freealise commited on
Commit
546adab
·
verified ·
1 Parent(s): de59377

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -12
app.py CHANGED
@@ -593,9 +593,6 @@ async(c, o, p, d, n, m, s)=>{
593
  }*/
594
  BABYLON.Engine.LastCreatedScene.getAnimationRatio();
595
  });
596
- var CoT = new BABYLON.TransformNode("root");
597
- BABYLON.Engine.LastCreatedScene.activeCamera = new BABYLON.ArcRotateCamera("camera", 0, Math.PI / 2, 1.0, new BABYLON.Vector3(0, 0, 0))
598
- BABYLON.Engine.LastCreatedScene.activeCamera.target = CoT;
599
 
600
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
601
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata = {
@@ -713,9 +710,6 @@ async(c, o, p, d, n, m, s)=>{
713
  if (md === true) {
714
  x = parseInt(evt.clientX - evt.target.getBoundingClientRect().x);
715
  y = parseInt(evt.clientY - evt.target.getBoundingClientRect().y);
716
- CoT.rotation.y = BABYLON.Engine.LastCreatedScene.activeCamera.alpha;
717
- CoT.rotation.x = BABYLON.Engine.LastCreatedScene.activeCamera.beta;
718
- CoT.position.z = BABYLON.Engine.LastCreatedScene.activeCamera.radius;
719
 
720
  if (Math.abs(x-xold)>16 || Math.abs(y-yold)>16) {
721
  if (Math.abs(BABYLON.Engine.LastCreatedScene.activeCamera.radius) > 16) {
@@ -1266,8 +1260,8 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
1266
  load_all = gr.Checkbox(label="Load all")
1267
 
1268
  with gr.Group():
1269
- camera = gr.HTML(value="""<div style='width:128px;height:128px;border:1px dotted gray;padding:0;margin:0;float:left;' id='seek'></div><br/>
1270
- <a href='#' id='reset_cam' style='width:12em;float:right;color:white' onclick='
1271
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
1272
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata = {
1273
  screenshot: true,
@@ -1287,7 +1281,7 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
1287
  document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].oncontextmenu = function(e){e.preventDefault();}
1288
  document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].ondrag = function(e){e.preventDefault();}
1289
  '>Reset camera</a>""")
1290
- html = gr.HTML(value="""<span style='max-width:50%;float:right'><label for='zoom' style='width:8em'>Zoom</label><input id='zoom' type='range' style='width:128px;height:1em;' value='0.8' min='0.157' max='1.57' step='0.001' oninput='
1291
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
1292
  var evt = document.createEvent(\"Event\");
1293
  evt.initEvent(\"click\", true, false);
@@ -1298,7 +1292,7 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
1298
 
1299
  document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].material.pointSize/2.0*Math.sqrt(2.0) + \"px)\";
1300
  '/> <span>0.8</span></span>""")
1301
- contrast = gr.HTML(value="""<span style='max-width:50%;float:right'><label for='contrast' style='width:8em'>Contrast</label><input id='contrast' type='range' style='width:128px;height:1em;' value='1.0' min='0' max='2' step='0.001' oninput='
1302
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
1303
  var evt = document.createEvent(\"Event\");
1304
  evt.initEvent(\"click\", true, false);
@@ -1307,7 +1301,7 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
1307
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.contrast = this.value;
1308
  this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.contrast;
1309
  '/> <span>1.0</span></span>""")
1310
- exposure = gr.HTML(value="""<span style='max-width:50%;float:right'><label for='exposure' style='width:8em'>Exposure</label><input id='exposure' type='range' style='width:128px;height:1em;' value='1.0' min='0' max='2' step='0.001' oninput='
1311
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
1312
  var evt = document.createEvent(\"Event\");
1313
  evt.initEvent(\"click\", true, false);
@@ -1316,7 +1310,7 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
1316
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure = this.value;
1317
  this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure;
1318
  '/> <span>1.0</span></span>""")
1319
- snapshot = gr.HTML(value="""<span style='max-width:50%;float:right'>
1320
  <a href='#' onclick='snapshot();'>Screenshot</a>
1321
  <a href='#' onclick='record_video();'>Record</a>
1322
  <a href='#' onclick='stop_recording();'>Stop rec.</a>
 
593
  }*/
594
  BABYLON.Engine.LastCreatedScene.getAnimationRatio();
595
  });
 
 
 
596
 
597
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
598
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata = {
 
710
  if (md === true) {
711
  x = parseInt(evt.clientX - evt.target.getBoundingClientRect().x);
712
  y = parseInt(evt.clientY - evt.target.getBoundingClientRect().y);
 
 
 
713
 
714
  if (Math.abs(x-xold)>16 || Math.abs(y-yold)>16) {
715
  if (Math.abs(BABYLON.Engine.LastCreatedScene.activeCamera.radius) > 16) {
 
1260
  load_all = gr.Checkbox(label="Load all")
1261
 
1262
  with gr.Group():
1263
+ camera = gr.HTML(value="""<div style='width:128px;height:128px;border:1px dotted gray;padding:0;margin:0;float:left;clear:none;' id='seek'></div><br/>
1264
+ <a href='#' id='reset_cam' style='width:12em;float:right;clear:none;color:white' onclick='
1265
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
1266
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata = {
1267
  screenshot: true,
 
1281
  document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].oncontextmenu = function(e){e.preventDefault();}
1282
  document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].ondrag = function(e){e.preventDefault();}
1283
  '>Reset camera</a>""")
1284
+ html = gr.HTML(value="""<span style='max-width:50%;float:right;clear:none;'><label for='zoom' style='width:8em'>Zoom</label><input id='zoom' type='range' style='width:128px;height:1em;' value='0.8' min='0.157' max='1.57' step='0.001' oninput='
1285
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
1286
  var evt = document.createEvent(\"Event\");
1287
  evt.initEvent(\"click\", true, false);
 
1292
 
1293
  document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].material.pointSize/2.0*Math.sqrt(2.0) + \"px)\";
1294
  '/> <span>0.8</span></span>""")
1295
+ contrast = gr.HTML(value="""<span style='max-width:50%;float:right;clear:none;'><label for='contrast' style='width:8em'>Contrast</label><input id='contrast' type='range' style='width:128px;height:1em;' value='1.0' min='0' max='2' step='0.001' oninput='
1296
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
1297
  var evt = document.createEvent(\"Event\");
1298
  evt.initEvent(\"click\", true, false);
 
1301
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.contrast = this.value;
1302
  this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.contrast;
1303
  '/> <span>1.0</span></span>""")
1304
+ exposure = gr.HTML(value="""<span style='max-width:50%;float:right;clear:none;'><label for='exposure' style='width:8em'>Exposure</label><input id='exposure' type='range' style='width:128px;height:1em;' value='1.0' min='0' max='2' step='0.001' oninput='
1305
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
1306
  var evt = document.createEvent(\"Event\");
1307
  evt.initEvent(\"click\", true, false);
 
1310
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure = this.value;
1311
  this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure;
1312
  '/> <span>1.0</span></span>""")
1313
+ snapshot = gr.HTML(value="""<span style='max-width:50%;float:right;clear:none;'>
1314
  <a href='#' onclick='snapshot();'>Screenshot</a>
1315
  <a href='#' onclick='record_video();'>Record</a>
1316
  <a href='#' onclick='stop_recording();'>Stop rec.</a>