The SketchUp C API does not allow setting color for newly created layers
After creating a layer, I am unable to set its color
Do you have a code snippet to reproduce?
Are you trying to modify properties before you have attached the layer (or any entity) to the model?
Do you have a code snippet to reproduce?
Are you trying to modify properties before you have attached the layer (or any entity) to the model?
There's nothing special in the code, just created a new layer, but couldn't find an API interface to modify its material
Please provide a code example. We often find that we cannot reproduce due to subtle differences in how we try to recreate an issue from description alone vs what the reporter is doing.
Oh, I see, you're saying you were looking for a way to set the layer material.
You are right, we don't have a setter. Materials owner by layers have some unusual ownership that makes this quirkly. But you should be able to set the properties on the material retrieved from SULayerGetMaterial: https://extensions.sketchup.com/developers/sketchup_c_api/sketchup/struct_s_u_layer_ref.html#acb1bdd418a35ee45aa165f60a34f79dd`
Oh, I see, you're saying you were looking for a way to set the layer material.
You are right, we don't have a setter. Materials owner by layers have some unusual ownership that makes this quirkly. But you should be able to set the properties on the material retrieved from
SULayerGetMaterial: [https://extensions.sketchup.com/developers/sketchup_c_api/sketchup/struct_s_u_layer_ref.html#acb1bdd418a35ee45aa165f60a34f79dd`]
You mentioned that you can only retrieve material data but not change it. Is there another way to modify the material data of a layer?
The docs only says not to deallocate it:
The retrieved material object must not be deallocated by the caller since it is owned by the layer object.
Meaning not calling SUMaterialRelease on it.
You should be able to modify the material.