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
+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