[Bf-blender-cvs] [6e7873e54a1] modifier-panels-ui: Implement panels for remaining modifiers
Hans Goudey
noreply at git.blender.org
Thu Apr 2 16:58:54 CEST 2020
Commit: 6e7873e54a12e2c2d9ba7dcefd0a2f1fdbb2ed40
Author: Hans Goudey
Date: Wed Apr 1 11:41:05 2020 -0500
Branches: modifier-panels-ui
https://developer.blender.org/rB6e7873e54a12e2c2d9ba7dcefd0a2f1fdbb2ed40
Implement panels for remaining modifiers
===================================================================
M source/blender/modifiers/intern/MOD_weightvg_util.c
M source/blender/modifiers/intern/MOD_weightvg_util.h
M source/blender/modifiers/intern/MOD_weightvgedit.c
M source/blender/modifiers/intern/MOD_weightvgmix.c
M source/blender/modifiers/intern/MOD_weightvgproximity.c
M source/blender/modifiers/intern/MOD_weld.c
M source/blender/modifiers/intern/MOD_wireframe.c
===================================================================
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index f1023acde26..057e7189578 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -36,8 +36,8 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "BKE_context.h"
#include "BKE_colortools.h" /* CurveMapping. */
+#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_deform.h"
#include "BKE_modifier.h"
@@ -309,20 +309,16 @@ void weightvg_update_vg(MDeformVert *dvert,
/* Common vertex weight mask interface elements for the modifier panels.
*/
-void weightvg_ui_common(bContext *C, PointerRNA *ob_ptr, PointerRNA *ptr, uiLayout *layout)
+void weightvg_ui_common(const bContext *C, PointerRNA *ob_ptr, PointerRNA *ptr, uiLayout *layout)
{
- uiLayout *sub, *row, *col, *split;
+ uiLayout *sub, *row, *split;
PointerRNA mask_texture_ptr = RNA_pointer_get(ptr, "mask_texture");
bool has_mask_texture = !RNA_pointer_is_null(&mask_texture_ptr);
bool has_mask_vertex_group = RNA_string_length(ptr, "mask_vertex_group") != 0;
int mask_tex_mapping = RNA_enum_get(ptr, "mask_tex_mapping");
- uiItemL(layout, IFACE_("Influence/Mask Options:"), ICON_NONE);
-
- split = uiLayoutSplit(layout, 0.4f, false);
- uiItemL(split, IFACE_("Global Influence:"), ICON_NONE);
- uiItemR(split, ptr, "mask_constant", 0, "", ICON_NONE);
+ uiItemR(layout, ptr, "mask_constant", UI_ITEM_R_SLIDER, IFACE_("Global Influence:"), ICON_NONE);
if (!has_mask_texture) {
split = uiLayoutSplit(layout, 0.4f, false);
@@ -335,26 +331,22 @@ void weightvg_ui_common(bContext *C, PointerRNA *ob_ptr, PointerRNA *ptr, uiLayo
}
if (!has_mask_vertex_group) {
- split = uiLayoutSplit(layout, 0.5f, false);
- uiItemL(split, IFACE_("Texture Mask:"), ICON_NONE);
- uiTemplateID(split, C, ptr, "mask_texture", "texture.new", NULL, NULL, 0, ICON_NONE, NULL);
+ uiItemL(layout, IFACE_("Mask Texture:"), ICON_NONE);
+ row = uiLayoutRow(layout, true);
+ uiTemplateID(row, C, ptr, "mask_texture", "texture.new", NULL, NULL, 0, ICON_NONE, "");
if (has_mask_texture) {
- split = uiLayoutSplit(layout, 0.5f, false);
- col = uiLayoutColumn(split, false);
- uiItemL(col, IFACE_("Texture Coordinate:"), ICON_NONE);
- uiItemR(col, ptr, "mask_tex_mapping", 0, "", ICON_NONE);
-
- col = uiLayoutColumn(split, false);
- uiItemL(col, IFACE_("Use Channel:"), ICON_NONE);
- uiItemR(col, ptr, "mask_tex_use_channel", 0, "", ICON_NONE);
+ uiItemR(layout, ptr, "mask_tex_use_channel", 0, IFACE_("Channel"), ICON_NONE);
+ uiItemL(layout, IFACE_("Texture Coordinates:"), ICON_NONE);
+ uiItemR(layout, ptr, "mask_tex_mapping", 0, "", ICON_NONE);
if (mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
uiItemR(layout, ptr, "mask_tex_map_object", 0, IFACE_("Object"), ICON_NONE);
}
else if (mask_tex_mapping == MOD_DISP_MAP_UV && RNA_enum_get(ob_ptr, "type") == OB_MESH) {
PointerRNA obj_data_ptr = RNA_pointer_get(ob_ptr, "data");
- uiItemPointerR(col, ptr, "mask_tex_uv_layer", &obj_data_ptr, "uv_layers", NULL, ICON_NONE);
+ uiItemPointerR(
+ layout, ptr, "mask_tex_uv_layer", &obj_data_ptr, "uv_layers", NULL, ICON_NONE);
}
}
}
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.h b/source/blender/modifiers/intern/MOD_weightvg_util.h
index 3cb4b2d18ac..e29cf079e58 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.h
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.h
@@ -89,5 +89,5 @@ void weightvg_update_vg(struct MDeformVert *dvert,
const bool do_rem,
const float rem_thresh);
-void weightvg_ui_common(bContext *C, PointerRNA *ob_ptr, PointerRNA *ptr, uiLayout *layout);
+void weightvg_ui_common(const bContext *C, PointerRNA *ob_ptr, PointerRNA *ptr, uiLayout *layout);
#endif /* __MOD_WEIGHTVG_UTIL_H__ */
diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c
index 2561bb6bf16..05c1c5b68ab 100644
--- a/source/blender/modifiers/intern/MOD_weightvgedit.c
+++ b/source/blender/modifiers/intern/MOD_weightvgedit.c
@@ -34,12 +34,14 @@
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
+#include "DNA_screen_types.h"
#include "BKE_colortools.h" /* CurveMapping. */
#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_lib_query.h"
#include "BKE_modifier.h"
+#include "BKE_screen.h"
#include "BKE_texture.h" /* Texture masking. */
#include "UI_interface.h"
@@ -53,6 +55,7 @@
#include "MEM_guardedalloc.h"
#include "MOD_modifiertypes.h"
+#include "MOD_ui_common.h"
#include "MOD_weightvg_util.h"
/**************************************
@@ -300,34 +303,79 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
return mesh;
}
-// uiLayout *sub, *col, *split;
+static void panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *sub, *col, *row;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ PointerRNA ob_ptr;
+ modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
-// split = uiLayoutSplit(layout, 0.5f, true);
-// col = uiLayoutColumn(split, false);
-// uiItemL(col, IFACE_("Vertex Group:"), ICON_NONE);
-// uiItemPointerR(col, ptr, "vertex_group", ob_ptr, "vertex_groups", "", ICON_NONE);
-// uiItemL(col, IFACE_("Default Weight:"), ICON_NONE);
-// uiItemR(col, ptr, "default_weight", 0, "", ICON_NONE);
+ col = uiLayoutColumn(layout, true);
+ uiItemL(col, IFACE_("Vertex Group:"), ICON_NONE);
+ uiItemPointerR(col, &ptr, "vertex_group", &ob_ptr, "vertex_groups", "", ICON_NONE);
-// col = uiLayoutColumn(split, false);
-// uiItemR(col, ptr, "use_add", 0, NULL, ICON_NONE);
-// sub = uiLayoutColumn(col, false);
-// uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_add"));
-// uiItemR(col, ptr, "add_threshold", 0, NULL, ICON_NONE);
-// uiItemR(col, ptr, "use_remove", 0, NULL, ICON_NONE);
-// sub = uiLayoutColumn(col, false);
-// uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_remove"));
-// uiItemR(col, ptr, "remove_threshold", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "default_weight", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
-// uiItemS(layout);
+ row = uiLayoutRow(layout, false);
+ uiItemR(row, &ptr, "use_add", 0, NULL, ICON_NONE);
+ sub = uiLayoutColumn(row, false);
+ uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_add"));
+ uiItemR(sub, &ptr, "add_threshold", 0, IFACE_("Threshold"), ICON_NONE);
-// uiItemR(layout, ptr, "falloff_type", 0, NULL, ICON_NONE);
-// if (RNA_enum_get(ptr, "falloff_type") == MOD_WVG_MAPPING_CURVE) {
-// uiTemplateCurveMapping(layout, ptr, "map_curve", 0, false, false, false, false);
-// }
+ row = uiLayoutRow(layout, false);
+ uiItemR(row, &ptr, "use_remove", 0, NULL, ICON_NONE);
+ sub = uiLayoutColumn(row, false);
+ uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_remove"));
+ uiItemR(sub, &ptr, "remove_threshold", 0, IFACE_("Threshold"), ICON_NONE);
-// uiItemS(layout);
-// weightvg_ui_common(C, ob_ptr, ptr, layout);
+ modifier_panel_end(layout, &ptr);
+}
+
+static void falloff_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);
+
+ uiItemR(layout, &ptr, "falloff_type", 0, NULL, ICON_NONE);
+ if (RNA_enum_get(&ptr, "falloff_type") == MOD_WVG_MAPPING_CURVE) {
+ uiTemplateCurveMapping(layout, &ptr, "map_curve", 0, false, false, false, false);
+ }
+}
+
+static void influence_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);
+
+ weightvg_ui_common(C, &ob_ptr, &ptr, layout);
+}
+
+static void panelRegister(ARegionType *region_type)
+{
+ PanelType *panel_type = modifier_panel_register(region_type, "VertexWeightEdit", panel_draw);
+ modifier_subpanel_register(region_type,
+ "vertexweightedit_falloff",
+ "Falloff",
+ NULL,
+ falloff_panel_draw,
+ false,
+ panel_type);
+ modifier_subpanel_register(region_type,
+ "vertexweightedit_influence",
+ "Influence",
+ NULL,
+ influence_panel_draw,
+ false,
+ panel_type);
+}
ModifierTypeInfo modifierType_WeightVGEdit = {
/* name */ "VertexWeightEdit",
@@ -356,5 +404,5 @@ ModifierTypeInfo modifierType_WeightVGEdit = {
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ foreachTexLink,
/* freeRuntimeData */ NULL,
- /* panelRegister */ NULL,
+ /* panelRegister */ panelRegister,
};
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c
index df9de00fce7..959fd73a1c4 100644
--- a/source/blender/modifiers/intern/MOD_weightvgmix.c
+++ b/source/blender/modifiers/intern/MOD_weightvgmix.c
@@ -32,12 +32,14 @@
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
+#include "DNA_screen_types.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_deform.h"
#include "BKE_lib_query.h"
#include "BKE_modifier.h"
+#include "BKE_screen.h"
#include "BKE_texture.h" /* Texture masking. */
#include "UI_interface.h"
@@ -51,6 +53,7 @@
#include "MEM_guardedalloc.h"
#include "MOD_modifiertypes.h"
+#include "MOD_ui_common.h"
#include "MOD_weightvg_util.h"
/**
@@ -430,27 +433,62 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
return mesh;
}
-// uiLayout *col, *split;
+static void panel_draw(const bContext *C, Panel *panel)
+{
+ uiLayout *col, *split, *sub;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA ptr;
+ Pointer
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list