@sage-rsc/talking-head-react 1.0.82 → 1.0.84

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sage-rsc/talking-head-react",
3
- "version": "1.0.82",
3
+ "version": "1.0.84",
4
4
  "description": "A reusable React component for 3D talking avatars with lip-sync and text-to-speech",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -432,11 +432,15 @@ class TalkingHead {
432
432
  anims: [
433
433
  { name: 'breathing', delay: 1500, dt: [ 1200,500,1000 ], vs: { chestInhale: [0.5,0.5,0] } },
434
434
  { name: 'pose', alt: [
435
- { p: 0.5, delay: [5000,30000], vs: { pose: ['side'] } },
435
+ { p: 0.5, delay: [5000,30000], vs: { pose: ['side'] },
436
+ 'M': { delay: [5000,30000], vs: { pose: ['wide'] } }
437
+ },
436
438
  { p: 0.3, delay: [5000,30000], vs: { pose: ['hip'] },
437
439
  'M': { delay: [5000,30000], vs: { pose: ['wide'] } }
438
440
  },
439
- { delay: [5000,30000], vs: { pose: ['straight'] } }
441
+ { delay: [5000,30000], vs: { pose: ['straight'] },
442
+ 'M': { delay: [5000,30000], vs: { pose: ['wide'] } }
443
+ }
440
444
  ]},
441
445
  { name: 'head',
442
446
  idle: { delay: [0,1000], dt: [ [200,5000] ], vs: { bodyRotateX: [[-0.04,0.10]], bodyRotateY: [[-0.3,0.3]], bodyRotateZ: [[-0.08,0.08]] } },
@@ -456,9 +460,11 @@ class TalkingHead {
456
460
  { name: 'pose',
457
461
  idle: {
458
462
  alt: [
459
- { p: 0.6, delay: [5000,30000], vs: { pose: ['side'] } },
463
+ { p: 0.6, delay: [5000,30000], vs: { pose: ['side'] },
464
+ 'M': { delay: [5000,30000], vs: { pose: ['wide'] } }
465
+ },
460
466
  { p: 0.2, delay: [5000,30000], vs: { pose: ['hip'] },
461
- 'M': { delay: [5000,30000], vs: { pose: ['side'] } }
467
+ 'M': { delay: [5000,30000], vs: { pose: ['wide'] } }
462
468
  },
463
469
  { p: 0.1, delay: [5000,30000], vs: { pose: ['straight'] } },
464
470
  { delay: [5000,10000], vs: { pose: ['wide'] } },
@@ -467,8 +473,12 @@ class TalkingHead {
467
473
  },
468
474
  speaking: {
469
475
  alt: [
470
- { p: 0.4, delay: [5000,30000], vs: { pose: ['side'] } },
471
- { p: 0.4, delay: [5000,30000], vs: { pose: ['straight'] } },
476
+ { p: 0.4, delay: [5000,30000], vs: { pose: ['side'] },
477
+ 'M': { delay: [5000,30000], vs: { pose: ['wide'] } }
478
+ },
479
+ { p: 0.4, delay: [5000,30000], vs: { pose: ['straight'] },
480
+ 'M': { delay: [5000,30000], vs: { pose: ['wide'] } }
481
+ },
472
482
  { delay: [5000,20000], vs: { pose: ['hip'] },
473
483
  'M': { delay: [5000,30000], vs: { pose: ['wide'] } }
474
484
  },
@@ -2742,6 +2752,11 @@ class TalkingHead {
2742
2752
  } else if ( typeof x === 'function' ) {
2743
2753
  return x;
2744
2754
  } else if ( typeof x === 'string' || x instanceof String ) {
2755
+ // Intercept pose values and override 'hip' and 'side' to 'wide' for male avatars
2756
+ if (mt === 'pose' && this.avatar && this.avatar.body === 'M' && (x === 'hip' || x === 'side')) {
2757
+ console.log('Intercepting pose', x, 'in animation factory, overriding to wide for male avatar');
2758
+ return 'wide'; // Always use 'wide' for male avatars, never 'side' or 'hip'
2759
+ }
2745
2760
  return x.slice();
2746
2761
  } else if ( Array.isArray(x) ) {
2747
2762
  if ( mt === 'gesture' ) {
@@ -3032,16 +3047,14 @@ class TalkingHead {
3032
3047
  break;
3033
3048
 
3034
3049
  case 'pose':
3035
- // Ensure gender-appropriate pose for male avatars
3036
- // If 'hip' pose is selected for male avatar, override to 'wide' or 'side'
3037
- if (this.avatar && this.avatar.body === 'M' && j === 'hip') {
3038
- // Prefer 'wide' for male avatars, fallback to 'side' if 'wide' doesn't exist
3039
- if (this.poseTemplates['wide']) {
3040
- j = 'wide';
3041
- console.log('Overriding hip pose to wide for male avatar');
3042
- } else if (this.poseTemplates['side']) {
3043
- j = 'side';
3044
- console.log('Overriding hip pose to side for male avatar');
3050
+ // Ensure gender-appropriate pose for male avatars - always use 'wide', never 'side' or 'hip'
3051
+ if (this.avatar && this.avatar.body === 'M') {
3052
+ if (j === 'hip' || j === 'side') {
3053
+ // Always override 'hip' and 'side' to 'wide' for male avatars
3054
+ if (this.poseTemplates['wide']) {
3055
+ j = 'wide';
3056
+ console.log('Overriding pose', j === 'hip' ? 'hip' : 'side', 'to wide for male avatar');
3057
+ }
3045
3058
  }
3046
3059
  }
3047
3060
  this.poseName = j;