import * as React from "react"; import { Observable } from "babylonjs/Misc/observable"; import { PropertyChangedEvent } from "../../../../propertyChangedEvent"; import { LineContainerComponent } from "../../../lineContainerComponent"; import { CommonMaterialPropertyGridComponent } from "./commonMaterialPropertyGridComponent"; import { LockObject } from "../../../../../sharedUiComponents/tabs/propertyGrids/lockObject"; import { GlobalState } from '../../../../globalState'; import { TextLineComponent } from '../../../../../sharedUiComponents/lines/textLineComponent'; import { Material } from 'babylonjs/Materials/material'; import { MultiMaterial } from 'babylonjs/Materials/multiMaterial'; interface IMultiMaterialPropertyGridComponentProps { globalState: GlobalState; material: MultiMaterial; lockObject: LockObject; onSelectionChangedObservable?: Observable; onPropertyChangedObservable?: Observable; } export class MultiMaterialPropertyGridComponent extends React.Component { constructor(props: IMultiMaterialPropertyGridComponentProps) { super(props); } onMaterialLink(mat: Material) { if (!this.props.onSelectionChangedObservable) { return; } this.props.onSelectionChangedObservable.notifyObservers(mat); } renderChildMaterial() { const material = this.props.material; return ( { material.subMaterials.map((mat, i) => { if (mat) { return ( this.onMaterialLink(mat)} /> ) } return null; }) } ); } render() { const material = this.props.material; return (
{this.renderChildMaterial()}
); } }