Missing systems in the editor

7 views
Skip to first unread message

Luca Vezzadini

unread,
Jan 14, 2013, 6:03:34 AM1/14/13
to dtEntity developers
Hi Martin,
I think I have a problem in the editor when loading scenes which specify what libraries to load. The problem is that my systems - the ones created in the plugins specified in the <libraries> block - do not show up in the editor.
Looking at the code I seem to see two different behaviors about plugins, as described below

** When adding a new plugin from the editor:
- the OnAddPlugin slot calls EditorApplication::AddPluginLibrary, which will invoke mMainWindow->AddToKnownComponentList and the new systems will appear. That's fine.
** When loading a scene with <libraries> specified:
- ParseScene will check the libraries to add and for each one it will call pluginManager.AddPlugin, which will not update the list of plugins known to the editor. So none of my systems will show up.

Did I miss something? If not, can we fix this? I think we shold just add a way to let the editor know that a new plugin has been loaded also when parsing the scene. I'll look deeper in the code and see if I can propose a solution.


    Luca


--
_______________________________________________________________________
Luca Vezzadini R&D Team
Kairos3D Srl www.kairos3d.it

Martin Scheffler

unread,
Jan 14, 2013, 6:19:28 AM1/14/13
to dtenti...@googlegroups.com
Hi Luca,
I think the Library tag was added by you guys, I never actually used it. Maybe it would make sense to add a LibraryLoadedMessage to dtENtity/systemmessages.h and make the editor register to that.
You can go ahead and commit that yourself, or send me a patch if you want

Cheers,
martin


2013/1/14 Luca Vezzadini <luca.ve...@kairos3d.it>

Luca Vezzadini

unread,
Jan 14, 2013, 6:22:44 AM1/14/13
to dtenti...@googlegroups.com
Maybe there is even a simple solution. The  EditorApplication::LoadScene, called when you load a scene from file, at the end has a call to "emit SceneLoaded(path)". The signal is apparently not used by anybody (there is a signal with the same name in EntityTree, but that's anothring thing). So we could add a slot that catches it and just refreshes the list of known components at that point.
If you agree with the idea, I'll go ahead and test it.

  luca


_______________________________________________________________________
Luca Vezzadini R&D Team
Kairos3D Srl www.kairos3d.it

Luca Vezzadini

unread,
Jan 14, 2013, 6:29:29 AM1/14/13
to dtenti...@googlegroups.com
Even better: there is already a EditorMainWindow::OnSceneLoaded, called when adtEntity::SceneLoadedMessage is sent by the loading code. I'd then use that as it is safer and cleaner.
As a side note, maybe you want to either renamed that EditorApplication::SceneLoaded signal, or even remove it completely if nobody is actually using it. Right now it is a bit confusing (there's another slot with the same name in EntityTree and there is the dtEntity::SceneLoadedMessage message...)


     Luca


_______________________________________________________________________
Luca Vezzadini R&D Team
Kairos3D Srl www.kairos3d.it

Martin Scheffler

unread,
Jan 14, 2013, 6:34:34 AM1/14/13
to dtenti...@googlegroups.com
hmm, but it is possible to load libraries after the scene was loaded. I think adding a LibraryLoaded message would be more general


2013/1/14 Luca Vezzadini <luca.ve...@kairos3d.it>

Luca Vezzadini

unread,
Jan 14, 2013, 7:36:22 AM1/14/13
to dtenti...@googlegroups.com
Here is what I propose then:

- rename the EditorApplication::SceneLoaded signal to EditorApplication::EditorSceneLoaded, to avoid confusion (see previous message)
- add an OnComponentListChanged() method to EditorMainWindow;
use that method anytime that something changes that requires refreshing the list of components. This fully rebuilds the list of known systems, using the same approach that was used by AddToKnownComponentList (emit PropertyEditorModel::EntitySystemAdded signals)
- Add a connect between EditorSceneLoaded and the ne method - this fixes my issue
- For code cleanness, remove the AddToKnownComponentList method and switch everything to use the new method

I've done that and things look fine now. Here attached the modified files (both as a SVN patch and as single files). Have a look and it's fine for you I'll go ahead and commit them.


   Luca



_______________________________________________________________________
Luca Vezzadini R&D Team
Kairos3D Srl www.kairos3d.it
editorapplication.h
editormainwindow.h
editormainwindow.cpp
editorapplication.cpp
editorComponentList.patch

Martin Scheffler

unread,
Jan 15, 2013, 12:48:39 AM1/15/13
to dtenti...@googlegroups.com
OK, committed.
Maybe it is not that good an idea to load all plugin dlls in a certain directory. Do you think that it would make sense to only load those libraries set in the map, then add others via script or cpp code?

Cheers,
Martin


2013/1/14 Luca Vezzadini <luca.ve...@kairos3d.it>

Luca Vezzadini

unread,
Jan 15, 2013, 5:37:55 AM1/15/13
to dtenti...@googlegroups.com
Cool, thanks.

About loading all plugins in a folder, I agree, it's not really clean. In our apps we normally proceed in a different way: explicitely load from code those plugins we certainly have to use, and let the scene file specify which additional ones are used. We could do the same for the editor I think.

   luca


Reply all
Reply to author
Forward
0 new messages