Add rhino3dm updater script.

This commit is contained in:
kovacsv 2021-11-08 19:39:45 +01:00
parent 90b11feb28
commit 38965e7bfa
3 changed files with 41 additions and 21 deletions

File diff suppressed because one or more lines are too long

View File

@ -24,6 +24,7 @@
"svg": "node tools/run_python.js tools/svg.py"
},
"dependencies": {
"rhino3dm": "7.7.0",
"three": "0.134.0"
},
"eslintConfig": {

View File

@ -8,13 +8,18 @@ import urllib.request
from lib import tools_lib as Tools
threeJsFilesMap = [
[os.path.join ('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 ('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 ('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')]
threeJsFileMap = [
[os.path.join ('three', 'build', 'three.min.js'), os.path.join ('three.min.js')],
[os.path.join ('three', 'examples', 'js', 'libs', 'chevrotain.min.js'), os.path.join ('three_loaders', 'chevrotain.min.js')],
[os.path.join ('three', 'examples', 'js', 'loaders', '3MFLoader.js'), os.path.join ('three_loaders', '3MFLoader.js')],
[os.path.join ('three', 'examples', 'js', 'loaders', 'ColladaLoader.js'), os.path.join ('three_loaders', 'ColladaLoader.js')],
[os.path.join ('three', 'examples', 'js', 'loaders', 'FBXLoader.js'), os.path.join ('three_loaders', 'FBXLoader.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):
@ -23,10 +28,10 @@ def PrintInfo (message):
def PrintError (message):
print ('ERROR: ' + message)
def UpdateThreeJs (moduleDir, libsDir):
for threeJsFile in threeJsFilesMap:
src = os.path.join (moduleDir, threeJsFile[0])
dst = os.path.join (libsDir, threeJsFile[1])
def UpdateModule (fileMap, moduleDir, libsDir):
for fileEntry in fileMap:
src = os.path.join (moduleDir, fileEntry[0])
dst = os.path.join (libsDir, fileEntry[1])
PrintInfo ('Copying file ' + os.path.split (src)[1])
shutil.copy2 (src, dst)
@ -35,10 +40,11 @@ def Main (argv):
rootDir = os.path.dirname (toolsDir)
os.chdir (rootDir)
nodeModulesDir = os.path.join (rootDir, 'node_modules')
libsDir = os.path.join (rootDir, 'libs')
threeJsModuleDir = os.path.join (rootDir, 'node_modules', 'three')
UpdateThreeJs (threeJsModuleDir, libsDir)
UpdateModule (threeJsFileMap, nodeModulesDir, libsDir)
UpdateModule (rhino3dmFileMap, nodeModulesDir, libsDir)
return 0