mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-24 09:58:46 +00:00
Fixed: #1193 Correct deleting particle system from workspace
This commit is contained in:
parent
43b0cf8ad1
commit
2234eae556
3 changed files with 8 additions and 2 deletions
|
@ -78,6 +78,8 @@ void CParticleEditor::release()
|
||||||
void CParticleEditor::setActiveNode(CWorkspaceNode *node)
|
void CParticleEditor::setActiveNode(CWorkspaceNode *node)
|
||||||
{
|
{
|
||||||
if (node == _ActiveNode) return;
|
if (node == _ActiveNode) return;
|
||||||
|
if (node == 0)
|
||||||
|
_ActiveNode->getPSModel()->hide();
|
||||||
_ActiveNode = node;
|
_ActiveNode = node;
|
||||||
|
|
||||||
bool wasRunning = _State == State::RunningSingle;
|
bool wasRunning = _State == State::RunningSingle;
|
||||||
|
|
|
@ -378,6 +378,7 @@ void CParticleWorkspace::removeNode(uint index)
|
||||||
{
|
{
|
||||||
nlassert(index < _Nodes.size());
|
nlassert(index < _Nodes.size());
|
||||||
_Nodes[index] = NULL; // delete the smart-ptr target
|
_Nodes[index] = NULL; // delete the smart-ptr target
|
||||||
|
delete _Nodes[index];
|
||||||
_Nodes.erase(_Nodes.begin() + index);
|
_Nodes.erase(_Nodes.begin() + index);
|
||||||
touch();
|
touch();
|
||||||
}
|
}
|
||||||
|
|
|
@ -305,6 +305,8 @@ void CParticleWorkspaceDialog::customContextMenu()
|
||||||
_instanciateAction->setEnabled(stopped);
|
_instanciateAction->setEnabled(stopped);
|
||||||
_savePSAction->setEnabled(stopped);
|
_savePSAction->setEnabled(stopped);
|
||||||
_saveAsPSAction->setEnabled(stopped);
|
_saveAsPSAction->setEnabled(stopped);
|
||||||
|
_removeFromWSAction->setEnabled(stopped);
|
||||||
|
_clearContentAction->setEnabled(stopped);
|
||||||
|
|
||||||
popurMenu->exec(QCursor::pos());
|
popurMenu->exec(QCursor::pos());
|
||||||
delete popurMenu;
|
delete popurMenu;
|
||||||
|
@ -369,13 +371,14 @@ void CParticleWorkspaceDialog::clearContent()
|
||||||
|
|
||||||
void CParticleWorkspaceDialog::removePS()
|
void CParticleWorkspaceDialog::removePS()
|
||||||
{
|
{
|
||||||
if (_treeModel->getOwnerNode(_currentItem) == Modules::psEdit().getActiveNode())
|
CWorkspaceNode *node = _currentItem->getNode();
|
||||||
|
if (node == Modules::psEdit().getActiveNode())
|
||||||
Modules::psEdit().setActiveNode(NULL);
|
Modules::psEdit().setActiveNode(NULL);
|
||||||
|
|
||||||
QModelIndex index = _ui.treeView->currentIndex();
|
QModelIndex index = _ui.treeView->currentIndex();
|
||||||
_ui.treeView->setCurrentIndex(index.parent());
|
_ui.treeView->setCurrentIndex(index.parent());
|
||||||
clickedItem(index.parent());
|
clickedItem(index.parent());
|
||||||
Modules::psEdit().getParticleWorkspace()->removeNode(static_cast<CParticleTreeItem *>(index.internalPointer())->getNode());
|
Modules::psEdit().getParticleWorkspace()->removeNode(node);
|
||||||
_treeModel->removeRows(index.row(), index.parent());
|
_treeModel->removeRows(index.row(), index.parent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue