diff --git a/scripts/presets/keyconfig/keymap_data/blender_default.py b/scripts/presets/keyconfig/keymap_data/blender_default.py index 8c42b6d6892..f47f4a6c935 100644 --- a/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -7931,7 +7931,7 @@ def km_3d_view_tool_paint_grease_pencil_primitive_line(params): "3D View Tool: Paint Grease Pencil, Line", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("grease_pencil.primitive_line", params.tool_maybe_tweak_event, + ("grease_pencil.primitive_line", {"type": 'LEFTMOUSE', "value": 'PRESS'}, {"properties": []}), ("grease_pencil.primitive_line", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, {"properties": []}), @@ -7965,7 +7965,7 @@ def km_3d_view_tool_paint_grease_pencil_primitive_box(params): "3D View Tool: Paint Grease Pencil, Box", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("grease_pencil.primitive_box", params.tool_maybe_tweak_event, + ("grease_pencil.primitive_box", {"type": 'LEFTMOUSE', "value": 'PRESS'}, {"properties": []}), ("grease_pencil.primitive_box", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, {"properties": []}), @@ -7983,7 +7983,7 @@ def km_3d_view_tool_paint_grease_pencil_primitive_circle(params): "3D View Tool: Paint Grease Pencil, Circle", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("grease_pencil.primitive_circle", params.tool_maybe_tweak_event, + ("grease_pencil.primitive_circle", {"type": 'LEFTMOUSE', "value": 'PRESS'}, {"properties": []}), ("grease_pencil.primitive_circle", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, {"properties": []}), @@ -8001,7 +8001,7 @@ def km_3d_view_tool_paint_grease_pencil_primitive_arc(params): "3D View Tool: Paint Grease Pencil, Arc", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("grease_pencil.primitive_arc", params.tool_maybe_tweak_event, + ("grease_pencil.primitive_arc", {"type": 'LEFTMOUSE', "value": 'PRESS'}, {"properties": []}), ("grease_pencil.primitive_arc", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, {"properties": []}), @@ -8019,7 +8019,7 @@ def km_3d_view_tool_paint_grease_pencil_primitive_curve(params): "3D View Tool: Paint Grease Pencil, Curve", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("grease_pencil.primitive_curve", params.tool_maybe_tweak_event, + ("grease_pencil.primitive_curve", {"type": 'LEFTMOUSE', "value": 'PRESS'}, {"properties": []}), # Lasso select ("grease_pencil.select_lasso", diff --git a/source/blender/editors/gpencil_legacy/annotate_paint.cc b/source/blender/editors/gpencil_legacy/annotate_paint.cc index 396f889ff43..74edffb1772 100644 --- a/source/blender/editors/gpencil_legacy/annotate_paint.cc +++ b/source/blender/editors/gpencil_legacy/annotate_paint.cc @@ -1464,7 +1464,7 @@ static tGPsdata *annotation_session_initpaint(bContext *C) tGPsdata *p = nullptr; /* create new context data */ - p = static_cast(MEM_callocN(sizeof(tGPsdata), "Annotation Drawing Data")); + p = MEM_new("Annotation Drawing Data"); /* Try to initialize context data * WARNING: This may not always succeed (e.g. using GP in an annotation-only context) @@ -1474,7 +1474,7 @@ static tGPsdata *annotation_session_initpaint(bContext *C) * NOTE: It should be safe to just free the data, since failing context checks should * only happen when no data has been allocated. */ - MEM_freeN(p); + MEM_delete(p); return nullptr; } @@ -1519,7 +1519,7 @@ static void annotation_session_free(tGPsdata *p) if (p->depths) { ED_view3d_depths_free(p->depths); } - MEM_freeN(p); + MEM_delete(p); } /* init new stroke */ diff --git a/source/blender/editors/sculpt_paint/grease_pencil_interpolate.cc b/source/blender/editors/sculpt_paint/grease_pencil_interpolate.cc index 42fdc0db236..cf42d03e154 100644 --- a/source/blender/editors/sculpt_paint/grease_pencil_interpolate.cc +++ b/source/blender/editors/sculpt_paint/grease_pencil_interpolate.cc @@ -287,10 +287,10 @@ static bool find_curve_mapping_from_index(const GreasePencil &grease_pencil, } /* Discard additional elements of the larger selection. */ if (from_selection.size() > to_selection.size()) { - from_selection.slice(0, to_selection.size()); + from_selection = from_selection.slice(0, to_selection.size()); } else if (to_selection.size() > from_selection.size()) { - to_selection.slice(0, from_selection.size()); + to_selection = to_selection.slice(0, from_selection.size()); } /* By default: copy the "from" curve and ignore the "to" curve. */ diff --git a/source/blender/geometry/intern/interpolate_curves.cc b/source/blender/geometry/intern/interpolate_curves.cc index 73b58bd4edb..b00795b2715 100644 --- a/source/blender/geometry/intern/interpolate_curves.cc +++ b/source/blender/geometry/intern/interpolate_curves.cc @@ -455,17 +455,24 @@ void interpolate_curves_with_samples(const CurvesGeometry &from_curves, CD_PROP_FLOAT2, CD_PROP_FLOAT3); if (can_mix_attribute && !src_from.is_empty() && !src_to.is_empty()) { + const int max_curves = std::min(dst_curve_mask.min_array_size(), + std::min(src_from.size(), src_to.size())); + const IndexMask safe_dst_curve_mask = dst_curve_mask.slice_content(0, max_curves); GArray<> from_samples(dst.type(), dst.size()); GArray<> to_samples(dst.type(), dst.size()); - array_utils::copy(GVArray::ForSpan(src_from), dst_curve_mask, from_samples); - array_utils::copy(GVArray::ForSpan(src_to), dst_curve_mask, to_samples); - mix_arrays(from_samples, to_samples, mix_factors, dst_curve_mask, dst); + array_utils::copy(GVArray::ForSpan(src_from), safe_dst_curve_mask, from_samples); + array_utils::copy(GVArray::ForSpan(src_to), safe_dst_curve_mask, to_samples); + mix_arrays(from_samples, to_samples, mix_factors, safe_dst_curve_mask, dst); } else if (!src_from.is_empty()) { - array_utils::copy(GVArray::ForSpan(src_from), dst_curve_mask, dst); + const int max_curves = std::min(dst_curve_mask.min_array_size(), src_from.size()); + const IndexMask safe_dst_curve_mask = dst_curve_mask.slice_content(0, max_curves); + array_utils::copy(GVArray::ForSpan(src_from), safe_dst_curve_mask, dst); } else if (!src_to.is_empty()) { - array_utils::copy(GVArray::ForSpan(src_to), dst_curve_mask, dst); + const int max_curves = std::min(dst_curve_mask.min_array_size(), src_to.size()); + const IndexMask safe_dst_curve_mask = dst_curve_mask.slice_content(0, max_curves); + array_utils::copy(GVArray::ForSpan(src_to), safe_dst_curve_mask, dst); } }