Skip to content

Commit

Permalink
Print warnings when editing out of editable area instead of verbose p…
Browse files Browse the repository at this point in the history
…rints
  • Loading branch information
Zylann committed Jun 14, 2024
1 parent aac7025 commit 3a9f3d1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions edition/voxel_tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ float VoxelTool::get_voxel_f(Vector3i pos) const {
void VoxelTool::set_voxel(Vector3i pos, uint64_t v) {
Box3i box(pos, Vector3i(1, 1, 1));
if (!is_area_editable(box)) {
ZN_PRINT_VERBOSE("Area not editable");
ZN_PRINT_WARNING("Area not editable");
return;
}
_set_voxel(pos, v);
Expand All @@ -112,7 +112,7 @@ void VoxelTool::set_voxel(Vector3i pos, uint64_t v) {
void VoxelTool::set_voxel_f(Vector3i pos, float v) {
Box3i box(pos, Vector3i(1, 1, 1));
if (!is_area_editable(box)) {
ZN_PRINT_VERBOSE("Area not editable");
ZN_PRINT_WARNING("Area not editable");
return;
}
_set_voxel_f(pos, v);
Expand Down Expand Up @@ -165,7 +165,7 @@ void VoxelTool::do_sphere(Vector3 center, float radius) {
);

if (_allow_out_of_bounds == false && !is_area_editable(box)) {
ZN_PRINT_VERBOSE("Area not editable");
ZN_PRINT_WARNING("Area not editable");
return;
}

Expand Down Expand Up @@ -201,7 +201,7 @@ void VoxelTool::sdf_stamp_erase(const VoxelBuffer &stamp, Vector3i pos) {

const Box3i box(pos, stamp.get_size());
if (!is_area_editable(box)) {
ZN_PRINT_VERBOSE("Area not editable");
ZN_PRINT_WARNING("Area not editable");
return;
}

Expand All @@ -226,7 +226,7 @@ void VoxelTool::do_box(Vector3i begin, Vector3i end) {
const Box3i box = Box3i::from_min_max(begin, end + Vector3i(1, 1, 1));

if (_allow_out_of_bounds == false && !is_area_editable(box)) {
ZN_PRINT_VERBOSE("Area not editable");
ZN_PRINT_WARNING("Area not editable");
return;
}

Expand Down Expand Up @@ -351,7 +351,7 @@ void VoxelTool::grow_sphere(Vector3 sphere_center, float sphere_radius, float st
);

if (_allow_out_of_bounds == false && !is_area_editable(voxel_box)) {
ZN_PRINT_VERBOSE("Area not editable");
ZN_PRINT_WARNING("Area not editable");
return;
}

Expand Down
14 changes: 7 additions & 7 deletions edition/voxel_tool_lod_terrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void VoxelToolLodTerrain::do_box(Vector3i begin, Vector3i end) {
op.strength = get_sdf_strength();

if (!is_area_editable(op.box)) {
ZN_PRINT_VERBOSE("Area not editable");
ZN_PRINT_WARNING("Area not editable");
return;
}

Expand Down Expand Up @@ -226,7 +226,7 @@ void VoxelToolLodTerrain::do_sphere(Vector3 center, float radius) {
op.strength = get_sdf_strength();

if (!is_area_editable(op.box)) {
ZN_PRINT_VERBOSE("Area not editable");
ZN_PRINT_WARNING("Area not editable");
return;
}

Expand Down Expand Up @@ -258,7 +258,7 @@ void VoxelToolLodTerrain::do_hemisphere(Vector3 center, float radius, Vector3 fl
op.strength = get_sdf_strength();

if (!is_area_editable(op.box)) {
ZN_PRINT_VERBOSE("Area not editable");
ZN_PRINT_WARNING("Area not editable");
return;
}

Expand Down Expand Up @@ -325,7 +325,7 @@ void VoxelToolLodTerrain::do_sphere_async(Vector3 center, float radius) {
op.strength = get_sdf_strength();

if (!is_area_editable(op.box)) {
ZN_PRINT_VERBOSE("Area not editable");
ZN_PRINT_WARNING("Area not editable");
return;
}

Expand All @@ -350,7 +350,7 @@ void VoxelToolLodTerrain::paste(Vector3i pos, const VoxelBuffer &src, uint8_t ch
}
const Box3i box(pos, src.get_size());
if (!is_area_editable(box)) {
ZN_PRINT_VERBOSE("Area not editable");
ZN_PRINT_WARNING("Area not editable");
return;
}

Expand Down Expand Up @@ -959,7 +959,7 @@ void VoxelToolLodTerrain::stamp_sdf(
// This could be avoided with a box/transformed-box intersection algorithm. Might investigate if the use case
// occurs. It won't happen with full load mode. This also affects other shapes.
if (!is_area_editable(voxel_box)) {
ZN_PRINT_VERBOSE("Area not editable");
ZN_PRINT_WARNING("Area not editable");
return;
}

Expand Down Expand Up @@ -1011,7 +1011,7 @@ void VoxelToolLodTerrain::do_graph(Ref<VoxelGeneratorGraph> graph, Transform3D t
.clipped(_terrain->get_voxel_bounds());

if (!is_area_editable(box)) {
ZN_PRINT_VERBOSE("Area not editable");
ZN_PRINT_WARNING("Area not editable");
return;
}

Expand Down
6 changes: 3 additions & 3 deletions edition/voxel_tool_terrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void VoxelToolTerrain::do_box(Vector3i begin, Vector3i end) {
op.strength = get_sdf_strength();

if (!is_area_editable(op.box)) {
ZN_PRINT_VERBOSE("Area not editable");
ZN_PRINT_WARNING("Area not editable");
return;
}

Expand Down Expand Up @@ -277,7 +277,7 @@ void VoxelToolTerrain::do_sphere(Vector3 center, float radius) {
op.strength = get_sdf_strength();

if (!is_area_editable(op.box)) {
ZN_PRINT_VERBOSE("Area not editable");
ZN_PRINT_WARNING("Area not editable");
return;
}

Expand Down Expand Up @@ -308,7 +308,7 @@ void VoxelToolTerrain::do_hemisphere(Vector3 center, float radius, Vector3 flat_
op.strength = get_sdf_strength();

if (!is_area_editable(op.box)) {
ZN_PRINT_VERBOSE("Area not editable");
ZN_PRINT_WARNING("Area not editable");
return;
}

Expand Down

0 comments on commit 3a9f3d1

Please sign in to comment.