Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

World Editor Menu Re-Initialization Issue #6

Closed
lukaspj opened this issue May 30, 2020 · 0 comments
Closed

World Editor Menu Re-Initialization Issue #6

lukaspj opened this issue May 30, 2020 · 0 comments

Comments

@lukaspj
Copy link
Contributor

lukaspj commented May 30, 2020

This issue was created in the GarageGames Repository (Link to original issue).
The issue was originally created by @Lynouna and had a total of 0 comments that may contain additional information. The original issue description is pasted below:

Platform: Win7
Affected Versions & Branches:
latest development [ tested and confirmed for DEBUG ~ Release builds result in an immediate crash before even creating the window frame(?) ]
release 3.10.1 [tested and confirmed]
release 3.10 [ files in question are the same ]
Compilers/Toolkits: Any [it's a TorqueScript issue]
Brief Description of Bug:
Physics menu disappears and "Editors" menu is empty after opening the world editor more than once in a session. In short, world editor menus aren't reinitialized and restored properly for subsequent invocations of the editor.
Requirements:
A physics library must be enabled in order for the physics menu bug to be present. [ PHYSICS_BULLET or PHYSICS_PHYSX3 ]
Torque editor tools must be enabled and built with the engine. [ TORQUE_TOOLS ]

To Reproduce:

  1. Open the World Editor and load a level or create a new one.
  2. Select File->New Level OR File->Exit Level [Return to main menu] OR File->Open Level [load map]
  3. Open the World Editor again
  4. Observe the lack of physics menu and that the "Editors" menu is now empty.

Possible Solutions:
A) For each EditorPlugin, in the main.cs file in the respective folder, create a new override for the onEditorWake( %this ) method and re-add the menu item [at a bare-minimum]. As far as I can tell there aren't any negative side effects to this. However, certain editors [terrain, inspector[shape], and a few others] will have to be explicitly re-initialized in function EditorGui::onWake( %this ) in [ /Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs Line 532 in the development branch ]
This will have to be applied to each Template that contains this script.
Example:

function ForestEditorPlugin::onEditorWake( %this ){
   // Add ourselves to the window menu.
   %accel = EditorGui.addToEditorsMenu( "Forest Editor", "", ForestEditorPlugin );    
   
   // Add ourselves to the tools menu.
   %tooltip = "Forest Editor (" @ %accel @ ")";  
   EditorGui.addToToolsToolbar( "ForestEditorPlugin", "ForestEditorPalette", expandFilename("tools/forestEditor/images/forest-editor-btn"), %tooltip );   
}

B) Defer tools initialization until editor invocation. This comes with the cost of a potentially slower editor load time, but greater reliability because it starts from the same completely cleared state every single time and eliminates the possibility of latent values from previous sessions. Tools/Editors are initialized on-demand and completely reset when they are closed. When the editor is closed, completely destroy and clear all the editor states from the session. When the editor is opened, execute all the init scripts right before creation rather than initializing them at startup. This is significantly more complicated and probably more difficult than A.
Screenshot of initial launch of the editor from the main menu: Launch
Screenshot of menu bar after exiting to main menu or loading a new level [ the editors item is clicked and no physics menu ] .
NoPhys

@Azaezel Azaezel closed this as completed Jul 22, 2022
Eikelenboom pushed a commit to Eikelenboom/Torque3d-UI-MakeOver that referenced this issue Dec 5, 2022
Eikelenboom pushed a commit to Eikelenboom/Torque3d-UI-MakeOver that referenced this issue Dec 5, 2022
Eikelenboom pushed a commit to Eikelenboom/Torque3d-UI-MakeOver that referenced this issue Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants