Refactor: Remove bAction argument from insert_keyframe

No functional changes intended.

The `insert_keyframe` function had a `bAction` argument that could be
a `nullptr`. If it was a `nullptr` it would be queried from the `ID`.

However in all cases where it is passed it is also gotten from the `ID`, making
the argument redundant.

This PR removes the argument to simplify the function.

Pull Request: https://projects.blender.org/blender/blender/pulls/119742
This commit is contained in:
Christoph Lendenfeld
2024-03-22 13:18:32 +01:00
committed by Christoph Lendenfeld
parent d470b65f6d
commit 646f9bcebe
8 changed files with 8 additions and 21 deletions

View File

@@ -51,7 +51,6 @@ void update_autoflags_fcurve_direct(FCurve *fcu, PropertyRNA *prop);
int insert_keyframe(Main *bmain,
ReportList *reports,
ID *id,
bAction *act,
const char group[],
const char rna_path[],
int array_index,

View File

@@ -546,7 +546,6 @@ static void generate_keyframe_reports_from_result(ReportList *reports,
int insert_keyframe(Main *bmain,
ReportList *reports,
ID *id,
bAction *act,
const char group[],
const char rna_path[],
int array_index,
@@ -577,18 +576,15 @@ int insert_keyframe(Main *bmain,
return 0;
}
/* If no action is provided, keyframe to the default one attached to this ID-block. */
bAction *act = id_action_ensure(bmain, id);
if (act == nullptr) {
act = id_action_ensure(bmain, id);
if (act == nullptr) {
BKE_reportf(reports,
RPT_ERROR,
"Could not insert keyframe, as this type does not support animation data (ID = "
"%s, path = %s)",
id->name,
rna_path);
return 0;
}
BKE_reportf(reports,
RPT_ERROR,
"Could not insert keyframe, as this type does not support animation data (ID = "
"%s, path = %s)",
id->name,
rna_path);
return 0;
}
/* Apply NLA-mapping to frame to use (if applicable). */

View File

@@ -138,7 +138,6 @@ void autokeyframe_object(bContext *C, Scene *scene, Object *ob, Span<std::string
insert_keyframe(bmain,
reports,
id,
adt->action,
(fcu->grp ? fcu->grp->name : nullptr),
fcu->rna_path,
fcu->array_index,
@@ -267,7 +266,6 @@ void autokeyframe_pose_channel(bContext *C,
blender::animrig::insert_keyframe(bmain,
reports,
id,
act,
((fcu->grp) ? (fcu->grp->name) : (nullptr)),
fcu->rna_path,
fcu->array_index,
@@ -361,7 +359,6 @@ bool autokeyframe_property(bContext *C,
changed = insert_keyframe(bmain,
reports,
id,
action,
(fcu && fcu->grp) ? fcu->grp->name : nullptr,
fcu ? fcu->rna_path : (path ? path->c_str() : nullptr),
rnaindex,

View File

@@ -1010,7 +1010,6 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
changed = (blender::animrig::insert_keyframe(bmain,
op->reports,
ptr.owner_id,
nullptr,
group,
path->c_str(),
index,

View File

@@ -1079,7 +1079,6 @@ static int insert_key_to_keying_set_path(bContext *C,
keyed_channels += blender::animrig::insert_keyframe(bmain,
reports,
keyingset_path->id,
nullptr,
groupname,
keyingset_path->rna_path,
array_index,

View File

@@ -840,7 +840,6 @@ static void insert_fcurve_key(bAnimContext *ac,
insert_keyframe(ac->bmain,
reports,
ale->id,
nullptr,
((fcu->grp) ? (fcu->grp->name) : (nullptr)),
fcu->rna_path,
fcu->array_index,

View File

@@ -210,7 +210,6 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
insert_keyframe(ac->bmain,
reports,
ale->id,
nullptr,
((fcu->grp) ? (fcu->grp->name) : (nullptr)),
fcu->rna_path,
fcu->array_index,

View File

@@ -387,7 +387,6 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
result = (blender::animrig::insert_keyframe(G_MAIN,
&reports,
id,
nullptr,
group_name,
path_full,
index,