in a Grasshopper Python Component I would like to get a list of all materials in the document to read their RGB values (of the diffuse channel). My materials are Vray materials. There are no Rhino materials present in the file. I cannot use Rhino materials for this.
Rhino Version 6 SR26
Vray Version 3.60.03
I tried so far:
scriptcontext.doc.Materials-> not supported in GH
Rhino.RhinoDoc.ActiveDoc.Materials-> Holds the same number of materials as listed in the Vray Asset Editor UI. So I assume those are the Vray materials. But all
Rhino.RhinoDoc.ActiveDoc.Materials[i].DiffuseColorvalues are unrelated to the actual values set up in the Vray materials.
Rhino.RhinoDoc.ActiveDoc.RenderMaterials-> is empty
- I applied the Vray materials in Rhino to Brep objects. Loaded those objects into GH as Geometry and use them inside the GH Python Component to do
rhinoscriptsyntax.ObjectMaterialIndex(guid)-> always gives me -1. This works in normal Rhino Python Scripts, but not in the GH Python component.
Further tests I did
- Using the Vray Material from Project component to get to the material and plugging it into the GH Python Script component. Inside the script this gives me
-1, same when you plug it into a panel. Those Vray components hardly implement anything.
I know @clement did some work in this direction with Python Script. Did you ever get it to work in GH Python?
Any ideas are greatly appreciated. Thanks for your help.