void CommandAddParticleEmitterLayer::Execute() { // Need to know selected Particle Emitter Layers Root. BaseParticleEditorNode* selectedNode = ParticlesEditorController::Instance()->GetSelectedNode(); EmitterParticleEditorNode* emitterNode = dynamic_cast<EmitterParticleEditorNode*>(selectedNode); if (!emitterNode) { return; } ParticleEffectComponent * effectComponent = emitterNode->GetParticleEffectComponent(); DVASSERT(effectComponent); effectComponent->Stop(); // Lets select this node when the tree will be rebuilt. LayerParticleEditorNode* layerNode = ParticlesEditorController::Instance()->AddParticleLayerToNode(emitterNode); if (layerNode) { layerNode->SetMarkedToSelection(true); } effectComponent->Restart(); // Update the scene graph. QtMainWindowHandler::Instance()->RefreshSceneGraph(); }
void CommandCloneParticleEmitterLayer::Execute() { // Need to know selected Layer Node to remove it. BaseParticleEditorNode* selectedNode = ParticlesEditorController::Instance()->GetSelectedNode(); LayerParticleEditorNode* layerNode = dynamic_cast<LayerParticleEditorNode*>(selectedNode); if (!layerNode) { return; } LayerParticleEditorNode* clonedNode = ParticlesEditorController::Instance()->CloneParticleLayerNode(layerNode); if (clonedNode) { clonedNode->SetMarkedToSelection(true); } // Update the scene graph. QtMainWindowHandler::Instance()->RefreshSceneGraph(); }