diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-06-15 13:48:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-06-15 13:56:22 +0300 |
commit | 830df9b33d3e2afdf3bb23b469378899c34fda78 (patch) | |
tree | 4f2fad8cdd48937e28d2c45115476c9045e4525b /source/blender/editors/transform/transform_manipulator.c | |
parent | 1a7099f3ecf52fa8a54c2ba3f652d5827ca9103c (diff) |
Updates to manipulator API
While this is work-in-progress from custom-manipulators branch
its stable so adding into 2.8 so we don't get too much out of sync.
- ManipulatorGroupType's are moved out of the manipulator-map and are now
global (like operators, panels etc) and added into spaces as needed.
Without this all operators that might ever use a manipulator in the 3D
view would be polling the viewport.
- Add optional get/set callbacks for non-RNA properties
Needed so re-usable manipulators can control values that
don't correspond to a single properly or need conversion.
- Fix divide by zero bug in arrow manipulator (when moving zero pixels).
Diffstat (limited to 'source/blender/editors/transform/transform_manipulator.c')
-rw-r--r-- | source/blender/editors/transform/transform_manipulator.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index eee9919efd4..bd470bd08d9 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -39,7 +39,6 @@ #include "DNA_curve_types.h" #include "DNA_gpencil_types.h" #include "DNA_lattice_types.h" -#include "DNA_manipulator_types.h" #include "DNA_meta_types.h" #include "DNA_screen_types.h" #include "DNA_scene_types.h" @@ -1134,7 +1133,7 @@ static void manipulator_modal( ED_region_tag_redraw(ar); } -static void WIDGETGROUP_manipulator_init(const bContext *UNUSED(C), wmManipulatorGroup *mgroup) +static void WIDGETGROUP_manipulator_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup) { ManipulatorGroup *man = manipulatorgroup_init(mgroup); mgroup->customdata = man; @@ -1345,12 +1344,14 @@ void TRANSFORM_WGT_manipulator(wmManipulatorGroupType *wgt) wgt->name = "Transform Manipulator"; wgt->idname = "TRANSFORM_WGT_manipulator"; + wgt->flag |= (WM_MANIPULATORGROUPTYPE_PERSISTENT | + WM_MANIPULATORGROUPTYPE_3D | + WM_MANIPULATORGROUPTYPE_SCALE_3D); + wgt->poll = WIDGETGROUP_manipulator_poll; - wgt->setup = WIDGETGROUP_manipulator_init; + wgt->setup = WIDGETGROUP_manipulator_setup; wgt->refresh = WIDGETGROUP_manipulator_refresh; wgt->draw_prepare = WIDGETGROUP_manipulator_draw_prepare; - - wgt->flag |= (WM_MANIPULATORGROUPTYPE_3D | WM_MANIPULATORGROUPTYPE_SCALE_3D); } @@ -1365,7 +1366,7 @@ static void WIDGETGROUP_object_manipulator_init(const bContext *C, wmManipulator ob->mgroup = mgroup; } - WIDGETGROUP_manipulator_init(C, mgroup); + WIDGETGROUP_manipulator_setup(C, mgroup); } static bool WIDGETGROUP_object_manipulator_poll(const bContext *C, wmManipulatorGroupType *wgt) |