@sage-rsc/talking-head-react 1.6.2 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -5
- package/dist/index.js +2062 -2175
- package/package.json +1 -1
- package/src/components/SimpleTalkingAvatar.jsx +15 -69
- package/src/lib/talkinghead.mjs +4 -126
- package/src/utils/animationLoader.js +1 -22
|
@@ -11,28 +11,15 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export async function loadAnimationsFromManifest(manifestPath) {
|
|
13
13
|
try {
|
|
14
|
-
console.log(`📥 Loading animation manifest from: ${manifestPath}`);
|
|
15
14
|
const response = await fetch(manifestPath);
|
|
16
15
|
if (!response.ok) {
|
|
17
16
|
throw new Error(`Failed to fetch manifest: ${response.status} ${response.statusText}`);
|
|
18
17
|
}
|
|
19
18
|
const manifest = await response.json();
|
|
20
|
-
console.log('📦 Raw manifest loaded:', manifest);
|
|
21
|
-
|
|
22
19
|
const animations = manifest.animations || {};
|
|
23
|
-
console.log('✅ Processed animations object:', animations);
|
|
24
|
-
|
|
25
|
-
if (animations._genderSpecific) {
|
|
26
|
-
console.log('👥 Gender-specific structure detected:', {
|
|
27
|
-
male: Object.keys(animations._genderSpecific.male || {}),
|
|
28
|
-
female: Object.keys(animations._genderSpecific.female || {}),
|
|
29
|
-
shared: Object.keys(animations._genderSpecific.shared || {})
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
20
|
return animations;
|
|
34
21
|
} catch (error) {
|
|
35
|
-
console.error('
|
|
22
|
+
console.error('Failed to load animation manifest:', error);
|
|
36
23
|
return {};
|
|
37
24
|
}
|
|
38
25
|
}
|
|
@@ -148,7 +135,6 @@ export async function autoDiscoverAnimationsFromFolder(folderPath, avatarBody =
|
|
|
148
135
|
.map(file => file.startsWith('/') ? file : `${normalizedPath}/${file}`);
|
|
149
136
|
|
|
150
137
|
if (fbxFiles.length > 0) {
|
|
151
|
-
console.log(`✅ Auto-discovered ${fbxFiles.length} animations from ${endpoint}`);
|
|
152
138
|
return fbxFiles;
|
|
153
139
|
}
|
|
154
140
|
}
|
|
@@ -182,7 +168,6 @@ export async function autoDiscoverAnimationsFromFolder(folderPath, avatarBody =
|
|
|
182
168
|
.map(file => file.startsWith('/') ? file : `${genderFolder}/${file}`);
|
|
183
169
|
|
|
184
170
|
if (fbxFiles.length > 0) {
|
|
185
|
-
console.log(`✅ Auto-discovered ${fbxFiles.length} animations from ${genderFolder}`);
|
|
186
171
|
animations.push(...fbxFiles);
|
|
187
172
|
}
|
|
188
173
|
}
|
|
@@ -205,9 +190,6 @@ export async function autoDiscoverAnimationsFromFolder(folderPath, avatarBody =
|
|
|
205
190
|
'idle1.fbx', 'idle2.fbx', 'idle_01.fbx', 'idle_02.fbx'
|
|
206
191
|
];
|
|
207
192
|
|
|
208
|
-
console.warn(`⚠️ Could not auto-discover animations from ${normalizedPath}. Consider using a manifest.json file or a server-side directory listing API.`);
|
|
209
|
-
console.info(`💡 Tip: Create a ${normalizedPath}/.list.json file with an array of FBX filenames, or use animations: { manifest: "/animations/manifest.json" }`);
|
|
210
|
-
|
|
211
193
|
return animations;
|
|
212
194
|
}
|
|
213
195
|
|
|
@@ -228,9 +210,6 @@ export async function autoLoadAnimationsFromFolders(folderPaths, avatarBody = 'F
|
|
|
228
210
|
const discoveredAnimations = await autoDiscoverAnimationsFromFolder(folderPath, avatarBody);
|
|
229
211
|
if (discoveredAnimations.length > 0) {
|
|
230
212
|
animations[groupName] = discoveredAnimations;
|
|
231
|
-
console.log(`✅ Auto-loaded ${discoveredAnimations.length} animations for group "${groupName}"`);
|
|
232
|
-
} else {
|
|
233
|
-
console.warn(`⚠️ No animations found in ${folderPath} for group "${groupName}"`);
|
|
234
213
|
}
|
|
235
214
|
} catch (error) {
|
|
236
215
|
console.error(`❌ Failed to auto-load animations from ${folderPath}:`, error);
|