import * as React from "react"; import { LineContainerComponent } from '../../sharedComponents/lineContainerComponent'; import { IPropertyComponentProps } from './propertyComponentProps'; import { CheckBoxLineComponent } from '../../sharedComponents/checkBoxLineComponent'; import { FloatLineComponent } from '../../sharedComponents/floatLineComponent'; import { SliderLineComponent } from '../../sharedComponents/sliderLineComponent'; import { PropertyTypeForEdition, IPropertyDescriptionForEdition } from 'babylonjs/Materials/Node/nodeMaterialDecorator'; export class GenericPropertyComponent extends React.Component { constructor(props: IPropertyComponentProps) { super(props); } render() { return ( <> ); } } export class GeneralPropertyTabComponent extends React.Component { constructor(props: IPropertyComponentProps) { super(props); } render() { return ( <> ); } } export class GenericPropertyTabComponent extends React.Component { constructor(props: IPropertyComponentProps) { super(props); } forceRebuild(notifiers?: { "rebuild"?: boolean; "update"?: boolean; }) { if (!notifiers || notifiers.update) { this.props.globalState.onUpdateRequiredObservable.notifyObservers(); } if (!notifiers || notifiers.rebuild) { this.props.globalState.onRebuildRequiredObservable.notifyObservers(); } } render() { const block = this.props.guiBlock, propStore: IPropertyDescriptionForEdition[] = (block as any)._propStore; if (!propStore) { return ( <> ); } const componentList: { [groupName: string]: JSX.Element[]} = {}, groups: string[] = []; for (const { propertyName, displayName, type, groupName, options } of propStore) { let components = componentList[groupName]; if (!components) { components = []; componentList[groupName] = components; groups.push(groupName); } switch (type) { case PropertyTypeForEdition.Boolean: { components.push( this.forceRebuild(options.notifiers)} /> ); break; } case PropertyTypeForEdition.Float: { let cantDisplaySlider = (isNaN(options.min as number) || isNaN(options.max as number) || options.min === options.max); if (cantDisplaySlider) { components.push( this.forceRebuild(options.notifiers)} /> ); } else { components.push( this.forceRebuild(options.notifiers)}/> ); } break; } } } return ( <> { groups.map((group) => {componentList[group]} ) } ); } }