Game Development Community

T3D 1.1 Beta 3 - ActionMaps are activated in wrong order in WorldEditor +fix - RESOLVED

by Fyodor -bank- Osokin · in Torque 3D Professional · 03/30/2011 (4:36 am) · 3 replies

Build: T3D 1.1 Beta 3 Pro

Platform: Windows (+ Mac OS too)

Target: WorldEditor

Issues: If you launch editor and it was automatically set to something other than "WorldEditorInspectorPlugin" it the MoveMap will override editor plugin's action map.

Steps to Repeat:
Launch Torque.
Open editor and set to any editor (I've used RoadEditor for debugging/fixing).
Close editor and exit from Torque (so it will remember the last active editor).
Launch Torque again, enter into the game and press F11 to open editor. Notice that pressing moveMap-used keys are processed by moveMap and not the editor/plugin (for example pressing "1" will call commandToServer('use',"RocketLauncher"); and not the setting editor to "select" mode.

The order in which action maps are pushed atm:
1. plugin's map - from EditorGui::init() -> EditorGui::setEditor() -> %newEditor::onActivated()
2. MoveMap - from EditorGui::onWake()
3. EditorMap - from EditorGui::onWake()

Should be:
1. MoveMap - from EditorGui::onWake()
2. EditorMap - from EditorGui::onWake()
3. plugin's map - by calling %this.currentEditor.onActivated() from EditorGui::onWake()

Suggested Fix:

tools/worldEditor/scripts/EditorGui.ed.cs around line 312 in EditorGui::init():
..//skipped
   if( %initialEditor $= "" )
      %initialEditor = "WorldEditorInspectorPlugin";
   %this.setEditor( %initialEditor, true, true ); // <-- CHANGED!
   
   // Done.
..//skipped
I've added third param to ignore calling "onActivated()" in plugin.

tools/worldEditor/scripts/EditorGui.ed.cs around line 480 in EditorGui::setEditor()
..//skipped
      if( %newEditor.setEditorFunction() )
      {
         %this.syncEditor( %newEditor );
         %this.currentEditor = %newEditor;
         if( !%dontActivate ) // <-- ADDED!
            %this.currentEditor.onActivated();
      }
..//skipped
In this function all calls to onActivated() was already with check, and the one was missing the if(!) check.

#1
03/30/2011 (10:01 am)
Logged as THREED-1534.
#2
04/06/2011 (5:44 pm)
Good fix. Thanks Bank!
#3
04/13/2011 (5:10 pm)
Fixed in 1.1 Final and Preview.