Blender  V3.3
Macros | Functions | Variables
rna_access_compare_override.c File Reference
#include <string.h>
#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.h"
#include "BKE_idprop.h"
#include "BKE_idtype.h"
#include "BKE_lib_override.h"
#include "BKE_main.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "RNA_path.h"
#include "RNA_prototypes.h"
#include "rna_access_internal.h"
#include "rna_internal.h"

Go to the source code of this file.

Macros

#define RNA_PATH_BUFFSIZE   8192
 

Functions

static IDrna_property_override_property_real_id_owner (Main *bmain, PointerRNA *ptr, PropertyRNA *prop, char **r_rna_path)
 
int RNA_property_override_flag (PropertyRNA *prop)
 
bool RNA_property_overridable_get (PointerRNA *ptr, PropertyRNA *prop)
 
bool RNA_property_overridable_library_set (PointerRNA *UNUSED(ptr), PropertyRNA *prop, const bool is_overridable)
 
bool RNA_property_overridden (PointerRNA *ptr, PropertyRNA *prop)
 
bool RNA_property_comparable (PointerRNA *UNUSED(ptr), PropertyRNA *prop)
 
static bool rna_property_override_operation_apply (Main *bmain, PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *ptr_storage, PropertyRNA *prop_dst, PropertyRNA *prop_src, PropertyRNA *prop_storage, PointerRNA *ptr_item_dst, PointerRNA *ptr_item_src, PointerRNA *ptr_item_storage, IDOverrideLibraryPropertyOperation *opop)
 
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 *override, 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 *override, const eRNAOverrideMatch flags, eRNAOverrideMatchResult *r_report_flags)
 
bool RNA_struct_override_store (Main *bmain, PointerRNA *ptr_local, PointerRNA *ptr_reference, PointerRNA *ptr_storage, IDOverrideLibrary *override)
 
static void rna_porperty_override_collection_subitem_lookup (PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *ptr_storage, PropertyRNA *prop_dst, PropertyRNA *prop_src, PropertyRNA *prop_storage, PointerRNA **r_ptr_item_dst, PointerRNA **r_ptr_item_src, PointerRNA **r_ptr_item_storage, PointerRNA *private_ptr_item_dst, PointerRNA *private_ptr_item_src, PointerRNA *private_ptr_item_storage, IDOverrideLibraryProperty *op, IDOverrideLibraryPropertyOperation *opop)
 
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, PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *ptr_storage, PropertyRNA *prop_dst, PropertyRNA *prop_src, PropertyRNA *prop_storage, PointerRNA *ptr_item_dst, PointerRNA *ptr_item_src, PointerRNA *ptr_item_storage, IDOverrideLibraryProperty *op, const bool do_insert)
 
void RNA_struct_override_apply (Main *bmain, PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *ptr_storage, IDOverrideLibrary *override, 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

◆ rna_porperty_override_collection_subitem_lookup()

static void rna_porperty_override_collection_subitem_lookup ( PointerRNA ptr_dst,
PointerRNA ptr_src,
PointerRNA ptr_storage,
PropertyRNA prop_dst,
PropertyRNA prop_src,
PropertyRNA prop_storage,
PointerRNA **  r_ptr_item_dst,
PointerRNA **  r_ptr_item_src,
PointerRNA **  r_ptr_item_storage,
PointerRNA private_ptr_item_dst,
PointerRNA private_ptr_item_src,
PointerRNA private_ptr_item_storage,
IDOverrideLibraryProperty op,
IDOverrideLibraryPropertyOperation opop 
)
static

◆ RNA_property_comparable()

bool RNA_property_comparable ( PointerRNA UNUSEDptr,
PropertyRNA prop 
)

◆ RNA_property_copy()

bool RNA_property_copy ( Main bmain,
PointerRNA ptr,
PointerRNA fromptr,
PropertyRNA prop,
int  index 
)

◆ RNA_property_equals()

bool RNA_property_equals ( Main bmain,
PointerRNA ptr_a,
PointerRNA ptr_b,
PropertyRNA prop,
eRNACompareMode  mode 
)

◆ RNA_property_overridable_get()

bool RNA_property_overridable_get ( PointerRNA ptr,
PropertyRNA prop 
)

◆ RNA_property_overridable_library_set()

bool RNA_property_overridable_library_set ( PointerRNA UNUSEDptr,
PropertyRNA prop,
const bool  is_overridable 
)

◆ RNA_property_overridden()

bool RNA_property_overridden ( PointerRNA ptr,
PropertyRNA prop 
)

◆ rna_property_override_apply_ex()

static void rna_property_override_apply_ex ( Main bmain,
PointerRNA ptr_dst,
PointerRNA ptr_src,
PointerRNA ptr_storage,
PropertyRNA prop_dst,
PropertyRNA prop_src,
PropertyRNA prop_storage,
PointerRNA ptr_item_dst,
PointerRNA ptr_item_src,
PointerRNA ptr_item_storage,
IDOverrideLibraryProperty op,
const bool  do_insert 
)
static

◆ rna_property_override_check_resync()

static void rna_property_override_check_resync ( Main bmain,
PointerRNA ptr_dst,
PointerRNA ptr_src,
PointerRNA ptr_item_dst,
PointerRNA ptr_item_src 
)
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 override,
const eRNAOverrideMatch  flags,
eRNAOverrideMatchResult r_report_flags 
)
static

Generic RNA property diff function.

Note
about prop and prop_a/prop_b parameters: the former is expected to be an 'un-resolved' one, while the two later are expected to be fully resolved ones (i.e. to be the IDProps when they should be, etc.). When prop is given, prop_a and prop_b should always be NULL, and vice-versa. This is necessary, because we cannot perform 'set/unset' checks on resolved properties (unset IDProps would merely be NULL then).
When there is no equality, but we cannot determine an order (greater than/lesser than), we return 1.

Definition at line 325 of file rna_access_compare_override.c.

References PropertyRNAOrID::array_len, BLI_assert, BLI_assert_unreachable, CLOG_ERROR, KDL::diff(), ELEM, PropertyRNA::flag_override, PropertyRNAOrID::identifier, PropertyRNAOrID::idprop, PropertyRNAOrID::is_array, PropertyRNAOrID::is_idprop, PropertyRNAOrID::is_set, LOG, NULL, PropertyRNA::override_diff, PROP_COLLECTION, PROP_POINTER, PROPOVERRIDE_NO_COMPARISON, PropertyRNAOrID::ptr, PropertyRNAOrID::rawprop, RNA_EQ_UNSET_MATCH_ANY, RNA_EQ_UNSET_MATCH_NONE, RNA_OVERRIDE_COMPARE_CREATE, RNA_OVERRIDE_MATCH_RESULT_CREATED, RNA_property_editable_flag(), RNA_property_overridable_get(), rna_property_override_diff_default(), RNA_property_type(), and PropertyRNAOrID::rnaprop.

Referenced by RNA_property_equals(), and RNA_struct_override_matches().

◆ RNA_property_override_flag()

int RNA_property_override_flag ( PropertyRNA prop)

◆ RNA_property_override_library_status()

eRNAOverrideStatus RNA_property_override_library_status ( Main bmain,
PointerRNA ptr,
PropertyRNA prop,
const int  index 
)

◆ rna_property_override_operation_apply()

static bool rna_property_override_operation_apply ( Main bmain,
PointerRNA ptr_dst,
PointerRNA ptr_src,
PointerRNA ptr_storage,
PropertyRNA prop_dst,
PropertyRNA prop_src,
PropertyRNA prop_storage,
PointerRNA ptr_item_dst,
PointerRNA ptr_item_src,
PointerRNA ptr_item_storage,
IDOverrideLibraryPropertyOperation opop 
)
static

◆ rna_property_override_operation_store()

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

◆ RNA_property_override_property_find()

IDOverrideLibraryProperty* RNA_property_override_property_find ( Main bmain,
PointerRNA ptr,
PropertyRNA prop,
ID **  r_owner_id 
)

◆ 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 bmain,
PointerRNA ptr,
PropertyRNA prop,
char **  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 57 of file rna_access_compare_override.c.

References BLI_assert_unreachable, BLI_sprintfN(), ID::flag, GS, id, ID_GR, ID_KE, ID_NT, LIB_EMBEDDED_DATA, LIB_EMBEDDED_DATA_LIB_OVERRIDE, MEM_freeN, ID::name, NULL, PointerRNA::owner_id, ptr, RNA_find_real_ID_and_path(), and RNA_path_from_ID_to_property().

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

◆ RNA_struct_equals()

bool RNA_struct_equals ( Main bmain,
PointerRNA ptr_a,
PointerRNA ptr_b,
eRNACompareMode  mode 
)

◆ RNA_struct_override_apply()

void RNA_struct_override_apply ( struct Main bmain,
struct PointerRNA ptr_dst,
struct PointerRNA ptr_src,
struct PointerRNA ptr_storage,
struct IDOverrideLibrary override,
eRNAOverrideApplyFlag  flag 
)

◆ RNA_struct_override_matches()

bool RNA_struct_override_matches ( struct Main bmain,
struct PointerRNA ptr_local,
struct PointerRNA ptr_reference,
const char *  root_path,
size_t  root_path_len,
struct IDOverrideLibrary override,
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 626 of file rna_access_compare_override.c.

References BKE_lib_override_library_operations_tag(), BKE_lib_override_library_property_find(), BKE_pose_ensure(), BLI_assert, BLI_assert_msg, CLOG_INFO, Object::data, PointerRNA::data, KDL::diff(), ELEM, ListBase::first, float(), GS, ID_OB, PropertyRNAOrID::identifier, IDOVERRIDE_LIBRARY_OP_NOOP, IDOVERRIDE_LIBRARY_OP_REPLACE, IDOVERRIDE_LIBRARY_TAG_UNUSED, PropertyRNAOrID::idprop, if(), PropertyRNAOrID::is_idprop, LOG, MEM_freeN, MEM_mallocN, ID::name, NULL, OB_ARMATURE, IDOverrideLibraryPropertyOperation::operation, IDOverrideLibraryProperty::operations, ID::override_library, PointerRNA::owner_id, PIL_check_seconds_timer(), PROPOVERRIDE_IGNORE, PropertyRNAOrID::ptr, CollectionPropertyIterator::ptr, 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_MATCH_RESULT_CREATED, 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, Object::type, PointerRNA::type, and CollectionPropertyIterator::valid.

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

◆ RNA_struct_override_store()

bool RNA_struct_override_store ( struct Main bmain,
struct PointerRNA ptr_local,
struct PointerRNA ptr_reference,
PointerRNA ptr_storage,
struct IDOverrideLibrary override 
)

Store needed second operands into storage data-block for differential override operations.

Definition at line 909 of file rna_access_compare_override.c.

References LISTBASE_FOREACH, NULL, override, PointerRNA::owner_id, RNA_path_resolve_property(), rna_property_override_operation_store(), TIMEIT_END_AVERAGED, and TIMEIT_START_AVERAGED.

Referenced by BKE_lib_override_library_operations_store_start().

Variable Documentation

◆ LOG

CLG_LogRef LOG = {"rna.access_compare_override"}
static