@needle-tools/three 0.146.8 → 0.146.9
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.
|
@@ -812,6 +812,11 @@ class GLTFMaterialsClearcoatExtension {
|
|
|
812
812
|
* Draft Specification: https://github.com/ux3d/glTF/tree/extensions/KHR_animation_pointer/extensions/2.0/Khronos/KHR_animation_pointer
|
|
813
813
|
*/
|
|
814
814
|
|
|
815
|
+
|
|
816
|
+
// HACK monkey patching findNode to ensure we can map to other types required by KHR_animation_pointer.
|
|
817
|
+
const find = PropertyBinding.findNode;
|
|
818
|
+
const _animationPointerDebug = false;
|
|
819
|
+
|
|
815
820
|
class GLTFAnimationPointerExtension {
|
|
816
821
|
|
|
817
822
|
ANIMATION_TARGET_TYPE = {
|
|
@@ -828,23 +833,19 @@ class GLTFAnimationPointerExtension {
|
|
|
828
833
|
|
|
829
834
|
}
|
|
830
835
|
|
|
831
|
-
_animationPointerDebug = false;
|
|
832
836
|
_havePatchedPropertyBindings = false;
|
|
833
837
|
_patchPropertyBindingFindNode() {
|
|
834
838
|
|
|
835
839
|
if ( this._havePatchedPropertyBindings ) return;
|
|
836
840
|
this._havePatchedPropertyBindings = true;
|
|
837
841
|
|
|
838
|
-
// HACK monkey patching findNode to ensure we can map to other types required by KHR_animation_pointer.
|
|
839
|
-
const find = PropertyBinding.findNode;
|
|
840
|
-
|
|
841
842
|
// "node" is the Animator component in our case
|
|
842
843
|
// "path" is the animated property path, just with translated material names.
|
|
843
|
-
PropertyBinding.findNode = ( node, path )
|
|
844
|
+
PropertyBinding.findNode = function ( node, path ) {
|
|
844
845
|
|
|
845
846
|
if ( path.startsWith( '.materials.' ) ) {
|
|
846
847
|
|
|
847
|
-
if (
|
|
848
|
+
if ( _animationPointerDebug ) console.log( 'FIND', path );
|
|
848
849
|
|
|
849
850
|
const remainingPath = path.substring( '.materials.'.length ).substring( path.indexOf( '.' ) );
|
|
850
851
|
const nextIndex = remainingPath.indexOf( '.' );
|
|
@@ -856,7 +857,7 @@ class GLTFAnimationPointerExtension {
|
|
|
856
857
|
if ( x[ 'material' ]?.uuid === uuid || x[ 'material' ]?.name === uuid ) {
|
|
857
858
|
|
|
858
859
|
res = x[ 'material' ];
|
|
859
|
-
if (
|
|
860
|
+
if ( _animationPointerDebug ) console.log( res, remainingPath );
|
|
860
861
|
if ( res !== null ) {
|
|
861
862
|
|
|
862
863
|
if ( remainingPath.endsWith( '.map' ) )
|
|
@@ -895,7 +896,7 @@ class GLTFAnimationPointerExtension {
|
|
|
895
896
|
let key = val;
|
|
896
897
|
if ( index >= 0 ) key = index;
|
|
897
898
|
currentTarget = currentTarget[ key ];
|
|
898
|
-
if (
|
|
899
|
+
if ( _animationPointerDebug )
|
|
899
900
|
console.log( currentTarget );
|
|
900
901
|
|
|
901
902
|
} else {
|
|
@@ -920,7 +921,7 @@ class GLTFAnimationPointerExtension {
|
|
|
920
921
|
|
|
921
922
|
}
|
|
922
923
|
|
|
923
|
-
if (
|
|
924
|
+
if ( _animationPointerDebug )
|
|
924
925
|
console.log( 'NODE', path, currentTarget );
|
|
925
926
|
|
|
926
927
|
return currentTarget;
|