|
Blender V5.0
|
Go to the source code of this file.
Namespaces | |
| namespace | blender |
| namespace | blender::bke |
| namespace | blender::bke::liboverride |
API to manage data-blocks inside of Blender's Main data-base, or as independent runtime-only data.
Definition in file BKE_lib_override.hh.
| void BKE_lib_override_debug_print | ( | IDOverrideLibrary * | liboverride, |
| const char * | intro_txt ) |
Debugging helper to show content of given liboverride data.
Definition at line 5326 of file lib_override.cc.
References LIBOVERRIDE_OP_FLAG_IDPOINTER_MATCH_REFERENCE, LIBOVERRIDE_PROP_OP_TAG_UNUSED, and LISTBASE_FOREACH.
| void BKE_lib_override_id_tag_on_deg_tag_from_user | ( | ID * | id | ) |
Tag the liboverride ID for auto-refresh when it gets tagged for depsgraph update.
NOTE: This should only handle direct user editing, it is assumed that indirect updates should never require an update of the liboverride diffing info.
Definition at line 426 of file lib_override.cc.
References ID_IS_LINKED, ID_IS_OVERRIDE_LIBRARY, and ID_TAG_LIBOVERRIDE_AUTOREFRESH.
Referenced by blender::deg::id_tag_update().
| void BKE_lib_override_library_clear | ( | IDOverrideLibrary * | liboverride, |
| bool | do_id_user ) |
Clear any overriding data from given liboverride.
Definition at line 229 of file lib_override.cc.
References BLI_assert, BLI_freelistN(), BLI_ghash_clear(), ELEM, id_us_min(), lib_override_library_property_clear(), and LISTBASE_FOREACH.
Referenced by BKE_lib_override_library_copy(), and BKE_lib_override_library_free().
Shallow or deep copy of a whole override from src_id to dst_id.
Definition at line 185 of file lib_override.cc.
References BKE_lib_override_library_clear(), BKE_lib_override_library_free(), BKE_lib_override_library_init(), BLI_assert, BLI_duplicatelist(), ListBase::first, IDOverrideLibrary::flag, IDOverrideLibrary::hierarchy_root, ID_IS_OVERRIDE_LIBRARY, ID_TAG_LIBOVERRIDE_REFOK, id_us_plus(), lib_override_library_property_copy(), IDOverrideLibraryProperty::next, ID::override_library, IDOverrideLibrary::properties, IDOverrideLibrary::reference, and ID::tag.
Referenced by BKE_libblock_copy_in_lib().
| bool BKE_lib_override_library_create | ( | Main * | bmain, |
| Scene * | scene, | ||
| ViewLayer * | view_layer, | ||
| Library * | owner_library, | ||
| ID * | id_root_reference, | ||
| ID * | id_hierarchy_root_reference, | ||
| ID * | id_instance_hint, | ||
| ID ** | r_id_root_override, | ||
| const bool | do_fully_editable ) |
Advanced 'smart' function to create fully functional overrides.
| view_layer | the active view layer to search instantiated collections in, can be NULL (in which case scene's master collection children hierarchy is used instead). |
| owner_library | the library in which the overrides should be created. Besides versioning and resync code path, this should always be NULL (i.e. the local .blend file). |
| id_root_reference | The linked root ID to create an override from. May be a sub-root of the overall hierarchy, in which case calling code is expected to have already tagged required 'path' of IDs leading from the given id_hierarchy_root to the given id_root. |
| id_hierarchy_root_reference | The ID to be used a hierarchy root of the overrides to be created. Can be either the linked root ID of the whole override hierarchy, (typically the same as id_root, unless a sub-part only of the hierarchy is overridden), or the already existing override hierarchy root if part of the hierarchy is already overridden. |
| id_instance_hint | Some ID used as hint/reference to do some post-processing after overrides have been created, may be NULL. Typically, the Empty object instantiating the linked collection we override, currently. |
| r_id_root_override | if not NULL, the override generated for the given id_root. |
| do_fully_editable | if true, tag all created overrides as user-editable by default. |
Definition at line 1659 of file lib_override.cc.
References BKE_lib_override_library_main_operations_create(), BKE_main_id_newptr_and_tag_clear(), BKE_main_id_tag_all(), BKE_main_view_layers_synced_ensure(), BKE_view_layer_active_object_get(), ID_TAG_DOIT, lib_override_library_create_do(), lib_override_library_create_post_process(), and ID::newid.
Referenced by BKE_lib_override_library_proxy_convert(), blender::ed::outliner::id_override_library_create_hierarchy(), blender::ed::object::make_override_library_exec(), and ui_template_id_liboverride_hierarchy_make().
| ID * BKE_lib_override_library_create_from_id | ( | Main * | bmain, |
| ID * | reference_id, | ||
| bool | do_tagged_remap ) |
Create an overridden local copy of linked reference.
Definition at line 439 of file lib_override.cc.
References BKE_key_from_id(), BKE_libblock_relink_ex(), BKE_main_namemap_destroy(), BLI_assert, IDOverrideLibrary::flag, FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, IDOverrideLibrary::hierarchy_root, Key::id, ID_IS_LINKED, ID_REMAP_SKIP_INDIRECT_USAGE, ID_REMAP_SKIP_OVERRIDE_LIBRARY, ID_TAG_DOIT, lib_override_library_create_from(), LIBOVERRIDE_FLAG_NO_HIERARCHY, LIBOVERRIDE_FLAG_SYSTEM_DEFINED, Main::name_map_global, ID::override_library, and ID::tag.
Referenced by BKE_blendfile_override(), and blender::ed::outliner::id_override_library_create_hierarchy().
| bool BKE_lib_override_library_create_from_tag | ( | Main * | bmain, |
| Library * | owner_library, | ||
| const ID * | id_root_reference, | ||
| ID * | id_hierarchy_root, | ||
| const ID * | id_hierarchy_root_reference, | ||
| bool | do_no_main, | ||
| const bool | do_fully_editable ) |
Create overridden local copies of all tagged data-blocks in given Main.
| owner_library | the library in which the overrides should be created. Besides versioning and resync code path, this should always be NULL (i.e. the local .blend file). |
| id_root_reference | the linked ID that is considered as the root of the overridden hierarchy. |
| id_hierarchy_root | the override ID that is the root of the hierarchy. May be NULL, in which case it is assumed that the given id_root_reference is tagged for override, and its newly created override will be used as hierarchy root. Must be NULL if id_hierarchy_root_reference is not NULL. |
| id_hierarchy_root_reference | the linked ID that is the root of the hierarchy. Must be tagged for override. May be NULL, in which case it is assumed that the given id_root_reference is tagged for override, and its newly created override will be used as hierarchy root. Must be NULL if id_hierarchy_root is not NULL. |
| do_no_main | Create the new override data outside of Main database. Used for resyncing of linked overrides. |
| do_fully_editable | if true, tag all created overrides as user-editable by default. |
Definition at line 533 of file lib_override.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), BKE_id_delete(), BKE_idtype_idcode_is_linkable(), BKE_key_from_id(), BKE_lib_override_library_get(), BKE_libblock_relink_multiple(), BLI_addtail(), BLI_assert, BLI_freelistN(), blender::Vector< T, InlineBufferCapacity, Allocator >::clear(), LinkData::data, ELEM, ListBase::first, IDOverrideLibrary::flag, FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, GS, IDOverrideLibrary::hierarchy_root, Key::id, ID_IS_LINKED, ID_IS_OVERRIDE_LIBRARY_REAL, ID_REMAP_FORCE_USER_REFCOUNT, ID_REMAP_SKIP_OVERRIDE_LIBRARY, ID_REMAP_TYPE_REMAP, ID_TAG_DOIT, ID::lib, LIB_ID_CREATE_NO_MAIN, lib_override_library_create_from(), lib_override_prefill_newid_from_existing_overrides(), lib_override_remapper_overrides_add(), LIBOVERRIDE_FLAG_SYSTEM_DEFINED, MEM_callocN(), ID::name, ID::newid, LinkData::next, ID::override_library, IDOverrideLibrary::reference, and ID::tag.
Referenced by lib_override_library_create_do(), and lib_override_library_resync().
Advanced 'smart' function to delete library overrides (including their existing override hierarchy) and remap their usages to their linked reference IDs.
| id_root | The root liboverride ID to delete. |
Definition at line 3928 of file lib_override.cc.
References BKE_id_multi_tagged_delete(), BKE_libblock_remap(), BKE_main_id_tag_all(), BKE_main_relations_create(), BKE_main_relations_free(), BLI_assert, data, FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, IDOverrideLibrary::hierarchy_root, ID_IS_OVERRIDE_LIBRARY_REAL, ID_REMAP_SKIP_INDIRECT_USAGE, ID_TAG_DOIT, ID_TAG_MISSING, lib_override_group_tag_data_object_to_collection_init(), lib_override_overrides_group_tag(), ID::override_library, and IDOverrideLibrary::reference.
Referenced by blender::ed::outliner::id_override_library_delete_hierarchy_process().
| void BKE_lib_override_library_free | ( | IDOverrideLibrary ** | liboverride, |
| bool | do_id_user ) |
Free given liboverride.
Definition at line 249 of file lib_override.cc.
References BKE_lib_override_library_clear(), BLI_assert, BLI_ghash_free(), MEM_freeN(), and MEM_SAFE_FREE.
Referenced by BKE_lib_override_library_copy(), BKE_lib_override_library_make_local(), BKE_libblock_free_data(), and reuse_bmain_data_invalid_local_usages_fix().
| IDOverrideLibrary * BKE_lib_override_library_get | ( | Main * | bmain, |
| ID * | id, | ||
| ID * | owner_id_hint, | ||
| ID ** | r_owner_id ) |
Return the actual IDOverrideLibrary data 'controlling' the given id, and the actual ID owning it.
| owner_id_hint | If not NULL, a potential owner for the given override-embedded id. |
| r_owner_id | If given, will be set with the actual ID owning the return liboverride data. |
Definition at line 151 of file lib_override.cc.
References BKE_lib_override_library_get().
Referenced by blender::ed::outliner::id_is_in_override_hierarchy(), RNA_property_driver_editable(), and ui_template_id_liboverride_hierarchy_make().
| void BKE_lib_override_library_id_hierarchy_reset | ( | Main * | bmain, |
| ID * | id_root, | ||
| bool | do_reset_system_override ) |
Reset all overrides in given id_root and its dependencies, while preserving ID relations.
| do_reset_system_override | If true, reset the given ID and all of its descendants in the override hierarchy as system override ones (i.e. non-editable). |
Definition at line 5025 of file lib_override.cc.
References BKE_lib_override_library_update(), BKE_main_relations_create(), BKE_main_relations_free(), FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, ID_IS_OVERRIDE_LIBRARY_REAL, lib_override_library_id_hierarchy_recursive_reset(), and LIBOVERRIDE_TAG_NEEDS_RELOAD.
Referenced by blender::ed::outliner::id_override_library_reset().
In case an ID is used by another liboverride ID, user may not be allowed to delete it.
Definition at line 5306 of file lib_override.cc.
References BKE_collection_has_object(), Main::collections, GS, ID_IS_OVERRIDE_LIBRARY, ID_OB, and LISTBASE_FOREACH.
Referenced by blender::ed::object::active_shape_key_editable_poll(), blender::ed::object::base_free_and_unlink(), blender::ed::object::object_delete_exec(), and blender::ed::object::object_join_exec().
| void BKE_lib_override_library_id_reset | ( | Main * | bmain, |
| ID * | id_root, | ||
| bool | do_reset_system_override ) |
Reset all overrides in given id_root, while preserving ID relations.
| do_reset_system_override | If true, reset the given ID as a system override one (i.e. non-editable). |
Definition at line 4964 of file lib_override.cc.
References BKE_lib_override_library_update(), ID_IS_OVERRIDE_LIBRARY_REAL, lib_override_library_id_reset_do(), LIBOVERRIDE_TAG_NEEDS_RELOAD, ID::override_library, IDOverrideLibrary::runtime, and IDOverrideLibraryRuntime::tag.
Referenced by blender::ed::object::clear_override_library_exec(), blender::ed::outliner::id_override_library_clear_single_process(), blender::ed::outliner::id_override_library_reset(), lib_id_override_editable_toggle_exec(), override_idtemplate_clear_exec(), override_idtemplate_reset_exec(), blender::ed::object::reset_override_library_exec(), and ui_template_id_liboverride_hierarchy_make().
| void BKE_lib_override_library_id_unused_cleanup | ( | ID * | local | ) |
Remove all tagged-as-unused properties and operations from that ID override data.
Definition at line 5096 of file lib_override.cc.
References BKE_lib_override_library_property_delete(), BKE_lib_override_library_property_operation_delete(), BLI_listbase_is_empty(), ID_IS_OVERRIDE_LIBRARY_REAL, LIBOVERRIDE_PROP_OP_TAG_UNUSED, LISTBASE_FOREACH_MUTABLE, ID::override_library, and IDOverrideLibrary::properties.
Referenced by BKE_lib_override_library_main_unused_cleanup().
| IDOverrideLibrary * BKE_lib_override_library_init | ( | ID * | local_id, |
| ID * | reference_id ) |
Initialize empty overriding of reference_id by local_id.
Definition at line 165 of file lib_override.cc.
References BLI_assert, IDOverrideLibrary::flag, ID_IS_LINKED, ID_TAG_LIBOVERRIDE_REFOK, id_us_plus(), LIBOVERRIDE_FLAG_SYSTEM_DEFINED, MEM_callocN(), ID::override_library, IDOverrideLibrary::reference, and ID::tag.
Referenced by BKE_lib_override_library_copy(), BKE_lib_override_library_proxy_convert(), and lib_override_library_create_from().
Check if given ID is a leaf in its liboverride hierarchy (i.e. if it does not use any other override ID).
NOTE: Embedded IDs of override IDs are not considered as leaves.
Definition at line 414 of file lib_override.cc.
References BKE_library_foreach_ID_link(), foreachid_is_hierarchy_leaf_fn(), ID_IS_OVERRIDE_LIBRARY_REAL, IDWALK_READONLY, and is_leaf().
Referenced by blender::ed::object::clear_override_library_exec(), blender::ed::outliner::id_override_library_clear_single_process(), and override_idtemplate_clear_exec().
Check if given ID is a system override.
Definition at line 356 of file lib_override.cc.
References BKE_lib_override_library_get(), IDOverrideLibrary::flag, ID_IS_OVERRIDE_LIBRARY, LIBOVERRIDE_FLAG_SYSTEM_DEFINED, and ID::override_library.
Referenced by active_bone_collection_poll(), ANIM_armature_bonecoll_is_editable(), BKE_id_is_editable(), bone_collection_add_poll(), bone_collection_assign_poll(), bone_collection_create_and_assign_poll(), lib_id_override_editable_toggle_exec(), move_to_collection_poll(), blender::ed::outliner::outliner_draw_overrides_restrictbuts(), and rna_property_editable_do().
| bool BKE_lib_override_library_is_user_edited | ( | const ID * | id | ) |
Check if given ID has some override rules that actually indicate the user edited it.
Definition at line 324 of file lib_override.cc.
References ID_IS_OVERRIDE_LIBRARY, ID_IS_OVERRIDE_LIBRARY_REAL, LIBOVERRIDE_OP_FLAG_IDPOINTER_MATCH_REFERENCE, LIBOVERRIDE_OP_NOOP, and LISTBASE_FOREACH.
Referenced by blo_do_versions_300(), lib_override_library_main_resync_on_library_indirect_level(), and lib_override_library_resync().
| void BKE_lib_override_library_main_hierarchy_root_ensure | ( | Main * | bmain | ) |
Find and set the 'hierarchy root' ID pointer of all library overrides in given bmain.
NOTE: Cannot be called from do_versions_after_linking as this code needs a single complete Main database, not a split-by-libraries one.
Definition at line 2038 of file lib_override.cc.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), BKE_main_relations_create(), BKE_main_relations_free(), FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, ID_IS_OVERRIDE_LIBRARY_REAL, and lib_override_library_main_hierarchy_id_root_ensure().
Referenced by BKE_lib_override_library_make_local(), BKE_library_make_local(), and do_versions_after_setup().
| void BKE_lib_override_library_main_operations_create | ( | Main * | bmain, |
| bool | force_auto, | ||
| int * | r_report_flags ) |
Check all overrides from given bmain and create/update overriding operations as needed.
| r_report_flags | eRNAOverrideMatchResult flags giving info about the result of this call. |
Definition at line 4764 of file lib_override.cc.
References BKE_key_from_id(), BKE_lib_override_library_main_operations_create(), BKE_lib_override_library_main_operations_restore(), BKE_lib_override_library_main_tag(), BKE_lib_override_library_main_unused_cleanup(), BKE_lib_override_library_properties_tag(), BKE_pose_ensure(), BLI_assert, BLI_task_pool_create(), BLI_task_pool_free(), BLI_task_pool_push(), BLI_task_pool_work_and_wait(), LibOverrideOpCreateData::bmain, Object::data, FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, GS, ID_IS_LINKED, ID_IS_OVERRIDE_LIBRARY_REAL, ID_OB, ID_SCE, ID_TAG_LIBOVERRIDE_AUTOREFRESH, ID_TAG_MISSING, lib_override_library_operations_create_cb(), LIBOVERRIDE_PROP_OP_TAG_UNUSED, LISTBASE_FOREACH, blender::bke::node_tree_from_id(), OB_ARMATURE, Main::objects, LibOverrideOpCreateData::report_flags, RNA_OVERRIDE_MATCH_RESULT_INIT, RNA_OVERRIDE_MATCH_RESULT_RESTORE_TAGGED, task_pool, TASK_PRIORITY_HIGH, TIMEIT_END_AVERAGED, TIMEIT_START_AVERAGED, and Object::type.
Referenced by BKE_blendfile_library_relocate(), BKE_lib_override_library_create(), BKE_lib_override_library_main_operations_create(), BKE_undosys_step_push_with_type(), blendfile_relocate_postprocess_liboverrides(), setup_app_data(), and wm_file_write().
| void BKE_lib_override_library_main_operations_restore | ( | Main * | bmain, |
| int * | r_report_flags ) |
Restore forbidden modified override properties to the values of their matching properties in the linked reference ID, for all liboverride IDs tagged as needing such process in given bmain.
| r_report_flags | eRNAOverrideMatchResult flags giving info about the result of this call. |
Definition at line 4878 of file lib_override.cc.
References BKE_lib_override_library_operations_restore(), FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, ID_IS_LINKED, ID_IS_OVERRIDE_LIBRARY_REAL, ID_TAG_MISSING, and LIBOVERRIDE_TAG_NEEDS_RESTORE.
Referenced by BKE_lib_override_library_main_operations_create().
| void BKE_lib_override_library_main_proxy_convert | ( | Main * | bmain, |
| BlendFileReadReport * | reports ) |
Convert all proxy objects into library overrides.
Definition at line 118 of file lib_override_proxy_conversion.cc.
References BLI_linklist_append(), BLI_linklist_free(), CLOG_WARN, BlendFileReadReport::count, FOREACH_SCENE_OBJECT_BEGIN, FOREACH_SCENE_OBJECT_END, ID_IS_LINKED, id_us_min(), lib_override_library_proxy_convert_do(), LinkNodePair::list, LISTBASE_FOREACH, LOG, LinkNode::next, Main::objects, BlendFileReadReport::proxies_to_lib_overrides_failures, and Main::scenes.
Referenced by do_versions_after_setup().
| void BKE_lib_override_library_main_resync | ( | Main * | bmain, |
| const blender::Map< Library *, Library * > * | new_to_old_libraries_map, | ||
| Scene * | scene, | ||
| ViewLayer * | view_layer, | ||
| BlendFileReadReport * | reports ) |
Detect and handle required resync of overrides data, when relations between reference linked IDs have changed.
This is a fairly complex and costly operation, typically it should be called after BKE_lib_override_library_main_update, which would already detect and tag a lot of cases.
This function will first detect the remaining cases requiring a resync (namely, either when an existing linked ID that did not require to be overridden before now would be, or when new IDs are added to the hierarchy).
Then it will handle the resync of necessary IDs (through calls to BKE_lib_override_library_resync).
| new_to_old_libraries_map | If not null, a mapping between new and old libraries. Only useful when they are not the same, e.g. when relocating a library or ID. |
| view_layer | the active view layer to search instantiated collections in, can be NULL (in which case scene's master collection children hierarchy is used instead). |
Definition at line 3820 of file lib_override.cc.
References BKE_collection_add(), BKE_collection_delete(), BKE_collection_is_empty(), BKE_layer_collection_resync_allow(), BKE_layer_collection_resync_forbid(), BKE_main_namemap_destroy(), BKE_main_namemap_validate(), BKE_view_layer_active_object_get(), BKE_view_layer_synced_ensure(), BLI_assert, BLI_findstring(), CLOG_DEBUG, CLOG_WARN, COLLECTION_HIDE_RENDER, COLLECTION_HIDE_VIEWPORT, Main::collections, Collection::flag, ID_IS_LINKED, lib_override_cleanup_after_resync(), lib_override_libraries_index_define(), lib_override_library_create_post_process(), lib_override_library_main_resync_on_library_indirect_level(), Main::libraries, LIBRARY_TAG_RESYNC_REQUIRED, LISTBASE_FOREACH, LOG_RESYNC, Scene::master_collection, name, Main::name_map_global, offsetof, and OVERRIDE_RESYNC_RESIDUAL_STORAGE_NAME.
Referenced by blendfile_relocate_postprocess_liboverrides(), and setup_app_data().
| void BKE_lib_override_library_main_tag | ( | Main * | bmain, |
| short | tag, | ||
| bool | do_set ) |
Set or clear given tag in all properties and operations in that Main's ID override data.
Definition at line 5084 of file lib_override.cc.
References BKE_lib_override_library_properties_tag(), FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, and ID_IS_OVERRIDE_LIBRARY.
Referenced by BKE_lib_override_library_main_operations_create().
| void BKE_lib_override_library_main_unused_cleanup | ( | Main * | bmain | ) |
Remove all tagged-as-unused properties and operations from that Main's ID override data.
Definition at line 5119 of file lib_override.cc.
References BKE_lib_override_library_id_unused_cleanup(), FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, and ID_IS_OVERRIDE_LIBRARY.
Referenced by BKE_lib_override_library_main_operations_create().
| void BKE_lib_override_library_main_update | ( | Main * | bmain | ) |
Update all overrides from given bmain.
Definition at line 5281 of file lib_override.cc.
References BKE_blender_globals_main_swap(), BKE_lib_override_library_update(), BKE_main_namemap_validate(), BLI_assert, FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, and UNUSED_VARS_NDEBUG.
Referenced by blo_read_file_internal(), and library_link_end().
| void BKE_lib_override_library_main_validate | ( | Main * | bmain, |
| ReportList * | reports ) |
Check against potential bmain.
Definition at line 4525 of file lib_override.cc.
References BKE_lib_override_library_validate(), FOREACH_MAIN_ID_BEGIN, and FOREACH_MAIN_ID_END.
Referenced by blo_read_file_internal(), and library_link_end().
Make given ID fully local.
| bmain | If given, all liboverrides hierarchy roots will be re-validated/generated after clearing the liboverride data from given id. If nullptr, caller is responsible to perform this action (call BKE_lib_override_library_main_hierarchy_root_ensure) itself. |
Definition at line 3971 of file lib_override.cc.
References BKE_key_from_id(), BKE_lib_override_library_free(), BKE_lib_override_library_main_hierarchy_root_ensure(), BLI_assert_unreachable, ID::flag, GS, bNodeTree::id, Collection::id, Key::id, ID_FLAG_EMBEDDED_DATA_LIB_OVERRIDE, ID_IS_OVERRIDE_LIBRARY_VIRTUAL, ID_SCE, and blender::bke::node_tree_from_id().
Referenced by BKE_lib_id_make_local_generic(), BKE_lib_override_library_validate(), BKE_library_make_local(), blender::ed::outliner::id_local_fn(), and template_id_cb().
Compare local and reference data-blocks and create new override operations as needed, or reset to reference values if overriding is not allowed.
| r_report_flags | eRNAOverrideMatchResult flags giving info about the result of this call. |
Definition at line 4692 of file lib_override.cc.
References lib_override_library_operations_create(), RNA_OVERRIDE_COMPARE_CREATE, and RNA_OVERRIDE_COMPARE_RESTORE.
Referenced by write_file_handle().
Restore forbidden modified override properties to the values of their matching properties in the linked reference ID.
| r_report_flags | eRNAOverrideMatchResult flags giving info about the result of this call. |
Definition at line 4701 of file lib_override.cc.
References BKE_lib_override_library_operations_tag(), BKE_lib_override_library_property_delete(), BKE_lib_override_library_property_operation_delete(), BLI_listbase_is_empty(), ID_IS_OVERRIDE_LIBRARY_REAL, LIBOVERRIDE_PROP_TAG_NEEDS_RETORE, LIBOVERRIDE_TAG_NEEDS_RESTORE, LISTBASE_FOREACH_MUTABLE, ID::override_library, IDOverrideLibrary::properties, IDOverrideLibrary::reference, RNA_id_pointer_create(), RNA_OVERRIDE_APPLY_FLAG_RESTORE_ONLY, RNA_OVERRIDE_APPLY_FLAG_SKIP_RESYNC_CHECK, RNA_OVERRIDE_MATCH_RESULT_RESTORED, RNA_struct_override_apply(), IDOverrideLibrary::runtime, and IDOverrideLibraryRuntime::tag.
Referenced by BKE_lib_override_library_main_operations_restore().
| void BKE_lib_override_library_operations_tag | ( | IDOverrideLibraryProperty * | liboverride_property, |
| short | tag, | ||
| bool | do_set ) |
Set or clear given tag in all operations in that override property data.
Definition at line 5048 of file lib_override.cc.
References LISTBASE_FOREACH, IDOverrideLibraryProperty::operations, and IDOverrideLibraryProperty::tag.
Referenced by BKE_lib_override_library_operations_restore(), BKE_lib_override_library_properties_tag(), and RNA_struct_override_matches().
| void BKE_lib_override_library_properties_tag | ( | IDOverrideLibrary * | liboverride, |
| short | tag, | ||
| bool | do_set ) |
Set or clear given tag in all properties and operations in that override data.
Definition at line 5073 of file lib_override.cc.
References BKE_lib_override_library_operations_tag(), and LISTBASE_FOREACH.
Referenced by BKE_lib_override_library_main_operations_create(), and BKE_lib_override_library_main_tag().
| void BKE_lib_override_library_property_delete | ( | IDOverrideLibrary * | liboverride, |
| IDOverrideLibraryProperty * | liboverride_property ) |
Remove and free given liboverride_property from given ID liboverride.
Definition at line 4159 of file lib_override.cc.
References lib_override_library_property_delete().
Referenced by BKE_lib_override_library_id_unused_cleanup(), BKE_lib_override_library_operations_restore(), lib_override_library_id_reset_do(), lib_override_library_resync(), and override_remove_button_exec().
| IDOverrideLibraryProperty * BKE_lib_override_library_property_find | ( | IDOverrideLibrary * | liboverride, |
| const char * | rna_path ) |
Find override property from given RNA path, if it exists.
Definition at line 4032 of file lib_override.cc.
References BLI_ghash_lookup(), and override_library_rna_path_mapping_ensure().
Referenced by BKE_lib_override_library_property_get(), RNA_property_overridden(), RNA_property_override_property_find(), RNA_struct_override_matches(), version_liboverride_rnacollections_insertion_animdata(), and version_liboverride_rnacollections_insertion_object().
| IDOverrideLibraryProperty * BKE_lib_override_library_property_get | ( | IDOverrideLibrary * | liboverride, |
| const char * | rna_path, | ||
| bool * | r_created ) |
Find override property from given RNA path, or create it if it does not exist.
Definition at line 4039 of file lib_override.cc.
References BKE_lib_override_library_property_find(), BLI_addtail(), BLI_ghash_insert(), BLI_strdup(), MEM_callocN(), override_library_rna_path_mapping_ensure(), and IDOverrideLibraryProperty::rna_path.
Referenced by RNA_property_override_property_get(), and RNA_struct_override_matches().
| bool BKE_lib_override_library_property_is_animated | ( | const ID * | id, |
| const IDOverrideLibraryProperty * | liboverride_prop, | ||
| const PropertyRNA * | override_rna_prop, | ||
| const int | rnaprop_index ) |
Check if given Override Property for given ID is animated (through a F-Curve in an Action, or from a driver).
| liboverride_rna_prop | if not NULL, the RNA property matching the given path in the liboverride_prop. |
| rnaprop_index | Array in the RNA property, 0 if unknown or irrelevant. |
Definition at line 366 of file lib_override.cc.
References BKE_animadata_fcurve_find_by_rna_path(), BKE_animdata_from_id(), IDOverrideLibraryProperty::rna_path, and RNA_path_array_index_token_find().
Referenced by blender::ed::outliner::iterate_properties_to_display().
| void BKE_lib_override_library_property_operation_delete | ( | IDOverrideLibraryProperty * | liboverride_property, |
| IDOverrideLibraryPropertyOperation * | liboverride_property_operation ) |
Remove and free given liboverride_property_operation from given ID liboverride_property.
Definition at line 4388 of file lib_override.cc.
References BLI_freelinkN(), lib_override_library_property_operation_clear(), and IDOverrideLibraryProperty::operations.
Referenced by BKE_lib_override_library_id_unused_cleanup(), BKE_lib_override_library_operations_restore(), override_remove_button_exec(), version_liboverride_rnacollections_insertion_object(), and version_liboverride_rnacollections_insertion_object_constraints().
| IDOverrideLibraryPropertyOperation * BKE_lib_override_library_property_operation_find | ( | IDOverrideLibraryProperty * | liboverride_property, |
| const char * | subitem_refname, | ||
| const char * | subitem_locname, | ||
| const std::optional< const ID * > & | subitem_refid, | ||
| const std::optional< const ID * > & | subitem_locid, | ||
| int | subitem_refindex, | ||
| int | subitem_locindex, | ||
| bool | strict, | ||
| bool * | r_strict ) |
Find override property operation from given sub-item(s), if it exists.
| subitem_refid | |
| subitem_locid | Only for RNA collections of ID pointers, the ID pointers referenced by the given names. Note that both must be set, or left unset. |
Definition at line 4219 of file lib_override.cc.
References BLI_assert, BLI_listbase_bytes_find(), ELEM, liboverride_opop_find_name_lib_iterative(), offsetof, IDOverrideLibraryProperty::operations, IDOverrideLibraryPropertyOperation::subitem_local_index, and IDOverrideLibraryPropertyOperation::subitem_reference_index.
Referenced by BKE_lib_override_library_property_operation_get(), override_remove_button_exec(), and RNA_property_override_property_operation_find().
| IDOverrideLibraryPropertyOperation * BKE_lib_override_library_property_operation_get | ( | IDOverrideLibraryProperty * | liboverride_property, |
| short | operation, | ||
| const char * | subitem_refname, | ||
| const char * | subitem_locname, | ||
| const std::optional< ID * > & | subitem_refid, | ||
| const std::optional< ID * > & | subitem_locid, | ||
| int | subitem_refindex, | ||
| int | subitem_locindex, | ||
| bool | strict, | ||
| bool * | r_strict, | ||
| bool * | r_created ) |
Find override property operation from given sub-item(s), or create it if it does not exist.
Definition at line 4310 of file lib_override.cc.
References BKE_lib_override_library_property_operation_find(), BLI_addtail(), BLI_assert, BLI_strdup(), IDOverrideLibraryPropertyOperation::flag, LIBOVERRIDE_OP_FLAG_IDPOINTER_ITEM_USE_ID, MEM_callocN(), IDOverrideLibraryPropertyOperation::operation, IDOverrideLibraryProperty::operations, IDOverrideLibraryPropertyOperation::subitem_local_id, IDOverrideLibraryPropertyOperation::subitem_local_index, IDOverrideLibraryPropertyOperation::subitem_local_name, IDOverrideLibraryPropertyOperation::subitem_reference_id, IDOverrideLibraryPropertyOperation::subitem_reference_index, and IDOverrideLibraryPropertyOperation::subitem_reference_name.
Referenced by override_remove_button_exec(), RNA_property_override_property_operation_get(), and RNA_struct_override_matches().
| bool BKE_lib_override_library_property_operation_operands_validate | ( | IDOverrideLibraryPropertyOperation * | liboverride_property_operation, |
| PointerRNA * | ptr_dst, | ||
| PointerRNA * | ptr_src, | ||
| PointerRNA * | ptr_storage, | ||
| PropertyRNA * | prop_dst, | ||
| PropertyRNA * | prop_src, | ||
| PropertyRNA * | prop_storage ) |
Validate that required data for a given operation are available.
Definition at line 4396 of file lib_override.cc.
References ATTR_FALLTHROUGH, BLI_assert_msg, PointerRNA::data, LIBOVERRIDE_OP_ADD, LIBOVERRIDE_OP_INSERT_AFTER, LIBOVERRIDE_OP_INSERT_BEFORE, LIBOVERRIDE_OP_MULTIPLY, LIBOVERRIDE_OP_NOOP, LIBOVERRIDE_OP_REPLACE, LIBOVERRIDE_OP_SUBTRACT, and IDOverrideLibraryPropertyOperation::operation.
Referenced by rna_property_override_operation_apply().
| bool BKE_lib_override_library_property_rna_path_change | ( | IDOverrideLibrary * | liboverride, |
| const char * | old_rna_path, | ||
| const char * | new_rna_path ) |
Change the RNA path of a library override on a property.
No-op if the property override cannot be found.
| from_rna_path | The RNA path of the property to change. |
| to_rna_path | The new RNA path. The library override system will copy the string to its own memory; the caller will retain ownership of the passed pointer. |
Definition at line 4103 of file lib_override.cc.
References BLI_ghash_insert(), BLI_ghash_popkey(), BLI_strdup(), MEM_SAFE_FREE, override_library_rna_path_mapping_ensure(), and IDOverrideLibraryProperty::rna_path.
Referenced by version_liboverride_nla_strip_frame_start_end().
| bool BKE_lib_override_library_property_search_and_delete | ( | IDOverrideLibrary * | liboverride, |
| const char * | rna_path ) |
Delete a property override from the given ID liboverride, if it exists.
Definition at line 4142 of file lib_override.cc.
References BLI_ghash_popkey(), lib_override_library_property_delete(), and override_library_rna_path_mapping_ensure().
Referenced by version_liboverride_nla_strip_frame_start_end().
| bool BKE_lib_override_library_proxy_convert | ( | Main * | bmain, |
| Scene * | scene, | ||
| ViewLayer * | view_layer, | ||
| Object * | ob_proxy ) |
Convert a given proxy object into a library override.
| view_layer | the active view layer to search instantiated collections in, can be NULL (in which case scene's master collection children hierarchy is used instead). |
Definition at line 34 of file lib_override_proxy_conversion.cc.
References BKE_lib_override_library_create(), BKE_lib_override_library_init(), DEG_id_tag_update(), IDOverrideLibrary::flag, FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, Collection::id, Object::id, ID_IS_LINKED, ID_IS_OVERRIDABLE_LIBRARY_HIERARCHY, ID_RECALC_SYNC_TO_EVAL, ID_TAG_DOIT, id_us_min(), Object::instance_collection, ID::lib, LIBOVERRIDE_FLAG_SYSTEM_DEFINED, ID::newid, ID::override_library, and ID::tag.
Referenced by lib_override_library_proxy_convert_do().
| bool BKE_lib_override_library_resync | ( | Main * | bmain, |
| Scene * | scene, | ||
| ViewLayer * | view_layer, | ||
| ID * | id_root, | ||
| Collection * | override_resync_residual_storage, | ||
| bool | do_hierarchy_enforce, | ||
| BlendFileReadReport * | reports ) |
Advanced 'smart' function to resync, re-create fully functional overrides up-to-date with linked data, from an existing override hierarchy.
| view_layer | the active view layer to search instantiated collections in, can be NULL (in which case scene's master collection children hierarchy is used instead). |
| id_root | The root liboverride ID to resync from. |
| do_hierarchy_enforce | If true, enforce the liboverride hierarchy of dependencies to match the one from the reference linked data (i.e. if some manually override were applied to some ID pointers, they will be reset to the default reference value). |
Definition at line 2911 of file lib_override.cc.
References BKE_id_free(), BKE_main_namemap_destroy(), lib_override_cleanup_after_resync(), lib_override_library_resync(), LinkNode::link, LISTBASE_FOREACH_MUTABLE, Main::name_map_global, and LinkNode::next.
Referenced by blender::ed::outliner::id_override_library_resync_hierarchy_process().
Check that status of local data-block is still valid against current reference one.
It means that all overridable, but not overridden, properties' local values must be equal to reference ones. Clears ID_TAG_LIBOVERRIDE_REFOK if they do not.
This is typically used to detect whether some property has been changed in local and a new #IDOverrideProperty (of #IDOverridePropertyOperation) has to be added.
Definition at line 4535 of file lib_override.cc.
References BKE_pose_ensure(), BLI_assert, Object::data, GS, ID_IS_OVERRIDE_LIBRARY_REAL, ID_OB, ID_TAG_LIBOVERRIDE_REFOK, ID::name, OB_ARMATURE, ID::override_library, IDOverrideLibrary::reference, RNA_id_pointer_create(), RNA_OVERRIDE_COMPARE_IGNORE_NON_OVERRIDABLE, RNA_OVERRIDE_COMPARE_IGNORE_OVERRIDDEN, RNA_struct_override_matches(), ID::tag, and Object::type.
Check that status of reference data-block is still valid against current local one.
It means that all non-overridden properties' local values must be equal to reference ones. Clears ID_TAG_LIBOVERRIDE_REFOK if they do not.
This is typically used to detect whether some reference has changed and local needs to be updated against it.
Definition at line 4580 of file lib_override.cc.
References BKE_lib_override_library_status_check_reference(), BKE_pose_ensure(), BLI_assert, Object::data, GS, ID_IS_OVERRIDE_LIBRARY_REAL, ID_OB, ID_TAG_LIBOVERRIDE_REFOK, ID::name, OB_ARMATURE, ID::override_library, IDOverrideLibrary::reference, RNA_id_pointer_create(), RNA_OVERRIDE_COMPARE_IGNORE_OVERRIDDEN, RNA_struct_override_matches(), ID::tag, and Object::type.
Referenced by BKE_lib_override_library_status_check_reference().
Update given override from its reference (re-applying overridden properties).
Definition at line 5149 of file lib_override.cc.
References BKE_animdata_liboverride_post_process(), BKE_id_copy_ex(), BKE_id_free_ex(), BKE_key_from_id(), BKE_key_from_id_p(), BKE_lib_override_library_update(), BKE_main_namemap_remove_id(), BKE_pose_clear_pointers(), BLI_assert, DEG_id_tag_update_ex(), DEG_relations_tag_update(), ID::flag, Key::from, GS, Key::id, ID_AR, ID_FLAG_EMBEDDED_DATA_LIB_OVERRIDE, ID_IS_OVERRIDE_LIBRARY_REAL, ID_MISSING, ID_RECALC_ALL, ID_TAG_LIBOVERRIDE_REFOK, ID::lib, LIB_ID_COPY_DEFAULT, LIB_ID_COPY_NO_LIB_OVERRIDE_LOCAL_DATA_FLAG, LIB_ID_FREE_NO_NAMEMAP_REMOVE, LIB_ID_FREE_NO_UI_USER, lib_override_id_swap(), lib_override_object_posemode_transfer(), LISTBASE_FOREACH, ID::name, OB_ARMATURE, Main::objects, ID::override_library, POSE_RECALC, IDOverrideLibrary::reference, RNA_id_pointer_create(), RNA_OVERRIDE_APPLY_FLAG_NOP, RNA_struct_override_apply(), STRNCPY(), and ID::tag.
Referenced by BKE_lib_override_library_id_hierarchy_reset(), BKE_lib_override_library_id_reset(), BKE_lib_override_library_main_update(), BKE_lib_override_library_update(), and blendfile_relocate_postprocess_liboverrides().
| void BKE_lib_override_library_validate | ( | Main * | bmain, |
| ID * | id, | ||
| ReportList * | reports ) |
Check against potential bmain.
Definition at line 4491 of file lib_override.cc.
References BKE_lib_override_library_get(), BKE_lib_override_library_make_local(), BLI_assert, ID_FLAG_EMBEDDED_DATA_LIB_OVERRIDE, ID_IS_OVERRIDE_LIBRARY_VIRTUAL, override_library_is_valid(), and override_library_properties_validate().
Referenced by BKE_lib_override_library_main_validate().
| bool BKE_lib_override_rna_property_find | ( | PointerRNA * | idpoin, |
| const IDOverrideLibraryProperty * | library_prop, | ||
| PointerRNA * | r_override_poin, | ||
| PropertyRNA ** | r_override_prop, | ||
| int * | r_index ) |
Get the RNA-property matching the library_prop override property. Used for UI to query additional data about the overridden property (e.g. UI name).
| idpoin | Pointer to the override ID. |
| library_prop | The library override property to find the matching RNA property for. |
| r_index | The RNA array flat index (i.e. flattened index in case of multi-dimensional array properties). See RNA_path_resolve_full family of functions for details. |
Definition at line 4064 of file lib_override.cc.
References BLI_assert, PointerRNA::data, ID_IS_OVERRIDE_LIBRARY, IDOverrideLibraryProperty::rna_path, RNA_path_resolve_property_full(), RNA_struct_is_ID(), and PointerRNA::type.
Referenced by blender::ed::outliner::iterate_properties_to_display().