Esempio n. 1
0
void CommandRemoveParticleEmitterForce::Execute()
{
    // Need to know selected Layer Node to add the Force to.
    BaseParticleEditorNode* selectedNode = ParticlesEditorController::Instance()->GetSelectedNode();
    ForceParticleEditorNode* forceNode = dynamic_cast<ForceParticleEditorNode*>(selectedNode);
    if (!forceNode || !forceNode->GetRootNode())
    {
        return;
    }

    // Mark the "parent" Layer Node to selection.
    forceNode->GetLayerEditorNode()->SetMarkedToSelection(true);

	
	ParticleEffectComponent * effectComponent = forceNode->GetParticleEffectComponent();
	if (effectComponent)
	{
		effectComponent->Stop();
	}

    ParticlesEditorController::Instance()->RemoveParticleForceNode(forceNode);

	if (effectComponent)
	{
		effectComponent->Restart();
	}

    // Update the scene graph.
    QtMainWindowHandler::Instance()->RefreshSceneGraph();
}
Esempio n. 2
0
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();
}
Esempio n. 3
0
void CommandRestartParticleEffect::Execute()
{
    BaseParticleEditorNode* selectedNode = ParticlesEditorController::Instance()->GetSelectedNode();
    EffectParticleEditorNode* effectNode = dynamic_cast<EffectParticleEditorNode*>(selectedNode);
    if (!effectNode || !effectNode->GetRootNode() || !effectNode->GetRootNode())
    {
        return;
    }
    
	ParticleEffectComponent * effectComponent = effectNode->GetParticleEffectComponent();
	DVASSERT(effectComponent);
    effectComponent->Restart();
}
Esempio n. 4
0
void CommandAddParticleEmitterForce::Execute()
{
    // Need to know selected Layer Node to add the Force to.
    BaseParticleEditorNode* selectedNode = ParticlesEditorController::Instance()->GetSelectedNode();
    LayerParticleEditorNode* layerNode = dynamic_cast<LayerParticleEditorNode*>(selectedNode);
    if (!layerNode || !layerNode->GetRootNode())
    {
        return;
    }

	ParticleEffectComponent * effectComponent = layerNode->GetParticleEffectComponent();
	DVASSERT(effectComponent);
	effectComponent->Stop();
    ForceParticleEditorNode* forceNode = ParticlesEditorController::Instance()->AddParticleForceToNode(layerNode);
    if (forceNode)
    {
        forceNode->SetMarkedToSelection(true);
    }
	effectComponent->Restart();
	
    // Update the scene graph.
    QtMainWindowHandler::Instance()->RefreshSceneGraph();
}