From 8d57e269b8b94aef8567aa43c21c51d1546a1f6f Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Tue, 8 Nov 2011 00:22:32 +0200 Subject: [PATCH] Fixed: #1193 Correct deleting particle system from workspace --- .../src/plugins/object_viewer/particle_editor.cpp | 2 ++ .../src/plugins/object_viewer/particle_node.cpp | 1 + .../plugins/object_viewer/particle_workspace_dialog.cpp | 7 +++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_editor.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_editor.cpp index d03cdab3d..768576755 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_editor.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_editor.cpp @@ -78,6 +78,8 @@ void CParticleEditor::release() void CParticleEditor::setActiveNode(CWorkspaceNode *node) { if (node == _ActiveNode) return; + if (node == 0) + _ActiveNode->getPSModel()->hide(); _ActiveNode = node; bool wasRunning = _State == State::RunningSingle; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_node.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_node.cpp index 3dfc1ce2c..15761c505 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_node.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_node.cpp @@ -378,6 +378,7 @@ void CParticleWorkspace::removeNode(uint index) { nlassert(index < _Nodes.size()); _Nodes[index] = NULL; // delete the smart-ptr target + delete _Nodes[index]; _Nodes.erase(_Nodes.begin() + index); touch(); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp index cb49def05..74182120c 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp @@ -305,6 +305,8 @@ void CParticleWorkspaceDialog::customContextMenu() _instanciateAction->setEnabled(stopped); _savePSAction->setEnabled(stopped); _saveAsPSAction->setEnabled(stopped); + _removeFromWSAction->setEnabled(stopped); + _clearContentAction->setEnabled(stopped); popurMenu->exec(QCursor::pos()); delete popurMenu; @@ -369,13 +371,14 @@ void CParticleWorkspaceDialog::clearContent() void CParticleWorkspaceDialog::removePS() { - if (_treeModel->getOwnerNode(_currentItem) == Modules::psEdit().getActiveNode()) + CWorkspaceNode *node = _currentItem->getNode(); + if (node == Modules::psEdit().getActiveNode()) Modules::psEdit().setActiveNode(NULL); QModelIndex index = _ui.treeView->currentIndex(); _ui.treeView->setCurrentIndex(index.parent()); clickedItem(index.parent()); - Modules::psEdit().getParticleWorkspace()->removeNode(static_cast(index.internalPointer())->getNode()); + Modules::psEdit().getParticleWorkspace()->removeNode(node); _treeModel->removeRows(index.row(), index.parent()); }