diff options
Diffstat (limited to 'source/blender/windowmanager/manipulators/intern/manipulator_library/arrow2d_manipulator.c')
-rw-r--r-- | source/blender/windowmanager/manipulators/intern/manipulator_library/arrow2d_manipulator.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow2d_manipulator.c b/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow2d_manipulator.c index 106e1f97990..0cec342dd06 100644 --- a/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow2d_manipulator.c +++ b/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow2d_manipulator.c @@ -55,6 +55,7 @@ #include "WM_types.h" /* own includes */ +#include "WM_manipulator_api.h" #include "WM_manipulator_types.h" #include "wm_manipulator_wmapi.h" #include "WM_manipulator_library.h" @@ -191,21 +192,14 @@ static int manipulator_arrow2d_intersect( struct wmManipulator *MANIPULATOR_arrow2d_new(wmManipulatorGroup *mgroup, const char *name) { - ArrowManipulator2D *arrow = MEM_callocN(sizeof(ArrowManipulator2D), __func__); - - arrow->manipulator.type.draw = manipulator_arrow2d_draw; - arrow->manipulator.type.invoke = manipulator_arrow2d_invoke; -// arrow->manipulator.type.bind_to_prop = manipulator_arrow2d_bind_to_prop; -// arrow->manipulator.type.handler = manipulator_arrow2d_handler; - arrow->manipulator.type.intersect = manipulator_arrow2d_intersect; -// arrow->manipulator.type.exit = manipulator_arrow2d_exit; + const wmManipulatorType *mpt = WM_manipulatortype_find("MANIPULATOR_WT_arrow_2d", false); + ArrowManipulator2D *arrow = (ArrowManipulator2D *)WM_manipulator_new(mpt, mgroup, name); + arrow->manipulator.flag |= WM_MANIPULATOR_DRAW_ACTIVE; arrow->line_len = 1.0f; - wm_manipulator_register(mgroup, &arrow->manipulator, name); - - return (struct wmManipulator *)arrow; + return &arrow->manipulator; } void MANIPULATOR_arrow2d_set_angle(struct wmManipulator *manipulator, const float angle) @@ -220,6 +214,24 @@ void MANIPULATOR_arrow2d_set_line_len(struct wmManipulator *manipulator, const f arrow->line_len = len; } +static void MANIPULATOR_WT_arrow_2d(wmManipulatorType *wt) +{ + /* identifiers */ + wt->idname = "MANIPULATOR_WT_arrow_2d"; + + /* api callbacks */ + wt->draw = manipulator_arrow2d_draw; + wt->invoke = manipulator_arrow2d_invoke; + wt->intersect = manipulator_arrow2d_intersect; + + wt->size = sizeof(ArrowManipulator2D); +} + +void ED_manipulatortypes_arrow_2d(void) +{ + WM_manipulatortype_append(MANIPULATOR_WT_arrow_2d); +} + /** \} */ /* Arrow Manipulator API */ |