Also, I found that 2 materials CAN have the same name in a specific case: If you name one material Color_000 for example, it will be named like the Sketchup internal material of the same name: [Color_000]. (It seems that the SDK removes the brakets '[' and ']' when you get the name of an internal material with SUMaterialGetName()).
Latest posts made by Marc477
-
RE: Entity ID and Materials!
-
RE: Entity ID and Materials!
Ok thank you! I though 2 materials could have the same name.
-
RE: Entity ID and Materials!
I don't really understand how it is possible to have no persistent ID. In the skp file: how each face knows to which material it is bound? I supposed there is an ID saved with the face that tells which material is linked to the face.
-
RE: Entity ID and Materials!
Then how can I find: starting from a ruby API material: the corresponding SDK material ?
-
Entity ID and Materials!
I discovered that the entityID (for materials) is not the same when getting it from the Ruby API or the cpp SDK:
Example (using the same material in both example)
Ruby API
//aMat is a material aMat.entityID //Returns 183
Cpp SDK
//aMat is a SUMaterialRef int id; SUEntityRef entity = SUMaterialToEntity(aMat ); SUEntityGetID(entity , &id); uint matID = (uint) id; //Returns 201
I tested this using a custom attribute dict to make sure it is the same material in both cases, it seems that the material in the SDK has always an ID of +18, and if I don't cast it to a uint, its value is always negative.
Why ?
-
RE: SDK: Get Images data
@tt_su said:
Not that the API provides. You could extract to a temp file and read it.
I'm not sure how I am supposed to extract the image to a file, if I cannot read its data.
-
SDK: Get Images data
In the Sketchup c++ SDK:
What is the equivalent of SUTextureGetImageData for a SUImageRef? How can I access images pixel data?
Thank you
-
RE: Material is deleted when cloning
Thank you, I fixed my problem by processing only materials used in the model:
aMat = Sketchup.active_model.materials.current if aMat != nil and Sketchup.active_model.materials.include?(aMat) ... end
-
Material is deleted when cloning
Can someone explains why this happens ?
test = Sketchup.active_model.materials.current #<Sketchup;;Material;0x8a19480> test2 = test.clone #<Deleted Entity;0x8a19278>
I'd like to store a material in a class variable to use it later, if I do not clone, and the selection change, test will not contain the previous material I want, but the new one selected.
Thank you