33#include "RNA_prototypes.hh"
163 bool free_depsgraph =
false;
181 free_depsgraph =
false;
185 free_depsgraph =
true;
204 if (free_depsgraph) {
233 C, op, 270,
IFACE_(
"Calculate Paths for the Selected Bones"),
IFACE_(
"Calculate"));
289 ot->name =
"Calculate Bone Paths";
290 ot->idname =
"POSE_OT_paths_calculate";
291 ot->description =
"Calculate paths for the selected bones";
320 "Which point on the bones is used when calculating paths");
340 if (
ELEM(
nullptr, ob, scene)) {
364 ot->name =
"Update Bone Paths";
365 ot->idname =
"POSE_OT_paths_update";
366 ot->description =
"Recalculate paths for bones that already have them";
381 bool skipped =
false;
390 if ((only_selected ==
false) || (pchan->flag &
POSE_SELECTED)) {
392 pchan->mpath =
nullptr;
401 if (skipped ==
false) {
435 return TIP_(
"Clear motion paths of selected bones");
437 return TIP_(
"Clear motion paths of all bones");
443 ot->name =
"Clear Bone Paths";
444 ot->idname =
"POSE_OT_paths_clear";
459 "Only clear motion paths of selected bones");
470 if (
ELEM(
nullptr, scene, ob, ob->
pose)) {
488 ot->name =
"Update Range from Scene";
489 ot->idname =
"POSE_OT_paths_range_update";
490 ot->description =
"Update frame range for motion paths from the Scene's current frame range";
537 ot->name =
"Flip Names";
538 ot->idname =
"POSE_OT_flip_names";
539 ot->description =
"Flips (and corrects) the axis suffixes of the names of selected bones";
552 "Try to remove right-most dot-number from flipped names.\n"
553 "Warning: May result in incoherent naming in some cases");
563 Object *ob_prev =
nullptr;
569 if (
bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis])) {
590 {0,
"XAXIS", 0,
"X-Axis",
"Left/Right"},
591 {1,
"YAXIS", 0,
"Y-Axis",
"Front/Back"},
592 {2,
"ZAXIS", 0,
"Z-Axis",
"Top/Bottom"},
593 {0,
nullptr, 0,
nullptr,
nullptr},
597 ot->name =
"Auto-Name by Axis";
598 ot->idname =
"POSE_OT_autoside_names";
600 "Automatically renames the selected bones according to which side of the target axis they "
612 ot->prop =
RNA_def_enum(
ot->srna,
"axis", axis_items, 0,
"Axis",
"Axis to tag names with");
620 Object *prev_ob =
nullptr;
626 pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle, pchan->rotmode,
short(mode));
629 pchan->rotmode = mode;
647 ot->name =
"Set Rotation Mode";
648 ot->idname =
"POSE_OT_rotation_mode_set";
649 ot->description =
"Set the rotation representation used by selected bones";
673 bool changed_multi =
false;
677 for (
Object *ob_iter : objects) {
678 bool changed =
false;
693 changed_multi =
true;
705 ot->name =
"Hide Selected";
706 ot->idname =
"POSE_OT_hide";
707 ot->description =
"Tag selected bones to not be visible in Pose Mode";
726 bool changed_multi =
false;
729 for (
Object *ob_iter : objects) {
732 bool changed =
false;
748 changed_multi =
true;
760 ot->name =
"Reveal Selected";
761 ot->idname =
"POSE_OT_reveal";
762 ot->description =
"Reveal all bones hidden in Pose Mode";
782 bool changed_multi =
false;
787 bool changed =
false;
797 C, scene, ob_iter, pchan, {{
"rotation_quaternion"}},
false);
803 changed_multi =
true;
817 ot->name =
"Flip Quaternions";
818 ot->idname =
"POSE_OT_quaternions_flip";
820 "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).
bool ANIM_bone_in_visible_collection(const bArmature *armature, const Bone *bone)
Functions to insert, delete or modify keyframes.
struct bMotionPath * animviz_verify_motionpaths(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan)
void animviz_free_motionpath(struct bMotionPath *mpath)
#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)
ReportList * CTX_wm_reports(const bContext *C)
#define CTX_DATA_BEGIN(C, Type, instance, member)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
#define FOREACH_OBJECT_IN_MODE_END
#define FOREACH_OBJECT_IN_MODE_BEGIN(_scene, _view_layer, _v3d, _object_type, _object_mode, _instance)
bool BKE_id_is_editable(const Main *bmain, const ID *id)
General operations, lookup, etc. for blender objects.
Object * BKE_object_pose_armature_get(Object *ob)
blender::Vector< Object * > BKE_object_pose_array_get_unique(const Scene *scene, ViewLayer *view_layer, View3D *v3d)
void BKE_report(ReportList *reports, eReportType type, const char *message)
LinkData * BLI_genericNodeN(void *data)
#define LISTBASE_FOREACH(type, var, list)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE void negate_v4(float r[4])
#define STRNCPY_UTF8(dst, src)
Utility defines for timing/benchmarks.
#define TIMEIT_START(var)
#define SET_FLAG_FROM_TEST(value, test, flag)
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_graph_free(Depsgraph *graph)
@ 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
bool ED_operator_posemode_local(bContext *C)
bool ED_operator_posemode_exclusive(bContext *C)
bool ED_operator_posemode(bContext *C)
Depsgraph * animviz_depsgraph_build(Main *bmain, Scene *scene, ViewLayer *view_layer, blender::Span< MPathTarget * > targets)
void animviz_free_motionpath_targets(blender::Vector< MPathTarget * > &targets)
void animviz_motionpath_compute_range(Object *ob, Scene *scene)
void animviz_calc_motionpaths(Depsgraph *depsgraph, Main *bmain, Scene *scene, blender::MutableSpan< MPathTarget * > targets, eAnimvizCalcRange range, bool restore)
void animviz_build_motionpath_targets(Object *ob, blender::Vector< MPathTarget * > &r_targets)
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)
BPy_StructRNA * depsgraph
DEG_id_tag_update_ex(cb_data->bmain, cb_data->owner_id, ID_RECALC_TAG_FOR_UNDO|ID_RECALC_SYNC_TO_EVAL)
void autokeyframe_pose_channel(bContext *C, Scene *scene, Object *ob, bPoseChannel *pose_channel, Span< RNAPath > rna_paths, short targetless_ik)
Object * context_active_object(const bContext *C)
void POSE_OT_hide(wmOperatorType *ot)
void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob, ePosePathCalcRange range)
bool ED_object_posemode_enter_ex(Main *bmain, Object *ob)
static wmOperatorStatus pose_bone_rotmode_exec(bContext *C, wmOperator *op)
static wmOperatorStatus pose_update_paths_range_exec(bContext *C, wmOperator *)
void POSE_OT_paths_range_update(wmOperatorType *ot)
static wmOperatorStatus pose_reveal_exec(bContext *C, wmOperator *op)
void POSE_OT_quaternions_flip(wmOperatorType *ot)
void POSE_OT_paths_update(wmOperatorType *ot)
bool ED_object_posemode_enter(bContext *C, Object *ob)
static wmOperatorStatus pose_flip_names_exec(bContext *C, wmOperator *op)
static wmOperatorStatus pose_clear_paths_exec(bContext *C, wmOperator *op)
Object * ED_pose_object_from_context(bContext *C)
static wmOperatorStatus pose_hide_exec(bContext *C, wmOperator *op)
void POSE_OT_reveal(wmOperatorType *ot)
static eAnimvizCalcRange pose_path_convert_range(ePosePathCalcRange range)
static wmOperatorStatus pose_calculate_paths_exec(bContext *C, wmOperator *op)
void POSE_OT_flip_names(wmOperatorType *ot)
void POSE_OT_paths_clear(wmOperatorType *ot)
static void pose_clear_paths(Object *ob, bool only_selected)
static std::string pose_clear_paths_get_description(bContext *, wmOperatorType *, PointerRNA *ptr)
static wmOperatorStatus pose_autoside_names_exec(bContext *C, wmOperator *op)
void POSE_OT_autoside_names(wmOperatorType *ot)
void POSE_OT_paths_calculate(wmOperatorType *ot)
void POSE_OT_rotation_mode_set(wmOperatorType *ot)
static wmOperatorStatus pose_calculate_paths_invoke(bContext *C, wmOperator *op, const wmEvent *)
bool ED_object_posemode_exit_ex(Main *bmain, Object *ob)
static wmOperatorStatus pose_flip_quats_exec(bContext *C, wmOperator *)
static wmOperatorStatus pose_update_paths_exec(bContext *C, wmOperator *op)
static bool pose_update_paths_poll(bContext *C)
bool ED_object_posemode_exit(bContext *C, Object *ob)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
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_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
const EnumPropertyItem rna_enum_object_rotation_mode_items[]
struct ReportList * reports
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
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)
wmOperatorStatus WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *)