void LandscapePropertyControl::OnFloatPropertyChanged(PropertyList *forList, const String &forKey, float newValue) { if("property.landscape.size" == forKey || "property.landscape.height" == forKey) { LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode); Vector3 size( propertyList->GetFloatPropertyValue("property.landscape.size"), propertyList->GetFloatPropertyValue("property.landscape.size"), propertyList->GetFloatPropertyValue("property.landscape.height")); AABBox3 bbox; bbox.AddPoint(Vector3(-size.x/2.f, -size.y/2.f, 0.f)); bbox.AddPoint(Vector3(size.x/2.f, size.y/2.f, size.z)); String heightMap = propertyList->GetFilepathPropertyValue("property.landscape.heightmap"); if(EditorSettings::IsValidPath(heightMap) && heightMap.length()) { landscape->BuildLandscapeFromHeightmapImage(heightMap, bbox); } } if ("property.landscape.texture0.tilex" == forKey || "property.landscape.texture0.tiley" == forKey) { LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode); Vector2 tiling(propertyList->GetFloatPropertyValue("property.landscape.texture0.tilex"), propertyList->GetFloatPropertyValue("property.landscape.texture0.tiley")); landscape->SetTextureTiling(LandscapeNode::TEXTURE_TILE0, tiling); } if ("property.landscape.texture1.tilex" == forKey || "property.landscape.texture1.tiley" == forKey) { LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode); Vector2 tiling(propertyList->GetFloatPropertyValue("property.landscape.texture1.tilex"), propertyList->GetFloatPropertyValue("property.landscape.texture1.tiley")); landscape->SetTextureTiling(LandscapeNode::TEXTURE_TILE1, tiling); } if ("property.landscape.texture2.tilex" == forKey || "property.landscape.texture2.tiley" == forKey) { LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode); Vector2 tiling(propertyList->GetFloatPropertyValue("property.landscape.texture2.tilex"), propertyList->GetFloatPropertyValue("property.landscape.texture2.tiley")); landscape->SetTextureTiling(LandscapeNode::TEXTURE_TILE2, tiling); } if ("property.landscape.texture3.tilex" == forKey || "property.landscape.texture3.tiley" == forKey) { LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode); Vector2 tiling(propertyList->GetFloatPropertyValue("property.landscape.texture3.tilex"), propertyList->GetFloatPropertyValue("property.landscape.texture3.tiley")); landscape->SetTextureTiling(LandscapeNode::TEXTURE_TILE3, tiling); } if ("property.material.dencity" == forKey) { LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (currentSceneNode); landscape->SetFogDensity(newValue); } NodesPropertyControl::OnFloatPropertyChanged(forList, forKey, newValue); }
void LandscapePropertyControl::OnFloatPropertyChanged(PropertyList *forList, const String &forKey, float newValue) { if("property.landscape.size" == forKey || "property.landscape.height" == forKey) { LandscapeNode *landscape = GetLandscape(); if (landscape) { Vector3 size( propertyList->GetFloatPropertyValue("property.landscape.size"), propertyList->GetFloatPropertyValue("property.landscape.size"), propertyList->GetFloatPropertyValue("property.landscape.height")); AABBox3 bbox; bbox.AddPoint(Vector3(-size.x/2.f, -size.y/2.f, 0.f)); bbox.AddPoint(Vector3(size.x/2.f, size.y/2.f, size.z)); Set<String> errorsLog; String heightMap = propertyList->GetFilepathPropertyValue("property.landscape.heightmap"); if(SceneValidator::Instance()->ValidateHeightmapPathname(heightMap, errorsLog) && heightMap.length()) { landscape->BuildLandscapeFromHeightmapImage(heightMap, bbox); } } } if ("property.landscape.texture0.tilex" == forKey || "property.landscape.texture0.tiley" == forKey) { LandscapeNode *landscape = GetLandscape(); if (landscape) { Vector2 tiling(propertyList->GetFloatPropertyValue("property.landscape.texture0.tilex"), propertyList->GetFloatPropertyValue("property.landscape.texture0.tiley")); landscape->SetTextureTiling(LandscapeNode::TEXTURE_TILE0, tiling); } } if ("property.landscape.texture1.tilex" == forKey || "property.landscape.texture1.tiley" == forKey) { LandscapeNode *landscape = GetLandscape(); if (landscape) { Vector2 tiling(propertyList->GetFloatPropertyValue("property.landscape.texture1.tilex"), propertyList->GetFloatPropertyValue("property.landscape.texture1.tiley")); landscape->SetTextureTiling(LandscapeNode::TEXTURE_TILE1, tiling); } } if ("property.landscape.texture2.tilex" == forKey || "property.landscape.texture2.tiley" == forKey) { LandscapeNode *landscape = GetLandscape(); if (landscape) { Vector2 tiling(propertyList->GetFloatPropertyValue("property.landscape.texture2.tilex"), propertyList->GetFloatPropertyValue("property.landscape.texture2.tiley")); landscape->SetTextureTiling(LandscapeNode::TEXTURE_TILE2, tiling); } } if ("property.landscape.texture3.tilex" == forKey || "property.landscape.texture3.tiley" == forKey) { LandscapeNode *landscape = GetLandscape(); if (landscape) { Vector2 tiling(propertyList->GetFloatPropertyValue("property.landscape.texture3.tilex"), propertyList->GetFloatPropertyValue("property.landscape.texture3.tiley")); landscape->SetTextureTiling(LandscapeNode::TEXTURE_TILE3, tiling); } } if ("property.material.dencity" == forKey) { LandscapeNode *landscape = GetLandscape(); if (landscape) landscape->SetFogDensity(newValue); } NodesPropertyControl::OnFloatPropertyChanged(forList, forKey, newValue); }