FR
Joined: Jun 25, 2017
Post Count: 54
Status:
Offline
Debug & sweethome3D.min.js
Hi all,
I succeed in building all the ant projects of sweethomeJS repo. Now, I play with the jsp/Tomcat demo on my machine. Neverthetless, I notice that the main js files have been minimized for performance optimization I suppose. As I want to had some code in the software, I would greatly prefer to use a non minified version, with existing code comments.
For this, I look at the build.xml file and I remove the following lines :
From the little I understand, this command minified sweethome3d.min.js by overwritting the current file.
Nevertheless, when I remove these lines, the sweethome3d.min.js only contains very few lines of code unlike the 100,000 lines of code that should be present.
France
Joined: Nov 7, 2005
Post Count: 9421
Status:
Offline
Re: Debug & sweethome3D.min.js
You should also remove or change the <concat> element which adds a header to sweethome3d.min.js.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
FR
Joined: Jun 25, 2017
Post Count: 54
Status:
Offline
Re: Debug & sweethome3D.min.js
Hi Puybaret
I notice that in the Build.xml, for the .war build, the SweetHome3D.jar is also generated. What for ? Is it usefull for the jsonline ? I would believe not.. But then, what for?
FR
Joined: Jun 25, 2017
Post Count: 54
Status:
Offline
Re: Debug & sweethome3D.min.js
Ok, I see.
I have some difficulties in understanding how writeHomeEdits.jsp is called and how data are transfered. From what I saw, each time I modify the home in the browser, this script is called in JS to save the updates on server/disk :
It seems that only updates are sent. But the saved sh3D file on disk contains all data. I do not see how data in the file are updated. Option 1 : by adding updates at the end of the sh3D ? Option 2 : by loading the old sh3D in the JSP + applying new updates from the jsp + saving the new sh3D ?
France
Joined: Nov 7, 2005
Post Count: 9421
Status:
Offline
Re: Debug & sweethome3D.min.js
The option 2 is the right option and is performed by the statements of writeHomeEdits.jsp from line 69 to 75. I would suggest to log jsonEdits in writeHomeEdits.jsp, it will help you understand what updates consist of and you’ll easily recognize the fields of undoable edits and their value.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
France
Joined: Nov 7, 2005
Post Count: 9421
Status:
Offline
Re: Debug & sweethome3D.min.js
I already gave you some clues here. If you gather all the images and 3D models referenced by a Home.xml entry in a ZIP file with a .sh3d extension, you’ll get a SH3D file (something like what is done in DefaultHomeOutputStream class but which is not programmed in JavaScript at the moment), but I don’t see the interest to program a solution which doesn’t require a server. If people want to use Sweet Home 3D locally, they should rather use the downloadable desktop version which offers more features, and I find that handling saved files in download directory is not user friendly, because each time a user will save his home, it will create a new file. It’s interesting for an export once in a while but not if a user saves every 5 minutes, don’t you think?
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
FR
Joined: Jun 25, 2017
Post Count: 54
Status:
Offline
Re: Debug & sweethome3D.min.js
It depends. From a production point of view, a Tomcat server is costly. At present time, each time a user modifies something in the house, the writehome.jsp process is launched. This is a quite huge machinery for doing almost nothing. So, with 10 users at the same time, I'm not sure the server will survive the heavy load.
Moreover, some users do not really want their data to stay on an unknown server.
For all of these reasons, the full JS is an interesting option.
If the user wants to save his plans every 5 minutes, it will create a new file in the download directory. Ok, not really sexy, but not really problematic.
France
Joined: Nov 7, 2005
Post Count: 9421
Status:
Offline
Re: Debug & sweethome3D.min.js
It depends. From a production point of view, a Tomcat server is costly. At present time, each time a user modifies something in the house, the writehome.jsp process is launched. This is a quite huge machinery for doing almost nothing. So, with 10 users at the same time, I'm not sure the server will survive the heavy load.
It doesn't require so much power on a server (by the way, to avoid confusion, the page is not writehome.jsp but writeHomeEdits.jsp). There have been already more than 250 user sessions at the same time on sweethome3d.com server with 10 calls to writeHomeEdits.jsp per second peaks and the CPU load kept low. The good thing is that you may restart the JSP server without breaking the update process.
Moreover, some users do not really want their data to stay on an unknown server.
I recommend to these users to use the Desktop version, even if they will have also to trust the installer too. The Privacy policy clearly states that homes data created with Sweet Home 3D application installed on a user's computer is only stored on his or her computer.
If the user wants to save his plans every 5 minutes, it will create a new file in the download directory. Ok, not really sexy, but not really problematic.
I find this is really not ergonomic. Sweet Home 3D doesn't target only computer users with good knowledge about how browser downloads are stored. Anyway, I'll probably add a JavaScript export function that will save current home in a blob that can be saved in download directory.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator