diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_internal_types.h')
-rw-r--r-- | source/blender/makesrna/intern/rna_internal_types.h | 65 |
1 files changed, 56 insertions, 9 deletions
diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index d93f3308b2a..88efff30481 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -40,20 +40,14 @@ struct PointerRNA; struct FunctionRNA; struct CollectionPropertyIterator; struct bContext; +struct IDOverrideStatic; +struct IDOverrideStaticProperty; +struct IDOverrideStaticPropertyOperation; struct IDProperty; struct GHash; struct Main; struct Scene; -#ifdef UNIT_TEST -#define RNA_MAX_ARRAY_LENGTH 64 -#else -#define RNA_MAX_ARRAY_LENGTH 32 -#endif - -#define RNA_MAX_ARRAY_DIMENSION 3 - - /* store local properties here */ #define RNA_IDP_UI "_RNA_UI" @@ -126,6 +120,54 @@ typedef void (*PropStringSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA * typedef int (*PropEnumGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop); typedef void (*PropEnumSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value); +/* Handling override operations, and also comparison. */ + +/** + * If \a override is NULL, merely do comparison between prop_a from ptr_a and prop_b from ptr_b, + * following comparison mode given. + * If \a override and \a rna_path are not NULL, it will add a new override operation for overridable properties + * that differ and have not yet been overridden (and set accordingly \a r_override_changed if given). + * + * \note Given PropertyRNA are final (in case of IDProps...). + * \note In non-array cases, \a len values are 0. + * \note \a override, \a rna_path and \a r_override_changed may be NULL pointers. + */ +typedef int (*RNAPropOverrideDiff)( + struct PointerRNA *ptr_a, struct PointerRNA *ptr_b, + struct PropertyRNA *prop_a, struct PropertyRNA *prop_b, + const int len_a, const int len_b, + const int mode, + struct IDOverrideStatic *override, const char *rna_path, + const int flags, bool *r_override_changed); + +/** + * Only used for differential override (add, sub, etc.). + * Store into storage the value needed to transform reference's value into local's value. + * + * \note Given PropertyRNA are final (in case of IDProps...). + * \note In non-array cases, \a len values are 0. + * \note Might change given override operation (e.g. change 'add' one into 'sub'), in case computed storage value + * is out of range (or even change it to basic 'set' operation if nothing else works). + */ +typedef bool (*RNAPropOverrideStore)( + struct PointerRNA *ptr_local, struct PointerRNA *ptr_reference, struct PointerRNA *ptr_storage, + struct PropertyRNA *prop_local, struct PropertyRNA *prop_reference, struct PropertyRNA *prop_storage, + const int len_local, const int len_reference, const int len_storage, + struct IDOverrideStaticPropertyOperation *opop); + +/** + * Apply given override operation from src to dst (using value from storage as second operand + * for differential operations). + * + * \note Given PropertyRNA are final (in case of IDProps...). + * \note In non-array cases, \a len values are 0. + */ +typedef bool (*RNAPropOverrideApply)( + struct PointerRNA *ptr_dst, struct PointerRNA *ptr_src, struct PointerRNA *ptr_storage, + struct PropertyRNA *prop_dst, struct PropertyRNA *prop_src, struct PropertyRNA *prop_storage, + const int len_dst, const int len_src, const int len_storage, + struct IDOverrideStaticPropertyOperation *opop); + /* Container - generic abstracted container of RNA properties */ typedef struct ContainerRNA { void *next, *prev; @@ -203,6 +245,11 @@ struct PropertyRNA { /* callback for testing if array-item editable (if applicable) */ ItemEditableFunc itemeditable; + /* Override handling callbacks (diff is also used for comparison). */ + RNAPropOverrideDiff override_diff; + RNAPropOverrideStore override_store; + RNAPropOverrideApply override_apply; + /* raw access */ int rawoffset; RawPropertyType rawtype; |