Archives for: May 2007, 24

2007-05-24

Class Diagram and some Q&A with myself

Permalink 03:33:13 am, Categories: World Editor  

Now that exams are over, I can start the real work on the CS editor.

I decided to start off by trying to make a class diagram of the editor. This allows me visualize the system and locate problem areas in the design.

Class Diagram

There are a few issues that I've identified right now:

  1. What type do I use for the selections?

    Since I'm allowing heterogeneous selections, I need an array which can hold basically any CS engine object, including factories. I'm thinking a csWeakRefArray of iBase will work. It should use weak references since, we don't want to keep objects around if they deleted. Perhaps I need to call csWeakRefArray::Compact() before any function dealing with the selection, so I don't need to deal with invalid objects.



  2. How do I get the property editor for the selected objects?

    Each SCF interface will have its own property category, and each of these categories will be registered with the main property editor. To display the appropriate property editor for the selection, for each object, I should query each possible SCF interface until I find a match. The downside of this is that it has to test each and every interface for each object.

    Something like:

    class MeshWrapperPropertyCategory {
    public:
      // Pretty name for the category
      const char* GetCategory() {
        return "Mesh Wrapper";
      }
    
      bool AddToEditor(iBase* obj, PropertyEditor* propEditor) {
        iMeshWrapper* mesh = scfQueryInterface<iMeshWrapper>(obj);
        if (!mesh) return false;
    
        // ...
        // Add properties to propEditor.
        // These will also setup property change handlers which will call the interface's functions.
        // ...
    
        return true;
      }
    
    private:
      // Property change handlers go here.
    };
    

    This should allow you to edit objects of different types as long as they share some common SCF interface. The property editor will only show the interfaces in common. This will also reduce the amount of querying being done, since if the first object doesn't have interface X, we don't have to check if the next object has it.



  3. How do I register the tools with the toolbox?

    When a tool will registers itself with the tool manager, the tool manager should publish a ToolAdded event to its listeners. Among the listeners will be the ToolboxPanel. This should solve that.



  4. How to draw special stuff like the selection, manipulators for the move, rotate, and scale tools, or billboard icons for lights so you can select them visually?

    These should be handled in different classes.

    The CS view should draw the selection bounding box and the billboards for lights.
    The move, rotate, and scale tools should draw the manipulators.


  5. Where to use SCF interfaces in the code?

    I think one of the annoyances of CStudio was that everything was an interface and you had to put up with a lot of SCF boilerplate and interface querying to do anything. That said, I think that parts of the editor which are meant to be implemented by plugins should use SCF so that I can leave the dirty work of plugin loading to SCF. So, you'll probably end up seeing iTool, iPanel, and iAction. I'll have to read up more on SCF and talk to my mentor to make sure this is what I want.

Still, the diagram is missing some detail, e.g. tool and property category registration, various events/listeners, settings manager, and many tools/actions are not shown.

I will try to come up with a more complete diagram tomorrow and then I'll try to sort out any further difficulties. Hopefully I can get my hands on some code soon. In the meantime, to entertain my thirst for action rather than abstract thinking, I will try to set up the build system to work with wxAUI and wxPropertyGrid.

May 2007
Mon Tue Wed Thu Fri Sat Sun
 << < Current> >>
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Search

Categories

Archives

Misc

XML Feeds

What is this?

powered by
b2evolution