Modify the materials of a piece of furniture

This topic has been viewed 5734 times and has 4 replies
Thread status: Active
Questions about extending features and developing plug-ins [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

Modify the materials of a piece of furniture

Post by enkonyito »

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
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Modify the materials of a piece of furniture

Post by Puybaret »

[font=courier new]HomeMaterial[/font] objects are immutable like a few other ones in Sweet Home 3D like [font=courier new]BackgroundImagel[/font], [font=courier new]Sash[/font], [font=courier new]TextStyle[/font]... instances. But I guess your question isn't about the advantages of immutability, right?
As you're a programmer, you could call the [font=courier new]setModelMaterials[/font] in HomePieceOfFurniture class with a new array of [font=courier new]HomeMaterial[/font] instances. What is the problem to do that?
Emmanuel Puybaret, Sweet Home 3D creator
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

Re: Modify the materials of a piece of furniture

Post by enkonyito »

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
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

Re: Modify the materials of a piece of furniture

Post by enkonyito »

Is it normal that sometimes the [font=courier new]getModelMaterials()[/font] method only returns one material when there are several?
EnkoNyito
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

Re: Modify the materials of a piece of furniture

Post by enkonyito »

It's normal and I was able to adapt it to my plug-in. [:)]
EnkoNyito
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 1 guest