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: 55
Posts: 55   Pages: 6   [ Previous Page | 1 2 3 4 5 6 | Next Page ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 87312 times and has 54 replies Next Thread
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 5841
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export to HTML5 plug-in

I'm glad you found some use for the Home.xml export. Do you plan to make your script available to the public? That would be a nice way to import a home in Blender with lights.

I don't know whether the HTML viewer will support some lighting, but you can already get in Home.xml file the light information you look for by changing some flags in the plug-in source code included in the sh3p file (or reusing plug-in classes in an other plug-in). The easiest way should be to remove HomeXMLFileRecorder.INCLUDE_VIEWER_DATA flag (and HomeXMLFileRecorder.REDUCE_IMAGES if you don't want images to be resized) in the getHomeRecorder method the end of the ExportHTML5PluginAction inner class of com.eteks.sweethome3d.plugin.exporthtml5.ExportHTML5Plugin. Then, rebuild the plug-in with the help of Plug-in developer's guide.

The XML format of Home.xml shouldn't change in the future, it will even become part of the updated format of Sweet Home 3D files. In the coming versions 5.x, the idea is to include the Home.xml file along with the existing Home Java serialized entry in .sh3d files + the ability to parse both entries even if they describe the same com.eteks.sweethome3d.model.Home instance. Then probably in versions 6+, the default Sweet Home 3D files will have a .sh3x extension and use a file format that will contain a Home.xml entry but no Home entry, to avoid slowing down Save operation. This transition will help users to read .sh3x files even with Sweet Home 3D version 5.3 and superior. Of course, the ability to read Home Java serialized entry included in .sh3d files will be kept to be able to read all files made with previous versions of Sweet Home 3D.
The XML writer added to Sweet Home 3D 5.3 will be very close to the one in Export to HTML5 plug-in, using the same elements and attributes syntax when its INCLUDE_VIEWER_DATA flag is not set. Why only "very close" and not "the same as"? Because the plug-in needs to simplify the exported data to match SweetHome3DJS features, i.e. its inability to read 3D models at 3DS and DAE format as well as to compute walls and rooms in 3D. Quickly said, at the moment, the plug-in is "only" able to read 3D models at OBJ+MTL format listed in Home.xml and place them at the good location. Walls, floors, ceilings, holes in the ground and 3D labels are all precomputed by the plug-in in the HomeStructure/Home.obj entry which is displayed as one 3D object by SweetHome3DJS. This structure file and exporting only in OBJ format is not needed in Sweet Home 3D itself, that's why its XML writer will not perform these operations but will keep the same XML syntax, except for the structure attribute of the home.
From the various tests I run with Blender, it seems that Blender supports better OBJ+MTL format than 3DS and DAE formats (but maybe it was improved recently). Blender is of course unable to compute in 3D the walls and rooms of a Sweet Home 3D file. So I guess that the format I chose for SweetHome3DJS is the best choice for Blender too, and you would prefer that the way 3D models and home structure are exported won't change! I'll keep that in mind and if needed I'll create an other Export to XML + OBJ plug-in. That could even become a Save option in Sweet Home 3D if this format becomes really useful for many people. Keep also in mind that DAE/Collada format is also able to store lights, so if you need only OBJ files + lights, it could be more logical to add Export to DAE format option (even if this will require more work from me).
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Jun 3, 2016 10:39:56 AM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.eteks.com [Link] Report threatening or abusive post: please login first  Go to top 
okh
Advanced Member




Joined: May 12, 2013
Post Count: 1287
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export to HTML5 plug-in

..In the coming versions 5.x, the idea is to include the Home.xml file along with the existing Home Java serialized entry in .sh3d files...
Does this mean the .sh3d file will contain all files needed by the export to html javascripts for the canvas? ok
[Jun 3, 2016 11:33:55 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 
lcgamboa
Newbie



Brasil
Joined: May 31, 2016
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export to HTML5 plug-in

Of course, I will distribute the script in GLP, when a finish it. (there are some bugs to fix yet)

I asked about lighting support in HTML viewer because the webgl has support to it. There are some nice examples of webgl lighting on the web.

Looking the plugin code, I think that remove HomeXMLFileRecorder.INCLUDE_VIEWER_DATA flag, only for HomeLight in my case, will solve the problem.

About the SweetHome3DJS and SweetHome3D XML format is exactly what had thought.

I agree that SweetHome3DJS XML format (added with the lamp color and power ) plus the obj+mtl files is the best choice for blender export.

About export in DAE/Collada format for now I think you should focus on sweethome 3d. After you import the file XML+obj+mtl in blender(or other software) they can be converted to other formats.

Thank you for the help.
[Jun 3, 2016 4:02:41 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: 5841
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export to HTML5 plug-in

Does this mean the .sh3d file will contain all files needed by the export to html javascripts for the canvas?
It's one of my goals at the end, but that requires to port to JavaScript the classes DAELoader, Max3DSLoader for DAE/3DS support, and Wall3D, Room3D,Ground3D and other model classes to manage the structure of a home. Porting these 5000 lines of code will require probably two weeks of work and will avoid to use the Export to HTML5 plug-in, but without adding any new feature to the end user.
I wonder if it wouldn't be better to be able to add and arrange furniture in the plan first. This second task requires more work but would bring some nice features in SweetHome3DJS...
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Jun 3, 2016 7:09:29 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.eteks.com [Link] Report threatening or abusive post: please login first  Go to top 
okh
Advanced Member




Joined: May 12, 2013
Post Count: 1287
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export to HTML5 plug-in

Absolutely. But as an end goal for some time in a distant future, it would be nice if the (super great) HTML export could use standard .sh3d files. But urgent, not at all. The HTML export works very nicely as is.
[Jun 3, 2016 7:51:20 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 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 5841
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export to HTML5 plug-in

As I received an other request similar to lcgamboa's one, I finally programmed the additional Export to XML/OBJ plug-in (see links at end of message) that proposes the Tools > Export to XML/OBJ format menu item able to generate a ZIP file that contains:
- Home.xml entry with all the data of the edited home at XML format (including furniture visible or not, walls, rooms, texts, dimensions lines, polylines...)
- HomeStructure/Home.obj that contains the home structure computed by Sweet Home 3D classes (wall, rooms, ground and 3D labels)
- 3D models only at OBJ+MTL format (models at other format will be converted)
- furniture icons, texture images and other images.

This generated ZIP file is compatible with Sweet Home 3D JS viewer (it just contains more data that the home file generated by Export to HTML5 plug-in, and will be readable with Sweet Home 3D 5.3 too, once the upcoming changes in .sh3d file format will be programmed.
The XML schema used in the Home.xml entry should be quite straightforward. Its elements and attributes match com.eteks.sweethome3d.model API (except for the classes starting by Home which is omitted, like HomeLight class which becomes light element). An exported Home instance will have an XML structure looking like this:

<home>
<furnitureVisibleProperty/>
<property/>
<environment/>
<compass/>
<observerCamera/>
<camera/>
<level/><level/>
<pieceOfFurniture/><doorOrWindow/><light/>
<wall/><wall/><wall/>
<room/><room/>
<polyline/><polyline/>
<dimensionLine/><dimensionLine/>
<label/>
</home>

At the moment, the only elements which have an id are level and wall elements because they can be referenced in other elements. Lengths are in centimeters and angles in radians. If needed, look at com.eteks.sweethome3d.plugin.exportxml.HomeXMLExporter class source code included in the plug-in or ask for more information in this forum. A more complete description of the schema will be available with next Sweet Home 3D release.

This plug-in reuses the same classes as Export to HTML5 plug-in, that's why it uses the same version number 1.1.

Hope you'll find all kind of use for your Sweet Home 3D data smile

Download links for Export to XML/OBJ plug-in:
Export to XML/OBJ plug-in 1.1 was released on 06/07/2016
Export to XML/OBJ plug-in 1.2 was released on 12/13/2016
Export to XML/OBJ plug-in 1.3 was released on 10/10/2017
----------------------------------------
Attachment Home.xml (14808 bytes) (Download count: 70) (Example of exported home at XML format)

----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
----------------------------------------
[Edit 3 times, last edit by Puybaret at Oct 10, 2017 10:16:01 PM]
[Jun 7, 2016 2:00:34 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.eteks.com [Link] Report threatening or abusive post: please login first  Go to top 
lcgamboa
Newbie



Brasil
Joined: May 31, 2016
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export to HTML5 plug-in

Puybaret thank's for the Export to XML/OBJ plug-in!

Now I have to change my blender import script to work with the new XML schema. With the new XML the light will can be edited in Sweet Home and blender will be used only as viewer.

I published the python script to import SweetHome 3D HTML5 to blender in GitHub: SweetHome3D HTML5 to Blender importer. The script creates one object for each obj file (leaving easier editing of objects in blender), this is the the main difference to use the obj file generated by SweetHome 3D.
[Jun 7, 2016 10:37: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 
avamonster
Newbie



Russia
Joined: Sep 15, 2016
Post Count: 1
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export to HTML5 plug-in

Hi all,

This thing does not work in Chrome out of the box.

to run the exported ViewHome*.html in Chrome browser, you have to start chrome.exe with "--allow-file-access-from-files" commandLine option (no quotes).

Else it will just stuck on "loading model" message.

Probably it's good to add info on that to blog/manual e.t.c., or m.b. even add a message on local file access to ViewHome.html.

M.b. it's possible to somehow detect that accessing files from files is disabled right from the page script, and display corresponding message.

WBR,
AVAmonster
[Sep 15, 2016 5:20:19 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
ersteinmal
Newbie




Joined: Oct 14, 2016
Post Count: 2
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export to HTML5 plug-in

I am sorry.

But in Opera 40.0.2308.81
The Html file start to load *.zip and stops there.

Regards Carsten
[Oct 14, 2016 5:41:33 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 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 5841
Status: Offline
Reply to this Post  Reply with Quote 
Re: Export to HTML5 plug-in

Just tried this version of Opera under Windows 10 and Mac OS X, and I didn't notice any issue...
Did you try with another browser? Maybe your file is very big.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Oct 14, 2016 6:15:16 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.eteks.com [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 55   Pages: 6   [ Previous Page | 1 2 3 4 5 6 | 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-2017 eTeks - All rights reserved