[Bf-blender-cvs] [2814a1316fd] modifier-panels-ui: Update Ocean, Remesh, Build modifier UI layouts
Hans Goudey
noreply at git.blender.org
Sat Apr 4 20:23:02 CEST 2020
Commit: 2814a1316fdac08f25cf35b4df47c7e46e839e15
Author: Hans Goudey
Date: Sat Apr 4 13:22:13 2020 -0500
Branches: modifier-panels-ui
https://developer.blender.org/rB2814a1316fdac08f25cf35b4df47c7e46e839e15
Update Ocean, Remesh, Build modifier UI layouts
===================================================================
M source/blender/modifiers/intern/MOD_build.c
M source/blender/modifiers/intern/MOD_ocean.c
M source/blender/modifiers/intern/MOD_remesh.c
===================================================================
diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c
index 12572b5100d..6760a30e3bc 100644
--- a/source/blender/modifiers/intern/MOD_build.c
+++ b/source/blender/modifiers/intern/MOD_build.c
@@ -286,32 +286,49 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, str
static void panel_draw(const bContext *C, Panel *panel)
{
- uiLayout *col, *split, *sub;
-
uiLayout *layout = panel->layout;
+
PointerRNA ptr;
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
modifier_panel_buttons(C, panel);
- split = uiLayoutSplit(layout, 0.5f, false);
-
- col = uiLayoutColumn(split, false);
- uiItemR(col, &ptr, "frame_start", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "frame_duration", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "use_reverse", 0, NULL, ICON_NONE);
+ uiLayoutSetPropSep(layout, true);
- col = uiLayoutColumn(split, false);
- uiItemR(col, &ptr, "use_random_order", 0, NULL, ICON_NONE);
- sub = uiLayoutColumn(col, true);
- uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_random_order"));
- uiItemR(sub, &ptr, "seed", 0, "", ICON_ARROW_LEFTRIGHT);
+ uiItemR(layout, &ptr, "frame_start", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "frame_duration", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "use_reverse", 0, NULL, ICON_NONE);
modifier_panel_end(layout, &ptr);
}
+static void random_panel_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_random_order", 0, NULL, ICON_NONE);
+}
+
+static void random_panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+
+ uiLayoutSetPropSep(layout, true);
+
+ uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "use_random_order"));
+ uiItemR(layout, &ptr, "seed", 0, NULL, ICON_NONE);
+}
+
static void panelRegister(ARegionType *region_type)
{
- modifier_panel_register(region_type, "Build", panel_draw);
+ PanelType *panel_type = modifier_panel_register(region_type, "Build", panel_draw);
+ modifier_subpanel_register(
+ region_type, "build_randomize", "", random_panel_header_draw, random_panel_draw, panel_type);
}
ModifierTypeInfo modifierType_Build = {
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index 95010b746b8..7ec65c55fec 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -507,36 +507,34 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
return result;
}
-
+// #define WITH_OCEANSIM
static void panel_draw(const bContext *C, Panel *panel)
{
uiLayout *layout = panel->layout;
#ifdef WITH_OCEANSIM
- uiLayout *row, *col, *split;
+ uiLayout *col;
PointerRNA ptr;
PointerRNA ob_ptr;
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
+ modifier_panel_buttons(C, panel);
+
+ uiLayoutSetPropSep(layout, true);
uiItemR(layout, &ptr, "geometry_mode", 0, NULL, ICON_NONE);
if (RNA_enum_get(&ptr, "geometry_mode") == MOD_OCEAN_GEOM_GENERATE) {
- row = uiLayoutRow(layout, false);
- uiItemR(row, &ptr, "repeat_x", 0, NULL, ICON_NONE);
- uiItemR(row, &ptr, "repeat_y", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(layout, true);
+ uiItemR(col, &ptr, "repeat_x", 0, IFACE_("Repeat X"), ICON_NONE);
+ uiItemR(col, &ptr, "repeat_y", 0, IFACE_("Y"), ICON_NONE);
}
+ uiItemR(layout, &ptr, "random_seed", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "resolution", 0, NULL, ICON_NONE);
- uiItemS(layout);
+ uiItemR(layout, &ptr, "time", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "depth", 0, NULL, ICON_NONE);
- split = uiLayoutSplit(layout, 0.5f, false);
- col = uiLayoutColumn(split, false);
- uiItemR(col, &ptr, "time", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "depth", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "random_seed", 0, NULL, ICON_NONE);
-
- col = uiLayoutColumn(split, false);
- uiItemR(col, &ptr, "resolution", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "size", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "spatial_size", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "size", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "spatial_size", 0, NULL, ICON_NONE);
uiItemR(layout, &ptr, "use_normals", 0, NULL, ICON_NONE);
@@ -550,26 +548,24 @@ static void panel_draw(const bContext *C, Panel *panel)
#ifdef WITH_OCEANSIM
static void waves_panel_draw(const bContext *C, Panel *panel)
{
- uiLayout *split, *col, *sub;
+ uiLayout *col;
uiLayout *layout = panel->layout;
PointerRNA ptr;
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
- modifier_panel_buttons(C, panel);
- split = uiLayoutSplit(layout, 0.5f, false);
- col = uiLayoutColumn(split, false);
- uiItemR(col, &ptr, "choppiness", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "wave_scale", 0, IFACE_("Scale"), ICON_NONE);
- uiItemR(col, &ptr, "wave_scale_min", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "wind_velocity", 0, NULL, ICON_NONE);
-
- col = uiLayoutColumn(split, false);
- uiItemR(col, &ptr, "wave_alignment", 0, IFACE_("Alignment"), ICON_NONE);
- sub = uiLayoutColumn(col, false);
- uiLayoutSetActive(sub, RNA_float_get(&ptr, "wave_alignment") > 0.0f);
- uiItemR(sub, &ptr, "wave_direction", 0, IFACE_("Direction"), ICON_NONE);
- uiItemR(sub, &ptr, "damping", 0, NULL, ICON_NONE);
+ uiLayoutSetPropSep(layout, true);
+
+ uiItemR(layout, &ptr, "wave_scale", 0, IFACE_("Scale"), ICON_NONE);
+ uiItemR(layout, &ptr, "wave_scale_min", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "choppiness", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "wind_velocity", 0, NULL, ICON_NONE);
+
+ uiItemR(layout, &ptr, "wave_alignment", 0, IFACE_("Alignment"), ICON_NONE);
+ col = uiLayoutColumn(layout, false);
+ uiLayoutSetActive(col, RNA_float_get(&ptr, "wave_alignment") > 0.0f);
+ uiItemR(col, &ptr, "wave_direction", 0, IFACE_("Direction"), ICON_NONE);
+ uiItemR(col, &ptr, "damping", 0, NULL, ICON_NONE);
}
static void foam_panel_draw_header(const bContext *C, Panel *panel)
@@ -592,14 +588,15 @@ static void foam_panel_draw(const bContext *C, Panel *panel)
bool use_foam = RNA_boolean_get(&ptr, "use_foam");
+ uiLayoutSetPropSep(layout, true);
+
col = uiLayoutColumn(layout, false);
uiLayoutSetActive(col, use_foam);
uiItemR(col, &ptr, "foam_coverage", 0, IFACE_("Coverage"), ICON_NONE);
col = uiLayoutColumn(layout, true);
uiLayoutSetActive(col, use_foam);
- uiItemL(col, IFACE_("Data Layer Name:"), ICON_NONE);
- uiItemR(col, &ptr, "foam_layer_name", 0, "", ICON_NONE);
+ uiItemR(col, &ptr, "foam_layer_name", 0, IFACE_("Data Layer"), ICON_NONE);
}
static void spectrum_panel_draw(const bContext *C, Panel *panel)
@@ -609,6 +606,8 @@ static void spectrum_panel_draw(const bContext *C, Panel *panel)
PointerRNA ptr;
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+ uiLayoutSetPropSep(layout, true);
+
int spectrum = RNA_enum_get(&ptr, "spectrum");
uiItemR(layout, &ptr, "spectrum", 0, NULL, ICON_NONE);
@@ -626,6 +625,8 @@ static void bake_panel_draw(const bContext *C, Panel *panel)
PointerRNA ptr;
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+ uiLayoutSetPropSep(layout, true);
+
bool is_cached = RNA_boolean_get(&ptr, "is_cached");
bool use_foam = RNA_boolean_get(&ptr, "use_foam");
@@ -645,7 +646,7 @@ static void bake_panel_draw(const bContext *C, Panel *panel)
uiItemO(layout, NULL, ICON_NONE, "OBJECT_OT_ocean_bake");
}
- uiItemR(layout, &ptr, "filepath", 0, "", ICON_NONE);
+ uiItemR(layout, &ptr, "filepath", 0, NULL, ICON_NONE);
col = uiLayoutColumn(layout, true);
uiLayoutSetEnabled(col, !is_cached);
@@ -663,13 +664,12 @@ static void panelRegister(ARegionType *region_type)
PanelType *panel_type = modifier_panel_register(region_type, "Ocean", panel_draw);
#ifdef WITH_OCEANSIM
modifier_subpanel_register(
- region_type, "ocean_waves", "Waves", NULL, waves_panel_draw, false, panel_type);
- modifier_subpanel_register(
- region_type, "ocean_foam", "", foam_panel_draw_header, foam_panel_draw, false, panel_type);
+ region_type, "ocean_waves", "Waves", NULL, waves_panel_draw, panel_type);
modifier_subpanel_register(
- region_type, "ocean_spectrum", "Spectrum", NULL, spectrum_panel_draw, false, panel_type);
+ region_type, "ocean_foam", "", foam_panel_draw_header, foam_panel_draw, panel_type);
modifier_subpanel_register(
- region_type, "ocean_bake", "Bake", NULL, bake_panel_draw, false, panel_type);
+ region_type, "ocean_spectrum", "Spectrum", NULL, spectrum_panel_draw, panel_type);
+ modifier_subpanel_register(region_type, "ocean_bake", "Bake", NULL, bake_panel_draw, panel_type);
#endif /* WITH_OCEANSIM */
}
diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c
index 502b45df22b..0cf4f94463e 100644
--- a/source/blender/modifiers/intern/MOD_remesh.c
+++ b/source/blender/modifiers/intern/MOD_remesh.c
@@ -243,6 +243,8 @@ static void panel_draw(const bContext *C, Panel *panel)
int mode = RNA_enum_get(&ptr, "mode");
+ uiLayoutSetPropSep(layout, true);
+
uiItemR(layout, &ptr, "mode", 0, NULL, ICON_NONE);
if (mode == MOD_REMESH_VOXEL) {
More information about the Bf-blender-cvs
mailing list