diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-01-15 08:06:56 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-01-15 08:06:56 +0300 |
commit | 7c1286b2b7651562e744d531a3c4a8b518b2a852 (patch) | |
tree | 089406793ab5d59ad38fc53936ab444d0bba8834 /source/blender/windowmanager/manipulators | |
parent | 129196dc32b9e67c7008a3b31ce6e2154f9811da (diff) |
Manipulator: add free callback
Diffstat (limited to 'source/blender/windowmanager/manipulators')
3 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_types.h b/source/blender/windowmanager/manipulators/WM_manipulator_types.h index f2c0a8e93d9..6d83f411db1 100644 --- a/source/blender/windowmanager/manipulators/WM_manipulator_types.h +++ b/source/blender/windowmanager/manipulators/WM_manipulator_types.h @@ -313,6 +313,9 @@ typedef struct wmManipulatorType { /* called when manipulator selection state changes */ wmManipulatorFnSelectRefresh select_refresh; + /* Free data (not the manipulator it's self), use when the manipulator allocates it's own members. */ + wmManipulatorFnFree free; + /* RNA for properties */ struct StructRNA *srna; diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c index 5190a4932b4..dff8d8b4e6c 100644 --- a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c +++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c @@ -166,6 +166,10 @@ static void wm_manipulator_register(wmManipulatorGroup *mgroup, wmManipulator *m */ void WM_manipulator_free(wmManipulator *mpr) { + if (mpr->type->free != NULL) { + mpr->type->free(mpr); + } + #ifdef WITH_PYTHON if (mpr->py_instance) { /* do this first in case there are any __del__ functions or diff --git a/source/blender/windowmanager/manipulators/wm_manipulator_fn.h b/source/blender/windowmanager/manipulators/wm_manipulator_fn.h index 7e163f8a785..305d04eab68 100644 --- a/source/blender/windowmanager/manipulators/wm_manipulator_fn.h +++ b/source/blender/windowmanager/manipulators/wm_manipulator_fn.h @@ -59,6 +59,7 @@ typedef int (*wmManipulatorFnInvoke)(struct bContext *, struct wmManipulator typedef void (*wmManipulatorFnExit)(struct bContext *, struct wmManipulator *, const bool); typedef int (*wmManipulatorFnCursorGet)(struct wmManipulator *); typedef void (*wmManipulatorFnSelectRefresh)(struct wmManipulator *); +typedef void (*wmManipulatorFnFree)(struct wmManipulator *); /* wmManipulatorProperty ('value' type defined by 'wmManipulatorProperty.data_type') */ typedef void (*wmManipulatorPropertyFnGet)( |