Load FBX characters directly: in-app conversion to GLB
The model button now accepts .fbx too: a new model:convert IPC runs Blender with scripts/fbx2modelglb.py (mesh + skin kept, animations dropped, embedded diffuse recovered even when the FBX references missing external textures) into userData/models3d, then the resulting GLB loads as usual. anim/model conversion share one convertFbx helper. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a5c0a8b297
commit
d329759961
6 files changed
+93
-19
No files matched your search
+2
-2
@@ -163,8 +163,8 @@
|
||||
</section>
|
||||
<section class="span2">
|
||||
<label>Modello 3D (GLB)</label>
|
||||
<button id="btn-glb-load" class="wide">🧊 Carica un modello .glb…</button>
|
||||
<input type="file" id="glb-input" accept=".glb" hidden />
|
||||
<button id="btn-glb-load" class="wide">🧊 Carica un modello (.glb / .fbx)…</button>
|
||||
<input type="file" id="glb-input" accept=".glb,.fbx" hidden />
|
||||
<div class="hint-mini" id="glb-name">Il modello ruota e balla a tempo di musica nella famiglia “Modello 3D”;
|
||||
con la camera lo comandi in “Interattivo Avatar”.</div>
|
||||
<label>Sfondo</label>
|
||||
|
||||
+17
-8
@@ -287,17 +287,26 @@ pre3dSel.addEventListener('change', apply3d);
|
||||
$('#glb-effect-go').addEventListener('click', apply3d);
|
||||
|
||||
$('#btn-glb-load').addEventListener('click', () => $('#glb-input').click());
|
||||
$('#glb-input').addEventListener('change', (e) => {
|
||||
$('#glb-input').addEventListener('change', async (e) => {
|
||||
const f = e.target.files[0];
|
||||
if (!f) return;
|
||||
const p = djv.pathForFile(f);
|
||||
if (p) {
|
||||
glbPath = p;
|
||||
localStorage.setItem('glb3d', p);
|
||||
glbSend();
|
||||
glbLabel(f.name);
|
||||
}
|
||||
let p = djv.pathForFile(f);
|
||||
e.target.value = '';
|
||||
if (!p) return;
|
||||
// FBX characters (e.g. a Mixamo T-pose) are converted to GLB by Blender
|
||||
if (/\.fbx$/i.test(p)) {
|
||||
glbLabel('⏳ converto ' + f.name + '… (qualche secondo)');
|
||||
const res = await djv.convertModel(p);
|
||||
if (!res || !res.ok) {
|
||||
$('#glb-name').textContent = '⚠️ ' + ((res && res.error) || 'conversione fallita');
|
||||
return;
|
||||
}
|
||||
p = res.path;
|
||||
}
|
||||
glbPath = p;
|
||||
localStorage.setItem('glb3d', p);
|
||||
glbSend();
|
||||
glbLabel(f.name.replace(/\.fbx$/i, '.glb'));
|
||||
});
|
||||
|
||||
// --- Effect sequence (playlist of effects with auto-cycle) ---
|
||||
|
||||
Reference in new issue
Block a user