diff options
Diffstat (limited to 'source/blender/modifiers/intern/MOD_mask.cc')
-rw-r--r-- | source/blender/modifiers/intern/MOD_mask.cc | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/source/blender/modifiers/intern/MOD_mask.cc b/source/blender/modifiers/intern/MOD_mask.cc index 18b88864926..c6de980d674 100644 --- a/source/blender/modifiers/intern/MOD_mask.cc +++ b/source/blender/modifiers/intern/MOD_mask.cc @@ -28,23 +28,39 @@ #include "BLI_ghash.h" #include "BLI_listbase.h" +#include "BLT_translation.h" + #include "DNA_armature_types.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" #include "BKE_action.h" /* BKE_pose_channel_find_name */ +#include "BKE_context.h" #include "BKE_customdata.h" #include "BKE_deform.h" #include "BKE_lib_query.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +/* SpaceType struct has a member called 'new' which obviously conflicts with C++ + * so temporarily redefining the new keyword to make it compile. */ +#define new extern_new +#include "BKE_screen.h" +#undef new + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_query.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "BLI_array.hh" #include "BLI_listbase_wrapper.hh" @@ -387,6 +403,42 @@ static bool isDisabled(const struct Scene *UNUSED(scene), return mmd->ob_arm && mmd->ob_arm->type != OB_ARMATURE; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *sub, *row; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + int mode = RNA_enum_get(&ptr, "mode"); + + uiItemR(layout, &ptr, "mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + + uiLayoutSetPropSep(layout, true); + + if (mode == MOD_MASK_MODE_ARM) { + row = uiLayoutRow(layout, true); + uiItemR(row, &ptr, "armature", 0, NULL, ICON_NONE); + sub = uiLayoutRow(row, true); + uiLayoutSetPropDecorate(sub, false); + uiItemR(sub, &ptr, "invert_vertex_group", 0, "", ICON_ARROW_LEFTRIGHT); + } + else if (mode == MOD_MASK_MODE_VGROUP) { + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", nullptr); + } + + uiItemR(layout, &ptr, "threshold", 0, NULL, ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Mask, panel_draw); +} + ModifierTypeInfo modifierType_Mask = { /* name */ "Mask", /* structName */ "MaskModifierData", @@ -418,4 +470,5 @@ ModifierTypeInfo modifierType_Mask = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; |