[Bf-blender-cvs] [91825ebfe2c] master: UI: UVProject modifier: clarify aspect & scale are only for camera projectors

Philipp Oeser noreply at git.blender.org
Mon Mar 8 15:17:00 CET 2021


Commit: 91825ebfe2cb8ecf6d5c02e11783e44aaa1add84
Author: Philipp Oeser
Date:   Sun Mar 7 15:12:49 2021 +0100
Branches: master
https://developer.blender.org/rB91825ebfe2cb8ecf6d5c02e11783e44aaa1add84

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

===================================================================

M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/modifiers/intern/MOD_uvproject.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 4f53a1e6c2b..8624384e3ec 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -3139,7 +3139,7 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna)
   RNA_def_property_flag(prop, PROP_PROPORTIONAL);
   RNA_def_property_range(prop, 1, FLT_MAX);
   RNA_def_property_ui_range(prop, 1, 1000, 1, 3);
-  RNA_def_property_ui_text(prop, "Horizontal Aspect Ratio", "");
+  RNA_def_property_ui_text(prop, "Aspect X", "Horizontal aspect ratio (only used for camera projectors)");
   RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
   prop = RNA_def_property(srna, "aspect_y", PROP_FLOAT, PROP_NONE);
@@ -3147,7 +3147,7 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna)
   RNA_def_property_flag(prop, PROP_PROPORTIONAL);
   RNA_def_property_range(prop, 1, FLT_MAX);
   RNA_def_property_ui_range(prop, 1, 1000, 1, 3);
-  RNA_def_property_ui_text(prop, "Vertical Aspect Ratio", "");
+  RNA_def_property_ui_text(prop, "Aspect Y", "Vertical aspect ratio (only used for camera projectors)");
   RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
   prop = RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_NONE);
@@ -3155,7 +3155,7 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna)
   RNA_def_property_flag(prop, PROP_PROPORTIONAL);
   RNA_def_property_range(prop, 0, FLT_MAX);
   RNA_def_property_ui_range(prop, 0, 1000, 1, 3);
-  RNA_def_property_ui_text(prop, "Horizontal Scale", "");
+  RNA_def_property_ui_text(prop, "Scale X", "Horizontal scale (only used for camera projectors)");
   RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
   prop = RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_NONE);
@@ -3163,7 +3163,7 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna)
   RNA_def_property_flag(prop, PROP_PROPORTIONAL);
   RNA_def_property_range(prop, 0, FLT_MAX);
   RNA_def_property_ui_range(prop, 0, 1000, 1, 3);
-  RNA_def_property_ui_text(prop, "Vertical Scale", "");
+  RNA_def_property_ui_text(prop, "Scale Y", "Vertical scale (only used for camera projectors)");
   RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
   srna = RNA_def_struct(brna, "UVProjector", NULL);
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);



More information about the Bf-blender-cvs mailing list