@sage-rsc/talking-head-react 1.0.83 → 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.83",
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,10 +2752,10 @@ class TalkingHead {
2742
2752
  } else if ( typeof x === 'function' ) {
2743
2753
  return x;
2744
2754
  } else if ( typeof x === 'string' || x instanceof String ) {
2745
- // Intercept pose values and override 'hip' for male avatars
2746
- if (mt === 'pose' && this.avatar && this.avatar.body === 'M' && x === 'hip') {
2747
- console.log('Intercepting hip pose in animation factory, overriding to wide');
2748
- return 'wide'; // Override hip to wide for male avatars
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'
2749
2759
  }
2750
2760
  return x.slice();
2751
2761
  } else if ( Array.isArray(x) ) {
@@ -3037,16 +3047,14 @@ class TalkingHead {
3037
3047
  break;
3038
3048
 
3039
3049
  case 'pose':
3040
- // Ensure gender-appropriate pose for male avatars
3041
- // If 'hip' pose is selected for male avatar, override to 'wide' or 'side'
3042
- if (this.avatar && this.avatar.body === 'M' && j === 'hip') {
3043
- // Prefer 'wide' for male avatars, fallback to 'side' if 'wide' doesn't exist
3044
- if (this.poseTemplates['wide']) {
3045
- j = 'wide';
3046
- console.log('Overriding hip pose to wide for male avatar');
3047
- } else if (this.poseTemplates['side']) {
3048
- j = 'side';
3049
- 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
+ }
3050
3058
  }
3051
3059
  }
3052
3060
  this.poseName = j;