Nodes: use BKE_main_ensure_invariants directly instead of ED_node_tree_propagate_change

`BKE_main_ensure_invariants` was added in 1fae5fd8f6. The older
`ED_node_tree_propagate_change` was already implemented as a thin wrapper around
`BKE_main_ensure_invariants`. This patch removes the wrapper and calls the more
general function directly.

A new overload of `BKE_main_ensure_invariants` is added for the common case when
only a single data-block has been modified.

Pull Request: https://projects.blender.org/blender/blender/pulls/133048
This commit is contained in:
Jacques Lucke
2025-01-14 16:26:54 +01:00
parent 476b7ded9e
commit 684fd4643a
33 changed files with 160 additions and 147 deletions

View File

@@ -36,3 +36,9 @@ struct ID;
*/
void BKE_main_ensure_invariants(Main &bmain,
std::optional<blender::Span<ID *>> modified_ids = std::nullopt);
/**
* Same as above but the calling code is less verbose in the common case when only a single
* data-block has been modified.
*/
void BKE_main_ensure_invariants(Main &bmain, ID &modified_id);

View File

@@ -68,3 +68,8 @@ void BKE_main_ensure_invariants(Main &bmain, const std::optional<blender::Span<I
{
propagate_node_tree_changes(bmain, modified_ids);
}
void BKE_main_ensure_invariants(Main &bmain, ID &modified_id)
{
BKE_main_ensure_invariants(bmain, {{&modified_id}});
}

View File

@@ -12,6 +12,7 @@
#include "BKE_attribute.hh"
#include "BKE_context.hh"
#include "BKE_curves.hh"
#include "BKE_main_invariants.hh"
#include "BKE_node_legacy_types.hh"
#include "BKE_node_runtime.hh"
@@ -88,7 +89,7 @@ void ensure_surface_deformation_node_exists(bContext &C, Object &curves_ob)
bNode *group_output = bke::node_add_static_node(&C, ntree, NODE_GROUP_OUTPUT);
bNode *deform_node = bke::node_add_static_node(&C, ntree, GEO_NODE_DEFORM_CURVES_ON_SURFACE);
ED_node_tree_propagate_change(*bmain, nmd.node_group);
BKE_main_ensure_invariants(*bmain, nmd.node_group->id);
bke::node_add_link(ntree,
group_input,
@@ -105,7 +106,7 @@ void ensure_surface_deformation_node_exists(bContext &C, Object &curves_ob)
group_output->location[0] = 200;
deform_node->location[0] = 0;
ED_node_tree_propagate_change(*bmain, nmd.node_group);
BKE_main_ensure_invariants(*bmain, nmd.node_group->id);
}
bke::CurvesGeometry primitive_random_sphere(const int curves_size, const int points_per_curve)

View File

@@ -93,23 +93,6 @@ void ED_node_post_apply_transform(bContext *C, bNodeTree *ntree);
void ED_node_set_active(
Main *bmain, SpaceNode *snode, bNodeTree *ntree, bNode *node, bool *r_active_texture_changed);
/**
* Call after one or more node trees have been changed and tagged accordingly.
*
* This function will make sure that other parts of Blender update accordingly. For example, if the
* node group interface changed, parent node groups have to be updated as well.
*
* Additionally, this will send notifiers and tag the depsgraph based on the changes. Depsgraph
* relation updates have to be triggered by the caller.
*
* \param bmain: Main whose data-blocks should be updated based on the changes.
* \param ntree: Under some circumstances the caller knows that only one node tree has
* changed since the last update. In this case the function may be able to skip scanning #bmain
* for other things that have to be changed. It may still scan #bmain if the interface of the
* node tree has changed.
*/
void ED_node_tree_propagate_change(Main &bmain, bNodeTree *ntree = nullptr);
/**
* \param scene_owner: is the owner of the job,
* we don't use it for anything else currently so could also be a void pointer,

View File

@@ -14,6 +14,7 @@
#include "BKE_lib_id.hh"
#include "BKE_lib_override.hh"
#include "BKE_main.hh"
#include "BKE_main_invariants.hh"
#include "BKE_packedFile.hh"
#include "BLI_string.h"
@@ -771,7 +772,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, nullptr);
DEG_relations_tag_update(bmain);
}
ED_node_tree_propagate_change(*CTX_data_main(C));
BKE_main_ensure_invariants(*CTX_data_main(C));
undo_push_label = "Make Single User";
}
break;

View File

@@ -7,6 +7,7 @@
*/
#include "BKE_context.hh"
#include "BKE_main_invariants.hh"
#include "BKE_node_tree_interface.hh"
#include "BKE_node_tree_update.hh"
@@ -157,7 +158,7 @@ class NodeSocketViewItem : public BasicTreeViewItem {
socket_.name = BLI_strdup(new_name.c_str());
nodetree_.tree_interface.tag_items_changed();
ED_node_tree_propagate_change(*CTX_data_main(&C), &nodetree_);
BKE_main_ensure_invariants(*CTX_data_main(&C), nodetree_.id);
ED_undo_push(&const_cast<bContext &>(C), new_name.c_str());
return true;
}
@@ -217,7 +218,7 @@ class NodePanelViewItem : public BasicTreeViewItem {
panel_.name = BLI_strdup(new_name.c_str());
nodetree_.tree_interface.tag_items_changed();
ED_node_tree_propagate_change(*CTX_data_main(&C), &nodetree_);
BKE_main_ensure_invariants(*CTX_data_main(&C), nodetree_.id);
return true;
}
StringRef get_rename_string() const override
@@ -395,7 +396,7 @@ bool NodeSocketDropTarget::on_drop(bContext *C, const DragInfo &drag_info) const
interface.move_item_to_parent(*drag_item, parent, index);
/* General update */
ED_node_tree_propagate_change(*CTX_data_main(C), &nodetree);
BKE_main_ensure_invariants(*CTX_data_main(C), nodetree.id);
ED_undo_push(C, "Insert node group item");
return true;
}
@@ -485,7 +486,7 @@ bool NodePanelDropTarget::on_drop(bContext *C, const DragInfo &drag_info) const
interface.move_item_to_parent(*drag_item, parent, index);
/* General update */
ED_node_tree_propagate_change(*CTX_data_main(C), &nodetree);
BKE_main_ensure_invariants(*CTX_data_main(C), nodetree.id);
ED_undo_push(C, "Insert node group item");
return true;
}

View File

@@ -58,6 +58,7 @@
#include "BKE_layer.hh"
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
#include "BKE_main_invariants.hh"
#include "BKE_material.hh"
#include "BKE_mball.hh"
#include "BKE_mesh.hh"
@@ -3802,7 +3803,7 @@ static int geometry_node_tree_copy_assign_exec(bContext *C, wmOperator * /*op*/)
nmd->node_group = new_tree;
id_us_min(&tree->id);
ED_node_tree_propagate_change(*bmain, new_tree);
BKE_main_ensure_invariants(*bmain);
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
DEG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);

View File

@@ -50,6 +50,7 @@
#include "BKE_lightprobe.h"
#include "BKE_linestyle.h"
#include "BKE_main.hh"
#include "BKE_main_invariants.hh"
#include "BKE_material.hh"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
@@ -1642,7 +1643,7 @@ static int render_view_add_exec(bContext *C, wmOperator * /*op*/)
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
BKE_ntree_update_tag_id_changed(bmain, &scene->id);
ED_node_tree_propagate_change(*bmain);
BKE_main_ensure_invariants(*bmain);
return OPERATOR_FINISHED;
}
@@ -1681,7 +1682,7 @@ static int render_view_remove_exec(bContext *C, wmOperator * /*op*/)
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
BKE_ntree_update_tag_id_changed(bmain, &scene->id);
ED_node_tree_propagate_change(*bmain);
BKE_main_ensure_invariants(*bmain);
return OPERATOR_FINISHED;
}
@@ -2835,7 +2836,7 @@ static int paste_material_exec(bContext *C, wmOperator *op)
/* There are some custom updates to the node tree above, better do a full update pass. */
BKE_ntree_update_tag_all(ma->nodetree);
ED_node_tree_propagate_change(*bmain);
BKE_main_ensure_invariants(*bmain);
DEG_id_tag_update(&ma->id, ID_RECALC_SYNC_TO_EVAL);
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma);

View File

@@ -31,6 +31,7 @@
#include "BKE_context.hh"
#include "BKE_icons.h"
#include "BKE_main.hh"
#include "BKE_main_invariants.hh"
#include "BKE_material.hh"
#include "BKE_paint.hh"
#include "BKE_scene.hh"
@@ -201,7 +202,7 @@ void ED_render_engine_changed(Main *bmain, const bool update_scene_data)
ntreeCompositUpdateRLayers(scene->nodetree);
}
}
ED_node_tree_propagate_change(*bmain);
BKE_main_ensure_invariants(*bmain);
/* Update #CacheFiles to ensure that procedurals are properly taken into account. */
LISTBASE_FOREACH (CacheFile *, cachefile, &bmain->cachefiles) {

View File

@@ -63,6 +63,7 @@
#include "BKE_layer.hh"
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
#include "BKE_main_invariants.hh"
#include "BKE_material.hh"
#include "BKE_mesh.hh"
#include "BKE_mesh_mapping.hh"
@@ -6777,7 +6778,7 @@ static bool proj_paint_add_slot(bContext *C, wmOperator *op)
}
}
ED_node_tree_propagate_change(*bmain);
BKE_main_ensure_invariants(*bmain);
/* In case we added more than one node, position them too. */
blender::bke::node_position_propagate(out_node);

View File

@@ -10,6 +10,7 @@
#include "BKE_lib_query.hh"
#include "BKE_main.hh"
#include "BKE_main_idmap.hh"
#include "BKE_main_invariants.hh"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_report.hh"
@@ -473,7 +474,7 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op)
update_multi_input_indices_for_removed_links(*new_node);
}
ED_node_tree_propagate_change(*bmain);
BKE_main_ensure_invariants(*bmain);
/* Pasting nodes can create arbitrary new relations because nodes can reference IDs. */
DEG_relations_tag_update(bmain);

View File

@@ -20,6 +20,7 @@
#include "BKE_curve.hh"
#include "BKE_image.hh"
#include "BKE_main.hh"
#include "BKE_main_invariants.hh"
#include "BKE_node.hh"
#include "BKE_node_enum.hh"
#include "BKE_node_legacy_types.hh"
@@ -1008,7 +1009,7 @@ static void node_property_update_default(Main *bmain, Scene * /*scene*/, Pointer
bNodeTree *ntree = (bNodeTree *)ptr->owner_id;
bNode *node = (bNode *)ptr->data;
BKE_ntree_update_tag_node_property(ntree, node);
ED_node_tree_propagate_change(*bmain);
BKE_main_ensure_invariants(*bmain);
}
static void node_socket_template_properties_update(blender::bke::bNodeType *ntype,

View File

@@ -13,6 +13,7 @@
#include "BKE_context.hh"
#include "BKE_idprop.hh"
#include "BKE_lib_id.hh"
#include "BKE_main_invariants.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.hh"
#include "BKE_screen.hh"
@@ -99,7 +100,7 @@ static void add_group_input_node_fn(nodes::LinkSearchOpParams &params)
bNode &group_input = params.add_node("NodeGroupInput");
/* This is necessary to create the new sockets in the other input nodes. */
ED_node_tree_propagate_change(*CTX_data_main(&params.C), &params.node_tree);
BKE_main_ensure_invariants(*CTX_data_main(&params.C), params.node_tree.id);
/* Hide the new input in all other group input nodes, to avoid making them taller. */
for (bNode *node : params.node_tree.all_nodes()) {
@@ -384,7 +385,7 @@ static void link_drag_search_exec_fn(bContext *C, void *arg1, void *arg2)
/* Ideally it would be possible to tag the node tree in some way so it updates only after the
* translate operation is finished, but normally moving nodes around doesn't cause updates. */
ED_node_tree_propagate_change(bmain, &node_tree);
BKE_main_ensure_invariants(bmain, node_tree.id);
/* Start translation operator with the new node. */
wmOperatorType *ot = WM_operatortype_find("NODE_OT_translate_attach_remove_on_cancel", true);

View File

@@ -26,6 +26,7 @@
#include "BKE_image.hh"
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
#include "BKE_main_invariants.hh"
#include "BKE_node.hh"
#include "BKE_node_legacy_types.hh"
#include "BKE_node_runtime.hh"
@@ -87,7 +88,7 @@ bNode *add_node(const bContext &C, const StringRef idname, const float2 &locatio
bke::node_set_selected(node, true);
ED_node_set_active(&bmain, &snode, &node_tree, node, nullptr);
ED_node_tree_propagate_change(bmain, &node_tree);
BKE_main_ensure_invariants(bmain, node_tree.id);
return node;
}
@@ -107,7 +108,7 @@ bNode *add_static_node(const bContext &C, int type, const float2 &location)
bke::node_set_selected(node, true);
ED_node_set_active(&bmain, &snode, &node_tree, node, nullptr);
ED_node_tree_propagate_change(bmain, &node_tree);
BKE_main_ensure_invariants(bmain, node_tree.id);
return node;
}
@@ -224,7 +225,7 @@ static int add_reroute_exec(bContext *C, wmOperator *op)
}
}
ED_node_tree_propagate_change(*CTX_data_main(C), &ntree);
BKE_main_ensure_invariants(*CTX_data_main(C), ntree.id);
return OPERATOR_FINISHED;
}
@@ -330,7 +331,7 @@ static int node_add_group_exec(bContext *C, wmOperator *op)
BKE_ntree_update_tag_node_property(snode->edittree, group_node);
bke::node_set_active(ntree, group_node);
ED_node_tree_propagate_change(*bmain, nullptr);
BKE_main_ensure_invariants(*bmain);
WM_event_add_notifier(C, NC_NODE | NA_ADDED, nullptr);
DEG_relations_tag_update(bmain);
return OPERATOR_FINISHED;
@@ -433,7 +434,7 @@ static bool add_node_group_asset(const bContext &C,
BKE_ntree_update_tag_node_property(&edit_tree, group_node);
bke::node_set_active(&edit_tree, group_node);
ED_node_tree_propagate_change(bmain, nullptr);
BKE_main_ensure_invariants(bmain);
WM_event_add_notifier(&C, NC_NODE | NA_ADDED, nullptr);
DEG_relations_tag_update(&bmain);
@@ -544,7 +545,7 @@ static int node_add_object_exec(bContext *C, wmOperator *op)
BKE_ntree_update_tag_socket_property(ntree, sock);
bke::node_set_active(ntree, object_node);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
DEG_relations_tag_update(bmain);
return OPERATOR_FINISHED;
@@ -631,7 +632,7 @@ static int node_add_collection_exec(bContext *C, wmOperator *op)
BKE_ntree_update_tag_socket_property(&ntree, sock);
bke::node_set_active(&ntree, collection_node);
ED_node_tree_propagate_change(*bmain, &ntree);
BKE_main_ensure_invariants(*bmain, ntree.id);
DEG_relations_tag_update(bmain);
return OPERATOR_FINISHED;
@@ -825,7 +826,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C));
ED_node_tree_propagate_change(*bmain, snode.edittree);
BKE_main_ensure_invariants(*bmain, snode.edittree->id);
DEG_relations_tag_update(bmain);
if (nodes.size() == 1) {
@@ -927,7 +928,7 @@ static int node_add_mask_exec(bContext *C, wmOperator *op)
node->id = mask;
id_us_plus(mask);
ED_node_tree_propagate_change(*bmain, snode.edittree);
BKE_main_ensure_invariants(*bmain, snode.edittree->id);
DEG_relations_tag_update(bmain);
return OPERATOR_FINISHED;
@@ -980,7 +981,7 @@ static int node_add_material_exec(bContext *C, wmOperator *op)
material_node->id = &material->id;
id_us_plus(&material->id);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
DEG_relations_tag_update(bmain);
return OPERATOR_FINISHED;

View File

@@ -44,6 +44,7 @@
#include "BKE_idtype.hh"
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
#include "BKE_main_invariants.hh"
#include "BKE_node.hh"
#include "BKE_node_enum.hh"
#include "BKE_node_legacy_types.hh"
@@ -2378,7 +2379,7 @@ static void node_panel_toggle_button_cb(bContext *C, void *panel_state_argv, voi
panel_state->flag ^= NODE_PANEL_COLLAPSED;
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
/* Draw panel backgrounds first, so other node elements can be rendered on top. */

View File

@@ -469,16 +469,6 @@ bool composite_node_editable(bContext *C)
/** \name Node Editor Public API Functions
* \{ */
void ED_node_tree_propagate_change(Main &bmain, bNodeTree *root_ntree)
{
if (root_ntree) {
BKE_main_ensure_invariants(bmain, {{&root_ntree->id}});
}
else {
BKE_main_ensure_invariants(bmain);
}
}
void ED_node_set_tree_type(SpaceNode *snode, blender::bke::bNodeTreeType *typeinfo)
{
if (typeinfo) {
@@ -737,7 +727,7 @@ void ED_node_set_active(
BKE_ntree_update_tag_active_output_changed(ntree);
}
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
if ((node->flag & NODE_ACTIVE_TEXTURE) && !was_active_texture) {
/* If active texture changed, free GLSL materials. */
@@ -781,7 +771,7 @@ void ED_node_set_active(
if (r_active_texture_changed) {
*r_active_texture_changed = true;
}
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_IMAGE, nullptr);
}
@@ -799,7 +789,7 @@ void ED_node_set_active(
node->flag |= NODE_DO_OUTPUT;
if (was_output == 0) {
BKE_ntree_update_tag_active_output_changed(ntree);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
/* Adding a node doesn't link this yet. */
@@ -815,11 +805,11 @@ void ED_node_set_active(
node->flag |= NODE_DO_OUTPUT;
BKE_ntree_update_tag_active_output_changed(ntree);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
}
else if (do_update) {
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
}
else if (ntree->type == NTREE_GEOMETRY) {
@@ -1487,7 +1477,7 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
}
tree_draw_order_update(*snode->edittree);
ED_node_tree_propagate_change(*bmain, snode->edittree);
BKE_main_ensure_invariants(*bmain, snode->edittree->id);
return OPERATOR_FINISHED;
}
@@ -1550,7 +1540,7 @@ static int node_read_viewlayers_exec(bContext *C, wmOperator * /*op*/)
}
}
ED_node_tree_propagate_change(*bmain, &edit_tree);
BKE_main_ensure_invariants(*bmain, edit_tree.id);
return OPERATOR_FINISHED;
}
@@ -1716,7 +1706,7 @@ static int node_preview_toggle_exec(bContext *C, wmOperator * /*op*/)
node_flag_toggle_exec(snode, NODE_PREVIEW);
ED_node_tree_propagate_change(*CTX_data_main(C), snode->edittree);
BKE_main_ensure_invariants(*CTX_data_main(C), snode->edittree->id);
return OPERATOR_FINISHED;
}
@@ -1767,7 +1757,7 @@ static int node_deactivate_viewer_exec(bContext *C, wmOperator * /*op*/)
}
}
ED_node_tree_propagate_change(*CTX_data_main(C), snode.edittree);
BKE_main_ensure_invariants(*CTX_data_main(C), snode.edittree->id);
return OPERATOR_FINISHED;
}
@@ -1846,7 +1836,7 @@ static int node_socket_toggle_exec(bContext *C, wmOperator * /*op*/)
}
}
ED_node_tree_propagate_change(*CTX_data_main(C), snode->edittree);
BKE_main_ensure_invariants(*CTX_data_main(C), snode->edittree->id);
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr);
/* Hack to force update of the button state after drawing, see #112462. */
@@ -1890,7 +1880,7 @@ static int node_mute_exec(bContext *C, wmOperator * /*op*/)
}
}
ED_node_tree_propagate_change(*bmain, snode->edittree);
BKE_main_ensure_invariants(*bmain, snode->edittree->id);
return OPERATOR_FINISHED;
}
@@ -1932,7 +1922,7 @@ static int node_delete_exec(bContext *C, wmOperator * /*op*/)
}
}
ED_node_tree_propagate_change(*bmain, snode->edittree);
BKE_main_ensure_invariants(*bmain, snode->edittree->id);
return OPERATOR_FINISHED;
}
@@ -1979,7 +1969,7 @@ static int node_delete_reconnect_exec(bContext *C, wmOperator * /*op*/)
}
}
ED_node_tree_propagate_change(*bmain, snode->edittree);
BKE_main_ensure_invariants(*bmain, snode->edittree->id);
return OPERATOR_FINISHED;
}
@@ -2030,7 +2020,7 @@ static int node_output_file_add_socket_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "file_path", file_path);
ntreeCompositOutputFileAddSocket(ntree, node, file_path, &scene->r.im_format);
ED_node_tree_propagate_change(*CTX_data_main(C), snode->edittree);
BKE_main_ensure_invariants(*CTX_data_main(C), snode->edittree->id);
return OPERATOR_FINISHED;
}
@@ -2083,7 +2073,7 @@ static int node_output_file_remove_active_socket_exec(bContext *C, wmOperator *
return OPERATOR_CANCELLED;
}
ED_node_tree_propagate_change(*CTX_data_main(C), ntree);
BKE_main_ensure_invariants(*CTX_data_main(C), ntree->id);
return OPERATOR_FINISHED;
}
@@ -2155,7 +2145,7 @@ static int node_output_file_move_active_socket_exec(bContext *C, wmOperator *op)
}
BKE_ntree_update_tag_node_property(snode->edittree, node);
ED_node_tree_propagate_change(*CTX_data_main(C), snode->edittree);
BKE_main_ensure_invariants(*CTX_data_main(C), snode->edittree->id);
return OPERATOR_FINISHED;
}
@@ -2438,7 +2428,7 @@ static int viewer_border_exec(bContext *C, wmOperator *op)
btree->flag |= NTREE_VIEWER_BORDER;
}
ED_node_tree_propagate_change(*bmain, btree);
BKE_main_ensure_invariants(*bmain, btree->id);
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr);
}
else {
@@ -2478,7 +2468,7 @@ static int clear_viewer_border_exec(bContext *C, wmOperator * /*op*/)
bNodeTree *btree = snode->nodetree;
btree->flag &= ~NTREE_VIEWER_BORDER;
ED_node_tree_propagate_change(*CTX_data_main(C), btree);
BKE_main_ensure_invariants(*CTX_data_main(C), btree->id);
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr);
return OPERATOR_FINISHED;
@@ -2527,7 +2517,7 @@ static int node_cryptomatte_add_socket_exec(bContext *C, wmOperator * /*op*/)
ntreeCompositCryptomatteAddSocket(ntree, node);
ED_node_tree_propagate_change(*CTX_data_main(C), ntree);
BKE_main_ensure_invariants(*CTX_data_main(C), ntree->id);
return OPERATOR_FINISHED;
}
@@ -2577,7 +2567,7 @@ static int node_cryptomatte_remove_socket_exec(bContext *C, wmOperator * /*op*/)
return OPERATOR_CANCELLED;
}
ED_node_tree_propagate_change(*CTX_data_main(C), ntree);
BKE_main_ensure_invariants(*CTX_data_main(C), ntree->id);
return OPERATOR_FINISHED;
}

View File

@@ -11,6 +11,7 @@
#include "DNA_space_types.h"
#include "BKE_context.hh"
#include "BKE_main_invariants.hh"
#include "BKE_node_legacy_types.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.hh"
@@ -205,7 +206,7 @@ static void attribute_search_exec_fn(bContext *C, void *data_v, void *item_v)
/* Make the output socket with the new type on the attribute input node active. */
nodes::update_node_declaration_and_sockets(*node_tree, *node);
BKE_ntree_update_tag_node_property(node_tree, node);
ED_node_tree_propagate_change(*CTX_data_main(C), node_tree);
BKE_main_ensure_invariants(*CTX_data_main(C), node_tree->id);
}
}

View File

@@ -29,6 +29,7 @@
#include "BKE_context.hh"
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
#include "BKE_main_invariants.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.hh"
#include "BKE_report.hh"
@@ -482,7 +483,7 @@ static int node_group_ungroup_exec(bContext *C, wmOperator * /*op*/)
for (bNode *node : nodes_to_ungroup) {
node_group_ungroup(bmain, snode->edittree, node);
}
ED_node_tree_propagate_change(*CTX_data_main(C));
BKE_main_ensure_invariants(*CTX_data_main(C));
return OPERATOR_FINISHED;
}
@@ -667,7 +668,7 @@ static int node_group_separate_exec(bContext *C, wmOperator *op)
/* switch to parent tree */
ED_node_tree_pop(snode);
ED_node_tree_propagate_change(*CTX_data_main(C));
BKE_main_ensure_invariants(*CTX_data_main(C));
return OPERATOR_FINISHED;
}
@@ -1200,7 +1201,7 @@ static void node_group_make_insert_selected(const bContext &C,
update_nested_node_refs_after_moving_nodes_into_group(ntree, group, *gnode, node_identifier_map);
ED_node_tree_propagate_change(*bmain);
BKE_main_ensure_invariants(*bmain);
}
static bNode *node_group_make_from_nodes(const bContext &C,

View File

@@ -15,6 +15,7 @@
#include "BLI_stack.hh"
#include "BKE_context.hh"
#include "BKE_main_invariants.hh"
#include "BKE_node.hh"
#include "BKE_node_legacy_types.hh"
#include "BKE_node_runtime.hh"
@@ -582,7 +583,7 @@ static void finalize_viewer_link(const bContext &C,
if (snode.edittree->type == NTREE_GEOMETRY) {
viewer_path::activate_geometry_node(*bmain, snode, viewer_node);
}
ED_node_tree_propagate_change(*bmain, snode.edittree);
BKE_main_ensure_invariants(*bmain, snode.edittree->id);
}
static const bNode *find_overlapping_node(const bNodeTree &tree,
@@ -847,7 +848,7 @@ static int node_active_link_viewer_exec(bContext *C, wmOperator * /*op*/)
return OPERATOR_CANCELLED;
}
ED_node_tree_propagate_change(*CTX_data_main(C), snode.edittree);
BKE_main_ensure_invariants(*CTX_data_main(C), snode.edittree->id);
return OPERATOR_FINISHED;
}
@@ -1229,7 +1230,7 @@ static void add_dragged_links_to_tree(bContext &C, bNodeLinkDrag &nldrag)
BKE_ntree_update_tag_link_added(&ntree, new_link);
}
ED_node_tree_propagate_change(*bmain, &ntree);
BKE_main_ensure_invariants(*bmain, ntree.id);
/* Ensure drag-link tool-tip is disabled. */
draw_draglink_tooltip_deactivate(region, nldrag);
@@ -1250,7 +1251,7 @@ static void node_link_cancel(bContext *C, wmOperator *op)
snode->runtime->linkdrag.reset();
clear_picking_highlight(&snode->edittree->links);
BKE_ntree_update_tag_link_removed(snode->edittree);
ED_node_tree_propagate_change(*CTX_data_main(C), snode->edittree);
BKE_main_ensure_invariants(*CTX_data_main(C), snode->edittree->id);
}
static void node_link_find_socket(bContext &C, wmOperator &op, const float2 &cursor)
@@ -1617,7 +1618,7 @@ static int node_make_link_exec(bContext *C, wmOperator *op)
node_deselect_all_input_sockets(node_tree, false);
node_deselect_all_output_sockets(node_tree, false);
ED_node_tree_propagate_change(bmain, &node_tree);
BKE_main_ensure_invariants(bmain, node_tree.id);
return OPERATOR_FINISHED;
}
@@ -1706,7 +1707,7 @@ static int cut_links_exec(bContext *C, wmOperator *op)
update_multi_input_indices_for_removed_links(*node);
}
ED_node_tree_propagate_change(*CTX_data_main(C), snode.edittree);
BKE_main_ensure_invariants(*CTX_data_main(C), snode.edittree->id);
if (found) {
return OPERATOR_FINISHED;
}
@@ -1836,7 +1837,7 @@ static int mute_links_exec(bContext *C, wmOperator *op)
}
}
ED_node_tree_propagate_change(*CTX_data_main(C), &ntree);
BKE_main_ensure_invariants(*CTX_data_main(C), ntree.id);
return OPERATOR_FINISHED;
}
@@ -1884,7 +1885,7 @@ static int detach_links_exec(bContext *C, wmOperator * /*op*/)
}
}
ED_node_tree_propagate_change(*CTX_data_main(C), &ntree);
BKE_main_ensure_invariants(*CTX_data_main(C), ntree.id);
return OPERATOR_FINISHED;
}
@@ -2055,7 +2056,7 @@ static int node_join_exec(bContext *C, wmOperator * /*op*/)
}
tree_draw_order_update(ntree);
ED_node_tree_propagate_change(bmain, snode.edittree);
BKE_main_ensure_invariants(bmain, snode.edittree->id);
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr);
return OPERATOR_FINISHED;
@@ -2488,7 +2489,7 @@ void node_insert_on_link_flags(Main &bmain, SpaceNode &snode, bool is_new_node)
snode.runtime->iofsd = iofsd;
}
ED_node_tree_propagate_change(bmain, &ntree);
BKE_main_ensure_invariants(bmain, ntree.id);
}
/** \} */

View File

@@ -25,6 +25,7 @@
#include "BKE_context.hh"
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
#include "BKE_main_invariants.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.hh"
@@ -177,7 +178,7 @@ static void node_socket_disconnect(Main *bmain,
sock_to->flag |= SOCK_COLLAPSED;
BKE_ntree_update_tag_node_property(ntree, node_to);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
/* remove all nodes connected to this socket, if they aren't connected to other nodes */
@@ -191,7 +192,7 @@ static void node_socket_remove(Main *bmain, bNodeTree *ntree, bNode *node_to, bN
sock_to->flag |= SOCK_COLLAPSED;
BKE_ntree_update_tag_node_property(ntree, node_to);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
/* add new node connected to this socket, or replace an existing one */
@@ -245,7 +246,7 @@ static void node_socket_add_replace(const bContext *C,
}
node_link_item_apply(ntree, node_from, item);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
bke::node_set_active(ntree, node_from);
@@ -295,7 +296,7 @@ static void node_socket_add_replace(const bContext *C,
BKE_ntree_update_tag_node_property(ntree, node_from);
BKE_ntree_update_tag_node_property(ntree, node_to);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
/****************************** Node Link Menu *******************************/
@@ -733,7 +734,7 @@ static void node_panel_toggle_button_cb(bContext *C, void *panel_state_argv, voi
panel_state->flag ^= NODE_PANEL_COLLAPSED;
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
/* Make sure panel state updates from the Properties Editor, too. */
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_NODE_VIEW, nullptr);

View File

@@ -53,6 +53,7 @@
#include "BKE_lib_query.hh"
#include "BKE_lib_remap.hh"
#include "BKE_main.hh"
#include "BKE_main_invariants.hh"
#include "BKE_object.hh"
#include "BKE_report.hh"
#include "BKE_scene.hh"
@@ -2722,7 +2723,7 @@ static int outliner_delete_exec(bContext *C, wmOperator *op)
WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active);
}
ED_node_tree_propagate_change(*bmain);
BKE_main_ensure_invariants(*bmain);
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
@@ -3021,7 +3022,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
break;
}
ED_node_tree_propagate_change(*bmain);
BKE_main_ensure_invariants(*bmain);
/* wrong notifier still... */
WM_event_add_notifier(C, NC_ID | NA_EDITED, nullptr);
@@ -3112,7 +3113,7 @@ static int outliner_lib_operation_exec(bContext *C, wmOperator *op)
break;
}
ED_node_tree_propagate_change(*bmain);
BKE_main_ensure_invariants(*bmain);
/* wrong notifier still... */
WM_event_add_notifier(C, NC_ID | NA_EDITED, nullptr);

View File

@@ -21,6 +21,7 @@
#include "BKE_geometry_set_instances.hh"
#include "BKE_idprop.hh"
#include "BKE_instances.hh"
#include "BKE_main_invariants.hh"
#include "BKE_modifier.hh"
#include "BKE_node_legacy_types.hh"
#include "BKE_node_runtime.hh"
@@ -1073,7 +1074,7 @@ static void WIDGETGROUP_geometry_nodes_refresh(const bContext *C, wmGizmoGroup *
modify_value);
Main *main = CTX_data_main(C);
ED_node_tree_propagate_change(*main);
BKE_main_ensure_invariants(*main);
WM_main_add_notifier(NC_GEOM | ND_DATA, nullptr);
};
}

View File

@@ -16,6 +16,7 @@
#include "BLI_rect.h"
#include "BKE_context.hh"
#include "BKE_main_invariants.hh"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
@@ -280,7 +281,7 @@ static void special_aftertrans_update__node(bContext *C, TransInfo *t)
bke::node_remove_node(bmain, ntree, node, true);
}
}
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
}

View File

@@ -33,6 +33,7 @@
#include "BKE_customdata.hh"
#include "BKE_editmesh.hh"
#include "BKE_layer.hh"
#include "BKE_main_invariants.hh"
#include "BKE_material.hh"
#include "BKE_mesh_mapping.hh"
#include "BKE_mesh_types.hh"
@@ -171,7 +172,7 @@ void ED_object_assign_active_image(Main *bmain, Object *ob, int mat_nr, Image *i
if (node && is_image_texture_node(node)) {
node->id = &ima->id;
ED_node_tree_propagate_change(*bmain, ma->nodetree);
BKE_main_ensure_invariants(*bmain, ma->nodetree->id);
}
}

View File

@@ -16,6 +16,7 @@
#include "BLT_translation.hh"
#include "BKE_main_invariants.hh"
#include "BKE_node_tree_update.hh"
#include "RNA_define.hh"
@@ -360,7 +361,7 @@ static void rna_ColorRamp_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr
for (node = static_cast<bNode *>(ntree->nodes.first); node; node = node->next) {
if (ELEM(node->type_legacy, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) {
BKE_ntree_update_tag_node_property(ntree, node);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
}
break;

View File

@@ -16,6 +16,7 @@
#include "BKE_image.hh"
#include "BKE_image_format.hh"
#include "BKE_main_invariants.hh"
#include "BKE_node_tree_update.hh"
#include "BLT_translation.hh"
@@ -254,7 +255,7 @@ static void rna_ImageUser_update(Main *bmain, Scene *scene, PointerRNA *ptr)
if (GS(id->name) == ID_NT) {
/* Special update for node-trees. */
BKE_ntree_update_tag_image_user_changed((bNodeTree *)id, iuser);
ED_node_tree_propagate_change(*bmain);
BKE_main_ensure_invariants(*bmain);
}
else {
/* Update material or texture for render preview. */

View File

@@ -43,6 +43,7 @@
# include "BKE_light.h"
# include "BKE_lightprobe.h"
# include "BKE_linestyle.h"
# include "BKE_main_invariants.hh"
# include "BKE_mask.h"
# include "BKE_material.hh"
# include "BKE_mball.hh"
@@ -293,7 +294,7 @@ static bNodeTree *rna_Main_nodetree_new(Main *bmain, const char *name, int type)
blender::bke::bNodeTreeType *typeinfo = rna_node_tree_type_from_enum(type);
if (typeinfo) {
bNodeTree *ntree = blender::bke::node_tree_add_tree(bmain, safe_name, typeinfo->idname);
ED_node_tree_propagate_change(*bmain);
BKE_main_ensure_invariants(*bmain);
id_us_min(&ntree->id);
return ntree;

View File

@@ -47,6 +47,7 @@ const EnumPropertyItem rna_enum_node_socket_type_items[] = {
# include "BLI_string_ref.hh"
# include "BKE_main_invariants.hh"
# include "BKE_node.hh"
# include "BKE_node_enum.hh"
# include "BKE_node_runtime.hh"
@@ -350,7 +351,7 @@ static void rna_NodeSocket_update(Main *bmain, Scene * /*scene*/, PointerRNA *pt
bNodeSocket *sock = static_cast<bNodeSocket *>(ptr->data);
BKE_ntree_update_tag_socket_property(ntree, sock);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
static void rna_NodeSocket_enabled_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
@@ -359,7 +360,7 @@ static void rna_NodeSocket_enabled_update(Main *bmain, Scene * /*scene*/, Pointe
bNodeSocket *sock = static_cast<bNodeSocket *>(ptr->data);
BKE_ntree_update_tag_socket_availability(ntree, sock);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
static bool rna_NodeSocket_is_output_get(PointerRNA *ptr)

View File

@@ -33,6 +33,7 @@ static const EnumPropertyItem node_tree_interface_socket_in_out_items[] = {
# include "BLI_string_ref.hh"
# include "BKE_attribute.hh"
# include "BKE_main_invariants.hh"
# include "BKE_node.hh"
# include "BKE_node_enum.hh"
# include "BKE_node_runtime.hh"
@@ -62,7 +63,7 @@ static void rna_NodeTreeInterfaceItem_update(Main *bmain, Scene * /*scene*/, Poi
return;
}
ntree->tree_interface.tag_items_changed();
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
static StructRNA *rna_NodeTreeInterfaceItem_refine(PointerRNA *ptr)
@@ -544,7 +545,7 @@ static bNodeTreeInterfaceSocket *rna_NodeTreeInterfaceItems_new_socket(
BKE_report(reports, RPT_ERROR, "Unable to create socket");
}
else {
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -570,7 +571,7 @@ static bNodeTreeInterfacePanel *rna_NodeTreeInterfaceItems_new_panel(ID *id,
}
else {
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -607,7 +608,7 @@ static bNodeTreeInterfaceItem *rna_NodeTreeInterfaceItems_copy_to_parent(
}
else {
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -634,7 +635,7 @@ static void rna_NodeTreeInterfaceItems_remove(ID *id,
interface->remove_item(*item, move_content_to_parent);
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -643,7 +644,7 @@ static void rna_NodeTreeInterfaceItems_clear(ID *id, bNodeTreeInterface *interfa
interface->clear_items();
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -656,7 +657,7 @@ static void rna_NodeTreeInterfaceItems_move(ID *id,
interface->move_item(*item, to_position);
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -671,7 +672,7 @@ static void rna_NodeTreeInterfaceItems_move_to_parent(ID *id,
interface->move_item_to_parent(*item, parent, to_position);
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}

View File

@@ -41,6 +41,7 @@
#include "BKE_cryptomatte.h"
#include "BKE_geometry_set.hh"
#include "BKE_image.hh"
#include "BKE_main_invariants.hh"
#include "BKE_node.hh"
#include "BKE_node_legacy_types.hh"
#include "BKE_node_runtime.hh"
@@ -1154,7 +1155,7 @@ static void rna_NodeTree_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
WM_main_add_notifier(NC_NODE | NA_EDITED, &ntree->id);
WM_main_add_notifier(NC_SCENE | ND_NODES, &ntree->id);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
static void rna_NodeTree_update_asset(Main *bmain, Scene *scene, PointerRNA *ptr)
@@ -1266,7 +1267,7 @@ static bNode *rna_NodeTree_node_new(bNodeTree *ntree,
}
Main *bmain = CTX_data_main(C);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
return node;
@@ -1292,7 +1293,7 @@ static void rna_NodeTree_node_remove(bNodeTree *ntree,
RNA_POINTER_INVALIDATE(node_ptr);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -1312,7 +1313,7 @@ static void rna_NodeTree_node_clear(bNodeTree *ntree, Main *bmain, ReportList *r
node = next_node;
}
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -1434,7 +1435,7 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree,
fromsock->flag &= ~SOCK_HIDDEN;
tosock->flag &= ~SOCK_HIDDEN;
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
return ret;
@@ -1459,7 +1460,7 @@ static void rna_NodeTree_link_remove(bNodeTree *ntree,
blender::bke::node_remove_link(ntree, link);
RNA_POINTER_INVALIDATE(link_ptr);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -1478,7 +1479,7 @@ static void rna_NodeTree_link_clear(bNodeTree *ntree, Main *bmain, ReportList *r
link = next_link;
}
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -1631,7 +1632,7 @@ static void rna_NodeTree_interface_update(bNodeTree *ntree, bContext *C)
{
Main *bmain = CTX_data_main(C);
ntree->tree_interface.tag_items_changed();
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
/* ******** NodeLink ******** */
@@ -1654,7 +1655,7 @@ static void rna_NodeLink_swap_multi_input_sort_id(
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
BKE_ntree_update_tag_link_changed(ntree);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -2502,7 +2503,7 @@ void rna_Node_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
bNode *node = static_cast<bNode *>(ptr->data);
BKE_ntree_update_tag_node_property(ntree, node);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
static void rna_NodeCrop_min_x_set(PointerRNA *ptr, int value)
@@ -2578,7 +2579,7 @@ void rna_Node_update_relations(Main *bmain, Scene *scene, PointerRNA *ptr)
static void rna_Node_socket_value_update(ID *id, bNode * /*node*/, bContext *C)
{
BKE_ntree_update_tag_all(reinterpret_cast<bNodeTree *>(id));
ED_node_tree_propagate_change(*CTX_data_main(C), reinterpret_cast<bNodeTree *>(id));
BKE_main_ensure_invariants(*CTX_data_main(C), *id);
}
static void rna_Node_select_set(PointerRNA *ptr, bool value)
@@ -2684,7 +2685,7 @@ static bNodeSocket *rna_Node_inputs_new(ID *id,
if (use_multi_input) {
sock->flag |= SOCK_MULTI_INPUT;
}
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -2722,7 +2723,7 @@ static bNodeSocket *rna_Node_outputs_new(ID *id,
BKE_report(reports, RPT_ERROR, "Unable to create socket");
}
else {
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -2745,7 +2746,7 @@ static void rna_Node_socket_remove(
else {
blender::bke::node_remove_socket(ntree, node, sock);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
}
@@ -2765,7 +2766,7 @@ static void rna_Node_inputs_clear(ID *id, bNode *node, Main *bmain, ReportList *
blender::bke::node_remove_socket(ntree, node, sock);
}
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -2784,7 +2785,7 @@ static void rna_Node_outputs_clear(ID *id, bNode *node, Main *bmain, ReportList
blender::bke::node_remove_socket(ntree, node, sock);
}
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -2823,7 +2824,7 @@ static void rna_Node_inputs_move(
}
BKE_ntree_update_tag_node_property(ntree, node);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -2862,7 +2863,7 @@ static void rna_Node_outputs_move(
}
BKE_ntree_update_tag_node_property(ntree, node);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -2988,7 +2989,7 @@ static void rna_NodeInternal_update(ID *id, bNode *node, Main *bmain)
{
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
BKE_ntree_update_tag_node_property(ntree, node);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
static void rna_NodeInternal_draw_buttons(ID *id, bNode *node, bContext *C, uiLayout *layout)
@@ -3123,7 +3124,7 @@ static void rna_Node_tex_image_update(Main *bmain, Scene * /*scene*/, PointerRNA
bNode *node = static_cast<bNode *>(ptr->data);
BKE_ntree_update_tag_node_property(ntree, node);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_IMAGE, nullptr);
}
@@ -3133,7 +3134,7 @@ static void rna_NodeGroup_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr
bNode *node = static_cast<bNode *>(ptr->data);
BKE_ntree_update_tag_node_property(ntree, node);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
DEG_relations_tag_update(bmain);
}
@@ -3944,7 +3945,7 @@ static bool rna_Node_pair_with_output(
output_node_id = output_node->identifier;
BKE_ntree_update_tag_node_property(ntree, node);
ED_node_tree_propagate_change(*CTX_data_main(C), ntree);
BKE_main_ensure_invariants(*CTX_data_main(C), ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
return true;
}
@@ -3976,7 +3977,7 @@ static void rna_Node_ItemArray_remove(ID *id,
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
BKE_ntree_update_tag_node_property(ntree, node);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -3987,7 +3988,7 @@ template<typename Accessor> static void rna_Node_ItemArray_clear(ID *id, bNode *
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
BKE_ntree_update_tag_node_property(ntree, node);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -4004,7 +4005,7 @@ static void rna_Node_ItemArray_move(
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
BKE_ntree_update_tag_node_property(ntree, node);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
@@ -4045,7 +4046,7 @@ static void rna_Node_ItemArray_item_update(Main *bmain, Scene * /*scene*/, Point
BLI_assert(node != nullptr);
BKE_ntree_update_tag_node_property(&ntree, node);
ED_node_tree_propagate_change(*bmain, &ntree);
BKE_main_ensure_invariants(*bmain, ntree.id);
}
template<typename Accessor>
@@ -4096,7 +4097,7 @@ typename Accessor::ItemT *rna_Node_ItemArray_new_with_socket_and_name(
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
BKE_ntree_update_tag_node_property(ntree, node);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
return new_item;
@@ -4109,7 +4110,7 @@ static IndexSwitchItem *rna_NodeIndexSwitchItems_new(ID *id, bNode *node, Main *
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
BKE_ntree_update_tag_node_property(ntree, node);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
return new_item;
@@ -4203,7 +4204,7 @@ static bNodeSocket *rna_NodeOutputFile_slots_new(
sock = ntreeCompositOutputFileAddSocket(ntree, node, name, im_format);
ED_node_tree_propagate_change(*CTX_data_main(C), ntree);
BKE_main_ensure_invariants(*CTX_data_main(C), ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
return sock;
@@ -4319,7 +4320,7 @@ static void rna_ShaderNodeScript_update(Main *bmain, Scene *scene, PointerRNA *p
}
BKE_ntree_update_tag_node_property(ntree, node);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
static void rna_ShaderNode_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
@@ -4615,7 +4616,7 @@ static NodeEnumItem *rna_NodeMenuSwitchItems_new(ID *id,
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
BKE_ntree_update_tag_node_property(ntree, node);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
return new_item;

View File

@@ -40,6 +40,7 @@
#include "BKE_armature.hh"
#include "BKE_editmesh.hh"
#include "BKE_idtype.hh"
#include "BKE_main_invariants.hh"
#include "BKE_paint.hh"
#include "BKE_volume.hh"
@@ -1813,7 +1814,7 @@ void rna_Scene_compositor_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(scene->nodetree);
WM_main_add_notifier(NC_NODE | NA_EDITED, &ntree->id);
WM_main_add_notifier(NC_SCENE | ND_NODES, &ntree->id);
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
}

View File

@@ -22,6 +22,7 @@
#include "BLI_utildefines.h"
#include "BKE_main_invariants.hh"
#include "BKE_node.hh"
#include "BKE_node_tree_update.hh"
#include "BKE_paint.hh"
@@ -194,7 +195,7 @@ static void rna_Texture_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
}
else if (GS(id->name) == ID_NT) {
bNodeTree *ntree = (bNodeTree *)ptr->owner_id;
ED_node_tree_propagate_change(*bmain, ntree);
BKE_main_ensure_invariants(*bmain, ntree->id);
}
}

View File

@@ -9,6 +9,7 @@
#include "WM_api.hh"
#include "BKE_context.hh"
#include "BKE_main_invariants.hh"
#include "BKE_node_tree_update.hh"
#include "BKE_node_tree_zones.hh"
@@ -60,7 +61,7 @@ inline void update_after_node_change(bContext *C, const PointerRNA node_ptr)
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(node_ptr.owner_id);
BKE_ntree_update_tag_node_property(ntree, node);
ED_node_tree_propagate_change(*CTX_data_main(C), ntree);
BKE_main_ensure_invariants(*CTX_data_main(C), ntree->id);
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}