Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/anim_sys.c
| Show First 20 Lines • Show All 1,826 Lines • ▼ Show 20 Lines | bool BKE_animsys_execute_fcurve(PointerRNA *ptr, FCurve *fcu, float curval) | ||||
| if (animsys_store_rna_setting(ptr, fcu->rna_path, fcu->array_index, &anim_rna)) { | if (animsys_store_rna_setting(ptr, fcu->rna_path, fcu->array_index, &anim_rna)) { | ||||
| ok = animsys_write_rna_setting(&anim_rna, curval); | ok = animsys_write_rna_setting(&anim_rna, curval); | ||||
| } | } | ||||
| /* return whether we were successful */ | /* return whether we were successful */ | ||||
| return ok; | return ok; | ||||
| } | } | ||||
| static bool animsys_construct_orig_pointer_rna(const PointerRNA *ptr, PointerRNA *ptr_orig) | |||||
| { | |||||
| *ptr_orig = *ptr; | |||||
| /* NOTE: nlastrip_evaluate_controls() creates PointerRNA with ID of NULL. Technically, this is | |||||
| * 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->type != &RNA_NlaStrip) { | |||||
| return false; | |||||
| } | |||||
| NlaStrip *strip = ((NlaStrip *)ptr_orig->data); | |||||
| if (strip->orig_strip == NULL) { | |||||
| return false; | |||||
| } | |||||
| 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; | |||||
| } | |||||
| return true; | |||||
| } | |||||
| static void animsys_write_orig_anim_rna(PointerRNA *ptr, | static void animsys_write_orig_anim_rna(PointerRNA *ptr, | ||||
| const char *rna_path, | const char *rna_path, | ||||
| int array_index, | int array_index, | ||||
| float value) | float value) | ||||
| { | { | ||||
| /* Pointer is expected to be an ID pointer, if it's not -- we are doomed. | PointerRNA ptr_orig; | ||||
| * | if (!animsys_construct_orig_pointer_rna(ptr, &ptr_orig)) { | ||||
| * NOTE: It is possible to have animation data on NLA strip, see T57360. | |||||
| * TODO(sergey): Find solution for those cases. | |||||
| */ | |||||
| if (ptr->id.data == NULL) { | |||||
| return; | return; | ||||
| } | } | ||||
| PointerRNA orig_ptr = *ptr; | |||||
| orig_ptr.id.data = ((ID *)orig_ptr.id.data)->orig_id; | |||||
| orig_ptr.data = orig_ptr.id.data; | |||||
| PathResolvedRNA orig_anim_rna; | PathResolvedRNA orig_anim_rna; | ||||
| /* TODO(sergey): Is there a faster way to get anim_rna of original ID? */ | /* TODO(sergey): Should be possible to cache resolved path in dependency graph somehow. */ | ||||
| if (animsys_store_rna_setting(&orig_ptr, rna_path, array_index, &orig_anim_rna)) { | if (animsys_store_rna_setting(&ptr_orig, rna_path, array_index, &orig_anim_rna)) { | ||||
| animsys_write_rna_setting(&orig_anim_rna, value); | animsys_write_rna_setting(&orig_anim_rna, value); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Evaluate all the F-Curves in the given list | * Evaluate all the F-Curves in the given list | ||||
| * This performs a set of standard checks. If extra checks are required, | * This performs a set of standard checks. If extra checks are required, | ||||
| * separate code should be used. | * separate code should be used. | ||||
| ▲ Show 20 Lines • Show All 2,260 Lines • Show Last 20 Lines | |||||