Merge branch 'dev' into navigator_redesign

This commit is contained in:
kovacsv 2021-11-08 19:40:05 +01:00
commit d94dd7d862
20 changed files with 77 additions and 90 deletions

File diff suppressed because one or more lines are too long

View File

@ -20,10 +20,13 @@
"test": "mocha test", "test": "mocha test",
"build": "node tools/run_python.js tools/build.py", "build": "node tools/run_python.js tools/build.py",
"update": "node tools/run_python.js tools/update.py", "update": "node tools/run_python.js tools/update.py",
"updatelibs": "node tools/run_python.js tools/updatelibs.py && npm run update", "updatelibs": "npm install && node tools/run_python.js tools/updatelibs.py",
"svg": "node tools/run_python.js tools/svg.py" "svg": "node tools/run_python.js tools/svg.py"
}, },
"dependencies": {}, "dependencies": {
"rhino3dm": "7.7.0",
"three": "0.134.0"
},
"eslintConfig": { "eslintConfig": {
"env": { "env": {
"browser": true, "browser": true,

View File

@ -7,7 +7,7 @@
<title>Online 3D Viewer</title> <title>Online 3D Viewer</title>
<script type="text/javascript" src="../../libs/three.min-r134.js"></script> <script type="text/javascript" src="../../libs/three.min.js"></script>
<!-- engine start --> <!-- engine start -->
<script type="text/javascript" src="../source/core/core.js"></script> <script type="text/javascript" src="../source/core/core.js"></script>

View File

@ -7,7 +7,7 @@
<title>Online 3D Viewer</title> <title>Online 3D Viewer</title>
<script type="text/javascript" src="../../libs/three.min-r134.js"></script> <script type="text/javascript" src="../../libs/three.min.js"></script>
<!-- engine start --> <!-- engine start -->
<script type="text/javascript" src="../source/core/core.js"></script> <script type="text/javascript" src="../source/core/core.js"></script>

View File

@ -7,7 +7,7 @@
<title>Online 3D Viewer</title> <title>Online 3D Viewer</title>
<script type="text/javascript" src="../../libs/three.min-r134.js"></script> <script type="text/javascript" src="../../libs/three.min.js"></script>
<!-- engine start --> <!-- engine start -->
<script type="text/javascript" src="../source/core/core.js"></script> <script type="text/javascript" src="../source/core/core.js"></script>
<script type="text/javascript" src="../source/core/taskrunner.js"></script> <script type="text/javascript" src="../source/core/taskrunner.js"></script>

View File

@ -7,7 +7,7 @@
<title>Online 3D Viewer</title> <title>Online 3D Viewer</title>
<script type="text/javascript" src="../../libs/three.min-r134.js"></script> <script type="text/javascript" src="../../libs/three.min.js"></script>
<!-- engine start --> <!-- engine start -->
<script type="text/javascript" src="../source/core/core.js"></script> <script type="text/javascript" src="../source/core/core.js"></script>

View File

@ -7,7 +7,7 @@
<title>Online 3D Viewer</title> <title>Online 3D Viewer</title>
<script type="text/javascript" src="../../libs/three.min-r134.js"></script> <script type="text/javascript" src="../../libs/three.min.js"></script>
<!-- engine start --> <!-- engine start -->
<script type="text/javascript" src="../source/core/core.js"></script> <script type="text/javascript" src="../source/core/core.js"></script>

View File

@ -7,7 +7,7 @@
<title>Online 3D Viewer</title> <title>Online 3D Viewer</title>
<script type="text/javascript" src="../../libs/three.min-r134.js"></script> <script type="text/javascript" src="../../libs/three.min.js"></script>
<!-- engine start --> <!-- engine start -->
<script type="text/javascript" src="../source/core/core.js"></script> <script type="text/javascript" src="../source/core/core.js"></script>
<script type="text/javascript" src="../source/core/taskrunner.js"></script> <script type="text/javascript" src="../source/core/taskrunner.js"></script>

View File

@ -7,7 +7,7 @@
<title>Online 3D Viewer</title> <title>Online 3D Viewer</title>
<script type="text/javascript" src="../../libs/three.min-r134.js"></script> <script type="text/javascript" src="../../libs/three.min.js"></script>
<!-- engine start --> <!-- engine start -->
<script type="text/javascript" src="../source/core/core.js"></script> <script type="text/javascript" src="../source/core/core.js"></script>
<script type="text/javascript" src="../source/core/taskrunner.js"></script> <script type="text/javascript" src="../source/core/taskrunner.js"></script>

View File

@ -7,7 +7,7 @@
<title>Online 3D Viewer</title> <title>Online 3D Viewer</title>
<script type="text/javascript" src="../../libs/three.min-r134.js"></script> <script type="text/javascript" src="../../libs/three.min.js"></script>
<script type='text/javascript'> <script type='text/javascript'>
function HasHighpDriverIssue () function HasHighpDriverIssue ()
{ {

View File

@ -7,7 +7,7 @@
<title>Online 3D Viewer</title> <title>Online 3D Viewer</title>
<script type="text/javascript" src="../../libs/three.min-r134.js"></script> <script type="text/javascript" src="../../libs/three.min.js"></script>
<script type='text/javascript'> <script type='text/javascript'>
function Sandbox3D () function Sandbox3D ()
{ {

View File

@ -63,14 +63,14 @@ def CreateDestinationDir (config, rootDir, websiteDir, version, testBuild):
shutil.copytree (os.path.join (rootDir, 'website', 'o3dv', 'css', 'Quicksand'), os.path.join (websiteDir, 'o3dv', 'Quicksand')) shutil.copytree (os.path.join (rootDir, 'website', 'o3dv', 'css', 'Quicksand'), os.path.join (websiteDir, 'o3dv', 'Quicksand'))
shutil.copytree (os.path.join (rootDir, 'website', 'o3dv', 'css', 'O3DVIcons'), os.path.join (websiteDir, 'o3dv', 'O3DVIcons')) shutil.copytree (os.path.join (rootDir, 'website', 'o3dv', 'css', 'O3DVIcons'), os.path.join (websiteDir, 'o3dv', 'O3DVIcons'))
shutil.copytree (os.path.join (rootDir, 'website', 'info'), os.path.join (websiteDir, 'info')) shutil.copytree (os.path.join (rootDir, 'website', 'info'), os.path.join (websiteDir, 'info'))
libFiles = config['lib_files'] libFiles = config['lib_files']
importerFiles = ['o3dv/o3dv.min.js'] importerFiles = ['o3dv/o3dv.min.js']
websiteFiles = [ websiteFiles = [
'o3dv/o3dv.website.min.css', 'o3dv/o3dv.website.min.css',
'o3dv/o3dv.website.min.js' 'o3dv/o3dv.website.min.js'
] ]
htmlFileNames = [ htmlFileNames = [
'index.html', 'index.html',
'embed.html', 'embed.html',
@ -112,9 +112,9 @@ def CreatePackage (rootDir, websiteDir, packageDir, version):
zip.write (os.path.join (websiteDir, 'libs', 'loaders', lib), 'libs/loaders/' + lib) zip.write (os.path.join (websiteDir, 'libs', 'loaders', lib), 'libs/loaders/' + lib)
for lib in os.listdir (os.path.join (websiteDir, 'libs', 'three_loaders')): for lib in os.listdir (os.path.join (websiteDir, 'libs', 'three_loaders')):
zip.write (os.path.join (websiteDir, 'libs', 'three_loaders', lib), 'libs/three_loaders/' + lib) zip.write (os.path.join (websiteDir, 'libs', 'three_loaders', lib), 'libs/three_loaders/' + lib)
zip.write (os.path.join (websiteDir, 'libs', 'three.min-r134.js'), 'three.min-r134.js') zip.write (os.path.join (websiteDir, 'libs', 'three.min.js'), 'three.min.js')
zip.write (os.path.join (websiteDir, 'libs', 'three.license.md'), 'three.license.md') zip.write (os.path.join (websiteDir, 'libs', 'three.license.md'), 'three.license.md')
zip.write (os.path.join (websiteDir, 'o3dv', 'o3dv.min.js'), 'o3dv.min-' + version + '.js') zip.write (os.path.join (websiteDir, 'o3dv', 'o3dv.min.js'), 'o3dv.min.js')
zip.write (os.path.join (rootDir, 'LICENSE.md'), 'o3dv.license.md') zip.write (os.path.join (rootDir, 'LICENSE.md'), 'o3dv.license.md')
zip.close () zip.close ()
return True return True
@ -123,7 +123,7 @@ def Main (argv):
toolsDir = os.path.dirname (os.path.abspath (__file__)) toolsDir = os.path.dirname (os.path.abspath (__file__))
rootDir = os.path.dirname (toolsDir) rootDir = os.path.dirname (toolsDir)
os.chdir (rootDir) os.chdir (rootDir)
testBuild = False testBuild = False
buildDir = os.path.join (rootDir, 'build', 'final') buildDir = os.path.join (rootDir, 'build', 'final')
if len (argv) >= 2 and argv[1] == 'test': if len (argv) >= 2 and argv[1] == 'test':
@ -145,7 +145,7 @@ def Main (argv):
if not esLintResult: if not esLintResult:
PrintError ('ESLint importer sources failed.') PrintError ('ESLint importer sources failed.')
return 1 return 1
PrintInfo ('ESLint website sources.') PrintInfo ('ESLint website sources.')
esLintResult = ESLintFolder (os.path.join (rootDir, 'website', 'o3dv')) esLintResult = ESLintFolder (os.path.join (rootDir, 'website', 'o3dv'))
if not esLintResult: if not esLintResult:
@ -181,5 +181,5 @@ def Main (argv):
return 1 return 1
return 0 return 0
sys.exit (Main (sys.argv)) sys.exit (Main (sys.argv))

View File

@ -1,9 +1,9 @@
{ {
"lib_files" : [ "lib_files" : [
"libs/jquery-3.5.1.min.js", "libs/jquery.min.js",
"libs/pickr.monolith.min-1.8.2.css", "libs/pickr.monolith.min.css",
"libs/pickr.es5.min-1.8.2.js", "libs/pickr.es5.min.js",
"libs/three.min-r134.js" "libs/three.min.js"
], ],
"engine_files" : [ "engine_files" : [
"source/core/core.js", "source/core/core.js",

View File

@ -8,13 +8,18 @@ import urllib.request
from lib import tools_lib as Tools from lib import tools_lib as Tools
threeJsFilesMap = [ threeJsFileMap = [
[os.path.join ('build', 'three.min.js'), os.path.join ('three.min-$TAG_NAME$.js')], [os.path.join ('three', 'build', 'three.min.js'), os.path.join ('three.min.js')],
[os.path.join ('examples', 'js', 'libs', 'chevrotain.min.js'), os.path.join ('three_loaders', 'chevrotain.min.js')], [os.path.join ('three', 'examples', 'js', 'libs', 'chevrotain.min.js'), os.path.join ('three_loaders', 'chevrotain.min.js')],
[os.path.join ('examples', 'js', 'loaders', '3MFLoader.js'), os.path.join ('three_loaders', '3MFLoader.js')], [os.path.join ('three', 'examples', 'js', 'loaders', '3MFLoader.js'), os.path.join ('three_loaders', '3MFLoader.js')],
[os.path.join ('examples', 'js', 'loaders', 'ColladaLoader.js'), os.path.join ('three_loaders', 'ColladaLoader.js')], [os.path.join ('three', 'examples', 'js', 'loaders', 'ColladaLoader.js'), os.path.join ('three_loaders', 'ColladaLoader.js')],
[os.path.join ('examples', 'js', 'loaders', 'FBXLoader.js'), os.path.join ('three_loaders', 'FBXLoader.js')], [os.path.join ('three', 'examples', 'js', 'loaders', 'FBXLoader.js'), os.path.join ('three_loaders', 'FBXLoader.js')],
[os.path.join ('examples', 'js', 'loaders', 'VRMLLoader.js'), os.path.join ('three_loaders', 'VRMLLoader.js')] [os.path.join ('three', 'examples', 'js', 'loaders', 'VRMLLoader.js'), os.path.join ('three_loaders', 'VRMLLoader.js')]
]
rhino3dmFileMap = [
[os.path.join ('rhino3dm', 'rhino3dm.js'), os.path.join ('loaders', 'rhino3dm.min.js')],
[os.path.join ('rhino3dm', 'rhino3dm.wasm'), os.path.join ('loaders', 'rhino3dm.wasm')],
] ]
def PrintInfo (message): def PrintInfo (message):
@ -23,57 +28,23 @@ def PrintInfo (message):
def PrintError (message): def PrintError (message):
print ('ERROR: ' + message) print ('ERROR: ' + message)
def DownloadFile (url, resultPath): def UpdateModule (fileMap, moduleDir, libsDir):
PrintInfo ('Downloading ' + url) for fileEntry in fileMap:
urllib.request.urlretrieve (url, resultPath) src = os.path.join (moduleDir, fileEntry[0])
dst = os.path.join (libsDir, fileEntry[1])
def UnzipFile (zipPath, resultFolder):
PrintInfo ('Unzipping ' + zipPath)
with zipfile.ZipFile (zipPath, 'r') as zipFile:
zipFile.extractall (resultFolder)
def UpdateThreeJs (rootDir, tempDir):
libsDir = os.path.join (rootDir, 'libs')
for fileName in os.listdir (libsDir):
if (fileName.startswith ('three.min-')):
os.remove (os.path.join (libsDir, fileName))
response = urllib.request.urlopen ('https://api.github.com/repos/mrdoob/three.js/releases/latest')
responseJson = json.loads (response.read ())
threeJsTagName = responseJson['tag_name']
threeJsFileName = 'three.js-' + threeJsTagName
threeJsZipPath = os.path.join (tempDir, threeJsFileName + '.zip')
threeJsExtractedFolderPath = os.path.join (tempDir, threeJsFileName)
DownloadFile ('https://github.com/mrdoob/three.js/archive/refs/tags/' + threeJsTagName + '.zip', threeJsZipPath)
UnzipFile (threeJsZipPath, threeJsExtractedFolderPath)
for threeJsFile in threeJsFilesMap:
src = os.path.join (tempDir, threeJsFileName, threeJsFileName, threeJsFile[0])
dst = os.path.join (libsDir, threeJsFile[1].replace ('$TAG_NAME$', threeJsTagName))
PrintInfo ('Copying file ' + os.path.split (src)[1]) PrintInfo ('Copying file ' + os.path.split (src)[1])
shutil.copy2 (src, dst) shutil.copy2 (src, dst)
PrintInfo ('Replacing file name')
configFilePath = os.path.join (rootDir, 'tools', 'config.json')
Tools.ReplaceRegexInFile (configFilePath, 'three.min-r?[0-9]+.js', 'three.min-' + threeJsTagName + '.js')
buildScriptPath = os.path.join (rootDir, 'tools', 'build.py')
Tools.ReplaceRegexInFile (buildScriptPath, 'three.min-r?[0-9]+.js', 'three.min-' + threeJsTagName + '.js')
def Main (argv): def Main (argv):
toolsDir = os.path.dirname (os.path.abspath (__file__)) toolsDir = os.path.dirname (os.path.abspath (__file__))
rootDir = os.path.dirname (toolsDir) rootDir = os.path.dirname (toolsDir)
os.chdir (rootDir) os.chdir (rootDir)
tempDir = os.path.join (rootDir, 'build', 'temp') nodeModulesDir = os.path.join (rootDir, 'node_modules')
if os.path.exists (tempDir): libsDir = os.path.join (rootDir, 'libs')
shutil.rmtree (tempDir)
os.makedirs (tempDir)
UpdateThreeJs (rootDir, tempDir) UpdateModule (threeJsFileMap, nodeModulesDir, libsDir)
shutil.rmtree (tempDir) UpdateModule (rhino3dmFileMap, nodeModulesDir, libsDir)
return 0 return 0

View File

@ -5,19 +5,19 @@
<meta http-equiv="content-type" content="text/html;charset=utf-8"> <meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no"> <meta name="viewport" content="width=device-width, user-scalable=no">
<link rel="icon" type="image/png" href="assets/images/3dviewer_net_favicon.ico"> <link rel="icon" type="image/png" href="assets/images/3dviewer_net_favicon.ico">
<title>Online 3D Viewer Embedded</title> <title>Online 3D Viewer Embedded</title>
<!-- meta start --> <!-- meta start -->
<!-- meta end --> <!-- meta end -->
<!-- libs start --> <!-- libs start -->
<script type="text/javascript" src="../libs/jquery-3.5.1.min.js"></script> <script type="text/javascript" src="../libs/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="../libs/pickr.monolith.min-1.8.2.css"> <link rel="stylesheet" type="text/css" href="../libs/pickr.monolith.min.css">
<script type="text/javascript" src="../libs/pickr.es5.min-1.8.2.js"></script> <script type="text/javascript" src="../libs/pickr.es5.min.js"></script>
<script type="text/javascript" src="../libs/three.min-r134.js"></script> <script type="text/javascript" src="../libs/three.min.js"></script>
<!-- libs end --> <!-- libs end -->
<!-- engine start --> <!-- engine start -->
<script type="text/javascript" src="../source/core/core.js"></script> <script type="text/javascript" src="../source/core/core.js"></script>
<script type="text/javascript" src="../source/core/taskrunner.js"></script> <script type="text/javascript" src="../source/core/taskrunner.js"></script>
@ -81,7 +81,7 @@
<script type="text/javascript" src="../source/viewer/viewer.js"></script> <script type="text/javascript" src="../source/viewer/viewer.js"></script>
<script type="text/javascript" src="../source/viewer/domviewer.js"></script> <script type="text/javascript" src="../source/viewer/domviewer.js"></script>
<!-- engine end --> <!-- engine end -->
<!-- website start --> <!-- website start -->
<link rel="stylesheet" type="text/css" href="o3dv/css/icons.css"> <link rel="stylesheet" type="text/css" href="o3dv/css/icons.css">
<link rel="stylesheet" type="text/css" href="o3dv/css/themes.css"> <link rel="stylesheet" type="text/css" href="o3dv/css/themes.css">

View File

@ -9,10 +9,10 @@
<title>Online 3D Viewer</title> <title>Online 3D Viewer</title>
<!-- libs start --> <!-- libs start -->
<script type="text/javascript" src="../libs/jquery-3.5.1.min.js"></script> <script type="text/javascript" src="../libs/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="../libs/pickr.monolith.min-1.8.2.css"> <link rel="stylesheet" type="text/css" href="../libs/pickr.monolith.min.css">
<script type="text/javascript" src="../libs/pickr.es5.min-1.8.2.js"></script> <script type="text/javascript" src="../libs/pickr.es5.min.js"></script>
<script type="text/javascript" src="../libs/three.min-r134.js"></script> <script type="text/javascript" src="../libs/three.min.js"></script>
<!-- libs end --> <!-- libs end -->
<!-- meta start --> <!-- meta start -->