Skip to content

Commit

Permalink
Merge pull request #90384 from groud/dont_save_some_default_tileset_p…
Browse files Browse the repository at this point in the history
…rops

TileSet: don't save angular and linear physics velocities if they have their default values
  • Loading branch information
akien-mga committed Apr 8, 2024
2 parents e68f03a + bde8d44 commit a5565c8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions scene/resources/2d/tile_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6805,8 +6805,20 @@ void TileData::_get_property_list(List<PropertyInfo> *p_list) const {
// Physics layers.
p_list->push_back(PropertyInfo(Variant::NIL, GNAME("Physics", ""), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_GROUP));
for (int i = 0; i < physics.size(); i++) {
p_list->push_back(PropertyInfo(Variant::VECTOR2, vformat("physics_layer_%d/%s", i, PNAME("linear_velocity")), PROPERTY_HINT_NONE));
p_list->push_back(PropertyInfo(Variant::FLOAT, vformat("physics_layer_%d/%s", i, PNAME("angular_velocity")), PROPERTY_HINT_NONE));
// physics_layer_%d/linear_velocity
property_info = PropertyInfo(Variant::VECTOR2, vformat("physics_layer_%d/%s", i, PNAME("linear_velocity")), PROPERTY_HINT_NONE);
if (physics[i].linear_velocity == Vector2()) {
property_info.usage ^= PROPERTY_USAGE_STORAGE;
}
p_list->push_back(property_info);

// physics_layer_%d/angular_velocity
property_info = PropertyInfo(Variant::FLOAT, vformat("physics_layer_%d/%s", i, PNAME("angular_velocity")), PROPERTY_HINT_NONE);
if (physics[i].angular_velocity == 0.0) {
property_info.usage ^= PROPERTY_USAGE_STORAGE;
}
p_list->push_back(property_info);

p_list->push_back(PropertyInfo(Variant::INT, vformat("physics_layer_%d/%s", i, PNAME("polygons_count")), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR));

for (int j = 0; j < physics[i].polygons.size(); j++) {
Expand Down

0 comments on commit a5565c8

Please sign in to comment.