Joined: Jun 22, 2013
Post Count: 19
Status:
Offline
How to replace one Texture with another Texture using code
I wish to develop a plugin that will replace one texture with another texture in entire home model.
user will supply old texture name and new texture name. I wish to know how to create a HomeTexture if you know just the texture name as displayed in Available Texture List.
France
Joined: Nov 7, 2005
Post Count: 9426
Status:
Offline
Re: How to replace one Texture with another Texture using code
Textures in the textures catalog (i.e. Available Texture List in the user interface) are accessible by getTexturesCatalog method in preferences (see TextureChoiceComponent class) and each CatalogTexture instance has a name. To create a HomeTexture instance just use in parameter the instance of the CatalogTexture instance in the catalog with the name you want. In case you didn't know it, have also a look to Change Texture Plugin which might give you some ideas.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
Joined: Jun 22, 2013
Post Count: 19
Status:
Offline
Re: How to replace one Texture with another Texture using code
Thanks Puybaret,
I could write code to access CatalogTexture object using texture name. I am writing code to undo texture changes in my plugin. i can see that undo code gets called and it is able to invoke wall.setLeftSideColour() method where i am changing colour of the wall.
though this method is invoked the change is not reflected in 3d model display screen. if i double click on wall i could see that left side colour checkbox is checked..but colour change is not getting reflected in 3d display.......
what could be the problem...do i need to call some extra method besides calling settter methods for changing colour and textures..so that the changes are reflected in 3d model...