Download

Online

Gallery

Blog

  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: 14
Posts: 14   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 2593 times and has 13 replies Next Thread
enkonyito
Advanced Member
Member's Avatar


Joined: May 28, 2015
Post Count: 553
Status: Offline
Reply to this Post  Reply with Quote 
Add another 3D model to an existing 3D model?

Since Sweet Home 3D 6.5, there is a method to modify the 3D model of a piece of furniture.

Is it possible to modify this model by adding another one?
This modified 3D model (possibly a clone) would only be visible in a 3D preview.
----------------------------------------
EnkoNyito
[Sep 12, 2021, 12:23:03 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: 7904
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add another 3D model to an existing 3D model?

The setModel method requires a parameter of Content type, like URLContent class. The supported content are the ones cited in the furniture import wizard, i.e. OBJ, 3DS, DAE or a ZIP file containing a file at this format. I don’t see how you could add a second model with these restrictions, unless you generate a model file containing both models.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Sep 13, 2021, 2:21:38 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
enkonyito
Advanced Member
Member's Avatar


Joined: May 28, 2015
Post Count: 553
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add another 3D model to an existing 3D model?

When I select a light and added sources manually, only the light is taken into account when exporting the selection in OBJ format.
If I only select the sources added manually, the .obj and .mtl files are empty when exporting the selection in OBJ format.

How to bypass the restriction in the WriteNode method of the OBJWriter class?
...else if (node instanceof Shape3D) {
Shape3D shape = (Shape3D)node;
Appearance appearance = shape.getAppearance();
RenderingAttributes renderingAttributes = appearance != null
? appearance.getRenderingAttributes() : null;
if (shape.numGeometries() >= 1
&& (renderingAttributes == null
|| renderingAttributes.getVisible())) {
...
// Start a new object at OBJ format
this.out.write("g " + objectName + "\n");
...

----------------------------------------
EnkoNyito
[Sep 16, 2021, 3:45:44 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
enkonyito
Advanced Member
Member's Avatar


Joined: May 28, 2015
Post Count: 553
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add another 3D model to an existing 3D model?

The setModel method requires a parameter of Content type, like URLContent class. The supported content are the ones cited in the furniture import wizard, i.e. OBJ, 3DS, DAE or a ZIP file containing a file at this format. I don’t see how you could add a second model with these restrictions, unless you generate a model file containing both models.

Since it is possible to import an object into SH3D from a resource (com/eteks/sweethome3d/io/resources/lightSource.obj), how to use the URLContent class ?

The goal would be to preload a scene with the model of a light and those of these sources before displaying them in the 3D preview.
----------------------------------------
EnkoNyito
[Sep 25, 2021, 4:39:10 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: 7904
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add another 3D model to an existing 3D model?

Look in DefaultFurnitureCatalog how the subclass ResourceURLContent is used.
But as lightSource.obj may be in different places (in a file during development, then in Furniture.jar or SweetHome3D-x.y.jar during deployment and finally in a SH3D file when saved), I would suggest to use a copy of that file in your plug-in.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Sep 26, 2021, 9:30:15 AM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
enkonyito
Advanced Member
Member's Avatar


Joined: May 28, 2015
Post Count: 553
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add another 3D model to an existing 3D model?

For the first version of the plugin, I used this location for the lightSource.obj file.
final Content sourceContent = new ResourceURLContent (DefaultFurnitureCatalog.class, "resources/lightSource.obj");


Taking inspiration from your ShapeGenerator plug-in, I get these results.
ViewLightSources_firstOpening.jpg
ViewLightSources_secondOpening.jpg

We see that when using the plug-in for the first time, a white box serves as a 3D model of the sources while for other uses the correct model is displayed in the 3D preview.

I can publish this version so that you can suggest some improvements.
----------------------------------------
EnkoNyito
[Sep 28, 2021, 5:06:02 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: 7904
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add another 3D model to an existing 3D model?

As said before, I would suggest not to rely on such a resource in Sweet Home 3D (they can change like icons recently), and would copy lightSource.obj in your plug-in.
You could even use your own shape naming it in the OBJ file with a prefix equal to ModelManager.LIGHT_SHAPE_PREFIX to ensure it has the same behavior as lightSource.obj.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Sep 28, 2021, 7:14:10 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
enkonyito
Advanced Member
Member's Avatar


Joined: May 28, 2015
Post Count: 553
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add another 3D model to an existing 3D model?

The ViewLightSources plug-in is available.
----------------------------------------
EnkoNyito
[Sep 30, 2021, 2:04:25 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
YGYL
Member
Member's Avatar


Joined: Feb 5, 2013
Post Count: 98
Status: Offline
Reply to this Post  Reply with Quote 
rose Re: Add another 3D model to an existing 3D model?

Tested and available
It would be perfect if the coordinates of the light source of the object can be adjusted in real time
[Oct 1, 2021, 2:09:05 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
enkonyito
Advanced Member
Member's Avatar


Joined: May 28, 2015
Post Count: 553
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add another 3D model to an existing 3D model?

ViewLightSources-1.1.sh3p
- transparency of the previewed light
----------------------------------------
EnkoNyito
[Oct 2, 2021, 5:05:31 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 14   Pages: 2   [ 1 2 | Next Page ]
[ 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-2021 eTeks - All rights reserved