From 77bc5510a90bbfcc7adaed6a0e4c4768cb236239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Mon, 1 Mar 2021 18:42:48 +0100 Subject: Cleanup: rename some animation-related functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename: - `BKE_animsys_store_rna_setting` → `BKE_animsys_rna_path_resolve` - `BKE_animsys_read_rna_setting` → `BKE_animsys_read_from_rna_path` - `BKE_animsys_write_rna_setting` → `BKE_animsys_write_to_rna_path` The concept of "RNA setting" is unclear; the new names reflect better what the functions actually do. No functional changes. --- source/blender/blenkernel/BKE_animsys.h | 12 +++---- source/blender/blenkernel/intern/anim_sys.c | 42 +++++++++++----------- .../eval/deg_eval_runtime_backup_animation.cc | 14 ++++---- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index 2fce4bfc5b8..8666291cec8 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -235,12 +235,12 @@ typedef enum eAnimData_Recalc { ADT_RECALC_ALL = (ADT_RECALC_DRIVERS | ADT_RECALC_ANIM), } eAnimData_Recalc; -bool BKE_animsys_store_rna_setting(struct PointerRNA *ptr, - const char *rna_path, - const int array_index, - struct PathResolvedRNA *r_result); -bool BKE_animsys_read_rna_setting(struct PathResolvedRNA *anim_rna, float *r_value); -bool BKE_animsys_write_rna_setting(struct PathResolvedRNA *anim_rna, const float value); +bool BKE_animsys_rna_path_resolve(struct PointerRNA *ptr, + const char *rna_path, + const int array_index, + struct PathResolvedRNA *r_result); +bool BKE_animsys_read_from_rna_path(struct PathResolvedRNA *anim_rna, float *r_value); +bool BKE_animsys_write_to_rna_path(struct PathResolvedRNA *anim_rna, const float value); /* Evaluation loop for evaluating animation data */ void BKE_animsys_evaluate_animdata(struct ID *id, diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index a23b10a0da6..9a890fd02be 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -376,11 +376,11 @@ static bool is_fcurve_evaluatable(FCurve *fcu) return true; } -bool BKE_animsys_store_rna_setting(PointerRNA *ptr, - /* typically 'fcu->rna_path', 'fcu->array_index' */ - const char *rna_path, - const int array_index, - PathResolvedRNA *r_result) +bool BKE_animsys_rna_path_resolve(PointerRNA *ptr, + /* typically 'fcu->rna_path', 'fcu->array_index' */ + const char *rna_path, + const int array_index, + PathResolvedRNA *r_result) { if (rna_path == NULL) { return false; @@ -425,7 +425,7 @@ bool BKE_animsys_store_rna_setting(PointerRNA *ptr, /* less than 1.0 evaluates to false, use epsilon to avoid float error */ #define ANIMSYS_FLOAT_AS_BOOL(value) ((value) > ((1.0f - FLT_EPSILON))) -bool BKE_animsys_read_rna_setting(PathResolvedRNA *anim_rna, float *r_value) +bool BKE_animsys_read_from_rna_path(PathResolvedRNA *anim_rna, float *r_value) { PropertyRNA *prop = anim_rna->prop; PointerRNA *ptr = &anim_rna->ptr; @@ -488,7 +488,7 @@ bool BKE_animsys_read_rna_setting(PathResolvedRNA *anim_rna, float *r_value) } /* Write the given value to a setting using RNA, and return success */ -bool BKE_animsys_write_rna_setting(PathResolvedRNA *anim_rna, const float value) +bool BKE_animsys_write_to_rna_path(PathResolvedRNA *anim_rna, const float value) { PropertyRNA *prop = anim_rna->prop; PointerRNA *ptr = &anim_rna->ptr; @@ -499,7 +499,7 @@ bool BKE_animsys_write_rna_setting(PathResolvedRNA *anim_rna, const float value) /* Check whether value is new. Otherwise we skip all the updates. */ float old_value; - if (!BKE_animsys_read_rna_setting(anim_rna, &old_value)) { + if (!BKE_animsys_read_from_rna_path(anim_rna, &old_value)) { return false; } if (old_value == value) { @@ -588,8 +588,8 @@ static void animsys_write_orig_anim_rna(PointerRNA *ptr, } PathResolvedRNA orig_anim_rna; /* TODO(sergey): Should be possible to cache resolved path in dependency graph somehow. */ - if (BKE_animsys_store_rna_setting(&ptr_orig, rna_path, array_index, &orig_anim_rna)) { - BKE_animsys_write_rna_setting(&orig_anim_rna, value); + if (BKE_animsys_rna_path_resolve(&ptr_orig, rna_path, array_index, &orig_anim_rna)) { + BKE_animsys_write_to_rna_path(&orig_anim_rna, value); } } @@ -611,9 +611,9 @@ static void animsys_evaluate_fcurves(PointerRNA *ptr, } PathResolvedRNA anim_rna; - if (BKE_animsys_store_rna_setting(ptr, fcu->rna_path, fcu->array_index, &anim_rna)) { + if (BKE_animsys_rna_path_resolve(ptr, fcu->rna_path, fcu->array_index, &anim_rna)) { const float curval = calculate_fcurve(&anim_rna, fcu, anim_eval_context); - BKE_animsys_write_rna_setting(&anim_rna, curval); + BKE_animsys_write_to_rna_path(&anim_rna, curval); if (flush_to_original) { animsys_write_orig_anim_rna(ptr, fcu->rna_path, fcu->array_index, curval); } @@ -663,9 +663,9 @@ static void animsys_evaluate_drivers(PointerRNA *ptr, * NOTE: for 'layering' option later on, we should check if we should remove old value * before adding new to only be done when drivers only changed. */ PathResolvedRNA anim_rna; - if (BKE_animsys_store_rna_setting(ptr, fcu->rna_path, fcu->array_index, &anim_rna)) { + if (BKE_animsys_rna_path_resolve(ptr, fcu->rna_path, fcu->array_index, &anim_rna)) { const float curval = calculate_fcurve(&anim_rna, fcu, anim_eval_context); - ok = BKE_animsys_write_rna_setting(&anim_rna, curval); + ok = BKE_animsys_write_to_rna_path(&anim_rna, curval); } /* set error-flag if evaluation failed */ @@ -744,9 +744,9 @@ void animsys_evaluate_action_group(PointerRNA *ptr, /* check if this curve should be skipped */ if ((fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED)) == 0 && !BKE_fcurve_is_empty(fcu)) { PathResolvedRNA anim_rna; - if (BKE_animsys_store_rna_setting(ptr, fcu->rna_path, fcu->array_index, &anim_rna)) { + if (BKE_animsys_rna_path_resolve(ptr, fcu->rna_path, fcu->array_index, &anim_rna)) { const float curval = calculate_fcurve(&anim_rna, fcu, anim_eval_context); - BKE_animsys_write_rna_setting(&anim_rna, curval); + BKE_animsys_write_to_rna_path(&anim_rna, curval); } } } @@ -1997,7 +1997,7 @@ void nladata_flush_channels(PointerRNA *ptr, if (nec->is_array) { rna.prop_index = i; } - BKE_animsys_write_rna_setting(&rna, value); + BKE_animsys_write_to_rna_path(&rna, value); if (flush_to_original) { animsys_write_orig_anim_rna(ptr, nec->rna_path, rna.prop_index, value); } @@ -2758,8 +2758,8 @@ static void animsys_evaluate_overrides(PointerRNA *ptr, AnimData *adt) /* for each override, simply execute... */ for (aor = adt->overrides.first; aor; aor = aor->next) { PathResolvedRNA anim_rna; - if (BKE_animsys_store_rna_setting(ptr, aor->rna_path, aor->array_index, &anim_rna)) { - BKE_animsys_write_rna_setting(&anim_rna, aor->value); + if (BKE_animsys_rna_path_resolve(ptr, aor->rna_path, aor->array_index, &anim_rna)) { + BKE_animsys_write_to_rna_path(&anim_rna, aor->value); } } } @@ -3089,13 +3089,13 @@ void BKE_animsys_eval_driver(Depsgraph *depsgraph, ID *id, int driver_index, FCu // printf("\told val = %f\n", fcu->curval); PathResolvedRNA anim_rna; - if (BKE_animsys_store_rna_setting(&id_ptr, fcu->rna_path, fcu->array_index, &anim_rna)) { + if (BKE_animsys_rna_path_resolve(&id_ptr, fcu->rna_path, fcu->array_index, &anim_rna)) { /* Evaluate driver, and write results to COW-domain destination */ const float ctime = DEG_get_ctime(depsgraph); const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct( depsgraph, ctime); const float curval = calculate_fcurve(&anim_rna, fcu, &anim_eval_context); - ok = BKE_animsys_write_rna_setting(&anim_rna, curval); + ok = BKE_animsys_write_to_rna_path(&anim_rna, curval); /* Flush results & status codes to original data for UI (T59984) */ if (ok && DEG_is_active(depsgraph)) { diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc index 3c0df93f4b9..c1d2dd8b6cc 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc @@ -59,14 +59,14 @@ void animated_property_store_cb(ID *id, FCurve *fcurve, void *data_v) /* Resolve path to the property. */ PathResolvedRNA resolved_rna; - if (!BKE_animsys_store_rna_setting( + if (!BKE_animsys_rna_path_resolve( &data->id_pointer_rna, fcurve->rna_path, fcurve->array_index, &resolved_rna)) { return; } /* Read property value. */ float value; - if (!BKE_animsys_read_rna_setting(&resolved_rna, &value)) { + if (!BKE_animsys_read_from_rna_path(&resolved_rna, &value)) { return; } @@ -127,15 +127,15 @@ void AnimationBackup::restore_to_id(ID *id) * NOTE: Do it again (after storing), since the sub-data pointers might be * changed after copy-on-write. */ PathResolvedRNA resolved_rna; - if (!BKE_animsys_store_rna_setting(&id_pointer_rna, - value_backup.rna_path.c_str(), - value_backup.array_index, - &resolved_rna)) { + if (!BKE_animsys_rna_path_resolve(&id_pointer_rna, + value_backup.rna_path.c_str(), + value_backup.array_index, + &resolved_rna)) { return; } /* Write property value. */ - if (!BKE_animsys_write_rna_setting(&resolved_rna, value_backup.value)) { + if (!BKE_animsys_write_to_rna_path(&resolved_rna, value_backup.value)) { return; } } -- cgit v1.2.3