Manipulator: add free callback

This commit is contained in:
Campbell Barton 2018-01-15 16:06:56 +11:00
parent 129196dc32
commit 7c1286b2b7
3 changed files with 8 additions and 0 deletions

View File

@ -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;

View File

@ -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

View File

@ -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)(