|
@@ -69,6 +69,8 @@ const NodeHandler = {
|
|
|
|
|
|
};
|
|
|
|
|
|
+const nodeObjects = new WeakMap();
|
|
|
+
|
|
|
const ShaderNodeObject = ( obj ) => {
|
|
|
|
|
|
const type = typeof obj;
|
|
@@ -81,16 +83,17 @@ const ShaderNodeObject = ( obj ) => {
|
|
|
|
|
|
if ( obj.isNode === true ) {
|
|
|
|
|
|
- const node = obj;
|
|
|
-
|
|
|
- if ( node.isProxyNode !== true ) {
|
|
|
+ let nodeObject = nodeObjects.get( obj );
|
|
|
|
|
|
- node.isProxyNode = true;
|
|
|
+ if ( nodeObject === undefined ) {
|
|
|
|
|
|
- return new Proxy( node, NodeHandler );
|
|
|
+ nodeObject = new Proxy( obj, NodeHandler );
|
|
|
+ nodeObjects.set( obj, nodeObject );
|
|
|
|
|
|
}
|
|
|
|
|
|
+ return nodeObject;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|