freealise commited on
Commit
16e749d
1 Parent(s): c3096ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -606,7 +606,7 @@ with gr.Blocks(css=css) as demo:
606
  with gr.Accordion(label="Blur levels", open=False):
607
  blur_in = gr.Textbox(label="Kernel size", show_label=False, value="1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1")
608
  with gr.Accordion(label="Locations", open=False):
609
- offset = gr.HTML(value="""<div style='text-align:center;width:100%;'><input type='text' id='kbrd' onpointerdown='this.style.color = \"white\";' onpointerup='this.style.color = \"auto\";' onpointermove='
610
  try {
611
  if (this.style.color!=\"auto\" && BABYLON) {
612
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
@@ -621,7 +621,7 @@ with gr.Blocks(css=css) as demo:
621
  const dir = BABYLON.Engine.LastCreatedScene.activeCamera.getForwardRay().direction;
622
  dir.y = 0; dir.normalize();
623
  const angle = BABYLON.Vector3.GetAngleBetweenVectors(dir, BABYLON.Vector3.Forward(), BABYLON.Vector3.Up());
624
- const x = event.clientX-this.getBoundingClientRect().x-64;
625
  const y = event.clientY-this.getBoundingClientRect().y-64;
626
  const angle_ = Math.atan2(y, x);
627
  const r = Math.sqrt(Math.pow(y,2) + Math.pow(x,2));
@@ -640,6 +640,7 @@ with gr.Blocks(css=css) as demo:
640
  if (BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].rotationQuaternion) {
641
  BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].rotationQuaternion = null;
642
  }
 
643
  const dir = BABYLON.Engine.LastCreatedScene.activeCamera.getForwardRay().direction;
644
  dir.y = 0; dir.normalize();
645
  const angle = BABYLON.Vector3.GetAngleBetweenVectors(dir, BABYLON.Vector3.Forward(), BABYLON.Vector3.Up());
@@ -745,15 +746,16 @@ with gr.Blocks(css=css) as demo:
745
  default:
746
  this.value = \"\";
747
  }
 
748
  }
749
- ' style='height:128px;width:128px;user-select:none;touch-action:none;color:auto;background-color:transparent;border:1px solid gray;'/>
750
  <pre id='keymap'>
751
  ` 1 2 3 4 5 6 7 8 9 0 - =
752
  W E T Y I O { }
753
  A-`S´-D F-`G´-H J-`K´-L ; '
754
  Z´ X̀ V´ B̀ M´ `, . /
755
  <a id='move' href='#'>move</a> <a id='rotate' href='#'>rotate</a> <a id='scale' href='#'>scale</a>
756
- </pre></div>""")
757
  selected = gr.Number(elem_id="fnum", value=0, minimum=0, maximum=256, interactive=False)
758
  output_frame.select(fn=select_frame, inputs=[output_mask], outputs=[output_mask, selected])
759
  example_coords = """[
 
606
  with gr.Accordion(label="Blur levels", open=False):
607
  blur_in = gr.Textbox(label="Kernel size", show_label=False, value="1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1")
608
  with gr.Accordion(label="Locations", open=False):
609
+ offset = gr.HTML(value="""<input type='text' id='kbrd' onpointerdown='this.style.color = \"white\";' onpointerup='this.style.color = \"auto\";' onpointermove='
610
  try {
611
  if (this.style.color!=\"auto\" && BABYLON) {
612
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
 
621
  const dir = BABYLON.Engine.LastCreatedScene.activeCamera.getForwardRay().direction;
622
  dir.y = 0; dir.normalize();
623
  const angle = BABYLON.Vector3.GetAngleBetweenVectors(dir, BABYLON.Vector3.Forward(), BABYLON.Vector3.Up());
624
+ const x = event.clientX-this.getBoundingClientRect().x-128;
625
  const y = event.clientY-this.getBoundingClientRect().y-64;
626
  const angle_ = Math.atan2(y, x);
627
  const r = Math.sqrt(Math.pow(y,2) + Math.pow(x,2));
 
640
  if (BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].rotationQuaternion) {
641
  BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].rotationQuaternion = null;
642
  }
643
+ try {
644
  const dir = BABYLON.Engine.LastCreatedScene.activeCamera.getForwardRay().direction;
645
  dir.y = 0; dir.normalize();
646
  const angle = BABYLON.Vector3.GetAngleBetweenVectors(dir, BABYLON.Vector3.Forward(), BABYLON.Vector3.Up());
 
746
  default:
747
  this.value = \"\";
748
  }
749
+ } catch(e) {alert(e)}
750
  }
751
+ ' style='height:128px;width:256px;user-select:none;touch-action:none;color:auto;background-color:transparent;border:1px solid gray;'/>
752
  <pre id='keymap'>
753
  ` 1 2 3 4 5 6 7 8 9 0 - =
754
  W E T Y I O { }
755
  A-`S´-D F-`G´-H J-`K´-L ; '
756
  Z´ X̀ V´ B̀ M´ `, . /
757
  <a id='move' href='#'>move</a> <a id='rotate' href='#'>rotate</a> <a id='scale' href='#'>scale</a>
758
+ </pre>""")
759
  selected = gr.Number(elem_id="fnum", value=0, minimum=0, maximum=256, interactive=False)
760
  output_frame.select(fn=select_frame, inputs=[output_mask], outputs=[output_mask, selected])
761
  example_coords = """[