Refactor: combine insert_keyframe() and insert_key_rna() into a single function #122053

Merged
Nathan Vegdahl merged 49 commits from nathanvegdahl/blender:combine_keying_functions into main 2024-06-11 16:43:08 +02:00
4 changed files with 19 additions and 18 deletions
Showing only changes of commit e697a312fb - Show all commits

View File

@ -261,12 +261,12 @@ CombinedKeyingResult insert_key_action(Main *bmain,
* \param scene_frame: is expected to be not NLA mapped as that happens within the function.
* \returns How often keyframe insertion was successful and how often it failed / for which reason.
*/
CombinedKeyingResult insert_key_rna(PointerRNA *rna_pointer,
CombinedKeyingResult insert_key_rna(Main *bmain,
PointerRNA *rna_pointer,
const blender::Span<RNAPath> rna_paths,
float scene_frame,
eInsertKeyFlags insert_key_flags,
const AnimationEvalContext &anim_eval_context,
eBezTriple_KeyframeType key_type,
Main *bmain,
const AnimationEvalContext &anim_eval_context);
eInsertKeyFlags insert_key_flags);
} // namespace blender::animrig

View File

@ -959,13 +959,14 @@ CombinedKeyingResult insert_key_action(Main *bmain,
return combined_result;
}
CombinedKeyingResult insert_key_rna(PointerRNA *rna_pointer,
CombinedKeyingResult insert_key_rna(Main *bmain,
PointerRNA *rna_pointer,
const blender::Span<RNAPath> rna_paths,
const float scene_frame,
const eInsertKeyFlags insert_key_flags,
const AnimationEvalContext &anim_eval_context,
const eBezTriple_KeyframeType key_type,
Main *bmain,
const AnimationEvalContext &anim_eval_context)
const eInsertKeyFlags insert_key_flags)
{
ID *id = rna_pointer->owner_id;
bAction *action = id_action_ensure(bmain, id);

View File

@ -143,13 +143,13 @@ void autokeyframe_object(bContext *C, Scene *scene, Object *ob, Span<RNAPath> rn
CombinedKeyingResult combined_result;
for (PointerRNA ptr : sources) {
const CombinedKeyingResult result = insert_key_rna(
bmain,
&ptr,
rna_paths,
scene_frame,
flag,
anim_eval_context,
eBezTriple_KeyframeType(scene->toolsettings->keyframe_type),
bmain,
anim_eval_context);
flag);
combined_result.merge(result);
}
@ -246,13 +246,13 @@ void autokeyframe_pose_channel(bContext *C,
CombinedKeyingResult combined_result;
for (PointerRNA &ptr : sources) {
const CombinedKeyingResult result = insert_key_rna(
bmain,
&ptr,
rna_paths,
scene_frame,
flag,
anim_eval_context,
eBezTriple_KeyframeType(scene->toolsettings->keyframe_type),
bmain,
anim_eval_context);
flag);
combined_result.merge(result);
}

View File

@ -402,13 +402,13 @@ static int insert_key(bContext *C, wmOperator *op)
}
Vector<RNAPath> rna_paths = construct_rna_paths(&id_ptr);
combined_result.merge(animrig::insert_key_rna(&id_ptr,
combined_result.merge(animrig::insert_key_rna(bmain,
&id_ptr,
rna_paths.as_span(),
scene_frame,
insert_key_flags,
anim_eval_context,
key_type,
bmain,
anim_eval_context));
insert_key_flags));
}
if (combined_result.get_count(animrig::SingleKeyingResult::SUCCESS) == 0) {