mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-05 21:40:31 +00:00
Fixes #1257
The editor didn't test that a mission area actually existed, so when you switched to the editor, it would trigger the crash. It now tests if there is a mission area when switching to the editor tool, and if there is not, prompts for the creation of a new one, similar to the auto-prompt for creating terrain blocks.
This commit is contained in:
parent
6e681dd82f
commit
977791bad2
4 changed files with 58 additions and 10 deletions
|
|
@ -99,6 +99,27 @@ function MissionAreaEditorPlugin::onDeactivated( %this )
|
|||
Parent::onDeactivated(%this);
|
||||
}
|
||||
|
||||
function MissionAreaEditorPlugin::setEditorFunction( %this )
|
||||
{
|
||||
%missionAreaExists = isObject(getMissionAreaServerObject());
|
||||
|
||||
if( %missionAreaExists == false )
|
||||
MessageBoxYesNoCancel("No Mission Area","Would you like to create a New Mission Area?", "MissionAreaEditorPlugin.createNewMissionArea();");
|
||||
|
||||
return %missionAreaExists;
|
||||
}
|
||||
|
||||
function MissionAreaEditorPlugin::createNewMissionArea(%this)
|
||||
{
|
||||
%newMissionArea = new MissionArea();
|
||||
%newMissionArea.area = "-256 -256 512 512";
|
||||
|
||||
MissionGroup.add(%newMissionArea);
|
||||
|
||||
EditorGui.setEditor(MissionAreaEditorPlugin);
|
||||
|
||||
EWorldEditor.isDirty = true;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
// Settings
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -25,11 +25,14 @@ function MissionAreaEditorGui::onEditorActivated( %this )
|
|||
EWorldEditor.clearSelection();
|
||||
|
||||
%ma = getMissionAreaServerObject();
|
||||
EWorldEditor.selectObject( %ma );
|
||||
EWorldEditor.syncGui();
|
||||
MissionAreaEditorTerrainEditor.updateTerrain();
|
||||
%this.setSelectedMissionArea( %ma );
|
||||
%this.onMissionAreaSelected( %this.getSelectedMissionArea() );
|
||||
if( isObject( %ma ) )
|
||||
{
|
||||
EWorldEditor.selectObject( %ma );
|
||||
EWorldEditor.syncGui();
|
||||
MissionAreaEditorTerrainEditor.updateTerrain();
|
||||
%this.setSelectedMissionArea( %ma );
|
||||
%this.onMissionAreaSelected( %this.getSelectedMissionArea() );
|
||||
}
|
||||
}
|
||||
|
||||
function MissionAreaEditorGui::onEditorDeactivated( %this )
|
||||
|
|
|
|||
|
|
@ -99,6 +99,27 @@ function MissionAreaEditorPlugin::onDeactivated( %this )
|
|||
Parent::onDeactivated(%this);
|
||||
}
|
||||
|
||||
function MissionAreaEditorPlugin::setEditorFunction( %this )
|
||||
{
|
||||
%missionAreaExists = isObject(getMissionAreaServerObject());
|
||||
|
||||
if( %missionAreaExists == false )
|
||||
MessageBoxYesNoCancel("No Mission Area","Would you like to create a New Mission Area?", "MissionAreaEditorPlugin.createNewMissionArea();");
|
||||
|
||||
return %missionAreaExists;
|
||||
}
|
||||
|
||||
function MissionAreaEditorPlugin::createNewMissionArea(%this)
|
||||
{
|
||||
%newMissionArea = new MissionArea();
|
||||
%newMissionArea.area = "-256 -256 512 512";
|
||||
|
||||
MissionGroup.add(%newMissionArea);
|
||||
|
||||
EditorGui.setEditor(MissionAreaEditorPlugin);
|
||||
|
||||
EWorldEditor.isDirty = true;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
// Settings
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -25,11 +25,14 @@ function MissionAreaEditorGui::onEditorActivated( %this )
|
|||
EWorldEditor.clearSelection();
|
||||
|
||||
%ma = getMissionAreaServerObject();
|
||||
EWorldEditor.selectObject( %ma );
|
||||
EWorldEditor.syncGui();
|
||||
MissionAreaEditorTerrainEditor.updateTerrain();
|
||||
%this.setSelectedMissionArea( %ma );
|
||||
%this.onMissionAreaSelected( %this.getSelectedMissionArea() );
|
||||
if( isObject( %ma ) )
|
||||
{
|
||||
EWorldEditor.selectObject( %ma );
|
||||
EWorldEditor.syncGui();
|
||||
MissionAreaEditorTerrainEditor.updateTerrain();
|
||||
%this.setSelectedMissionArea( %ma );
|
||||
%this.onMissionAreaSelected( %this.getSelectedMissionArea() );
|
||||
}
|
||||
}
|
||||
|
||||
function MissionAreaEditorGui::onEditorDeactivated( %this )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue