Update app.py
Browse files
app.py
CHANGED
@@ -638,10 +638,42 @@ async(c, o, p, d, n, m)=>{
|
|
638 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.diffuseTexture.hasAlpha = true;
|
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 |
loadEditControl();
|
643 |
const editControl = new EditControl(BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1-parseInt(document.getElementById("cnum").value)], BABYLON.Engine.LastCreatedScene.activeCamera, document.getElementById("model3D").getElementsByTagName("canvas")[0], 1.0, true, 0.02);
|
644 |
editControl.enableTranslation();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
645 |
|
646 |
if (document.getElementById("model")) {
|
647 |
document.getElementById("model").appendChild(document.getElementById("model3D"));
|
@@ -861,7 +893,7 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
|
|
861 |
with gr.Tab("Blur"):
|
862 |
chart_c = gr.HTML(elem_id="chart_c", value="""<div id='chart' onpointermove='window.drawLine(event.clientX, event.clientY);' onpointerdown='window.pointerDown(event.clientX, event.clientY);' onpointerup='window.pointerUp();' onpointerleave='window.pointerUp();' onpointercancel='window.pointerUp();' onclick='window.resetLine();'></div>
|
863 |
<style>
|
864 |
-
|
865 |
user-select: none;
|
866 |
}
|
867 |
#chart hr {
|
@@ -973,39 +1005,8 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
|
|
973 |
BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure = this.value;
|
974 |
this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure;
|
975 |
'/><span>1.0</span>""")
|
976 |
-
control = gr.HTML(value="""<select id='cnum' style='color:black'
|
977 |
-
|
978 |
-
' onselect='
|
979 |
-
editControl.switchTo(BABYLON.Engine.LastCreatedScene.meshes[parseInt(this.value)], true);
|
980 |
-
'><option selected value='0'>0</option></select>
|
981 |
-
mode<select id='c_mode' style='color:black' oninput='
|
982 |
-
if (this.value == \'move\') {
|
983 |
-
editControl.show();
|
984 |
-
editControl.enableTranslation();
|
985 |
-
|
986 |
-
editControl.disableRotation();
|
987 |
-
editControl.disableScaling();
|
988 |
-
} else if (this.value == \'rotate\') {
|
989 |
-
editControl.show();
|
990 |
-
editControl.enableRotation();
|
991 |
-
editControl.setRotGuideFull(false) //This makes the rotation guides 360 degree(true) or 90 degree(false) .90 degree looks less cluttered.
|
992 |
-
editControl.returnEuler(true); // Optional. This will return rotation in euler instead of quaternion. Quaternion is the default.
|
993 |
-
|
994 |
-
editControl.disableTranslation();
|
995 |
-
editControl.disableScaling();
|
996 |
-
} else if (this.value == \'scale\') {
|
997 |
-
editControl.show();
|
998 |
-
editControl.enableScaling();
|
999 |
-
|
1000 |
-
editControl.disableTranslation();
|
1001 |
-
editControl.disableRotation();
|
1002 |
-
} else {
|
1003 |
-
editControl.disableTranslation();
|
1004 |
-
editControl.disableRotation();
|
1005 |
-
editControl.disableScaling();
|
1006 |
-
editControl.hide();
|
1007 |
-
}
|
1008 |
-
' onselect='this.oninput'>
|
1009 |
<option selected value='move'>move</option>
|
1010 |
<option value='rotate'>rotate</option>
|
1011 |
<option value='scale'>scale</option>
|
|
|
638 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.diffuseTexture.hasAlpha = true;
|
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 |
+
document.getElementById("cnum").innerHTML += '<option value="' + o_[j] + '">' + j + '</option>';
|
643 |
}
|
644 |
loadEditControl();
|
645 |
const editControl = new EditControl(BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1-parseInt(document.getElementById("cnum").value)], BABYLON.Engine.LastCreatedScene.activeCamera, document.getElementById("model3D").getElementsByTagName("canvas")[0], 1.0, true, 0.02);
|
646 |
editControl.enableTranslation();
|
647 |
+
document.getElementById("cnum").onchange = function(e) {
|
648 |
+
editControl.switchTo(BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1-parseInt(e.target.value)], true);
|
649 |
+
}
|
650 |
+
document.getElementById("c_mode").onchange = function(e) {
|
651 |
+
if (e.target.value == 'move') {
|
652 |
+
editControl.show();
|
653 |
+
editControl.enableTranslation();
|
654 |
+
|
655 |
+
editControl.disableRotation();
|
656 |
+
editControl.disableScaling();
|
657 |
+
} else if (e.target.value == 'rotate') {
|
658 |
+
editControl.show();
|
659 |
+
editControl.enableRotation();
|
660 |
+
editControl.setRotGuideFull(false) //This makes the rotation guides 360 degree(true) or 90 degree(false) .90 degree looks less cluttered.
|
661 |
+
editControl.returnEuler(true); // Optional. This will return rotation in euler instead of quaternion. Quaternion is the default.
|
662 |
+
editControl.disableTranslation();
|
663 |
+
editControl.disableScaling();
|
664 |
+
} else if (e.target.value == 'scale') {
|
665 |
+
editControl.show();
|
666 |
+
editControl.enableScaling();
|
667 |
+
|
668 |
+
editControl.disableTranslation();
|
669 |
+
editControl.disableRotation();
|
670 |
+
} else {
|
671 |
+
editControl.disableTranslation();
|
672 |
+
editControl.disableRotation();
|
673 |
+
editControl.disableScaling();
|
674 |
+
editControl.hide();
|
675 |
+
}
|
676 |
+
}
|
677 |
|
678 |
if (document.getElementById("model")) {
|
679 |
document.getElementById("model").appendChild(document.getElementById("model3D"));
|
|
|
893 |
with gr.Tab("Blur"):
|
894 |
chart_c = gr.HTML(elem_id="chart_c", value="""<div id='chart' onpointermove='window.drawLine(event.clientX, event.clientY);' onpointerdown='window.pointerDown(event.clientX, event.clientY);' onpointerup='window.pointerUp();' onpointerleave='window.pointerUp();' onpointercancel='window.pointerUp();' onclick='window.resetLine();'></div>
|
895 |
<style>
|
896 |
+
* {
|
897 |
user-select: none;
|
898 |
}
|
899 |
#chart hr {
|
|
|
1005 |
BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure = this.value;
|
1006 |
this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure;
|
1007 |
'/><span>1.0</span>""")
|
1008 |
+
control = gr.HTML(value="""<select id='cnum' style='color:black;line-height:1em'></select>
|
1009 |
+
mode<select id='c_mode' style='color:black;line-height:1em'>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1010 |
<option selected value='move'>move</option>
|
1011 |
<option value='rotate'>rotate</option>
|
1012 |
<option value='scale'>scale</option>
|