34#include "RNA_prototypes.hh"
203 C, op, 270,
IFACE_(
"Calculate Paths for the Selected Bones"),
IFACE_(
"Calculate"));
262 ot->
name =
"Calculate Bone Paths";
263 ot->
idname =
"POSE_OT_paths_calculate";
264 ot->
description =
"Calculate paths for the selected bones";
293 "Which point on the bones is used when calculating paths");
313 if (
ELEM(
nullptr, ob, scene)) {
341 ot->
name =
"Update Bone Paths";
342 ot->
idname =
"POSE_OT_paths_update";
343 ot->
description =
"Recalculate paths for bones that already have them";
358 bool skipped =
false;
369 pchan.
mpath =
nullptr;
378 if (skipped ==
false) {
412 return TIP_(
"Clear motion paths of selected bones");
414 return TIP_(
"Clear motion paths of all bones");
420 ot->
name =
"Clear Bone Paths";
421 ot->
idname =
"POSE_OT_paths_clear";
436 "Only clear motion paths of selected bones");
447 if (
ELEM(
nullptr, scene, ob, ob->
pose)) {
465 ot->
name =
"Update Range from Scene";
466 ot->
idname =
"POSE_OT_paths_range_update";
467 ot->
description =
"Update frame range for motion paths from the Scene's current frame range";
492 bArmature *arm = id_cast<bArmature *>(ob->data);
493 ListBaseT<LinkData> bones_names = {
nullptr};
502 bones_names.free_no_destruct();
519 ot->
name =
"Flip Names";
520 ot->
idname =
"POSE_OT_flip_names";
521 ot->
description =
"Flips (and corrects) the axis suffixes of the names of selected bones";
534 "Try to remove right-most dot-number from flipped names.\n"
535 "Warning: May result in incoherent naming in some cases");
545 Object *ob_prev =
nullptr;
549 bArmature *arm = id_cast<bArmature *>(ob->data);
550 const Bone *bone = pchan->bone_get(*ob);
574 {0,
"XAXIS", 0,
"X-Axis",
"Left/Right"},
575 {1,
"YAXIS", 0,
"Y-Axis",
"Front/Back"},
576 {2,
"ZAXIS", 0,
"Z-Axis",
"Top/Bottom"},
577 {0,
nullptr, 0,
nullptr,
nullptr},
581 ot->
name =
"Auto-Name by Axis";
582 ot->
idname =
"POSE_OT_autoside_names";
584 "Automatically renames the selected bones according to which side of the target axis they "
609 "pose.rotation_mode_set is deprecated. Use anim.rotation_mode_convert instead");
611 Object *prev_ob =
nullptr;
617 pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle, pchan->rotmode, mode);
620 pchan->rotmode = mode;
638 ot->
name =
"Set Rotation Mode";
639 ot->
idname =
"POSE_OT_rotation_mode_set";
640 ot->
description =
"Set the rotation representation used by selected bones";
669 bool changed_multi =
false;
673 for (
Object *ob_iter : objects) {
674 bool changed =
false;
675 bArmature *arm = id_cast<bArmature *>(ob_iter->data);
689 changed_multi =
true;
701 ot->
name =
"Hide Selected";
702 ot->
idname =
"POSE_OT_hide";
703 ot->
description =
"Tag selected bones to not be visible in Pose Mode";
724 bool changed_multi =
false;
727 for (
Object *ob_iter : objects) {
728 bArmature *arm = id_cast<bArmature *>(ob_iter->data);
730 bool changed =
false;
732 const Bone *bone = pchan.bone_get(*ob_iter);
747 changed_multi =
true;
759 ot->
name =
"Reveal Selected";
760 ot->
idname =
"POSE_OT_reveal";
761 ot->
description =
"Reveal all bones hidden in Pose Mode";
784 bool changed_multi =
false;
790 bool changed =
false;
800 C, scene, ob_iter, pchan, {{
"rotation_quaternion"}},
false);
806 changed_multi =
true;
820 ot->
name =
"Flip Quaternions";
821 ot->
idname =
"POSE_OT_quaternions_flip";
823 "Flip quaternion values to achieve desired rotations, while maintaining the same "
Functions to deal with Armatures.
C++ functions to deal with Armature collections (i.e. the successor of bone layers).
Functions to insert, delete or modify keyframes.
#define FOREACH_PCHAN_SELECTED_IN_OBJECT_END
#define FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN(_ob, _pchan)
#define CTX_DATA_BEGIN_WITH_ID(C, Type, instance, member, Type_id, instance_id)
#define CTX_DATA_BEGIN(C, Type, instance, member)
#define FOREACH_OBJECT_IN_MODE_BEGIN(_bmain, _scene, _view_layer, _v3d, _object_type, _object_mode, _instance)
#define FOREACH_OBJECT_IN_MODE_END
General operations, lookup, etc. for blender objects.
#define STRNCPY_UTF8(dst, src)
Utility defines for timing/benchmarks.
#define TIMEIT_START(var)
Object is a sort of wrapper for general info.
#define SET_FLAG_FROM_TEST(value, test, flag)
void bone_deselect(bPoseChannel *pchan)
void autokeyframe_pose_channel(bContext *C, Scene *scene, Object *ob, bPoseChannel *pose_channel, Span< RNAPath > rna_paths, short targetless_ik)
void free(struct bMotionPath *mpath)
struct bMotionPath * ensure(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan)
void tag_for_recalc(bMotionPath &motion_path)
Object * context_active_object(const bContext *C)
void ED_armature_bones_flip_names(Main *bmain, bArmature *arm, ListBaseT< LinkData > *bones_names, const bool do_strip_numbers)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void POSE_OT_flip_names(wmOperatorType *ot)
wmOperatorStatus WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *)
bool ED_operator_posemode_exclusive(bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
int RNA_enum_get(PointerRNA *ptr, const char *name)
void POSE_OT_paths_calculate(wmOperatorType *ot)
void DEG_graph_free(Depsgraph *graph)
static wmOperatorStatus pose_bone_rotmode_exec(bContext *C, wmOperator *op)
const EnumPropertyItem rna_enum_object_rotation_mode_items[]
static std::string pose_clear_paths_get_description(bContext *, wmOperatorType *, PointerRNA *ptr)
bool ED_operator_posemode(bContext *C)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void POSE_OT_paths_range_update(wmOperatorType *ot)
bool ANIM_bone_in_visible_collection(const bArmature *armature, const Bone *bone)
void POSE_OT_quaternions_flip(wmOperatorType *ot)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
const EnumPropertyItem rna_enum_motionpath_bake_location_items[]
static wmOperatorStatus pose_autoside_names_exec(bContext *C, wmOperator *op)
static bool pose_update_paths_poll(bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
Object * ED_pose_object_from_context(bContext *C)
static wmOperatorStatus pose_calculate_paths_exec(bContext *C, wmOperator *op)
void ED_armature_bone_rename(Main *bmain, bArmature *arm, const char *oldnamep, const char *newnamep)
bool bone_autoside_name(char name[64], int strip_number, short axis, float head, float tail)
void POSE_OT_paths_update(wmOperatorType *ot)
Vector< Object * > BKE_object_pose_array_get_unique(const Main &bmain, const Scene *scene, ViewLayer *view_layer, View3D *v3d)
void animviz_build_motionpath_targets(Object *ob, Vector< MPathTarget > &r_targets)
static wmOperatorStatus pose_reveal_exec(bContext *C, wmOperator *op)
static wmOperatorStatus pose_update_paths_exec(bContext *C, wmOperator *op)
void DEG_id_tag_update_ex(Main *bmain, ID *id, unsigned int flags)
Depsgraph * animviz_depsgraph_build(Main *bmain, Scene *scene, ViewLayer *view_layer, const Span< MPathTarget > targets)
void POSE_OT_hide(wmOperatorType *ot)
bool ED_object_posemode_exit_ex(Main *bmain, Object *ob)
void DEG_id_tag_update(ID *id, unsigned int flags)
float BKE_scene_frame_get(const Scene *scene)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Object * BKE_object_pose_armature_get(Object *ob)
static wmOperatorStatus pose_flip_quats_exec(bContext *C, wmOperator *)
LinkData * BLI_genericNodeN(void *data)
void animviz_calc_motionpaths(Depsgraph *depsgraph, Scene *scene, MutableSpan< MPathTarget > targets, const int modified_frame)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
static void pose_clear_paths(Object *ob, bool only_selected)
const EnumPropertyItem rna_enum_motionpath_range_items[]
wmOperatorStatus WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, std::optional< std::string > title, std::optional< std::string > confirm_text, const bool cancel_default, std::optional< std::string > message, const bool show_icon)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void animviz_motionpath_compute_range(Object *ob, Scene *scene)
void BKE_rotMode_change_values(float quat[4], float eul[3], float axis[3], float *angle, eRotationModes oldMode, eRotationModes newMode)
static wmOperatorStatus pose_calculate_paths_invoke(bContext *C, wmOperator *op, const wmEvent *)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
bool ED_object_posemode_exit(bContext *C, Object *ob)
static wmOperatorStatus pose_flip_names_exec(bContext *C, wmOperator *op)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Main * CTX_data_main(const bContext *C)
bool ED_operator_posemode_local(bContext *C)
static wmOperatorStatus pose_hide_exec(bContext *C, wmOperator *op)
bool ED_object_posemode_enter_ex(Main *bmain, Object *ob)
void POSE_OT_paths_clear(wmOperatorType *ot)
const EnumPropertyItem rna_enum_motionpath_display_type_items[]
MINLINE void negate_v4(float r[4])
Scene * CTX_data_scene(const bContext *C)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
ReportList * CTX_wm_reports(const bContext *C)
bool BKE_id_is_editable(const Main *bmain, const ID *id)
@ MOTIONPATH_BAKE_HAS_PATHS
void POSE_OT_rotation_mode_set(wmOperatorType *ot)
void POSE_OT_autoside_names(wmOperatorType *ot)
Object * CTX_data_active_object(const bContext *C)
void POSE_OT_reveal(wmOperatorType *ot)
void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob)
View3D * CTX_wm_view3d(const bContext *C)
bool ED_object_posemode_enter(bContext *C, Object *ob)
static wmOperatorStatus pose_clear_paths_exec(bContext *C, wmOperator *op)
static wmOperatorStatus pose_update_paths_range_exec(bContext *C, wmOperator *)
eMotionPath_Ranges path_range
eMotionPath_BakeFlag path_bakeflag
eMotionPaths_Types path_type
eAnimViz_RecalcFlags recalc
ListBaseT< bPoseChannel > chanbase
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
std::string(*) get_description(bContext *C, wmOperatorType *ot, PointerRNA *ptr)
struct ReportList * reports