Blender V4.5
pose_edit.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9
10#include "BLI_listbase.h"
11#include "BLI_math_vector.h"
12#include "BLI_string.h"
13
14#include "BLT_translation.hh"
15
16#include "DNA_armature_types.h"
17#include "DNA_object_types.h"
18#include "DNA_scene_types.h"
19
21#include "BKE_armature.hh"
22#include "BKE_context.hh"
23#include "BKE_layer.hh"
24#include "BKE_lib_id.hh"
25#include "BKE_object.hh"
26#include "BKE_report.hh"
27
28#include "DEG_depsgraph.hh"
29
30#include "RNA_access.hh"
31#include "RNA_define.hh"
32#include "RNA_enum_types.hh"
33#include "RNA_prototypes.hh"
34
35#include "WM_api.hh"
36#include "WM_types.hh"
37
38#include "ED_anim_api.hh"
39#include "ED_armature.hh"
40#include "ED_keyframing.hh"
41#include "ED_object.hh"
42#include "ED_screen.hh"
43
44#include "ANIM_armature.hh"
46#include "ANIM_keyframing.hh"
47
48#include "armature_intern.hh"
49
50#undef DEBUG_TIME
51
52#ifdef DEBUG_TIME
53# include "BLI_time_utildefines.h"
54#endif
55
56using blender::Vector;
57
59{
60 /* NOTE: matches logic with #ED_operator_posemode_context(). */
61
62 ScrArea *area = CTX_wm_area(C);
63 Object *ob;
64
65 /* Since this call may also be used from the buttons window,
66 * we need to check for where to get the object. */
67 if (area && area->spacetype == SPACE_PROPERTIES) {
69 }
70 else {
72 }
73
74 return ob;
75}
76
78{
79 BLI_assert(BKE_id_is_editable(bmain, &ob->id));
80 bool ok = false;
81
82 switch (ob->type) {
83 case OB_ARMATURE:
84 ob->restore_mode = ob->mode;
85 ob->mode |= OB_MODE_POSE;
86 /* Inform all evaluated versions that we changed the mode. */
88 ok = true;
89
90 break;
91 default:
92 break;
93 }
94
95 return ok;
96}
98{
100 Main *bmain = CTX_data_main(C);
101 if (!BKE_id_is_editable(bmain, &ob->id)) {
102 BKE_report(reports, RPT_WARNING, "Cannot pose libdata");
103 return false;
104 }
105 bool ok = ED_object_posemode_enter_ex(bmain, ob);
106 if (ok) {
108 }
109 return ok;
110}
111
113{
114 bool ok = false;
115 if (ob) {
116 ob->restore_mode = ob->mode;
117 ob->mode &= ~OB_MODE_POSE;
118
119 /* Inform all evaluated versions that we changed the mode. */
121 ok = true;
122 }
123 return ok;
124}
126{
127 Main *bmain = CTX_data_main(C);
128 bool ok = ED_object_posemode_exit_ex(bmain, ob);
129 if (ok) {
131 }
132 return ok;
133}
134
135/* ********************************************** */
136/* Motion Paths */
137
150
152{
153 /* Transform doesn't always have context available to do update. */
154 if (C == nullptr) {
155 return;
156 }
157
158 Main *bmain = CTX_data_main(C);
159 ViewLayer *view_layer = CTX_data_view_layer(C);
160
161 Depsgraph *depsgraph;
162 bool free_depsgraph = false;
163
165 /* set flag to force recalc, then grab the relevant bones to target */
168
169/* recalculate paths, then free */
170#ifdef DEBUG_TIME
171 TIMEIT_START(pose_path_calc);
172#endif
173
174 /* For a single frame update it's faster to re-use existing dependency graph and avoid overhead
175 * of building all the relations and so on for a temporary one. */
177 /* NOTE: Dependency graph will be evaluated at all the frames, but we first need to access some
178 * nested pointers, like animation data. */
180 free_depsgraph = false;
181 }
182 else {
183 depsgraph = animviz_depsgraph_build(bmain, scene, view_layer, targets);
184 free_depsgraph = true;
185 }
186
188 depsgraph, bmain, scene, targets, pose_path_convert_range(range), !free_depsgraph);
189
190#ifdef DEBUG_TIME
191 TIMEIT_END(pose_path_calc);
192#endif
193
195
197 /* Tag armature object for copy-on-eval - so paths will draw/redraw.
198 * For currently frame only we update evaluated object directly. */
200 }
201
202 /* Free temporary depsgraph. */
203 if (free_depsgraph) {
205 }
206}
207
208/* show popup to determine settings */
210 wmOperator *op,
211 const wmEvent * /*event*/)
212{
214
215 if (ELEM(nullptr, ob, ob->pose)) {
216 return OPERATOR_CANCELLED;
217 }
218
219 /* set default settings from existing/stored settings */
220 {
221 bAnimVizSettings *avs = &ob->pose->avs;
222
223 PointerRNA avs_ptr = RNA_pointer_create_discrete(nullptr, &RNA_AnimVizMotionPaths, avs);
224 RNA_enum_set(op->ptr, "display_type", RNA_enum_get(&avs_ptr, "type"));
225 RNA_enum_set(op->ptr, "range", RNA_enum_get(&avs_ptr, "range"));
226 RNA_enum_set(op->ptr, "bake_location", RNA_enum_get(&avs_ptr, "bake_location"));
227 }
228
229 /* show popup dialog to allow editing of range... */
230 /* FIXME: hard-coded dimensions here are just arbitrary. */
232 C, op, 270, IFACE_("Calculate Paths for the Selected Bones"), IFACE_("Calculate"));
233}
234
240{
242 Scene *scene = CTX_data_scene(C);
243
244 if (ELEM(nullptr, ob, ob->pose)) {
245 return OPERATOR_CANCELLED;
246 }
247
248 /* grab baking settings from operator settings */
249 {
250 bAnimVizSettings *avs = &ob->pose->avs;
251
252 avs->path_type = RNA_enum_get(op->ptr, "display_type");
253 avs->path_range = RNA_enum_get(op->ptr, "range");
255
256 PointerRNA avs_ptr = RNA_pointer_create_discrete(nullptr, &RNA_AnimVizMotionPaths, avs);
257 RNA_enum_set(&avs_ptr, "bake_location", RNA_enum_get(op->ptr, "bake_location"));
258 }
259
260 /* set up path data for bones being calculated */
261 CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones_from_active_object) {
262 /* verify makes sure that the selected bone has a bone with the appropriate settings */
263 animviz_verify_motionpaths(op->reports, scene, ob, pchan);
264 }
266
267#ifdef DEBUG_TIME
268 TIMEIT_START(recalc_pose_paths);
269#endif
270
271 /* Calculate the bones that now have motion-paths. */
272 /* TODO: only make for the selected bones? */
274
275#ifdef DEBUG_TIME
276 TIMEIT_END(recalc_pose_paths);
277#endif
278
279 /* notifiers for updates */
281
282 return OPERATOR_FINISHED;
283}
284
286{
287 /* identifiers */
288 ot->name = "Calculate Bone Paths";
289 ot->idname = "POSE_OT_paths_calculate";
290 ot->description = "Calculate paths for the selected bones";
291
292 /* API callbacks. */
296
297 /* flags */
299
300 /* properties */
301 RNA_def_enum(ot->srna,
302 "display_type",
305 "Display type",
306 "");
307 RNA_def_enum(ot->srna,
308 "range",
311 "Computation Range",
312 "");
313
314 RNA_def_enum(ot->srna,
315 "bake_location",
318 "Bake Location",
319 "Which point on the bones is used when calculating paths");
320}
321
322/* --------- */
323
325{
328 return (ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS) != 0;
329 }
330
331 return false;
332}
333
335{
337 Scene *scene = CTX_data_scene(C);
338
339 if (ELEM(nullptr, ob, scene)) {
340 return OPERATOR_CANCELLED;
341 }
343
344 /* set up path data for bones being calculated */
345 CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones_from_active_object) {
346 animviz_verify_motionpaths(op->reports, scene, ob, pchan);
347 }
349
350 /* Calculate the bones that now have motion-paths. */
351 /* TODO: only make for the selected bones? */
353
354 /* notifiers for updates */
356
357 return OPERATOR_FINISHED;
358}
359
361{
362 /* identifiers */
363 ot->name = "Update Bone Paths";
364 ot->idname = "POSE_OT_paths_update";
365 ot->description = "Recalculate paths for bones that already have them";
366
367 /* API callbacks. */
370
371 /* flags */
373}
374
375/* --------- */
376
377/* for the object with pose/action: clear path curves for selected bones only */
378static void pose_clear_paths(Object *ob, bool only_selected)
379{
380 bool skipped = false;
381
382 if (ELEM(nullptr, ob, ob->pose)) {
383 return;
384 }
385
386 /* free the motionpath blocks for all bones - This is easier for users to quickly clear all */
387 LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
388 if (pchan->mpath) {
389 if ((only_selected == false) || ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED))) {
390 animviz_free_motionpath(pchan->mpath);
391 pchan->mpath = nullptr;
392 }
393 else {
394 skipped = true;
395 }
396 }
397 }
398
399 /* if nothing was skipped, there should be no paths left! */
400 if (skipped == false) {
402 }
403
404 /* tag armature object for copy-on-eval - so removed paths don't still show */
406}
407
408/* Operator callback - wrapper for the back-end function. */
410{
412 bool only_selected = RNA_boolean_get(op->ptr, "only_selected");
413
414 /* only continue if there's an object */
415 if (ELEM(nullptr, ob, ob->pose)) {
416 return OPERATOR_CANCELLED;
417 }
418
419 /* use the backend function for this */
420 pose_clear_paths(ob, only_selected);
421
422 /* notifiers for updates */
424
425 return OPERATOR_FINISHED;
426}
427
429 wmOperatorType * /*ot*/,
431{
432 const bool only_selected = RNA_boolean_get(ptr, "only_selected");
433 if (only_selected) {
434 return TIP_("Clear motion paths of selected bones");
435 }
436 return TIP_("Clear motion paths of all bones");
437}
438
440{
441 /* identifiers */
442 ot->name = "Clear Bone Paths";
443 ot->idname = "POSE_OT_paths_clear";
444
445 /* API callbacks. */
448 ot->get_description = pose_clear_paths_get_description;
449
450 /* flags */
452
453 /* properties */
454 ot->prop = RNA_def_boolean(ot->srna,
455 "only_selected",
456 false,
457 "Only Selected",
458 "Only clear motion paths of selected bones");
460}
461
462/* --------- */
463
465{
466 Scene *scene = CTX_data_scene(C);
468
469 if (ELEM(nullptr, scene, ob, ob->pose)) {
470 return OPERATOR_CANCELLED;
471 }
472
473 /* use Preview Range or Full Frame Range - whichever is in use */
474 ob->pose->avs.path_sf = PSFRA;
475 ob->pose->avs.path_ef = PEFRA;
476
477 /* tag for updates */
480
481 return OPERATOR_FINISHED;
482}
483
485{
486 /* identifiers */
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";
490
491 /* callbacks */
494
495 /* flags */
497}
498
499/* ********************************************** */
500
502{
503 Main *bmain = CTX_data_main(C);
504 const Scene *scene = CTX_data_scene(C);
505 ViewLayer *view_layer = CTX_data_view_layer(C);
506 View3D *v3d = CTX_wm_view3d(C);
507 const bool do_strip_numbers = RNA_boolean_get(op->ptr, "do_strip_numbers");
508
509 FOREACH_OBJECT_IN_MODE_BEGIN (scene, view_layer, v3d, OB_ARMATURE, OB_MODE_POSE, ob) {
510 bArmature *arm = static_cast<bArmature *>(ob->data);
511 ListBase bones_names = {nullptr};
512
514 BLI_addtail(&bones_names, BLI_genericNodeN(pchan->name));
515 }
517
518 ED_armature_bones_flip_names(bmain, arm, &bones_names, do_strip_numbers);
519
520 BLI_freelistN(&bones_names);
521
522 /* since we renamed stuff... */
524
525 /* NOTE: notifier might evolve. */
527 }
529
530 return OPERATOR_FINISHED;
531}
532
534{
535 /* identifiers */
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";
539
540 /* API callbacks. */
541 ot->exec = pose_flip_names_exec;
543
544 /* flags */
546
547 RNA_def_boolean(ot->srna,
548 "do_strip_numbers",
549 false,
550 "Strip Numbers",
551 "Try to remove right-most dot-number from flipped names.\n"
552 "Warning: May result in incoherent naming in some cases");
553}
554
555/* ------------------ */
556
558{
559 Main *bmain = CTX_data_main(C);
560 char newname[MAXBONENAME];
561 short axis = RNA_enum_get(op->ptr, "axis");
562 Object *ob_prev = nullptr;
563
564 /* loop through selected bones, auto-naming them */
565 CTX_DATA_BEGIN_WITH_ID (C, bPoseChannel *, pchan, selected_pose_bones, Object *, ob) {
566 bArmature *arm = static_cast<bArmature *>(ob->data);
567 STRNCPY(newname, pchan->name);
568 if (bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis])) {
569 ED_armature_bone_rename(bmain, arm, pchan->name, newname);
570 }
571
572 if (ob_prev != ob) {
573 /* since we renamed stuff... */
575
576 /* NOTE: notifier might evolve. */
578 ob_prev = ob;
579 }
580 }
582
583 return OPERATOR_FINISHED;
584}
585
587{
588 static const EnumPropertyItem axis_items[] = {
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},
593 };
594
595 /* identifiers */
596 ot->name = "Auto-Name by Axis";
597 ot->idname = "POSE_OT_autoside_names";
598 ot->description =
599 "Automatically renames the selected bones according to which side of the target axis they "
600 "fall on";
601
602 /* API callbacks. */
603 ot->invoke = WM_menu_invoke;
605 ot->poll = ED_operator_posemode;
606
607 /* flags */
609
610 /* settings */
611 ot->prop = RNA_def_enum(ot->srna, "axis", axis_items, 0, "Axis", "Axis to tag names with");
612}
613
614/* ********************************************** */
615
617{
618 const int mode = RNA_enum_get(op->ptr, "type");
619 Object *prev_ob = nullptr;
620
621 /* Set rotation mode of selected bones. */
622 CTX_DATA_BEGIN_WITH_ID (C, bPoseChannel *, pchan, selected_pose_bones, Object *, ob) {
623 /* use API Method for conversions... */
625 pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle, pchan->rotmode, short(mode));
626
627 /* finally, set the new rotation type */
628 pchan->rotmode = mode;
629
630 if (prev_ob != ob) {
631 /* Notifiers and updates. */
632 DEG_id_tag_update(reinterpret_cast<ID *>(ob), ID_RECALC_GEOMETRY);
635 prev_ob = ob;
636 }
637 }
639
640 return OPERATOR_FINISHED;
641}
642
644{
645 /* identifiers */
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";
649
650 /* callbacks */
651 ot->invoke = WM_menu_invoke;
653 ot->poll = ED_operator_posemode;
654
655 /* flags */
657
658 /* properties */
659 ot->prop = RNA_def_enum(
660 ot->srna, "type", rna_enum_object_rotation_mode_items, 0, "Rotation Mode", "");
661}
662
663/* ********************************************** */
664/* Show/Hide Bones */
665
666static int hide_pose_bone_fn(Object *ob, Bone *bone, void *ptr)
667{
668 bArmature *arm = static_cast<bArmature *>(ob->data);
669 const bool hide_select = bool(POINTER_AS_INT(ptr));
670 int count = 0;
671 if (ANIM_bone_in_visible_collection(arm, bone)) {
672 if (((bone->flag & BONE_SELECTED) != 0) == hide_select) {
673 bone->flag |= BONE_HIDDEN_P;
674 /* only needed when 'hide_select' is true, but harmless. */
675 bone->flag &= ~BONE_SELECTED;
676 count += 1;
677 }
678 }
679 return count;
680}
681
682/* active object is armature in posemode, poll checked */
684{
685 const Scene *scene = CTX_data_scene(C);
686 ViewLayer *view_layer = CTX_data_view_layer(C);
688 bool changed_multi = false;
689
690 const int hide_select = !RNA_boolean_get(op->ptr, "unselected");
691 void *hide_select_p = POINTER_FROM_INT(hide_select);
692
693 for (Object *ob_iter : objects) {
694 bArmature *arm = static_cast<bArmature *>(ob_iter->data);
695
696 bool changed = bone_looper(ob_iter,
697 static_cast<Bone *>(arm->bonebase.first),
698 hide_select_p,
699 hide_pose_bone_fn) != 0;
700 if (changed) {
701 changed_multi = true;
704 }
705 }
706
707 return changed_multi ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
708}
709
711{
712 /* identifiers */
713 ot->name = "Hide Selected";
714 ot->idname = "POSE_OT_hide";
715 ot->description = "Tag selected bones to not be visible in Pose Mode";
716
717 /* API callbacks. */
718 ot->exec = pose_hide_exec;
719 ot->poll = ED_operator_posemode;
720
721 /* flags */
723
724 /* props */
725 RNA_def_boolean(ot->srna, "unselected", false, "Unselected", "");
726}
727
728static int show_pose_bone_cb(Object *ob, Bone *bone, void *data)
729{
730 const bool select = POINTER_AS_INT(data);
731
732 bArmature *arm = static_cast<bArmature *>(ob->data);
733 int count = 0;
734 if (ANIM_bone_in_visible_collection(arm, bone)) {
735 if (bone->flag & BONE_HIDDEN_P) {
736 if (!(bone->flag & BONE_UNSELECTABLE)) {
738 }
739 bone->flag &= ~BONE_HIDDEN_P;
740 count += 1;
741 }
742 }
743
744 return count;
745}
746
747/* active object is armature in posemode, poll checked */
749{
750 const Scene *scene = CTX_data_scene(C);
751 ViewLayer *view_layer = CTX_data_view_layer(C);
753 bool changed_multi = false;
754 const bool select = RNA_boolean_get(op->ptr, "select");
755 void *select_p = POINTER_FROM_INT(select);
756
757 for (Object *ob_iter : objects) {
758 bArmature *arm = static_cast<bArmature *>(ob_iter->data);
759
760 bool changed = bone_looper(
761 ob_iter, static_cast<Bone *>(arm->bonebase.first), select_p, show_pose_bone_cb);
762 if (changed) {
763 changed_multi = true;
766 }
767 }
768
769 return changed_multi ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
770}
771
773{
774 /* identifiers */
775 ot->name = "Reveal Selected";
776 ot->idname = "POSE_OT_reveal";
777 ot->description = "Reveal all bones hidden in Pose Mode";
778
779 /* API callbacks. */
780 ot->exec = pose_reveal_exec;
781 ot->poll = ED_operator_posemode;
782
783 /* flags */
785
786 RNA_def_boolean(ot->srna, "select", true, "Select", "");
787}
788
789/* -------------------------------------------------------------------- */
792
794{
795 Scene *scene = CTX_data_scene(C);
796
797 bool changed_multi = false;
798
799 ViewLayer *view_layer = CTX_data_view_layer(C);
800 View3D *v3d = CTX_wm_view3d(C);
801 FOREACH_OBJECT_IN_MODE_BEGIN (scene, view_layer, v3d, OB_ARMATURE, OB_MODE_POSE, ob_iter) {
802 bool changed = false;
803 /* loop through all selected pchans, flipping and keying (as needed) */
805 /* only if bone is using quaternion rotation */
806 if (pchan->rotmode == ROT_MODE_QUAT) {
807 changed = true;
808 /* quaternions have 720 degree range */
809 negate_v4(pchan->quat);
810
812 C, scene, ob_iter, pchan, {{"rotation_quaternion"}}, false);
813 }
814 }
816
817 if (changed) {
818 changed_multi = true;
819 /* notifiers and updates */
822 }
823 }
825
826 return changed_multi ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
827}
828
830{
831 /* identifiers */
832 ot->name = "Flip Quaternions";
833 ot->idname = "POSE_OT_quaternions_flip";
834 ot->description =
835 "Flip quaternion values to achieve desired rotations, while maintaining the same "
836 "orientations";
837
838 /* callbacks */
839 ot->exec = pose_flip_quats_exec;
840 ot->poll = ED_operator_posemode;
841
842 /* flags */
844}
845
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)
Definition armature.cc:2414
#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)
#define CTX_DATA_END
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
#define FOREACH_OBJECT_IN_MODE_END
Definition BKE_layer.hh:382
#define FOREACH_OBJECT_IN_MODE_BEGIN(_scene, _view_layer, _v3d, _object_type, _object_mode, _instance)
Definition BKE_layer.hh:377
bool BKE_id_is_editable(const Main *bmain, const ID *id)
Definition lib_id.cc:2503
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)
Definition report.cc:126
#define BLI_assert(a)
Definition BLI_assert.h:46
LinkData * BLI_genericNodeN(void *data)
Definition listbase.cc:922
#define LISTBASE_FOREACH(type, var, list)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
Definition listbase.cc:497
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:111
MINLINE void negate_v4(float r[4])
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:688
Utility defines for timing/benchmarks.
#define TIMEIT_START(var)
#define TIMEIT_END(var)
#define POINTER_FROM_INT(i)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define POINTER_AS_INT(i)
#define ELEM(...)
#define TIP_(msgid)
#define IFACE_(msgid)
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_graph_free(Depsgraph *graph)
Definition depsgraph.cc:306
@ ID_RECALC_PARAMETERS
Definition DNA_ID.h:1046
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1026
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:982
@ MOTIONPATH_BAKE_HEADS
@ MOTIONPATH_BAKE_HAS_PATHS
@ MOTIONPATH_TYPE_RANGE
@ ROT_MODE_QUAT
@ MOTIONPATH_RANGE_SCENE
@ ANIMVIZ_RECALC_PATHS
#define MAXBONENAME
@ BONE_SELECTED
@ BONE_UNSELECTABLE
@ BONE_HIDDEN_P
@ OB_MODE_POSE
Object is a sort of wrapper for general info.
@ OB_ARMATURE
#define PSFRA
#define PEFRA
@ SPACE_PROPERTIES
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
eAnimvizCalcRange
@ ANIMVIZ_CALC_RANGE_FULL
@ ANIMVIZ_CALC_RANGE_CURRENT_FRAME
@ ANIMVIZ_CALC_RANGE_CHANGED
ePosePathCalcRange
@ 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)
@ PROP_SKIP_SAVE
Definition RNA_types.hh:330
#define C
Definition RandGen.cpp:29
@ OPTYPE_UNDO
Definition WM_types.hh:182
@ OPTYPE_REGISTER
Definition WM_types.hh:180
#define ND_MODE
Definition WM_types.hh:442
#define NC_SCENE
Definition WM_types.hh:375
#define ND_POSE
Definition WM_types.hh:455
#define NS_MODE_OBJECT
Definition WM_types.hh:557
ReportList * reports
Definition WM_types.hh:1025
#define ND_TRANSFORM
Definition WM_types.hh:453
#define NS_MODE_POSE
Definition WM_types.hh:566
#define ND_BONE_SELECT
Definition WM_types.hh:457
#define NC_OBJECT
Definition WM_types.hh:376
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
#define select(A, B, C)
int count
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)
Definition pose_edit.cc:710
void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob, ePosePathCalcRange range)
Definition pose_edit.cc:151
bool ED_object_posemode_enter_ex(Main *bmain, Object *ob)
Definition pose_edit.cc:77
static wmOperatorStatus pose_bone_rotmode_exec(bContext *C, wmOperator *op)
Definition pose_edit.cc:616
static wmOperatorStatus pose_update_paths_range_exec(bContext *C, wmOperator *)
Definition pose_edit.cc:464
void POSE_OT_paths_range_update(wmOperatorType *ot)
Definition pose_edit.cc:484
static wmOperatorStatus pose_reveal_exec(bContext *C, wmOperator *op)
Definition pose_edit.cc:748
void POSE_OT_quaternions_flip(wmOperatorType *ot)
Definition pose_edit.cc:829
void POSE_OT_paths_update(wmOperatorType *ot)
Definition pose_edit.cc:360
bool ED_object_posemode_enter(bContext *C, Object *ob)
Definition pose_edit.cc:97
static wmOperatorStatus pose_flip_names_exec(bContext *C, wmOperator *op)
Definition pose_edit.cc:501
static wmOperatorStatus pose_clear_paths_exec(bContext *C, wmOperator *op)
Definition pose_edit.cc:409
Object * ED_pose_object_from_context(bContext *C)
Definition pose_edit.cc:58
static int show_pose_bone_cb(Object *ob, Bone *bone, void *data)
Definition pose_edit.cc:728
static wmOperatorStatus pose_hide_exec(bContext *C, wmOperator *op)
Definition pose_edit.cc:683
void POSE_OT_reveal(wmOperatorType *ot)
Definition pose_edit.cc:772
static eAnimvizCalcRange pose_path_convert_range(ePosePathCalcRange range)
Definition pose_edit.cc:138
static int hide_pose_bone_fn(Object *ob, Bone *bone, void *ptr)
Definition pose_edit.cc:666
static wmOperatorStatus pose_calculate_paths_exec(bContext *C, wmOperator *op)
Definition pose_edit.cc:239
void POSE_OT_flip_names(wmOperatorType *ot)
Definition pose_edit.cc:533
void POSE_OT_paths_clear(wmOperatorType *ot)
Definition pose_edit.cc:439
static void pose_clear_paths(Object *ob, bool only_selected)
Definition pose_edit.cc:378
static std::string pose_clear_paths_get_description(bContext *, wmOperatorType *, PointerRNA *ptr)
Definition pose_edit.cc:428
static wmOperatorStatus pose_autoside_names_exec(bContext *C, wmOperator *op)
Definition pose_edit.cc:557
void POSE_OT_autoside_names(wmOperatorType *ot)
Definition pose_edit.cc:586
void POSE_OT_paths_calculate(wmOperatorType *ot)
Definition pose_edit.cc:285
void POSE_OT_rotation_mode_set(wmOperatorType *ot)
Definition pose_edit.cc:643
static wmOperatorStatus pose_calculate_paths_invoke(bContext *C, wmOperator *op, const wmEvent *)
Definition pose_edit.cc:209
bool ED_object_posemode_exit_ex(Main *bmain, Object *ob)
Definition pose_edit.cc:112
static wmOperatorStatus pose_flip_quats_exec(bContext *C, wmOperator *)
Definition pose_edit.cc:793
static wmOperatorStatus pose_update_paths_exec(bContext *C, wmOperator *op)
Definition pose_edit.cc:334
static bool pose_update_paths_poll(bContext *C)
Definition pose_edit.cc:324
bool ED_object_posemode_exit(bContext *C, Object *ob)
Definition pose_edit.cc:125
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[]
Definition DNA_ID.h:404
void * first
struct bPose * pose
ListBase chanbase
bAnimVizSettings avs
struct ReportList * reports
struct PointerRNA * ptr
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4226
wmOperatorType * ot
Definition wm_files.cc:4225
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 *)