Commit: b226236b017f5f84c5ce029689b0707f639299dc Author: Ramil Roosileht Date: Fri Apr 22 08:08:15 2022 +0200 Branches: master https://developer.blender.org/rBb226236b017f5f84c5ce029689b0707f639299dc
Fix - Display correct units in "Edit voxel size" widget Fix for T84962 Before the patch, edit voxel size always displayed voxel size without units, just as a number in meters. Now it changes like in the voxel remesh panel and shows correct units Video: {F13009428} In adaptive mode: {F13009435} Reviewed By: JulienKaspar Maniphest Tasks: T84962 Differential Revision: https://developer.blender.org/D14682 =================================================================== M source/blender/editors/object/object_remesh.cc =================================================================== diff --git a/source/blender/editors/object/object_remesh.cc b/source/blender/editors/object/object_remesh.cc index 39416a5fbe3..b65e76a5031 100644 --- a/source/blender/editors/object/object_remesh.cc +++ b/source/blender/editors/object/object_remesh.cc @@ -40,6 +40,7 @@ #include "BKE_report.h" #include "BKE_scene.h" #include "BKE_shrinkwrap.h" +#include "BKE_unit.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" @@ -282,7 +283,7 @@ static void voxel_size_parallel_lines_draw(uint pos3d, immEnd(); } -static void voxel_size_edit_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg) +static void voxel_size_edit_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) { VoxelSizeEditCustomData *cd = static_cast<VoxelSizeEditCustomData *>(arg); @@ -338,8 +339,9 @@ static void voxel_size_edit_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), short fstyle_points = fstyle->points; char str[VOXEL_SIZE_EDIT_MAX_STR_LEN]; short strdrawlen = 0; - - BLI_snprintf(str, VOXEL_SIZE_EDIT_MAX_STR_LEN, "%.4f", cd->voxel_size); + Scene *scene = CTX_data_scene(C); + UnitSettings *unit = &scene->unit; + BKE_unit_value_as_string(str, VOXEL_SIZE_EDIT_MAX_STR_LEN, (double)(cd->voxel_size * unit->scale_length), 4, B_UNIT_LENGTH, unit, true); strdrawlen = BLI_strlen_utf8(str); immUnbindProgram(); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs