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: 13
Posts: 13   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 4566 times and has 12 replies Next Thread
buzzz
Member



FR
Joined: Jun 25, 2017
Post Count: 54
Status: Offline
Reply to this Post  Reply with Quote 
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 :

<java jar="${yuicompressor.jar}" fork="true" failonerror="true">
<arg value="dist/build/sweethome3d.min.js" />
<arg value="-o" />
<arg value="dist/build/sweethome3d.min.js" />
</java>


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.

Im sure I miss something
[May 22, 2023, 11:42:07 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: 9180
Status: Offline
Reply to this Post  Reply with Quote 
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 developer
[May 23, 2023, 9:30:41 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
buzzz
Member



FR
Joined: Jun 25, 2017
Post Count: 54
Status: Offline
Reply to this Post  Reply with Quote 
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?
[May 25, 2023, 10:57:36 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: 9180
Status: Offline
Reply to this Post  Reply with Quote 
Re: Debug & sweethome3D.min.js

It’s required by writeHomeEdits.jsp
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[May 25, 2023, 11:33:18 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
buzzz
Member



FR
Joined: Jun 25, 2017
Post Count: 54
Status: Offline
Reply to this Post  Reply with Quote 
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 :

request.send("home=" + encodeURIComponent(home.name)
+ "&editionId=" + home.editionId
+ "&version=" + this.application.getVersion()
+ "&edits=" + encodeURIComponent(JSON.stringify(update.edits)));


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 ?
[May 27, 2023, 5:49:03 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: 9180
Status: Offline
Reply to this Post  Reply with Quote 
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 developer
[May 27, 2023, 7:26:10 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
buzzz
Member



FR
Joined: Jun 25, 2017
Post Count: 54
Status: Offline
Reply to this Post  Reply with Quote 
Re: Debug & sweethome3D.min.js

I would want to create a full JS of SH3D online.

Can I find some usefull functions in the sw.min.js to build the sh3D file without using the tomcat/jar/jsp machinery ?

Of course, this file would be donwloaded into the web browser download directory.
[May 27, 2023, 11:36:30 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: 9180
Status: Offline
Reply to this Post  Reply with Quote 
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 developer
[May 28, 2023, 1:32:12 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
buzzz
Member



FR
Joined: Jun 25, 2017
Post Count: 54
Status: Offline
Reply to this Post  Reply with Quote 
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.
[May 29, 2023, 2:11:20 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: 9180
Status: Offline
Reply to this Post  Reply with Quote 
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 developer
[May 29, 2023, 11:07:50 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: 13   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-2024 eTeks - All rights reserved