소스 검색

Merge pull request #6359 from gw1108/master

Added header for texture and input nodes in material editor
David Catuhe 6 년 전
부모
커밋
a7aaa57c73

+ 24 - 0
nodeEditor/src/components/diagram/input/inputNodePropertyComponent.tsx

@@ -68,8 +68,32 @@ export class InputPropertyTabComponentProps extends React.Component<IInputProper
             { label: "Automatic", value: NodeMaterialWellKnownValues.Automatic },
         ];
 
+        /**
+         * Gets the base math type of node material block connection point.
+         * @param type Type to parse.
+         */
+        function getBaseType(type: NodeMaterialBlockConnectionPointTypes): string {
+            switch (type) {
+                case NodeMaterialBlockConnectionPointTypes.Vector3OrColor3:
+                case NodeMaterialBlockConnectionPointTypes.Color3: {
+                    return NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes.Vector3];
+                }
+                case NodeMaterialBlockConnectionPointTypes.Vector4OrColor4:
+                case NodeMaterialBlockConnectionPointTypes.Vector3OrVector4:
+                case NodeMaterialBlockConnectionPointTypes.Color3OrColor4:
+                case NodeMaterialBlockConnectionPointTypes.Vector3OrColor3OrVector4OrColor4:
+                case NodeMaterialBlockConnectionPointTypes.Color4: {
+                    return NodeMaterialBlockConnectionPointTypes[NodeMaterialBlockConnectionPointTypes.Vector4];
+                }
+                default: {
+                    return NodeMaterialBlockConnectionPointTypes[type];
+                }
+            }
+        }
+
         return (
             <div>
+                <h1>{getBaseType(connection.type)}</h1>
                 <CheckBoxLineComponent label="Is mesh attribute" onSelect={value => {
                     connection!.isAttribute = value;
                     this.props.globalState.onRebuildRequiredObservable.notifyObservers();

+ 4 - 1
nodeEditor/src/components/propertyTab/properties/texturePropertyTabComponent.tsx

@@ -50,7 +50,10 @@ export class TexturePropertyTabComponent extends React.Component<ITexturePropert
 
     render() {
         return (
-            <FileButtonLineComponent label="Replace texture" onClick={(file) => this.replaceTexture(file)} accept=".jpg, .png, .tga, .dds, .env" />
+            <div>
+                <h1>Texture</h1>
+                <FileButtonLineComponent label="Replace texture" onClick={(file) => this.replaceTexture(file)} accept=".jpg, .png, .tga, .dds, .env" />
+            </div>
         );
     }
 }