Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -450,7 +450,97 @@ with gr.Blocks(css=css) as demo:
|
|
450 |
with gr.Accordion(label="Blur levels", open=False):
|
451 |
blur_in = gr.Textbox(value="", label="Kernel size", show_label=False)
|
452 |
with gr.Accordion(label="Locations", open=False):
|
453 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
454 |
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
455 |
var evt = document.createEvent(\"Event\");
|
456 |
evt.initEvent(\"click\", true, false);
|
@@ -524,7 +614,7 @@ with gr.Blocks(css=css) as demo:
|
|
524 |
document.getElementById(\"cr\").setAttribute(\"stroke\", \"white\");
|
525 |
}
|
526 |
} catch(e) {alert(e);}
|
527 |
-
'><option>Move</option><option>Rotate</option><option>Scale</option></select>""")
|
528 |
selected = gr.Number(elem_id="fnum", value=0, minimum=0, maximum=256, interactive=False)
|
529 |
output_frame.select(fn=select_frame, inputs=None, outputs=[output_depth, selected], show_progress='hidden')
|
530 |
output_depth.select(fn=select_frame, inputs=None, outputs=[output_frame, selected], show_progress='hidden')
|
|
|
450 |
with gr.Accordion(label="Blur levels", open=False):
|
451 |
blur_in = gr.Textbox(value="", label="Kernel size", show_label=False)
|
452 |
with gr.Accordion(label="Locations", open=False):
|
453 |
+
kbrd = gr.Textbox(elem_id="kbrd", value="", label="Offset", show_label=False)
|
454 |
+
offset = gr.HTML(value="""<pre onload='
|
455 |
+
document.getElementById(\"kbrd\").getElementsByTagName(\"textarea\")[0].onkeydown = function(event) {
|
456 |
+
event.preventDefault();
|
457 |
+
switch(event.key) {
|
458 |
+
case \"w\":
|
459 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].position.y += 1;
|
460 |
+
break;
|
461 |
+
case \"x\":
|
462 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].position.y -= 1;
|
463 |
+
break;
|
464 |
+
case \"a\":
|
465 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].position.z -= 1;
|
466 |
+
break;
|
467 |
+
case \"d\":
|
468 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].position.z += 1;
|
469 |
+
break;
|
470 |
+
case \"e\":
|
471 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].position.x -= 1;
|
472 |
+
break;
|
473 |
+
case \"z\":
|
474 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].position.x += 1;
|
475 |
+
break;
|
476 |
+
case \"s\":
|
477 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].position.x = 0;
|
478 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].position.y = 0;
|
479 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].position.z = 0;
|
480 |
+
break;
|
481 |
+
case \"t\":
|
482 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].rotation.z += 1;
|
483 |
+
break;
|
484 |
+
case \"b\":
|
485 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].rotation.z -= 1;
|
486 |
+
break;
|
487 |
+
case \"f\":
|
488 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].rotation.y -= 1;
|
489 |
+
break;
|
490 |
+
case \"h\":
|
491 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].rotation.y += 1;
|
492 |
+
break;
|
493 |
+
case \"y\":
|
494 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].rotation.x -= 1;
|
495 |
+
break;
|
496 |
+
case \"v\":
|
497 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].rotation.x += 1;
|
498 |
+
break;
|
499 |
+
case \"g\":
|
500 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].rotation.x = 0;
|
501 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].rotation.y = 0;
|
502 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].rotation.z = 0;
|
503 |
+
break;
|
504 |
+
case \"i\":
|
505 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].scale.y += 1;
|
506 |
+
break;
|
507 |
+
case \",\":
|
508 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].scale.y -= 1;
|
509 |
+
break;
|
510 |
+
case \"j\":
|
511 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].scale.z -= 1;
|
512 |
+
break;
|
513 |
+
case \"l\":
|
514 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].scale.z += 1;
|
515 |
+
break;
|
516 |
+
case \"o\":
|
517 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].scale.x -= 1;
|
518 |
+
break;
|
519 |
+
case \"m\":
|
520 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].scale.x += 1;
|
521 |
+
break;
|
522 |
+
case \"k\":
|
523 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].scale.x = 1;
|
524 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].scale.y = 1;
|
525 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].scale.z = 1;
|
526 |
+
break;
|
527 |
+
default:
|
528 |
+
// code block
|
529 |
+
}
|
530 |
+
}
|
531 |
+
'>
|
532 |
+
,---,---,---,---,---,---,---,---,---,---,---,---,---,-------,
|
533 |
+
|1/2| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | + | ' | <- |
|
534 |
+
|---'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-----|
|
535 |
+
| ->| | Q | W | E | R | T | Y | U | I | O | P | ] | ^ | |
|
536 |
+
|-----',--',--',--',--',--',--',--',--',--',--',--',--'| |
|
537 |
+
| Caps | A | S | D | F | G | H | J | K | L | \ | [ | * | |
|
538 |
+
|----,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'-,-'---'----|
|
539 |
+
| | < | Z | X | C | V | B | N | M | , | . | - | |
|
540 |
+
|----'-,-',--'--,'---'---'---'---'---'---'-,-'---',--,------|
|
541 |
+
| ctrl | | alt | |altgr | | ctrl |
|
542 |
+
'------' '-----'--------------------------'------' '------'
|
543 |
+
</pre><svg id='offset' height='256' width='288' viewBox='0 0 288 256' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' style='touch-action:none;background-color:transparent;' onpointerdown='
|
544 |
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
545 |
var evt = document.createEvent(\"Event\");
|
546 |
evt.initEvent(\"click\", true, false);
|
|
|
614 |
document.getElementById(\"cr\").setAttribute(\"stroke\", \"white\");
|
615 |
}
|
616 |
} catch(e) {alert(e);}
|
617 |
+
' onload=''><option>Move</option><option>Rotate</option><option>Scale</option></select>""")
|
618 |
selected = gr.Number(elem_id="fnum", value=0, minimum=0, maximum=256, interactive=False)
|
619 |
output_frame.select(fn=select_frame, inputs=None, outputs=[output_depth, selected], show_progress='hidden')
|
620 |
output_depth.select(fn=select_frame, inputs=None, outputs=[output_frame, selected], show_progress='hidden')
|