I just recently realized that one can override the material color in an instance of a component without affecting other instances.
Is there a way, when getting the front material for the component definition in the C API, to see that it is just the default, and hasn’t been set to anything?
(1) Definitions and instances (including groups) do not have a “front material”. Only faces have a separate front and back material.
(2) The material assigned to a definition is “special”. It may only be used by the SketchUp engine for special highlighting purposes.
I just tested setting the material for a group’s definition, and it splatted SU2016, when I attempted to copy a group instance using the MoveTool + CTRL key. (The group instance itself did not have a material applied.)
I would suggest only setting the material on instances (component or group.)
If there is no material setting, perhaps nil or the C equivalent (NULL) may be returned ?
… checking, …, …
YES, I was correct. You upcast the instance to a SUDrawingElement type, and use the SUDrawingElementGetMaterial() function, which says:
Returns … SU_ERROR_NULL_POINTER_OUTPUT if material is NULL