freealise commited on
Commit
5d1153e
·
verified ·
1 Parent(s): f5b3d04

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -639,12 +639,19 @@ 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=\"" + 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
  if (document.getElementById("model")) {
649
  document.getElementById("model").appendChild(document.getElementById("model3D"));
650
  toggleDisplay("model");
@@ -975,9 +982,7 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
975
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure = this.value;
976
  this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure;
977
  '/><span>1.0</span>""")
978
- control = gr.HTML(value="""<select id='cnum' style='color:black;line-height:1em' onchange='
979
- editControl.switchTo(BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1-parseInt(this.value)], true);
980
- '></select>
981
  mode<select id='c_mode' style='color:black;line-height:1em' onchange='
982
  if (this.value == \"move\") {
983
  editControl.show();
 
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
+ const opt = document.createElement("option");
643
+ opt.value = j;
644
+ opt.innerText = j;
645
+ document.getElementById("cnum").appendChild(opt);
646
  }
647
  loadEditControl();
648
  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);
649
  editControl.enableTranslation();
650
 
651
+ document.getElementById("cnum").onchange = function(e) {
652
+ editControl.switchTo(BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1-parseInt(e.target.value)], true);
653
+ }
654
+
655
  if (document.getElementById("model")) {
656
  document.getElementById("model").appendChild(document.getElementById("model3D"));
657
  toggleDisplay("model");
 
982
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure = this.value;
983
  this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure;
984
  '/><span>1.0</span>""")
985
+ control = gr.HTML(value="""<select id='cnum' style='color:black;line-height:1em'></select>
 
 
986
  mode<select id='c_mode' style='color:black;line-height:1em' onchange='
987
  if (this.value == \"move\") {
988
  editControl.show();