diff --git a/source/blender/editors/object/object_modifier.cc b/source/blender/editors/object/object_modifier.cc index 448eb26aeed..d03ea86fa2b 100644 --- a/source/blender/editors/object/object_modifier.cc +++ b/source/blender/editors/object/object_modifier.cc @@ -628,7 +628,7 @@ bool modifier_copy_to_object(Main *bmain, return false; } - WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob_dst); + WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_ADDED, ob_dst); DEG_id_tag_update(&ob_dst->id, ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION); DEG_relations_tag_update(bmain); return true; @@ -1428,7 +1428,7 @@ static wmOperatorStatus modifier_add_exec(bContext *C, wmOperator *op) continue; } changed = true; - WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); + WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER | NA_ADDED, ob); } if (!changed) { return OPERATOR_CANCELLED; @@ -1709,7 +1709,7 @@ static wmOperatorStatus modifier_remove_exec(bContext *C, wmOperator *op) changed = true; - WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); + WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER | NA_REMOVED, ob); /* if cloth/softbody was removed, particle mode could be cleared */ if (mode_orig & OB_MODE_PARTICLE_EDIT) { @@ -2280,7 +2280,7 @@ static wmOperatorStatus modifier_copy_exec(bContext *C, wmOperator *op) changed = true; DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); DEG_relations_tag_update(bmain); - WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); + WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER | NA_ADDED, ob); } if (!changed) { diff --git a/source/blender/editors/space_node/node_context_path.cc b/source/blender/editors/space_node/node_context_path.cc index b97c640c7e1..f902862c3bf 100644 --- a/source/blender/editors/space_node/node_context_path.cc +++ b/source/blender/editors/space_node/node_context_path.cc @@ -19,6 +19,7 @@ #include "RNA_access.hh" #include "RNA_prototypes.hh" +#include "ED_node_c.hh" #include "ED_screen.hh" #include "SEQ_modifier.hh" @@ -90,6 +91,9 @@ static void context_path_add_node_tree_and_node_groups(const SpaceNode &snode, if (skip_base && path_item == snode.treepath.first) { continue; } + if (path_item->nodetree == nullptr) { + continue; + } int icon = ICON_NODETREE; if (ID_IS_PACKED(&path_item->nodetree->id)) { @@ -175,6 +179,7 @@ static void get_context_path_node_compositor(const bContext &C, context_path_add_node_tree_and_node_groups(snode, path); return; } + ui::context_path_add_generic(path, RNA_Scene, sequencer_scene, ICON_SCENE); Editing *ed = seq::editing_get(sequencer_scene); if (!ed) { context_path_add_node_tree_and_node_groups(snode, path); @@ -185,6 +190,7 @@ static void get_context_path_node_compositor(const bContext &C, context_path_add_node_tree_and_node_groups(snode, path); return; } + ui::context_path_add_generic(path, RNA_Strip, strip, ICON_SEQ_STRIP_DUPLICATE); StripModifierData *smd = seq::modifier_get_active(strip); if (!smd) { context_path_add_node_tree_and_node_groups(snode, path); @@ -200,8 +206,6 @@ static void get_context_path_node_compositor(const bContext &C, context_path_add_node_tree_and_node_groups(snode, path); return; } - ui::context_path_add_generic(path, RNA_Scene, sequencer_scene, ICON_SCENE); - ui::context_path_add_generic(path, RNA_Strip, strip, ICON_SEQ_STRIP_DUPLICATE); ui::context_path_add_generic(path, RNA_NodeTree, scmd->node_group); context_path_add_node_tree_and_node_groups(snode, path, true); } @@ -238,13 +242,13 @@ Vector context_path_for_space_node(const bContext &C) Vector context_path; - if (snode->edittree->type == NTREE_GEOMETRY) { + if (ED_node_is_geometry(snode)) { get_context_path_node_geometry(C, *snode, context_path); } - else if (snode->edittree->type == NTREE_SHADER) { + else if (ED_node_is_shader(snode)) { get_context_path_node_shader(C, *snode, context_path); } - else if (snode->edittree->type == NTREE_COMPOSIT) { + else if (ED_node_is_compositor(snode)) { get_context_path_node_compositor(C, *snode, context_path); } diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index daf2be96c89..c47456107d8 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -4996,7 +4996,7 @@ void node_draw_space(const bContext &C, ARegion ®ion) } /* Draw context path. */ - if (snode.overlay.flag & SN_OVERLAY_SHOW_PATH && snode.edittree) { + if (snode.overlay.flag & SN_OVERLAY_SHOW_PATH) { draw_tree_path(C, region); } } diff --git a/source/blender/editors/space_node/space_node.cc b/source/blender/editors/space_node/space_node.cc index bb58db9ad6d..60be672c387 100644 --- a/source/blender/editors/space_node/space_node.cc +++ b/source/blender/editors/space_node/space_node.cc @@ -760,11 +760,15 @@ static void node_area_listener(const wmSpaceTypeListenerParams *params) } } else if (ED_node_is_geometry(snode)) { - /* Rather strict check: only redraw when the reference matches the current editor's ID. */ if (wmn->data == ND_MODIFIER) { + /* Rather strict check: only redraw when the reference matches current editor's ID, */ if (wmn->reference == snode->id || snode->id == nullptr) { node_area_tag_tree_recalc(snode, area); } + /* Redraw context path if modifier was added or removed. */ + if (ELEM(wmn->action, NA_ADDED, NA_REMOVED)) { + ED_area_tag_redraw(area); + } } } break;