Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_manipulator_3d.c
| Show First 20 Lines • Show All 1,277 Lines • ▼ Show 20 Lines | static void WIDGETGROUP_manipulator_setup(const bContext *C, wmManipulatorGroup *mgroup) | ||||
| } ot_store = {NULL}; | } ot_store = {NULL}; | ||||
| mgroup->customdata = man; | mgroup->customdata = man; | ||||
| { | { | ||||
| /* TODO: support mixing modes again? - it's supported but tool system makes it unobvious. */ | /* TODO: support mixing modes again? - it's supported but tool system makes it unobvious. */ | ||||
| man->twtype = 0; | man->twtype = 0; | ||||
| WorkSpace *workspace = CTX_wm_workspace(C); | WorkSpace *workspace = CTX_wm_workspace(C); | ||||
| Scene *scene = CTX_data_scene(C); | |||||
| ScrArea *sa = CTX_wm_area(C); | ScrArea *sa = CTX_wm_area(C); | ||||
| wmKeyMap *km = WM_keymap_find_all(C, workspace->tool.keymap, sa->spacetype, RGN_TYPE_WINDOW); | const bToolKey tkey = { | ||||
| .space_type = sa->spacetype, | |||||
| .mode = WM_toolsystem_mode_from_spacetype(workspace, scene, NULL, sa->spacetype), | |||||
| }; | |||||
| bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_find(workspace, &tkey); | |||||
| wmKeyMap *km = WM_keymap_find_all(C, tref_rt->keymap, sa->spacetype, RGN_TYPE_WINDOW); | |||||
| /* Weak, check first event */ | /* Weak, check first event */ | ||||
| wmKeyMapItem *kmi = km ? km->items.first : NULL; | wmKeyMapItem *kmi = km ? km->items.first : NULL; | ||||
| if (kmi == NULL) { | if (kmi == NULL) { | ||||
| man->twtype |= V3D_MANIP_TRANSLATE | V3D_MANIP_ROTATE | V3D_MANIP_SCALE; | man->twtype |= V3D_MANIP_TRANSLATE | V3D_MANIP_ROTATE | V3D_MANIP_SCALE; | ||||
| } | } | ||||
| else if (STREQ(kmi->idname, "TRANSFORM_OT_translate")) { | else if (STREQ(kmi->idname, "TRANSFORM_OT_translate")) { | ||||
| man->twtype |= V3D_MANIP_TRANSLATE; | man->twtype |= V3D_MANIP_TRANSLATE; | ||||
| ▲ Show 20 Lines • Show All 251 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| /* it's a given we only use this in 3D view */ | /* it's a given we only use this in 3D view */ | ||||
| ScrArea *sa = CTX_wm_area(C); | ScrArea *sa = CTX_wm_area(C); | ||||
| View3D *v3d = sa->spacedata.first; | View3D *v3d = sa->spacedata.first; | ||||
| if (v3d && ((v3d->twflag & V3D_MANIPULATOR_DRAW)) == 0) { | if (v3d && ((v3d->twflag & V3D_MANIPULATOR_DRAW)) == 0) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| WorkSpace *workspace = CTX_wm_workspace(C); | bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext *)C); | ||||
| if (!STREQ(workspace->tool.manipulator_group, "TRANSFORM_WGT_manipulator")) { | if ((tref_rt == NULL) || | ||||
| !STREQ(wgt->idname, tref_rt->manipulator_group)) | |||||
| { | |||||
| WM_manipulator_group_type_unlink_delayed_ptr(wgt); | WM_manipulator_group_type_unlink_delayed_ptr(wgt); | ||||
| return false; | return false; | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| void TRANSFORM_WGT_manipulator(wmManipulatorGroupType *wgt) | void TRANSFORM_WGT_manipulator(wmManipulatorGroupType *wgt) | ||||
| { | { | ||||
| Show All 26 Lines | |||||
| static bool WIDGETGROUP_xform_cage_poll(const bContext *C, wmManipulatorGroupType *wgt) | static bool WIDGETGROUP_xform_cage_poll(const bContext *C, wmManipulatorGroupType *wgt) | ||||
| { | { | ||||
| ScrArea *sa = CTX_wm_area(C); | ScrArea *sa = CTX_wm_area(C); | ||||
| View3D *v3d = sa->spacedata.first; | View3D *v3d = sa->spacedata.first; | ||||
| if (v3d && ((v3d->twflag & V3D_MANIPULATOR_DRAW)) == 0) { | if (v3d && ((v3d->twflag & V3D_MANIPULATOR_DRAW)) == 0) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| WorkSpace *workspace = CTX_wm_workspace(C); | bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext *)C); | ||||
| if (!STREQ(wgt->idname, workspace->tool.manipulator_group)) { | if (!STREQ(wgt->idname, tref_rt->manipulator_group)) { | ||||
| WM_manipulator_group_type_unlink_delayed_ptr(wgt); | WM_manipulator_group_type_unlink_delayed_ptr(wgt); | ||||
| return false; | return false; | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| static void WIDGETGROUP_xform_cage_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup) | static void WIDGETGROUP_xform_cage_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 142 Lines • Show Last 20 Lines | |||||