Преглед на файлове

edit nme directly from PP

David Catuhe преди 5 години
родител
ревизия
b9140dca50

+ 13 - 0
inspector/src/components/actionTabs/tabs/propertyGrids/postProcesses/postProcessPropertyGridComponent.tsx

@@ -7,6 +7,8 @@ import { PropertyChangedEvent } from "../../../../propertyChangedEvent";
 import { LockObject } from "../lockObject";
 import { CommonPostProcessPropertyGridComponent } from './commonPostProcessPropertyGridComponent';
 import { GlobalState } from '../../../../globalState';
+import { LineContainerComponent } from '../../../lineContainerComponent';
+import { ButtonLineComponent } from '../../../lines/buttonLineComponent';
 
 interface IPostProcessPropertyGridComponentProps {
     globalState: GlobalState;
@@ -20,12 +22,23 @@ export class PostProcessPropertyGridComponent extends React.Component<IPostProce
         super(props);
     }
 
+    edit() {        
+        const postProcess = this.props.postProcess;
+        postProcess.nodeMaterialSource.edit();
+    }
+
     render() {
         const postProcess = this.props.postProcess;
 
         return (
             <div className="pane">
                 <CommonPostProcessPropertyGridComponent globalState={this.props.globalState} lockObject={this.props.lockObject} postProcess={postProcess} onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
+                {
+                    postProcess.nodeMaterialSource &&
+                    <LineContainerComponent globalState={this.props.globalState} title="CONFIGURATION">
+                        <ButtonLineComponent label="Node Material Editor" onClick={() => this.edit()} />
+                    </LineContainerComponent>                
+                }
             </div>
         );
     }

+ 2 - 0
src/Materials/Node/nodeMaterial.ts

@@ -765,6 +765,8 @@ export class NodeMaterial extends PushMaterial {
             options, camera, samplingMode, engine, reusable, defines.toString(), textureType, tempName, { maxSimultaneousLights: this.maxSimultaneousLights }, false, textureFormat
         );
 
+        postProcess.nodeMaterialSource = this;
+
         postProcess.onApplyObservable.add((effect) => {
             if (buildId !== this._buildId) {
                 delete Effect.ShadersStore[tempName + "VertexShader"];

+ 7 - 0
src/PostProcesses/postProcess.ts

@@ -11,6 +11,7 @@ import { Engine } from '../Engines/engine';
 import { Color4 } from '../Maths/math.color';
 
 import "../Engines/Extensions/engine.renderTarget";
+import { NodeMaterial } from '../Materials';
 
 declare type Scene = import("../scene").Scene;
 declare type InternalTexture = import("../Materials/Textures/internalTexture").InternalTexture;
@@ -36,12 +37,18 @@ export class PostProcess {
     * Width of the texture to apply the post process on
     */
     public width = -1;
+    
     /**
     * Height of the texture to apply the post process on
     */
     public height = -1;
 
     /**
+     * Gets the node material used to create this postprocess (null if the postprocess was manually created)
+     */
+    public nodeMaterialSource: Nullable<NodeMaterial> = null;
+
+    /**
     * Internal, reference to the location where this postprocess was output to. (Typically the texture on the next postprocess in the chain)
     * @hidden
     */