Refactor: combine insert_keyframe() and insert_key_rna() into a single function #122053
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user