UI: Object Scale Warnings
Show warnings on the status bar during idle time (not running any operators) when the active object has non-uniform or negative scale. Pull Request: https://projects.blender.org/blender/blender/pulls/132969
This commit is contained in:
committed by
Harley Acheson
parent
9c94c3803f
commit
06a43d7d99
@@ -11,11 +11,13 @@
|
||||
#include "BKE_blender_version.h"
|
||||
#include "BKE_context.hh"
|
||||
#include "BKE_global.hh"
|
||||
#include "BKE_layer.hh"
|
||||
#include "BKE_main.hh"
|
||||
#include "BKE_report.hh"
|
||||
#include "BKE_screen.hh"
|
||||
#include "BKE_workspace.hh"
|
||||
|
||||
#include "BLI_math_matrix.h"
|
||||
#include "BLI_math_vector.h"
|
||||
#include "BLI_rect.h"
|
||||
#include "BLI_string.h"
|
||||
@@ -214,6 +216,35 @@ static bool uiTemplateInputStatusHeader(ARegion *region, uiLayout *row)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool uiTemplateInputStatus3DView(bContext *C, uiLayout *row)
|
||||
{
|
||||
const ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
const Object *ob = BKE_view_layer_active_object_get(view_layer);
|
||||
if (ob && is_negative_m4(ob->object_to_world().ptr())) {
|
||||
uiItemS_ex(row, 1.0f);
|
||||
uiItemL(row, "", ICON_ERROR);
|
||||
uiItemS_ex(row, -0.2f);
|
||||
uiItemL(row, IFACE_("Active object has negative scale"), ICON_NONE);
|
||||
uiItemS_ex(row, 1.0f, LayoutSeparatorType::Line);
|
||||
uiItemS_ex(row, 0.5f);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ob &&
|
||||
!(fabsf(ob->scale[0] - ob->scale[1]) < 1e-4f && fabsf(ob->scale[1] - ob->scale[2]) < 1e-4f))
|
||||
{
|
||||
uiItemS_ex(row, 1.0f);
|
||||
uiItemL(row, "", ICON_ERROR);
|
||||
uiItemS_ex(row, -0.2f);
|
||||
uiItemL(row, IFACE_("Active Object has non-uniform scale"), ICON_NONE);
|
||||
uiItemS_ex(row, 1.0f, LayoutSeparatorType::Line);
|
||||
uiItemS_ex(row, 0.5f);
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void uiTemplateInputStatus(uiLayout *layout, bContext *C)
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
@@ -289,6 +320,11 @@ void uiTemplateInputStatus(uiLayout *layout, bContext *C)
|
||||
return;
|
||||
}
|
||||
|
||||
if (area && area->spacetype == SPACE_VIEW3D && uiTemplateInputStatus3DView(C, row)) {
|
||||
/* Specific to 3DView. */
|
||||
return;
|
||||
}
|
||||
|
||||
if (!area || !region) {
|
||||
/* Keymap status only if over a region in an area. */
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user