[Bf-blender-cvs] [7c1286b2b76] blender2.8: Manipulator: add free callback
Campbell Barton
noreply at git.blender.org
Mon Jan 15 05:59:27 CET 2018
Commit: 7c1286b2b7651562e744d531a3c4a8b518b2a852
Author: Campbell Barton
Date: Mon Jan 15 16:06:56 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB7c1286b2b7651562e744d531a3c4a8b518b2a852
Manipulator: add free callback
===================================================================
M source/blender/windowmanager/manipulators/WM_manipulator_types.h
M source/blender/windowmanager/manipulators/intern/wm_manipulator.c
M source/blender/windowmanager/manipulators/wm_manipulator_fn.h
===================================================================
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)(
More information about the Bf-blender-cvs
mailing list