コード例 #1
0
void CommandInternalRemoveSceneNode::Cancel()
{
	if (nodesForDeletion.size() == 0)
		return;

	for (Vector<RemoveNodeRec>::reverse_iterator rIt = nodesForDeletion.rbegin(); rIt != nodesForDeletion.rend(); ++rIt)
	{
		if (rIt->insertBeforeNode)
			rIt->nodeParent->InsertBeforeNode(rIt->node, rIt->insertBeforeNode);
		else
			rIt->nodeParent->AddNode(rIt->node);
	}

	SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive();
	activeScene->RebuildSceneGraph();

	if (selectedNode)
	{
		SceneEditorScreenMain* screen = dynamic_cast<SceneEditorScreenMain *>(UIScreenManager::Instance()->GetScreen());
		DVASSERT(screen);

		EditorBodyControl* bodyControl = screen->FindCurrentBody()->bodyControl;
		if (bodyControl && !bodyControl->LandscapeEditorActive())
			activeScene->SelectNode(selectedNode);
	}
}
コード例 #2
0
void CommandHeightmapEditor::Execute()
{
    SceneEditorScreenMain *screen = dynamic_cast<SceneEditorScreenMain *>(UIScreenManager::Instance()->GetScreen());
    if(screen)
    {
        screen->HeightmapTriggered();
    }

    SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive();
    activeScene->RebuildSceneGraph();
}
コード例 #3
0
void GraphBase::NodesPropertyChanged(const String &forKey)
{
	SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive();

	// For some properties rebuilding of selected node only is enough. For other ones,
	// the whole Scene Graph refresh is needed.
	if (IsRebuildSelectedNodeEnough(forKey))
	{
		Entity* selectedNode = activeScene->GetSelectedNode();
		activeScene->RebuildSceneGraphNode(selectedNode);
	}
	else
	{
		activeScene->RebuildSceneGraph();
	}
}
コード例 #4
0
void CommandInternalRemoveSceneNode::Execute()
{
	if (nodesForDeletion.size() == 0)
	{
		SetState(STATE_INVALID);
		return;
	}

	for (uint32 i = 0; i < nodesForDeletion.size(); ++i)
	{
		nodesForDeletion[i].nodeParent->RemoveNode(nodesForDeletion[i].node);
	}

	SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive();
	activeScene->RebuildSceneGraph();
}
コード例 #5
0
bool EditorBodyControl::ProcessKeyboard(UIEvent *event)
{
    if (event->phase == UIEvent::PHASE_KEYCHAR)
    {
        UITextField *tf = dynamic_cast<UITextField *>(UIControlSystem::Instance()->GetFocusedControl());
        if(!tf)
        {
            modificationPanel->Input(event);
            
			if(!IsKeyModificatorsPressed())
			{
				Camera * newCamera = 0;
				switch(event->tid)
				{
				case DVKEY_ESCAPE:
					{
						UIControl *c = UIControlSystem::Instance()->GetFocusedControl();
						if(c == this || c == scene3dView)
						{
                        SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive();
							activeScene->SelectNode(NULL);
						}

						break;
					}

				case DVKEY_C:
					newCamera = scene->GetCamera(2);
					break;

				case DVKEY_V:
					newCamera = scene->GetCamera(3);
					break;

				case DVKEY_B:
					newCamera = scene->GetCamera(4);
					break;

				case DVKEY_X:
					{
						bool Z = InputSystem::Instance()->GetKeyboard()->IsKeyPressed(DVKEY_Z);
						bool C = InputSystem::Instance()->GetKeyboard()->IsKeyPressed(DVKEY_C);
						if(!Z && !C)
						{
							ProcessIsSolidChanging();
						}

						break;
					}

				default:
					break;
				}

				if (newCamera)
				{
					scene->SetCurrentCamera(newCamera);
					scene->SetClipCamera(scene->GetCamera(0));
				}
			}
            else if(InputSystem::Instance()->GetKeyboard()->IsKeyPressed(DVKEY_CTRL) && (event->tid == DVKEY_BACKSPACE))
            {
                sceneGraph->RemoveWorkingNode();
                
                SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive();
                activeScene->SelectNode(NULL);
                activeScene->RebuildSceneGraph();
            }
        }
	}
	
    return true;
}
コード例 #6
0
void CommandRefreshSceneGraph::Execute()
{
    SceneData * activeScene = SceneDataManager::Instance()->SceneGetActive();
    activeScene->RebuildSceneGraph();
}