Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2020-06-05 17:41:03 +0300
committerHans Goudey <h.goudey@me.com>2020-06-05 17:41:03 +0300
commit9b099c86123fc828a194c59ce5b8bbf5a56f9cdb (patch)
tree38937711643f5816881710debd93df2d28cf9675 /source/blender/makesrna
parent4e70e0e384c08d2d4b021758347aeb5e7a1da0dc (diff)
UI: Drag and Drop Modifiers, Layout Updates
This patch implements the list panel system D7490 for modifiers. It also moves modifier drawing to a callback in ModifierTypeInfo in line with the extensible architecture refactoring goal T75724. This adds a PanelRegister callback and utilities for registering panels and subpanels. It also adds the callbacks for expansion saving and drag and drop reordering described in D7490. These utilities, callbacks, and other common UI elements shared between modifiers live in MOD_ui_common.c. Because modifier buttons are now in panels, we can make use of subpanels for organization. The UI layouts also use the single column layout style consistently used elsewhere in Blender. Additionally, the mode-setting buttons are aligned and ordered consistently with the outliner. However, the large number of UI changes in this patch may mean that additional polishing is required in master. Thanks to William Reynish (@billreynish) who did a fair amount of the layout work and to Julian Eisel (@Severin) for consistent help. Differential Revision: https://developer.blender.org/D7498
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c48
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c8
2 files changed, 29 insertions, 27 deletions
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 585f866ffae..e9b8595ce3c 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -2808,7 +2808,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,
@@ -2824,7 +2824,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);
@@ -3356,7 +3357,7 @@ static void rna_def_modifier_cast(BlenderRNA *brna)
prop = RNA_def_property(srna, "cast_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type");
RNA_def_property_enum_items(prop, prop_cast_type_items);
- RNA_def_property_ui_text(prop, "Cast Type", "Target object shape");
+ RNA_def_property_ui_text(prop, "Shape", "Target object shape");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
@@ -3958,6 +3959,12 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL},
};
+ static const EnumPropertyItem prop_affect_items[] = {
+ {0, "EDGES", 0, "Edges", "Affect only edges"},
+ {MOD_BEVEL_VERT, "VERTICES", 0, "Vertices", "Affect only vertices"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
srna = RNA_def_struct(brna, "BevelModifier", "Modifier");
RNA_def_struct_ui_text(
srna, "Bevel Modifier", "Bevel modifier to make edges and vertices more rounded");
@@ -3986,9 +3993,10 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Segments", "Number of segments for round edges/verts");
RNA_def_property_update(prop, 0, "rna_BevelModifier_update_segments");
- prop = RNA_def_property(srna, "use_only_vertices", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_BEVEL_VERT);
- RNA_def_property_ui_text(prop, "Only Vertices", "Bevel verts/corners, not edges");
+ prop = RNA_def_property(srna, "affect", PROP_ENUM, PROP_NONE); /* as an enum */
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, prop_affect_items);
+ RNA_def_property_ui_text(prop, "Affect", "Affect edges or vertices");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
@@ -4036,7 +4044,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "mat");
RNA_def_property_range(prop, -1, SHRT_MAX);
RNA_def_property_ui_text(
- prop, "Material", "Material index of generated faces, -1 for automatic");
+ prop, "Material Index", "Material index of generated faces, -1 for automatic");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "loop_slide", PROP_BOOLEAN, PROP_NONE);
@@ -4063,7 +4071,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "face_str_mode");
RNA_def_property_enum_items(prop, prop_harden_normals_items);
RNA_def_property_ui_text(
- prop, "Set Face Strength", "Whether to set face strength, and which faces to set it on");
+ prop, "Face Strength", "Whether to set face strength, and which faces to set it on");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "miter_outer", PROP_ENUM, PROP_NONE);
@@ -4164,7 +4172,7 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
prop = RNA_def_property(srna, "wrap_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "shrinkType");
RNA_def_property_enum_items(prop, shrink_type_items);
- RNA_def_property_ui_text(prop, "Mode", "");
+ RNA_def_property_ui_text(prop, "Wrap Method", "");
RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
prop = RNA_def_property(srna, "wrap_mode", PROP_ENUM, PROP_NONE);
@@ -4923,7 +4931,7 @@ static void rna_def_modifier_weightvg_mask(BlenderRNA *UNUSED(brna),
prop = RNA_def_property(srna, "mask_vertex_group", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "mask_defgrp_name");
- RNA_def_property_ui_text(prop, "Mask VGroup", "Masking vertex group name");
+ RNA_def_property_ui_text(prop, "Mask Vertex Group", "Masking vertex group name");
RNA_def_property_string_funcs(prop, NULL, NULL, mask_vgroup_setter);
RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -5422,7 +5430,7 @@ static void rna_def_modifier_remesh(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_remove_disconnected", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_REMESH_FLOOD_FILL);
- RNA_def_property_ui_text(prop, "Remove Disconnected Pieces", "");
+ RNA_def_property_ui_text(prop, "Remove Disconnected", "");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "use_smooth_shade", PROP_BOOLEAN, PROP_NONE);
@@ -5977,6 +5985,8 @@ static void rna_def_modifier_meshseqcache(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_ENUM_FLAG);
RNA_def_property_enum_sdna(prop, NULL, "read_flag");
RNA_def_property_enum_items(prop, read_flag_items);
+ RNA_def_property_ui_text(prop, "Read Data", "Data to read from the cache");
+
RNA_def_property_update(prop, 0, "rna_Modifier_update");
RNA_define_lib_overridable(false);
@@ -6161,7 +6171,7 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna)
{DT_TYPE_MDEFORMVERT,
"VGROUP_WEIGHTS",
0,
- "Vertex Group(s)",
+ "Vertex Groups",
"Transfer active or all vertex groups"},
# if 0 /* TODO */
{DT_TYPE_SHAPEKEY, "SHAPEKEYS", 0, "Shapekey(s)", "Transfer active or all shape keys"},
@@ -6178,19 +6188,15 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna)
static const EnumPropertyItem DT_layer_edge_items[] = {
{DT_TYPE_SHARP_EDGE, "SHARP_EDGE", 0, "Sharp", "Transfer sharp mark"},
{DT_TYPE_SEAM, "SEAM", 0, "UV Seam", "Transfer UV seam mark"},
- {DT_TYPE_CREASE, "CREASE", 0, "Subsurf Crease", "Transfer crease values"},
+ {DT_TYPE_CREASE, "CREASE", 0, "Crease", "Transfer subdivision crease values"},
{DT_TYPE_BWEIGHT_EDGE, "BEVEL_WEIGHT_EDGE", 0, "Bevel Weight", "Transfer bevel weights"},
- {DT_TYPE_FREESTYLE_EDGE,
- "FREESTYLE_EDGE",
- 0,
- "Freestyle Mark",
- "Transfer Freestyle edge mark"},
+ {DT_TYPE_FREESTYLE_EDGE, "FREESTYLE_EDGE", 0, "Freestyle", "Transfer Freestyle edge mark"},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem DT_layer_loop_items[] = {
{DT_TYPE_LNOR, "CUSTOM_NORMAL", 0, "Custom Normals", "Transfer custom normals"},
- {DT_TYPE_VCOL, "VCOL", 0, "VCol", "Vertex (face corners) colors"},
+ {DT_TYPE_VCOL, "VCOL", 0, "Vertex Colors", "Vertex (face corners) colors"},
{DT_TYPE_UV, "UV", 0, "UVs", "Transfer UV layers"},
{0, NULL, 0, NULL, NULL},
};
@@ -6374,7 +6380,7 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna)
0.0f,
0.0f,
1.0f,
- "Islands Handling Refinement",
+ "Islands Precision",
"Factor controlling precision of islands handling "
"(typically, 0.1 should be enough, higher values can make things really slow)",
0.0f,
@@ -6855,7 +6861,7 @@ void RNA_def_modifier(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Expanded);
+ RNA_def_property_boolean_sdna(prop, NULL, "ui_expand_flag", 0);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
RNA_def_property_ui_text(prop, "Expanded", "Set modifier expanded in the user interface");
RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 8d0e403aa2d..fd65b713d15 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -1209,13 +1209,9 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
api_ui_item_common_text(func);
- func = RNA_def_function(srna, "template_modifier", "uiTemplateModifier");
+ func = RNA_def_function(srna, "template_modifiers", "uiTemplateModifiers");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Generates the UI layout for modifiers");
- parm = RNA_def_pointer(func, "data", "Modifier", "", "Modifier data");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
- RNA_def_function_return(func, parm);
+ RNA_def_function_ui_description(func, "Generates the UI layout for the modifier stack");
func = RNA_def_function(srna, "template_greasepencil_modifier", "uiTemplateGpencilModifier");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);