|
Blender V4.3
|
#include <cmath>#include <cstring>#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_matrix.h"#include "BLI_math_vector.h"#include "BLI_string_utils.hh"#include "BLI_utildefines.h"#include "BKE_action.hh"#include "BKE_armature.hh"#include "BKE_fcurve.hh"#include "ANIM_action_legacy.hh"#include "DEG_depsgraph.hh"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(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 (FCurve_KeyCache *fkc, int index, const char *path, FCurvePathCache *fcache) |
| static void | action_flip_pchan_cache_fcurve_assign_array (FCurve_KeyCache *fkc, int fkc_len, const char *path, FCurvePathCache *fcache) |
| static void | action_flip_pchan_cache_init (FCurve_KeyCache *fkc, const float *keyed_frames, int keyed_frames_len) |
| static void | action_flip_pchan (Object *ob_arm, const bPoseChannel *pchan, FCurvePathCache *fcache) |
| static void | action_flip_pchan_rna_paths (bAction *act) |
| void | BKE_action_flip_with_pose (bAction *act, Object *ob_arm) |
Mirror/Symmetry functions applying to actions.
Definition in file action_mirror.cc.
| #define FCURVE_ASSIGN_ARRAY | ( | id, | |
| path_test_suffix ) |
Referenced by action_flip_pchan().
| #define FCURVE_ASSIGN_VALUE | ( | id, | |
| path_test_suffix, | |||
| index ) |
Referenced by action_flip_pchan().
| #define FCURVE_CHANNEL_LEN (sizeof(fkc_pchan) / sizeof(FCurve_KeyCache)) |
Referenced by action_flip_pchan().
| #define READ_ARRAY_FLT | ( | id | ) |
Referenced by action_flip_pchan().
| #define READ_VALUE_FLT | ( | id | ) |
Referenced by action_flip_pchan().
| #define READ_VALUE_INT | ( | id | ) |
Referenced by action_flip_pchan().
| #define WRITE_ARRAY_FLT | ( | id | ) |
Referenced by action_flip_pchan().
| #define WRITE_VALUE_FLT | ( | id | ) |
Referenced by action_flip_pchan().
|
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 166 of file action_mirror.cc.
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(), bActionChannel::name, bPoseChannel::name, Object::pose, READ_ARRAY_FLT, READ_VALUE_FLT, READ_VALUE_INT, 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 97 of file action_mirror.cc.
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 83 of file action_mirror.cc.
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 119 of file action_mirror.cc.
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, FCurve::totvert, and BezTriple::vec.
Referenced by action_flip_pchan().
|
static |
Swap all RNA paths left/right.
Definition at line 389 of file action_mirror.cc.
References AGRP_TEMP, BLI_sprintfN(), BLI_str_escape(), BLI_str_escape_find_quote(), BLI_str_unescape(), BLI_string_flip_side_name(), blender::animrig::legacy::channel_groups_all(), blender::animrig::legacy::fcurves_all(), MAXBONENAME, MEM_freeN(), STREQ, STRNCPY, STRPREFIX, and UNLIKELY.
Referenced by BKE_action_flip_with_pose().
Definition at line 452 of file action_mirror.cc.
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_SYNC_TO_EVAL, LISTBASE_FOREACH_INDEX, and Object::pose.