Is there a way in the SDK to load a specific material (*rmtl) file from disk and add it to the material table?
One idea was to use a scripted command from the SDK - I noticed in another topic, that there should be a command “RenderLoadMaterialFromFile”, but Rhino says “command not found”.
Of course it would also be good in the other direction - so I would like to export a specific material from the Rhino material table to a .rmtl file.
/** Loads a content from a library file and attaches it to a document, hence the returned
pointer is to a const content. Do not const-cast or attempt to delete the retured pointer.
To make changes to the content, call its BeginChange() method.
\see CRhRdkContent::BeginChange()
\param doc is the document to attach the loaded content to.
\param wszFullPath is the full path to the file to be loaded.
\return a pointer to the loaded content or nullptr if an error occurred. /
RHRDK_SDK const CRhRdkContent RhRdkLoadPersistentContentFromFile(const CRhinoDoc& doc, const wchar_t* wszFullPath, bool bForceDownloadTextures = false);
Unfortunately the ON_Material contains just default parameters, so something is missing. So what would be the best or recommended way to get material parameters like ambient color, reflectivity etc.?
Later on we are planning to deliver and support some custom materials edited and saved by our users. Basic properties (w/o textures and other high sophisticated stuff) are ok for the moment. It is not really for rendering purpose, the goal is supporting structured individual object display. We have some other ways of structuring objects than layers, so we cannot just use the Rhino way (materials for individual objects or layers).
So you are going to be assigning materials using some other property, and you would like to draw in the display? You should be able to do that in a conduit.
In the meanwhile I’m able to import the .rmtl files successfully.
I have already a special display variant and a conduit, that is able to handle different material assignments to objects.
Thanks for the help!