[Bf-blender-cvs] [ecfae8a55b7] modifier-panels-ui: Use 2.8-compliant layouts for some modifiers
William Reynish
noreply at git.blender.org
Fri Apr 3 22:53:11 CEST 2020
Commit: ecfae8a55b7d5109958f2c09ac1f651196864d8e
Author: William Reynish
Date: Fri Apr 3 22:52:26 2020 +0200
Branches: modifier-panels-ui
https://developer.blender.org/rBecfae8a55b7d5109958f2c09ac1f651196864d8e
Use 2.8-compliant layouts for some modifiers
===================================================================
M source/blender/modifiers/intern/MOD_boolean.c
M source/blender/modifiers/intern/MOD_curve.c
M source/blender/modifiers/intern/MOD_displace.c
M source/blender/modifiers/intern/MOD_edgesplit.c
M source/blender/modifiers/intern/MOD_hook.c
M source/blender/modifiers/intern/MOD_laplaciandeform.c
M source/blender/modifiers/intern/MOD_weld.c
===================================================================
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index b19076b6754..c976dd874a5 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -361,23 +361,18 @@ static void panel_draw(const bContext *C, Panel *panel)
{
PointerRNA ptr;
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
- uiLayout *col, *split;
uiLayout *layout = panel->layout;
- split = uiLayoutSplit(layout, 0.5f, false);
+ uiLayoutSetPropSep(layout, true);
- col = uiLayoutColumn(split, false);
- uiItemL(col, IFACE_("Operation:"), ICON_NONE);
- uiItemR(col, &ptr, "operation", 0, "", ICON_NONE);
+ uiItemR(layout, &ptr, "operation", 0, 0, ICON_NONE);
- col = uiLayoutColumn(split, false);
- uiItemL(col, IFACE_("Object:"), ICON_NONE);
- uiItemR(col, &ptr, "object", 0, "", ICON_NONE);
+ uiItemR(layout, &ptr, "object", 0, 0, ICON_NONE);
uiItemR(layout, &ptr, "double_threshold", 0, NULL, ICON_NONE);
if (G.debug) {
- uiItemR(col, &ptr, "debug_options", 0, "", ICON_NONE);
+ uiItemR(layout, &ptr, "debug_options", 0, "", ICON_NONE);
}
modifier_panel_end(layout, &ptr);
diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c
index a3a6a06f9ab..f28b7db2ec5 100644
--- a/source/blender/modifiers/intern/MOD_curve.c
+++ b/source/blender/modifiers/intern/MOD_curve.c
@@ -171,17 +171,17 @@ static void panel_draw(const bContext *C, Panel *panel)
bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
- uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE);
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, &ptr, "object", 0, IFACE_("Curve Object"), ICON_NONE);
+ uiItemR(layout, &ptr, "deform_axis", 0, NULL, ICON_NONE);
+
row = uiLayoutRow(layout, true);
uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
sub = uiLayoutRow(row, true);
uiLayoutSetActive(sub, has_vertex_group);
uiItemR(sub, &ptr, "invert_vertex_group", 0, "", ICON_ARROW_LEFTRIGHT);
- uiItemL(layout, IFACE_("Deformation Axis:"), ICON_NONE);
- row = uiLayoutRow(layout, false);
- uiItemR(row, &ptr, "deform_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
-
modifier_panel_end(layout, &ptr);
}
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 0deddede06b..40942b2b059 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -418,7 +418,7 @@ static void deformVertsEM(ModifierData *md,
static void panel_draw(const bContext *C, Panel *panel)
{
- uiLayout *sub, *row, *col, *split;
+ uiLayout *sub, *row, *col;
uiLayout *layout = panel->layout;
PointerRNA ptr;
@@ -426,52 +426,49 @@ static void panel_draw(const bContext *C, Panel *panel)
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
PointerRNA texture_ptr = RNA_pointer_get(&ptr, "texture");
- bool has_texture = RNA_pointer_is_null(&texture_ptr);
+ bool has_texture = !RNA_pointer_is_null(&texture_ptr);
bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
- uiItemL(layout, IFACE_("Texture:"), ICON_NONE);
+ uiLayoutSetPropSep(layout, true);
+
uiTemplateID(layout, C, &ptr, "texture", "texture.new", NULL, NULL, 0, ICON_NONE, NULL);
- split = uiLayoutSplit(layout, 0.5f, false);
- col = uiLayoutColumn(split, false);
- uiItemL(col, IFACE_("Direction:"), ICON_NONE);
- uiItemR(col, &ptr, "direction", 0, "", ICON_NONE);
+ col = uiLayoutColumn(layout, false);
+ uiLayoutSetActive(col, has_texture);
+ uiItemR(col, &ptr, "texture_coords", 0, 0, ICON_NONE);
+ int texture_coords = RNA_enum_get(&ptr, "texture_coords");
+ if (texture_coords == MOD_DISP_MAP_OBJECT) {
+ uiItemR(col, &ptr, "texture_coords_object", 0, NULL, ICON_NONE);
+ }
+ else if (texture_coords == MOD_DISP_MAP_UV && RNA_enum_get(&ob_ptr, "type") == OB_MESH) {
+ uiItemR(col, &ptr, "uv_layer", 0, NULL, ICON_NONE);
+ }
+
+ uiItemS(layout);
+
+ col = uiLayoutColumn(layout, false);
+ uiItemR(col, &ptr, "direction", 0, 0, ICON_NONE);
if (ELEM(RNA_enum_get(&ptr, "direction"),
MOD_DISP_DIR_X,
MOD_DISP_DIR_Y,
MOD_DISP_DIR_Z,
MOD_DISP_DIR_RGB_XYZ)) {
- uiItemL(col, IFACE_("Space:"), ICON_NONE);
- uiItemR(col, &ptr, "space", 0, "", ICON_NONE);
+ uiItemR(col, &ptr, "space", 0, NULL, ICON_NONE);
}
- col = uiLayoutColumn(layout, true);
- uiItemL(col, IFACE_("Vertex Group:"), ICON_NONE);
+ uiItemS(layout);
+
+ col = uiLayoutColumn(layout, false);
+ uiItemR(col, &ptr, "strength", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "mid_level", 0, NULL, ICON_NONE);
+
row = uiLayoutRow(col, true);
- uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", "", ICON_NONE);
- sub = uiLayoutRow(row, true);
+ uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", 0, ICON_NONE);
+ sub = uiLayoutColumn(row, true);
+ uiLayoutSetPropDecorate(sub, false);
uiLayoutSetActive(sub, has_vertex_group);
uiItemR(sub, &ptr, "invert_vertex_group", 0, "", ICON_ARROW_LEFTRIGHT);
- col = uiLayoutColumn(split, false);
- uiLayoutSetActive(col, has_texture);
- uiItemL(col, IFACE_("Texture Coordinates:"), ICON_NONE);
- uiItemR(col, &ptr, "texture_coords", 0, "", ICON_NONE);
- int texture_coords = RNA_enum_get(&ptr, "texture_coords");
- if (texture_coords == MOD_DISP_MAP_OBJECT) {
- uiItemL(col, IFACE_("Object:"), ICON_NONE);
- uiItemR(col, &ptr, "texture_coords_object", 0, "", ICON_NONE);
- }
- else if (texture_coords == MOD_DISP_MAP_UV && RNA_enum_get(&ob_ptr, "type") == OB_MESH) {
- uiItemL(col, IFACE_("UV Map:"), ICON_NONE);
- uiItemR(col, &ptr, "uv_layer", 0, "", ICON_NONE);
- }
-
- uiItemS(layout);
- row = uiLayoutRow(layout, false);
- uiItemR(row, &ptr, "mid_level", 0, NULL, ICON_NONE);
- uiItemR(row, &ptr, "strength", 0, NULL, ICON_NONE);
-
modifier_panel_end(layout, &ptr);
}
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c
index 1532f24051e..affd6efdadc 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -140,30 +140,49 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *UNUSED(c
static void panel_draw(const bContext *C, Panel *panel)
{
- uiLayout *row, *col, *split;
-
uiLayout *layout = panel->layout;
PointerRNA ptr;
PointerRNA ob_ptr;
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
- row = uiLayoutColumn(layout, false);
- uiLayoutSetActive(row, RNA_boolean_get(&ptr, "use_edge_angle"));
- uiItemR(row, &ptr, "split_angle", 0, NULL, ICON_NONE);
-
- split = uiLayoutSplit(layout, 0.5f, false);
- col = uiLayoutColumn(split, false);
- uiItemR(col, &ptr, "use_edge_angle", 0, IFACE_("Edge Angle"), ICON_NONE);
+ uiLayoutSetPropSep(layout, true);
- col = uiLayoutColumn(split, false);
- uiItemR(col, &ptr, "use_edge_sharp", 0, IFACE_("Sharp Edges"), ICON_NONE);
+ uiItemR(layout, &ptr, "use_edge_sharp", 0, IFACE_("Sharp Edges"), ICON_NONE);
modifier_panel_end(layout, &ptr);
}
+static void edge_angle_panel_draw_header(const bContext *C, Panel *panel)
+{
+ PointerRNA ptr;
+ modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+ uiLayout *layout = panel->layout;
+
+ uiItemR(layout, &ptr, "use_edge_angle", 0, "", ICON_NONE);
+}
+
+static void edge_angle_panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *layout = panel->layout;
+ PointerRNA ptr;
+ PointerRNA ob_ptr;
+ modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
+
+ uiLayoutSetPropSep(layout, true);
+ uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "use_edge_angle"));
+ uiItemR(layout, &ptr, "split_angle", 0, NULL, ICON_NONE);
+}
+
static void panelRegister(ARegionType *region_type)
{
- modifier_panel_register(region_type, "EdgeSplit", panel_draw);
+ PanelType *panel_type = modifier_panel_register(region_type, "EdgeSplit", panel_draw);
+ modifier_subpanel_register(region_type,
+ "edgesplit_",
+ "Edge Angle",
+ edge_angle_panel_draw_header,
+ edge_angle_panel_draw,
+ false,
+ panel_type);
}
ModifierTypeInfo modifierType_EdgeSplit = {
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index caf38a4d2ab..34728a0e8b1 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -401,7 +401,7 @@ static void deformVertsEM(struct ModifierData *md,
static void panel_draw(const bContext *C, Panel *panel)
{
- uiLayout *sub, *row, *col, *split;
+ uiLayout *sub, *row, *col;
uiLayout *layout = panel->layout;
PointerRNA ptr;
@@ -411,20 +411,18 @@ static void panel_draw(const bContext *C, Panel *panel)
PointerRNA hook_object_ptr = RNA_pointer_get(&ptr, "object");
bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
- split = uiLayoutSplit(layout, 0.5f, false);
- col = uiLayoutColumn(split, false);
- uiItemL(col, IFACE_("Object:"), ICON_NONE);
- uiItemR(col, &ptr, "object", 0, "", ICON_NONE);
+ uiLayoutSetPropSep(layout, true);
+
+ col = uiLayoutColumn(layout, false);
+ uiItemR(col, &ptr, "object", 0, NULL, ICON_NONE);
if (!RNA_pointer_is_null(&hook_object_ptr) &&
RNA_enum_get(&hook_object_ptr, "type") == OB_ARMATURE) {
- uiItemL(col, IFACE_("Bone:"), ICON_NONE);
PointerRNA hook_object_data_ptr = RNA_pointer_get(&hook_object_ptr, "data");
- uiItemPointerR(col, &ptr, "subtarget", &hook_object_data_ptr, "bones", "", ICON_NONE);
+ uiItemPointerR(col, &ptr, "subtarget", &hook_object_data_ptr, "bones", "Bone", ICON_NONE);
}
- col = uiLayoutColumn(split, false);
- uiItemL(col, IFACE_("Vertex Group:"), ICON_NONE);
+ col = uiLayoutColumn(layout, false);
row = uiLayoutRow(col, true);
- uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", ""
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list