diff --git a/modules/gui/src/scene_selection.cc b/modules/gui/src/scene_selection.cc index 7beeadc58d7777ca7362424ca03692902d628657..72e8f4f55b0bf66f36c7c9caaf9c31bd7f7eee31 100644 --- a/modules/gui/src/scene_selection.cc +++ b/modules/gui/src/scene_selection.cc @@ -117,18 +117,13 @@ void SceneSelection::CenterOnObjects() { } void SceneSelection::Delete() { - QList<gfx::GfxObjP> selected_objects; + QList<gfx::GfxNodeP> selected_objects; for(unsigned int i = 0; i < nodes_.size(); i++){ gfx::GfxNodeP node = nodes_[i]; - if (node) { - gfx::GfxObjP obj = dyn_cast<gfx::GfxObj> (node); - if (obj) { - selected_objects.append(obj); - } - } + selected_objects.append(node); } for(int i=0; i < selected_objects.size(); i++){ - gfx::Scene::Instance().Remove(selected_objects[i]); + gfx::Scene::Instance().Remove(selected_objects[i]); } } diff --git a/modules/gui/src/scene_win/context_menu.cc b/modules/gui/src/scene_win/context_menu.cc index e69b943bc7d0adf5d3e27fe62d67bb6c2b1345c3..dff6fbee6e8fbce72da02c0c9d5d81a9b10f4951 100644 --- a/modules/gui/src/scene_win/context_menu.cc +++ b/modules/gui/src/scene_win/context_menu.cc @@ -28,6 +28,8 @@ #include <ost/dyn_cast.hh> +#include <ost/gfx/scene.hh> + #include <ost/gui/scene_selection.hh> #include <ost/gui/query_dialog.hh> @@ -66,14 +68,14 @@ ContextMenu::ContextMenu(QTreeView* view, SceneWinModel* model): action = new QAction("Delete",this); connect(action, SIGNAL(triggered()), SceneSelection::Instance(), SLOT(Delete())); - this->AddAction(action, GFX_OBJECT|NOT_SCENE); + this->AddAction(action, GFX_NODE|NOT_SCENE); action = new QAction("Show",this); connect(action, SIGNAL(triggered()), SceneSelection::Instance(), SLOT(Show())); - this->AddAction(action, GFX_OBJECT|NOT_VISIBLE); + this->AddAction(action, GFX_NODE|NOT_VISIBLE); action = new QAction("Hide",this); connect(action, SIGNAL(triggered()), SceneSelection::Instance(), SLOT(Hide())); - this->AddAction(action, GFX_OBJECT|NOT_HIDDEN); + this->AddAction(action, GFX_NODE|NOT_HIDDEN); action = new QAction("Show",this); connect(action, SIGNAL(triggered()), SceneSelection::Instance(), SLOT(MakeVisible())); @@ -149,7 +151,7 @@ void ContextMenu::ShowMenu(const QPoint& pos) else{ flags &= ~NOT_VISIBLE; } - if(gfx_node->GetType()==0){flags &= ~NOT_SCENE;} + if(gfx::Scene::Instance().GetRootNode() == gfx_node){flags &= ~NOT_SCENE;} if(!dyn_cast<gfx::GfxObj> (gfx_node)){flags &= ~GFX_OBJECT;} if(!dyn_cast<gfx::Entity> (gfx_node)){flags &= ~ENTITY;} #if OST_IMG_ENABLED @@ -175,7 +177,7 @@ void ContextMenu::ShowMenu(const QPoint& pos) #endif // OST_IMG_ENABLED } else{ - flags &= ~(GFX_OBJECT | ENTITY + flags &= ~(GFX_NODE | GFX_OBJECT | ENTITY #if OST_IMG_ENABLED | MAP #endif diff --git a/modules/gui/src/scene_win/context_menu.hh b/modules/gui/src/scene_win/context_menu.hh index b8a99f6f0292d14aed63eb8410c1def41900d485..06890baea5611db74a12ab9956c308c4c746db93 100644 --- a/modules/gui/src/scene_win/context_menu.hh +++ b/modules/gui/src/scene_win/context_menu.hh @@ -35,21 +35,22 @@ namespace ost { namespace gui { enum ContextActionType { - GFX_OBJECT=0x1, - ENTITY=0x2, - ENTITY_VIEW=0x4, - CUSTOM_VIEW=0x8, - NOT_VISIBLE=0x10, - NOT_HIDDEN=0x20, - NOT_SCENE=0x40, - SINGLE=0x80, - MULTI=0x100, - VIEWS_SAME_OBJECT=0x200 + GFX_NODE=0x1, + GFX_OBJECT=0x2, + ENTITY=0x4, + ENTITY_VIEW=0x8, + CUSTOM_VIEW=0x10, + NOT_VISIBLE=0x20, + NOT_HIDDEN=0x40, + NOT_SCENE=0x80, + SINGLE=0x100, + MULTI=0x200, + VIEWS_SAME_OBJECT=0x400 #if OST_IMG_ENABLED - ,MAP=0x400, - MAP_ORIGINAL=0x800, - MAP_DOWNSAMPLED=0x1000, - MAP_DSAMPLED_AVAIL=0x2000 + ,MAP=0x800, + MAP_ORIGINAL=0x1000, + MAP_DOWNSAMPLED=0x2000, + MAP_DSAMPLED_AVAIL=0x4000 #endif }; Q_DECLARE_FLAGS(ContextActionTypes, ContextActionType)