void NodesPropertyControl::WillDisappear()
{
    LodComponent *lodComponent = GetLodComponent(currentSceneNode);
    if(lodComponent)
    {
        lodComponent->SetForceDistance(LodComponent::INVALID_DISTANCE);
    }
    else
    {
        if(propertyList->IsPropertyAvaliable(String("property.lodnode.forcedistance"))
           && propertyList->GetBoolPropertyValue(String("property.lodnode.forcedistance")))
        {
            RestoreChildLodDistances();
        }
        
        for(int32 i = 0; i < (int32)childLodComponents.size(); ++i)
        {
            childLodComponents[i]->SetForceDistance(LodComponent::INVALID_DISTANCE);
        }
        
        ReleaseChildLodData();
    }
    
    SafeRelease(currentSceneNode);
}
void NodesPropertyControl::OnSliderPropertyChanged(PropertyList *, const String &forKey, float32 newValue)
{
    if("property.lodnode.distanceslider" == forKey)
    {
        if(propertyList->GetBoolPropertyValue("property.lodnode.forcedistance"))
        {
            LodComponent *lodComponent = GetLodComponent(currentSceneNode);
            if(lodComponent)
            {
                lodComponent->SetForceDistance(newValue);
            }
            else
            {
                for(int32 i = 0; i < (int32)childLodComponents.size(); ++i)
                {
                    childLodComponents[i]->SetForceDistance(newValue);
                }
            }     
        }
    }

    if(nodesDelegate)
    {
        nodesDelegate->NodesPropertyChanged(forKey);
    }
}
void NodesPropertyControl::OnBoolPropertyChanged(PropertyList *, const String &forKey, bool newValue)
{
    if(currentSceneNode)
    {
        KeyedArchive *customProperties = currentSceneNode->GetCustomProperties();
        
        if(SCENE_NODE_USED_IN_STATIC_LIGHTING_PROPERTY_NAME == forKey)
        {
            customProperties->SetBool("editor.staticlight.used", newValue);
        }
		else if(SCENE_NODE_CAST_SHADOWS_PROPERTY_NAME == forKey)
		{
			customProperties->SetBool("editor.staticlight.castshadows", newValue);
		}
		else if(SCENE_NODE_RECEIVE_SHADOWS_PROPERTY_NAME == forKey)
		{
			customProperties->SetBool("editor.staticlight.receiveshadows", newValue);
		}
        else if("property.lodnode.forcedistance" == forKey)
        {
            float32 forceDistance = (newValue)  ? propertyList->GetSliderPropertyValue("property.lodnode.distanceslider")
                                                : LodComponent::INVALID_DISTANCE;
            
            LodComponent *lodComponent = GetLodComponent(currentSceneNode);
            if(lodComponent)
            {
                lodComponent->SetForceDistance(forceDistance);
            }
            else 
            {
                if(newValue)    SetChildLodDistances();
                else            RestoreChildLodDistances();
                    
                for(int32 i = 0; i < (int32)childLodComponents.size(); ++i)
                {
                    childLodComponents[i]->SetForceDistance(forceDistance);
                }
            }
        }
// 		else if("CollisionFlag" == forKey)
// 		{
// 			currentSceneNode->PropagateBoolProperty("CollisionFlag", newValue);
// 		}
        
        if(!createNodeProperties)
        {
            KeyedArchive *customProperties = currentSceneNode->GetCustomProperties();
            if (forKey == SCENE_NODE_IS_VISIBLE_PROPERTY_NAME)
            {
                currentSceneNode->SetVisible(newValue);
            }
            
            if(customProperties->IsKeyExists(forKey))
            {
                customProperties->SetBool(forKey, newValue);
            }
        }
        else
        {
            KeyedArchive *customProperties = currentSceneNode->GetCustomProperties();
            if(customProperties->IsKeyExists(forKey))
            {
                customProperties->SetBool(forKey, newValue);
            }
        }
    }

    
    if(nodesDelegate)
    {
        nodesDelegate->NodesPropertyChanged(forKey);
    }
}