mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Added autosave logic to the world editor. Via a schedule, it will autosave to tool/autosave to create a backup of the current dirty scene
Fixed RMB menu on multi select objects in the Scene Tree so it will properly display the full list of actions Fixed up several spots of editor settings fields being incorrect copy-pastes Integrated AssetBrowser tool into the standard initSettings hook-through for proper default settings integration Added Editor Theme settings to the default value init'ing of the World Editor Shifted exec of editor settings default values as part of the initial editor load to ensure that if the settings.xml is deleted, theme info reverts back to the default Integrated Convex Editor's settings into new EditorSettings window system Added several missing World Editor settings to Editor Settings Window
This commit is contained in:
parent
8611e7090a
commit
8824ee9a2a
8 changed files with 196 additions and 29 deletions
|
|
@ -256,7 +256,10 @@ function EditorGui::init(%this)
|
|||
|
||||
// make sure to show the default world editor guis
|
||||
EditorGui.bringToFront( EWorldEditor );
|
||||
EWorldEditor.setVisible( false );
|
||||
EWorldEditor.setVisible( false );
|
||||
|
||||
// Start up the settings window
|
||||
ESettingsWindow.startup();
|
||||
|
||||
// Call the startup callback on the editor plugins.
|
||||
for ( %i = 0; %i < EditorPluginSet.getCount(); %i++ )
|
||||
|
|
@ -266,9 +269,6 @@ function EditorGui::init(%this)
|
|||
}
|
||||
|
||||
callOnModules("onWorldEditorStartup", "Tools");
|
||||
|
||||
// With everything loaded, start up the settings window
|
||||
ESettingsWindow.startup();
|
||||
|
||||
// Start up initial editor plugin.
|
||||
|
||||
|
|
@ -1631,7 +1631,7 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj )
|
|||
%popup.item[ 0 ] = "Delete" TAB "" TAB "EditorMenuEditDelete();";
|
||||
%popup.item[ 1 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );";
|
||||
%popup.item[ 2 ] = "-";
|
||||
%popup.item[ 1 ] = "Make select a Sub-Level" TAB "" TAB "MakeSelectionASublevel();";
|
||||
%popup.item[ 3 ] = "Make select a Sub-Level" TAB "" TAB "MakeSelectionASublevel();";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1925,6 +1925,10 @@ function Editor::open(%this)
|
|||
|
||||
if(EditorSettings.value("WorldEditor/Layout/LayoutMode", "Classic") $= "Modern")
|
||||
togglePanelLayout();
|
||||
|
||||
%autosaveInterval = EditorSettings.value("WorldEditor/AutosaveInterval", "5");
|
||||
%autosaveInterval = %autosaveInterval * 60000; //convert to milliseconds from minutes
|
||||
EditorGui.autosaveSchedule = schedule( %autosaveInterval, 0, "EditorAutoSaveMission" );
|
||||
}
|
||||
|
||||
function Editor::close(%this, %gui)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ EditorSettings.setDefaultValue( "forceLoadDAE", "0" );
|
|||
EditorSettings.setDefaultValue( "displayType", $EditTsCtrl::DisplayTypePerspective );
|
||||
EditorSettings.setDefaultValue( "orthoFOV", "50" );
|
||||
EditorSettings.setDefaultValue( "orthoShowGrid", "1" );
|
||||
EditorSettings.setDefaultValue( "currentEditor", "WorldEditorInspectorPlugin" );
|
||||
EditorSettings.setDefaultValue( "AutosaveInterval", "5" );
|
||||
EditorSettings.setDefaultValue( "forceSidebarToSide", "1" );
|
||||
|
||||
if( isFile( "C:/Program Files/Torsion/Torsion.exe" ) )
|
||||
EditorSettings.setDefaultValue( "torsionPath", "C:/Program Files/Torsion/Torsion.exe" );
|
||||
|
|
@ -174,6 +175,36 @@ EditorSettings.endGroup();
|
|||
|
||||
//-------------------------------------
|
||||
|
||||
//-------------------------------------
|
||||
EditorSettings.beginGroup( "Theme", true );
|
||||
EditorSettings.setDefaultValue( "headerColor", "50 49 48 255");
|
||||
EditorSettings.setDefaultValue( "windowBackgroundColor", "32 31 30 255");
|
||||
|
||||
EditorSettings.setDefaultValue( "tabsColor", "37 36 35 255" );
|
||||
EditorSettings.setDefaultValue( "tabsHLColor", "50 49 48 255" );
|
||||
EditorSettings.setDefaultValue( "tabsSELColor", "59 58 57 255" );
|
||||
|
||||
EditorSettings.setDefaultValue( "dividerDarkColor", "17 16 15 255");
|
||||
EditorSettings.setDefaultValue( "dividerMidColor", "50 49 48 255");
|
||||
EditorSettings.setDefaultValue( "dividerLightColor", "96 94 92 255");
|
||||
|
||||
EditorSettings.setDefaultValue( "headerTextColor", "236 234 232 255");
|
||||
|
||||
EditorSettings.setDefaultValue( "fieldTextColor", "178 175 172 255");
|
||||
EditorSettings.setDefaultValue( "fieldTextHLColor", "234 232 230 255");
|
||||
EditorSettings.setDefaultValue( "fieldTextSELColor", "255 255 255 255");
|
||||
EditorSettings.setDefaultValue( "fieldTextNAColor", "120 120 120 255");
|
||||
|
||||
EditorSettings.setDefaultValue( "fieldBGColor", "59 58 57 255");
|
||||
EditorSettings.setDefaultValue( "fieldBGHLColor", "72 70 68 255");
|
||||
EditorSettings.setDefaultValue( "fieldBGSELColor", "100 98 96 255");
|
||||
|
||||
EditorSettings.setDefaultValue( "tooltipBGColor", "43 43 43 255");
|
||||
EditorSettings.setDefaultValue( "tooltipTextColor", "255 255 255 255");
|
||||
EditorSettings.setDefaultValue( "tooltipDivColor", "72 70 68 255");
|
||||
EditorSettings.endGroup();
|
||||
//-------------------------------------
|
||||
|
||||
//TODO: this doesn't belong here
|
||||
function setDefault( %name, %value )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -374,6 +374,83 @@ function EditorSaveMissionAs( %levelAsset )
|
|||
// Canvas.pushDialog(
|
||||
}
|
||||
|
||||
function EditorAutoSaveMission()
|
||||
{
|
||||
// just save the mission without renaming it
|
||||
|
||||
if($Editor::AutoSaveIndex $= "" || $Editor::AutoSaveIndex $= "5")
|
||||
$Editor::AutoSaveIndex = 1;
|
||||
else
|
||||
$Editor::AutoSaveIndex++;
|
||||
|
||||
%autosaveFileName = "tools/autosave/" @ fileBase($Server::MissionFile) @ "_autosave" @ $Editor::AutoSaveIndex @ fileExt($Server::MissionFile);
|
||||
|
||||
// first check for dirty and read-only files:
|
||||
if((EWorldEditor.isDirty || ETerrainEditor.isMissionDirty) && !isWriteableFileName(%autosaveFileName))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO: Make Autosave work with terrains
|
||||
/*if(ETerrainEditor.isDirty)
|
||||
{
|
||||
// Find all of the terrain files
|
||||
initContainerTypeSearch($TypeMasks::TerrainObjectType);
|
||||
|
||||
while ((%terrainObject = containerSearchNext()) != 0)
|
||||
{
|
||||
if (!isWriteableFileName(%terrainObject.terrainFile))
|
||||
{
|
||||
if (toolsMessageBox("Error", "Terrain file \""@ %terrainObject.terrainFile @ "\" is read-only. Continue?", "Ok", "Stop") == $MROk)
|
||||
continue;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// now write the terrain and mission files out:
|
||||
|
||||
if(EWorldEditor.isDirty || ETerrainEditor.isMissionDirty)
|
||||
getScene(0).save(%autosaveFileName);
|
||||
|
||||
//TODO: Make Autosave work with terrains
|
||||
/*if(ETerrainEditor.isDirty)
|
||||
{
|
||||
// Find all of the terrain files
|
||||
initContainerTypeSearch($TypeMasks::TerrainObjectType);
|
||||
|
||||
while ((%terrainObject = containerSearchNext()) != 0)
|
||||
{
|
||||
if(%terrainObject.terrainAsset !$= "")
|
||||
{
|
||||
//we utilize a terrain asset, so we'll update our dependencies while we're at it
|
||||
%terrainObject.saveAsset();
|
||||
}
|
||||
else
|
||||
{
|
||||
%terrainObject.save(%terrainObject.terrainFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ETerrainPersistMan.saveDirty();*/
|
||||
|
||||
// Give EditorPlugins a chance to save.
|
||||
for ( %i = 0; %i < EditorPluginSet.getCount(); %i++ )
|
||||
{
|
||||
%obj = EditorPluginSet.getObject(%i);
|
||||
if ( %obj.isDirty() )
|
||||
%obj.onSaveMission( %autosaveFileName );
|
||||
}
|
||||
|
||||
%autosaveInterval = EditorSettings.value("WorldEditor/AutosaveInterval", "5");
|
||||
%autosaveInterval = %autosaveInterval * 60000; //convert to milliseconds from minutes
|
||||
EditorGui.autosaveSchedule = schedule( %autosaveInterval, 0, "EditorAutoSaveMission" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function EditorOpenMission(%levelAsset)
|
||||
{
|
||||
if( EditorIsDirty())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue