Jelajahi Sumber

resource: remove unused material field in ColliderDesc

Daniele Bartolini 6 tahun lalu
induk
melakukan
c31f70d1cd

+ 3 - 4
src/resource/physics_resource.cpp

@@ -123,10 +123,9 @@ namespace physics_resource_internal
 
 		ColliderDesc cd;
 		memset((void*)&cd, 0, sizeof(cd));
-		cd.type        = st;
-		cd.material    = sjson::parse_string_id(obj["material"]);
-		cd.local_tm    = MATRIX4X4_IDENTITY;
-		cd.size        = 0;
+		cd.type     = st;
+		cd.local_tm = MATRIX4X4_IDENTITY;
+		cd.size     = 0;
 
 		// Parse .mesh
 		DynamicString scene(ta);

+ 2 - 2
src/resource/types.h

@@ -58,7 +58,7 @@ struct UnitResource;
 #define RESOURCE_VERSION_STATE_MACHINE    RESOURCE_VERSION(2)
 #define RESOURCE_VERSION_CONFIG           RESOURCE_VERSION(1)
 #define RESOURCE_VERSION_FONT             RESOURCE_VERSION(1)
-#define RESOURCE_VERSION_LEVEL            RESOURCE_VERSION(4)
+#define RESOURCE_VERSION_LEVEL            RESOURCE_VERSION(5)
 #define RESOURCE_VERSION_MATERIAL         RESOURCE_VERSION(2)
 #define RESOURCE_VERSION_MESH             RESOURCE_VERSION(1)
 #define RESOURCE_VERSION_PACKAGE          RESOURCE_VERSION(2)
@@ -69,7 +69,7 @@ struct UnitResource;
 #define RESOURCE_VERSION_SPRITE_ANIMATION RESOURCE_VERSION(1)
 #define RESOURCE_VERSION_SPRITE           RESOURCE_VERSION(2)
 #define RESOURCE_VERSION_TEXTURE          RESOURCE_VERSION(1)
-#define RESOURCE_VERSION_UNIT             RESOURCE_VERSION(2)
+#define RESOURCE_VERSION_UNIT             RESOURCE_VERSION(3)
 
 #define RESOURCE_MAGIC                    u32(0x9B) //!< Non-UTF8 to early out on file type detection
 #define RESOURCE_HEADER(version)          u32((version & 0x00ffffff) << 8 | RESOURCE_MAGIC)

+ 0 - 1
src/world/types.h

@@ -403,7 +403,6 @@ struct HeightfieldShape
 struct ColliderDesc
 {
 	u32 type;                     ///< ShapeType::Enum
-	StringId32 material;          ///< Name of material in global.physics_config resource.
 	Matrix4x4 local_tm;           ///< In actor-space
 	SphereShape sphere;
 	CapsuleShape capsule;

+ 1 - 2
tools/level_editor/level.vala

@@ -342,7 +342,7 @@ namespace Crown
 			_client.send_script(LevelEditorApi.set_camera(unit_id, projection, fov, near_range, far_range));
 		}
 
-		public void set_collider(Guid unit_id, Guid component_id, string shape, string scene, string name, string material)
+		public void set_collider(Guid unit_id, Guid component_id, string shape, string scene, string name)
 		{
 			_db.add_restore_point((int)ActionType.SET_COLLIDER, new Guid[] { unit_id });
 
@@ -350,7 +350,6 @@ namespace Crown
 			unit.set_component_property_string(component_id, "data.shape", shape);
 			unit.set_component_property_string(component_id, "data.scene", scene);
 			unit.set_component_property_string(component_id, "data.name", name);
-			unit.set_component_property_string(component_id, "data.material", material);
 			unit.set_component_property_string(component_id, "type", "collider");
 
 			// No synchronization

+ 0 - 4
tools/level_editor/project.vala

@@ -565,7 +565,6 @@ end
 							db.set_property_string(id, "data.shape", "box");
 							db.set_property_string(id, "data.scene", resource_name);
 							db.set_property_string(id, "data.name", "collider");
-							db.set_property_string(id, "data.material", "default");
 							db.set_property_string(id, "type", "collider");
 
 							db.add_to_set(GUID_ZERO, "components", id);
@@ -575,7 +574,6 @@ end
 							unit.set_component_property_string(id, "data.shape", "box");
 							unit.set_component_property_string(id, "data.scene", resource_name);
 							unit.set_component_property_string(id, "data.name", "collider");
-							unit.set_component_property_string(id, "data.material", "default");
 							unit.set_component_property_string(id, "type", "collider");
 						}
 					}
@@ -746,7 +744,6 @@ end
 						db.set_property_string(id, "data.shape", "mesh");
 						db.set_property_string(id, "data.scene", resource_name);
 						db.set_property_string(id, "data.name", mesh_nodes.entries.to_array()[0].key);
-						db.set_property_string(id, "data.material", "default");
 						db.set_property_string(id, "type", "collider");
 
 						db.add_to_set(GUID_ZERO, "components", id);
@@ -756,7 +753,6 @@ end
 						unit.set_component_property_string(id, "data.shape", "mesh");
 						unit.set_component_property_string(id, "data.scene", resource_name);
 						unit.set_component_property_string(id, "data.name", mesh_nodes.entries.to_array()[0].key);
-						unit.set_component_property_string(id, "data.material", "default");
 						unit.set_component_property_string(id, "type", "collider");
 					}
 				}

+ 0 - 6
tools/level_editor/properties_view.vala

@@ -344,7 +344,6 @@ namespace Crown
 		private Gtk.Entry _shape;
 		private ReferenceChooser _scene;
 		private Gtk.Entry _name;
-		private Gtk.Entry _material;
 
 		public ColliderComponentView(Level level, ProjectStore store)
 		{
@@ -358,13 +357,10 @@ namespace Crown
 			_scene.value_changed.connect(on_value_changed);
 			_name = new Gtk.Entry();
 			_name.sensitive = false;
-			_material = new Gtk.Entry();
-			_material.sensitive = false;
 
 			add_row("Shape", _shape);
 			add_row("Scene", _scene);
 			add_row("Name", _name);
-			add_row("Material", _material);
 		}
 
 		private void on_value_changed()
@@ -374,7 +370,6 @@ namespace Crown
 				, _shape.text
 				, _scene.value
 				, _name.text
-				, _material.text
 				);
 		}
 
@@ -384,7 +379,6 @@ namespace Crown
 			_shape.text    = unit.get_component_property_string(_component_id, "data.shape");
 			_scene.value   = unit.get_component_property_string(_component_id, "data.scene");
 			_name.text     = unit.get_component_property_string(_component_id, "data.name");
-			_material.text = unit.get_component_property_string(_component_id, "data.material");
 		}
 	}