Hello,
I have developed a Rhino c++ plug-in.
My plug-in shows a tree, contained into a CRhinoTabbedDockBarDialog, which presents the data contained into a tree model.
The tree model is populated with:
- some static elements which are always present, such the root and few children that allow to run particular actions;
- some dynamic elements built by the user, (the user can add, modify, move, delete these elements) that are saved into the .3dm on Rhino save event.
I don’t know if can be of help, but my tree view is build using Qt framework. I hook it to the CRhinoTabbedDockBarDialog throw the QWinWidget class, which allows to hook a QWidget to a Win dialog
I would like to better understand:
- Where should I instantiate the tree model and its static elements. Into my CRhinoPlugIn::OnLoadPlugIn() overload?
- Where should I load the data from the .3dm file and fill-in the tree model? I thought to my CRhinoEventWatcher::OnEndOpenDocument(CRhinoDoc&, const wchar_t*, BOOL, BOOL) and CRhinoEventWatcher::OnNewDocument(CRhinoDoc&) functions overload but I’m not sure they are executed after the OnLoadPlugIn() execution. I need to update the data model both when I open a document (new or saved) after the plug-in is fully loaded and when I load my plug-in after the document has been already opened. Anyway, should I manage the tree model updating into other CRhinoEventWatcher events?
- Which is the best place where I can store the reference to my tree model? Into my CRhinoPlugIn class? I need to access to it from several commands of my plug-in, and I would prefer to avoid to include my CRhinoPlugIn header file into each file where I need to change the tree model.
Any tips would be very appreciated!
Thank you,
Alberto