Features

Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Help  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 5
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 3232 times and has 4 replies Next Thread
rkv104
Newbie




Joined: Jun 22, 2013
Post Count: 19
Status: Offline
Reply to this Post  Reply with Quote 
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.
[May 28, 2016 1:33:28 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 5841
Status: Offline
Reply to this Post  Reply with Quote 
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 developer
[May 28, 2016 4:30:04 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.eteks.com [Link] Report threatening or abusive post: please login first  Go to top 
hobbyrv
Member




Joined: Oct 30, 2015
Post Count: 44
Status: Offline
Reply to this Post  Reply with Quote 
Re: How to replace one Texture with another Texture using code

How can I implement the Change Texture Plugin. I downloadedit but it doesn't do anything
[May 29, 2016 12:23:46 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
rkv104
Newbie




Joined: Jun 22, 2013
Post Count: 19
Status: Offline
Reply to this Post  Reply with Quote 
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...

please reply
[May 29, 2016 1:17:55 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
rkv104
Newbie




Joined: Jun 22, 2013
Post Count: 19
Status: Offline
Reply to this Post  Reply with Quote 
Re: How to replace one Texture with another Texture using code

I got the solution to my problem.. so don't bother my earlier query
[May 29, 2016 4:14:09 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2017 eTeks - All rights reserved