Blender V4.3
rna_access_compare_override.cc File Reference
#include <cstring>
#include <fmt/format.h>
#include <optional>
#include <CLG_log.h>
#include "MEM_guardedalloc.h"
#include "DNA_ID.h"
#include "DNA_anim_types.h"
#include "DNA_camera_types.h"
#include "DNA_constraint_types.h"
#include "DNA_gpencil_modifier_types.h"
#include "DNA_key_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BKE_armature.hh"
#include "BKE_idprop.hh"
#include "BKE_idtype.hh"
#include "BKE_lib_override.hh"
#include "BKE_main.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "RNA_enum_types.hh"
#include "RNA_path.hh"
#include "RNA_prototypes.hh"
#include "rna_access_internal.hh"
#include "rna_internal.hh"

Go to the source code of this file.

Macros

#define RNA_PATH_BUFFSIZE   8192
 

Functions

static IDrna_property_override_property_real_id_owner (Main *, PointerRNA *ptr, PropertyRNA *prop, std::optional< std::string > *r_rna_path)
 
int RNA_property_override_flag (PropertyRNA *prop)
 
bool RNA_property_overridable_get (const PointerRNA *ptr, PropertyRNA *prop)
 
bool RNA_property_overridable_library_set (PointerRNA *, PropertyRNA *prop, const bool is_overridable)
 
bool RNA_property_overridden (PointerRNA *ptr, PropertyRNA *prop)
 
bool RNA_property_comparable (PointerRNA *, PropertyRNA *prop)
 
static bool rna_property_override_operation_apply (Main *bmain, RNAPropertyOverrideApplyContext &rnaapply_ctx)
 
bool RNA_property_copy (Main *bmain, PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, int index)
 
static int rna_property_override_diff (Main *bmain, PropertyRNAOrID *prop_a, PropertyRNAOrID *prop_b, const char *rna_path, const size_t rna_path_len, eRNACompareMode mode, IDOverrideLibrary *liboverride, const eRNAOverrideMatch flags, eRNAOverrideMatchResult *r_report_flags)
 
bool RNA_property_equals (Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b, PropertyRNA *prop, eRNACompareMode mode)
 
bool RNA_struct_equals (Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b, eRNACompareMode mode)
 
static bool rna_property_override_operation_store (Main *bmain, PointerRNA *ptr_local, PointerRNA *ptr_reference, PointerRNA *ptr_storage, PropertyRNA *prop_local, PropertyRNA *prop_reference, PropertyRNA *prop_storage, IDOverrideLibraryProperty *op)
 
bool RNA_struct_override_matches (Main *bmain, PointerRNA *ptr_local, PointerRNA *ptr_reference, const char *root_path, const size_t root_path_len, IDOverrideLibrary *liboverride, const eRNAOverrideMatch flags, eRNAOverrideMatchResult *r_report_flags)
 
bool RNA_struct_override_store (Main *bmain, PointerRNA *ptr_local, PointerRNA *ptr_reference, PointerRNA *ptr_storage, IDOverrideLibrary *liboverride)
 
static bool rna_property_override_collection_subitem_name_id_match (const char *item_name, const int item_name_len, const bool do_id_pointer, const std::optional< ID * > &item_id, PointerRNA *ptr_item_name)
 
static bool rna_property_override_collection_subitem_name_id_lookup (PointerRNA *ptr, PropertyRNA *prop, const char *item_name, const int item_name_len, const bool do_id_pointer, const std::optional< ID * > &item_id, PointerRNA *r_ptr_item_name)
 
static void rna_property_override_collection_subitem_name_index_lookup (PointerRNA *ptr, PropertyRNA *prop, const char *item_name, const std::optional< ID * > &item_id, const int item_index, PointerRNA *r_ptr_item_name, PointerRNA *r_ptr_item_index)
 
static void rna_property_override_collection_subitem_lookup (RNAPropertyOverrideApplyContext &rnaapply_ctx)
 
static void rna_property_override_check_resync (Main *bmain, PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *ptr_item_dst, PointerRNA *ptr_item_src)
 
static void rna_property_override_apply_ex (Main *bmain, RNAPropertyOverrideApplyContext &rnaapply_ctx)
 
static bool override_apply_property_check_skip (Main *bmain, PointerRNA *id_ptr_dst, PointerRNA *id_ptr_src, RNAPropertyOverrideApplyContext &rnaapply_ctx)
 
void RNA_struct_override_apply (Main *bmain, PointerRNA *id_ptr_dst, PointerRNA *id_ptr_src, PointerRNA *id_ptr_storage, IDOverrideLibrary *liboverride, const eRNAOverrideApplyFlag flag)
 
IDOverrideLibraryPropertyRNA_property_override_property_find (Main *bmain, PointerRNA *ptr, PropertyRNA *prop, ID **r_owner_id)
 
IDOverrideLibraryPropertyRNA_property_override_property_get (Main *bmain, PointerRNA *ptr, PropertyRNA *prop, bool *r_created)
 
IDOverrideLibraryPropertyOperationRNA_property_override_property_operation_find (Main *bmain, PointerRNA *ptr, PropertyRNA *prop, const int index, const bool strict, bool *r_strict)
 
IDOverrideLibraryPropertyOperationRNA_property_override_property_operation_get (Main *bmain, PointerRNA *ptr, PropertyRNA *prop, const short operation, const int index, const bool strict, bool *r_strict, bool *r_created)
 
eRNAOverrideStatus RNA_property_override_library_status (Main *bmain, PointerRNA *ptr, PropertyRNA *prop, const int index)
 

Variables

static CLG_LogRef LOG = {"rna.access_compare_override"}
 

Macro Definition Documentation

◆ RNA_PATH_BUFFSIZE

#define RNA_PATH_BUFFSIZE   8192

Function Documentation

◆ override_apply_property_check_skip()

◆ RNA_property_comparable()

bool RNA_property_comparable ( PointerRNA * ptr,
PropertyRNA * prop )

◆ RNA_property_copy()

◆ RNA_property_equals()

◆ RNA_property_overridable_get()

◆ RNA_property_overridable_library_set()

bool RNA_property_overridable_library_set ( PointerRNA * ptr,
PropertyRNA * prop,
bool is_overridable )

Should only be used for custom properties.

Definition at line 171 of file rna_access_compare_override.cc.

References IDProperty::flag, IDP_FLAG_OVERRIDABLE_LIBRARY, IDP_FLAG_STATIC_TYPE, PropertyRNA::magic, and RNA_MAGIC.

Referenced by pyrna_struct_property_overridable_library_set().

◆ RNA_property_overridden()

◆ rna_property_override_apply_ex()

◆ rna_property_override_check_resync()

◆ rna_property_override_collection_subitem_lookup()

◆ rna_property_override_collection_subitem_name_id_lookup()

◆ rna_property_override_collection_subitem_name_id_match()

static bool rna_property_override_collection_subitem_name_id_match ( const char * item_name,
const int item_name_len,
const bool do_id_pointer,
const std::optional< ID * > & item_id,
PointerRNA * ptr_item_name )
static

◆ rna_property_override_collection_subitem_name_index_lookup()

static void rna_property_override_collection_subitem_name_index_lookup ( PointerRNA * ptr,
PropertyRNA * prop,
const char * item_name,
const std::optional< ID * > & item_id,
const int item_index,
PointerRNA * r_ptr_item_name,
PointerRNA * r_ptr_item_index )
static

◆ rna_property_override_diff()

static int rna_property_override_diff ( Main * bmain,
PropertyRNAOrID * prop_a,
PropertyRNAOrID * prop_b,
const char * rna_path,
const size_t rna_path_len,
eRNACompareMode mode,
IDOverrideLibrary * liboverride,
const eRNAOverrideMatch flags,
eRNAOverrideMatchResult * r_report_flags )
static

◆ RNA_property_override_flag()

int RNA_property_override_flag ( PropertyRNA * prop)

◆ RNA_property_override_library_status()

◆ rna_property_override_operation_apply()

◆ rna_property_override_operation_store()

◆ RNA_property_override_property_find()

◆ RNA_property_override_property_get()

IDOverrideLibraryProperty * RNA_property_override_property_get ( Main * bmain,
PointerRNA * ptr,
PropertyRNA * prop,
bool * r_created )

◆ RNA_property_override_property_operation_find()

IDOverrideLibraryPropertyOperation * RNA_property_override_property_operation_find ( Main * bmain,
PointerRNA * ptr,
PropertyRNA * prop,
const int index,
const bool strict,
bool * r_strict )

◆ RNA_property_override_property_operation_get()

IDOverrideLibraryPropertyOperation * RNA_property_override_property_operation_get ( Main * bmain,
PointerRNA * ptr,
PropertyRNA * prop,
const short operation,
const int index,
const bool strict,
bool * r_strict,
bool * r_created )

◆ rna_property_override_property_real_id_owner()

static ID * rna_property_override_property_real_id_owner ( Main * ,
PointerRNA * ptr,
PropertyRNA * prop,
std::optional< std::string > * r_rna_path )
static

Find the actual ID owner of the given ptr PointerRNA, in override sense, and generate the full rna path from it to given prop PropertyRNA if rna_path is given.

Note
This is slightly different than 'generic' RNA 'id owner' as returned by RNA_find_real_ID_and_path, since in overrides we also consider shape keys as embedded data, not only root node trees and master collections.

Definition at line 62 of file rna_access_compare_override.cc.

References BLI_assert_unreachable, GS, ID_FLAG_EMBEDDED_DATA, ID_FLAG_EMBEDDED_DATA_LIB_OVERRIDE, ID_GR, ID_KE, ID_NT, PointerRNA::owner_id, ptr, RNA_find_real_ID_and_path(), and RNA_path_from_ID_to_property().

Referenced by override_apply_property_check_skip(), rna_property_override_check_resync(), RNA_property_override_property_find(), RNA_property_override_property_get(), and RNA_struct_override_apply().

◆ RNA_struct_equals()

◆ RNA_struct_override_apply()

void RNA_struct_override_apply ( Main * bmain,
PointerRNA * id_ptr_dst,
PointerRNA * id_ptr_src,
PointerRNA * id_ptr_storage,
IDOverrideLibrary * liboverride,
eRNAOverrideApplyFlag flag )

Apply given override operations on id_ptr_dst, using id_ptr_src (and id_ptr_storage for differential ops) as source.

Note
Although in theory id_ptr_dst etc. could be any type of RNA structure, currently they are always ID ones. In any case, they are the roots of the rna_path of all override properties in the given liboverride data.

Definition at line 1492 of file rna_access_compare_override.cc.

References BKE_idtype_get_info_from_id(), BLI_assert, CLOG_INFO, PointerRNA::data, RNAPropertyOverrideApplyContext::do_insert, flag, IDOverrideLibraryPropertyOperation::flag, RNAPropertyOverrideApplyContext::flag, ID_TAG_LIBOVERRIDE_NEED_RESYNC, IDTypeInfo::lib_override_apply_post, RNAPropertyOverrideApplyContext::liboverride, LIBOVERRIDE_OP_FLAG_IDPOINTER_MATCH_REFERENCE, RNAPropertyOverrideApplyContext::liboverride_operation, LIBOVERRIDE_PROP_TAG_NEEDS_RETORE, RNAPropertyOverrideApplyContext::liboverride_property, LISTBASE_FOREACH, LOG, ID::name, override_apply_property_check_skip(), PointerRNA::owner_id, PROP_COLLECTION, RNAPropertyOverrideApplyContext::prop_dst, PROP_POINTER, RNAPropertyOverrideApplyContext::prop_src, RNAPropertyOverrideApplyContext::prop_storage, IDOverrideLibrary::properties, RNAPropertyOverrideApplyContext::ptr_dst, RNAPropertyOverrideApplyContext::ptr_item_dst, RNAPropertyOverrideApplyContext::ptr_item_src, RNAPropertyOverrideApplyContext::ptr_item_storage, RNAPropertyOverrideApplyContext::ptr_src, RNAPropertyOverrideApplyContext::ptr_storage, RNA_OVERRIDE_APPLY_FLAG_RESTORE_ONLY, RNA_OVERRIDE_APPLY_FLAG_SKIP_RESYNC_CHECK, RNA_path_resolve_property(), RNA_path_resolve_property_and_item_pointer(), rna_property_override_apply_ex(), rna_property_override_check_resync(), rna_property_override_collection_subitem_lookup(), rna_property_override_property_real_id_owner(), RNA_property_pointer_get(), RNA_property_pointer_type(), RNA_struct_is_a(), RNA_struct_is_ID(), RNA_struct_override_apply(), ID::tag, TIMEIT_END_AVERAGED, TIMEIT_START_AVERAGED, and PointerRNA::type.

Referenced by BKE_lib_override_library_operations_restore(), BKE_lib_override_library_update(), lib_override_library_resync(), and RNA_struct_override_apply().

◆ RNA_struct_override_matches()

bool RNA_struct_override_matches ( Main * bmain,
PointerRNA * ptr_local,
PointerRNA * ptr_reference,
const char * root_path,
size_t root_path_len,
IDOverrideLibrary * liboverride,
eRNAOverrideMatch flags,
eRNAOverrideMatchResult * r_report_flags )

Check whether reference and local overridden data match (are the same), with respect to given restrictive sets of properties. If requested, will generate needed new property overrides, and/or restore values from reference.

Parameters
r_report_flagsIf given, will be set with flags matching actions taken by the function on ptr_local.
Returns
True if resulting ptr_local does match ptr_reference.

Definition at line 594 of file rna_access_compare_override.cc.

References BKE_lib_override_library_operations_tag(), BKE_lib_override_library_property_find(), BKE_lib_override_library_property_get(), BKE_lib_override_library_property_operation_get(), BKE_pose_ensure(), BLI_assert, BLI_assert_msg, BLI_time_now_seconds(), CLOG_INFO, Object::data, PointerRNA::data, diff(), ELEM, ListBase::first, float, GS, ID_OB, PropertyRNAOrID::identifier, PropertyRNAOrID::idprop, PropertyRNAOrID::is_idprop, LIBOVERRIDE_OP_NOOP, LIBOVERRIDE_OP_REPLACE, RNAPropertyOverrideApplyContext::liboverride_operation, LIBOVERRIDE_PROP_OP_TAG_UNUSED, LIBOVERRIDE_PROP_TAG_NEEDS_RETORE, LIBOVERRIDE_TAG_NEEDS_RESTORE, LOG, MEM_mallocN, ID::name, OB_ARMATURE, IDOverrideLibraryPropertyOperation::operation, IDOverrideLibraryProperty::operations, ID::override_library, PointerRNA::owner_id, printf, RNAPropertyOverrideApplyContext::prop_dst, RNAPropertyOverrideApplyContext::prop_src, PROPOVERRIDE_IGNORE, CollectionPropertyIterator::ptr, PropertyRNAOrID::ptr, RNAPropertyOverrideApplyContext::ptr_dst, RNAPropertyOverrideApplyContext::ptr_src, IDOverrideLibrary::reference, RNA_EQ_STRICT, RNA_OVERRIDE_COMPARE_CREATE, RNA_OVERRIDE_COMPARE_IGNORE_NON_OVERRIDABLE, RNA_OVERRIDE_COMPARE_IGNORE_OVERRIDDEN, RNA_OVERRIDE_COMPARE_RESTORE, RNA_OVERRIDE_COMPARE_TAG_FOR_RESTORE, RNA_OVERRIDE_MATCH_RESULT_CREATED, RNA_OVERRIDE_MATCH_RESULT_RESTORE_TAGGED, RNA_OVERRIDE_MATCH_RESULT_RESTORED, RNA_PATH_BUFFSIZE, RNA_path_from_ID_to_property(), RNA_property_animated(), RNA_property_collection_begin(), RNA_property_collection_end(), RNA_property_collection_next(), RNA_property_editable(), RNA_property_overridable_get(), rna_property_override_diff(), RNA_property_override_flag(), rna_property_override_operation_apply(), rna_property_rna_or_id_get(), RNA_struct_iterator_property(), PropertyRNAOrID::rnaprop, IDOverrideLibrary::runtime, IDOverrideLibraryProperty::tag, IDOverrideLibraryPropertyOperation::tag, IDOverrideLibraryRuntime::tag, Object::type, PointerRNA::type, and CollectionPropertyIterator::valid.

Referenced by BKE_lib_override_library_status_check_local(), BKE_lib_override_library_status_check_reference(), and lib_override_library_operations_create().

◆ RNA_struct_override_store()

bool RNA_struct_override_store ( Main * bmain,
PointerRNA * ptr_local,
PointerRNA * ptr_reference,
PointerRNA * ptr_storage,
IDOverrideLibrary * liboverride )

Variable Documentation

◆ LOG