Several improvements to the javascript in the template:
* Render on demand rather than continuously
* Support high-DPI displays
* Fix the frustum depth for both cameras
* Deal correctly with the browser window being resized
* Only show controls for objects with geometry
Also some changes made for code clarity:
* Use 'const' and 'let' instead of 'var', as appropriate
* Use for...of and .map() instead of iterating over arrays
using a loop counter
Removes unused imports as reported by LGTM.
There are exceptions: `import Arch_rc` is shown as an alert, but has side effects. It's not clear what the best thing to do in those cases is, so I've left them for now.
If the `utf8_decode` is not added, when saving on server side, the following error occurs:
```
File "/usr/share/freecad/Mod/Arch/importWebGL.py", line 129, in export
FreeCAD.Console.PrintMessage(translate("Arch","Successfully written", utf8_decode=True) + ' ' + filename + "\n")
TypeError: translate() got an unexpected keyword argument 'utf8_decode'
```
Python 3 is fussy about match of data type for a file open or write. Python 2 does not seem to care if a string is written with a 'wb' indicating a binary type, but Python 3 flags it as an error.
Modified the code so that the whitespace was hardcoded since translators on Crowdin weren't adding the whitespace. Please review if correct.
+ found some other typos/grammar issues along the way.
CC @yorikvanhavre
issue 0000995
- use optional argument to get unicode from translation in python2
- add a utf8_decode function to get unicode from string, bytes, unicode
The Arch module now features a webgl exporter that produces an all-included
HTML file that displays the exported objects in WebGL-capable web browsers.
Many enhancements are still necessary, especially with lights and materials.
At time of export, the exporter downloads the three.js library from github
and includes it in the HTML file, so it has no other dependencies.