35#include "RNA_prototypes.hh"
76 if (!adt || !adt->
action) {
90 if (!path_to_struct.has_value()) {
94 base_path = path_to_struct.value();
98 const StringRefNull fcurve_path = fcurve.rna_path();
99 if (!base_path.is_empty() && !fcurve_path.startswith(base_path)) {
105 property_name = fcurve_path;
109 if (fcurve_path[base_path.size()] ==
'.') {
110 property_name = fcurve_path.substr(base_path.size() + 1);
113 property_name = fcurve_path.substr(base_path.size());
117 if (property_name ==
"location") {
119 r_curves.append(&fcurve);
123 if (property_name ==
"scale") {
125 r_curves.append(&fcurve);
129 if (property_name ==
"rotation_euler" || property_name ==
"rotation_quaternion" ||
130 property_name ==
"rotation_axis_angle")
133 r_curves.append(&fcurve);
137 if (property_name.startswith(
"bbone_")) {
138 flags |= ACT_TRANS_BBONE;
139 r_curves.append(&fcurve);
144 if (property_name.startswith(
"[\"")) {
145 flags |= ACT_TRANS_PROP;
146 r_curves.append(&fcurve);
169 if (property_values.
size() == 0) {
173 snapshots.
append({prop, std::move(property_values)});
197 std::string property_name_with_brackets = fmt::format(
"[\"{}\"]", name_escaped);
201 if (system_properties) {
222 SlideSubject *slide_subject = MEM_new<SlideSubject>(
"SlideSubject");
227 "transformable_pose_bone", ob, pchan);
235 slide_subject->
ptr = bone_ptr;
269 Object *prev_ob, *ob_pose_armature;
272 ob_pose_armature =
nullptr;
282 if (ob_pose_armature ==
nullptr) {
285 if (!ob_pose_armature->
adt || !ob_pose_armature->
adt->
action) {
290 if (!inserted_bones.
add(pchan)) {
297 if (pchan_mirror && inserted_bones.
add(pchan_mirror)) {
307 if (slide_subjects.is_empty()) {
309 ob_pose_armature =
nullptr;
317 if (ob_pose_armature ==
nullptr) {
320 if (!ob_pose_armature->
adt || !ob_pose_armature->
adt->
action) {
338 ob->id, object_ptr,
curves);
344 SlideSubject *slide_subject = MEM_new<SlideSubject>(
"TransformableFCurveLink");
354 slide_subject->
ptr = object_ptr;
357 store_id_properties(*slide_subject, object_ptr, ob->id.properties, ob->id.system_properties);
388 for (slide_subject = slide_subjects->first(); slide_subject; slide_subject = pfln) {
389 pfln = slide_subject->
next;
396 MEM_delete(slide_subject);
430 slide_subject.old_loc,
454 const ListBaseT<SlideSubject> *slide_subjects)
456 bool anything_to_key =
false;
461 anything_to_key =
true;
465 if (!anything_to_key) {
482 paths.
append({
"location"});
494 for (
const PropertySnapshot &snapshot : slide_subject.additional_properties) {
501 paths.
append({fmt::format(
"[\"{}\"]", name_escaped)});
507 switch (slide_subject.transformable->type()) {
524 ID *owner_id = slide_subject.transformable->owner_id();
528 objects.
append(id_cast<Object *>(owner_id));
Functions and classes to work with Actions.
Functionality to iterate an Action in various ways.
Functions to insert, delete or modify keyframes.
Functionality to interact with keying sets.
Helper functions for animation to interact with the RNA system.
Blender kernel action and pose functionality.
#define CTX_DATA_BEGIN_WITH_ID(C, Type, instance, member, Type_id, instance_id)
#define CTX_DATA_BEGIN(C, Type, instance, member)
General operations, lookup, etc. for blender objects.
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define BLI_assert_unreachable()
void append(const T &value)
constexpr bool is_empty() const
constexpr const char * data() const
void foreach_fcurve_in_action_slot(Action &action, slot_handle_t handle, FunctionRef< void(FCurve &fcurve)> callback)
bool autokeyframe_cfra_can_key(const Scene *scene, ID *id)
StringRefNull get_rotation_mode_path(eRotationModes rotation_mode)
void rna_property_set_as_float(PointerRNA &ptr, PropertyRNA &prop, Span< float > values)
void autokeyframe_object(bContext *C, const Scene *scene, Object *ob, Span< RNAPath > rna_paths)
Array< float > rna_property_get_as_float(PointerRNA &ptr, PropertyRNA &prop)
void autokeyframe_pose_channel(bContext *C, Scene *scene, Object *ob, bPoseChannel *pose_channel, Span< RNAPath > rna_paths, short targetless_ik)
void motion_paths_recalc(bContext *C, Scene *scene, const Span< Object * > objects)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
static void get_pose_bones_for_slide(bContext *C, ListBaseT< SlideSubject > &slide_subjects)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void slide_subjects_free(ListBaseT< SlideSubject > *slide_subjects)
const char * RNA_property_identifier(const PropertyRNA *prop)
std::optional< std::string > RNA_path_from_ID_to_struct(const PointerRNA *ptr)
enum eContextObjectMode CTX_data_mode_enum(const bContext *C)
static void store_property_snapshot(PointerRNA &ptr, const StringRef property_name, Vector< PropertySnapshot > &snapshots)
void slide_subjects_reset(ListBaseT< SlideSubject > *slide_subjects)
AnimData * BKE_animdata_from_id(const ID *id)
static eAction_TransformFlags get_item_transform_flags_and_fcurves(ID &id, PointerRNA &ptr, Vector< FCurve * > &r_curves)
bPoseChannel * BKE_pose_channel_get_mirrored(const bPose *pose, const char *name) ATTR_WARN_UNUSED_RESULT
static Object * animated_armature_ob_get(Object *ob_)
void slide_subjects_get(bContext *C, ListBaseT< SlideSubject > *r_transformable_list)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void DEG_id_tag_update(ID *id, unsigned int flags)
Object * BKE_object_pose_armature_get(Object *ob)
void ANIM_deselect_keys_in_animation_editors(bContext *C)
void slide_subjects_autokey(bContext *C, Scene *scene, const ListBaseT< SlideSubject > *slide_subjects)
char char size_t BLI_str_escape(char *__restrict dst, StringRef src, size_t dst_maxncpy) ATTR_NONNULL(1)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void slide_subjects_refresh(bContext *C, const SlideSubject &slide_subject)
bool RNA_struct_is_ID(const StructRNA *type)
static void store_id_properties(SlideSubject &slide_subject, PointerRNA &ptr, IDProperty *id_properties, IDProperty *system_properties)
static void pchan_to_slide_subject(ListBaseT< SlideSubject > &slide_subjects, Object &ob, bPoseChannel &pchan)
static void get_objects_for_slide(bContext *C, ListBaseT< SlideSubject > &slider_data)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
@ ID_RECALC_ANIMATION_NO_FLUSH
ID_Type GS(const char *name)
static void store_starting_transform(SlideSubject &slide_subject, ed::AnimTransformable &transformable)
ListBaseT< struct IDProperty > group
eAction_TransformFlags transform_flag
Vector< PropertySnapshot > additional_properties
Vector< PropertySnapshot > system_properties
ed::TransformFloats old_loc
Vector< PropertySnapshot > properties
ed::AnimTransformable * transformable
Vector< FCurve * > fcurves
ed::TransformFloats old_scale
IDProperty * system_properties