Spaces:
Running
Running
deploy(S4): Blender headless pipeline + WebAR client + backend fixes
Browse files
backend/services/blender_processor.py
CHANGED
|
@@ -150,7 +150,15 @@ def save_template(template: dict) -> str:
|
|
| 150 |
|
| 151 |
|
| 152 |
def match_template(kit: str, part_names: list[str], min_score: float = 0.5, min_hits: int = 2):
|
| 153 |
-
"""Same scoring contract as the client: kit equality + behavior-target overlap.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
clean_kit = str(kit or "").lower()
|
| 155 |
names = {slug(n) for n in part_names if n}
|
| 156 |
if not names:
|
|
@@ -160,12 +168,22 @@ def match_template(kit: str, part_names: list[str], min_score: float = 0.5, min_
|
|
| 160 |
if str(template.get("kit") or "").lower() != clean_kit:
|
| 161 |
continue
|
| 162 |
targets = {slug(b.get("target")) for b in template.get("behaviors") or [] if b.get("target")}
|
| 163 |
-
if
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
return {"template": best, "score": best_score} if best else None
|
| 170 |
|
| 171 |
|
|
@@ -270,6 +288,10 @@ async def forge_process_glb(input_path: str, name: str, kit: str,
|
|
| 270 |
"kit": kit,
|
| 271 |
"source": "blender",
|
| 272 |
"parts": [{"name": n} for n in read_glb_part_names(out_path)],
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
"behaviors": (template or {}).get("behaviors") or [],
|
| 274 |
"fromModel": out_name,
|
| 275 |
}
|
|
|
|
| 150 |
|
| 151 |
|
| 152 |
def match_template(kit: str, part_names: list[str], min_score: float = 0.5, min_hits: int = 2):
|
| 153 |
+
"""Same scoring contract as the client: kit equality + behavior-target overlap.
|
| 154 |
+
|
| 155 |
+
S4 fix: templates built from models with no rig-able behaviors were saved with
|
| 156 |
+
`behaviors: []` and then skipped here forever (`if not targets: continue`), so
|
| 157 |
+
the reuse path was dead for every non-interactive model — each re-import
|
| 158 |
+
relaunched Blender. Such templates now fall back to a near-exact structural
|
| 159 |
+
match on the SOURCE part names (`matchParts`), so an identical re-import
|
| 160 |
+
correctly skips the redundant Blender normalization pass.
|
| 161 |
+
"""
|
| 162 |
clean_kit = str(kit or "").lower()
|
| 163 |
names = {slug(n) for n in part_names if n}
|
| 164 |
if not names:
|
|
|
|
| 168 |
if str(template.get("kit") or "").lower() != clean_kit:
|
| 169 |
continue
|
| 170 |
targets = {slug(b.get("target")) for b in template.get("behaviors") or [] if b.get("target")}
|
| 171 |
+
if targets:
|
| 172 |
+
hits = len(targets & names)
|
| 173 |
+
score = hits / len(targets)
|
| 174 |
+
if hits >= min_hits and score >= min_score and score > best_score:
|
| 175 |
+
best, best_score = template, score
|
| 176 |
+
else:
|
| 177 |
+
# No interactive behaviors: reuse only on a strong structural match of
|
| 178 |
+
# the source part names, so we never falsely reuse a different model.
|
| 179 |
+
sig = {slug(n) for n in (template.get("matchParts") or []) if n}
|
| 180 |
+
if not sig: # templates saved before matchParts existed
|
| 181 |
+
sig = {slug(p.get("name")) for p in template.get("parts") or [] if p.get("name")}
|
| 182 |
+
if not sig:
|
| 183 |
+
continue
|
| 184 |
+
score = len(sig & names) / len(sig)
|
| 185 |
+
if score >= 0.9 and score > best_score:
|
| 186 |
+
best, best_score = template, score
|
| 187 |
return {"template": best, "score": best_score} if best else None
|
| 188 |
|
| 189 |
|
|
|
|
| 288 |
"kit": kit,
|
| 289 |
"source": "blender",
|
| 290 |
"parts": [{"name": n} for n in read_glb_part_names(out_path)],
|
| 291 |
+
# S4: the SOURCE node names are the reuse signature — matched against the
|
| 292 |
+
# next import's source names so structurally-identical models reuse this
|
| 293 |
+
# template instead of relaunching Blender (see match_template fallback).
|
| 294 |
+
"matchParts": part_names,
|
| 295 |
"behaviors": (template or {}).get("behaviors") or [],
|
| 296 |
"fromModel": out_name,
|
| 297 |
}
|
webar/assets/StereoEffect-D64g7BM0.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{ct as e,ot as t}from"./three-CGKoenNp.js";var n=class{constructor(n){let r=new t;r.aspect=.5;let i=new e;this.setEyeSeparation=function(e){r.eyeSep=e},this.setSize=function(e,t){n.setSize(e,t)},this.render=function(e,t){e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),r.update(t);let a=n.autoClear;n.getSize(i),n.autoClear=!1,n.clear(),n.setScissorTest(!0),n.setScissor(0,0,i.width/2,i.height),n.setViewport(0,0,i.width/2,i.height),n.render(e,r.cameraL),n.setScissor(i.width/2,0,i.width/2,i.height),n.setViewport(i.width/2,0,i.width/2,i.height),n.render(e,r.cameraR),n.setScissorTest(!1),n.autoClear=a}}};export{n as StereoEffect};
|
webar/assets/ar-compositor-BV-j37Aq.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{n as e}from"./ar-init-DL0ETfcc.js";export{e as initVrStereoSplitScreen};
|
webar/assets/ar-init-DL0ETfcc.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
webar/assets/index-JkST-uMb.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ar-init-DL0ETfcc.js","./mediapipe-Ck-u_eH7.js","./physics-ZWohGOc1.js","./three-CGKoenNp.js","./rolldown-runtime-DK3Fl9T5.js"])))=>i.map(i=>d[i]);
|
| 2 |
+
import{r as e}from"./mediapipe-Ck-u_eH7.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var t=`jarvis_omega_session_credentials_v1`,n=`/xr/ar_config`;function r(){try{return localStorage.getItem(t)||``}catch{return``}}function i(e){try{localStorage.setItem(t,String(e||``).trim())}catch{}}async function a(e){try{return(await fetch(n,{headers:{Authorization:`Bearer ${e}`},cache:`no-store`})).status===200}catch{return!1}}async function o(){await e(()=>import(`./ar-init-DL0ETfcc.js`),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function s(){let e=document.createElement(`div`);return e.id=`omega-access-gate`,e.innerHTML=`
|
| 3 |
+
<style>
|
| 4 |
+
#omega-access-gate {
|
| 5 |
+
position: fixed; inset: 0; z-index: 100000;
|
| 6 |
+
display: flex; align-items: center; justify-content: center;
|
| 7 |
+
background:
|
| 8 |
+
radial-gradient(120% 90% at 50% -10%, rgba(11,132,255,0.18), transparent 60%),
|
| 9 |
+
radial-gradient(80% 70% at 50% 120%, rgba(0,224,198,0.10), transparent 55%),
|
| 10 |
+
#05070b;
|
| 11 |
+
font-family: 'Inter', system-ui, sans-serif;
|
| 12 |
+
-webkit-tap-highlight-color: transparent;
|
| 13 |
+
animation: gateFade .5s ease both;
|
| 14 |
+
}
|
| 15 |
+
@keyframes gateFade { from { opacity: 0 } to { opacity: 1 } }
|
| 16 |
+
#omega-access-gate .card {
|
| 17 |
+
width: min(92vw, 380px);
|
| 18 |
+
padding: 34px 30px 28px;
|
| 19 |
+
border-radius: 22px;
|
| 20 |
+
background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
|
| 21 |
+
border: 1px solid rgba(120,180,255,0.18);
|
| 22 |
+
box-shadow: 0 30px 80px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.06);
|
| 23 |
+
backdrop-filter: blur(22px) saturate(140%);
|
| 24 |
+
text-align: center;
|
| 25 |
+
}
|
| 26 |
+
#omega-access-gate .ring {
|
| 27 |
+
width: 62px; height: 62px; margin: 0 auto 18px;
|
| 28 |
+
border-radius: 50%;
|
| 29 |
+
display: grid; place-items: center;
|
| 30 |
+
background: radial-gradient(circle at 50% 35%, rgba(11,132,255,0.35), rgba(11,132,255,0.06));
|
| 31 |
+
border: 1px solid rgba(120,180,255,0.4);
|
| 32 |
+
box-shadow: 0 0 30px rgba(11,132,255,0.35);
|
| 33 |
+
}
|
| 34 |
+
#omega-access-gate .ring svg { width: 26px; height: 26px; stroke: #cfe6ff; }
|
| 35 |
+
#omega-access-gate h1 {
|
| 36 |
+
margin: 0; font-size: 19px; font-weight: 700; letter-spacing: .3px; color: #eaf2ff;
|
| 37 |
+
}
|
| 38 |
+
#omega-access-gate p {
|
| 39 |
+
margin: 8px 0 22px; font-size: 12.5px; line-height: 1.5; color: rgba(200,216,240,0.62);
|
| 40 |
+
}
|
| 41 |
+
#omega-access-gate .field {
|
| 42 |
+
display: flex; gap: 8px; align-items: center;
|
| 43 |
+
background: rgba(0,0,0,0.35);
|
| 44 |
+
border: 1px solid rgba(120,180,255,0.22);
|
| 45 |
+
border-radius: 13px; padding: 4px 4px 4px 14px;
|
| 46 |
+
transition: border-color .2s, box-shadow .2s;
|
| 47 |
+
}
|
| 48 |
+
#omega-access-gate .field.focus { border-color: rgba(11,132,255,0.7); box-shadow: 0 0 0 3px rgba(11,132,255,0.18); }
|
| 49 |
+
#omega-access-gate .field.error { border-color: rgba(255,90,90,0.8); box-shadow: 0 0 0 3px rgba(255,90,90,0.16); }
|
| 50 |
+
#omega-access-gate input {
|
| 51 |
+
flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
|
| 52 |
+
color: #eaf2ff; font-size: 15px; letter-spacing: 1px; padding: 12px 0;
|
| 53 |
+
}
|
| 54 |
+
#omega-access-gate input::placeholder { color: rgba(200,216,240,0.35); letter-spacing: .3px; }
|
| 55 |
+
#omega-access-gate button {
|
| 56 |
+
border: 0; cursor: pointer;
|
| 57 |
+
width: 46px; height: 42px; border-radius: 10px;
|
| 58 |
+
background: linear-gradient(180deg, #1b8bff, #0a6be0);
|
| 59 |
+
color: #fff; font-size: 18px; display: grid; place-items: center;
|
| 60 |
+
transition: filter .15s, transform .1s;
|
| 61 |
+
}
|
| 62 |
+
#omega-access-gate button:hover { filter: brightness(1.08); }
|
| 63 |
+
#omega-access-gate button:active { transform: scale(0.94); }
|
| 64 |
+
#omega-access-gate button[disabled] { opacity: .55; cursor: default; }
|
| 65 |
+
#omega-access-gate .msg { margin-top: 14px; font-size: 12px; min-height: 16px; color: rgba(255,120,120,0.9); }
|
| 66 |
+
#omega-access-gate .foot { margin-top: 18px; font-size: 10.5px; color: rgba(200,216,240,0.32); letter-spacing: .4px; }
|
| 67 |
+
#omega-access-gate .spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.35); border-top-color:#fff; border-radius:50%; animation: gateSpin .7s linear infinite; }
|
| 68 |
+
@keyframes gateSpin { to { transform: rotate(360deg) } }
|
| 69 |
+
</style>
|
| 70 |
+
<div class="card" role="dialog" aria-label="OMEGA access">
|
| 71 |
+
<div class="ring">
|
| 72 |
+
<svg viewBox="0 0 24 24" fill="none" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
| 73 |
+
<rect x="4.5" y="10.5" width="15" height="10" rx="2.2"></rect>
|
| 74 |
+
<path d="M8 10.5V7.5a4 4 0 0 1 8 0v3"></path>
|
| 75 |
+
<circle cx="12" cy="15.4" r="1.3"></circle>
|
| 76 |
+
</svg>
|
| 77 |
+
</div>
|
| 78 |
+
<h1>OMEGA Access</h1>
|
| 79 |
+
<p>Enter your cloud access key to unlock the AR system.</p>
|
| 80 |
+
<div class="field" id="gate-field">
|
| 81 |
+
<input id="gate-input" type="password" inputmode="text" autocomplete="current-password"
|
| 82 |
+
placeholder="Access key" aria-label="Access key" />
|
| 83 |
+
<button id="gate-go" aria-label="Unlock">→</button>
|
| 84 |
+
</div>
|
| 85 |
+
<div class="msg" id="gate-msg"></div>
|
| 86 |
+
<div class="foot">JARVIS · FRIDAY · OMEGA</div>
|
| 87 |
+
</div>`,e}async function c(e,{field:t,input:n,go:r,msg:s},c){let u=String(e||n?.value||``).trim();if(!u){l(t,s,`Enter your access key.`);return}if(r.innerHTML=`<span class="spin"></span>`,r.disabled=!0,!await a(u)){r.disabled=!1,r.textContent=`→`,l(t,s,`Incorrect access key.`),n&&(n.value=``,n.focus());return}i(u),s.style.color=`rgba(0,224,198,0.9)`,s.textContent=`Access granted.`,c.style.transition=`opacity .45s ease`,c.style.opacity=`0`,setTimeout(()=>c.remove(),460),await o()}function l(e,t,n){t.style.color=`rgba(255,120,120,0.9)`,t.textContent=n,e.classList.add(`error`),setTimeout(()=>e.classList.remove(`error`),900)}async function u(){let e=r();if(e&&await a(e)){await o();return}let t=s();document.body.appendChild(t);let n=t.querySelector(`#gate-field`),i=t.querySelector(`#gate-input`),l=t.querySelector(`#gate-go`),u=t.querySelector(`#gate-msg`),d={field:n,input:i,go:l,msg:u};i.addEventListener(`focus`,()=>n.classList.add(`focus`)),i.addEventListener(`blur`,()=>n.classList.remove(`focus`)),i.addEventListener(`input`,()=>{u.textContent=``}),i.addEventListener(`keydown`,e=>{e.key===`Enter`&&c(null,d,t)}),l.addEventListener(`click`,()=>c(null,d,t)),setTimeout(()=>i.focus(),300)}document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,u,{once:!0}):u();
|
webar/assets/three-CGKoenNp.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
webar/index.html
CHANGED
|
@@ -119,7 +119,7 @@
|
|
| 119 |
<script src="https://cdn.jsdelivr.net/npm/@mediapipe/hands/hands.js" crossorigin="anonymous"></script>
|
| 120 |
<script src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils/camera_utils.js" crossorigin="anonymous"></script>
|
| 121 |
<script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.5.0/model-viewer.min.js" crossorigin="anonymous"></script>
|
| 122 |
-
<script type="module" crossorigin src="./assets/index-
|
| 123 |
<link rel="modulepreload" crossorigin href="./assets/mediapipe-Ck-u_eH7.js">
|
| 124 |
<link rel="stylesheet" crossorigin href="./assets/index-DSd7Ky4D.css">
|
| 125 |
</head>
|
|
|
|
| 119 |
<script src="https://cdn.jsdelivr.net/npm/@mediapipe/hands/hands.js" crossorigin="anonymous"></script>
|
| 120 |
<script src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils/camera_utils.js" crossorigin="anonymous"></script>
|
| 121 |
<script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.5.0/model-viewer.min.js" crossorigin="anonymous"></script>
|
| 122 |
+
<script type="module" crossorigin src="./assets/index-JkST-uMb.js"></script>
|
| 123 |
<link rel="modulepreload" crossorigin href="./assets/mediapipe-Ck-u_eH7.js">
|
| 124 |
<link rel="stylesheet" crossorigin href="./assets/index-DSd7Ky4D.css">
|
| 125 |
</head>
|