msDestiny14 4 лет назад
Родитель
Сommit
7ebf0bb203

+ 1 - 1
guiEditor/src/components/propertyTab/propertyTabComponent.tsx

@@ -187,7 +187,7 @@ export class PropertyTabComponent extends React.Component<IPropertyTabComponentP
                 <div>
                     <LineContainerComponent title="GENERAL">
                         <TextLineComponent label="Version" value={Engine.Version}/>
-                        <TextLineComponent label="Help" value="doc.babylonjs.com" underline={true} onLink={() => window.open('https://doc.babylonjs.com/how_to/node_material', '_blank')}/>
+                        <TextLineComponent label="Help" value="doc.babylonjs.com" underline={true} onLink={() => window.open('https://doc.babylonjs.com', '_blank')}/>
                         <ButtonLineComponent label="Reset to default" onClick={() => {
                             this.props.globalState.onResetRequiredObservable.notifyObservers();
                         }} />

+ 14 - 14
guiEditor/src/diagram/guiNode.ts

@@ -66,19 +66,19 @@ export class GUINode {
     }
 
     public get width() {
-        return this.guiNode.widthInPixels;
+        return this.guiControl.widthInPixels;
     }
 
     public get height() {
-        return this.guiNode.heightInPixels;
+        return this.guiControl.heightInPixels;
     }
 
     public get id() {
-        return this.guiNode.uniqueId;
+        return this.guiControl.uniqueId;
     }
 
     public get name() {
-        return this.guiNode.name;
+        return this.guiControl.name;
     }
 
     public get isSelected() {
@@ -101,29 +101,29 @@ export class GUINode {
         }
     }
 
-    public constructor(globalState: GlobalState, public guiNode: Control) {
+    public constructor(globalState: GlobalState, public guiControl: Control) {
         this._globalState = globalState;
         this._ownerCanvas = this._globalState.workbench;
         
-        guiNode.onPointerUpObservable.add(evt => {
+        guiControl.onPointerUpObservable.add(evt => {
             this.clicked = false;
             console.log("up");
         });
 
-        guiNode.onPointerDownObservable.add( evt => {
+        guiControl.onPointerDownObservable.add( evt => {
             this.clicked = true;
             this.isSelected = true;
             console.log("down");
         }
         );
 
-        guiNode.onPointerEnterObservable.add( evt => {
+        guiControl.onPointerEnterObservable.add( evt => {
             this._ownerCanvas.isOverGUINode = true;
             console.log("in");
         }
         );
 
-        guiNode.onPointerOutObservable.add( evt => {
+        guiControl.onPointerOutObservable.add( evt => {
             this._ownerCanvas.isOverGUINode = false;
             console.log("out");
         }
@@ -158,7 +158,7 @@ export class GUINode {
     }
 
     public renderProperties(): Nullable<JSX.Element> {
-        let className = this.guiNode.getClassName();
+        let className = this.guiControl.getClassName();
         let control = PropertyGuiLedger.RegisteredControls[className];
         
         if (!control) {
@@ -167,14 +167,14 @@ export class GUINode {
 
         return React.createElement(control, {
         globalState: this._globalState,
-        guiBlock: this.guiNode
+        guiControl: this.guiControl
         });
     }
 
     public updateVisual()
     {
-        this.guiNode.leftInPixels = this.x;
-        this.guiNode.topInPixels = this.y;
+        this.guiControl.leftInPixels = this.x;
+        this.guiControl.topInPixels = this.y;
     }
 
     public dispose() {
@@ -193,6 +193,6 @@ export class GUINode {
             this._globalState.onSelectionBoxMoved.remove(this._onSelectionBoxMovedObserver);
         }
 
-        this.guiNode.dispose();   
+        this.guiControl.dispose();   
     }
 }

+ 6 - 6
guiEditor/src/diagram/properties/genericNodePropertyComponent.tsx

@@ -15,8 +15,8 @@ export class GenericPropertyComponent extends React.Component<IPropertyComponent
     render() {
         return (
             <>
-                <GeneralPropertyTabComponent globalState={this.props.globalState} guiBlock={this.props.guiBlock}/>
-                <GenericPropertyTabComponent globalState={this.props.globalState} guiBlock={this.props.guiBlock}/>
+                <GeneralPropertyTabComponent globalState={this.props.globalState} guiControl={this.props.guiControl}/>
+                <GenericPropertyTabComponent globalState={this.props.globalState} guiControl={this.props.guiControl}/>
             </>
         );
     }
@@ -53,7 +53,7 @@ export class GenericPropertyTabComponent extends React.Component<IPropertyCompon
     }
 
     render() {
-        const block = this.props.guiBlock,
+        const block = this.props.guiControl,
               propStore: IPropertyDescriptionForEdition[] = (block as any)._propStore;
 
         if (!propStore) {
@@ -78,7 +78,7 @@ export class GenericPropertyTabComponent extends React.Component<IPropertyCompon
             switch (type) {
                 case PropertyTypeForEdition.Boolean: {
                     components.push(
-                        <CheckBoxLineComponent label={displayName} target={this.props.guiBlock} propertyName={propertyName} onValueChanged={() => this.forceRebuild(options.notifiers)} />
+                        <CheckBoxLineComponent label={displayName} target={this.props.guiControl} propertyName={propertyName} onValueChanged={() => this.forceRebuild(options.notifiers)} />
                     );
                     break;
                 }
@@ -86,11 +86,11 @@ export class GenericPropertyTabComponent extends React.Component<IPropertyCompon
                     let cantDisplaySlider = (isNaN(options.min as number) || isNaN(options.max as number) || options.min === options.max);
                     if (cantDisplaySlider) {
                         components.push(
-                            <FloatLineComponent globalState={this.props.globalState} label={displayName} propertyName={propertyName} target={this.props.guiBlock} onChange={() => this.forceRebuild(options.notifiers)} />
+                            <FloatLineComponent globalState={this.props.globalState} label={displayName} propertyName={propertyName} target={this.props.guiControl} onChange={() => this.forceRebuild(options.notifiers)} />
                         );
                     } else {
                         components.push(
-                            <SliderLineComponent label={displayName} target={this.props.guiBlock} globalState={this.props.globalState} propertyName={propertyName} step={Math.abs((options.max as number) - (options.min as number)) / 100.0} minimum={Math.min(options.min as number, options.max as number)} maximum={options.max as number} onChange={() => this.forceRebuild(options.notifiers)}/>
+                            <SliderLineComponent label={displayName} target={this.props.guiControl} globalState={this.props.globalState} propertyName={propertyName} step={Math.abs((options.max as number) - (options.min as number)) / 100.0} minimum={Math.min(options.min as number, options.max as number)} maximum={options.max as number} onChange={() => this.forceRebuild(options.notifiers)}/>
                         );
                     }
                     break;

+ 1 - 1
guiEditor/src/diagram/properties/propertyComponentProps.ts

@@ -3,5 +3,5 @@ import { GlobalState } from "../../globalState";
 
 export interface IPropertyComponentProps {
     globalState: GlobalState;
-    guiBlock: Control;
+    guiControl: Control;
 }

+ 14 - 14
guiEditor/src/diagram/properties/sliderGuiPropertyComponent.tsx

@@ -11,43 +11,43 @@ import { TextLineComponent } from "../../sharedUiComponents/lines/textLineCompon
 export class SliderPropertyTabComponent extends React.Component<IPropertyComponentProps> {
     constructor(props: IPropertyComponentProps) {
         super(props);
-        this.slider = this.props.guiBlock as Slider;
+        this._slider = this.props.guiControl as Slider;
     }
 
-    private slider : Slider;
+    private _slider : Slider;
 
     render() {
         return (
             <>                
-                <GeneralPropertyTabComponent globalState={this.props.globalState} guiBlock={this.props.guiBlock}/>
+                <GeneralPropertyTabComponent globalState={this.props.globalState} guiControl={this.props.guiControl}/>
                 <LineContainerComponent title="PROPERTIES"> 
-                <NumericInputComponent globalState={this.props.globalState} label="Minimum Value" value={this.slider.minimum}
+                <NumericInputComponent globalState={this.props.globalState} label="Minimum Value" value={this._slider.minimum}
                 onChange={evt =>{
-                    this.slider.minimum = evt;
+                    this._slider.minimum = evt;
                 }}>
                 </NumericInputComponent>
-                <NumericInputComponent globalState={this.props.globalState} label="Maximum Value" value={this.slider.maximum} 
+                <NumericInputComponent globalState={this.props.globalState} label="Maximum Value" value={this._slider.maximum} 
                 onChange={evt =>{
-                   this.slider.maximum = evt;
+                   this._slider.maximum = evt;
                 }}>
 
                 </NumericInputComponent>
-                <NumericInputComponent globalState={this.props.globalState} label="Value" value={this.slider.value} 
+                <NumericInputComponent globalState={this.props.globalState} label="Value" value={this._slider.value} 
                 onChange={evt =>{
-                   this.slider.value = evt;
+                   this._slider.value = evt;
                 }}>
                 </NumericInputComponent>
-                <NumericInputComponent globalState={this.props.globalState} label="Height" value={this.slider.heightInPixels} 
+                <NumericInputComponent globalState={this.props.globalState} label="Height" value={this._slider.heightInPixels} 
                 onChange={evt =>{
-                   this.slider.height = evt;
+                   this._slider.height = evt;
                 }}>
                 </NumericInputComponent>
-                <NumericInputComponent globalState={this.props.globalState} label="Width" value={this.slider.widthInPixels} 
+                <NumericInputComponent globalState={this.props.globalState} label="Width" value={this._slider.widthInPixels} 
                 onChange={evt =>{
-                   this.slider.width = evt;
+                   this._slider.width = evt;
                 }}>
                 </NumericInputComponent>
-                <TextLineComponent label="Color" value={this.slider.background} />
+                <TextLineComponent label="Color" value={this._slider.background} />
                 </LineContainerComponent>            
             </>
         );

+ 2 - 2
guiEditor/src/diagram/workbench.tsx

@@ -220,8 +220,8 @@ export class WorkbenchComponent extends React.Component<IWorkbenchComponentProps
         this._oldY = -1;
     }
 
-    findNodeFromGuiElement(guiElement: Control) {
-       return this._guiNodes.filter(n => n.guiNode === guiElement)[0];
+    findNodeFromGuiElement(guiControl: Control) {
+       return this._guiNodes.filter(n => n.guiControl === guiControl)[0];
     }
 
     reset() {

+ 1 - 1
guiEditor/src/guiNodeTools.ts

@@ -8,7 +8,7 @@ import { Slider } from "babylonjs-gui/2D/controls/sliders/slider";
 import { TextBlock } from "babylonjs-gui/2D/controls/textBlock";
 
 export class GuiNodeTools {
-    public static GetGuiFromString(data: string) {
+    public static CreateControlFromString (data: string) {
         //TODO: Add more elements and create default values for certain types.
         let element;
         switch (data) {

+ 5 - 5
guiEditor/src/workbenchEditor.tsx

@@ -46,7 +46,7 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
      */
     public createNodeFromObject(block: Control, recursion = true) {
         if (this._blocks.indexOf(block) !== -1) {
-            return this._workbenchCanvas.nodes.filter((n) => n.guiNode === block)[0];
+            return this._workbenchCanvas.nodes.filter((n) => n.guiControl === block)[0];
         }
 
         this._blocks.push(block);
@@ -108,7 +108,7 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
 
                     let selectedItem = selectedItems[0] as GUINode;
 
-                    if (!selectedItem.guiNode) {
+                    if (!selectedItem.guiControl) {
                         return;
                     }
                 } else if (evt.key === "v") {
@@ -133,7 +133,7 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
 
         // Create new nodes
         for (var node of copiedNodes) {
-            let block = node.guiNode;
+            let block = node.guiControl;
 
             if (!block) {
                 continue;
@@ -166,7 +166,7 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
                 // Locations
                 for (var location of editorData.locations) {
                     for (var node of this._workbenchCanvas.nodes) {
-                        if (node.guiNode && node.guiNode.uniqueId === location.blockId) {
+                        if (node.guiControl && node.guiControl.uniqueId === location.blockId) {
                             node.x = location.x;
                             node.y = location.y;
                             node.cleanAccumulation();
@@ -225,7 +225,7 @@ export class WorkbenchEditor extends React.Component<IGraphEditorProps, IGraphEd
     emitNewBlock(event: React.DragEvent<HTMLDivElement>) {
         var data = event.dataTransfer.getData("babylonjs-gui-node") as string;
 
-        let guiElement = GuiNodeTools.GetGuiFromString(data);
+        let guiElement = GuiNodeTools.CreateControlFromString (data);
 
         let newGuiNode = this._workbenchCanvas.appendBlock(guiElement);