This topic has been viewed 5667 times and has 3 replies
Thread status:
Active
Questions about extending features and developing plug-ins [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
jrmobile
Posts: 11 Joined: Sat May 16, 2020 9:20 pm
Country: Россия
Post
by jrmobile » Sat Aug 14, 2021 7:20 pm
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?
Code: Select all
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.
Puybaret
Posts: 9440 Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:
Post
by Puybaret » Mon Aug 16, 2021 3:25 pm
Look how HomeTexture is instantiated in TextureChoiceComponent class.
Emmanuel Puybaret, Sweet Home 3D creator
jrmobile
Posts: 11 Joined: Sat May 16, 2020 9:20 pm
Country: Россия
Post
by jrmobile » Mon Aug 16, 2021 9:15 pm
Thank you.
Will try.
jrmobile
Posts: 11 Joined: Sat May 16, 2020 9:20 pm
Country: Россия
Post
by jrmobile » Tue Aug 17, 2021 12:59 pm
I've made it.
If anyone need, i just leave it here
Code: Select all
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);
}
}
Users browsing this forum: No registered users and 2 guests