diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_modifier.h | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 15 |
2 files changed, 24 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index ad67ee290b0..e4cf7d44f05 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -28,6 +28,7 @@ extern "C" { #endif +struct ARegionType; struct BMEditMesh; struct CustomData_MeshMasks; struct DepsNodeHandle; @@ -351,13 +352,22 @@ typedef struct ModifierTypeInfo { * more like "ensure the data is freed". */ void (*freeRuntimeData)(void *runtime_data); + + /* Register the panel types for the modifier's UI. */ + void (*panelRegister)(struct ARegionType *region_type); } ModifierTypeInfo; +/* Used to find a modifier's panel type. */ +#define MODIFIER_TYPE_PANEL_PREFIX "MOD_PT_" + /* Initialize modifier's global data (type info and some common global storages). */ void BKE_modifier_init(void); const ModifierTypeInfo *BKE_modifier_get_info(ModifierType type); +/* For modifier UI panels. */ +void BKE_modifier_type_panel_id(ModifierType type, char *r_idname); + /* Modifier utility calls, do call through type pointer and return * default values if pointer is optional. */ diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 6b54a530034..324a9d3ccb0 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -116,6 +116,17 @@ const ModifierTypeInfo *BKE_modifier_get_info(ModifierType type) } } +/** + * Get the idname of the modifier type's panel, which was defined in the #panelRegister callback. + */ +void BKE_modifier_type_panel_id(ModifierType type, char *r_idname) +{ + const ModifierTypeInfo *mti = BKE_modifier_get_info(type); + + strcpy(r_idname, MODIFIER_TYPE_PANEL_PREFIX); + strcat(r_idname, mti->name); +} + /***/ ModifierData *BKE_modifier_new(int type) @@ -127,8 +138,9 @@ ModifierData *BKE_modifier_new(int type) BLI_strncpy(md->name, DATA_(mti->name), sizeof(md->name)); md->type = type; - md->mode = eModifierMode_Realtime | eModifierMode_Render | eModifierMode_Expanded; + md->mode = eModifierMode_Realtime | eModifierMode_Render; md->flag = eModifierFlag_OverrideLibrary_Local; + md->ui_expand_flag = 1; /* Only open the main panel at the beginning, not the subpanels. */ if (mti->flags & eModifierTypeFlag_EnableInEditmode) { md->mode |= eModifierMode_Editmode; @@ -342,6 +354,7 @@ void BKE_modifier_copydata_ex(ModifierData *md, ModifierData *target, const int target->mode = md->mode; target->flag = md->flag; + target->ui_expand_flag = md->ui_expand_flag; if (mti->copyData) { mti->copyData(md, target, flag); |