瀏覽代碼

PropertyBinding: Allow `map` as target object. (#24537)

Michael Herzog 2 年之前
父節點
當前提交
946c493bfe
共有 1 個文件被更改,包括 20 次插入1 次删除
  1. 20 1
      src/animation/PropertyBinding.js

+ 20 - 1
src/animation/PropertyBinding.js

@@ -32,7 +32,7 @@ const _trackRe = new RegExp( ''
 	+ '$'
 );
 
-const _supportedObjectNames = [ 'material', 'materials', 'bones' ];
+const _supportedObjectNames = [ 'material', 'materials', 'bones', 'map' ];
 
 class Composite {
 
@@ -496,6 +496,25 @@ class PropertyBinding {
 
 					break;
 
+				case 'map':
+
+					if ( ! targetObject.material ) {
+
+						console.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );
+						return;
+
+					}
+
+					if ( ! targetObject.material.map ) {
+
+						console.error( 'THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.', this );
+						return;
+
+					}
+
+					targetObject = targetObject.material.map;
+					break;
+
 				default:
 
 					if ( targetObject[ objectName ] === undefined ) {