Tool System: per space/mode tool support
[blender.git] / source / blender / editors / space_view3d / view3d_manipulator_ruler.c
index 9f69a33861d7c6991e70d690d92a27d17da02938..d46673b48171cea9a52919bb36388a81c218abbc 100644 (file)
@@ -982,8 +982,10 @@ void VIEW3D_WT_ruler_item(wmManipulatorType *wt)
 
 static bool WIDGETGROUP_ruler_poll(const bContext *C, wmManipulatorGroupType *wgt)
 {
-       WorkSpace *workspace = CTX_wm_workspace(C);
-       if (!STREQ(wgt->idname, workspace->tool.manipulator_group)) {
+       bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext *)C);
+       if ((tref_rt == NULL) ||
+           !STREQ(wgt->idname, tref_rt->manipulator_group))
+       {
                WM_manipulator_group_type_unlink_delayed_ptr(wgt);
                return false;
        }
@@ -1030,8 +1032,9 @@ void VIEW3D_WGT_ruler(wmManipulatorGroupType *wgt)
 
 static int view3d_ruler_poll(bContext *C)
 {
-       WorkSpace *workspace = CTX_wm_workspace(C);
-       if (!STREQ(view3d_wgt_ruler_id, workspace->tool.manipulator_group) ||
+       bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext *)C);
+       if ((tref_rt == NULL) ||
+           !STREQ(view3d_wgt_ruler_id, tref_rt->manipulator_group) ||
            CTX_wm_region_view3d(C) == NULL)
        {
                return false;