void LandscapeEditorDrawSystem::RemoveEntity(DAVA::Entity * entity)
{
	if (entity == landscapeNode)
	{
		SceneEditor2* sceneEditor = static_cast<SceneEditor2*>(GetScene());

		bool needRemoveBaseLandscape = sceneEditor->IsToolsEnabled(SceneEditor2::LANDSCAPE_TOOLS_ALL
																   & ~SceneEditor2::LANDSCAPE_TOOL_TILEMAP_EDITOR);

		sceneEditor->DisableTools(SceneEditor2::LANDSCAPE_TOOLS_ALL);

		if (needRemoveBaseLandscape)
		{
			sceneEditor->renderUpdateSystem->RemoveEntity(entity);
		}

		DeinitLandscape();

		Entity* entity = FindLandscapeEntity(sceneEditor);
		if (entity != NULL)
		{
			InitLandscape(entity, GetLandscape(entity));
		}
	}
}
Entity * FindLandscapeEntity(Entity * rootEntity)
{
	if(GetLandscape(rootEntity))
	{
		return rootEntity;
	}

	DAVA::int32 count = rootEntity->GetChildrenCount();
	for(DAVA::int32 i = 0; i < count; ++i)
	{
		Entity *landscapeEntity = FindLandscapeEntity(rootEntity->GetChild(i));
		if(landscapeEntity)
		{
			return landscapeEntity;
		}
	}

	return NULL;
}
Example #3
0
void Scene::ImportShadowColor(Entity * rootNode)
{
    if(NULL != sceneGlobalMaterial)
    {
		Entity * landscapeNode = FindLandscapeEntity(rootNode);
		if(NULL != landscapeNode)
		{
			// try to get shadow color for landscape
			KeyedArchive * props = GetCustomPropertiesArchieve(landscapeNode);
			if (props->IsKeyExists("ShadowColor"))
			{
				Color shadowColor = props->GetVariant("ShadowColor")->AsColor();
				sceneGlobalMaterial->SetPropertyValue(NMaterial::PARAM_SHADOW_COLOR,
					Shader::UT_FLOAT_VEC4,
					1,
					shadowColor.color);

				props->DeleteKey("ShadowColor");
			}
		}
    }
}
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);
}
Landscape * FindLandscape(Entity * rootEntity)
{
	Entity *entity = FindLandscapeEntity(rootEntity);
	return GetLandscape(entity);
}