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:
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/manipulators/WM_manipulator_types.h3
-rw-r--r--source/blender/windowmanager/manipulators/intern/wm_manipulator.c24
-rw-r--r--source/blender/windowmanager/manipulators/wm_manipulator_fn.h2
3 files changed, 17 insertions, 12 deletions
diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_types.h b/source/blender/windowmanager/manipulators/WM_manipulator_types.h
index cc487dadca2..ec009a5e7a0 100644
--- a/source/blender/windowmanager/manipulators/WM_manipulator_types.h
+++ b/source/blender/windowmanager/manipulators/WM_manipulator_types.h
@@ -175,6 +175,9 @@ typedef struct wmManipulatorType {
* use so we can cant to other types without the hassle of a custom-data pointer. */
uint struct_size;
+ /* Initialize struct (calloc'd 'struct_size' region). */
+ wmManipulatorFnSetup setup;
+
/* draw manipulator */
wmManipulatorFnDraw draw;
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);
}
/**
diff --git a/source/blender/windowmanager/manipulators/wm_manipulator_fn.h b/source/blender/windowmanager/manipulators/wm_manipulator_fn.h
index 41e603fc521..90eaba74de1 100644
--- a/source/blender/windowmanager/manipulators/wm_manipulator_fn.h
+++ b/source/blender/windowmanager/manipulators/wm_manipulator_fn.h
@@ -45,6 +45,8 @@ typedef struct wmKeyMap *(*wmManipulatorGroupFnSetupKeymap)(
/* wmManipulator */
/* See: wmManipulatorType for docs on each type. */
+
+typedef void (*wmManipulatorFnSetup)(struct wmManipulator *);
typedef void (*wmManipulatorFnDraw)(const struct bContext *, struct wmManipulator *);
typedef void (*wmManipulatorFnDrawSelect)(const struct bContext *, struct wmManipulator *, int);
typedef int (*wmManipulatorFnTestSelect)(struct bContext *, struct wmManipulator *, const struct wmEvent *);