public static void shapeEditorWireframeMode() { ShapeEditorToolbar ShapeEditorToolbar = "ShapeEditorToolbar"; GuiBitmapButtonCtrl wireframeMode = ShapeEditorToolbar.FOT("wireframeMode"); omni.bGlobal["$gfx::wireframe"] = !omni.bGlobal["$gfx::wireframe"]; wireframeMode.setStateOn(omni.bGlobal["$gfx::wireframe"]); }
public void writeSettings() { Settings EditorSettings = "EditorSettings"; ShapeEditor.ShapeEdPreviewGui ShapeEdPreviewGui = "ShapeEdPreviewGui"; ShapeEditor.ShapeEdMaterials ShapeEdMaterials = "ShapeEdMaterials"; ShapeEditorToolbar ShapeEditorToolbar = "ShapeEditorToolbar"; ShapeEditor.ShapeEdMountWindow ShapeEdMountWindow = "ShapeEdMountWindow"; ShapeEditor.ShapeEdShapeView ShapeEdShapeView = "ShapeEdShapeView"; GuiSwatchButtonCtrl previewBackground = ShapeEdPreviewGui.FOT("previewBackground"); GuiCheckBoxCtrl highlightMaterial = ShapeEdMaterials.FOT("highlightMaterial"); GuiBitmapButtonCtrl showNodes = ShapeEditorToolbar.FOT("showNodes"); GuiBitmapButtonCtrl showBounds = ShapeEditorToolbar.FOT("showBounds"); GuiBitmapButtonCtrl showObjBox = ShapeEditorToolbar.FOT("showObjBox"); GuiBitmapButtonCtrl showAdvanced = ShapeEditorToolbar.FOT("showAdvanced"); GuiBitmapButtonCtrl showGridBtn = ShapeEditorToolbar.FOT("showGridBtn"); GuiBitmapButtonCtrl renderColMeshes = ShapeEditorToolbar.FOT("renderColMeshes"); GuiCheckBoxCtrl renderMounts = ShapeEdMountWindow.FOT("renderMounts"); EditorSettings.beginGroup("ShapeEditor", true); // Display options EditorSettings.setValue("BackgroundColor", ColorPickerDlg.ColorFloatToInt(previewBackground["color"])); EditorSettings.setValue("HighlightMaterial", highlightMaterial.getValue()); EditorSettings.setValue("ShowNodes", showNodes.getValue()); EditorSettings.setValue("ShowBounds", showBounds.getValue()); EditorSettings.setValue("ShowObjBox", showObjBox.getValue()); EditorSettings.setValue("RenderCollision", renderColMeshes.getValue()); EditorSettings.setValue("RenderMounts", renderMounts.getValue()); // Grid EditorSettings.setValue("ShowGrid", showGridBtn.getValue()); EditorSettings.setValue("GridSize", ShapeEdShapeView["gridSize"]); EditorSettings.setValue("GridDimension", ShapeEdShapeView["gridDimension"]); // Sun EditorSettings.setValue("SunDiffuseColor", ShapeEdShapeView["sunDiffuse"]); EditorSettings.setValue("SunAmbientColor", ShapeEdShapeView["sunAmbient"]); EditorSettings.setValue("SunAngleX", ShapeEdShapeView["sunAngleX"]); EditorSettings.setValue("SunAngleZ", ShapeEdShapeView["sunAngleZ"]); // Sub-windows EditorSettings.setValue("AdvancedWndVisible", showAdvanced.getValue()); EditorSettings.endGroup(); }
public void readSettings() { Settings EditorSettings = "EditorSettings"; ShapeEditor.ShapeEdPreviewGui ShapeEdPreviewGui = "ShapeEdPreviewGui"; ShapeEditor.ShapeEdMaterials ShapeEdMaterials = "ShapeEdMaterials"; ShapeEditorToolbar ShapeEditorToolbar = "ShapeEditorToolbar"; ShapeEditor.ShapeEdMountWindow ShapeEdMountWindow = "ShapeEdMountWindow"; ShapeEditor.ShapeEdShapeView ShapeEdShapeView = "ShapeEdShapeView"; GuiSwatchButtonCtrl previewBackground = ShapeEdPreviewGui.FOT("previewBackground"); GuiCheckBoxCtrl highlightMaterial = ShapeEdMaterials.FOT("highlightMaterial"); GuiBitmapButtonCtrl showNodes = ShapeEditorToolbar.FOT("showNodes"); GuiBitmapButtonCtrl showBounds = ShapeEditorToolbar.FOT("showBounds"); GuiBitmapButtonCtrl showObjBox = ShapeEditorToolbar.FOT("showObjBox"); GuiBitmapButtonCtrl showAdvanced = ShapeEditorToolbar.FOT("showAdvanced"); GuiBitmapButtonCtrl showGridBtn = ShapeEditorToolbar.FOT("showGridBtn"); GuiBitmapButtonCtrl renderColMeshes = ShapeEditorToolbar.FOT("renderColMeshes"); GuiCheckBoxCtrl renderMounts = ShapeEdMountWindow.FOT("renderMounts"); EditorSettings.beginGroup("ShapeEditor", true); // Display options previewBackground["color"] = ColorPickerDlg.ColorIntToFloat(EditorSettings.value("BackgroundColor")); SetToggleButtonValue(highlightMaterial, EditorSettings.value("HighlightMaterial")); SetToggleButtonValue(showNodes, EditorSettings.value("ShowNodes")); SetToggleButtonValue(showBounds, EditorSettings.value("ShowBounds")); SetToggleButtonValue(showObjBox, EditorSettings.value("ShowObjBox")); SetToggleButtonValue(renderColMeshes, EditorSettings.value("RenderCollision")); SetToggleButtonValue(renderMounts, EditorSettings.value("RenderMounts")); // Grid SetToggleButtonValue(showGridBtn, EditorSettings.value("ShowGrid")); ShapeEdShapeView["gridSize"] = EditorSettings.value("GridSize"); ShapeEdShapeView["gridDimension"] = EditorSettings.value("GridDimension"); // Sun ShapeEdShapeView["sunDiffuse"] = EditorSettings.value("SunDiffuseColor"); ShapeEdShapeView["sunAmbient"] = EditorSettings.value("SunAmbientColor"); // Sub-windows SetToggleButtonValue(showAdvanced, EditorSettings.value("AdvancedWndVisible")); EditorSettings.endGroup(); }
public override void onWorldEditorStartup() { EditorGui EditorGui = "EditorGui"; // Add ourselves to the window menu. string accel = EditorGui.addToEditorsMenu("Shape Editor", "", this); // Add ourselves to the ToolsToolbar string tooltip = "Shape Editor (" + accel + ")"; EditorGui.addToToolsToolbar("ShapeEditorPlugin", "ShapeEditorPalette", Util._expandFilename("tools/worldEditor/images/toolbar/shape-editor"), tooltip); // Add ourselves to the Editor Settings window //exec( "./gui/ShapeEditorSettingsTab.gui" ); //console.Call("ShapeEditorSettingsTab_initialize"); ShapeEditorSettingsTab.initialize(); ESettingsWindow ESettingsWindow = "ESettingsWindow"; ESettingsWindow.addTabPage("EShapeEditorSettingsPage"); ShapeEdPropWindow ShapeEdPropWindow = "ShapeEdPropWindow"; ShapeEdPropWindow.attachTo("ShapeEdSelectWindow"); ShapeEdAnimWindow ShapeEdAnimWindow = "ShapeEdAnimWindow"; ShapeEdAnimWindow.resize(-1, 526, 593, 53); // Initialise gui ShapeEditor.ShapeEdSeqNodeTabBook ShapeEdSeqNodeTabBook = "ShapeEdSeqNodeTabBook"; ShapeEdSeqNodeTabBook.selectPage(0); ShapeEdAdvancedWindow ShapeEdAdvancedWindow = "ShapeEdAdvancedWindow"; GuiTabBookCtrl ShapeEdAdvancedWindowtabBook = ShapeEdAdvancedWindow.FOT("tabBook"); ShapeEdAdvancedWindowtabBook.selectPage(0); ShapeEdSelectWindow ShapeEdSelectWindow = "ShapeEdSelectWindow"; GuiTabBookCtrl ShapeEdSelectWindowtabBook = ShapeEdSelectWindow.FOT("tabBook"); ShapeEdSelectWindowtabBook.selectPage(0); ShapeEdSelectWindow.navigate(""); ShapeEditorToolbar ShapeEditorToolbar = "ShapeEditorToolbar"; GuiBitmapButtonCtrl orbitNodeBtn = ShapeEditorToolbar.FOT("orbitNodeBtn"); SetToggleButtonValue(orbitNodeBtn, "0"); GuiBitmapButtonCtrl ghostMode = ShapeEditorToolbar.FOT("ghostMode"); SetToggleButtonValue(ghostMode, "0"); // Initialise hints menu SimGroup ShapeHintGroup = "ShapeHintGroup"; ShapeEditor.ShapeEdHintMenu ShapeEdHintMenu = "ShapeEdHintMenu"; ShapeEdHintMenu.clear(); int count = ShapeHintGroup.getCount(); for (uint i = 0; i < count; i++) { SimObject hint = ShapeHintGroup.getObject(i); ShapeEdHintMenu.add(hint["objectType"], hint); } }
public void open(string filename) { EditorGui EditorGui = "EditorGui"; ShapeEdPropWindow ShapeEdPropWindow = "ShapeEdPropWindow"; ShapeEdSelectWindow ShapeEdSelectWindow = "ShapeEdSelectWindow"; ShapeEdAdvancedWindow ShapeEdAdvancedWindow = "ShapeEdAdvancedWindow"; ShapeEdAnimWindow ShapeEdAnimWindow = "ShapeEdAnimWindow"; ShapeEditorToolbar ShapeEditorToolbar = "ShapeEditorToolbar"; ShapeEditor.ShapeEdShapeView ShapeEdShapeView = "ShapeEdShapeView"; ShapeEditor.ShapeEdNodes ShapeEdNodes = "ShapeEdNodes"; Settings EditorSettings = "EditorSettings"; EWorldEditor EWorldEditor = "EWorldEditor"; GizmoProfile GlobalGizmoProfile = "GlobalGizmoProfile"; ShapeEditor.ShapeEdShapeTreeView ShapeEdShapeTreeView = "ShapeEdShapeTreeView"; ShapeEditor.ShapeEdPreviewGui ShapeEdPreviewGui = "ShapeEdPreviewGui"; ShapeEditorActions.ShapeEdUndoManager ShapeEdUndoManager = "ShapeEdUndoManager"; SimGroup MissionGroup = "MissionGroup"; GuiDynamicCtrlArrayControl ToolsPaletteArray = "ToolsPaletteArray"; editor Editor = "Editor"; ShapeEditor.ShapeEdMaterials ShapeEdMaterials = "ShapeEdMaterials"; ShapeEditor ShapeEditor = "ShapeEditor"; GuiBitmapButtonCtrl wireframeMode = ShapeEditorToolbar.FOT("wireframeMode"); GuiBitmapButtonCtrl showAdvanced = ShapeEditorToolbar.FOT("showAdvanced"); GuiIconButtonCtrl worldTransform = ShapeEdNodes.FOT("worldTransform"); GuiIconButtonCtrl objectTransform = ShapeEdNodes.FOT("objectTransform"); GuiCheckBoxCtrl highlightMaterial = ShapeEdMaterials.FOT("highlightMaterial"); GuiCanvas Canvas = "Canvas"; if (!this["isActivated"].AsBool()) { // Activate the Shape Editor EditorGui.setEditor(this, false); // Get editor settings (note the sun angle is not configured in the settings // dialog, so apply the settings here instead of in readSettings) this.readSettings(); ShapeEdShapeView["sunAngleX"] = EditorSettings.value("ShapeEditor/SunAngleX"); ShapeEdShapeView["sunAngleZ"] = EditorSettings.value("ShapeEditor/SunAngleZ"); EWorldEditor["forceLoadDAE"] = EditorSettings.value("forceLoadDAE"); bGlobal["$wasInWireFrameMode"] = bGlobal["$gfx::wireframe"]; wireframeMode.setStateOn(bGlobal["$gfx::wireframe"]); if (GlobalGizmoProfile.getFieldValue("alignment", -1) == "Object") { objectTransform.setStateOn(true); } else { worldTransform.setStateOn(true); } // Initialise and show the shape editor ShapeEdShapeTreeView.open(MissionGroup); ShapeEdShapeTreeView.buildVisibleTree(true); ShapeEdPreviewGui.setVisible(true); ShapeEdSelectWindow.setVisible(true); ShapeEdPropWindow.setVisible(true); ShapeEdAnimWindow.setVisible(true); ShapeEdAdvancedWindow.setVisible(showAdvanced.getValue().AsBool()); ShapeEditorToolbar.setVisible(true); EditorGui.bringToFront(ShapeEdPreviewGui); ((GuiBitmapButtonCtrl)ToolsPaletteArray.FOT("WorldEditorMove")).performClick(); this.map.push(); // Switch to the ShapeEditor UndoManager this["oldUndoMgr"] = Editor.getUndoManager(); Editor.setUndoManager(ShapeEdUndoManager); ShapeEdShapeView.setDisplayType(EditorGui["currentDisplayType"].AsInt()); this.initStatusBar(); // Customise menu bar this["oldCamFitCmd"] = this.replaceMenuCmd("Camera", "8", "ShapeEdShapeView.fitToShape();"); this["oldCamFitOrbitCmd"] = this.replaceMenuCmd("Camera", "9", "ShapeEdShapeView.fitToShape();"); base.onActivated(); } // Select the new shape if (ShapeEditor.shape.isObject() && (ShapeEditor.shape["baseShape"] == filename)) { // Shape is already selected => re-highlight the selected material if necessary ShapeEdMaterials.updateSelectedMaterial(highlightMaterial.getValue().AsBool()); } else if (filename != "") { ShapeEditor.selectShape(filename, ShapeEditor.isDirty()); // 'fitToShape' only works after the GUI has been rendered, so force a repaint first Canvas.repaint(0); ShapeEdShapeView.fitToShape(); } }