Skip to content
Snippets Groups Projects
Commit 76210863 authored by Matthias Puchner's avatar Matthias Puchner
Browse files

enhance ParticleCoreShellItem to allow un-setting core & shell

parent f73937e3
No related branches found
No related tags found
1 merge request!413introduce layer oriented sample editor
......@@ -66,9 +66,15 @@ ParticleItem* ParticleCoreShellItem::core() const
return dynamic_cast<ParticleItem*>(getItem(T_CORE));
}
void ParticleCoreShellItem::setCore(ParticleItem* core)
void ParticleCoreShellItem::setCore(ParticleItem* newCore)
{
model()->moveItem(core, this, -1, T_CORE);
if (newCore == nullptr) {
if (core() != nullptr)
model()->removeItem(core());
return;
}
model()->moveItem(newCore, this, -1, T_CORE);
}
ParticleItem* ParticleCoreShellItem::createCore()
......@@ -86,9 +92,15 @@ ParticleItem* ParticleCoreShellItem::shell() const
return dynamic_cast<ParticleItem*>(getItem(T_SHELL));
}
void ParticleCoreShellItem::setShell(ParticleItem* shell)
void ParticleCoreShellItem::setShell(ParticleItem* newShell)
{
model()->moveItem(shell, this, -1, T_SHELL);
if (newShell == nullptr) {
if (shell() != nullptr)
model()->removeItem(shell());
return;
}
model()->moveItem(newShell, this, -1, T_SHELL);
}
ParticleItem* ParticleCoreShellItem::createShell()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment