PDA

View Full Version : Good use of the MVC pattern for 3d editors.



toglia3d
1st October 2010, 03:00
As many people, I want to do my first basic 3d game editor based on Qt. The editor word here is just huge cause what I want to do is very simple.

Anyway, I have been messing with Qt for a few months now, doing a 2d editor, and I'm almost getting addicted to it, although I know I'm certainly not using it at its best. One of the main things I didn't like, for example, was syncing the Qt model (QStandardItemModel) with Ogre's Scene Manager (the graphics engine scene manager).

I used the QStandarditemModel to store all the logic of the 2d scene itself. I would have an element per row and columns for names, positions, dimensions, showing/hiding, textures, etc, etc. This allowed me to use this model as a center for all the views; like, the elements view, texture view, etc. But most of the time I would catch an event, change the model then change the scene, which I always thought it was an error prone way of doing things, but it was the best I could do by that time.

I have discovered many cool things about Qt, but since a lot of users have used it before to create 3d editors too, I would like to know how did you guys end up implementing the model view controller pattern in graphic editors, or how, for example, do you sync the graphic's engine world scene in a tree view.

Thanks!

marcvanriet
1st October 2010, 12:06
Hi,

You can take a look at Qt/3D (http://doc.qt.nokia.com/qt3d-snapshot/index.html). It has scene management classes that I think would be usefull for an editor.

Unfortunately I haven't had time to look into it myself.

Best regards,
Marc

toglia3d
1st October 2010, 14:39
Using Ogre is mandatory in my case. But the real question is how to maintain both the 3d world and the Qt Gui synced up. Is there a better way of doing things, that what I did before? Having the graphic model and a logic model?