Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-06-17 03:01:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-06-17 03:02:54 +0300
commit8c22d31dccd47102d618dce605c6d5f490575b91 (patch)
treee939f22bc412891a0ced6ca471fe4f89eabce75d /source/blender/windowmanager/manipulators/intern/wm_manipulator.c
parent71b70b23b36008b4ac03001b7e691a0189b4d158 (diff)
Manipulator: remove type specific 'new' functions
Instead use generic 'WM_manipulator_new', adding a new 'setup' callback (like wmManipulatorGroup.setup) used to initialize type vars. This moves conventions closer to wmOperator and simplifies exposing to Python.
Diffstat (limited to 'source/blender/windowmanager/manipulators/intern/wm_manipulator.c')
-rw-r--r--source/blender/windowmanager/manipulators/intern/wm_manipulator.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
index b71cfdb15cf..f24bdb6e697 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
@@ -66,22 +66,26 @@ static void wm_manipulator_register(
* \note Follow #wm_operator_create convention.
*/
static wmManipulator *wm_manipulator_create(
- const wmManipulatorType *mpt)
+ const wmManipulatorType *wt)
{
- BLI_assert(mpt != NULL);
- BLI_assert(mpt->struct_size >= sizeof(wmManipulator));
+ BLI_assert(wt != NULL);
+ BLI_assert(wt->struct_size >= sizeof(wmManipulator));
- wmManipulator *mpr = MEM_callocN(mpt->struct_size, __func__);
- mpr->type = mpt;
+ wmManipulator *mpr = MEM_callocN(wt->struct_size, __func__);
+ mpr->type = wt;
return mpr;
}
-wmManipulator *WM_manipulator_new_ptr(const wmManipulatorType *mpt, wmManipulatorGroup *mgroup, const char *name)
+wmManipulator *WM_manipulator_new_ptr(const wmManipulatorType *wt, wmManipulatorGroup *mgroup, const char *name)
{
- wmManipulator *mpr = wm_manipulator_create(mpt);
+ wmManipulator *mpr = wm_manipulator_create(wt);
wm_manipulator_register(mgroup, mpr, name);
+ if (mpr->type->setup != NULL) {
+ mpr->type->setup(mpr);
+ }
+
return mpr;
}
@@ -93,11 +97,7 @@ wmManipulator *WM_manipulator_new_ptr(const wmManipulatorType *mpt, wmManipulato
wmManipulator *WM_manipulator_new(const char *idname, wmManipulatorGroup *mgroup, const char *name)
{
const wmManipulatorType *wt = WM_manipulatortype_find(idname, false);
- wmManipulator *mpr = wm_manipulator_create(wt);
-
- wm_manipulator_register(mgroup, mpr, name);
-
- return mpr;
+ return WM_manipulator_new_ptr(wt, mgroup, name);
}
/**