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
Showing only changes of commit 3ef665f251 - Show all commits

View File

@ -402,18 +402,19 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
}
}
else {
ID *id = self->ptr.owner_id;
BLI_assert(BKE_id_is_in_global_main(self->ptr.owner_id));
BLI_assert(BKE_id_is_in_global_main(id));
CombinedKeyingResult combined_result = insert_keyframes(
G_MAIN,
&self->ptr,
group_name ? std::optional(group_name) : std::nullopt,
{{path_full, {}, index}},
std::nullopt,
anim_eval_context,
eBezTriple_KeyframeType(keytype),
eInsertKeyFlags(options));
const std::optional<blender::StringRefNull> channel_group = group_name ?
std::optional(group_name) :
std::nullopt;
CombinedKeyingResult combined_result = insert_keyframes(G_MAIN,
&self->ptr,
channel_group,
{{path_full, {}, index}},
std::nullopt,
anim_eval_context,
eBezTriple_KeyframeType(keytype),
eInsertKeyFlags(options));
const int success_count = combined_result.get_count(SingleKeyingResult::SUCCESS);
if (success_count == 0) {
combined_result.generate_reports(&reports);