Print at Dec 19, 2025, 5:44:14 PM View all posts in this thread on one page
Posted by enkonyito at Jul 17, 2018, 12:47:18 AM
Modify the materials of a piece of furniture
In the HomeMaterial class , only methods for obtaining information about the color, name, shininess, or texture of a material are defined.

Is it possible to change the value of these parameters other than by manually accessing the Home.xml file?
When there is more than a hundred pieces of furniture, it's tiring.
----------------------------------------
EnkoNyito

Posted by Puybaret at Jul 17, 2018, 1:35:12 AM
Re: Modify the materials of a piece of furniture
HomeMaterial objects are immutable like a few other ones in Sweet Home 3D like BackgroundImagel, Sash, TextStyle... instances. But I guess your question isn't about the advantages of immutability, right?
As you're a programmer, you could call the setModelMaterials in HomePieceOfFurniture class with a new array of HomeMaterial instances. What is the problem to do that?
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator

Posted by enkonyito at Jul 18, 2018, 3:58:02 AM
Re: Modify the materials of a piece of furniture
HomeMaterial objects are immutable like a few other ones in Sweet Home 3D like BackgroundImagel, Sash, TextStylel... instances. But I guess your question isn't about the advantages of immutability, right?
No, I didn't know the advantages of immutability .

As you're a programmer, you could call the setModelMaterials in HomePieceOfFurniture class with a new array of HomeMaterial instances. What is the problem to do that?
Sometimes we miss out on the most obvious things.
I had not yet figured out how to use this method in my plugin.

Thanks
----------------------------------------
EnkoNyito

Posted by enkonyito at Jan 9, 2019, 12:40:32 AM
Re: Modify the materials of a piece of furniture
Is it normal that sometimes the getModelMaterials() method only returns one material when there are several?
----------------------------------------
EnkoNyito

Posted by enkonyito at Jan 24, 2019, 10:13:44 PM
Re: Modify the materials of a piece of furniture
It's normal and I was able to adapt it to my plug-in. smile
----------------------------------------
EnkoNyito