void NodesPropertyControl::OnDistancePropertyChanged(PropertyList *, const String &forKey, float32 newValue, int32 index) { if("property.lodnode.distances" == forKey) { LodComponent *lodComponent = GetLodComponent(currentSceneNode); if(lodComponent) { lodComponent->SetLodLayerDistance(index, newValue); } else { if(propertyList->GetBoolPropertyValue("property.lodnode.forcedistance")) { for(int32 i = 0; i < (int32)childLodComponents.size(); ++i) { if(index < childLodComponents[i]->GetLodLayersCount()) { childLodComponents[i]->SetLodLayerDistance(index, newValue); } } } } } if(nodesDelegate) { nodesDelegate->NodesPropertyChanged(forKey); } }
void SceneValidator::ValidateLodComponent(Entity *ownerNode, Set<String> &errorsLog) { LodComponent *lodComponent = GetLodComponent(ownerNode); if(!lodComponent) return; int32 layersCount = lodComponent->GetLodLayersCount(); if (GetEmitter(ownerNode)) layersCount = LodComponent::MAX_LOD_LAYERS; if(layersCount == 0) { errorsLog.insert(Format("Node %s: Count of layers is 0", ownerNode->GetName().c_str())); } for(int32 layer = 0; layer < layersCount; ++layer) { float32 distance = lodComponent->GetLodLayerDistance(layer); if(LodComponent::INVALID_DISTANCE == distance) { //TODO: why this function isn't realized for lodcomponent? lodComponent->SetLodLayerDistance(layer, LodComponent::GetDefaultDistance(layer)); errorsLog.insert(Format("Node %s: lod distances weren't correct. Re-save.", ownerNode->GetName().c_str())); } } Vector<LodComponent::LodData *>lodLayers; lodComponent->GetLodData(lodLayers); Vector<LodComponent::LodData *>::const_iterator endIt = lodLayers.end(); int32 layer = 0; for(Vector<LodComponent::LodData *>::iterator it = lodLayers.begin(); it != endIt; ++it, ++layer) { LodComponent::LodData * ld = *it; if(ld->layer != layer) { ld->layer = layer; errorsLog.insert(Format("Node %s: lod layers weren't correct. Rename childs. Re-save.", ownerNode->GetName().c_str())); } } }