diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2021-03-07 17:12:49 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2021-03-08 17:09:17 +0300 |
commit | 91825ebfe2cb8ecf6d5c02e11783e44aaa1add84 (patch) | |
tree | 0dd8f5e6cbd0c4b166774ae8ab256a041e5e365c /source/blender/modifiers | |
parent | 9e0921497912cbfe9846358d1cb1220f88315f80 (diff) |
UI: UVProject modifier: clarify aspect & scale are only for camera
projectors
Make this clear in property UI descriptions and deactivate aspect &
scale fields if no camera projectors are present.
ref T86268
Maniphest Tasks: T86268
Differential Revision: https://developer.blender.org/D10634
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_uvproject.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index a6b83ed60ea..487250eb4e3 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -331,12 +331,24 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) uiItemPointerR(layout, ptr, "uv_layer", &obj_data_ptr, "uv_layers", NULL, ICON_NONE); + /* Aspect and Scale are only used for camera projectors. */ + bool has_camera = false; + RNA_BEGIN (ptr, projector_ptr, "projectors") { + PointerRNA ob_projector = RNA_pointer_get(&projector_ptr, "object"); + if (!RNA_pointer_is_null(&ob_projector) && RNA_enum_get(&ob_projector, "type") == OB_CAMERA) { + has_camera = true; + } + } + RNA_END; + sub = uiLayoutColumn(layout, true); - uiItemR(sub, ptr, "aspect_x", 0, IFACE_("Aspect X"), ICON_NONE); + uiLayoutSetActive(sub, has_camera); + uiItemR(sub, ptr, "aspect_x", 0, NULL, ICON_NONE); uiItemR(sub, ptr, "aspect_y", 0, IFACE_("Y"), ICON_NONE); sub = uiLayoutColumn(layout, true); - uiItemR(sub, ptr, "scale_x", 0, IFACE_("Scale X"), ICON_NONE); + uiLayoutSetActive(sub, has_camera); + uiItemR(sub, ptr, "scale_x", 0, NULL, ICON_NONE); uiItemR(sub, ptr, "scale_y", 0, IFACE_("Y"), ICON_NONE); uiItemR(layout, ptr, "projector_count", 0, IFACE_("Projectors"), ICON_NONE); |