Ejemplo n.º 1
0
void SceneValidator::ConvertLightmapSizeFromProperty(Entity *ownerNode, InstanceMaterialState *materialState)
{
	KeyedArchive * props = ownerNode->GetCustomProperties();
	Map<String, VariantType*> map = props->GetArchieveData();
	for(Map<String, VariantType*>::iterator it = map.begin(); it != map.end(); it++)
	{
		String key = it->first;
		if(key.find("lightmap.size") != String::npos && ((RenderComponent*)ownerNode->GetComponent(Component::RENDER_COMPONENT))->GetRenderObject()->GetType() != RenderObject::TYPE_LANDSCAPE)
		{
			materialState->SetLightmapSize(props->GetInt32(key, 128));
			props->DeleteKey(key);
			break;
		}
	}
}
void NodesPropertyControl::OnCellSelected(UIList *, UIListCell *selectedCell)
{
    if(currentSceneNode)
    {
        int32 index = selectedCell->GetIndex();
        KeyedArchive *customProperties = currentSceneNode->GetCustomProperties();
        Map<String, VariantType*> propsData = customProperties->GetArchieveData();
        int32 i = 0; 
        for (Map<String, VariantType*>::iterator it = propsData.begin(); it != propsData.end(); ++it, ++i)
        {
            if(i == index)
            {
                customProperties->DeleteKey(it->first);
                
                OnCancel(NULL, NULL, NULL);
                ReadFrom(currentSceneNode);
                break;
            }
        }
    }
}
Ejemplo n.º 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");
			}
		}
    }
}