diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-08-23 10:52:12 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-08-23 10:52:12 +0300 |
commit | a1aa4a259713f26c32a5fac4adbe0751e0479f5b (patch) | |
tree | 0737940d32513ad8e2458760c81ad7c1c61e1ce6 /source/blender/blenkernel/intern/anim_sys.c | |
parent | 232049dd9408e15d2082181e60ddd775b375ff19 (diff) |
RNA: Cleanup PointerRNA struct
The old layout of `PointerRNA` was confusing for historic reasons:
```
typedef struct PointerRNA {
struct {
void *data;
} id;
struct StructRNA *type;
void *data;
} PointerRNA;
```
This patch updates it to:
```
typedef struct PointerRNA {
struct ID *owner_id;
struct StructRNA *type;
void *data;
} PointerRNA;
```
Throughout the code base `id.data` was replaced with `owner_id`.
Furthermore, many explicit pointer type casts were added which
were implicit before. Some type casts to `ID *` were removed.
Reviewers: brecht, campbellbarton
Differential Revision: https://developer.blender.org/D5558
Diffstat (limited to 'source/blender/blenkernel/intern/anim_sys.c')
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 1a34c5376f6..ab8ea37377d 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -648,7 +648,7 @@ char *BKE_animdata_driver_path_hack(bContext *C, PropertyRNA *prop, char *base_path) { - ID *id = (ID *)ptr->id.data; + ID *id = ptr->owner_id; ScrArea *sa = CTX_wm_area(C); /* get standard path which may be extended */ @@ -1656,14 +1656,14 @@ static bool animsys_store_rna_setting(PointerRNA *ptr, if (path) { /* get property to write to */ if (RNA_path_resolve_property(ptr, path, &r_result->ptr, &r_result->prop)) { - if ((ptr->id.data == NULL) || RNA_property_animateable(&r_result->ptr, r_result->prop)) { + if ((ptr->owner_id == NULL) || RNA_property_animateable(&r_result->ptr, r_result->prop)) { int array_len = RNA_property_array_length(&r_result->ptr, r_result->prop); if (array_len && array_index >= array_len) { if (G.debug & G_DEBUG) { CLOG_WARN(&LOG, "Animato: Invalid array index. ID = '%s', '%s[%d]', array length is %d", - (ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>", + (ptr->owner_id) ? (ptr->owner_id->name + 2) : "<No ID>", path, array_index, array_len - 1); @@ -1682,7 +1682,7 @@ static bool animsys_store_rna_setting(PointerRNA *ptr, if (G.debug & G_DEBUG) { CLOG_WARN(&LOG, "Animato: Invalid path. ID = '%s', '%s[%d]'", - (ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>", + (ptr->owner_id) ? (ptr->owner_id->name + 2) : "<No ID>", path, array_index); } @@ -1703,7 +1703,7 @@ static bool animsys_read_rna_setting(PathResolvedRNA *anim_rna, float *r_value) float orig_value; /* caller must ensure this is animatable */ - BLI_assert(RNA_property_animateable(ptr, prop) || ptr->id.data == NULL); + BLI_assert(RNA_property_animateable(ptr, prop) || ptr->owner_id == NULL); switch (RNA_property_type(prop)) { case PROP_BOOLEAN: { @@ -1765,7 +1765,7 @@ static bool animsys_write_rna_setting(PathResolvedRNA *anim_rna, const float val int array_index = anim_rna->prop_index; /* caller must ensure this is animatable */ - BLI_assert(RNA_property_animateable(ptr, prop) || ptr->id.data == NULL); + BLI_assert(RNA_property_animateable(ptr, prop) || ptr->owner_id == NULL); /* Check whether value is new. Otherwise we skip all the updates. */ float old_value; @@ -1844,7 +1844,7 @@ static bool animsys_construct_orig_pointer_rna(const PointerRNA *ptr, PointerRNA * not a valid pointer, but there are exceptions in various places of this file which handles * such pointers. * We do special trickery here as well, to quickly go from evaluated to original NlaStrip. */ - if (ptr->id.data == NULL) { + if (ptr->owner_id == NULL) { if (ptr->type != &RNA_NlaStrip) { return false; } @@ -1855,8 +1855,8 @@ static bool animsys_construct_orig_pointer_rna(const PointerRNA *ptr, PointerRNA ptr_orig->data = strip->orig_strip; } else { - ptr_orig->id.data = ((ID *)ptr_orig->id.data)->orig_id; - ptr_orig->data = ptr_orig->id.data; + ptr_orig->owner_id = ptr_orig->owner_id->orig_id; + ptr_orig->data = ptr_orig->owner_id; } return true; } @@ -2003,7 +2003,7 @@ void animsys_evaluate_action_group(PointerRNA *ptr, bAction *act, bActionGroup * return; } - action_idcode_patch_check(ptr->id.data, act); + action_idcode_patch_check(ptr->owner_id, act); /* if group is muted, don't evaluated any of the F-Curve */ if (agrp->flag & AGRP_MUTED) { @@ -2034,7 +2034,7 @@ static void animsys_evaluate_action_ex(PointerRNA *ptr, return; } - action_idcode_patch_check(ptr->id.data, act); + action_idcode_patch_check(ptr->owner_id, act); /* calculate then execute each curve */ animsys_evaluate_fcurves(ptr, &act->curves, ctime, flush_to_original); @@ -2643,7 +2643,7 @@ static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, NlaEvalData *nlaeval, if (G.debug & G_DEBUG) { CLOG_WARN(&LOG, "Animato: Invalid path. ID = '%s', '%s'", - (ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>", + (ptr->owner_id) ? (ptr->owner_id->name + 2) : "<No ID>", path); } @@ -2651,7 +2651,7 @@ static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, NlaEvalData *nlaeval, } /* Check that the property can be animated. */ - if (ptr->id.data != NULL && !RNA_property_animateable(&key.ptr, key.prop)) { + if (ptr->owner_id != NULL && !RNA_property_animateable(&key.ptr, key.prop)) { return NULL; } @@ -2884,7 +2884,7 @@ static bool nlaeval_blend_value(NlaBlendData *blend, if (index < 0) { if (G.debug & G_DEBUG) { - ID *id = nec->key.ptr.id.data; + ID *id = nec->key.ptr.owner_id; CLOG_WARN(&LOG, "Animato: Invalid array index. ID = '%s', '%s[%d]', array length is %d", id ? (id->name + 2) : "<No ID>", @@ -3081,7 +3081,7 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr, return; } - action_idcode_patch_check(ptr->id.data, strip->act); + action_idcode_patch_check(ptr->owner_id, strip->act); /* join this strip's modifiers to the parent's modifiers (own modifiers first) */ nlaeval_fmodifiers_join_stacks(&tmp_modifiers, &strip->modifiers, modifiers); |