void EditorBodyControl::Update(float32 timeElapsed)
{
	Entity * selection = scene->GetProxy();
	if (selection)
	{
		rotationCenter = selection->GetWorldTransform().GetTranslationVector();

		ArrowsNode* arrowsNode = GetArrowsNode(true);
		if (arrowsNode)
			UpdateArrowsNode(selection);
	}
	else
	{
		ArrowsNode* arrowsNode = GetArrowsNode(false);
		if (arrowsNode)
		{
			arrowsNode->SetVisible(false);
			SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive();
			activeScene->RemoveSceneNode(arrowsNode);
		}
	}
	
    if(cameraController)
    {
        cameraController->Update(timeElapsed);
    }
    
    if(currentLandscapeEditor)
    {
        currentLandscapeEditor->Update(timeElapsed);
    }
    
    
    UIControl::Update(timeElapsed);
}
void EditorBodyControl::UpdateArrowsNode(Entity* node)
{
	ArrowsNode* arrowsNode = GetArrowsNode(false);
	if (node && arrowsNode)
	{
		if (node == arrowsNode)
		{
			arrowsNode->SetVisible(false);
			return;
		}

		Matrix4 nodeWT = node->GetWorldTransform();
		Matrix4 arrowsNodeTransform;
		arrowsNodeTransform.CreateTranslation(nodeWT.GetTranslationVector());
		arrowsNode->SetLocalTransform(arrowsNodeTransform);
		arrowsNode->SetVisible(true);
		arrowsNode->SetActive(InModificationMode());
	}
}
void EditorBodyControl::LandscapeEditorStarted()
{
    RemoveControl(modificationPanel);
    savedModificatioMode = modificationPanel->IsModificationMode();
    
    UIControl *toolsPanel = currentLandscapeEditor->GetToolPanel();
    if(!toolsPanel->GetParent())
    {
        AddControl(toolsPanel);
    }
    
	Entity* sceneNode = FindLandscapeEntity(scene);
	if (sceneNode)
	{
		scene->SetSelection(sceneNode);
		SelectNodeAtTree(NULL);
		SelectNodeAtTree(sceneNode);
	}
    landscapeToolsSelection->Show();

	ArrowsNode* arrowsNode = GetArrowsNode(false);
	if (arrowsNode)
		arrowsNode->SetVisible(false);
}
예제 #4
0
void EditorBodyControl::Update(float32 timeElapsed)
{
	Entity * selection = scene->GetProxy();
	if (selection)
	{
		rotationCenter = selection->GetWorldTransform().GetTranslationVector();

		ArrowsNode* arrowsNode = GetArrowsNode(true);
		if (arrowsNode)
			UpdateArrowsNode(selection);
	}
	else
	{
		ArrowsNode* arrowsNode = GetArrowsNode(false);
		if (arrowsNode)
		{
			arrowsNode->SetVisible(false);
			SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive();
			activeScene->RemoveSceneNode(arrowsNode);
		}
	}
	
    if(cameraController)
    {
        cameraController->Update(timeElapsed);
    }
    
    if(currentLandscapeEditor)
    {
        currentLandscapeEditor->Update(timeElapsed);
    }
    
    
    UIControl::Update(timeElapsed);

	BeastProxy::Instance()->Update(beastManager);
	if(BeastProxy::Instance()->IsJobDone(beastManager))
	{
		PackLightmaps();
		BeastProxy::Instance()->SafeDeleteManager(&beastManager);

		Landscape *land = scene->GetLandscape(scene);
		if(land)
		{
			FilePath textureName = land->GetTextureName(DAVA::Landscape::TEXTURE_COLOR);
			textureName.ReplaceFilename("temp_beast.png");

			FileSystem::Instance()->DeleteFile(textureName);
		}

#if defined (__DAVAENGINE_WIN32__)
		BeastCommandLineTool *beastTool = dynamic_cast<BeastCommandLineTool *>(CommandLineManager::Instance()->GetActiveCommandLineTool());
        if(beastTool)
        {
            QtMainWindowHandler::Instance()->SaveScene(scene, beastTool->GetScenePathname());

			bool forceClose =	CommandLineParser::CommandIsFound(String("-force"))
							||  CommandLineParser::CommandIsFound(String("-forceclose"));
			if(forceClose)
	            Core::Instance()->Quit();
        }
#endif //#if defined (__DAVAENGINE_WIN32__)

		QtMainWindowHandler::Instance()->ReloadSceneTextures();
	}
}