At last, we have a proper hierarchy shown in the scene browser. What you see above is the scene node hierarchy of flarge.
I'm ignoring the whole multiple names/hierarchies thing that I mentioned in my last post. That stuff can come later.
TODO for Scene Browser:
Show icons for nodes, e.g. light bulb for lights, cube for mesh.
Implement renaming (currently allows you to do it, but doesn't actually change the CS object)
Implement context menu which has Select, Remove command and shows available one-off tools.
TODO for other stuff:
Implement VFS open dialog
No screenshots today, sorry.
There are a few problems with the current iEditorObject abstraction which I've come across so far. I'll deal with them each and try to come up with a solution.
The scene browser shows all of the sectors in flarge.
Here's how it works:
A plugin implementing wrappers around all of the (useful) CS interfaces is loaded. It registers interface wrapper factories with an iInterfaceWrapperManager. This manager keeps a hash of scfInterfaceID's mapped to iInterfaceWrapperFactory's.
Another plugin listens for when the map is loaded (which the editor tells it), then creates an EditorObject for all of the sectors in the engine and adds it to the editor's object list.
EditorObject, using SCF metadata, goes through each interface implemented by the object it's wrapping and requests the iInterfaceWrapperFactory for the given interface. If there's no wrapper for that interface, it ignores it. It then instantiates that wrapper and pushes it onto an array. While it's going through, it finds an interface wrapper that has a name attribute, and stores that for future reference, when something wants to call Get/SetName. It does the same thing for a parent attribute. It also figures out the type (instance, factory, or unknown) and stores that.
After adding an object to the object list, the scene browser panel will get an Object Added event, and it will put the given object into the tree, using EditorObject to get the name and parent (for the hierarchy).
I haven't implemented putting the objects into the correct hierarchy in the Scene Browser panel yet, nor have I implemented object name editing or re-parenting via dragging. Also, scene browser should have a way of showing an icon and grouping (or sorting) the different objects.
Right now, I've only implemented an interface wrapper around iObject, since that provides the name for every engine object. But eventually, I'll need wrappers for every useful object, since I will need to know their properties for the property editor.
This was partly just a proof-of-concept right now. There are a few functions that could have a better place at the moment.
Add the rest of objects from engine on map load (other than sectors)
Clean up some of the nasty parts
Respect object hierarchy in scene browser
Implement name editing in scene browser
Well that took somewhat longer than expected, but I ticked off everything from my previous list except for starting on the SceneBrowserPanel. The File->Open only opens flarge right now, since I've yet to make an open dialog.
I also implemented a custom statusbar which has a progress bar. iEngine::Prepare takes a iProgressMeter* as a parameter, so I gave it an implementation which updates the statusbar with the description and the progress on the Prepare. Prepare reports on lighting. Unfortunately, engine lighting will soon be removed, but I still believe that the iProgressMeter implementation will be useful. After all, it is generic enough to be used in other parts of CS, for example the loader/saver, or even internally in the editor, such as for terrain generation (if someone implements a plugin to do this). I have yet to expose the statusbar in the iEditor interface, but I think this would be a good idea in some form, so that plugins can keep the user abreast of what is going on. Whether they need to show the progress gauge or not, they can still benefit from showing descriptive status text.
Other than that, I'm getting a segmentation fault at program exit, so I'll have to investigate this a bit.
Today I got the plugin loading and CS initialization code working. So I implemented the CS 3D view panel in a new plugin which is loaded by searching for any plugins under the 'crystalspace.editor.plugin.' hierarchy.
I didn't have time to make the map loading menu item yet, so I just had it load flarge to test the view functionality.
Move main frame stuff to separate class
Add File->Open menu item
Add world load/save listener
Make CS view resize in response to frame resize
Start work on scene browser panel
So I actually got started implementing the editor the past few days. The current state is as follows.
But you wouldn't know from the screenshot that the panel manager and the panels themselves are potentially pluggable. I say potentially, because I haven't written the CS initialization code yet, including plugin loading of iPanels. Although, I don't expect to ever make the panel manager into a plugin.
In fact, most things in the editor will be pluggable, meaning you could implement them in a plugin. But to avoid making a plugin implementation for each single SCF interface in the editor, I'm going to include all of the core managers in the editor executable itself. But the core panels, tools, actions, and CS objects will be implemented in a single plugin to serve as an example and also to use consistent code for instantiating these components.
thebolt made a nice addition to SCF recently to provide access to interface metadata. This should make getting all of the interfaces that an object has so much faster since it means I don't have to iterate over all possible interfaces. Instead, I can keep a hash table of interface names mapped to iInterfaceWrapperFactory's. So to instantiate the correct iInterfaceWrapper objects for a particular iBase* object, I can simply perform lookups in the table. Thanks Marten.
Panels now also specify a default dock position so that they are laid out in an appropriate way. You can always move the panes around though (except for center pane). It will be nice if I have a menu for saving perspectives, that is, view configurations. But I won't worry about that yet.
Implement plugin loading code
Implement CS initialization code
Implement the main CS 3d panel
Move wx event pump to CS 3d panel
Implement a map loading menu item
Start work on the scene manager and editor object stuff
|<< <||Current||> >>|