Normally the material collection attempts to hide “layer owned” and “image owned” materials because accessing them can crash the SketchUp application. (They were never meant to be directly manipulated.)
You seem to want to access an “image owned” material ? True?
If you want to use an “image owned” material you will need to create a normal “manager owned” material by creating a temporary ImageRep and assigning it as the texture for the new material. See the:SUImageGetImageRep() function
Does an “image owned” material means an image reference created by directly importing a jpg/png file into the project? But the missing material I mentioned is not this type of material.
The missing material is not listed in the “In Model” material list. But it can be picked by the “Sample Paint”, which is unlike the “image owned” material.
Could you please check the attachment? It is very simple, because I have removed all the other things and only kept several faces.
I checked your post on github, tried the ruby code in the post. It turns that the missing material is the type of image.
I will try to do some further tests with C API.
enum SUResult SUModelGetAllMaterials ( SUModelRef model,
size_t len,
SUMaterialRef materials,
size_t * count
)
Retrieves all the materials associated with a model object including those belonging to [SUImageRef] and [SULayerRef].
It makes the referencing simpler … but you must not assign any “image owned” or “layer owned” material to a SketchUp geometric entity. (The function you linked has a waring to this effect.)