Get all materials from the Materials Panel for my custom dialog

Hi,
I am trying to create a command that would apply a chosen material in the Materials Panel to the chosen object.
When i run this command, I want to show a dialog that would list all the materials available in the Materials Panel.

public MaterialDialog()
{
    this.Text = "Select a Material";
    this.Width = 300;
    this.Height = 200;

    // Create a ComboBox to list all materials
    ComboBox materialList = new ComboBox();
    materialList.Dock = DockStyle.Fill;
    materialList.DropDownStyle = ComboBoxStyle.DropDownList;

    // Populate the ComboBox with materials from the library
    foreach (var material in RhinoDoc.ActiveDoc.Materials))
    {
        materialList.Items.Add(material);
    }
}

this is just an example.

The problem I am facing is RhinoDoc.ActiveDoc.Materials only gives me access to materials already applied to objects in the document. It doesn’t show all the materials from the Materials Panel.
Whats the solution to get all materials?

Thanks

Have you seen this:

1 Like

Indeed the correct table to access is RenderMaterials.

1 Like

Thanks @martinsiegrist and @nathanletwory . RenderMaterials is the answer indeed. Cheers