Refactor: combine insert_keyframe() and insert_key_rna() into a single function #122053
@ -128,14 +128,14 @@ void update_autoflags_fcurve_direct(FCurve *fcu, PropertyRNA *prop);
|
||||
* that if you have an `ID` and want to pass it here for keying, you can create
|
||||
* the `PointerRNA` for it with `RNA_id_pointer_create()`.
|
||||
*
|
||||
* \param channel_group: the channel group to put any newly created fcurves
|
||||
* under. If not given, the standard groups are used.
|
||||
*
|
||||
* \param rna_paths: the RNA paths to key. These paths are relative to
|
||||
* `struct_pointer`. Note that for paths to array properties, if the array index
|
||||
* is specified then only that element is keyed, but if the index is not
|
||||
* specified then *all* array elements are keyed.
|
||||
*
|
||||
* \param channel_group: the channel group to put any newly created fcurves
|
||||
* under. If not given, the standard groups are used.
|
||||
*
|
||||
* \param scene_frame: the frame to insert the keys at. This is in scene time,
|
||||
* not NLA mapped (NLA mapping is already handled internally by this function).
|
||||
* If not given, the current scene time is used.
|
||||
nathanvegdahl marked this conversation as resolved
Outdated
|
||||
@ -145,8 +145,8 @@ void update_autoflags_fcurve_direct(FCurve *fcu, PropertyRNA *prop);
|
||||
*/
|
||||
CombinedKeyingResult insert_keyframes(Main *bmain,
|
||||
PointerRNA *struct_pointer,
|
||||
const blender::Span<RNAPath> rna_paths,
|
||||
std::optional<StringRefNull> channel_group,
|
||||
const blender::Span<RNAPath> rna_paths,
|
||||
std::optional<float> scene_frame,
|
||||
const AnimationEvalContext &anim_eval_context,
|
||||
eBezTriple_KeyframeType key_type,
|
||||
|
@ -945,8 +945,8 @@ static CombinedKeyingResult insert_key_layered_action(Action &action,
|
||||
|
||||
CombinedKeyingResult insert_keyframes(Main *bmain,
|
||||
PointerRNA *struct_pointer,
|
||||
const blender::Span<RNAPath> rna_paths,
|
||||
const std::optional<StringRefNull> channel_group,
|
||||
const blender::Span<RNAPath> rna_paths,
|
||||
const std::optional<float> scene_frame,
|
||||
const AnimationEvalContext &anim_eval_context,
|
||||
nathanvegdahl marked this conversation as resolved
Sybren A. Stüvel
commented
Same question as above. Why is there an Same question as above. Why is there an `std::optional<float> scene_frame` when there's also `anim_eval_context.eval_time`?
|
||||
const eBezTriple_KeyframeType key_type,
|
||||
|
@ -145,8 +145,8 @@ void autokeyframe_object(bContext *C, Scene *scene, Object *ob, Span<RNAPath> rn
|
||||
const CombinedKeyingResult result = insert_keyframes(
|
||||
bmain,
|
||||
&ptr,
|
||||
rna_paths,
|
||||
std::nullopt,
|
||||
rna_paths,
|
||||
scene_frame,
|
||||
anim_eval_context,
|
||||
eBezTriple_KeyframeType(scene->toolsettings->keyframe_type),
|
||||
@ -249,8 +249,8 @@ void autokeyframe_pose_channel(bContext *C,
|
||||
const CombinedKeyingResult result = insert_keyframes(
|
||||
bmain,
|
||||
&ptr,
|
||||
rna_paths,
|
||||
std::nullopt,
|
||||
rna_paths,
|
||||
scene_frame,
|
||||
anim_eval_context,
|
||||
eBezTriple_KeyframeType(scene->toolsettings->keyframe_type),
|
||||
@ -339,8 +339,8 @@ bool autokeyframe_property(bContext *C,
|
||||
|
||||
CombinedKeyingResult result = insert_keyframes(bmain,
|
||||
ptr,
|
||||
{{path, {}, array_index}},
|
||||
group,
|
||||
{{path, {}, array_index}},
|
||||
std::nullopt,
|
||||
anim_eval_context,
|
||||
eBezTriple_KeyframeType(ts->keyframe_type),
|
||||
|
@ -142,8 +142,8 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__non_array_property)
|
||||
object->empty_drawsize = 42.0;
|
||||
const CombinedKeyingResult result_1 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"empty_display_size"}},
|
||||
std::nullopt,
|
||||
{{"empty_display_size"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -189,8 +189,8 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__non_array_property)
|
||||
object->empty_drawsize = 86.0;
|
||||
const CombinedKeyingResult result_2 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"empty_display_size"}},
|
||||
std::nullopt,
|
||||
{{"empty_display_size"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -204,8 +204,8 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__non_array_property)
|
||||
object->empty_drawsize = 7.0;
|
||||
const CombinedKeyingResult result_3 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"empty_display_size"}},
|
||||
std::nullopt,
|
||||
{{"empty_display_size"}},
|
||||
10.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -229,8 +229,8 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__single_element)
|
||||
|
||||
const CombinedKeyingResult result = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler", std::nullopt, 0}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler", std::nullopt, 0}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -262,8 +262,8 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__all_elements)
|
||||
|
||||
const CombinedKeyingResult result = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler"}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler"}},
|
||||
1.0,
|
||||
dr.sybren marked this conversation as resolved
Sybren A. Stüvel
commented
Maybe not for this PR, as this is not a thing that's introduced here & now, but the scene frame range is a trivial value Maybe not for this PR, as this is not a thing that's introduced here & now, but the scene frame range is a trivial value `1.0` (which I would try to avoid), but also it's the same as `anim_eval_context`, and so a mistake in which one is picked will not show up in this test.
Nathan Vegdahl
commented
Good point. But since the intent is to remove the redundancy in a future PR anyway, I think it's fine for now. Good point. But since the intent is to remove the redundancy in a future PR anyway, I think it's fine for now.
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -300,8 +300,8 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__pose_bone_rna_pointer)
|
||||
|
||||
const CombinedKeyingResult result = insert_keyframes(bmain,
|
||||
&pose_bone_rna_pointer,
|
||||
{{"rotation_euler", std::nullopt, 0}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler", std::nullopt, 0}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -334,8 +334,8 @@ TEST_F(KeyframingTest, insert_keyframes__pose_bone_owner_id_pointer)
|
||||
const CombinedKeyingResult result = insert_keyframes(
|
||||
bmain,
|
||||
&armature_object_rna_pointer,
|
||||
{{"pose.bones[\"Bone\"].rotation_euler", std::nullopt, 0}},
|
||||
std::nullopt,
|
||||
{{"pose.bones[\"Bone\"].rotation_euler", std::nullopt, 0}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -367,13 +367,13 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__multiple_properties)
|
||||
|
||||
const CombinedKeyingResult result = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
std::nullopt,
|
||||
{
|
||||
{"empty_display_size"},
|
||||
{"location"},
|
||||
{"rotation_euler", std::nullopt, 0},
|
||||
{"rotation_euler", std::nullopt, 2},
|
||||
},
|
||||
std::nullopt,
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -411,8 +411,8 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__multiple_ids)
|
||||
/* First object should crate the action and get a binding and channel bag. */
|
||||
const CombinedKeyingResult result_1 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"empty_display_size"}},
|
||||
std::nullopt,
|
||||
{{"empty_display_size"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -447,8 +447,8 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__multiple_ids)
|
||||
* binding and channel bag. */
|
||||
const CombinedKeyingResult result_2 = insert_keyframes(bmain,
|
||||
&armature_object_rna_pointer,
|
||||
{{"empty_display_size"}},
|
||||
std::nullopt,
|
||||
{{"empty_display_size"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -475,8 +475,8 @@ TEST_F(KeyframingTest, insert_keyframes__baklava_legacy_action)
|
||||
/* Insert a key with the experimental flag off to create a legacy action. */
|
||||
const CombinedKeyingResult result_1 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"empty_display_size"}},
|
||||
std::nullopt,
|
||||
{{"empty_display_size"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -496,8 +496,8 @@ TEST_F(KeyframingTest, insert_keyframes__baklava_legacy_action)
|
||||
* action, not a layered action. */
|
||||
const CombinedKeyingResult result_2 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"location"}},
|
||||
std::nullopt,
|
||||
{{"location"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -522,8 +522,8 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__only_available)
|
||||
/* First attempt should fail, because there are no fcurves yet. */
|
||||
const CombinedKeyingResult result_1 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler"}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -551,11 +551,11 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__only_available)
|
||||
* will be two fcurves. */
|
||||
const CombinedKeyingResult result_2 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
std::nullopt,
|
||||
{
|
||||
{"rotation_euler", std::nullopt, 0},
|
||||
{"rotation_euler", std::nullopt, 2},
|
||||
},
|
||||
std::nullopt,
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -568,8 +568,8 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__only_available)
|
||||
* now have fcurves. */
|
||||
const CombinedKeyingResult result_3 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler"}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -596,8 +596,8 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__only_replace)
|
||||
object->rot[2] = 42.0;
|
||||
const CombinedKeyingResult result_1 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler"}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -608,11 +608,11 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__only_replace)
|
||||
* one key each. */
|
||||
const CombinedKeyingResult result_2 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
std::nullopt,
|
||||
{
|
||||
{"rotation_euler", std::nullopt, 0},
|
||||
{"rotation_euler", std::nullopt, 2},
|
||||
},
|
||||
std::nullopt,
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -645,8 +645,8 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__only_replace)
|
||||
object->rot[2] = 86.0;
|
||||
const CombinedKeyingResult result_3 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler"}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler"}},
|
||||
5.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -664,8 +664,8 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__only_replace)
|
||||
* the existing key on each fcurve. */
|
||||
const CombinedKeyingResult result_4 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler"}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -692,8 +692,8 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__only_needed)
|
||||
/* First attempt should succeed, because there are no fcurves yet. */
|
||||
const CombinedKeyingResult result_1 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler"}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -721,8 +721,8 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__only_needed)
|
||||
* property, but its value matches the current property value. */
|
||||
const CombinedKeyingResult result_2 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler"}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler"}},
|
||||
10.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -739,8 +739,8 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__only_needed)
|
||||
object->rot[2] = 123.0;
|
||||
const CombinedKeyingResult result_3 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler"}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler"}},
|
||||
10.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -767,8 +767,8 @@ TEST_F(KeyframingTest, insert_key_rna__legacy_action__non_array_property)
|
||||
object->empty_drawsize = 42.0;
|
||||
const CombinedKeyingResult result_1 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"empty_display_size"}},
|
||||
std::nullopt,
|
||||
{{"empty_display_size"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -789,8 +789,8 @@ TEST_F(KeyframingTest, insert_key_rna__legacy_action__non_array_property)
|
||||
object->empty_drawsize = 86.0;
|
||||
const CombinedKeyingResult result_2 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"empty_display_size"}},
|
||||
std::nullopt,
|
||||
{{"empty_display_size"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -804,8 +804,8 @@ TEST_F(KeyframingTest, insert_key_rna__legacy_action__non_array_property)
|
||||
object->empty_drawsize = 7.0;
|
||||
const CombinedKeyingResult result_3 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"empty_display_size"}},
|
||||
std::nullopt,
|
||||
{{"empty_display_size"}},
|
||||
10.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -828,8 +828,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__optional_frame)
|
||||
object->rotmode = ROT_MODE_XYZ;
|
||||
const CombinedKeyingResult result_1 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_mode"}},
|
||||
std::nullopt,
|
||||
{{"rotation_mode"}},
|
||||
std::nullopt,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -843,8 +843,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__optional_frame)
|
||||
object->rotmode = ROT_MODE_QUAT;
|
||||
const CombinedKeyingResult result_2 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_mode"}},
|
||||
std::nullopt,
|
||||
{{"rotation_mode"}},
|
||||
10.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -865,8 +865,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__optional_channel_group)
|
||||
const CombinedKeyingResult result_1 = insert_keyframes(
|
||||
bmain,
|
||||
&object_rna_pointer,
|
||||
{{"location", std::nullopt, 0}, {"visible_shadow"}},
|
||||
std::nullopt,
|
||||
{{"location", std::nullopt, 0}, {"visible_shadow"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -887,8 +887,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__optional_channel_group)
|
||||
const CombinedKeyingResult result_2 = insert_keyframes(
|
||||
bmain,
|
||||
&object_rna_pointer,
|
||||
{{"location", std::nullopt, 1}, {"hide_render"}},
|
||||
"Foo",
|
||||
{{"location", std::nullopt, 1}, {"hide_render"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -911,8 +911,8 @@ TEST_F(KeyframingTest, insert_keyframes__single_element)
|
||||
|
||||
const CombinedKeyingResult result = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler", std::nullopt, 0}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler", std::nullopt, 0}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -932,8 +932,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__all_elements)
|
||||
|
||||
const CombinedKeyingResult result = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler"}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -958,8 +958,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__pose_bone_rna_pointer)
|
||||
|
||||
const CombinedKeyingResult result = insert_keyframes(bmain,
|
||||
&pose_bone_rna_pointer,
|
||||
{{"rotation_euler", std::nullopt, 0}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler", std::nullopt, 0}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -982,8 +982,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__pose_bone_owner_id_point
|
||||
const CombinedKeyingResult result = insert_keyframes(
|
||||
bmain,
|
||||
&armature_object_rna_pointer,
|
||||
{{"pose.bones[\"Bone\"].rotation_euler", std::nullopt, 0}},
|
||||
std::nullopt,
|
||||
{{"pose.bones[\"Bone\"].rotation_euler", std::nullopt, 0}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -1007,13 +1007,13 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__multiple_properties)
|
||||
|
||||
insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
std::nullopt,
|
||||
{
|
||||
{"empty_display_size"},
|
||||
{"location"},
|
||||
{"rotation_euler", std::nullopt, 0},
|
||||
{"rotation_euler", std::nullopt, 2},
|
||||
},
|
||||
std::nullopt,
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -1039,8 +1039,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__only_available)
|
||||
/* First attempt should fail, because there are no fcurves yet. */
|
||||
const CombinedKeyingResult result_1 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler"}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -1060,11 +1060,11 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__only_available)
|
||||
* will be two fcurves. */
|
||||
insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
std::nullopt,
|
||||
{
|
||||
{"rotation_euler", std::nullopt, 0},
|
||||
{"rotation_euler", std::nullopt, 2},
|
||||
},
|
||||
std::nullopt,
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -1074,8 +1074,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__only_available)
|
||||
* now have fcurves. */
|
||||
const CombinedKeyingResult result_2 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler"}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -1098,8 +1098,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__only_replace)
|
||||
object->rot[2] = 42.0;
|
||||
const CombinedKeyingResult result_1 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler"}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -1110,11 +1110,11 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__only_replace)
|
||||
* one key each. */
|
||||
const CombinedKeyingResult result_2 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
std::nullopt,
|
||||
{
|
||||
{"rotation_euler", std::nullopt, 0},
|
||||
{"rotation_euler", std::nullopt, 2},
|
||||
},
|
||||
std::nullopt,
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -1143,8 +1143,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__only_replace)
|
||||
object->rot[2] = 86.0;
|
||||
const CombinedKeyingResult result_3 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler"}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler"}},
|
||||
5.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -1162,8 +1162,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__only_replace)
|
||||
* the existing key on each fcurve. */
|
||||
const CombinedKeyingResult result_4 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler"}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -1186,8 +1186,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__only_needed)
|
||||
/* First attempt should succeed, because there are no fcurves yet. */
|
||||
const CombinedKeyingResult result_1 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler"}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler"}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -1209,8 +1209,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__only_needed)
|
||||
anim_eval_context.eval_time = 10.0;
|
||||
const CombinedKeyingResult result_2 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler"}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler"}},
|
||||
10.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -1228,8 +1228,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__only_needed)
|
||||
object->rot[2] = 123.0;
|
||||
const CombinedKeyingResult result_3 = insert_keyframes(bmain,
|
||||
&object_rna_pointer,
|
||||
{{"rotation_euler"}},
|
||||
std::nullopt,
|
||||
{{"rotation_euler"}},
|
||||
10.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -1250,8 +1250,8 @@ TEST_F(KeyframingTest, insert_keyframes__nla_time_remapping)
|
||||
|
||||
const CombinedKeyingResult result = insert_keyframes(bmain,
|
||||
&object_with_nla_rna_pointer,
|
||||
{{"location", std::nullopt, 0}},
|
||||
std::nullopt,
|
||||
{{"location", std::nullopt, 0}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -1282,8 +1282,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__quaternion_on_nla)
|
||||
|
||||
const CombinedKeyingResult result = insert_keyframes(bmain,
|
||||
&object_with_nla_rna_pointer,
|
||||
{{"rotation_quaternion", std::nullopt, 0}},
|
||||
std::nullopt,
|
||||
{{"rotation_quaternion", std::nullopt, 0}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -1305,8 +1305,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__quaternion_on_nla__only_
|
||||
const CombinedKeyingResult result_1 = insert_keyframes(
|
||||
bmain,
|
||||
&object_with_nla_rna_pointer,
|
||||
{{"rotation_quaternion", std::nullopt, 0}},
|
||||
std::nullopt,
|
||||
{{"rotation_quaternion", std::nullopt, 0}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -1324,8 +1324,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__quaternion_on_nla__only_
|
||||
const CombinedKeyingResult result_2 = insert_keyframes(
|
||||
bmain,
|
||||
&object_with_nla_rna_pointer,
|
||||
{{"rotation_quaternion", std::nullopt, 0}},
|
||||
std::nullopt,
|
||||
{{"rotation_quaternion", std::nullopt, 0}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -1345,8 +1345,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__quaternion_on_nla__only_
|
||||
const CombinedKeyingResult result_1 = insert_keyframes(
|
||||
bmain,
|
||||
&object_with_nla_rna_pointer,
|
||||
{{"rotation_quaternion", std::nullopt, 0}},
|
||||
std::nullopt,
|
||||
{{"rotation_quaternion", std::nullopt, 0}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -1365,8 +1365,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__quaternion_on_nla__only_
|
||||
const CombinedKeyingResult result_2 = insert_keyframes(
|
||||
bmain,
|
||||
&object_with_nla_rna_pointer,
|
||||
{{"rotation_quaternion", std::nullopt, 0}},
|
||||
std::nullopt,
|
||||
{{"rotation_quaternion", std::nullopt, 0}},
|
||||
5.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
@ -1380,8 +1380,8 @@ TEST_F(KeyframingTest, insert_keyframes__legacy_action__quaternion_on_nla__only_
|
||||
const CombinedKeyingResult result_3 = insert_keyframes(
|
||||
bmain,
|
||||
&object_with_nla_rna_pointer,
|
||||
{{"rotation_quaternion", std::nullopt, 0}},
|
||||
std::nullopt,
|
||||
{{"rotation_quaternion", std::nullopt, 0}},
|
||||
1.0,
|
||||
anim_eval_context,
|
||||
BEZT_KEYTYPE_KEYFRAME,
|
||||
|
@ -404,8 +404,8 @@ static int insert_key(bContext *C, wmOperator *op)
|
||||
|
||||
combined_result.merge(animrig::insert_keyframes(bmain,
|
||||
&id_ptr,
|
||||
rna_paths.as_span(),
|
||||
std::nullopt,
|
||||
rna_paths.as_span(),
|
||||
scene_frame,
|
||||
anim_eval_context,
|
||||
key_type,
|
||||
@ -1036,8 +1036,8 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
|
||||
PointerRNA owner_ptr = RNA_id_pointer_create(ptr.owner_id);
|
||||
CombinedKeyingResult result = insert_keyframes(bmain,
|
||||
&owner_ptr,
|
||||
{{*path, {}, array_index}},
|
||||
group,
|
||||
{{*path, {}, array_index}},
|
||||
std::nullopt,
|
||||
anim_eval_context,
|
||||
eBezTriple_KeyframeType(ts->keyframe_type),
|
||||
|
@ -1089,8 +1089,8 @@ static int insert_key_to_keying_set_path(bContext *C,
|
||||
PointerRNA id_rna_pointer = RNA_id_pointer_create(keyingset_path->id);
|
||||
nathanvegdahl marked this conversation as resolved
Outdated
|
||||
CombinedKeyingResult result = insert_keyframes(bmain,
|
||||
&id_rna_pointer,
|
||||
{{keyingset_path->rna_path, {}, index}},
|
||||
group,
|
||||
{{keyingset_path->rna_path, {}, index}},
|
||||
std::nullopt,
|
||||
anim_eval_context,
|
||||
keytype,
|
||||
|
@ -854,8 +854,8 @@ static void insert_fcurve_key(bAnimContext *ac,
|
||||
PointerRNA id_rna_pointer = RNA_id_pointer_create(ale->id);
|
||||
CombinedKeyingResult result = insert_keyframes(ac->bmain,
|
||||
&id_rna_pointer,
|
||||
{{fcu->rna_path, {}, fcu->array_index}},
|
||||
channel_group,
|
||||
{{fcu->rna_path, {}, fcu->array_index}},
|
||||
std::nullopt,
|
||||
anim_eval_context,
|
||||
eBezTriple_KeyframeType(ts->keyframe_type),
|
||||
|
@ -212,8 +212,8 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
|
||||
PointerRNA id_rna_pointer = RNA_id_pointer_create(ale->id);
|
||||
CombinedKeyingResult result = insert_keyframes(ac->bmain,
|
||||
&id_rna_pointer,
|
||||
{{fcu->rna_path, {}, fcu->array_index}},
|
||||
channel_group,
|
||||
{{fcu->rna_path, {}, fcu->array_index}},
|
||||
std::nullopt,
|
||||
anim_eval_context,
|
||||
eBezTriple_KeyframeType(ts->keyframe_type),
|
||||
|
@ -408,8 +408,8 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
|
||||
CombinedKeyingResult combined_result = insert_keyframes(
|
||||
G_MAIN,
|
||||
&self->ptr,
|
||||
{{path_full, {}, index}},
|
||||
group_name ? std::optional(group_name) : std::nullopt,
|
||||
{{path_full, {}, index}},
|
||||
std::nullopt,
|
||||
anim_eval_context,
|
||||
eBezTriple_KeyframeType(keytype),
|
||||
|
Loading…
Reference in New Issue
Block a user
"the current scene time" is ill defined here. There is no parameter that gives you this information unambiguously. I think this assumes that
anim_eval_context.eval_time
is always the scene time (which it may or may not be), but that assumption is not documented here. This means that the reader wouldn't know where this value comes from.Ah! Thanks for catching that. I wrote those docs when I thought
AnimationEvalContext
represented something more fundamental/core than it actually does.