[Bf-blender-cvs] [24da1fbd232] panel-list-patch-2: Array Modifier: Move relative offset subpanel up

Hans Goudey noreply at git.blender.org
Mon Apr 27 02:31:48 CEST 2020


Commit: 24da1fbd2320d5f15cd2effaa13b73a5d5b9d240
Author: Hans Goudey
Date:   Sun Apr 26 19:30:28 2020 -0500
Branches: panel-list-patch-2
https://developer.blender.org/rB24da1fbd2320d5f15cd2effaa13b73a5d5b9d240

Array Modifier: Move relative offset subpanel up

Relative offset is on by default, so it makes more sense for it to be
at the top. Also add XYZ labels to the relative offset and label the
property "factor" instead.

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

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

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

diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index e404e355779..3a84ec4c4a3 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -2747,7 +2747,7 @@ static void rna_def_modifier_array(BlenderRNA *brna)
   RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
   /* PROP_TRANSLATION causes units to be used which we don't want */
-  prop = RNA_def_property(srna, "relative_offset_displace", PROP_FLOAT, PROP_NONE);
+  prop = RNA_def_property(srna, "relative_offset_displace", PROP_FLOAT, PROP_XYZ);
   RNA_def_property_float_sdna(prop, NULL, "scale");
   RNA_def_property_ui_text(
       prop,
@@ -2763,7 +2763,8 @@ static void rna_def_modifier_array(BlenderRNA *brna)
 
   prop = RNA_def_property(srna, "use_merge_vertices_cap", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_ARR_MERGEFINAL);
-  RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices in first and last duplicates");
+  RNA_def_property_ui_text(
+      prop, "Merge End Vertices", "Merge vertices in first and last duplicates");
   RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
   prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE);
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index b6907c887be..27a420d98e6 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -867,17 +867,17 @@ static void panel_draw(const bContext *C, Panel *panel)
   modifier_panel_end(layout, &ptr);
 }
 
-static void constant_offset_header_draw(const bContext *C, Panel *panel)
+static void relative_offset_header_draw(const bContext *C, Panel *panel)
 {
   uiLayout *layout = panel->layout;
 
   PointerRNA ptr;
   modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
 
-  uiItemR(layout, &ptr, "use_constant_offset", 0, NULL, ICON_NONE);
+  uiItemR(layout, &ptr, "use_relative_offset", 0, NULL, ICON_NONE);
 }
 
-static void constant_offset_draw(const bContext *C, Panel *panel)
+static void relative_offset_draw(const bContext *C, Panel *panel)
 {
   uiLayout *layout = panel->layout;
 
@@ -888,21 +888,21 @@ static void constant_offset_draw(const bContext *C, Panel *panel)
 
   uiLayout *col = uiLayoutColumn(layout, false);
 
-  uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_constant_offset"));
-  uiItemR(col, &ptr, "constant_offset_displace", 0, "Distance", ICON_NONE);
+  uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_relative_offset"));
+  uiItemR(col, &ptr, "relative_offset_displace", 0, IFACE_("Factor"), ICON_NONE);
 }
 
-static void relative_offset_header_draw(const bContext *C, Panel *panel)
+static void constant_offset_header_draw(const bContext *C, Panel *panel)
 {
   uiLayout *layout = panel->layout;
 
   PointerRNA ptr;
   modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
 
-  uiItemR(layout, &ptr, "use_relative_offset", 0, NULL, ICON_NONE);
+  uiItemR(layout, &ptr, "use_constant_offset", 0, NULL, ICON_NONE);
 }
 
-static void relative_offset_draw(const bContext *C, Panel *panel)
+static void constant_offset_draw(const bContext *C, Panel *panel)
 {
   uiLayout *layout = panel->layout;
 
@@ -913,10 +913,13 @@ static void relative_offset_draw(const bContext *C, Panel *panel)
 
   uiLayout *col = uiLayoutColumn(layout, false);
 
-  uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_relative_offset"));
-  uiItemR(col, &ptr, "relative_offset_displace", 0, "Distance", ICON_NONE);
+  uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_constant_offset"));
+  uiItemR(col, &ptr, "constant_offset_displace", 0, IFACE_("Distance"), ICON_NONE);
 }
 
+/**
+ * Object offset in a subpanel for consistency with the other offset types.
+ */
 static void object_offset_header_draw(const bContext *C, Panel *panel)
 {
   uiLayout *layout = panel->layout;
@@ -964,7 +967,7 @@ static void symmetry_panel_draw(const bContext *C, Panel *panel)
   uiLayout *col = uiLayoutColumn(layout, false);
   uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_merge_vertices"));
   uiItemR(col, &ptr, "merge_threshold", 0, IFACE_("Distance"), ICON_NONE);
-  uiItemR(col, &ptr, "use_merge_vertices_cap", 0, IFACE_("First Last"), ICON_NONE);
+  uiItemR(col, &ptr, "use_merge_vertices_cap", 0, IFACE_("Merge First and Last"), ICON_NONE);
 }
 
 static void uv_panel_draw(const bContext *C, Panel *panel)
@@ -985,18 +988,18 @@ static void uv_panel_draw(const bContext *C, Panel *panel)
 static void panelRegister(ARegionType *region_type)
 {
   PanelType *panel_type = modifier_panel_register(region_type, "Array", panel_draw);
-  modifier_subpanel_register(region_type,
-                             "array_constant_offset",
-                             "",
-                             constant_offset_header_draw,
-                             constant_offset_draw,
-                             panel_type);
   modifier_subpanel_register(region_type,
                              "array_relative_offset",
                              "",
                              relative_offset_header_draw,
                              relative_offset_draw,
                              panel_type);
+  modifier_subpanel_register(region_type,
+                             "array_constant_offset",
+                             "",
+                             constant_offset_header_draw,
+                             constant_offset_draw,
+                             panel_type);
   modifier_subpanel_register(region_type,
                              "array_object_offset",
                              "",



More information about the Bf-blender-cvs mailing list