Torque3D/Templates/BaseGame/game/tools/shapeEditor/main.tscript

465 lines
18 KiB
Plaintext
Raw Normal View History

//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Shape Editor
//------------------------------------------------------------------------------
function initializeShapeEditor()
{
echo(" % - Initializing Shape Editor");
exec("./gui/Profiles.ed." @ $TorqueScriptFileExtension);
// Order of GUI loading is important
exec("./gui/shapeEdPreviewWindow.ed.gui");
exec("./gui/ShapeEditorToolbar.ed.gui");
exec("./gui/shapeEdSelectWindow.ed.gui");
exec("./gui/shapeEdPropWindow.ed.gui");
exec("./gui/shapeEdAdvancedWindow.ed.gui");
exec("./gui/shapeEdAnimWindow.ed.gui");
exec("./gui/shapeEdAddSequenceGui.gui");
exec("./gui/shapeEdAddSequenceGui.tscript");
exec("./scripts/shapeEditor.ed." @ $TorqueScriptFileExtension);
exec("./scripts/shapeEditorHints.ed." @ $TorqueScriptFileExtension);
exec("./scripts/shapeEditorActions.ed." @ $TorqueScriptFileExtension);
// Add windows to editor gui
ShapeEdPreviewGui.setVisible(false);
ShapeEdAnimWindow.setVisible(false);
ShapeEdSelectWindow.setVisible(false);
ShapeEdPropWindow.setVisible(false);
MainSceneTabPanel.add(ShapeEdPreviewGui);
MainSceneTabPanel.add(ShapeEdAnimWindow);
MainSceneTabPanel.add(ShapeEdAdvancedWindow);
MainSceneTabPanel.add(ShapeEdSelectWindow);
MainSceneTabPanel.add(ShapeEdPropWindow);
new ScriptObject(ShapeEditorPlugin)
{
superClass = "EditorPlugin";
editorGui = ShapeEdShapeView;
};
%map = new ActionMap();
%map.bindCmd( keyboard, "escape", "ToolsToolbarArray->WorldEditorInspectorPalette.performClick();", "" );
%map.bindCmd( keyboard, "1", "ShapeEditorNoneModeBtn.performClick();", "" );
%map.bindCmd( keyboard, "2", "ShapeEditorMoveModeBtn.performClick();", "" );
%map.bindCmd( keyboard, "3", "ShapeEditorRotateModeBtn.performClick();", "" );
//%map.bindCmd( keyboard, "4", "ShapeEditorScaleModeBtn.performClick();", "" ); // not needed for the shape editor
%map.bindCmd( keyboard, "n", "ShapeEditorToolbar->showNodes.performClick();", "" );
%map.bindCmd( keyboard, "t", "ShapeEditorToolbar->ghostMode.performClick();", "" );
%map.bindCmd( keyboard, "r", "ShapeEditorToolbar->wireframeMode.performClick();", "" );
%map.bindCmd( keyboard, "f", "ShapeEditorToolbar->fitToShapeBtn.performClick();", "" );
%map.bindCmd( keyboard, "g", "ShapeEditorToolbar->showGridBtn.performClick();", "" );
%map.bindCmd( keyboard, "h", "ShapeEdSelectWindow->tabBook.selectPage( 2 );", "" ); // Load help tab
%map.bindCmd( keyboard, "l", "ShapeEdSelectWindow->tabBook.selectPage( 1 );", "" ); // load Library Tab
%map.bindCmd( keyboard, "j", "ShapeEdSelectWindow->tabBook.selectPage( 0 );", "" ); // load scene object Tab
%map.bindCmd( keyboard, "SPACE", "ShapeEdAnimWindow.togglePause();", "" );
%map.bindCmd( keyboard, "i", "ShapeEdSequences.onEditSeqInOut(\"in\", ShapeEdSeqSlider.getValue());", "" );
%map.bindCmd( keyboard, "o", "ShapeEdSequences.onEditSeqInOut(\"out\", ShapeEdSeqSlider.getValue());", "" );
%map.bindCmd( keyboard, "shift -", "ShapeEdSeqSlider.setValue(ShapeEdAnimWindow-->seqIn.getText());", "" );
%map.bindCmd( keyboard, "shift =", "ShapeEdSeqSlider.setValue(ShapeEdAnimWindow-->seqOut.getText());", "" );
%map.bindCmd( keyboard, "=", "ShapeEdAnimWindow-->stepFwdBtn.performClick();", "" );
%map.bindCmd( keyboard, "-", "ShapeEdAnimWindow-->stepBkwdBtn.performClick();", "" );
ShapeEditorPlugin.map = %map;
ShapeEditorPlugin.initSettings();
}
function destroyShapeEditor()
{
}
function SetToggleButtonValue(%ctrl, %value)
{
if ( %ctrl.getValue() != %value )
%ctrl.performClick();
}
// Replace the command field in an Editor PopupMenu item (returns the original value)
function ShapeEditorPlugin::replaceMenuCmd(%this, %menuTitle, %id, %newCmd)
{
%menu = EditorGui.findMenu( %menuTitle );
%cmd = getField( %menu.item[%id], 2 );
%menu.setItemCommand( %id, %newCmd );
return %cmd;
}
function ShapeEditorPlugin::onWorldEditorStartup(%this)
{
// Add ourselves to the window menu.
%accel = EditorGui.addToEditorsMenu("Shape Editor", "", ShapeEditorPlugin);
// Add ourselves to the ToolsToolbar
%tooltip = "Shape Editor (" @ %accel @ ")";
EditorGui.addToToolsToolbar( "ShapeEditorPlugin", "ShapeEditorPalette", "ToolsModule:shape_editor_n_image", %tooltip );
// Add ourselves to the Editor Settings window
exec( "./gui/ShapeEditorSettingsTab.gui" );
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector Adjusted expand behavior of guiTree to be more reliable Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields Removed redundant PreMult translucency type code Added setting of feature so probes work when in forward/basic lit mode Corrected indexing error in SQLiteObject class so it properly parses with the updated console API Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy Fixed var when trying to bind the camera to the client Added project setting field to dictate the default render mode between Forward or Deferred Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field Integrated DOF PostFX into updated PostFX Editor paradigm Updated setting group name for vignette postFX Shifted shaderCache to be in data/cache along with other cached files Added helper function to replace strings in a file Fixed ExampleCppObject asset to have correct loose file references Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default Fixed verve reference to root scene group Adjusted location of a nonmodal gui profile so it loads at the correct time Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful Initial work into zip and folder drag-and-drop asset importing support Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions Updated example asset type file Ensured all asset types have proper handling for move, rename and delete actions Fixed double-click behavior on folders in the AB Fixed CPP asset preview Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser Added ability to convert a non-module top-level folder in the AB into a module Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake Fixed convex editor's material handling to work with AB and reference back properly Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open Added some additional common text gui profiles Disabled calls to old editor settings logic in various editors to remove spam Added callOnModules call so tools can initialize properly when the world editor is opened Fixed logic test for visualizers Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
//ESettingsWindow.addTabPage( EShapeEditorSettingsPage );
GuiWindowCtrl::attach(ShapeEdPropWindow, ShapeEdSelectWindow);
// Initialise gui
ShapeEdSeqNodeTabBook.selectPage(0);
ShapeEdAdvancedWindow-->tabBook.selectPage(0);
ShapeEdSelectWindow-->tabBook.selectPage(0);
SetToggleButtonValue( ShapeEditorToolbar-->orbitNodeBtn, 0 );
SetToggleButtonValue( ShapeEditorToolbar-->ghostMode, 0 );
// Initialise hints menu
ShapeEdHintMenu.clear();
%count = ShapeHintGroup.getCount();
for (%i = 0; %i < %count; %i++)
{
%hint = ShapeHintGroup.getObject(%i);
ShapeEdHintMenu.add(%hint.objectType, %hint);
}
}
function ShapeEditorPlugin::openShapeAsset(%this, %assetDef)
{
%this.selectedAssetDef = %assetDef;
%this.open(%this.selectedAssetDef);
}
function ShapeEditorPlugin::openShapeAssetId(%this, %assetId)
{
%this.selectedAssetDef = AssetDatabase.acquireAsset(%assetId);
- Fixes the display of the preview in the MaterialAsset fields - Hides the special-case direct filepath field for ShapeAsset persist fields macro - Shifts the handling of TSStatics so the shape instance will load materials on the server as well as the client. This opens gameplay options as well as allowing rebaking of meshes functionality more easily - Expands AssetBase's isValidAsset utility function to actually check validity instead of just returning true - Adds isValid utility function to AssetPtr - Added new field flag that makes the field not write out to file - Removed legacy iconBitmap field from GuiIconButtonCtrl because it was causing errors - Fixed group filtering check of guiInspector to ignore case - Removed unneeded isFile checks for common datablock script files in Prototyping module script - Removed test datablocks from Prototyping module - Removed unnecessary container control from AssetBrowser - Adjusted preview regen logic of AssetBrowser so it doesn't trip if you're simply resizing the window - Fixed issue where row-vs-column layout logic for AssetBrowser when resizing window was fiddly - Added handling for when Dragging and Dropping datablock from AssetBrowser to spawn, it'll prompt if it spawns the actual object, or a spawnsphere that spawns said object. In the event of an PlayerData will also prompt if it should spawn an AIPlayer - Added ability to take a TSStatic that uses a baked down mesh and are able to restore it to the cache prefab, or trigger and in-place rebake to refresh it if something has changed in the original contents via RMB menu on the scene tree - Added ability to explode prefab to RMB menu on scene tree - Added ability to convert selection to prefab or bake to mesh in RMB menu on scene tree - Tweaked sizing of the DatablockEditorCreatePrompt window to not have cut off elements and easier to see/work with - Added sanity check to datablock editor creation - Fixed preview display of material in Decal Editor - Made compositeTextureEditor use the cached preview of images - Fixed sizing/spacing of gui selection dropdown as well as resolution dropdown of GuiEditor - Fixes MaterialEditor to properly save the group collapse state when editing - Adds ability to in-flow edit and create datablocks in the NavMesh Editor for the testing panel, and makes the datablock dropdown searchable - Fixed issue where opening the ShapeEditor via the edit button on a ShapeAsset field would cause the action buttons on the top bar to not show - Fixed error in shape editor where when exiting it was erroneously checking for a clear value of -1 rather than 0 - Removed unneeded top tabbook and tab page for main editor panel - Fixed issue where reset button of TerrainBrush Softness Curve editor didn't actually reset - Resized Object Builder window to not cut off elements and have enough width to show more data - Added a TypeCommand field type to Object Builder and changed spawnscript field of SpawnSphere to use it rather than a simple text edit field - Allow SpawnSphere in ObjectBuilder to be passed in spawn class and spawn datablock default info - Injects button to controllable objects when Inspecting them to make it easy to toggle if you're in control of it or not -
2025-08-26 04:35:28 +00:00
EditorGui.setEditor( ShapeEditorPlugin );
ShapeEditorPlugin.openShapeAsset(%this.selectedAssetDef);
}
function ShapeEditorPlugin::open(%this, %shapeAsset)
{
if ( !%this.isActivated )
{
// Activate the Shape Editor
EditorGui.setEditor( %this, true );
// 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");
$wasInWireFrameMode = $gfx::wireframe;
ShapeEditorToolbar-->wireframeMode.setStateOn($gfx::wireframe);
if ( GlobalGizmoProfile.getFieldValue(alignment) $= "Object" )
ShapeEdNodes-->objectTransform.setStateOn(1);
else
ShapeEdNodes-->worldTransform.setStateOn(1);
// Initialise and show the shape editor
ShapeEdShapeTreeView.open(getScene(0));
ShapeEdShapeTreeView.buildVisibleTree(true);
ShapeEdPreviewGui.setVisible(true);
ShapeEdSelectWindow.setVisible(true);
ShapeEdPropWindow.setVisible(true);
ShapeEdAnimWindow.setVisible(true);
ShapeEdAdvancedWindow.setVisible(ShapeEditorToolbar-->showAdvanced.getValue());
MainSceneTabPanel.bringToFront(ShapeEdPreviewGui);
ToolsPaletteArray.getObject(0).performClick();
%this.map.push();
// Switch to the ShapeEditor UndoManager
%this.oldUndoMgr = Editor.getUndoManager();
Editor.setUndoManager( ShapeEdUndoManager );
ShapeEdShapeView.setDisplayType( EditorGui.currentDisplayType );
%this.initStatusBar();
// Customise menu bar
%this.oldCamFitCmd = %this.replaceMenuCmd( "Camera", 8, "ShapeEdShapeView.fitToShape();" );
%this.oldCamFitOrbitCmd = %this.replaceMenuCmd( "Camera", 9, "ShapeEdShapeView.fitToShape();" );
Parent::onActivated(%this);
}
// Select the new shape
if (isObject(ShapeEditor.shape) && (ShapeEditor.shape.baseShapeAsset $= %shapeAsset))
{
// Shape is already selected => re-highlight the selected material if necessary
ShapeEdMaterials.updateSelectedMaterial(ShapeEdMaterials-->highlightMaterial.getValue());
}
else if (%shapeAsset !$= "")
{
ShapeEditor.selectShape(%shapeAsset, ShapeEditor.isDirty());
// 'fitToShape' only works after the GUI has been rendered, so force a repaint first
Canvas.repaint();
ShapeEdShapeView.fitToShape();
}
}
2024-12-29 21:59:08 +00:00
function EditorGui::SetShapePalletBar()
{
//Clears the button pallete stack
EWToolsPaletteWindow.setStackCtrl(ToolsPaletteArray); //legacy ctrl adhereance
EWToolsPaletteWindow.clearButtons();
EWToolsPaletteWindow.setActionMap(WorldEditorInspectorPlugin.map);
//Adds a button to the pallete stack
//Name Icon Click Command Tooltip text Keybind
EWToolsPaletteWindow.addButton("Select", "ToolsModule:arrow_n_image", "GlobalGizmoProfile.mode = \"None\";", "", "Select Arrow", "1");
EWToolsPaletteWindow.addButton("MoveSelection", "ToolsModule:move_point_n_image", "GlobalGizmoProfile.mode = \"Move\";", "", "Move", "2");
EWToolsPaletteWindow.addButton("RotateSelection", "ToolsModule:rotate_point_n_image", "GlobalGizmoProfile.mode = \"Rotate\";", "", "Rotate", "3");
EWToolsPaletteWindow.addButton("RotateSun", "ToolsModule:sun_btn_n_image", "ShapeEdShapeView.editSun = !ShapeEdShapeView.editSun;", "", "Rotate sun", "4");
EWToolsPaletteWindow.refresh();
}
function ShapeEditorPlugin::onActivated(%this)
{
%this.open("");
%this.storedHDRAdaptRateVal = $PostFX::HDRPostFX::enableAutoExposure;
$PostFX::HDRPostFX::enableAutoExposure = false;
// Try to start with the shape selected in the world editor
%count = EWorldEditor.getSelectionSize();
for (%i = 0; %i < %count; %i++)
{
%obj = EWorldEditor.getSelectedObject(%i);
%shapeFile = ShapeEditor.getObjectShapeFile(%obj);
if (%shapeFile !$= "" && isFile(%shapeFile))
{
if (!isObject(ShapeEditor.shape) || (ShapeEditor.shape.baseShape !$= %shapeFile))
{
// Call the 'onSelect' method directly if the object is not in the
// MissionGroup tree (such as a Player or Projectile object).
ShapeEdShapeTreeView.clearSelection();
if (!ShapeEdShapeTreeView.selectItem(%obj))
ShapeEdShapeTreeView.onSelect(%obj);
// 'fitToShape' only works after the GUI has been rendered, so force a repaint first
Canvas.repaint();
ShapeEdShapeView.fitToShape();
}
break;
}
else if(%shapeFile !$= "")
{
%this.openShapeAssetId(%shapeFile);
}
}
EditorGuiToolbarStack.remove( EWorldEditorToolbar );
EditorGuiToolbarStack.add( ShapeEditorToolbar );
2024-12-29 21:59:08 +00:00
EditorGui.SetShapePalletBar();
}
function ShapeEditorPlugin::initStatusBar(%this)
{
EditorGuiStatusBar.setInfo("Shape editor ( Shift Click ) to speed up camera.");
EditorGuiStatusBar.setSelection( ShapeEditor.shape.baseShape );
}
function ShapeEditorPlugin::onDeactivated(%this)
{
%this.writeSettings();
// Notify game objects if shape has been modified
if ( ShapeEditor.isDirty() )
ShapeEditor.shape.notifyShapeChanged();
$gfx::wireframe = $wasInWireFrameMode;
ShapeEdMaterials.updateSelectedMaterial(false);
EditorGuiToolbarStack.add( EWorldEditorToolbar );
EditorGuiToolbarStack.remove( ShapeEditorToolbar );
ShapeEdPreviewGui.setVisible(false);
ShapeEdSelectWindow.setVisible(false);
ShapeEdPropWindow.setVisible(false);
ShapeEdAnimWindow.setVisible(false);
ShapeEdAdvancedWindow.setVisible(false);
if( MaterialEditorGui.isAwake() )
{
ShapeEdMaterials.editSelectedMaterialEnd( true );
}
%this.map.pop();
// Restore the original undo manager
Editor.setUndoManager( %this.oldUndoMgr );
// Restore menu bar
%this.replaceMenuCmd( "Camera", 8, %this.oldCamFitCmd );
%this.replaceMenuCmd( "Camera", 9, %this.oldCamFitOrbitCmd );
$PostFX::HDRPostFX::enableAutoExposure = %this.storedHDRAdaptRateVal;
Parent::onDeactivated(%this);
}
function ShapeEditorPlugin::onExitMission( %this )
{
// unselect the current shape
ShapeEdShapeView.setModel( "" );
if (isObject(ShapeEditor.shape))
ShapeEditor.shape.delete();
ShapeEditor.shape = 0;
ShapeEdUndoManager.clearAll();
ShapeEditor.setDirty( false );
ShapeEdSequenceList.clear();
ShapeEdNodeTreeView.removeItem( 0 );
ShapeEdPropWindow.update_onNodeSelectionChanged( -1 );
ShapeEdDetailTree.removeItem( 0 );
ShapeEdMaterialList.clear();
ShapeEdMountWindow-->mountList.clear();
ShapeEdThreadWindow-->seqList.clear();
ShapeEdThreadList.clear();
}
function ShapeEditorPlugin::openShape( %this, %path, %discardChangesToCurrent )
{
EditorGui.setEditor( ShapeEditorPlugin );
if( ShapeEditor.isDirty() && !%discardChangesToCurrent )
{
toolsMessageBoxYesNo( "Save Changes?",
"Save changes to current shape?",
"ShapeEditor.saveChanges(); ShapeEditorPlugin.openShape(\"" @ %path @ "\");",
"ShapeEditorPlugin.openShape(\"" @ %path @ "\");" );
return;
}
ShapeEditor.selectShape( %path );
ShapeEdShapeView.fitToShape();
}
function shapeEditorWireframeMode()
{
$gfx::wireframe = !$gfx::wireframe;
ShapeEditorToolbar-->wireframeMode.setStateOn($gfx::wireframe);
}
//-----------------------------------------------------------------------------
// Settings
//-----------------------------------------------------------------------------
function ShapeEditorPlugin::initSettings( %this )
{
EditorSettings.beginGroup( "ShapeEditor", true );
// Display options
2024-02-10 20:49:54 +00:00
EditorSettings.setDefaultValue( "BackgroundColor", "128 128 128 100" );
EditorSettings.setDefaultValue( "HighlightMaterial", 1 );
EditorSettings.setDefaultValue( "ShowNodes", 1 );
EditorSettings.setDefaultValue( "ShowBounds", 0 );
EditorSettings.setDefaultValue( "ShowObjBox", 1 );
EditorSettings.setDefaultValue( "RenderMounts", 1 );
EditorSettings.setDefaultValue( "RenderCollision", 0 );
// Grid
EditorSettings.setDefaultValue( "ShowGrid", 1 );
EditorSettings.setDefaultValue( "GridSize", 0.1 );
EditorSettings.setDefaultValue( "GridDimension", "40 40" );
// Sun
EditorSettings.setDefaultValue( "SunDiffuseColor", "255 255 255 255" );
EditorSettings.setDefaultValue( "SunAmbientColor", "180 180 180 255" );
EditorSettings.setDefaultValue( "SunAngleX", "45" );
EditorSettings.setDefaultValue( "SunAngleZ", "135" );
// Sub-windows
EditorSettings.setDefaultValue( "AdvancedWndVisible", "1" );
EditorSettings.endGroup();
}
function ShapeEditorPlugin::readSettings( %this )
{
EditorSettings.beginGroup( "ShapeEditor", true );
// Display options
ShapeEdPreviewGui-->previewBackground.color = ColorIntToFloat( EditorSettings.value("BackgroundColor") );
SetToggleButtonValue( ShapeEdMaterials-->highlightMaterial, EditorSettings.value( "HighlightMaterial" ) );
SetToggleButtonValue( ShapeEditorToolbar-->showNodes, EditorSettings.value( "ShowNodes" ) );
SetToggleButtonValue( ShapeEditorToolbar-->showBounds, EditorSettings.value( "ShowBounds" ) );
SetToggleButtonValue( ShapeEditorToolbar-->showObjBox, EditorSettings.value( "ShowObjBox" ) );
SetToggleButtonValue( ShapeEditorToolbar-->renderColMeshes, EditorSettings.value( "RenderCollision" ) );
SetToggleButtonValue( ShapeEdMountWindow-->renderMounts, EditorSettings.value( "RenderMounts" ) );
// Grid
SetToggleButtonValue( ShapeEditorToolbar-->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( ShapeEditorToolbar-->showAdvanced, EditorSettings.value( "AdvancedWndVisible" ) );
EditorSettings.endGroup();
}
function ShapeEditorPlugin::writeSettings( %this )
{
EditorSettings.beginGroup( "ShapeEditor", true );
// Display options
EditorSettings.setValue( "BackgroundColor", ColorFloatToInt( ShapeEdPreviewGui-->previewBackground.color ) );
EditorSettings.setValue( "HighlightMaterial", ShapeEdMaterials-->highlightMaterial.getValue() );
EditorSettings.setValue( "ShowNodes", ShapeEditorToolbar-->showNodes.getValue() );
EditorSettings.setValue( "ShowBounds", ShapeEditorToolbar-->showBounds.getValue() );
EditorSettings.setValue( "ShowObjBox", ShapeEditorToolbar-->showObjBox.getValue() );
EditorSettings.setValue( "RenderCollision", ShapeEditorToolbar-->renderColMeshes.getValue() );
EditorSettings.setValue( "RenderMounts", ShapeEdMountWindow-->renderMounts.getValue() );
// Grid
EditorSettings.setValue( "ShowGrid", ShapeEditorToolbar-->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", ShapeEditorToolbar-->showAdvanced.getValue() );
EditorSettings.endGroup();
}