Commit 62b18208 authored by Dirk Wilden's avatar Dirk Wilden

addNode and addGlobalNode added


git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@2789 383ad7c9-94d9-4d36-a494-682f7c89f535
parent e2af11d1
......@@ -62,6 +62,8 @@ static ACG::QtWidgets::QtExaminerViewer* examiner_widget_;
*/
static SeparatorNode* root_node_;
static SeparatorNode* sceneGraph_root_node_;
void setDataRoot( BaseObject* _root ) {
objectRoot_ = _root;
}
......@@ -74,6 +76,10 @@ void set_rootNode( SeparatorNode* _root_node ) {
PluginFunctions::root_node_ = _root_node;
}
void set_sceneGraphRootNode( SeparatorNode* _root_node ) {
PluginFunctions::sceneGraph_root_node_ = _root_node;
}
bool get_source_meshes( std::vector<TriMesh*>& _meshes ) {
_meshes.clear();
......@@ -443,10 +449,31 @@ ACG::Vec3d upVector() {
}
ACG::SceneGraph::BaseNode* getSceneGraphRootNode() {
return PluginFunctions::sceneGraph_root_node_;
}
ACG::SceneGraph::BaseNode* getRootNode() {
return PluginFunctions::root_node_;
}
void addNode(ACG::SceneGraph::BaseNode* _node){
if (PluginFunctions::root_node_)
_node->set_parent( PluginFunctions::root_node_ );
}
void addGlobalNode(ACG::SceneGraph::BaseNode* _node){
if (PluginFunctions::sceneGraph_root_node_){
//set node as new parent for root's children
while( PluginFunctions::sceneGraph_root_node_->nChildren() > 0 ){
ACG::SceneGraph::BaseNode* child = *(PluginFunctions::sceneGraph_root_node_->childrenBegin());
child->set_parent( _node );
}
_node->set_parent( PluginFunctions::sceneGraph_root_node_ );
}
}
int object_count() {
int count = 0;
......
......@@ -278,7 +278,11 @@ bool get_property_handle(MeshT* _mesh , QString _name, OpenMesh::HPropHandleT< p
DLLEXPORT
void set_examiner( ACG::QtWidgets::QtExaminerViewer* examiner_widget_ );
/// Set the internal root node pointer ( DO NOT USE!! )
/// Set the internal scenegraph root node pointer ( DO NOT USE!! )
DLLEXPORT
void set_sceneGraphRootNode( SeparatorNode* _root_node );
/// Set the internal data root node pointer ( DO NOT USE!! )
DLLEXPORT
void set_rootNode( SeparatorNode* _root_node );
......@@ -306,10 +310,22 @@ ACG::GLState& glState();
DLLEXPORT
void getCurrentViewImage(QImage& _image);
/// Get the root node
DLLEXPORT
ACG::SceneGraph::BaseNode* getSceneGraphRootNode();
/// Get the root node
DLLEXPORT
ACG::SceneGraph::BaseNode* getRootNode();
/// Add a node under the root node
DLLEXPORT
void addNode(ACG::SceneGraph::BaseNode* _node);
/// Add a node between root node and its children
DLLEXPORT
void addGlobalNode(ACG::SceneGraph::BaseNode* _node);
/// Set the current Action Mode (PickMode,ExamineMode,...)
DLLEXPORT
void actionMode ( ACG::QtWidgets::QtBaseViewer::ActionMode _mode);
......
......@@ -101,13 +101,15 @@
Core::
Core() :
QObject(),
root_node_(0, "Root Node"),
nextBackupId_(0),
standard_draw_mode_(ACG::SceneGraph::DrawModes::SOLID_SMOOTH_SHADED),
set_random_base_color_(true),
coreWidget_(0)
{
//init nodes
root_node_scenegraph_ = new ACG::SceneGraph::SeparatorNode(0, "SceneGraph Root Node");
root_node_ = new ACG::SceneGraph::SeparatorNode(root_node_scenegraph_, "Data Root Node");
// Add ViewMode All
ViewMode* vm = new ViewMode();
vm->name = "All";
......@@ -133,7 +135,9 @@ void
Core::init() {
// Make root_node available to the plugins ( defined in PluginFunctions.hh)
PluginFunctions::set_rootNode( &root_node_ );
PluginFunctions::set_rootNode( root_node_ );
PluginFunctions::set_sceneGraphRootNode( root_node_scenegraph_ );
// Initialize the first object as the root Object for the object tree
objectRoot_ = dynamic_cast< BaseObject* > ( new GroupObject("ObjectRoot") );
......@@ -153,7 +157,7 @@ Core::init() {
QApplication::processEvents();
}
coreWidget_ = new CoreWidget( &root_node_, viewModes_ , plugins);
coreWidget_ = new CoreWidget(viewModes_ , plugins);
connect(coreWidget_, SIGNAL(clearAll()) , this, SLOT(clearAll()));
connect(coreWidget_, SIGNAL(loadMenu()) , this, SLOT(slotLoadMenu()));
......@@ -484,7 +488,7 @@ Core::slotAddHiddenPickMode( const std::string _mode , QCursor _cursor) {
*/
void Core::updateView() {
if ( OpenFlipper::Options::gui() && !OpenFlipper::Options::openingIni() ) {
coreWidget_->examiner_widget_->sceneGraph(&root_node_);
coreWidget_->examiner_widget_->sceneGraph(root_node_scenegraph_);
coreWidget_->examiner_widget_->updateGL();
}
}
......
......@@ -387,7 +387,10 @@ private:
private:
/// Scenegraphs root node
SeparatorNode root_node_;
SeparatorNode* root_node_scenegraph_;
/// Data root node
SeparatorNode* root_node_;
/** @} */
......
......@@ -47,7 +47,7 @@ void Core::resetScenegraph() {
if ( OpenFlipper::Options::gui() && !OpenFlipper::Options::openingIni() ) {
// update scene graph
coreWidget_->examiner_widget_->lockUpdate();
coreWidget_->examiner_widget_->sceneGraph(&root_node_);
coreWidget_->examiner_widget_->sceneGraph(root_node_scenegraph_);
coreWidget_->examiner_widget_->viewAll();
coreWidget_->examiner_widget_->setScenePos( coreWidget_->examiner_widget_->scene_center() ,
coreWidget_->examiner_widget_->scene_radius() /* 10.0*/ );
......
......@@ -58,8 +58,7 @@
*
*/
CoreWidget::
CoreWidget( SeparatorNode* _rootNode,
QVector<ViewMode*>& _viewModes,
CoreWidget( QVector<ViewMode*>& _viewModes,
std::vector<PluginInfoT>& _plugins ) :
QMainWindow(),
viewModes_(_viewModes),
......@@ -82,7 +81,6 @@ CoreWidget( SeparatorNode* _rootNode,
helpBrowserDeveloper_(0),
helpBrowserUser_(0),
optionsWidget_(0),
root_node_(_rootNode),
plugins_(_plugins)
{
......@@ -117,7 +115,7 @@ CoreWidget( SeparatorNode* _rootNode,
"Examiner Widget",
statusBar_ ,
&format);
examiner_widget_->sceneGraph(root_node_);
examiner_widget_->sceneGraph( PluginFunctions::getSceneGraphRootNode() );
examiner_widget_->enablePopupMenu(false);
stackedWidget_->addWidget(examiner_widget_);
......
......@@ -132,7 +132,7 @@ class CoreWidget : public QMainWindow
public:
/// constructor
CoreWidget( SeparatorNode* _rootNode , QVector<ViewMode*>& _viewModes, std::vector<PluginInfoT>& _plugins );
CoreWidget( QVector<ViewMode*>& _viewModes, std::vector<PluginInfoT>& _plugins );
/// destructor
~CoreWidget();
......@@ -499,9 +499,6 @@ public:
private :
/// Scenegraphs root node
SeparatorNode* root_node_;
std::vector<PluginInfoT>& plugins_;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment