Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | 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: 4
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 3085 times and has 3 replies Next Thread
jrmobile
Newbie



Россия
Joined: May 16, 2020
Post Count: 11
Status: Offline
Reply to this Post  Reply with Quote 
How do i Change Texture in Plugin?

Hi.
I need some help on my plugin.
I need to change pieceoffurniture texture to specific one from catalog.
I've found one in catalog and setting it with setTexture, but it requires HomeTexture object type.
How do i set it?

private void placeFurniture(float[] XYZRot, CatalogPieceOfFurniture furniture, String modelName, float ModelHeight, String CurrentWall) {
HomePieceOfFurniture model = furnitureController.createHomePieceOfFurniture(furniture);


TexturesCatalog texturesCatalog = userPreferences.getTexturesCatalog();
java.util.List<TexturesCategory> texturesCategories = texturesCatalog.getCategories();

TexturesCategory garderobCategory = null;
for (TexturesCategory category : texturesCategories) {
if (category.getName().matches("ЛДСП")) {
garderobCategory = category;
}
}


java.util.List<CatalogTexture> garderobTextures = garderobCategory.getTextures();
for (CatalogTexture texture : garderobTextures) {
if (texture.getName().matches("Гардеробная ЛДСП 31"))
model.setTexture(texture);
}


Would appreciate help on this item.
Thanks in advance.
[Aug 14, 2021, 7:20:27 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9172
Status: Offline
Reply to this Post  Reply with Quote 
Re: How do i Change Texture in Plugin?

Look how HomeTexture is instantiated in TextureChoiceComponent class.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Aug 16, 2021, 3:25:35 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
jrmobile
Newbie



Россия
Joined: May 16, 2020
Post Count: 11
Status: Offline
Reply to this Post  Reply with Quote 
Re: How do i Change Texture in Plugin?

Thank you.
Will try.
[Aug 16, 2021, 9:15:08 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
jrmobile
Newbie



Россия
Joined: May 16, 2020
Post Count: 11
Status: Offline
Reply to this Post  Reply with Quote 
Re: How do i Change Texture in Plugin?

I've made it.
If anyone need, i just leave it here

TexturesCatalog texturesCatalog = userPreferences.getTexturesCatalog();
java.util.List<TexturesCategory> texturesCategories = texturesCatalog.getCategories();

TexturesCategory garderobCategory = null;
for (TexturesCategory category : texturesCategories) {
if (category.getName().matches("ЛДСП")) {
garderobCategory = category;
}
}


java.util.List<CatalogTexture> garderobTextures = garderobCategory.getTextures();
for (CatalogTexture catalogTexture : garderobTextures)
{
if (catalogTexture.getName().matches(ldspColor)) {
HomeTexture texture = new HomeTexture(catalogTexture);
model.setTexture(texture);
}
}

[Aug 17, 2021, 12:59:35 PM] Show Printable Version of Post    View Member Profile    Send Private Message [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-2024 eTeks - All rights reserved