コード例 #1
0
void RenderUpdateSystem::UpdateActiveIndexes(Entity *entity, RenderObject *object)
{
    Entity *parent;
    
    // search effective lod index
    parent = entity;
    while(NULL != parent)
    {
        LodComponent *lc = GetLodComponent(parent);
        if(NULL != lc)
        {
            object->SetLodIndex(lc->currentLod);
            break;
        }

        parent = parent->GetParent();
    }

    // search effective switch index
    parent = entity;
    while(NULL != parent)
    {
        SwitchComponent *sc = GetSwitchComponent(parent);
        if(NULL != sc)
        {
            object->SetSwitchIndex(sc->GetSwitchIndex());
            break;
        }

        parent = parent->GetParent();
    }
}
コード例 #2
0
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);
}
コード例 #3
0
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);
    }
}
コード例 #4
0
void EditorScene::SetForceLodLayerRecursive(Entity *node, int32 layer)
{
    LodComponent *lc = GetLodComponent(node);
    if(lc)
    {
        lc->SetForceLodLayer(layer);
    }
    
    int32 count = node->GetChildrenCount();
    for(int32 i = 0; i < count; ++i)
    {
        SetForceLodLayerRecursive(node->GetChild(i), layer);
    }
}
コード例 #5
0
void LodSystem::LodMerger::MergeChildLods()
{
	LodComponent * toLod = (LodComponent*)toEntity->GetOrCreateComponent(Component::LOD_COMPONENT);
	

	Vector<SceneNode*> allLods;
	GetLodComponentsRecursive(toEntity, allLods);

	uint32 count = allLods.size();
	for(uint32 i = 0; i < count; ++i)
	{
		LodComponent * fromLod = GetLodComponent(allLods[i]);
		int32 fromLodsCount = fromLod->GetMaxLodLayer();
		for(int32 l = 0; l < fromLodsCount; ++l)
		{
			LodComponent::LodData & fromData = fromLod->lodLayers[l];
			int32 lodLayerIndex = fromData.layer;

			LodComponent::LodData * toData = 0;

			int32 maxLod = toLod->GetMaxLodLayer();
			//create loddata if needed
			if(lodLayerIndex > maxLod)
			{
				DVASSERT(maxLod == lodLayerIndex-1);

				toLod->lodLayers.push_back(fromData);
				toData = &(toLod->lodLayers[lodLayerIndex]);
				toData->nodes.clear();
				toData->indexes.clear(); //indeces will not have any sense after lod merge

				toLod->lodLayersArray = fromLod->lodLayersArray;
			}
			else
			{
				toData = &(toLod->lodLayers[lodLayerIndex]);
			}

			uint32 nodesToCopy = fromData.nodes.size();
			for(uint32 j = 0; j < nodesToCopy; ++j)
			{
				toData->nodes.push_back(fromData.nodes[j]); 
			}
		}

		allLods[i]->RemoveComponent(Component::LOD_COMPONENT);
	}
}
コード例 #6
0
void SceneValidator::ValidateParticleEmitterComponent(DAVA::Entity *ownerNode, Set<String> &errorsLog)
{
	ParticleEmitter * emitter = GetEmitter(ownerNode);
    if(!emitter)
	{
		return;
	}

	if (GetLodComponent(ownerNode) == NULL)
	{
		ownerNode->AddComponent(ScopedPtr<LodComponent> (new LodComponent()));		
	}

	ValidateParticleEmitter(emitter, errorsLog);
	
}
コード例 #7
0
int32 EditorScene::GetForceLodLayer(Entity *node)
{
    if(!node)   return -1;

    LodComponent *lc = GetLodComponent(node);
    if(lc)
        return lc->GetForceLodLayer();
    
    int32 count = node->GetChildrenCount();
    for(int32 i = 0; i < count; ++i)
    {
        int32 layer = GetForceLodLayer(node->GetChild(i));
        if(-1 != layer)
            return layer;
    }
    
    return -1;
}
コード例 #8
0
void EditorScene::SetForceLodLayer(Entity *node, int32 layer)
{
    if(!node)   return;
    
    Entity *n = node;
    
    do {
        LodComponent *lc = GetLodComponent(n);
        if(lc)
        {
            lc->SetForceLodLayer(layer);
        }
        
        n = n->GetParent();
    } while (n);
    
    SetForceLodLayerRecursive(node, layer);
}
コード例 #9
0
void LodNodePropertyControl::ReadFrom(Entity * sceneNode)
{
	NodesPropertyControl::ReadFrom(sceneNode);

    LodComponent *lodComponent = GetLodComponent(sceneNode);
	DVASSERT(lodComponent);

    propertyList->AddSection("property.lodnode", GetHeaderState("property.lodnode", true));
    
    propertyList->AddBoolProperty("property.lodnode.forcedistance");
    propertyList->SetBoolPropertyValue("property.lodnode.forcedistance", false);
    propertyList->AddSliderProperty("property.lodnode.distanceslider", false);
    propertyList->SetSliderPropertyValue("property.lodnode.distanceslider", 0, LodComponent::MAX_LOD_DISTANCE, LodComponent::MIN_LOD_DISTANCE);

    int32 lodCount = lodComponent->GetLodLayersCount();
    if(1 < lodCount)
    {
        propertyList->AddDistanceProperty("property.lodnode.distances");
        float32 *distances = new float32[lodComponent->GetLodLayersCount()];
        int32 *triangles = new int32[lodComponent->GetLodLayersCount()];
        
        
        Vector<LodComponent::LodData*> lodLayers;
        lodComponent->GetLodData(lodLayers);
        
        Vector<LodComponent::LodData*>::const_iterator lodLayerIt = lodLayers.begin();
        for(int32 i = 0; i < lodComponent->GetLodLayersCount(); ++i)
        {
            distances[i] = lodComponent->GetLodLayerDistance(i);
            
            LodComponent::LodData *layer = *lodLayerIt;
            triangles[i] = GetTrianglesForLodLayer(layer);

            ++lodLayerIt;
        }
        
        propertyList->SetDistancePropertyValue("property.lodnode.distances", distances, triangles, lodComponent->GetLodLayersCount());
        
        
        SafeDeleteArray(distances);
        SafeDeleteArray(triangles);
    }
}
コード例 #10
0
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()));
        }
    }
}
コード例 #11
0
void LodSystem::LodMerger::GetLodComponentsRecursive(SceneNode * fromEntity, Vector<SceneNode*> & allLods)
{
	if(fromEntity != toEntity)
	{
		LodComponent * lod = GetLodComponent(fromEntity);
		if(lod)
		{
			if(lod->flags & LodComponent::NEED_UPDATE_AFTER_LOAD)
			{
				LodSystem::UpdateEntityAfterLoad(fromEntity);
				lod->flags &= ~LodComponent::NEED_UPDATE_AFTER_LOAD;
			}

			allLods.push_back(fromEntity);
		}
	}
	int32 count = fromEntity->GetChildrenCount();
	for(int32 i = 0; i < count; ++i)
	{
		GetLodComponentsRecursive(fromEntity->GetChild(i), allLods);
	}
}
コード例 #12
0
QIcon SceneTreeItemEntity::ItemIcon() const
{
	static QIcon effectIcon(":/QtIcons/effect.png");
	static QIcon emitterIcon(":/QtIcons/emitter_particle.png");
	static QIcon renderobjIcon(":/QtIcons/render_object.png");
	static QIcon lodobjIcon(":/QtIcons/lod_object.png");
	static QIcon userobjIcon(":/QtIcons/user_object.png");
	static QIcon landscapeIcon(":/QtIcons/heightmapeditor.png");
	static QIcon cameraIcon(":/QtIcons/camera.png");
	static QIcon lightIcon(":/QtIcons/light.png");
	static QIcon shadowIcon(":/QtIcons/shadow.png");
	static QIcon switchIcon(":/QtIcons/switch.png");

	QIcon ret;

	if(NULL != entity)
	{
		if(NULL != DAVA::GetEmitter(entity))
		{
			ret = emitterIcon;
		}
		else if(NULL != DAVA::GetEffectComponent(entity))
		{
			ret = effectIcon;
		}
		else if(NULL != DAVA::GetLandscape(entity))
		{
			ret = landscapeIcon;
		}
		else if(NULL != GetLodComponent(entity))
		{
			ret = lodobjIcon;
		}
		else if(NULL != GetSwitchComponent(entity))
		{
			ret = switchIcon;
		}
		else if(NULL != DAVA::GetRenderObject(entity))
		{
			if(ConvertToShadowCommand::IsEntityWithShadowVolume(entity))
			{
				ret = shadowIcon;
			}
			else
			{
				ret = renderobjIcon;
			}
		}
		else if(NULL != entity->GetComponent(DAVA::Component::USER_COMPONENT))
		{
			ret = userobjIcon;
		}
		else if(NULL != DAVA::GetCamera(entity))
		{
			ret = cameraIcon;
		}
		else if(NULL != DAVA::GetLight(entity))
		{
			ret = lightIcon;
		}
	}

	if(ret.isNull())
	{
		ret = SceneTreeItem::ItemIcon();
	}

	return ret;
}
コード例 #13
0
bool SwitchToRenerObjectConverter::MergeSwitch(Entity * entity)
{
    Vector<Entity*> entitiesToRemove;

    SwitchComponent * sw = GetSwitchComponent(entity);
    if(sw)
    {
        RenderComponent * rc = GetRenderComponent(entity);
        RenderObject * ro = 0;
        if(!rc)
        {
            ro = new Mesh();
            rc = new RenderComponent(ro);
            ro->Release();

            ro->SetAABBox(AABBox3(Vector3(0, 0, 0), Vector3(0, 0, 0)));
            entity->AddComponent(rc);
        }
        else
        {
            ro = rc->GetRenderObject();
        }

        DVASSERT(ro);

        int32 size = entity->GetChildrenCount();
        for(int32 i = 0; i < size; ++i)
        {
            Entity * sourceEntity = entity->GetChild(i);
            RenderObject * sourceRenderObject = GetRenderObject(sourceEntity);

            //workaround for custom properties for crashed model
            if(1 == i) // crash model
            {
                KeyedArchive *childProps = GetCustomPropertiesArchieve(sourceEntity);
                if(childProps && childProps->IsKeyExists("CollisionType"))
                {
                    KeyedArchive *entityProps = GetOrCreateCustomProperties(entity)->GetArchive();
                    entityProps->SetInt32("CollisionTypeCrashed", childProps->GetInt32("CollisionType", 0));
                }
            }
            //end of custom properties

            Vector<std::pair<Entity*, RenderObject*> > renderPairs;
            if(sourceRenderObject)
            {
                renderPairs.push_back(std::make_pair(sourceEntity, sourceRenderObject));
            }
            else
            {
                FindRenderObjectsRecursive(sourceEntity, renderPairs);
                DVASSERT(renderPairs.size() == 1);
                sourceRenderObject = renderPairs[0].second;
            }

            if(sourceRenderObject)
            {
                TransformComponent * sourceTransform = GetTransformComponent(sourceEntity);
                if (sourceTransform->GetLocalTransform() != Matrix4::IDENTITY)
                {
                    PolygonGroup * pg = sourceRenderObject->GetRenderBatchCount() > 0 ? sourceRenderObject->GetRenderBatch(0)->GetPolygonGroup() : 0;
                    if(pg && bakedPolygonGroups.end() == bakedPolygonGroups.find(pg))
                    {
                        sourceRenderObject->BakeGeometry(sourceTransform->GetLocalTransform());
                        bakedPolygonGroups.insert(pg);
                    }
                }

                uint32 sourceSize = sourceRenderObject->GetRenderBatchCount();
                while(sourceSize)
                {
                    int32 lodIndex, switchIndex;
                    RenderBatch * sourceRenderBatch = sourceRenderObject->GetRenderBatch(0, lodIndex, switchIndex);
                    sourceRenderBatch->Retain();
                    sourceRenderObject->RemoveRenderBatch(sourceRenderBatch);
                    ro->AddRenderBatch(sourceRenderBatch, lodIndex, i);
                    sourceRenderBatch->Release();
                    sourceSize--;
                }
            }

            renderPairs[0].first->RemoveComponent(Component::RENDER_COMPONENT);

            LodComponent * lc = GetLodComponent(sourceEntity);
            if((0 != lc) && (0 == GetLodComponent(entity)))
            {
                LodComponent * newLod = (LodComponent*)lc->Clone(entity);
                entity->AddComponent(newLod);
            }

            renderPairs[0].first->RemoveComponent(Component::LOD_COMPONENT);

            if(sourceEntity->GetChildrenCount() == 0)
            {
                entitiesToRemove.push_back(sourceEntity);
            }
        }
    }

    uint32 entitiesToRemoveCount = entitiesToRemove.size();
    for(uint32 i = 0; i < entitiesToRemoveCount; ++i)
    {
        entitiesToRemove[i]->GetParent()->RemoveNode(entitiesToRemove[i]);
    }

    return false;
}
コード例 #14
0
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);
    }
}
コード例 #15
0
void NodesPropertyControl::AddChildLodSection()
{
    DVASSERT(0 == childLodComponents.size());
    DVASSERT(0 == childDistances.size());
    
    Vector<Entity *>nodes;
    currentSceneNode->GetChildNodes(nodes);
    nodes.push_back(currentSceneNode);
    for(int32 i = 0; i < (int32)nodes.size(); ++i)
    {
        LodComponent *lodComponent = GetLodComponent(nodes[i]);
        if(lodComponent)
        {
            childLodComponents.push_back(lodComponent);
        }
    }
    
    if(0 < childLodComponents.size())
    {
        propertyList->AddSection("LODs at hierarchy", GetHeaderState("LODs at hierarchy", true));
        
        propertyList->AddBoolProperty("property.lodnode.forcedistance");
        propertyList->SetBoolPropertyValue("property.lodnode.forcedistance", false);
        propertyList->AddSliderProperty("property.lodnode.distanceslider", false);
        propertyList->SetSliderPropertyValue("property.lodnode.distanceslider", 0, 
                                             LodComponent::MAX_LOD_DISTANCE, LodComponent::MIN_LOD_DISTANCE);
        
        
        
        struct LodInfo
        {
            float32 distance;
            int32 triangles;
            int32 count;
            
            LodInfo()
            {
                count = 0;
                distance = 0.0f;
                triangles = 0;
            }
            
        }lodInfo[LodComponent::MAX_LOD_LAYERS];
        
        for(int32 i = 0; i < (int32)childLodComponents.size(); ++i)
        {
            float32 *distances = new float32[LodComponent::MAX_LOD_LAYERS];
            
            
            Vector<LodComponent::LodData*> lodLayers;
            childLodComponents[i]->GetLodData(lodLayers);
            Vector<LodComponent::LodData*>::const_iterator lodLayerIt = lodLayers.begin();
            
            int32 iLod = 0;
            for(; iLod < childLodComponents[i]->GetLodLayersCount(); ++iLod)
            {
                //TODO: calculate triangles
                LodComponent::LodData *layer = *lodLayerIt;
                lodInfo[iLod].triangles += GetTrianglesForLodLayer(layer);
                ++lodLayerIt;

                distances[iLod] = childLodComponents[i]->GetLodLayerDistance(iLod);
                
                lodInfo[iLod].distance += childLodComponents[i]->GetLodLayerDistance(iLod);
                lodInfo[iLod].count++;
            }
            
            for(; iLod < LodComponent::MAX_LOD_LAYERS; ++iLod)
            {
                distances[iLod] = 0.0f;
            }
            
            childDistances.push_back(distances);
        }
        
        propertyList->AddDistanceProperty("property.lodnode.distances");
        float32 *distances = new float32[LodComponent::MAX_LOD_LAYERS];
        int32 *triangles = new int32[LodComponent::MAX_LOD_LAYERS];
        int32 count = 0;
        for(int32 iLod = 0; iLod < LodComponent::MAX_LOD_LAYERS; ++iLod)
        {
            if(lodInfo[iLod].count)
            {
                triangles[iLod] = lodInfo[iLod].triangles;
                distances[iLod] = lodInfo[iLod].distance / lodInfo[iLod].count;
                count = iLod + 1;
            }
            else 
            {
                distances[iLod] = 0.0f;
                triangles[iLod] = 0;
            }
            
        }
        
        propertyList->SetDistancePropertyValue("property.lodnode.distances", distances, triangles, count);
        SafeDeleteArray(distances);
        SafeDeleteArray(triangles);
        
        propertyList->AddMessageProperty("Set Distances", 
                                         Message(this, &NodesPropertyControl::OnSetDistancesForLodNodes));
    }
}
コード例 #16
0
void NodesPropertyControl::ReadFrom(Entity *sceneNode)
{
	SafeRelease(currentSceneNode);
    currentSceneNode = SafeRetain(sceneNode);
    currentDataNode = NULL;
    ReleaseChildLodData();
    
    propertyList->ReleaseProperties();
    
    if(!createNodeProperties)
    {
        propertyList->AddSection("property.scenenode.generalc++", GetHeaderState("property.scenenode.generalc++", true));
        propertyList->AddIntProperty("property.scenenode.retaincount", PropertyList::PROPERTY_IS_READ_ONLY);
        propertyList->AddStringProperty("property.scenenode.classname", PropertyList::PROPERTY_IS_READ_ONLY);
        propertyList->AddStringProperty("property.scenenode.c++classname", PropertyList::PROPERTY_IS_READ_ONLY);
        propertyList->AddStringProperty("property.scenenode.ptr", PropertyList::PROPERTY_IS_READ_ONLY);
        
//        for (uint32 k = 0; k < Component::COMPONENT_COUNT; ++k)
//        {
//            propertyList->AddStringProperty(Format("Component:%s", sceneNode->components sa M.  zz))
//        }
        
        
        
        propertyList->SetIntPropertyValue("property.scenenode.retaincount", sceneNode->GetRetainCount());
        propertyList->SetStringPropertyValue("property.scenenode.classname", sceneNode->GetClassName());
        propertyList->SetStringPropertyValue("property.scenenode.c++classname", typeid(*sceneNode).name());
        propertyList->SetStringPropertyValue("property.scenenode.ptr", Format("%p", sceneNode));
        
        AABBox3 unitBox = sceneNode->GetWTMaximumBoundingBoxSlow();
        if((-AABBOX_INFINITY != unitBox.max.x) && (AABBOX_INFINITY != unitBox.min.x))
        {
            propertyList->AddSubsection(String("Unit size"));

            Vector3 size = unitBox.max - unitBox.min;
            
            propertyList->AddFloatProperty(String("X-Size"), PropertyList::PROPERTY_IS_READ_ONLY);
            propertyList->SetFloatPropertyValue(String("X-Size"), size.x);
            
            propertyList->AddFloatProperty(String("Y-Size"), PropertyList::PROPERTY_IS_READ_ONLY);
            propertyList->SetFloatPropertyValue(String("Y-Size"), size.y);

            propertyList->AddFloatProperty(String("Z-Size"), PropertyList::PROPERTY_IS_READ_ONLY);
            propertyList->SetFloatPropertyValue(String("Z-Size"), size.z);
            
        }
    }

    propertyList->AddSection("property.scenenode.scenenode", GetHeaderState("property.scenenode.scenenode", true));
    propertyList->AddStringProperty(SCENE_NODE_NAME_PROPERTY_NAME, PropertyList::PROPERTY_IS_EDITABLE);
    propertyList->SetStringPropertyValue(SCENE_NODE_NAME_PROPERTY_NAME, sceneNode->GetName());

    if(!createNodeProperties)
    {
        propertyList->AddBoolProperty(SCENE_NODE_IS_VISIBLE_PROPERTY_NAME, PropertyList::PROPERTY_IS_EDITABLE);
		propertyList->SetBoolPropertyValue(SCENE_NODE_IS_VISIBLE_PROPERTY_NAME, sceneNode->GetVisible());
		
        propertyList->AddSection("property.scenenode.matrixes", GetHeaderState("property.scenenode.matrixes", false));
        propertyList->AddMatrix4Property("property.scenenode.localmatrix", PropertyList::PROPERTY_IS_EDITABLE);
        propertyList->AddMatrix4Property("property.scenenode.worldmatrix", PropertyList::PROPERTY_IS_READ_ONLY);

        propertyList->SetMatrix4PropertyValue("property.scenenode.localmatrix", sceneNode->GetLocalTransform());
        propertyList->SetMatrix4PropertyValue("property.scenenode.worldmatrix", sceneNode->GetWorldTransform());
    }

    
	{ //static light
		 propertyList->AddSection("Used in static lighting", GetHeaderState("Used in static lighting", true));

		 propertyList->AddBoolProperty(SCENE_NODE_USED_IN_STATIC_LIGHTING_PROPERTY_NAME);
		 propertyList->SetBoolPropertyValue(SCENE_NODE_USED_IN_STATIC_LIGHTING_PROPERTY_NAME, sceneNode->GetCustomProperties()->GetBool("editor.staticlight.used", true));

		 propertyList->AddBoolProperty(SCENE_NODE_CAST_SHADOWS_PROPERTY_NAME);
		 propertyList->SetBoolPropertyValue(SCENE_NODE_CAST_SHADOWS_PROPERTY_NAME, sceneNode->GetCustomProperties()->GetBool("editor.staticlight.castshadows", true));

		 propertyList->AddBoolProperty(SCENE_NODE_RECEIVE_SHADOWS_PROPERTY_NAME);
		 propertyList->SetBoolPropertyValue(SCENE_NODE_RECEIVE_SHADOWS_PROPERTY_NAME, sceneNode->GetCustomProperties()->GetBool("editor.staticlight.receiveshadows", true));
	}
    
    
    { // LodNodes at Hierarchy
        LodComponent *lodComponent = GetLodComponent(currentSceneNode);
        if(!lodComponent)
        {
            AddChildLodSection();
        }        
    }
    
    
    //must be last
    if(!createNodeProperties)
    {
        propertyList->AddSection("property.scenenode.customproperties", GetHeaderState("property.scenenode.customproperties", true));
        
        KeyedArchive *customProperties = sceneNode->GetCustomProperties();
        Map<String, VariantType*> propsData = customProperties->GetArchieveData();
        for (Map<String, VariantType*>::iterator it = propsData.begin(); it != propsData.end(); ++it)
        {
            String name = it->first;
            VariantType * key = it->second;

			if(EditorConfig::Instance()->HasProperty(name))
			{
				EditorConfig::Instance()->AddPropertyEditor(propertyList, name, key);
			}
			else
			{
				switch (key->type) 
				{
					case VariantType::TYPE_BOOLEAN:
						propertyList->AddBoolProperty(name, PropertyList::PROPERTY_IS_EDITABLE);
						propertyList->SetBoolPropertyValue(name, key->AsBool());
						break;
                    
					case VariantType::TYPE_STRING:
						propertyList->AddStringProperty(name, PropertyList::PROPERTY_IS_EDITABLE);
						propertyList->SetStringPropertyValue(name, key->AsString());
						break;

					case VariantType::TYPE_INT32:
						propertyList->AddIntProperty(name, PropertyList::PROPERTY_IS_EDITABLE);
						propertyList->SetIntPropertyValue(name, key->AsInt32());
						break;

					case VariantType::TYPE_FLOAT:
						propertyList->AddFloatProperty(name, PropertyList::PROPERTY_IS_EDITABLE);
						propertyList->SetFloatPropertyValue(name, key->AsFloat());
						break;
                    
					default:
						break;
				}
			}
        }
    }
    else
    {
        KeyedArchive *customProperties = sceneNode->GetCustomProperties();
        if(customProperties && customProperties->IsKeyExists("editor.isLocked"))
        {
            propertyList->AddSection("property.scenenode.customproperties", GetHeaderState("property.scenenode.customproperties", true));
            propertyList->AddBoolProperty("editor.isLocked", PropertyList::PROPERTY_IS_EDITABLE);
            propertyList->SetBoolPropertyValue("editor.isLocked", customProperties->GetBool("editor.isLocked"));
        }
    }
}