Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/view3d_manipulator_ruler.c
| Show First 20 Lines • Show All 976 Lines • ▼ Show 20 Lines | |||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Ruler Manipulator Group | /** \name Ruler Manipulator Group | ||||
| * \{ */ | * \{ */ | ||||
| static bool WIDGETGROUP_ruler_poll(const bContext *C, wmManipulatorGroupType *wgt) | static bool WIDGETGROUP_ruler_poll(const bContext *C, wmManipulatorGroupType *wgt) | ||||
| { | { | ||||
| 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 ((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; | ||||
| } | } | ||||
| static void WIDGETGROUP_ruler_setup(const bContext *C, wmManipulatorGroup *mgroup) | static void WIDGETGROUP_ruler_setup(const bContext *C, wmManipulatorGroup *mgroup) | ||||
| { | { | ||||
| Show All 30 Lines | |||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Add Ruler Operator | /** \name Add Ruler Operator | ||||
| * \{ */ | * \{ */ | ||||
| static int view3d_ruler_poll(bContext *C) | static int view3d_ruler_poll(bContext *C) | ||||
| { | { | ||||
| WorkSpace *workspace = CTX_wm_workspace(C); | bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext *)C); | ||||
| if (!STREQ(view3d_wgt_ruler_id, workspace->tool.manipulator_group) || | if ((tref_rt == NULL) || | ||||
| !STREQ(view3d_wgt_ruler_id, tref_rt->manipulator_group) || | |||||
| CTX_wm_region_view3d(C) == NULL) | CTX_wm_region_view3d(C) == NULL) | ||||
| { | { | ||||
| return false; | return false; | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| static int view3d_ruler_add_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) | static int view3d_ruler_add_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) | ||||
| ▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines | |||||