diff --git a/sandbox/embed_selfhost_fullscreen.html b/sandbox/embed_selfhost_fullscreen.html
index f28ca1d..9418ba4 100644
--- a/sandbox/embed_selfhost_fullscreen.html
+++ b/sandbox/embed_selfhost_fullscreen.html
@@ -53,6 +53,7 @@
+
diff --git a/sandbox/embed_selfhost_multiple.html b/sandbox/embed_selfhost_multiple.html
index f227873..f18425a 100644
--- a/sandbox/embed_selfhost_multiple.html
+++ b/sandbox/embed_selfhost_multiple.html
@@ -54,6 +54,7 @@
+
diff --git a/sandbox/embed_selfhost_single.html b/sandbox/embed_selfhost_single.html
index 568e9e8..e4cbd66 100644
--- a/sandbox/embed_selfhost_single.html
+++ b/sandbox/embed_selfhost_single.html
@@ -53,6 +53,7 @@
+
diff --git a/sandbox/embed_selfhost_single_scroll.html b/sandbox/embed_selfhost_single_scroll.html
index efe2a3a..0851ef8 100644
--- a/sandbox/embed_selfhost_single_scroll.html
+++ b/sandbox/embed_selfhost_single_scroll.html
@@ -53,6 +53,7 @@
+
diff --git a/source/external/externallibs.js b/source/external/externallibs.js
new file mode 100644
index 0000000..174f34c
--- /dev/null
+++ b/source/external/externallibs.js
@@ -0,0 +1,15 @@
+OV.ExternalLibLocation = null;
+
+OV.LoadExternalLibrary = function (libName, callbacks)
+{
+ if (OV.ExternalLibLocation === null) {
+ callbacks.error ();
+ return;
+ }
+ let scriptElement = document.createElement ('script');
+ scriptElement.type = 'text/javascript';
+ scriptElement.src = OV.ExternalLibLocation + '/' + libName;
+ scriptElement.onload = callbacks.success;
+ scriptElement.onerror = callbacks.error;
+ document.head.appendChild (scriptElement);
+};
diff --git a/source/external/rhinoimporter.js b/source/external/rhinoimporter.js
index 2346d12..0b2ff74 100644
--- a/source/external/rhinoimporter.js
+++ b/source/external/rhinoimporter.js
@@ -39,10 +39,17 @@ OV.Importer3dm = class extends OV.ImporterBase
{
if (this.rhino === null) {
let obj = this;
- rhino3dm ().then (function (rhino) {
- obj.rhino = rhino;
- obj.ImportRhinoContent (fileContent);
- onFinish ();
+ OV.LoadExternalLibrary ('rhino3dm.min.js', {
+ success : function () {
+ rhino3dm ().then (function (rhino) {
+ obj.rhino = rhino;
+ obj.ImportRhinoContent (fileContent);
+ onFinish ();
+ });
+ },
+ error : function () {
+ onFinish ();
+ }
});
} else {
this.ImportRhinoContent (fileContent);
diff --git a/tools/config.json b/tools/config.json
index 2294a9e..cd38227 100644
--- a/tools/config.json
+++ b/tools/config.json
@@ -1,8 +1,7 @@
{
"lib_files" : [
"libs/jquery-3.5.1.min.js",
- "libs/three.min-129.js",
- "libs/rhino3dm.min.js"
+ "libs/three.min-129.js"
],
"importer_files" : [
"source/core/core.js",
@@ -49,6 +48,7 @@
"source/export/exporteroff.js",
"source/export/exportergltf.js",
"source/export/exporter.js",
+ "source/external/externallibs.js",
"source/external/rhinoimporter.js",
"source/external/rhinoexporter.js",
"source/external/threeutils.js",
diff --git a/tools/create_package.py b/tools/create_package.py
index 32e4e2c..037833e 100644
--- a/tools/create_package.py
+++ b/tools/create_package.py
@@ -71,6 +71,11 @@ def CreateDestinationDir (config, rootDir, websiteDir, version, testBuild):
replacer.ReplaceTokenFileLinks ('', '', libFiles, None)
replacer.ReplaceTokenFileLinks ('', '', importerFiles, version)
replacer.ReplaceTokenFileLinks ('', '', websiteFiles, version)
+ externalScriptContent = ''
+ externalScriptContent += ''
+ replacer.ReplaceTokenContent ('', '', externalScriptContent)
metaFile = os.path.join (rootDir, 'tools', 'website_meta_data.txt')
if os.path.exists (metaFile):
metaContent = Tools.GetFileContent (metaFile)
diff --git a/tools/lib/tools_lib.py b/tools/lib/tools_lib.py
index 6c7ad91..a45c223 100644
--- a/tools/lib/tools_lib.py
+++ b/tools/lib/tools_lib.py
@@ -57,7 +57,10 @@ class TokenReplacer:
def ReplaceContent (self, begToken, endToken, begPosition, endPosition, linePrefix, newContent):
if self.keepToken:
newContent = linePrefix + begToken + self.eolChar + newContent + self.eolChar + linePrefix + endToken
- self.fileContent = self.fileContent.replace (self.fileContent[begPosition : endPosition], newContent)
+ self.ReplaceString (self.fileContent[begPosition : endPosition], newContent)
+
+ def ReplaceString (self, oldString, newString):
+ self.fileContent = self.fileContent.replace (oldString, newString)
def GetTokenBegPosition (self, begToken):
begPosition = self.fileContent.find (begToken)
diff --git a/website/embed.html b/website/embed.html
index 7d9dbc4..52d9b5b 100644
--- a/website/embed.html
+++ b/website/embed.html
@@ -14,7 +14,6 @@
-
@@ -62,6 +61,7 @@
+
@@ -99,7 +99,13 @@
-
+
+
+
-
@@ -62,6 +61,7 @@
+
@@ -96,7 +96,13 @@
-
+
+
+