38 #include "RNA_prototypes.h"
165 bool free_depsgraph =
false;
183 free_depsgraph =
false;
187 free_depsgraph =
true;
206 if (free_depsgraph) {
289 ot->
name =
"Calculate Bone Paths";
290 ot->
idname =
"POSE_OT_paths_calculate";
320 "Which point on the bones is used when calculating paths");
364 ot->
name =
"Update Bone Paths";
365 ot->
idname =
"POSE_OT_paths_update";
366 ot->
description =
"Recalculate paths for bones that already have them";
382 bool skipped =
false;
402 if (skipped ==
false) {
442 ot->
name =
"Clear Bone Paths";
444 ot->
description =
"Clear path caches for all bones, hold Shift key for selected bones only";
456 ot->
srna,
"only_selected",
false,
"Only Selected",
"Only clear paths from selected bones");
485 ot->
name =
"Update Range from Scene";
486 ot->
idname =
"POSE_OT_paths_range_update";
487 ot->
description =
"Update frame range for motion paths from the Scene's current frame range";
535 ot->
description =
"Flips (and corrects) the axis suffixes of the names of selected bones";
548 "Try to remove right-most dot-number from flipped names.\n"
549 "Warning: May result in incoherent naming in some cases");
564 BLI_strncpy(newname, pchan->name,
sizeof(newname));
565 if (
bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis])) {
586 {0,
"XAXIS", 0,
"X-Axis",
"Left/Right"},
587 {1,
"YAXIS", 0,
"Y-Axis",
"Front/Back"},
588 {2,
"ZAXIS", 0,
"Z-Axis",
"Top/Bottom"},
593 ot->
name =
"Auto-Name by Axis";
594 ot->
idname =
"POSE_OT_autoside_names";
596 "Automatically renames the selected bones according to which side of the target axis they "
622 pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle, pchan->rotmode, (
short)mode);
625 pchan->rotmode = mode;
643 ot->
name =
"Set Rotation Mode";
644 ot->
idname =
"POSE_OT_rotation_mode_set";
645 ot->
description =
"Set the rotation representation used by selected bones";
696 bool layers[32] = {
false};
709 for (
int i = 0; i < maxLayers; i++) {
726 ot->
name =
"Show All Layers";
727 ot->
idname =
"ARMATURE_OT_layers_show_all";
739 ot->
srna,
"all", 1,
"All Layers",
"Enable all layers or just the first 16 (top row)");
798 ot->
name =
"Change Armature Layers";
799 ot->
idname =
"ARMATURE_OT_armature_layers";
812 ot->
srna,
"layers", 32,
NULL,
"Layer",
"Armature layers to make visible");
821 bool layers[32] = {0};
828 for (bit = 0; bit < 32; bit++) {
829 layers[bit] = (pchan->bone->layer & (1u << bit)) != 0;
887 ot->
name =
"Change Bone Layers";
889 ot->
description =
"Change the layers that the selected bones belong to";
901 ot->
srna,
"layers", 32,
NULL,
"Layer",
"Armature layers that bone belongs to");
910 bool layers[32] = {0};
917 for (bit = 0; bit < 32; bit++) {
918 if (ebone->layer & (1u << bit)) {
963 ot->
name =
"Change Bone Layers";
964 ot->
idname =
"ARMATURE_OT_bone_layers";
965 ot->
description =
"Change the layers that the selected bones belong to";
977 ot->
srna,
"layers", 32,
NULL,
"Layer",
"Armature layers that bone belongs to");
1008 bool changed_multi =
false;
1013 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1020 changed_multi =
true;
1033 ot->
name =
"Hide Selected";
1035 ot->
description =
"Tag selected bones to not be visible in Pose Mode";
1073 bool changed_multi =
false;
1077 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1083 changed_multi =
true;
1096 ot->
name =
"Reveal Selected";
1118 bool changed_multi =
false;
1123 bool changed =
false;
1138 changed_multi =
true;
1153 ot->
idname =
"POSE_OT_quaternions_flip";
1155 "Flip quaternion values to achieve desired rotations, while maintaining the same "
Blender kernel action and pose functionality.
void animviz_free_motionpath(struct bMotionPath *mpath)
struct bMotionPath * animviz_verify_motionpaths(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan)
void BKE_pose_ensure(struct Main *bmain, struct Object *ob, struct bArmature *arm, bool do_id_user)
#define FOREACH_PCHAN_SELECTED_IN_OBJECT_END
void BKE_rotMode_change_values(float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode)
#define FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN(_ob, _pchan)
bool bone_autoside_name(char name[64], int strip_number, short axis, float head, float tail)
#define CTX_DATA_BEGIN_WITH_ID(C, Type, instance, member, Type_id, instance_id)
struct ScrArea * CTX_wm_area(const bContext *C)
struct Scene * CTX_data_scene(const bContext *C)
struct Object * CTX_data_edit_object(const bContext *C)
#define CTX_DATA_BEGIN(C, Type, instance, member)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct Object * CTX_data_active_object(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
struct ReportList * CTX_wm_reports(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
#define FOREACH_OBJECT_IN_MODE_END
#define FOREACH_OBJECT_IN_MODE_BEGIN(_view_layer, _v3d, _object_type, _object_mode, _instance)
bool BKE_id_is_editable(const struct Main *bmain, const struct ID *id)
General operations, lookup, etc. for blender objects.
struct Object * BKE_object_pose_armature_get(struct Object *ob)
struct Object ** BKE_object_pose_array_get_unique(struct ViewLayer *view_layer, struct View3D *v3d, unsigned int *r_objects_len)
void BKE_report(ReportList *reports, eReportType type, const char *message)
struct LinkData * BLI_genericNodeN(void *data)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE void negate_v4(float r[4])
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
#define POINTER_FROM_INT(i)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define POINTER_AS_INT(i)
struct Depsgraph Depsgraph
void DEG_id_tag_update_ex(struct Main *bmain, struct ID *id, int flag)
void DEG_graph_free(Depsgraph *graph)
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_COPY_ON_WRITE
@ MOTIONPATH_BAKE_HAS_PATHS
Object is a sort of wrapper for general info.
@ ANIMVIZ_CALC_RANGE_FULL
@ ANIMVIZ_CALC_RANGE_CURRENT_FRAME
@ ANIMVIZ_CALC_RANGE_CHANGED
@ POSE_PATH_CALC_RANGE_CURRENT_FRAME
@ POSE_PATH_CALC_RANGE_CHANGED
@ POSE_PATH_CALC_RANGE_FULL
#define ANIM_KS_LOC_ROT_SCALE_ID
struct Object * ED_object_context(const struct bContext *C)
bool ED_operator_posemode(struct bContext *C)
bool ED_operator_posemode_local(struct bContext *C)
bool ED_operator_editarmature(struct bContext *C)
bool ED_operator_posemode_exclusive(struct bContext *C)
Read Guarded memory(de)allocation.
Platform independent time functions.
Utility defines for timing/benchmarks.
#define TIMEIT_START(var)
void animviz_calc_motionpaths(Depsgraph *depsgraph, Main *bmain, Scene *scene, ListBase *targets, eAnimvizCalcRange range, bool restore)
void animviz_get_object_motionpaths(Object *ob, ListBase *targets)
Depsgraph * animviz_depsgraph_build(Main *bmain, Scene *scene, ViewLayer *view_layer, ListBase *targets)
void animviz_motionpath_compute_range(Object *ob, Scene *scene)
int bone_looper(struct Object *ob, struct Bone *bone, void *data, int(*bone_func)(struct Object *, struct Bone *, void *))
void ED_armature_bone_rename(Main *bmain, bArmature *arm, const char *oldnamep, const char *newnamep)
void ED_armature_bones_flip_names(Main *bmain, bArmature *arm, ListBase *bones_names, const bool do_strip_numbers)
void ED_armature_edit_refresh_layer_used(bArmature *arm)
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
const Depsgraph * depsgraph
bool ED_autokeyframe_pchan(bContext *C, Scene *scene, Object *ob, bPoseChannel *pchan, KeyingSet *ks)
KeyingSet * ANIM_builtin_keyingset_get_named(KeyingSet *prevKS, const char name[])
void(* MEM_freeN)(void *vmemh)
static void area(int d1, int d2, int e1, int e2, float weights[2])
static int pose_clear_paths_exec(bContext *C, wmOperator *op)
static int pose_update_paths_range_exec(bContext *C, wmOperator *UNUSED(op))
void POSE_OT_hide(wmOperatorType *ot)
void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob, ePosePathCalcRange range)
void POSE_OT_paths_range_update(wmOperatorType *ot)
static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static int pose_update_paths_exec(bContext *C, wmOperator *op)
static int armature_bone_layers_exec(bContext *C, wmOperator *op)
static int pose_autoside_names_exec(bContext *C, wmOperator *op)
void POSE_OT_quaternions_flip(wmOperatorType *ot)
void ARMATURE_OT_bone_layers(wmOperatorType *ot)
void POSE_OT_paths_update(wmOperatorType *ot)
static int armature_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
bool ED_object_posemode_enter(bContext *C, Object *ob)
static int pose_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static bArmature * armature_layers_get_data(Object **ob)
static void ED_pose_clear_paths(Object *ob, bool only_selected)
static int pose_bone_layers_exec(bContext *C, wmOperator *op)
static int show_pose_bone_cb(Object *ob, Bone *bone, void *data)
void ARMATURE_OT_layers_show_all(wmOperatorType *ot)
void POSE_OT_reveal(wmOperatorType *ot)
static eAnimvizCalcRange pose_path_convert_range(ePosePathCalcRange range)
Object * ED_pose_object_from_context(bContext *C)
static int hide_pose_bone_fn(Object *ob, Bone *bone, void *ptr)
bool ED_object_posemode_enter_ex(struct Main *bmain, Object *ob)
void POSE_OT_flip_names(wmOperatorType *ot)
void POSE_OT_paths_clear(wmOperatorType *ot)
static int pose_reveal_exec(bContext *C, wmOperator *op)
bool ED_object_posemode_exit_ex(struct Main *bmain, Object *ob)
static bool armature_layers_poll(bContext *C)
static int pose_flip_quats_exec(bContext *C, wmOperator *UNUSED(op))
static int armature_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void POSE_OT_autoside_names(wmOperatorType *ot)
static int pose_calculate_paths_exec(bContext *C, wmOperator *op)
void POSE_OT_paths_calculate(wmOperatorType *ot)
static int pose_flip_names_exec(bContext *C, wmOperator *op)
static int pose_clear_paths_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void POSE_OT_rotation_mode_set(wmOperatorType *ot)
static int pose_bone_rotmode_exec(bContext *C, wmOperator *op)
static int pose_hide_exec(bContext *C, wmOperator *op)
static int pose_armature_layers_showall_exec(bContext *C, wmOperator *op)
static int armature_layers_exec(bContext *C, wmOperator *op)
void ARMATURE_OT_armature_layers(wmOperatorType *ot)
static bool pose_update_paths_poll(bContext *C)
bool ED_object_posemode_exit(bContext *C, Object *ob)
void POSE_OT_bone_layers(wmOperatorType *ot)
void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const bool *values)
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
void RNA_boolean_get_array(PointerRNA *ptr, const char *name, bool *values)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
int RNA_enum_get(PointerRNA *ptr, const char *name)
const EnumPropertyItem rna_enum_motionpath_display_type_items[]
const EnumPropertyItem rna_enum_motionpath_range_items[]
const EnumPropertyItem rna_enum_motionpath_bake_location_items[]
PropertyRNA * RNA_def_boolean_layer_member(StructOrFunctionRNA *cont_, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
const EnumPropertyItem rna_enum_object_rotation_mode_items[]
struct bPoseChannel * next
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int WM_operator_props_popup(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width)
int WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)