main sync #3

Merged
Patrick Busch merged 318 commits from blender/blender:main into main 2023-03-17 15:52:21 +01:00
Showing only changes of commit b79ad1f93f - Show all commits

View File

@ -1295,7 +1295,6 @@ static int view3d_ruler_add_invoke(bContext *C, wmOperator *op, const wmEvent *e
{ {
ARegion *region = CTX_wm_region(C); ARegion *region = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C); View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = region->regiondata;
if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)) { if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)) {
BKE_report(op->reports, RPT_WARNING, "Gizmos hidden in this view"); BKE_report(op->reports, RPT_WARNING, "Gizmos hidden in this view");
@ -1304,7 +1303,6 @@ static int view3d_ruler_add_invoke(bContext *C, wmOperator *op, const wmEvent *e
wmGizmoMap *gzmap = region->gizmo_map; wmGizmoMap *gzmap = region->gizmo_map;
wmGizmoGroup *gzgroup = WM_gizmomap_group_find(gzmap, view3d_gzgt_ruler_id); wmGizmoGroup *gzgroup = WM_gizmomap_group_find(gzmap, view3d_gzgt_ruler_id);
const bool use_depth = (v3d->shading.type >= OB_SOLID);
if (!gizmo_ruler_check_for_operator(gzgroup)) { if (!gizmo_ruler_check_for_operator(gzgroup)) {
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
@ -1324,9 +1322,7 @@ static int view3d_ruler_add_invoke(bContext *C, wmOperator *op, const wmEvent *e
OPERATOR_RUNNING_MODAL) { OPERATOR_RUNNING_MODAL) {
RulerInfo *ruler_info = gzgroup->customdata; RulerInfo *ruler_info = gzgroup->customdata;
RulerInteraction *inter = ruler_item->gz.interaction_data; RulerInteraction *inter = ruler_item->gz.interaction_data;
if (use_depth) {
struct Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); struct Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
/* snap the first point added, not essential but handy */
inter->co_index = 0; inter->co_index = 0;
view3d_ruler_item_mousemove(C, view3d_ruler_item_mousemove(C,
depsgraph, depsgraph,
@ -1343,12 +1339,6 @@ static int view3d_ruler_add_invoke(bContext *C, wmOperator *op, const wmEvent *e
RNA_property_float_set_array(ruler_info->snap_data.gizmo->ptr, RNA_property_float_set_array(ruler_info->snap_data.gizmo->ptr,
ruler_info->snap_data.prop_prevpoint, ruler_info->snap_data.prop_prevpoint,
inter->drag_start_co); inter->drag_start_co);
}
else {
negate_v3_v3(inter->drag_start_co, rv3d->ofs);
copy_v3_v3(ruler_item->co[0], inter->drag_start_co);
view3d_ruler_item_project(ruler_info, ruler_item->co[0], mval);
}
copy_v3_v3(ruler_item->co[2], ruler_item->co[0]); copy_v3_v3(ruler_item->co[2], ruler_item->co[0]);
ruler_item->gz.highlight_part = inter->co_index = 2; ruler_item->gz.highlight_part = inter->co_index = 2;