freealise commited on
Commit
6137170
·
verified ·
1 Parent(s): 35f88df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -639,29 +639,27 @@ 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
- 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], 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
 
@@ -674,7 +672,7 @@ async(c, o, p, d, n, m)=>{
674
  editControl.hide();
675
  }
676
  }
677
-
678
  if (document.getElementById("model")) {
679
  document.getElementById("model").appendChild(document.getElementById("model3D"));
680
  toggleDisplay("model");
@@ -1005,7 +1003,9 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
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>
 
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=\"" + j + "\">" + j + "</option>";
643
  }
644
  loadEditControl();
645
  const editControl = new EditControl(BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1], BABYLON.Engine.LastCreatedScene.activeCamera, document.getElementById("model3D").getElementsByTagName("canvas")[0], 1.0, true, 0.02);
646
  editControl.enableTranslation();
647
+
 
 
648
  document.getElementById("c_mode").onchange = function(e) {
649
+ if (e.target.value == "move") {
650
  editControl.show();
651
  editControl.enableTranslation();
652
 
653
  editControl.disableRotation();
654
  editControl.disableScaling();
655
+ } else if (e.target.value == "rotate") {
656
  editControl.show();
657
  editControl.enableRotation();
658
  editControl.setRotGuideFull(false) //This makes the rotation guides 360 degree(true) or 90 degree(false) .90 degree looks less cluttered.
659
  editControl.returnEuler(true); // Optional. This will return rotation in euler instead of quaternion. Quaternion is the default.
660
  editControl.disableTranslation();
661
  editControl.disableScaling();
662
+ } else if (e.target.value == "scale") {
663
  editControl.show();
664
  editControl.enableScaling();
665
 
 
672
  editControl.hide();
673
  }
674
  }
675
+ alert("ok");
676
  if (document.getElementById("model")) {
677
  document.getElementById("model").appendChild(document.getElementById("model3D"));
678
  toggleDisplay("model");
 
1003
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure = this.value;
1004
  this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure;
1005
  '/><span>1.0</span>""")
1006
+ control = gr.HTML(value="""<select id='cnum' style='color:black;line-height:1em' onchange='
1007
+ editControl.switchTo(BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1-parseInt(this.value)], true);
1008
+ '></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>