commonLightPropertyGridComponent.tsx 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import * as React from "react";
  2. import { Observable } from "babylonjs/Misc/observable";
  3. import { Light } from "babylonjs/Lights/light";
  4. import { PropertyChangedEvent } from "../../../../propertyChangedEvent";
  5. import { LineContainerComponent } from "../../../lineContainerComponent";
  6. import { FloatLineComponent } from "../../../lines/floatLineComponent";
  7. import { TextLineComponent } from "../../../lines/textLineComponent";
  8. import { LockObject } from "../lockObject";
  9. import { GlobalState } from '../../../../globalState';
  10. import { CustomPropertyGridComponent } from '../customPropertyGridComponent';
  11. import { ButtonLineComponent } from '../../../lines/buttonLineComponent';
  12. import { TextInputLineComponent } from '../../../lines/textInputLineComponent';
  13. import { AnimationGridComponent } from '../animations/animationPropertyGridComponent';
  14. interface ICommonLightPropertyGridComponentProps {
  15. globalState: GlobalState,
  16. light: Light,
  17. lockObject: LockObject,
  18. onPropertyChangedObservable?: Observable<PropertyChangedEvent>
  19. }
  20. export class CommonLightPropertyGridComponent extends React.Component<ICommonLightPropertyGridComponentProps> {
  21. constructor(props: ICommonLightPropertyGridComponentProps) {
  22. super(props);
  23. }
  24. render() {
  25. const light = this.props.light;
  26. return (
  27. <div>
  28. <CustomPropertyGridComponent globalState={this.props.globalState} target={light}
  29. lockObject={this.props.lockObject}
  30. onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
  31. <LineContainerComponent globalState={this.props.globalState} title="GENERAL">
  32. <TextLineComponent label="ID" value={light.id} />
  33. <TextInputLineComponent lockObject={this.props.lockObject} label="Name" target={light} propertyName="name" onPropertyChangedObservable={this.props.onPropertyChangedObservable}/>
  34. <TextLineComponent label="Unique ID" value={light.uniqueId.toString()} />
  35. <TextLineComponent label="Class" value={light.getClassName()} />
  36. <FloatLineComponent lockObject={this.props.lockObject} label="Intensity" target={light} propertyName="intensity" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
  37. <ButtonLineComponent label="Dispose" onClick={() => {
  38. light.dispose();
  39. this.props.globalState.onSelectionChangedObservable.notifyObservers(null);
  40. }} />
  41. </LineContainerComponent>
  42. <AnimationGridComponent globalState={this.props.globalState} animatable={light} scene={light.getScene()} lockObject={this.props.lockObject} />
  43. </div>
  44. );
  45. }
  46. }