|
Blender V5.0
|
Go to the source code of this file.
Functions | |
| void | BKE_main_ensure_invariants (Main &bmain, std::optional< blender::Span< ID * > > modified_ids=std::nullopt) |
| void | BKE_main_ensure_invariants (Main &bmain, ID &modified_id) |
Same as above but the calling code is less verbose in the common case when only a single data-block has been modified.
Definition at line 72 of file main_invariants.cc.
References BKE_main_ensure_invariants().
| void BKE_main_ensure_invariants | ( | Main & | bmain, |
| std::optional< blender::Span< ID * > > | modified_ids = std::nullopt ) |
Makes sure that invariants in original DNA data are maintained after changes.
This function has to be idempotent, i.e. after calling it once, additional calls should not modify DNA data further. If it would, it would imply that this function does more than maintaining invariants.
This has to be called after any kind of change to original DNA data that may be involved in some of the maintained invariants. It's possible to do multiple changes in a row and then fixing all invariants with a single call in the end. Obviously, the invariants are not maintained in the meantime then and functions relying on them might not work.
If this function does not need to do any work to ensure the invariants (that is, no data affecting invariants has been changed), it should not be slower than checking a flag on every data-block in the given bmain.
Sometimes, it is known that only a single or very few data-blocks have been changed (e.g. when a node has been inserted in a node tree). Passing in #modified_ids can speed up the function because it may avoid the need to iterate over all data-blocks to find modified data-blocks.
Examples of maintained invariants:
Referenced by blender::ed::space_node::add_dragged_links_to_tree(), blender::ed::space_node::add_group_input_node_fn(), blender::ed::space_node::add_node(), blender::ed::space_node::add_node_group_asset(), blender::ed::space_node::add_reroute_exec(), blender::ed::space_node::add_static_node(), blender::ed::space_node::attribute_search_exec_fn(), BKE_blendfile_link_append_context_finalize(), blo_read_file_internal(), blender::ed::space_node::clear_viewer_border_exec(), blender::ed::space_node::cut_links_exec(), blender::ed::space_node::detach_links_exec(), ED_node_set_active(), ED_object_assign_active_image(), ED_render_engine_changed(), blender::ed::curves::ensure_surface_deformation_node_exists(), blender::ed::space_node::viewer_linking::finalize_viewer_link(), blender::ed::object::geometry_node_tree_copy_assign_exec(), blender::ed::space_node::link_drag_search_exec_fn(), blender::ed::space_node::mute_links_exec(), blender::ed::space_node::node_activate_viewer_exec(), blender::ed::space_node::node_active_link_viewer_exec(), blender::ed::space_node::node_add_collection_exec(), blender::ed::space_node::node_add_color_exec(), blender::ed::space_node::node_add_group_exec(), blender::ed::space_node::node_add_image_exec(), blender::ed::space_node::node_add_import_node_exec(), blender::ed::space_node::node_add_mask_exec(), blender::ed::space_node::node_add_material_exec(), blender::ed::space_node::node_add_object_exec(), blender::ed::space_node::node_clipboard_paste_exec(), blender::ed::space_node::node_cryptomatte_add_socket_exec(), blender::ed::space_node::node_cryptomatte_remove_socket_exec(), blender::ed::space_node::node_deactivate_viewer_exec(), blender::ed::space_node::node_delete_exec(), blender::ed::space_node::node_delete_reconnect_exec(), blender::ed::space_node::node_duplicate_exec(), blender::ed::space_node::node_group_make_from_node_declaration(), blender::ed::space_node::node_group_make_insert_selected(), blender::ed::space_node::node_group_make_wrapper(), blender::ed::space_node::node_group_separate_exec(), blender::ed::space_node::node_group_ungroup_exec(), blender::ed::space_node::node_insert_on_link_flags(), blender::ed::space_node::node_join_in_frame_exec(), blender::ed::space_node::node_join_nodes_exec(), blender::ed::space_node::node_link_cancel(), blender::ed::space_node::node_make_link_exec(), blender::ed::space_node::node_mouse_select(), blender::ed::space_node::node_mute_exec(), blender::ed::space_node::node_panel_toggle_button_cb(), blender::ed::space_node::node_preview_toggle_exec(), blender::ed::space_node::node_property_update_default(), blender::ed::space_node::node_read_viewlayers_exec(), blender::ed::space_node::node_socket_add_replace(), blender::ed::space_node::node_socket_disconnect(), blender::ed::space_node::node_socket_remove(), blender::ed::space_node::node_socket_toggle_exec(), blender::ed::space_node::node_swap_group_asset_invoke(), blender::ed::outliner::outliner_delete_exec(), blender::ed::outliner::outliner_id_operation_exec(), blender::ed::outliner::outliner_lib_operation_exec(), pack_linked_ids(), paste_material_exec(), proj_paint_add_slot(), render_view_add_exec(), render_view_remove_exec(), blender::ed::space_node::sockets_sync_exec(), blender::ed::transform::special_aftertrans_update__node(), template_id_cb(), blender::ed::space_node::test_inline_shader_nodes_exec(), blender::nodes::socket_items::ops::update_after_node_change(), blender::ed::space_node::viewer_border_exec(), and blender::ed::view3d::geometry_nodes_gizmos::WIDGETGROUP_geometry_nodes_refresh().