Blender
V3.3
|
#include <math.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_object_types.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_string_utils.h"
#include "BLI_utildefines.h"
#include "BKE_action.h"
#include "BKE_armature.h"
#include "BKE_fcurve.h"
#include "DEG_depsgraph.h"
Go to the source code of this file.
Classes | |
struct | FCurve_KeyCache |
Macros | |
#define | FCURVE_ASSIGN_VALUE(id, path_test_suffix, index) |
#define | FCURVE_ASSIGN_ARRAY(id, path_test_suffix) |
#define | FCURVE_CHANNEL_LEN (sizeof(fkc_pchan) / sizeof(struct FCurve_KeyCache)) |
#define | READ_VALUE_FLT(id) |
#define | READ_VALUE_INT(id) |
#define | READ_ARRAY_FLT(id) |
#define | WRITE_VALUE_FLT(id) |
#define | WRITE_ARRAY_FLT(id) |
Functions | |
Flip the Action (Armature/Pose Objects) | |
This flips the action using the rest pose (not the evaluated pose). Details:
| |
static void | action_flip_pchan_cache_fcurve_assign_value (struct FCurve_KeyCache *fkc, int index, const char *path, struct FCurvePathCache *fcache) |
static void | action_flip_pchan_cache_fcurve_assign_array (struct FCurve_KeyCache *fkc, int fkc_len, const char *path, struct FCurvePathCache *fcache) |
static void | action_flip_pchan_cache_init (struct FCurve_KeyCache *fkc, const float *keyed_frames, int keyed_frames_len) |
static void | action_flip_pchan (Object *ob_arm, const bPoseChannel *pchan, struct FCurvePathCache *fcache) |
static void | action_flip_pchan_rna_paths (struct bAction *act) |
void | BKE_action_flip_with_pose (struct bAction *act, struct Object *ob_arm) |
Mirror/Symmetry functions applying to actions.
Definition in file action_mirror.c.
#define FCURVE_CHANNEL_LEN (sizeof(fkc_pchan) / sizeof(struct FCurve_KeyCache)) |
|
static |
Structure to store transformation F-Curves corresponding to a pose bones transformation. Match struct member names from bPoseChannel so macros avoid repetition.
rotmode
needs to be read, but doesn't need to be written back to.Most bendy-bone settings don't need to be included either, flipping their RNA paths is enough. Although the X/Y settings could make sense to transform, in practice it would only work well if the rotation happened to swap X/Y alignment, leave this for now.
Definition at line 160 of file action_mirror.c.
References action_flip_pchan_cache_init(), Bone::arm_mat, FCurve_KeyCache::bezt_array, BKE_fcurve_handles_recalc_ex(), BKE_fcurves_calc_keyed_frames(), BKE_pchan_apply_mat4(), BKE_pchan_to_mat4(), BKE_pose_channel_find_name(), BLI_str_escape(), BLI_string_flip_side_name(), bPoseChannel::bone, dot_v3v3(), fabsf, FCurve_KeyCache::fcurve, FCURVE_ASSIGN_ARRAY, FCURVE_ASSIGN_VALUE, FCURVE_CHANNEL_LEN, FCurve_KeyCache::fcurve_eval, invert_m4_m4(), MAXBONENAME, MEM_freeN, mul_m4_m4m4(), bPoseChannel::name, NULL, Object::pose, READ_ARRAY_FLT, READ_VALUE_FLT, READ_VALUE_INT, size(), SNPRINTF, STREQ, unit_m4(), WRITE_ARRAY_FLT, and WRITE_VALUE_FLT.
Referenced by BKE_action_flip_with_pose().
|
static |
Assign FCurve_KeyCache.fcurve path, using a path
lookup for an array.
Definition at line 92 of file action_mirror.c.
References BKE_fcurve_pathcache_find_array(), and FCurve_KeyCache::fcurve.
|
static |
Assign fkc
path, using a path
lookup for a single value.
Definition at line 78 of file action_mirror.c.
References FCurve::bezt, BKE_fcurve_pathcache_find(), and FCurve_KeyCache::fcurve.
|
static |
Fill in pose channel cache for each frame in keyed_frames
.
keyed_frames | An array of keyed_frames to evaluate, note that each frame is rounded to the nearest int. |
keyed_frames_len | The length of the keyed_frames array. |
Definition at line 114 of file action_mirror.c.
References FCurve::bezt, FCurve_KeyCache::bezt_array, BLI_assert, evaltime, evaluate_fcurve_only_curve(), FCurve_KeyCache::fcurve, FCurve_KeyCache::fcurve_eval, FCURVE_MOD_OFF, FCurve::flag, MEM_mallocN, NULL, FCurve::totvert, and BezTriple::vec.
Referenced by action_flip_pchan().
Swap all RNA paths left/right.
Definition at line 385 of file action_mirror.c.
References AGRP_TEMP, BLI_sprintfN(), BLI_str_escape(), BLI_str_escape_find_quote(), BLI_str_unescape(), BLI_string_flip_side_name(), bAction::curves, bAction::groups, LISTBASE_FOREACH, MAXBONENAME, MEM_freeN, NULL, STREQ, STRNCPY, STRPREFIX, and UNLIKELY.
Referenced by BKE_action_flip_with_pose().
Definition at line 448 of file action_mirror.c.
References action_flip_pchan(), action_flip_pchan_rna_paths(), BKE_fcurve_pathcache_create(), BKE_fcurve_pathcache_destroy(), bPose::chanbase, bAction::curves, DEG_id_tag_update(), bAction::id, ID_RECALC_COPY_ON_WRITE, LISTBASE_FOREACH_INDEX, and Object::pose.
Referenced by flip_pose().