|
Sweet Home 3D Forum » List all forums » » Forum: Developers » » » Thread: HomeTexture |
|
| Print at Dec 19, 2025, 8:33:24 PM | View all posts in this thread on one page |
| Posted by Mitsaki at Aug 18, 2011, 6:22:01 PM |
HomeTextureHello, 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 ![]() |
| Posted by Puybaret at Aug 19, 2011, 8:25:45 PM |
|
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 |
| Posted by Mitsaki at Aug 20, 2011, 7:23:30 AM |
|
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? |
| Posted by Puybaret at Aug 20, 2011, 11:44:42 PM |
|
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. ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by Mitsaki at Aug 23, 2011, 5:35:46 PM |
Re: HomeTextureThanks 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-"}; int m;To select a texture from Wall Textures catalogue. Really thank you Puybaret. My project seems to work finally:))) |
|
|
Current timezone is GMT Dec 19, 2025, 8:33:24 PM |