Hello,
I would like to use the class room and modify the setFloorTexture, but the API says that my variable is of type HomeTexture. I am not very familiar with Java and I don't know how I can modify it...
Here is some of my code. What I have done already is to make an array of the values that I need and then save them in the variables. So, if str[16] = Beige_Tiles, I would like this value to be places in Floor_Texture and then use it to make my Room.
String Floor_Display = str[15];
HomeTexture Floor_Texture = str[16];
if (Floor_Display == "True") {
Parallelogram_Room.setFloorVisible(true);
Parallelogram_Room.setFloorTexture(Floor_Texture);
}
Any help would be very important [:((]
HomeTexture
This topic has been viewed 3931 times and has 4 replies
Re: HomeTexture
As you're "not very familiar with Java", you should probably rather learn the language first, shouldn't you? Once you know it better, you'll perfectly understand that a String instance can't match HomeTexture instance, and be able to change your program accordingly.
Emmanuel Puybaret, Sweet Home 3D creator
Re: HomeTexture
Yes, I know that I cannot do that. But I don't know how to use the type HomeTexture.
That is my problem. I don't understand if I should create a variable that is HomeTexture. eg.
TextureImage firstTexture = preferences.getTexturesCatalog().getCategories().get(0).getTexture(0);
Home Texture newHomeTexture = new HomeTexture(firstTexture texture); (something like that)
Parallelogram_Room.setFloorTexture(newHomeTexture);
But the thing is that I don't understand how to use the default libraries of Sweethome3D.
Like, if I want Beige_Tiles, how do I select them?
That is my problem. I don't understand if I should create a variable that is HomeTexture. eg.
TextureImage firstTexture = preferences.getTexturesCatalog().getCategories().get(0).getTexture(0);
Home Texture newHomeTexture = new HomeTexture(firstTexture texture); (something like that)
Parallelogram_Room.setFloorTexture(newHomeTexture);
But the thing is that I don't understand how to use the default libraries of Sweethome3D.
Like, if I want Beige_Tiles, how do I select them?
Re: HomeTexture
You shouldn't handle textures with strings but directly with some TextureImage, CatalogTexture or HomeTexture instances.
To get some ideas, have a look to the TextureListCellRenderer class used to display the CatalogTexture instances displayed in the list of textures displayed to the user.
To get some ideas, have a look to the TextureListCellRenderer class used to display the CatalogTexture instances displayed in the list of textures displayed to the user.
Emmanuel Puybaret, Sweet Home 3D creator
Re: HomeTexture
Thanks for the advice. After a while, I found the solution.
for anyone interested:
String[] Wall_Ceiling_Text = {"Beige_Tiles","Blue_Tiles", "Box_Tree", "Marble", "Roughcast",
"Small_Bricks","Small_Red_Bricks","Small_White_Bricks", "Stone",
"Stone-2-","Stone-3-"};
To select a texture from Wall Textures catalogue. [:)]
Really thank you Puybaret. My project seems to work finally:)))
for anyone interested:
String[] Wall_Ceiling_Text = {"Beige_Tiles","Blue_Tiles", "Box_Tree", "Marble", "Roughcast",
"Small_Bricks","Small_Red_Bricks","Small_White_Bricks", "Stone",
"Stone-2-","Stone-3-"};
Code: Select all
int m;
for (m=0; m<11; m++)
{
if(Left_Wall_Texture.equals(Wall_Ceiling_Text[m]))
{
// Set as Texture image the selected texture
TextureImage Left_Texture_Image = preferences.getTexturesCatalog().getCategories().get(2).getTexture(m);
Left_Wall.setLeftSideTexture(new HomeTexture (Left_Texture_Image));
}
}Really thank you Puybaret. My project seems to work finally:)))
Who is online
Users browsing this forum: No registered users and 2 guests