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);
	}
}
Ejemplo n.º 2
0
void EditorBodyControl::SelectNodeAtTree(DAVA::Entity *node)
{
    SceneData *sceneData = SceneDataManager::Instance()->SceneGetActive();
    sceneData->SelectNode(node);
}
Ejemplo n.º 3
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;
}