Features

Download

Online

Gallery

Blog

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




Joined: Nov 24, 2015
Post Count: 5
Status: Offline
Reply to this Post  Reply with Quote 
JAVA: How to change the default furniture catalog?

Hello guys,

I want to modify the default folders and furniture, that are displayed on startup. I have set up Sweet Home 3D in Eclipse. I am fairly new to Java, I must confess.

What I have found so far is this post: http://www.sweethome3d.com/support/forum/viewthread_thread,2422#10982 , but it explains, how to remove the default folders completely by editing the build.xml file.

The previously mentioned post let me to the location, where I could change the folder's and furniture's names:

D:\Path_To_Sweet_Home_3D\SweetHome3D-5.1-src\src\com\eteks\sweethome3d\io

You can also find the DefaultFurnitureCatalog class at this location.

Could you please point me in the right direction? What do I have to do to add my own furniture models to the default menu? Is there another config file? In which folder do I have to put the model files?

Greetings,

Sweeto
[Nov 24, 2015 4:41:59 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Sweeto
Newbie




Joined: Nov 24, 2015
Post Count: 5
Status: Offline
Reply to this Post  Reply with Quote 
Re: JAVA: How to change the default furniture catalog?

Ok, I've finally found the right file, where I can set the path of the default furniture files. Apparently all furniture files, that have been added in this file, have the extension ".obj" (exception: the light sources are also categorized as furniture, but they don't have an obj-file).

1. All files, that are nessesary to change the default categories/folders and default furniture are in this folder or in it's subfolders:

Path_To_Sweet_Home_3D\SweetHome3D-5.1-src\src\com\eteks\sweethome3d\io


1.1 All of the model files (.obj) and preview images (.png) are at this location:

Path_To_Sweet_Home_3D\SweetHome3D-5.1-src\src\com\eteks\sweethome3d\io\resources


1.2 All of the contributed model files and preview images are at this location:

Path_To_Sweet_Home_3D\SweetHome3D-5.1-src\src\com\eteks\sweethome3d\io\resources\contributions


2. Some files from the io-folder (see above):
2.1 ContributedFurnitureCatalog.properties (used to set the path, size,...)
id#1=Sheep#spiralStaircase
name#1=Spiral staircase
tags#1=
category#1=Miscellaneous
icon#1=/com/eteks/sweethome3d/io/resources/contributions/spiralStaircase.png
model#1=/com/eteks/sweethome3d/io/resources/contributions/spiralStaircase.obj
width#1=148.4
depth#1=133.1
height#1=271
dropOnTopElevation#1=-1
movable#1=false
doorOrWindow#1=false
staircaseCutOutShape#1=M0,0.35 h0.47 l0.375,-0.35 l0.088,0.118 A0.5,0.5 0 1,1 0,0.35 z
creator#1=Sheep

2.2 ContributedFurnitureCatalog_de.properties (language file, used for translation only)
name#1=Wendeltreppe
tags#1=
category#1=Verschiedenes


2.3 DefaultFurnitureCatalog.properties

id#1=eTeks#bed140x190
name#1=Bed 140x190
tags#1=
category#1=Bedroom
icon#1=/com/eteks/sweethome3d/io/resources/bed140x190.png
model#1=/com/eteks/sweethome3d/io/resources/bed140x190.obj
width#1=158
depth#1=208
height#1=70
dropOnTopElevation#1=48
movable#1=true
doorOrWindow#1=false
creator#1=eTeks

2.4 DefaultFurnitureCatalog_de.properties

name#1=Bett 140x190
tags#1=
category#1=Schlafzimmer

[Nov 26, 2015 10:00:53 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Sweeto
Newbie




Joined: Nov 24, 2015
Post Count: 5
Status: Offline
Reply to this Post  Reply with Quote 
Re: JAVA: How to change the default furniture catalog?

The function readDefaultFurnitureCatalogs in
Path_To_Sweet_Home_3D\SweetHome3D-5.1-src\src\com\eteks\sweethome3d\io\DefaultFurnitureCatalog.java
reads the default furniture catalog, the contributed furniture catalog and the additional furniture catalog:

private void readDefaultFurnitureCatalogs(UserPreferences preferences,
Map<FurnitureCategory, Map<CatalogPieceOfFurniture,
Integer>> furnitureHomonymsCounter,
List<String> identifiedFurniture) {
// Try to load com.eteks.sweethome3d.io.DefaultFurnitureCatalog property file from classpath
String defaultFurnitureCatalogFamily = DefaultFurnitureCatalog.class.getName();
readFurnitureCatalog(defaultFurnitureCatalogFamily,
preferences, furnitureHomonymsCounter, identifiedFurniture);

// Try to load com.eteks.sweethome3d.io.ContributedFurnitureCatalog property file from classpath
String classPackage = defaultFurnitureCatalogFamily.substring(0, defaultFurnitureCatalogFamily.lastIndexOf("."));
readFurnitureCatalog(classPackage + "." + CONTRIBUTED_FURNITURE_CATALOG_FAMILY,
preferences, furnitureHomonymsCounter, identifiedFurniture);

// Try to load com.eteks.sweethome3d.io.AdditionalFurnitureCatalog property file from classpath
readFurnitureCatalog(classPackage + "." + ADDITIONAL_FURNITURE_CATALOG_FAMILY,
preferences, furnitureHomonymsCounter, identifiedFurniture);
}

[Nov 26, 2015 1:34:17 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Sweeto
Newbie




Joined: Nov 24, 2015
Post Count: 5
Status: Offline
Reply to this Post  Reply with Quote 
Re: JAVA: How to change the default furniture catalog?

At first I have added the obj- and png-files to this folder:

Path_To_Sweet_Home_3D\SweetHome3D-5.1-src\src\com\eteks\sweethome3d\io\resources


And edited the language property file and the normal property file (see above) in:

Path_To_Sweet_Home_3D\SweetHome3D-5.1-src\src\com\eteks\sweethome3d\io

But it did not work.


Then I have added the obj and png-files to this folder:

Path_To_Sweet_Home_3D\SweetHome3D-5.1-src\classes\com\eteks\sweethome3d\io\resources


And edited the property files in:

Path_To_Sweet_Home_3D\SweetHome3D-5.1-src\classes\com\eteks\sweethome3d\io


Now it works! :)

What is the right way to do this? Do I really have to add the obj and png files in the classes folder (it doesn't make sense to me)? I am sorry, for those basic programming questions.
[Nov 26, 2015 2:55:33 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
digitaltrails
Member



New Zealand
Joined: Dec 28, 2014
Post Count: 45
Status: Offline
Reply to this Post  Reply with Quote 
Re: JAVA: How to change the default furniture catalog?

The properties and resources in the source (src) hierarchy are copied to the build output class hierarchy when the software is built by the build process. You would need to run ant to do a build.
[Nov 26, 2015 11:21:13 PM] Show Printable Version of Post    View Member Profile    Send Private Message    https://www.flickr.com/photos/digitaltrails/ [Link] Report threatening or abusive post: please login first  Go to top 
digitaltrails
Member



New Zealand
Joined: Dec 28, 2014
Post Count: 45
Status: Offline
Reply to this Post  Reply with Quote 
Re: JAVA: How to change the default furniture catalog?

The properties and resources in the source (src) hierarchy are copied to the build output class hierarchy when the software is built by the build process. You would need to run ant to do a build.


I should have mentioned - see "copy todir" in the build.xml file.
[Nov 26, 2015 11:23:30 PM] Show Printable Version of Post    View Member Profile    Send Private Message    https://www.flickr.com/photos/digitaltrails/ [Link] Report threatening or abusive post: please login first  Go to top 
Sweeto
Newbie




Joined: Nov 24, 2015
Post Count: 5
Status: Offline
Reply to this Post  Reply with Quote 
Re: JAVA: How to change the default furniture catalog?

Hello digitaltrails,

thank you for your answer.

I have watched this video to understand how to build a project with ant: https://www.youtube.com/watch?v=qOhfl9gayB8

The options for an ant build are in the "build.xml"-file, which is located in this folder:

Path_To_Sweet_Home_3D\SweetHome3D-5.1-src\

The "build.xml"-file does not contain any command, that will tell ant to copy files to this folder (the default output folder of my eclipse project):

Path_To_Sweet_Home_3D\SweetHome3D-5.1-src\classes

Instead ant copies the files to this folder (the build folder gets deleted at the end of the build process):

Path_To_Sweet_Home_3D\SweetHome3D-5.1-src\build\classes

I could add
<copy todir="classes\com\eteks\sweethome3d\io\resources">
to the "build.xml" file to copy the furniture files (png, obj). Is this the right way to do it? Why doesn't the default ant build copy the files?

Have a nice weekend!

Greetings,

Sweeto
[Nov 27, 2015 5:02:56 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
digitaltrails
Member



New Zealand
Joined: Dec 28, 2014
Post Count: 45
Status: Offline
Reply to this Post  Reply with Quote 
Re: JAVA: How to change the default furniture catalog?

I assume you're using eclipse. The directory SweetHome3D-5.1-src/classes is used by eclipse to store class files it compiles. This is used by internally by eclipse, and also when running/debugging from within eclipse. Eclipse automatically includes the Project's source folders in it's run class paths, so it it is unnecessary to copy source resources and property files to eclipse's class folder.

If you wanted to use eclipse's class folder outside of eclipse, you could do what eclipse does, and add the src folder to the class path of your java command (then both will searched).

If I wanted to run outside of eclipse, I would build with ant and create all the necessary jars in the output build folder, then put the jars on the classpath (using the run scripts in the install folder as a guide). In practice, I just copy jars from the Ant build into my original "official" SH3D installation replacing the official ones with my own.

Note: Ant builds are a separate thing from eclipse's automatic compiles. Eclipse uses it's own compiler, own dependency tracking, and own classpath definitions, all normally quite separate from Ant's.
Plus eclipse also has it's own separate run/debug-time classpaths. Keeping eclipse and Ant in agreement is a headache - various tools are available to help better integrate eclipse with external build tools such as Ant, but none are completely perfect. It's not uncommon to burn time on sorting out dependency problems when eclipse and the external build tools get subtlety out of sync.


Hello digitaltrails,

thank you for your answer.

I have watched this video to understand how to build a project with ant: https://www.youtube.com/watch?v=qOhfl9gayB8

The options for an ant build are in the "build.xml"-file, which is located in this folder:

Path_To_Sweet_Home_3D\SweetHome3D-5.1-src\

The "build.xml"-file does not contain any command, that will tell ant to copy files to this folder (the default output folder of my eclipse project):

Path_To_Sweet_Home_3D\SweetHome3D-5.1-src\classes

Instead ant copies the files to this folder (the build folder gets deleted at the end of the build process):

Path_To_Sweet_Home_3D\SweetHome3D-5.1-src\build\classes

I could add
<copy todir="classes\com\eteks\sweethome3d\io\resources">
to the "build.xml" file to copy the furniture files (png, obj). Is this the right way to do it? Why doesn't the default ant build copy the files?

Have a nice weekend!

Greetings,

Sweeto

[Nov 29, 2015 4:26:42 AM] Show Printable Version of Post    View Member Profile    Send Private Message    https://www.flickr.com/photos/digitaltrails/ [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-2017 eTeks - All rights reserved