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: 5
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 3763 times and has 4 replies Next Thread
Mitsaki
Member




Joined: Jul 26, 2011
Post Count: 62
Status: Offline
Reply to this Post  Reply with Quote 
confused HomeTexture

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 crying
[Aug 18, 2011, 6:22:01 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: 9426
Status: Offline
Reply to this Post  Reply with Quote 
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
[Aug 19, 2011, 8:25:45 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Mitsaki
Member




Joined: Jul 26, 2011
Post Count: 62
Status: Offline
Reply to this Post  Reply with Quote 
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?
[Aug 20, 2011, 7:23:30 AM] 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: 9426
Status: Offline
Reply to this Post  Reply with Quote 
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
[Aug 20, 2011, 11:44:42 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Mitsaki
Member




Joined: Jul 26, 2011
Post Count: 62
Status: Offline
Reply to this Post  Reply with Quote 
smile 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-"};

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));

}
}


To select a texture from Wall Textures catalogue. smile

Really thank you Puybaret. My project seems to work finally:)))
[Aug 23, 2011, 5:35:46 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 2024 Space Mushrooms - All rights reserved