|
@@ -194,60 +194,55 @@ class TSLGraphEditor extends Extension {
|
|
|
|
|
|
|
|
renderer.domElement.addEventListener( 'pointerup', ( e ) => {
|
|
renderer.domElement.addEventListener( 'pointerup', ( e ) => {
|
|
|
|
|
|
|
|
- const frame = inspector.getFrame();
|
|
|
|
|
-
|
|
|
|
|
- for ( const render of frame.renders ) {
|
|
|
|
|
-
|
|
|
|
|
- const scene = render.scene;
|
|
|
|
|
-
|
|
|
|
|
- if ( scene.isScene !== true ) continue;
|
|
|
|
|
|
|
+ const primaryPass = inspector.getPrimaryPass();
|
|
|
|
|
|
|
|
- const camera = render.camera;
|
|
|
|
|
|
|
+ if ( primaryPass === null ) return;
|
|
|
|
|
|
|
|
- if ( pointerDownPosition.distanceTo( pointer.set( e.clientX, e.clientY ) ) > 2 ) return;
|
|
|
|
|
|
|
+ const scene = primaryPass.scene;
|
|
|
|
|
+ const camera = primaryPass.camera;
|
|
|
|
|
|
|
|
- const rect = renderer.domElement.getBoundingClientRect();
|
|
|
|
|
- pointer.x = ( ( e.clientX - rect.left ) / rect.width ) * 2 - 1;
|
|
|
|
|
- pointer.y = - ( ( e.clientY - rect.top ) / rect.height ) * 2 + 1;
|
|
|
|
|
|
|
+ if ( pointerDownPosition.distanceTo( pointer.set( e.clientX, e.clientY ) ) > 2 ) return;
|
|
|
|
|
|
|
|
- raycaster.setFromCamera( pointer, camera );
|
|
|
|
|
|
|
+ const rect = renderer.domElement.getBoundingClientRect();
|
|
|
|
|
+ pointer.x = ( ( e.clientX - rect.left ) / rect.width ) * 2 - 1;
|
|
|
|
|
+ pointer.y = - ( ( e.clientY - rect.top ) / rect.height ) * 2 + 1;
|
|
|
|
|
|
|
|
- const intersects = raycaster.intersectObjects( scene.children, true );
|
|
|
|
|
|
|
+ raycaster.setFromCamera( pointer, camera );
|
|
|
|
|
|
|
|
- let graphMaterial = null;
|
|
|
|
|
|
|
+ const intersects = raycaster.intersectObjects( scene.children, true );
|
|
|
|
|
|
|
|
- if ( intersects.length > 0 ) {
|
|
|
|
|
|
|
+ let graphMaterial = null;
|
|
|
|
|
|
|
|
- for ( const intersect of intersects ) {
|
|
|
|
|
|
|
+ if ( intersects.length > 0 ) {
|
|
|
|
|
|
|
|
- const object = intersect.object;
|
|
|
|
|
- const material = object.material;
|
|
|
|
|
|
|
+ for ( const intersect of intersects ) {
|
|
|
|
|
|
|
|
- if ( material && material.isNodeMaterial ) {
|
|
|
|
|
|
|
+ const object = intersect.object;
|
|
|
|
|
+ const material = object.material;
|
|
|
|
|
|
|
|
- removeBoundingBox();
|
|
|
|
|
|
|
+ if ( material && material.isNodeMaterial ) {
|
|
|
|
|
|
|
|
- boundingBox = new BoxHelper( object, 0xffff00 );
|
|
|
|
|
- scene.add( boundingBox );
|
|
|
|
|
|
|
+ removeBoundingBox();
|
|
|
|
|
|
|
|
- graphMaterial = material;
|
|
|
|
|
|
|
+ boundingBox = new BoxHelper( object, 0xffff00 );
|
|
|
|
|
+ scene.add( boundingBox );
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ graphMaterial = material;
|
|
|
|
|
|
|
|
- if ( object.isMesh || object.isSprite ) {
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+ if ( object.isMesh || object.isSprite ) {
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ break;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- this.setMaterial( graphMaterial );
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ this.setMaterial( graphMaterial );
|
|
|
|
|
+
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -473,7 +468,7 @@ class TSLGraphEditor extends Extension {
|
|
|
|
|
|
|
|
await this.command( 'clear-graph' );
|
|
await this.command( 'clear-graph' );
|
|
|
|
|
|
|
|
- await this.command( 'set-root-material', { materialType: this._getGraphType( this.material ) } );
|
|
|
|
|
|
|
+ await this.command( 'set-root-material', { materialType: this._getGraphType( material ) } );
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|