Core: Gui: SoFCSysDragger: changes to SoFCDB to store dragger.

This commit is contained in:
blobfish 2015-08-09 11:45:38 -04:00 committed by wmayer
parent 56e5837fd3
commit 381a59bb36
2 changed files with 23 additions and 1 deletions

View File

@ -27,6 +27,7 @@
# include <Inventor/VRMLnodes/SoVRMLGroup.h>
# include <Inventor/VRMLnodes/SoVRMLParent.h>
# include <Inventor/SbString.h>
# include <Inventor/nodes/SoGroup.h>
#endif
#include <Base/FileInfo.h>
@ -53,6 +54,7 @@
#include "Inventor/SoDrawingGrid.h"
#include "Inventor/SoAutoZoomTranslation.h"
#include "Inventor/MarkerBitmaps.h"
#include "SoFCCSysDragger.h"
#include "propertyeditor/PropertyItem.h"
#include "NavigationStyle.h"
@ -64,6 +66,7 @@ using namespace Gui::Inventor;
using namespace Gui::PropertyEditor;
static SbBool init_done = false;
static SoGroup *storage = nullptr;
SbBool Gui::SoFCDB::isInitialized(void)
{
@ -112,6 +115,7 @@ void Gui::SoFCDB::init()
SoDrawingGrid ::initClass();
SoAutoZoomTranslation ::initClass();
MarkerBitmaps ::initClass();
SoFCCSysDragger ::initClass();
PropertyItem ::init();
PropertySeparatorItem ::init();
@ -160,6 +164,10 @@ void Gui::SoFCDB::init()
qRegisterMetaType<Base::Quantity>("Base::Quantity");
qRegisterMetaType<QList<Base::Quantity> >("Base::QuantityList");
init_done = true;
assert(!storage);
storage = new SoGroup();
storage->ref();
}
void Gui::SoFCDB::finish()
@ -181,6 +189,9 @@ void Gui::SoFCDB::finish()
SoFCEnableHighlightAction ::finish();
SoFCSelectionColorAction ::finish();
SoFCHighlightColorAction ::finish();
storage->unref();
storage = nullptr;
}
// buffer acrobatics for inventor ****************************************************
@ -287,3 +298,9 @@ bool Gui::SoFCDB::writeToFile(SoNode* node, const char* filename, bool binary)
return ret;
}
SoGroup* Gui::SoFCDB::getStorage()
{
assert(storage); //call init first.
return storage;
}

View File

@ -28,9 +28,10 @@
#include <Inventor/SbBasic.h>
class SoNode;
class SoGroup;
namespace Gui {
/**
* The FreeCAD database class to initialioze all onw Inventor nodes.
* The FreeCAD database class to initialize all our own Inventor nodes.
* @author Werner Mayer
*/
class GuiExport SoFCDB
@ -44,6 +45,10 @@ public:
static bool writeToVRML(SoNode* node, const char* filename, bool binary);
// Write to VRML or Inventor file
static bool writeToFile(SoNode* node, const char* filename, bool binary);
/*! container for app lifetime storage. See SoFCCSysDragger for details
* on why this is needed.
*/
static SoGroup* getStorage();
};
} // namespace Gui