Skip to content

Commit

Permalink
Fix mesh rotation not saved in cube models
Browse files Browse the repository at this point in the history
  • Loading branch information
Zylann committed Nov 16, 2024
1 parent 8159237 commit 4c680c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion meshers/blocky/voxel_blocky_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ void VoxelBlockyModel::bake(BakedData &baked_data, bool bake_tangents, MaterialI

BakedData::Model &model = baked_data.model;

// Note: mesh rotation is not implemented here, it is done in derived classes.

// Set empty sides mask
model.empty_sides_mask = 0;
for (unsigned int side = 0; side < Cube::SIDE_COUNT; ++side) {
Expand Down Expand Up @@ -612,7 +614,8 @@ void VoxelBlockyModel::_bind_methods() {
"get_collision_mask"
);

ADD_GROUP("Rotation", "");
// Note: rotation property is currently exposed only in derived classes.
// It will not necessarily be supported by all derived classes.

BIND_ENUM_CONSTANT(SIDE_NEGATIVE_X);
BIND_ENUM_CONSTANT(SIDE_POSITIVE_X);
Expand Down
8 changes: 8 additions & 0 deletions meshers/blocky/voxel_blocky_model_cube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,14 @@ void VoxelBlockyModelCube::_bind_methods() {
ADD_PROPERTY(
PropertyInfo(Variant::VECTOR2I, "atlas_size_in_tiles"), "set_atlas_size_in_tiles", "get_atlas_size_in_tiles"
);

// ADD_GROUP("Rotation", "");

ADD_PROPERTY(
PropertyInfo(Variant::INT, "mesh_ortho_rotation_index", PROPERTY_HINT_RANGE, "0,24"),
"set_mesh_ortho_rotation_index",
"get_mesh_ortho_rotation_index"
);
}

} // namespace zylann::voxel

0 comments on commit 4c680c7

Please sign in to comment.