void LodNodePropertyControl::ReadFrom(SceneNode * sceneNode) { NodesPropertyControl::ReadFrom(sceneNode); LodNode *lodNode = dynamic_cast<LodNode*> (sceneNode); DVASSERT(lodNode); 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, LodNode::MAX_LOD_DISTANCE, LodNode::MIN_LOD_DISTANCE); int32 lodCount = lodNode->GetLodLayersCount(); if(1 < lodCount) { propertyList->AddDistanceProperty("property.lodnode.distances"); float32 *distances = new float32[lodNode->GetLodLayersCount()]; for(int32 i = 0; i < lodNode->GetLodLayersCount(); ++i) { distances[i] = lodNode->GetLodLayerDistance(i); } propertyList->SetDistancePropertyValue("property.lodnode.distances", distances, lodNode->GetLodLayersCount()); SafeDeleteArray(distances); } }
void NodesPropertyControl::ReadFrom(DataNode *dataNode) { currentSceneNode = NULL; currentDataNode = dataNode; 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->SetIntPropertyValue("property.scenenode.retaincount", dataNode->GetRetainCount()); propertyList->SetStringPropertyValue("property.scenenode.classname", dataNode->GetClassName()); propertyList->SetStringPropertyValue("property.scenenode.c++classname", typeid(*dataNode).name()); } }
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); } }
void CameraPropertyControl::ReadFrom(Entity * sceneNode) { NodesPropertyControl::ReadFrom(sceneNode); Camera *camera = GetCamera(sceneNode); DVASSERT(camera); propertyList->AddSection("property.camera.camera", GetHeaderState("property.camera.camera", true)); propertyList->AddFloatProperty("property.camera.fov", PropertyList::PROPERTY_IS_EDITABLE); propertyList->AddFloatProperty("property.camera.znear", PropertyList::PROPERTY_IS_EDITABLE); propertyList->AddFloatProperty("property.camera.zfar", PropertyList::PROPERTY_IS_EDITABLE); propertyList->AddBoolProperty("property.camera.isortho", PropertyList::PROPERTY_IS_EDITABLE); propertyList->AddFloatProperty("property.camera.position.x", PropertyList::PROPERTY_IS_EDITABLE); propertyList->AddFloatProperty("property.camera.position.y", PropertyList::PROPERTY_IS_EDITABLE); propertyList->AddFloatProperty("property.camera.position.z", PropertyList::PROPERTY_IS_EDITABLE); propertyList->AddFloatProperty("property.camera.target.x", PropertyList::PROPERTY_IS_EDITABLE); propertyList->AddFloatProperty("property.camera.target.y", PropertyList::PROPERTY_IS_EDITABLE); propertyList->AddFloatProperty("property.camera.target.z", PropertyList::PROPERTY_IS_EDITABLE); propertyList->SetFloatPropertyValue("property.camera.fov", camera->GetFOV()); propertyList->SetFloatPropertyValue("property.camera.znear", camera->GetZNear()); propertyList->SetFloatPropertyValue("property.camera.zfar", camera->GetZFar()); propertyList->SetBoolPropertyValue("property.camera.isortho", camera->GetIsOrtho()); Vector3 pos = camera->GetPosition(); propertyList->SetFloatPropertyValue("property.camera.position.x", pos.x); propertyList->SetFloatPropertyValue("property.camera.position.y", pos.y); propertyList->SetFloatPropertyValue("property.camera.position.z", pos.z); Vector3 target = camera->GetTarget(); propertyList->SetFloatPropertyValue("property.camera.target.x", target.x); propertyList->SetFloatPropertyValue("property.camera.target.y", target.y); propertyList->SetFloatPropertyValue("property.camera.target.z", target.z); }
void LightPropertyControl::ReadFrom(Entity * sceneNode) { NodesPropertyControl::ReadFrom(sceneNode); Light *light = GetLight(sceneNode); DVASSERT(light); propertyList->AddSection("property.lightnode.light", GetHeaderState("property.lightnode.light", true)); propertyList->AddComboProperty("property.lightnode.type", types); propertyList->SetComboPropertyIndex("property.lightnode.type", light->GetType()); propertyList->AddColorProperty("property.lightnode.ambient.color"); propertyList->SetColorPropertyValue("property.lightnode.ambient.color", light->GetAmbientColor()); propertyList->AddColorProperty("property.lightnode.diffuse.color"); propertyList->SetColorPropertyValue("property.lightnode.diffuse.color", light->GetDiffuseColor()); propertyList->AddColorProperty("property.lightnode.specular.color"); propertyList->SetColorPropertyValue("property.lightnode.specular.color", light->GetSpecularColor()); propertyList->AddFloatProperty("property.lightnode.intensity"); propertyList->SetFloatPropertyValue("property.lightnode.intensity", light->GetIntensity()); //propertyList->AddFloatProperty("property.lightnode.material.shininess", light->GetShininess()) propertyList->AddSection("property.lightnode.staticlight", GetHeaderState("property.lightnode.staticlight", true)); propertyList->AddBoolProperty("property.staticlight.enable"); propertyList->SetBoolPropertyValue("property.staticlight.enable", sceneNode->GetCustomProperties()->GetBool("editor.staticlight.enable", true)); propertyList->AddBoolProperty("Cast shadows"); propertyList->SetBoolPropertyValue("Cast shadows", sceneNode->GetCustomProperties()->GetBool("editor.staticlight.castshadows", true)); propertyList->AddFloatProperty("Intensity"); propertyList->SetFloatPropertyValue("Intensity", sceneNode->GetCustomProperties()->GetFloat("editor.intensity", 1.f)); propertyList->AddFloatProperty("Falloff cutoff"); propertyList->SetFloatPropertyValue("Falloff cutoff", sceneNode->GetCustomProperties()->GetFloat("editor.staticlight.falloffcutoff", 1000.f)); propertyList->AddFloatProperty("Falloff exponent"); propertyList->SetFloatPropertyValue("Falloff exponent", sceneNode->GetCustomProperties()->GetFloat("editor.staticlight.falloffexponent", 1.f)); if(Light::TYPE_DIRECTIONAL == light->GetType()) { propertyList->AddFloatProperty("Shadow angle"); propertyList->SetFloatPropertyValue("Shadow angle", sceneNode->GetCustomProperties()->GetFloat("editor.staticlight.shadowangle", 0.f)); propertyList->AddIntProperty("Shadow samples"); propertyList->SetIntPropertyValue("Shadow samples", sceneNode->GetCustomProperties()->GetInt32("editor.staticlight.shadowsamples", 1)); } else if(Light::TYPE_POINT == light->GetType()) { propertyList->AddFloatProperty("Shadow radius"); propertyList->SetFloatPropertyValue("Shadow radius", sceneNode->GetCustomProperties()->GetFloat("editor.staticlight.shadowradius", 0.f)); } propertyList->AddSection("property.lightnode.dynamiclight", GetHeaderState("property.lightnode.dynamiclight", true)); propertyList->AddBoolProperty("property.dynamiclight.enable"); propertyList->SetBoolPropertyValue("property.dynamiclight.enable", sceneNode->GetCustomProperties()->GetBool("editor.dynamiclight.enable", true)); }
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)); } }
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")); } } }
void MeshInstancePropertyControl::ReadFrom(Entity * sceneNode) { NodesPropertyControl::ReadFrom(sceneNode); MeshInstanceNode *mesh = dynamic_cast<MeshInstanceNode *> (sceneNode); DVASSERT(mesh); propertyList->AddSection("property.meshinstance.meshinstance", GetHeaderState("property.meshinstance.meshinstance", true)); //BBOX AABBox3 bbox = mesh->GetBoundingBox(); AABBox3 transformedBox; bbox.GetTransformedBox(mesh->GetWorldTransform(), transformedBox); propertyList->AddStringProperty("property.meshinstance.bboxmin", PropertyList::PROPERTY_IS_READ_ONLY); propertyList->AddStringProperty("property.meshinstance.bboxmax", PropertyList::PROPERTY_IS_READ_ONLY); propertyList->SetStringPropertyValue("property.meshinstance.bboxmin", Format("%0.2f, %0.2f, %0.2f", transformedBox.min.x, transformedBox.min.y, transformedBox.min.z)); propertyList->SetStringPropertyValue("property.meshinstance.bboxmax", Format("%0.2f, %0.2f, %0.2f", transformedBox.max.x, transformedBox.max.y, transformedBox.max.z)); materials.clear(); materialNames.clear(); if(workingScene) { workingScene->GetDataNodes(materials); } int32 matCount = (int32)materials.size(); for(int32 i = 0; i < matCount; ++i) { Material *mat = materials[i]; materialNames.push_back(mat->GetName()); } Vector<PolygonGroupWithMaterial*> polygroups = mesh->GetPolygonGroups(); for(int32 i = 0; i < (int32)polygroups.size(); ++i) { PolygonGroup *pg = polygroups[i]->GetPolygonGroup(); String fieldName = Format("PolygonGroup #%d", i); propertyList->AddSection(fieldName, GetHeaderState(fieldName, true)); int32 vertexFormat = pg->GetFormat(); String keyPrefix = Format("#%d", i); propertyList->AddBoolProperty(keyPrefix + ". fmt.NORMAL", PropertyList::PROPERTY_IS_EDITABLE); propertyList->SetBoolPropertyValue(keyPrefix + ". fmt.NORMAL", 0 != (vertexFormat & EVF_NORMAL)); propertyList->AddBoolProperty(keyPrefix + ". fmt.COLOR", PropertyList::PROPERTY_IS_EDITABLE); propertyList->SetBoolPropertyValue(keyPrefix + ". fmt.COLOR", 0 != (vertexFormat & EVF_COLOR)); propertyList->AddBoolProperty(keyPrefix + ". fmt.TEXCOORD0", PropertyList::PROPERTY_IS_EDITABLE); propertyList->SetBoolPropertyValue(keyPrefix + ". fmt.TEXCOORD0", 0 != (vertexFormat & EVF_TEXCOORD0)); propertyList->AddBoolProperty(keyPrefix + ". fmt.TEXCOORD1", PropertyList::PROPERTY_IS_EDITABLE); propertyList->SetBoolPropertyValue(keyPrefix + ". fmt.TEXCOORD1", 0 != (vertexFormat & EVF_TEXCOORD1)); propertyList->AddBoolProperty(keyPrefix + ". fmt.TEXCOORD2", PropertyList::PROPERTY_IS_EDITABLE); propertyList->SetBoolPropertyValue(keyPrefix + ". fmt.TEXCOORD2", 0 != (vertexFormat & EVF_TEXCOORD2)); propertyList->AddBoolProperty(keyPrefix + ". fmt.TEXCOORD3", PropertyList::PROPERTY_IS_EDITABLE); propertyList->SetBoolPropertyValue(keyPrefix + ". fmt.TEXCOORD3", 0 != (vertexFormat & EVF_TEXCOORD3)); propertyList->AddBoolProperty(keyPrefix + ". fmt.TANGENT", PropertyList::PROPERTY_IS_EDITABLE); propertyList->SetBoolPropertyValue(keyPrefix + ". fmt.TANGENT", 0 != (vertexFormat & EVF_TANGENT)); propertyList->AddBoolProperty(keyPrefix + ". fmt.BINORMAL", PropertyList::PROPERTY_IS_EDITABLE); propertyList->SetBoolPropertyValue(keyPrefix + ". fmt.BINORMAL", 0 != (vertexFormat & EVF_BINORMAL)); propertyList->AddBoolProperty(keyPrefix + ". fmt.JOINTWEIGHT", PropertyList::PROPERTY_IS_EDITABLE); propertyList->SetBoolPropertyValue(keyPrefix + ". fmt.JOINTWEIGHT", 0 != (vertexFormat & EVF_JOINTWEIGHT)); propertyList->AddIntProperty(keyPrefix + ".lightmap.size"); propertyList->SetIntPropertyValue(keyPrefix + ".lightmap.size", currentSceneNode->GetCustomProperties()->GetInt32(keyPrefix + ".lightmap.size", 128)); if(matCount && !createNodeProperties) { String comboName = keyPrefix + ". Material"; propertyList->AddComboProperty(comboName, materialNames); if(polygroups[i]->GetMaterial()) { String meshMatName = polygroups[i]->GetMaterial()->GetName(); for(int32 iMat = 0; iMat < (int32)materials.size(); ++iMat) { if(meshMatName == materialNames[iMat]) { propertyList->SetComboPropertyIndex(comboName, iMat); break; } } } else { propertyList->SetComboPropertyIndex(comboName, 0); } propertyList->AddMessageProperty("property.meshinstance.editmaterial", Message(this, &MeshInstancePropertyControl::OnGo2Materials, polygroups[i]->GetMaterial())); } propertyList->AddMessageProperty("property.meshinstance.showtriangles", Message(this, &MeshInstancePropertyControl::OnShowTexture, pg)); } propertyList->AddSection("property.meshinstance.dynamicshadow", GetHeaderState("property.meshinstance.dynamicshadow", true)); propertyList->AddBoolProperty("property.meshinstance.dynamicshadow.enable"); propertyList->SetBoolPropertyValue("property.meshinstance.dynamicshadow.enable", currentSceneNode->GetCustomProperties()->GetBool("property.meshinstance.dynamicshadow.enable", false)); propertyList->AddMessageProperty("property.meshinstance.dynamicshadow.converttovolume", Message(this, &MeshInstancePropertyControl::OnConvertToShadowVolume)); }
void LandscapePropertyControl::ReadFrom(SceneNode * sceneNode) { NodesPropertyControl::ReadFrom(sceneNode); LandscapeNode *landscape = dynamic_cast<LandscapeNode*> (sceneNode); DVASSERT(landscape); propertyList->AddSection("property.landscape.landscape", GetHeaderState("property.landscape.landscape", true)); propertyList->AddFloatProperty("property.landscape.size", PropertyList::PROPERTY_IS_EDITABLE); propertyList->AddFloatProperty("property.landscape.height", PropertyList::PROPERTY_IS_EDITABLE); Vector3 size(445.0f, 445.0f, 50.f); AABBox3 bbox = landscape->GetBoundingBox(); AABBox3 emptyBox; if((emptyBox.min != bbox.min) && (emptyBox.max != bbox.max)) { AABBox3 transformedBox; bbox.GetTransformedBox(landscape->GetWorldTransform(), transformedBox); size = transformedBox.max - transformedBox.min; } propertyList->SetFloatPropertyValue("property.landscape.size", size.x); propertyList->SetFloatPropertyValue("property.landscape.height", size.z); propertyList->AddComboProperty("property.landscape.tilemode", tiledModes); propertyList->SetComboPropertyIndex("property.landscape.tilemode", landscape->GetTiledShaderMode()); propertyList->AddFilepathProperty("property.landscape.heightmap", ".png;.heightmap", false, PropertyList::PROPERTY_IS_EDITABLE); propertyList->SetFilepathPropertyValue("property.landscape.heightmap", landscape->GetHeightmapPathname()); propertyList->AddSubsection("property.landscape.subsection.textures"); AddFilepathProperty(String("property.landscape.texture.color"), String(".png;.pvr"), LandscapeNode::TEXTURE_COLOR); AddFilepathProperty(String("property.landscape.texture.tile0"), String(".png;.pvr"), LandscapeNode::TEXTURE_TILE0); AddFilepathProperty(String("property.landscape.texture.tile1"), String(".png;.pvr"), LandscapeNode::TEXTURE_TILE1); AddFilepathProperty(String("property.landscape.texture.tile2"), String(".png;.pvr"), LandscapeNode::TEXTURE_TILE2); AddFilepathProperty(String("property.landscape.texture.tile3"), String(".png;.pvr"), LandscapeNode::TEXTURE_TILE3); AddFilepathProperty(String("property.landscape.texture.tilemask"), String(".png;.pvr"), LandscapeNode::TEXTURE_TILE_MASK); AddFilepathProperty(String("property.landscape.texture.tiledtexture"), String(".png;.pvr"), LandscapeNode::TEXTURE_TILE_FULL); propertyList->AddMessageProperty(String("property.landscape.generatefulltiled"), Message(this, &LandscapePropertyControl::GenerateFullTiledTexture)); propertyList->AddSubsection("property.landscape.subsection.build_mask"); propertyList->AddFilepathProperty("property.landscape.lightmap", String(".png;.pvr"), true, PropertyList::PROPERTY_IS_EDITABLE); propertyList->AddFilepathProperty("property.landscape.alphamask", String(".png;.pvr"), true, PropertyList::PROPERTY_IS_EDITABLE); propertyList->SetFilepathPropertyValue("property.landscape.lightmap", String("")); propertyList->SetFilepathPropertyValue("property.landscape.alphamask", String("")); propertyList->AddBoolProperty("property.landscape.showgrid", PropertyList::PROPERTY_IS_EDITABLE); bool showGrid = (0 != (landscape->GetDebugFlags() & SceneNode::DEBUG_DRAW_GRID)); propertyList->SetBoolPropertyValue("property.landscape.showgrid", showGrid); propertyList->AddIntProperty("lightmap.size"); propertyList->SetIntPropertyValue("lightmap.size", currentSceneNode->GetCustomProperties()->GetInt32("lightmap.size", 1024)); propertyList->AddFloatProperty("property.landscape.texture0.tilex"); propertyList->SetFloatPropertyValue("property.landscape.texture0.tilex", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE0).x); propertyList->AddFloatProperty("property.landscape.texture0.tiley"); propertyList->SetFloatPropertyValue("property.landscape.texture0.tiley", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE0).y); propertyList->AddFloatProperty("property.landscape.texture1.tilex"); propertyList->SetFloatPropertyValue("property.landscape.texture1.tilex", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE1).x); propertyList->AddFloatProperty("property.landscape.texture1.tiley"); propertyList->SetFloatPropertyValue("property.landscape.texture1.tiley", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE1).y); propertyList->AddFloatProperty("property.landscape.texture2.tilex"); propertyList->SetFloatPropertyValue("property.landscape.texture2.tilex", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE2).x); propertyList->AddFloatProperty("property.landscape.texture2.tiley"); propertyList->SetFloatPropertyValue("property.landscape.texture2.tiley", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE2).y); propertyList->AddFloatProperty("property.landscape.texture3.tilex"); propertyList->SetFloatPropertyValue("property.landscape.texture3.tilex", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE3).x); propertyList->AddFloatProperty("property.landscape.texture3.tiley"); propertyList->SetFloatPropertyValue("property.landscape.texture3.tiley", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE3).y); ControlsFactory::AddFogSubsection(propertyList, landscape->IsFogEnabled(), landscape->GetFogDensity(), landscape->GetFogColor()); }
void LandscapePropertyControl::ReadFrom(SceneNode * sceneNode) { NodesPropertyControl::ReadFrom(sceneNode); LandscapeNode *landscape = GetLandscape(); if (!landscape) return; propertyList->AddSection("property.landscape.landscape", GetHeaderState("property.landscape.landscape", true)); propertyList->AddFloatProperty("property.landscape.size", PropertyList::PROPERTY_IS_EDITABLE); propertyList->AddFloatProperty("property.landscape.height", PropertyList::PROPERTY_IS_EDITABLE); Vector3 size(445.0f, 445.0f, 50.f); AABBox3 bbox = landscape->GetBoundingBox(); AABBox3 emptyBox; if((emptyBox.min != bbox.min) && (emptyBox.max != bbox.max)) { AABBox3 transformedBox; bbox.GetTransformedBox(*landscape->GetWorldTransformPtr(), transformedBox); size = transformedBox.max - transformedBox.min; } propertyList->SetFloatPropertyValue("property.landscape.size", size.x); propertyList->SetFloatPropertyValue("property.landscape.height", size.z); propertyList->AddComboProperty("property.landscape.tilemode", tiledModes); propertyList->SetComboPropertyIndex("property.landscape.tilemode", landscape->GetTiledShaderMode()); propertyList->AddFilepathProperty("property.landscape.heightmap", ".png;.heightmap", false, PropertyList::PROPERTY_IS_EDITABLE); propertyList->SetFilepathPropertyValue("property.landscape.heightmap", landscape->GetHeightmapPathname()); propertyList->AddSubsection("property.landscape.subsection.textures"); AddFilepathProperty(String("property.landscape.texture.color"), TextureDescriptor::GetSupportedTextureExtensions(), LandscapeNode::TEXTURE_COLOR); AddFilepathProperty(String("property.landscape.texture.tile0"), TextureDescriptor::GetSupportedTextureExtensions(), LandscapeNode::TEXTURE_TILE0); AddFilepathProperty(String("property.landscape.texture.tile1"), TextureDescriptor::GetSupportedTextureExtensions(), LandscapeNode::TEXTURE_TILE1); AddFilepathProperty(String("property.landscape.texture.tile2"), TextureDescriptor::GetSupportedTextureExtensions(), LandscapeNode::TEXTURE_TILE2); AddFilepathProperty(String("property.landscape.texture.tile3"), TextureDescriptor::GetSupportedTextureExtensions(), LandscapeNode::TEXTURE_TILE3); AddFilepathProperty(String("property.landscape.texture.tilemask"), TextureDescriptor::GetSupportedTextureExtensions(), LandscapeNode::TEXTURE_TILE_MASK); AddFilepathProperty(String("property.landscape.texture.tiledtexture"), TextureDescriptor::GetSupportedTextureExtensions(), LandscapeNode::TEXTURE_TILE_FULL); propertyList->AddColorProperty("property.landscape.texture.tilecolor0"); propertyList->SetColorPropertyValue("property.landscape.texture.tilecolor0", landscape->GetTileColor(LandscapeNode::TEXTURE_TILE0)); propertyList->AddColorProperty("property.landscape.texture.tilecolor1"); propertyList->SetColorPropertyValue("property.landscape.texture.tilecolor1", landscape->GetTileColor(LandscapeNode::TEXTURE_TILE1)); propertyList->AddColorProperty("property.landscape.texture.tilecolor2"); propertyList->SetColorPropertyValue("property.landscape.texture.tilecolor2", landscape->GetTileColor(LandscapeNode::TEXTURE_TILE2)); propertyList->AddColorProperty("property.landscape.texture.tilecolor3"); propertyList->SetColorPropertyValue("property.landscape.texture.tilecolor3", landscape->GetTileColor(LandscapeNode::TEXTURE_TILE3)); propertyList->AddMessageProperty(String("property.landscape.generatefulltiled"), Message(this, &LandscapePropertyControl::GenerateFullTiledTexture)); propertyList->AddMessageProperty(String("property.landscape.saveheightmaptopng"), Message(this, &LandscapePropertyControl::SaveHeightmapToPng)); propertyList->AddBoolProperty("property.landscape.showgrid", PropertyList::PROPERTY_IS_EDITABLE); // RETURN TO THIS CODE LATER // bool showGrid = (0 != (landscape->GetDebugFlags() & DebugRenderComponent::DEBUG_DRAW_GRID)); bool showGrid = false; propertyList->SetBoolPropertyValue("property.landscape.showgrid", showGrid); propertyList->AddIntProperty("lightmap.size"); propertyList->SetIntPropertyValue("lightmap.size", currentSceneNode->GetCustomProperties()->GetInt32("lightmap.size", 1024)); propertyList->AddFloatProperty("property.landscape.texture0.tilex"); propertyList->SetFloatPropertyValue("property.landscape.texture0.tilex", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE0).x); propertyList->AddFloatProperty("property.landscape.texture0.tiley"); propertyList->SetFloatPropertyValue("property.landscape.texture0.tiley", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE0).y); propertyList->AddFloatProperty("property.landscape.texture1.tilex"); propertyList->SetFloatPropertyValue("property.landscape.texture1.tilex", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE1).x); propertyList->AddFloatProperty("property.landscape.texture1.tiley"); propertyList->SetFloatPropertyValue("property.landscape.texture1.tiley", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE1).y); propertyList->AddFloatProperty("property.landscape.texture2.tilex"); propertyList->SetFloatPropertyValue("property.landscape.texture2.tilex", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE2).x); propertyList->AddFloatProperty("property.landscape.texture2.tiley"); propertyList->SetFloatPropertyValue("property.landscape.texture2.tiley", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE2).y); propertyList->AddFloatProperty("property.landscape.texture3.tilex"); propertyList->SetFloatPropertyValue("property.landscape.texture3.tilex", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE3).x); propertyList->AddFloatProperty("property.landscape.texture3.tiley"); propertyList->SetFloatPropertyValue("property.landscape.texture3.tiley", landscape->GetTextureTiling(LandscapeNode::TEXTURE_TILE3).y); ControlsFactory::AddFogSubsection(propertyList, landscape->IsFogEnabled(), landscape->GetFogDensity(), landscape->GetFogColor()); }