瀏覽代碼

Add support for 'list' variables

Popov72 5 年之前
父節點
當前提交
834b74ded6

+ 7 - 0
nodeEditor/src/diagram/properties/genericNodePropertyComponent.tsx

@@ -8,6 +8,7 @@ import { CheckBoxLineComponent } from '../../sharedComponents/checkBoxLineCompon
 import { FloatLineComponent } from '../../sharedComponents/floatLineComponent';
 import { SliderLineComponent } from '../../sharedComponents/sliderLineComponent';
 import { Vector2LineComponent } from '../../sharedComponents/vector2LineComponent';
+import { OptionsLineComponent } from '../../sharedComponents/OptionsLineComponent';
 import { InputBlock } from 'babylonjs/Materials/Node/Blocks/Input/inputBlock';
 import { PropertyTypeForEdition, IPropertyDescriptionForEdition } from 'babylonjs/Materials/Node/nodeMaterialDecorator';
 
@@ -113,6 +114,12 @@ export class GenericPropertyTabComponent extends React.Component<IPropertyCompon
                     );
                     break;
                 }
+                case PropertyTypeForEdition.List: {
+                    components.push(
+                        <OptionsLineComponent label={displayName} options={options.options} target={this.props.block} propertyName={propertyName} />
+                    );
+                    break;
+                }
             }
         }
 

+ 7 - 0
src/Materials/Node/nodeMaterialDecorator.ts

@@ -2,6 +2,12 @@ export enum PropertyTypeForEdition {
     Boolean,
     Float,
     Vector2,
+    List,
+}
+
+export interface IEditablePropertyListOption {
+    "label": string;
+    "value": number;
 }
 
 export interface IEditablePropertyOption {
@@ -11,6 +17,7 @@ export interface IEditablePropertyOption {
         "rebuild"?: boolean;
         "update"?: boolean;
     };
+    "options"?: IEditablePropertyListOption[];
 }
 
 export interface IPropertyDescriptionForEdition {