From 967fb3ae4ccb30a4c21b04efc92ef88f955d847c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 7 Mar 2025 18:13:20 +0100 Subject: [PATCH 1/2] Fix: Grease Pencil: Crash running operators that require a 3D viewport Correct the poll functions for reproject & texture gradient. Pull Request: https://projects.blender.org/blender/blender/pulls/135618 --- .../editors/grease_pencil/intern/grease_pencil_edit.cc | 4 ++-- .../editors/grease_pencil/intern/grease_pencil_ops.cc | 5 +++++ source/blender/editors/include/ED_grease_pencil.hh | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/grease_pencil/intern/grease_pencil_edit.cc b/source/blender/editors/grease_pencil/intern/grease_pencil_edit.cc index 3db85737a83..d1faf91ecbb 100644 --- a/source/blender/editors/grease_pencil/intern/grease_pencil_edit.cc +++ b/source/blender/editors/grease_pencil/intern/grease_pencil_edit.cc @@ -3416,7 +3416,7 @@ static void GREASE_PENCIL_OT_reproject(wmOperatorType *ot) /* callbacks */ ot->invoke = WM_menu_invoke; ot->exec = grease_pencil_reproject_exec; - ot->poll = editable_grease_pencil_poll; + ot->poll = editable_grease_pencil_with_region_view3d_poll; ot->ui = grease_pencil_reproject_ui; /* flags */ @@ -3880,7 +3880,7 @@ static void GREASE_PENCIL_OT_texture_gradient(wmOperatorType *ot) ot->invoke = grease_pencil_texture_gradient_invoke; ot->modal = grease_pencil_texture_gradient_modal; ot->exec = grease_pencil_texture_gradient_exec; - ot->poll = editable_grease_pencil_poll; + ot->poll = editable_grease_pencil_with_region_view3d_poll; ot->cancel = WM_gesture_straightline_cancel; /* Flags. */ diff --git a/source/blender/editors/grease_pencil/intern/grease_pencil_ops.cc b/source/blender/editors/grease_pencil/intern/grease_pencil_ops.cc index 4ea203d3e68..f8952c36104 100644 --- a/source/blender/editors/grease_pencil/intern/grease_pencil_ops.cc +++ b/source/blender/editors/grease_pencil/intern/grease_pencil_ops.cc @@ -64,6 +64,11 @@ bool editable_grease_pencil_poll(bContext *C) return true; } +bool editable_grease_pencil_with_region_view3d_poll(bContext *C) +{ + return ED_operator_region_view3d_active(C) && editable_grease_pencil_poll(C); +} + bool active_grease_pencil_layer_poll(bContext *C) { const GreasePencil *grease_pencil = blender::ed::greasepencil::from_context(*C); diff --git a/source/blender/editors/include/ED_grease_pencil.hh b/source/blender/editors/include/ED_grease_pencil.hh index c0f88af2c5c..1441d9c40bd 100644 --- a/source/blender/editors/include/ED_grease_pencil.hh +++ b/source/blender/editors/include/ED_grease_pencil.hh @@ -317,6 +317,7 @@ bool grease_pencil_context_poll(bContext *C); bool active_grease_pencil_poll(bContext *C); bool active_grease_pencil_material_poll(bContext *C); bool editable_grease_pencil_poll(bContext *C); +bool editable_grease_pencil_with_region_view3d_poll(bContext *C); bool active_grease_pencil_layer_poll(bContext *C); bool editable_grease_pencil_point_selection_poll(bContext *C); bool grease_pencil_selection_poll(bContext *C); From 3f87120ccf28d2c4c6726b4b0cbd21433d49303d Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 7 Mar 2025 18:46:53 +0100 Subject: [PATCH 2/2] Fix #135633: Freeze/crash using a specific Geometry Node group as modifier `interface_input_index` was called for an output socket. Also filter out inputs that aren't exposed in the modifier, similar to a few lines above. Pull Request: https://projects.blender.org/blender/blender/pulls/135641 --- source/blender/modifiers/intern/MOD_nodes.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index fdd4df0059e..f5c44147e0d 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -2258,6 +2258,12 @@ static bool interface_panel_affects_output(DrawGroupInputsContext &ctx, for (const bNodeTreeInterfaceItem *item : panel.items()) { if (item->item_type == NODE_INTERFACE_SOCKET) { const auto &socket = *reinterpret_cast(item); + if (socket.flag & NODE_INTERFACE_SOCKET_HIDE_IN_MODIFIER) { + continue; + } + if (!(socket.flag & NODE_INTERFACE_SOCKET_INPUT)) { + continue; + } const int input_index = ctx.nmd.node_group->interface_input_index(socket); if (ctx.input_usages[input_index]) { return true;