Blender  V2.93
Classes | Macros | Typedefs | Functions | Variables
lib_override.c File Reference
#include <stdlib.h>
#include <string.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "DNA_ID.h"
#include "DNA_collection_types.h"
#include "DNA_key_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "BKE_armature.h"
#include "BKE_collection.h"
#include "BKE_global.h"
#include "BKE_idtype.h"
#include "BKE_key.h"
#include "BKE_layer.h"
#include "BKE_lib_id.h"
#include "BKE_lib_override.h"
#include "BKE_lib_query.h"
#include "BKE_lib_remap.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BLI_ghash.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLI_task.h"
#include "BLI_utildefines.h"
#include "RNA_access.h"
#include "RNA_types.h"
#include "atomic_ops.h"

Go to the source code of this file.

Classes

struct  LibOverrideGroupTagData
 
struct  LibOverrideOpCreateData
 

Macros

#define OVERRIDE_AUTO_CHECK_DELAY   0.2 /* 200ms between auto-override checks. */
 
#define OVERRIDE_RESYNC_RESIDUAL_STORAGE_NAME   "OVERRIDE_RESYNC_LEFTOVERS"
 

Typedefs

typedef struct LibOverrideGroupTagData LibOverrideGroupTagData
 

Functions

static void lib_override_library_property_copy (IDOverrideLibraryProperty *op_dst, IDOverrideLibraryProperty *op_src)
 
static void lib_override_library_property_operation_copy (IDOverrideLibraryPropertyOperation *opop_dst, IDOverrideLibraryPropertyOperation *opop_src)
 
static void lib_override_library_property_clear (IDOverrideLibraryProperty *op)
 
static void lib_override_library_property_operation_clear (IDOverrideLibraryPropertyOperation *opop)
 
IDOverrideLibraryBKE_lib_override_library_init (ID *local_id, ID *reference_id)
 
void BKE_lib_override_library_copy (ID *dst_id, const ID *src_id, const bool do_full_copy)
 
void BKE_lib_override_library_clear (IDOverrideLibrary *override, const bool do_id_user)
 
void BKE_lib_override_library_free (struct IDOverrideLibrary **override, const bool do_id_user)
 
static IDlib_override_library_create_from (Main *bmain, ID *reference_id)
 
bool BKE_lib_override_library_is_user_edited (struct ID *id)
 
IDBKE_lib_override_library_create_from_id (Main *bmain, ID *reference_id, const bool do_tagged_remap)
 
bool BKE_lib_override_library_create_from_tag (Main *bmain)
 
static bool lib_override_hierarchy_dependencies_recursive_tag (LibOverrideGroupTagData *data)
 
static void lib_override_linked_group_tag_recursive (LibOverrideGroupTagData *data)
 
static void lib_override_linked_group_tag (LibOverrideGroupTagData *data)
 
static void lib_override_local_group_tag_recursive (LibOverrideGroupTagData *data)
 
static void lib_override_local_group_tag (LibOverrideGroupTagData *data)
 
static bool lib_override_library_create_do (Main *bmain, ID *id_root)
 
static void lib_override_library_create_post_process (Main *bmain, Scene *scene, ViewLayer *view_layer, ID *id_root, ID *id_reference, Collection *residual_storage, const bool is_resync)
 
bool BKE_lib_override_library_create (Main *bmain, Scene *scene, ViewLayer *view_layer, ID *id_root, ID *id_reference)
 
bool BKE_lib_override_library_template_create (struct ID *id)
 
bool BKE_lib_override_library_proxy_convert (Main *bmain, Scene *scene, ViewLayer *view_layer, Object *ob_proxy)
 
bool BKE_lib_override_library_resync (Main *bmain, Scene *scene, ViewLayer *view_layer, ID *id_root, Collection *override_resync_residual_storage, const bool do_hierarchy_enforce, const bool do_post_process)
 
void BKE_lib_override_library_main_resync (Main *bmain, Scene *scene, ViewLayer *view_layer)
 
void BKE_lib_override_library_delete (Main *bmain, ID *id_root)
 
void BKE_lib_override_library_make_local (ID *id)
 
BLI_INLINE IDOverrideLibraryRuntimeoverride_library_rna_path_runtime_ensure (IDOverrideLibrary *override)
 
BLI_INLINE GHashoverride_library_rna_path_mapping_ensure (IDOverrideLibrary *override)
 
IDOverrideLibraryPropertyBKE_lib_override_library_property_find (IDOverrideLibrary *override, const char *rna_path)
 
IDOverrideLibraryPropertyBKE_lib_override_library_property_get (IDOverrideLibrary *override, const char *rna_path, bool *r_created)
 
bool BKE_lib_override_rna_property_find (PointerRNA *idpoin, const IDOverrideLibraryProperty *library_prop, PointerRNA *r_override_poin, PropertyRNA **r_override_prop)
 
void BKE_lib_override_library_property_delete (IDOverrideLibrary *override, IDOverrideLibraryProperty *override_property)
 
IDOverrideLibraryPropertyOperationBKE_lib_override_library_property_operation_find (IDOverrideLibraryProperty *override_property, const char *subitem_refname, const char *subitem_locname, const int subitem_refindex, const int subitem_locindex, const bool strict, bool *r_strict)
 
IDOverrideLibraryPropertyOperationBKE_lib_override_library_property_operation_get (IDOverrideLibraryProperty *override_property, const short operation, const char *subitem_refname, const char *subitem_locname, const int subitem_refindex, const int subitem_locindex, const bool strict, bool *r_strict, bool *r_created)
 
void BKE_lib_override_library_property_operation_delete (IDOverrideLibraryProperty *override_property, IDOverrideLibraryPropertyOperation *override_property_operation)
 
bool BKE_lib_override_library_property_operation_operands_validate (struct IDOverrideLibraryPropertyOperation *override_property_operation, struct PointerRNA *ptr_dst, struct PointerRNA *ptr_src, struct PointerRNA *ptr_storage, struct PropertyRNA *prop_dst, struct PropertyRNA *prop_src, struct PropertyRNA *prop_storage)
 
void BKE_lib_override_library_validate (Main *UNUSED(bmain), ID *id, ReportList *reports)
 
void BKE_lib_override_library_main_validate (Main *bmain, ReportList *reports)
 
bool BKE_lib_override_library_status_check_local (Main *bmain, ID *local)
 
bool BKE_lib_override_library_status_check_reference (Main *bmain, ID *local)
 
bool BKE_lib_override_library_operations_create (Main *bmain, ID *local)
 
static void lib_override_library_operations_create_cb (TaskPool *__restrict pool, void *taskdata)
 
bool BKE_lib_override_library_main_operations_create (Main *bmain, const bool force_auto)
 
static bool lib_override_library_id_reset_do (Main *bmain, ID *id_root)
 
void BKE_lib_override_library_id_reset (Main *bmain, ID *id_root)
 
static void lib_override_library_id_hierarchy_recursive_reset (Main *bmain, ID *id_root)
 
void BKE_lib_override_library_id_hierarchy_reset (Main *bmain, ID *id_root)
 
void BKE_lib_override_library_operations_tag (struct IDOverrideLibraryProperty *override_property, const short tag, const bool do_set)
 
void BKE_lib_override_library_properties_tag (struct IDOverrideLibrary *override, const short tag, const bool do_set)
 
void BKE_lib_override_library_main_tag (struct Main *bmain, const short tag, const bool do_set)
 
void BKE_lib_override_library_id_unused_cleanup (struct ID *local)
 
void BKE_lib_override_library_main_unused_cleanup (struct Main *bmain)
 
static void lib_override_id_swap (Main *bmain, ID *id_local, ID *id_temp)
 
void BKE_lib_override_library_update (Main *bmain, ID *local)
 
void BKE_lib_override_library_main_update (Main *bmain)
 
OverrideLibraryStorageBKE_lib_override_library_operations_store_init (void)
 
IDBKE_lib_override_library_operations_store_start (Main *bmain, OverrideLibraryStorage *override_storage, ID *local)
 
void BKE_lib_override_library_operations_store_end (OverrideLibraryStorage *UNUSED(override_storage), ID *local)
 
void BKE_lib_override_library_operations_store_finalize (OverrideLibraryStorage *override_storage)
 

Variables

static CLG_LogRef LOG = {"bke.liboverride"}
 

Macro Definition Documentation

◆ OVERRIDE_AUTO_CHECK_DELAY

#define OVERRIDE_AUTO_CHECK_DELAY   0.2 /* 200ms between auto-override checks. */

Definition at line 66 of file lib_override.c.

◆ OVERRIDE_RESYNC_RESIDUAL_STORAGE_NAME

#define OVERRIDE_RESYNC_RESIDUAL_STORAGE_NAME   "OVERRIDE_RESYNC_LEFTOVERS"

Typedef Documentation

◆ LibOverrideGroupTagData

Function Documentation

◆ BKE_lib_override_library_clear()

void BKE_lib_override_library_clear ( IDOverrideLibrary override,
const bool  do_id_user 
)

◆ BKE_lib_override_library_copy()

void BKE_lib_override_library_copy ( ID dst_id,
const ID src_id,
const bool  do_full_copy 
)

◆ BKE_lib_override_library_create()

bool BKE_lib_override_library_create ( Main bmain,
Scene scene,
ViewLayer view_layer,
ID id_root,
ID id_reference 
)

Advanced 'smart' function to create fully functional overrides.

Note
Currently it only does special things if given id_root is an object of collection, more specific behaviors may be added in the future for other ID types.
It will override all IDs tagged with LIB_TAG_DOIT, and it does not clear that tag at its beginning, so caller code can add extra data-blocks to be overridden as well.
Parameters
id_rootThe root ID to create an override from.
id_referenceSome reference ID used to do some post-processing after overrides have been created, may be NULL. Typically, the Empty object instantiating the linked collection we override, currently.
Returns
true if override was successfully created.

Definition at line 788 of file lib_override.c.

References BKE_lib_override_library_main_operations_create(), BKE_main_id_clear_newpoins(), BKE_main_id_tag_all(), lib_override_library_create_do(), lib_override_library_create_post_process(), LIB_TAG_DOIT, NULL, and scene.

Referenced by BKE_lib_override_library_proxy_convert(), id_override_library_create_fn(), and make_override_library_exec().

◆ BKE_lib_override_library_create_from_id()

ID* BKE_lib_override_library_create_from_id ( Main bmain,
ID reference_id,
const bool  do_tagged_remap 
)

◆ BKE_lib_override_library_create_from_tag()

bool BKE_lib_override_library_create_from_tag ( Main bmain)

Create overridden local copies of all tagged data-blocks in given Main.

Note
Set id->newid of overridden libs with newly created overrides, caller is responsible to clean those pointers before/after usage as needed.
By default, it will only remap newly created local overriding data-blocks between themselves, to avoid 'enforcing' those overrides into all other usages of the linked data in main. You can add more local IDs to be remapped to use new overriding ones by setting their LIB_TAG_DOIT tag.
Returns
true on success, false otherwise.

Definition at line 308 of file lib_override.c.

References BKE_id_delete(), BKE_idtype_idcode_is_linkable(), BKE_key_from_id(), BKE_libblock_relink_ex(), BLI_addtail(), BLI_assert, BLI_freelistN(), LinkData::data, ListBase::first, FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, GS, Key::id, ID_REMAP_SKIP_INDIRECT_USAGE, ID_REMAP_SKIP_OVERRIDE_LIBRARY, ID::lib, lib_override_library_create_from(), LIB_TAG_DOIT, MEM_callocN, ID::name, ID::newid, LinkData::next, NULL, and ID::tag.

Referenced by BKE_lib_override_library_resync(), and lib_override_library_create_do().

◆ BKE_lib_override_library_delete()

void BKE_lib_override_library_delete ( Main bmain,
ID id_root 
)

Advanced 'smart' function to delete library overrides (including their existing override hierarchy) and remap their usages to their linked reference IDs.

Note
All IDs tagged with LIB_TAG_DOIT will be deleted.
Parameters
id_rootThe root liboverride ID to delete.

Definition at line 1285 of file lib_override.c.

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, id, ID_IS_OVERRIDE_LIBRARY_REAL, ID_REMAP_SKIP_INDIRECT_USAGE, lib_override_local_group_tag(), LIB_TAG_DOIT, LIB_TAG_MISSING, ID::override_library, IDOverrideLibrary::reference, and ID::tag.

Referenced by id_override_library_delete_fn().

◆ BKE_lib_override_library_free()

void BKE_lib_override_library_free ( struct IDOverrideLibrary **  override,
const bool  do_id_user 
)

◆ BKE_lib_override_library_id_hierarchy_reset()

void BKE_lib_override_library_id_hierarchy_reset ( Main bmain,
ID id_root 
)

◆ BKE_lib_override_library_id_reset()

void BKE_lib_override_library_id_reset ( Main bmain,
ID id_root 
)

◆ BKE_lib_override_library_id_unused_cleanup()

void BKE_lib_override_library_id_unused_cleanup ( struct ID local)

◆ BKE_lib_override_library_init()

IDOverrideLibrary* BKE_lib_override_library_init ( ID local_id,
ID reference_id 
)

◆ BKE_lib_override_library_is_user_edited()

bool BKE_lib_override_library_is_user_edited ( struct ID id)

Check if given ID has some override rules that actually indicate the user edited it.

TODO: This could be simplified by storing a flag in IDOverrideLibrary during the diffing process?

Definition at line 231 of file lib_override.c.

References id, ID_IS_OVERRIDE_LIBRARY, IDOVERRIDE_LIBRARY_FLAG_IDPOINTER_MATCH_REFERENCE, IDOVERRIDE_LIBRARY_OP_NOOP, LISTBASE_FOREACH, ID::override_library, and IDOverrideLibrary::properties.

Referenced by BKE_lib_override_library_resync().

◆ BKE_lib_override_library_main_operations_create()

bool BKE_lib_override_library_main_operations_create ( Main bmain,
const bool  force_auto 
)

◆ BKE_lib_override_library_main_resync()

void BKE_lib_override_library_main_resync ( Main bmain,
Scene scene,
ViewLayer view_layer 
)

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).

Definition at line 1140 of file lib_override.c.

References BKE_collection_add(), BKE_collection_delete(), BKE_collection_is_empty(), BKE_lib_override_library_resync(), BKE_main_id_tag_all(), BKE_main_relations_create(), BKE_main_relations_free(), BKE_main_relations_tag_set(), BLI_assert, BLI_findstring(), BLI_ghash_lookup(), CLOG_INFO, COLLECTION_RESTRICT_RENDER, COLLECTION_RESTRICT_VIEWPORT, Main::collections, data, Collection::flag, FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, FOREACH_MAIN_LISTBASE_BEGIN, FOREACH_MAIN_LISTBASE_END, FOREACH_MAIN_LISTBASE_ID_BEGIN, FOREACH_MAIN_LISTBASE_ID_END, id, Collection::id, ID_IS_LINKED, ID_IS_OVERRIDE_LIBRARY_REAL, IDWALK_CB_OVERRIDE_LIBRARY_NOT_OVERRIDABLE, ID::lib, lib_override_hierarchy_dependencies_recursive_tag(), lib_override_library_create_post_process(), lib_override_linked_group_tag(), LIB_TAG_DOIT, LIB_TAG_LIB_OVERRIDE_NEED_RESYNC, LIB_TAG_MISSING, LOG, MAINIDRELATIONS_ENTRY_TAGS_PROCESSED, Scene::master_collection, ID::name, NULL, OVERRIDE_RESYNC_RESIDUAL_STORAGE_NAME, Main::relations, MainIDRelations::relations_from_pointers, scene, ID::tag, and MainIDRelationsEntry::to_ids.

Referenced by setup_app_data().

◆ BKE_lib_override_library_main_tag()

void BKE_lib_override_library_main_tag ( struct Main bmain,
const short  tag,
const bool  do_set 
)

Set or clear given tag in all properties and operations in that Main's ID override data.

Definition at line 2192 of file lib_override.c.

References BKE_lib_override_library_properties_tag(), LibOverrideOpCreateData::bmain, FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, id, ID_IS_OVERRIDE_LIBRARY, and ID::override_library.

Referenced by BKE_lib_override_library_main_operations_create().

◆ BKE_lib_override_library_main_unused_cleanup()

void BKE_lib_override_library_main_unused_cleanup ( struct Main bmain)

Remove all tagged-as-unused properties and operations from that Main's ID override data.

Definition at line 2225 of file lib_override.c.

References BKE_lib_override_library_id_unused_cleanup(), LibOverrideOpCreateData::bmain, FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, id, and ID_IS_OVERRIDE_LIBRARY.

Referenced by BKE_lib_override_library_main_operations_create().

◆ BKE_lib_override_library_main_update()

void BKE_lib_override_library_main_update ( Main bmain)

◆ BKE_lib_override_library_main_validate()

void BKE_lib_override_library_main_validate ( Main bmain,
ReportList reports 
)

Check against potential bmain.

Definition at line 1719 of file lib_override.c.

References BKE_lib_override_library_validate(), FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, id, NULL, and ID::override_library.

Referenced by blo_read_file_internal().

◆ BKE_lib_override_library_make_local()

void BKE_lib_override_library_make_local ( ID id)

Make given ID fully local.

Note
Only differs from lower-level `BKE_lib_override_library_free in infamous embedded ID cases.

Definition at line 1322 of file lib_override.c.

References BKE_key_from_id(), BKE_lib_override_library_free(), BLI_assert_unreachable, ID::flag, GS, id, Collection::id, Key::id, ID_IS_OVERRIDE_LIBRARY, ID_IS_OVERRIDE_LIBRARY_VIRTUAL, ID_SCE, LIB_EMBEDDED_DATA_LIB_OVERRIDE, ID::name, ntreeFromID(), NULL, and ID::override_library.

Referenced by BKE_library_make_local(), id_local_fn(), and template_id_cb().

◆ BKE_lib_override_library_operations_create()

bool BKE_lib_override_library_operations_create ( Main bmain,
ID local 
)

Compare local and reference data-blocks and create new override operations as needed, or reset to reference values if overriding is not allowed.

Note
Defining override operations is only mandatory before saving a .blend file on disk (not for undo!). Knowing that info at runtime is only useful for UI/UX feedback.
This is by far the biggest operation (the more time-consuming) of the three so far, since it has to go over all properties in depth (all overridable ones at least). Generating differential values and applying overrides are much cheaper.
Returns
true if any library operation was created.

Definition at line 1870 of file lib_override.c.

References BKE_pose_ensure(), BLI_assert, CLOG_INFO, Object::data, GS, ID_MISSING, ID_OB, LOG, ID::name, NULL, OB_ARMATURE, ID::override_library, IDOverrideLibrary::reference, RNA_id_pointer_create(), RNA_OVERRIDE_COMPARE_CREATE, RNA_OVERRIDE_COMPARE_RESTORE, RNA_OVERRIDE_MATCH_RESULT_CREATED, RNA_OVERRIDE_MATCH_RESULT_RESTORED, RNA_struct_override_matches(), and Object::type.

Referenced by BKE_lib_override_library_operations_store_start(), and lib_override_library_operations_create_cb().

◆ BKE_lib_override_library_operations_store_end()

void BKE_lib_override_library_operations_store_end ( OverrideLibraryStorage UNUSEDoverride_storage,
ID local 
)

Restore given ID modified by BKE_lib_override_library_operations_store_start, to its original state.

Definition at line 2483 of file lib_override.c.

References BLI_assert, ID_IS_OVERRIDE_LIBRARY_REAL, NULL, ID::override_library, and IDOverrideLibrary::storage.

◆ BKE_lib_override_library_operations_store_finalize()

void BKE_lib_override_library_operations_store_finalize ( OverrideLibraryStorage override_storage)

◆ BKE_lib_override_library_operations_store_init()

OverrideLibraryStorage* BKE_lib_override_library_operations_store_init ( void  )

Storage (how to store overriding data into .blend files).

Basically: 1) Only 'differential' overrides needs special handling here. All others (replacing values or inserting/removing items from a collection) can be handled with simply storing current content of local data-block. 2) We store the differential value into a second 'ghost' data-block, which is an empty ID of same type as the local one, where we only define values that need differential data.

This avoids us having to modify 'real' data-block at write time (and restoring it afterwards), which is inefficient, and potentially dangerous (in case of concurrent access...), while not using much extra memory in typical cases. It also ensures stored data-block always contains exact same data as "desired" ones (kind of "baked" data-blocks). Initialize an override storage.

Definition at line 2405 of file lib_override.c.

References BKE_main_new().

Referenced by write_file_handle().

◆ BKE_lib_override_library_operations_store_start()

ID* BKE_lib_override_library_operations_store_start ( Main bmain,
OverrideLibraryStorage override_storage,
ID local 
)

◆ BKE_lib_override_library_operations_tag()

void BKE_lib_override_library_operations_tag ( struct IDOverrideLibraryProperty override_property,
const short  tag,
const bool  do_set 
)

Set or clear given tag in all operations in that override property data.

Definition at line 2156 of file lib_override.c.

References LISTBASE_FOREACH, NULL, IDOverrideLibraryProperty::operations, and IDOverrideLibraryProperty::tag.

Referenced by BKE_lib_override_library_properties_tag(), and RNA_struct_override_matches().

◆ BKE_lib_override_library_properties_tag()

void BKE_lib_override_library_properties_tag ( struct IDOverrideLibrary override,
const short  tag,
const bool  do_set 
)

Set or clear given tag in all properties and operations in that override data.

Definition at line 2180 of file lib_override.c.

References BKE_lib_override_library_operations_tag(), LISTBASE_FOREACH, NULL, and override.

Referenced by BKE_lib_override_library_main_operations_create(), and BKE_lib_override_library_main_tag().

◆ BKE_lib_override_library_property_delete()

void BKE_lib_override_library_property_delete ( IDOverrideLibrary override,
IDOverrideLibraryProperty override_property 
)

◆ BKE_lib_override_library_property_find()

IDOverrideLibraryProperty* BKE_lib_override_library_property_find ( IDOverrideLibrary override,
const char *  rna_path 
)

◆ BKE_lib_override_library_property_get()

IDOverrideLibraryProperty* BKE_lib_override_library_property_get ( IDOverrideLibrary override,
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 1391 of file lib_override.c.

References BKE_lib_override_library_property_find(), BLI_addtail(), BLI_ghash_insert(), BLI_strdup(), MEM_callocN, NULL, override, override_library_rna_path_mapping_ensure(), and IDOverrideLibraryProperty::rna_path.

Referenced by RNA_property_override_property_get().

◆ BKE_lib_override_library_property_operation_delete()

void BKE_lib_override_library_property_operation_delete ( IDOverrideLibraryProperty override_property,
IDOverrideLibraryPropertyOperation override_property_operation 
)

Remove and free given override_property_operation from given ID override_property.

Definition at line 1636 of file lib_override.c.

References BLI_freelinkN(), lib_override_library_property_operation_clear(), and IDOverrideLibraryProperty::operations.

Referenced by BKE_lib_override_library_id_unused_cleanup(), and override_remove_button_exec().

◆ BKE_lib_override_library_property_operation_find()

IDOverrideLibraryPropertyOperation* BKE_lib_override_library_property_operation_find ( IDOverrideLibraryProperty override_property,
const char *  subitem_refname,
const char *  subitem_locname,
const int  subitem_refindex,
const int  subitem_locindex,
const bool  strict,
bool *  r_strict 
)

◆ BKE_lib_override_library_property_operation_get()

IDOverrideLibraryPropertyOperation* BKE_lib_override_library_property_operation_get ( IDOverrideLibraryProperty override_property,
const short  operation,
const char *  subitem_refname,
const char *  subitem_locname,
const int  subitem_refindex,
const int  subitem_locindex,
const bool  strict,
bool *  r_strict,
bool *  r_created 
)

◆ BKE_lib_override_library_property_operation_operands_validate()

bool BKE_lib_override_library_property_operation_operands_validate ( struct IDOverrideLibraryPropertyOperation override_property_operation,
struct PointerRNA ptr_dst,
struct PointerRNA ptr_src,
struct PointerRNA ptr_storage,
struct PropertyRNA prop_dst,
struct PropertyRNA prop_src,
struct PropertyRNA prop_storage 
)

◆ BKE_lib_override_library_proxy_convert()

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.

Note
This is a thin wrapper around BKE_lib_override_library_create, only extra work is to actually convert the proxy itself into an override first.
Returns
true if override was successfully created.

Definition at line 834 of file lib_override.c.

References BKE_lib_override_library_create(), BKE_lib_override_library_init(), DEG_id_tag_update(), Collection::id, Object::id, ID_IS_OVERRIDABLE_LIBRARY, ID_RECALC_COPY_ON_WRITE, Object::instance_collection, LIB_TAG_DOIT, ID::newid, NULL, Object::proxy, Object::proxy_from, Object::proxy_group, scene, and ID::tag.

Referenced by convert_proxy_to_override_exec(), and object_proxy_to_override_convert_fn().

◆ BKE_lib_override_library_resync()

bool BKE_lib_override_library_resync ( Main bmain,
Scene scene,
ViewLayer view_layer,
ID id_root,
Collection override_resync_residual_storage,
const bool  do_hierarchy_enforce,
const bool  do_post_process 
)

Advanced 'smart' function to resync, re-create fully functional overrides up-to-date with linked data, from an existing override hierarchy.

Parameters
id_rootThe root liboverride ID to resync from.
Returns
true if override was successfully resynced.

Definition at line 876 of file lib_override.c.

References BKE_id_multi_tagged_delete(), BKE_lib_override_library_create_from_tag(), BKE_lib_override_library_is_user_edited(), BKE_lib_override_library_property_delete(), BKE_libblock_remap(), BKE_main_id_clear_newpoins(), BKE_main_id_tag_all(), BKE_main_relations_create(), BKE_main_relations_free(), BKE_main_relations_tag_set(), BLI_assert, BLI_duplicatelist(), BLI_freelinkN(), BLI_ghash_free(), BLI_ghash_haskey(), BLI_ghash_insert(), BLI_ghash_lookup(), BLI_ghash_new(), BLI_ghashutil_ptrcmp(), BLI_ghashutil_ptrhash(), BLI_listbase_is_empty(), BLI_listbase_swaplinks(), CLOG_INFO, data, ELEM, ListBase::first, FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, FOREACH_MAIN_LISTBASE_BEGIN, FOREACH_MAIN_LISTBASE_END, FOREACH_MAIN_LISTBASE_ID_BEGIN, FOREACH_MAIN_LISTBASE_ID_END, GS, id, id_fake_user_set(), ID_IS_LINKED, ID_IS_OVERRIDE_LIBRARY, ID_IS_OVERRIDE_LIBRARY_REAL, ID_REMAP_SKIP_INDIRECT_USAGE, IDOVERRIDE_LIBRARY_FLAG_IDPOINTER_MATCH_REFERENCE, LIB_LIB_OVERRIDE_RESYNC_LEFTOVER, lib_override_hierarchy_dependencies_recursive_tag(), lib_override_library_create_post_process(), lib_override_library_property_copy(), lib_override_library_property_operation_clear(), lib_override_linked_group_tag(), lib_override_local_group_tag(), LIB_TAG_DOIT, LIB_TAG_LIB_OVERRIDE_NEED_RESYNC, LIB_TAG_MISSING, LISTBASE_FOREACH, LISTBASE_FOREACH_MUTABLE, LOG, MAINIDRELATIONS_ENTRY_TAGS_PROCESSED, MAX_ID_NAME, ID::name, ID::newid, NULL, OB_DATA_SUPPORT_ID, ID::override_library, PROP_COLLECTION, PROP_POINTER, IDOverrideLibrary::properties, IDOverrideLibrary::reference, RNA_id_pointer_create(), RNA_OVERRIDE_APPLY_FLAG_IGNORE_ID_POINTERS, RNA_OVERRIDE_APPLY_FLAG_NOP, RNA_struct_override_apply(), scene, and ID::tag.

Referenced by BKE_lib_override_library_main_resync(), and id_override_library_resync_fn().

◆ BKE_lib_override_library_status_check_local()

bool BKE_lib_override_library_status_check_local ( Main bmain,
ID local 
)

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 #LIB_TAG_OVERRIDE_OK 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.

Returns
true if status is OK, false otherwise.

Definition at line 1741 of file lib_override.c.

References BKE_pose_ensure(), BLI_assert, Object::data, GS, ID_IS_OVERRIDE_LIBRARY_REAL, ID_OB, LIB_TAG_OVERRIDE_LIBRARY_REFOK, ID::name, NULL, 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.

◆ BKE_lib_override_library_status_check_reference()

bool BKE_lib_override_library_status_check_reference ( Main bmain,
ID local 
)

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 LIB_TAG_OVERRIDE_OK if they do not.

This is typically used to detect whether some reference has changed and local needs to be updated against it.

Returns
true if status is OK, false otherwise.

Definition at line 1800 of file lib_override.c.

References BKE_lib_override_library_status_check_reference(), BKE_pose_ensure(), BLI_assert, Object::data, GS, ID_IS_OVERRIDE_LIBRARY_REAL, ID_OB, LIB_TAG_OVERRIDE_LIBRARY_REFOK, ID::name, NULL, 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().

◆ BKE_lib_override_library_template_create()

bool BKE_lib_override_library_template_create ( struct ID id)

Create a library override template.

Definition at line 813 of file lib_override.c.

References BKE_lib_override_library_init(), ID_IS_LINKED, ID_IS_OVERRIDE_LIBRARY, and NULL.

◆ BKE_lib_override_library_update()

void BKE_lib_override_library_update ( Main bmain,
ID local 
)

◆ BKE_lib_override_library_validate()

void BKE_lib_override_library_validate ( Main UNUSEDbmain,
ID id,
ReportList reports 
)

Check against potential bmain.

Definition at line 1685 of file lib_override.c.

References BKE_reportf(), id, ID::lib, ID::name, NULL, ID::override_library, IDOverrideLibrary::reference, and RPT_ERROR.

Referenced by BKE_lib_override_library_main_validate().

◆ BKE_lib_override_rna_property_find()

bool BKE_lib_override_rna_property_find ( PointerRNA idpoin,
const IDOverrideLibraryProperty library_prop,
PointerRNA r_override_poin,
PropertyRNA **  r_override_prop 
)

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).

Parameters
idpoinPointer to the override ID.
library_propThe library override property to find the matching RNA property for.

Definition at line 1423 of file lib_override.c.

References BLI_assert, PointerRNA::data, ID_IS_OVERRIDE_LIBRARY, IDOverrideLibraryProperty::rna_path, RNA_path_resolve_property(), RNA_struct_is_ID(), and PointerRNA::type.

◆ lib_override_hierarchy_dependencies_recursive_tag()

static bool lib_override_hierarchy_dependencies_recursive_tag ( LibOverrideGroupTagData data)
static

◆ lib_override_id_swap()

static void lib_override_id_swap ( Main bmain,
ID id_local,
ID id_temp 
)
static

◆ lib_override_library_create_do()

static bool lib_override_library_create_do ( Main bmain,
ID id_root 
)
static

◆ lib_override_library_create_from()

static ID* lib_override_library_create_from ( Main bmain,
ID reference_id 
)
static

◆ lib_override_library_create_post_process()

static void lib_override_library_create_post_process ( Main bmain,
Scene scene,
ViewLayer view_layer,
ID id_root,
ID id_reference,
Collection residual_storage,
const bool  is_resync 
)
static

◆ lib_override_library_id_hierarchy_recursive_reset()

static void lib_override_library_id_hierarchy_recursive_reset ( Main bmain,
ID id_root 
)
static

◆ lib_override_library_id_reset_do()

static bool lib_override_library_id_reset_do ( Main bmain,
ID id_root 
)
static

◆ lib_override_library_operations_create_cb()

static void lib_override_library_operations_create_cb ( TaskPool *__restrict  pool,
void *  taskdata 
)
static

◆ lib_override_library_property_clear()

void lib_override_library_property_clear ( IDOverrideLibraryProperty op)
static

◆ lib_override_library_property_copy()

void lib_override_library_property_copy ( IDOverrideLibraryProperty op_dst,
IDOverrideLibraryProperty op_src 
)
static

◆ lib_override_library_property_operation_clear()

void lib_override_library_property_operation_clear ( IDOverrideLibraryPropertyOperation opop)
static

◆ lib_override_library_property_operation_copy()

void lib_override_library_property_operation_copy ( IDOverrideLibraryPropertyOperation opop_dst,
IDOverrideLibraryPropertyOperation opop_src 
)
static

◆ lib_override_linked_group_tag()

static void lib_override_linked_group_tag ( LibOverrideGroupTagData data)
static

◆ lib_override_linked_group_tag_recursive()

static void lib_override_linked_group_tag_recursive ( LibOverrideGroupTagData data)
static

◆ lib_override_local_group_tag()

static void lib_override_local_group_tag ( LibOverrideGroupTagData data)
static

◆ lib_override_local_group_tag_recursive()

static void lib_override_local_group_tag_recursive ( LibOverrideGroupTagData data)
static

◆ override_library_rna_path_mapping_ensure()

BLI_INLINE GHash* override_library_rna_path_mapping_ensure ( IDOverrideLibrary override)

◆ override_library_rna_path_runtime_ensure()

BLI_INLINE IDOverrideLibraryRuntime* override_library_rna_path_runtime_ensure ( IDOverrideLibrary override)

Variable Documentation

◆ LOG

CLG_LogRef LOG = {"bke.liboverride"}
static