Update app.py
Browse files
app.py
CHANGED
@@ -561,7 +561,7 @@ def draw_mask(o, b, v, d, evt: gr.EventData):
|
|
561 |
load_model="""
|
562 |
async(c, o, p, d, n, m)=>{
|
563 |
var intv = setInterval(function(){
|
564 |
-
if (document.getElementById("
|
565 |
try {
|
566 |
if (typeof BABYLON !== "undefined" && BABYLON.Engine && BABYLON.Engine.LastCreatedScene) {
|
567 |
BABYLON.Engine.LastCreatedScene.onAfterRenderObservable.add(function() { //onDataLoadedObservable
|
@@ -639,38 +639,13 @@ async(c, o, p, d, n, m)=>{
|
|
639 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.useAlphaFromDiffuseTexture = true;
|
640 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].applyDisplacementMap(m[o_[j]].url, 0, 255, function(m){try{alert(BABYLON.Engine.Version);}catch(e){alert(e);}}, null, null, true, function(e){alert(e);});
|
641 |
}
|
|
|
|
|
|
|
|
|
642 |
clearInterval(intv);
|
643 |
}
|
644 |
} catch(e) {alert(e);}
|
645 |
-
} else if (BABYLON || BABYLON == null) {
|
646 |
-
try {
|
647 |
-
BABYLON = null;
|
648 |
-
if (document.getElementById("model3D").getElementsByTagName("canvas")[0]) {
|
649 |
-
document.getElementById("model3D").getElementsByTagName("canvas")[0].remove();
|
650 |
-
}
|
651 |
-
document.getElementById("iframe3D").src = "index.htm";
|
652 |
-
document.getElementById("iframe3D").onload = function() {
|
653 |
-
if (o.indexOf(""+n) < 0) {
|
654 |
-
if (o != "") { o += ","; }
|
655 |
-
o += n;
|
656 |
-
}
|
657 |
-
//alert(o);
|
658 |
-
var o_ = o.split(",");
|
659 |
-
document.getElementById("iframe3D").contentDocument.getElementById("coords").value = c;
|
660 |
-
document.getElementById("iframe3D").contentDocument.getElementById("order").value = o;
|
661 |
-
document.getElementById("iframe3D").contentDocument.getElementById("bgimage").value = "";
|
662 |
-
document.getElementById("iframe3D").contentDocument.getElementById("bgdepth").value = "";
|
663 |
-
for (var j=0; j<o_.length; j++) {
|
664 |
-
o_[j] = parseInt(o_[j]);
|
665 |
-
//alert(o_[j]);
|
666 |
-
document.getElementById("iframe3D").contentDocument.getElementById("bgimage").value += p[o_[j]].image.url + ",";
|
667 |
-
document.getElementById("iframe3D").contentDocument.getElementById("bgdepth").value += m[o_[j]].url + ",";
|
668 |
-
}
|
669 |
-
}
|
670 |
-
toggleDisplay("model");
|
671 |
-
|
672 |
-
clearInterval(intv);
|
673 |
-
} catch(e) {alert(e)}
|
674 |
}
|
675 |
}, 40);
|
676 |
}
|
|
|
561 |
load_model="""
|
562 |
async(c, o, p, d, n, m)=>{
|
563 |
var intv = setInterval(function(){
|
564 |
+
if (document.getElementById("model3D").getElementsByTagName("canvas")[0]) {
|
565 |
try {
|
566 |
if (typeof BABYLON !== "undefined" && BABYLON.Engine && BABYLON.Engine.LastCreatedScene) {
|
567 |
BABYLON.Engine.LastCreatedScene.onAfterRenderObservable.add(function() { //onDataLoadedObservable
|
|
|
639 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.useAlphaFromDiffuseTexture = true;
|
640 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].applyDisplacementMap(m[o_[j]].url, 0, 255, function(m){try{alert(BABYLON.Engine.Version);}catch(e){alert(e);}}, null, null, true, function(e){alert(e);});
|
641 |
}
|
642 |
+
if (document.getElementById("model")) {
|
643 |
+
document.getElementById("model").appendChild(document.getElementById("model3D"));
|
644 |
+
toggleDisplay("model");
|
645 |
+
}
|
646 |
clearInterval(intv);
|
647 |
}
|
648 |
} catch(e) {alert(e);}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
649 |
}
|
650 |
}, 40);
|
651 |
}
|