35#include "RNA_prototypes.hh"
118 ob->
mode &= ~OB_MODE_POSE;
163 bool free_depsgraph =
false;
165 ListBase targets = {
nullptr,
nullptr};
181 free_depsgraph =
false;
185 free_depsgraph =
true;
204 if (free_depsgraph) {
231 C, op, 270,
IFACE_(
"Calculate Paths for the Selected Bones"),
IFACE_(
"Calculate"));
287 ot->
name =
"Calculate Bone Paths";
288 ot->
idname =
"POSE_OT_paths_calculate";
318 "Which point on the bones is used when calculating paths");
338 if (
ELEM(
nullptr, ob, scene)) {
362 ot->
name =
"Update Bone Paths";
363 ot->
idname =
"POSE_OT_paths_update";
364 ot->
description =
"Recalculate paths for bones that already have them";
379 bool skipped =
false;
388 if ((only_selected ==
false) || ((pchan->bone) && (pchan->bone->flag &
BONE_SELECTED))) {
390 pchan->mpath =
nullptr;
399 if (skipped ==
false) {
433 return TIP_(
"Clear motion paths of selected bones");
435 return TIP_(
"Clear motion paths of all bones");
441 ot->
name =
"Clear Bone Paths";
457 "Only clear motion paths of selected bones");
468 if (
ELEM(
nullptr, scene, ob, ob->
pose)) {
486 ot->
name =
"Update Range from Scene";
487 ot->
idname =
"POSE_OT_paths_range_update";
488 ot->
description =
"Update frame range for motion paths from the Scene's current frame range";
537 ot->
description =
"Flips (and corrects) the axis suffixes of the names of selected bones";
550 "Try to remove right-most dot-number from flipped names.\n"
551 "Warning: May result in incoherent naming in some cases");
561 Object *ob_prev =
nullptr;
567 if (
bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis])) {
588 {0,
"XAXIS", 0,
"X-Axis",
"Left/Right"},
589 {1,
"YAXIS", 0,
"Y-Axis",
"Front/Back"},
590 {2,
"ZAXIS", 0,
"Z-Axis",
"Top/Bottom"},
591 {0,
nullptr, 0,
nullptr,
nullptr},
595 ot->
name =
"Auto-Name by Axis";
596 ot->
idname =
"POSE_OT_autoside_names";
598 "Automatically renames the selected bones according to which side of the target axis they "
618 Object *prev_ob =
nullptr;
624 pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle, pchan->rotmode,
short(mode));
627 pchan->rotmode = mode;
645 ot->
name =
"Set Rotation Mode";
646 ot->
idname =
"POSE_OT_rotation_mode_set";
647 ot->
description =
"Set the rotation representation used by selected bones";
674 bone->
flag &= ~BONE_SELECTED;
687 bool changed_multi =
false;
692 for (
Object *ob_iter : objects) {
700 changed_multi =
true;
712 ot->
name =
"Hide Selected";
714 ot->
description =
"Tag selected bones to not be visible in Pose Mode";
738 bone->
flag &= ~BONE_HIDDEN_P;
752 bool changed_multi =
false;
756 for (
Object *ob_iter : objects) {
762 changed_multi =
true;
774 ot->
name =
"Reveal Selected";
796 bool changed_multi =
false;
801 bool changed =
false;
811 C, scene, ob_iter, pchan, {{
"rotation_quaternion"}},
false);
817 changed_multi =
true;
831 ot->
name =
"Flip Quaternions";
832 ot->
idname =
"POSE_OT_quaternions_flip";
834 "Flip quaternion values to achieve desired rotations, while maintaining the same "
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)
#define LISTBASE_FOREACH(type, var, list)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
struct LinkData * BLI_genericNodeN(void *data)
MINLINE void negate_v4(float r[4])
#define STRNCPY(dst, 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_id_tag_update_ex(Main *bmain, 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)
Read Guarded memory(de)allocation.
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)
void animviz_motionpath_compute_range(Object *ob, Scene *scene)
Depsgraph * animviz_depsgraph_build(Main *bmain, Scene *scene, ViewLayer *view_layer, ListBase *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)
const Depsgraph * depsgraph
ccl_device_inline float4 select(const int4 mask, const float4 a, const float4 b)
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)
static int pose_clear_paths_exec(bContext *C, wmOperator *op)
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 int pose_update_paths_range_exec(bContext *C, wmOperator *)
void POSE_OT_paths_range_update(wmOperatorType *ot)
static int pose_update_paths_exec(bContext *C, wmOperator *op)
static int pose_autoside_names_exec(bContext *C, wmOperator *op)
void POSE_OT_quaternions_flip(wmOperatorType *ot)
static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, const wmEvent *)
void POSE_OT_paths_update(wmOperatorType *ot)
bool ED_object_posemode_enter(bContext *C, Object *ob)
Object * ED_pose_object_from_context(bContext *C)
static void ED_pose_clear_paths(Object *ob, bool only_selected)
static int show_pose_bone_cb(Object *ob, Bone *bone, void *data)
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 int pose_flip_quats_exec(bContext *C, wmOperator *)
void POSE_OT_flip_names(wmOperatorType *ot)
void POSE_OT_paths_clear(wmOperatorType *ot)
static int pose_reveal_exec(bContext *C, wmOperator *op)
static std::string pose_clear_paths_get_description(bContext *, wmOperatorType *, PointerRNA *ptr)
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)
void POSE_OT_rotation_mode_set(wmOperatorType *ot)
bool ED_object_posemode_exit_ex(Main *bmain, Object *ob)
static int pose_bone_rotmode_exec(bContext *C, wmOperator *op)
static int pose_hide_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(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[]
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
std::string(* get_description)(bContext *C, wmOperatorType *ot, PointerRNA *ptr)
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *)
int 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)