33#include "RNA_prototypes.hh"
162 bool free_depsgraph =
false;
180 free_depsgraph =
false;
184 free_depsgraph =
true;
203 if (free_depsgraph) {
232 C, op, 270,
IFACE_(
"Calculate Paths for the Selected Bones"),
IFACE_(
"Calculate"));
288 ot->name =
"Calculate Bone Paths";
289 ot->idname =
"POSE_OT_paths_calculate";
290 ot->description =
"Calculate paths for the selected bones";
319 "Which point on the bones is used when calculating paths");
339 if (
ELEM(
nullptr, ob, scene)) {
363 ot->name =
"Update Bone Paths";
364 ot->idname =
"POSE_OT_paths_update";
365 ot->description =
"Recalculate paths for bones that already have them";
380 bool skipped =
false;
389 if ((only_selected ==
false) || ((pchan->bone) && (pchan->bone->flag &
BONE_SELECTED))) {
391 pchan->mpath =
nullptr;
400 if (skipped ==
false) {
434 return TIP_(
"Clear motion paths of selected bones");
436 return TIP_(
"Clear motion paths of all bones");
442 ot->name =
"Clear Bone Paths";
443 ot->idname =
"POSE_OT_paths_clear";
458 "Only clear motion paths of selected bones");
469 if (
ELEM(
nullptr, scene, ob, ob->
pose)) {
487 ot->name =
"Update Range from Scene";
488 ot->idname =
"POSE_OT_paths_range_update";
489 ot->description =
"Update frame range for motion paths from the Scene's current frame range";
536 ot->name =
"Flip Names";
537 ot->idname =
"POSE_OT_flip_names";
538 ot->description =
"Flips (and corrects) the axis suffixes of the names of selected bones";
551 "Try to remove right-most dot-number from flipped names.\n"
552 "Warning: May result in incoherent naming in some cases");
562 Object *ob_prev =
nullptr;
568 if (
bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis])) {
589 {0,
"XAXIS", 0,
"X-Axis",
"Left/Right"},
590 {1,
"YAXIS", 0,
"Y-Axis",
"Front/Back"},
591 {2,
"ZAXIS", 0,
"Z-Axis",
"Top/Bottom"},
592 {0,
nullptr, 0,
nullptr,
nullptr},
596 ot->name =
"Auto-Name by Axis";
597 ot->idname =
"POSE_OT_autoside_names";
599 "Automatically renames the selected bones according to which side of the target axis they "
611 ot->prop =
RNA_def_enum(
ot->srna,
"axis", axis_items, 0,
"Axis",
"Axis to tag names with");
619 Object *prev_ob =
nullptr;
625 pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle, pchan->rotmode,
short(mode));
628 pchan->rotmode = mode;
646 ot->name =
"Set Rotation Mode";
647 ot->idname =
"POSE_OT_rotation_mode_set";
648 ot->description =
"Set the rotation representation used by selected bones";
688 bool changed_multi =
false;
693 for (
Object *ob_iter : objects) {
701 changed_multi =
true;
713 ot->name =
"Hide Selected";
714 ot->idname =
"POSE_OT_hide";
715 ot->description =
"Tag selected bones to not be visible in Pose Mode";
753 bool changed_multi =
false;
757 for (
Object *ob_iter : objects) {
763 changed_multi =
true;
775 ot->name =
"Reveal Selected";
776 ot->idname =
"POSE_OT_reveal";
777 ot->description =
"Reveal all bones hidden in Pose Mode";
797 bool changed_multi =
false;
802 bool changed =
false;
812 C, scene, ob_iter, pchan, {{
"rotation_quaternion"}},
false);
818 changed_multi =
true;
832 ot->name =
"Flip Quaternions";
833 ot->idname =
"POSE_OT_quaternions_flip";
835 "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])
char * STRNCPY(char(&dst)[N], const char *src)
Utility defines for timing/benchmarks.
#define TIMEIT_START(var)
#define POINTER_FROM_INT(i)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define POINTER_AS_INT(i)
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)
int bone_looper(Object *ob, Bone *bone, void *data, int(*bone_func)(Object *, 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)
BMesh const char void * data
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 int show_pose_bone_cb(Object *ob, Bone *bone, void *data)
static wmOperatorStatus pose_hide_exec(bContext *C, wmOperator *op)
void POSE_OT_reveal(wmOperatorType *ot)
static eAnimvizCalcRange pose_path_convert_range(ePosePathCalcRange range)
static int hide_pose_bone_fn(Object *ob, Bone *bone, void *ptr)
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)
wmOperatorStatus WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *)