Blender  V2.93
pose_edit.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  * Pose Mode API's and Operators for Pose Mode armatures
19  */
20 
25 #include "MEM_guardedalloc.h"
26 
27 #include "BLI_blenlib.h"
28 #include "BLI_math.h"
29 
30 #include "DNA_anim_types.h"
31 #include "DNA_armature_types.h"
32 #include "DNA_object_types.h"
33 #include "DNA_scene_types.h"
34 
35 #include "BKE_action.h"
36 #include "BKE_anim_visualization.h"
37 #include "BKE_armature.h"
38 #include "BKE_context.h"
39 #include "BKE_deform.h"
40 #include "BKE_global.h"
41 #include "BKE_layer.h"
42 #include "BKE_main.h"
43 #include "BKE_object.h"
44 #include "BKE_report.h"
45 #include "BKE_scene.h"
46 
47 #include "DEG_depsgraph.h"
48 #include "DEG_depsgraph_query.h"
49 
50 #include "RNA_access.h"
51 #include "RNA_define.h"
52 #include "RNA_enum_types.h"
53 
54 #include "WM_api.h"
55 #include "WM_types.h"
56 
57 #include "ED_anim_api.h"
58 #include "ED_armature.h"
59 #include "ED_keyframing.h"
60 #include "ED_object.h"
61 #include "ED_screen.h"
62 #include "ED_view3d.h"
63 
64 #include "UI_interface.h"
65 
66 #include "armature_intern.h"
67 
68 #undef DEBUG_TIME
69 
70 #include "PIL_time.h"
71 #ifdef DEBUG_TIME
72 # include "PIL_time_utildefines.h"
73 #endif
74 
75 /* matches logic with ED_operator_posemode_context() */
77 {
79  Object *ob;
80 
81  /* Since this call may also be used from the buttons window,
82  * we need to check for where to get the object. */
83  if (area && area->spacetype == SPACE_PROPERTIES) {
84  ob = ED_object_context(C);
85  }
86  else {
88  }
89 
90  return ob;
91 }
92 
93 /* This function is used to process the necessary updates for */
94 bool ED_object_posemode_enter_ex(struct Main *bmain, Object *ob)
95 {
97  bool ok = false;
98 
99  switch (ob->type) {
100  case OB_ARMATURE:
101  ob->restore_mode = ob->mode;
102  ob->mode |= OB_MODE_POSE;
103  /* Inform all CoW versions that we changed the mode. */
105  ok = true;
106 
107  break;
108  default:
109  break;
110  }
111 
112  return ok;
113 }
115 {
116  ReportList *reports = CTX_wm_reports(C);
117  if (ID_IS_LINKED(ob)) {
118  BKE_report(reports, RPT_WARNING, "Cannot pose libdata");
119  return false;
120  }
121  struct Main *bmain = CTX_data_main(C);
122  bool ok = ED_object_posemode_enter_ex(bmain, ob);
123  if (ok) {
125  }
126  return ok;
127 }
128 
129 bool ED_object_posemode_exit_ex(struct Main *bmain, Object *ob)
130 {
131  bool ok = false;
132  if (ob) {
133  ob->restore_mode = ob->mode;
134  ob->mode &= ~OB_MODE_POSE;
135 
136  /* Inform all CoW versions that we changed the mode. */
138  ok = true;
139  }
140  return ok;
141 }
143 {
144  struct Main *bmain = CTX_data_main(C);
145  bool ok = ED_object_posemode_exit_ex(bmain, ob);
146  if (ok) {
148  }
149  return ok;
150 }
151 
152 /* if a selected or active bone is protected, throw error (only if warn == 1) and return 1 */
153 /* only_selected == 1: the active bone is allowed to be protected */
154 #if 0 /* UNUSED 2.5 */
155 static bool pose_has_protected_selected(Object *ob, short warn)
156 {
157  /* check protection */
158  if (ob->proxy) {
159  bPoseChannel *pchan;
160  bArmature *arm = ob->data;
161 
162  for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
163  if (pchan->bone && (pchan->bone->layer & arm->layer)) {
164  if (pchan->bone->layer & arm->layer_protected) {
165  if (pchan->bone->flag & BONE_SELECTED) {
166  break;
167  }
168  }
169  }
170  }
171  if (pchan) {
172  if (warn) {
173  error("Cannot change Proxy protected bones");
174  }
175  return 1;
176  }
177  }
178  return 0;
179 }
180 #endif
181 
182 /* ********************************************** */
183 /* Motion Paths */
184 
186 {
187  switch (range) {
194  }
196 }
197 
198 /* For the object with pose/action: update paths for those that have got them
199  * This should selectively update paths that exist...
200  *
201  * To be called from various tools that do incremental updates
202  */
204 {
205  /* Transform doesn't always have context available to do update. */
206  if (C == NULL) {
207  return;
208  }
209 
210  Main *bmain = CTX_data_main(C);
211  ViewLayer *view_layer = CTX_data_view_layer(C);
212 
214  bool free_depsgraph = false;
215 
216  ListBase targets = {NULL, NULL};
217  /* set flag to force recalc, then grab the relevant bones to target */
219  animviz_get_object_motionpaths(ob, &targets);
220 
221  /* recalculate paths, then free */
222 #ifdef DEBUG_TIME
223  TIMEIT_START(pose_path_calc);
224 #endif
225 
226  /* For a single frame update it's faster to re-use existing dependency graph and avoid overhead
227  * of building all the relations and so on for a temporary one. */
228  if (range == POSE_PATH_CALC_RANGE_CURRENT_FRAME) {
229  /* NOTE: Dependency graph will be evaluated at all the frames, but we first need to access some
230  * nested pointers, like animation data. */
232  free_depsgraph = false;
233  }
234  else {
235  depsgraph = animviz_depsgraph_build(bmain, scene, view_layer, &targets);
236  free_depsgraph = true;
237  }
238 
240  depsgraph, bmain, scene, &targets, pose_path_convert_range(range), !free_depsgraph);
241 
242 #ifdef DEBUG_TIME
243  TIMEIT_END(pose_path_calc);
244 #endif
245 
246  BLI_freelistN(&targets);
247 
248  if (range != POSE_PATH_CALC_RANGE_CURRENT_FRAME) {
249  /* Tag armature object for copy on write - so paths will draw/redraw.
250  * For currently frame only we update evaluated object directly. */
252  }
253 
254  /* Free temporary depsgraph. */
255  if (free_depsgraph) {
257  }
258 }
259 
260 /* show popup to determine settings */
262 {
264 
265  if (ELEM(NULL, ob, ob->pose)) {
266  return OPERATOR_CANCELLED;
267  }
268 
269  /* set default settings from existing/stored settings */
270  {
271  bAnimVizSettings *avs = &ob->pose->avs;
272  PointerRNA avs_ptr;
273 
274  RNA_int_set(op->ptr, "start_frame", avs->path_sf);
275  RNA_int_set(op->ptr, "end_frame", avs->path_ef);
276 
278  RNA_enum_set(op->ptr, "bake_location", RNA_enum_get(&avs_ptr, "bake_location"));
279  }
280 
281  /* show popup dialog to allow editing of range... */
282  /* FIXME: hard-coded dimensions here are just arbitrary. */
283  return WM_operator_props_dialog_popup(C, op, 200);
284 }
285 
286 /* For the object with pose/action: create path curves for selected bones
287  * This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range
288  */
290 {
293 
294  if (ELEM(NULL, ob, ob->pose)) {
295  return OPERATOR_CANCELLED;
296  }
297 
298  /* grab baking settings from operator settings */
299  {
300  bAnimVizSettings *avs = &ob->pose->avs;
301  PointerRNA avs_ptr;
302 
303  avs->path_sf = RNA_int_get(op->ptr, "start_frame");
304  avs->path_ef = RNA_int_get(op->ptr, "end_frame");
305 
307  RNA_enum_set(&avs_ptr, "bake_location", RNA_enum_get(op->ptr, "bake_location"));
308  }
309 
310  /* set up path data for bones being calculated */
311  CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones_from_active_object) {
312  /* verify makes sure that the selected bone has a bone with the appropriate settings */
313  animviz_verify_motionpaths(op->reports, scene, ob, pchan);
314  }
315  CTX_DATA_END;
316 
317 #ifdef DEBUG_TIME
318  TIMEIT_START(recalc_pose_paths);
319 #endif
320 
321  /* calculate the bones that now have motionpaths... */
322  /* TODO: only make for the selected bones? */
324 
325 #ifdef DEBUG_TIME
326  TIMEIT_END(recalc_pose_paths);
327 #endif
328 
329  /* notifiers for updates */
331 
332  return OPERATOR_FINISHED;
333 }
334 
336 {
337  /* identifiers */
338  ot->name = "Calculate Bone Paths";
339  ot->idname = "POSE_OT_paths_calculate";
340  ot->description = "Calculate paths for the selected bones";
341 
342  /* api callbacks */
346 
347  /* flags */
349 
350  /* properties */
352  "start_frame",
353  1,
354  MINAFRAME,
355  MAXFRAME,
356  "Start",
357  "First frame to calculate bone paths on",
358  MINFRAME,
359  MAXFRAME / 2.0);
361  "end_frame",
362  250,
363  MINAFRAME,
364  MAXFRAME,
365  "End",
366  "Last frame to calculate bone paths on",
367  MINFRAME,
368  MAXFRAME / 2.0);
369 
371  "bake_location",
374  "Bake Location",
375  "Which point on the bones is used when calculating paths");
376 }
377 
378 /* --------- */
379 
381 {
384  return (ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS) != 0;
385  }
386 
387  return false;
388 }
389 
391 {
394 
395  if (ELEM(NULL, ob, scene)) {
396  return OPERATOR_CANCELLED;
397  }
398 
399  /* calculate the bones that now have motionpaths... */
400  /* TODO: only make for the selected bones? */
402 
403  /* notifiers for updates */
405 
406  return OPERATOR_FINISHED;
407 }
408 
410 {
411  /* identifiers */
412  ot->name = "Update Bone Paths";
413  ot->idname = "POSE_OT_paths_update";
414  ot->description = "Recalculate paths for bones that already have them";
415 
416  /* api callbacks */
419 
420  /* flags */
422 }
423 
424 /* --------- */
425 
426 /* for the object with pose/action: clear path curves for selected bones only */
427 static void ED_pose_clear_paths(Object *ob, bool only_selected)
428 {
429  bPoseChannel *pchan;
430  bool skipped = false;
431 
432  if (ELEM(NULL, ob, ob->pose)) {
433  return;
434  }
435 
436  /* free the motionpath blocks for all bones - This is easier for users to quickly clear all */
437  for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
438  if (pchan->mpath) {
439  if ((only_selected == false) || ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED))) {
441  pchan->mpath = NULL;
442  }
443  else {
444  skipped = true;
445  }
446  }
447  }
448 
449  /* if nothing was skipped, there should be no paths left! */
450  if (skipped == false) {
452  }
453 
454  /* tag armature object for copy on write - so removed paths don't still show */
456 }
457 
458 /* operator callback - wrapper for the backend function */
460 {
462  bool only_selected = RNA_boolean_get(op->ptr, "only_selected");
463 
464  /* only continue if there's an object */
465  if (ELEM(NULL, ob, ob->pose)) {
466  return OPERATOR_CANCELLED;
467  }
468 
469  /* use the backend function for this */
470  ED_pose_clear_paths(ob, only_selected);
471 
472  /* notifiers for updates */
474 
475  return OPERATOR_FINISHED;
476 }
477 
478 /* operator callback/wrapper */
479 static int pose_clear_paths_invoke(bContext *C, wmOperator *op, const wmEvent *event)
480 {
481  if ((event->shift) && !RNA_struct_property_is_set(op->ptr, "only_selected")) {
482  RNA_boolean_set(op->ptr, "only_selected", true);
483  }
484  return pose_clear_paths_exec(C, op);
485 }
486 
488 {
489  /* identifiers */
490  ot->name = "Clear Bone Paths";
491  ot->idname = "POSE_OT_paths_clear";
492  ot->description = "Clear path caches for all bones, hold Shift key for selected bones only";
493 
494  /* api callbacks */
498 
499  /* flags */
501 
502  /* properties */
504  ot->srna, "only_selected", false, "Only Selected", "Only clear paths from selected bones");
506 }
507 
508 /* --------- */
509 
511 {
514 
515  if (ELEM(NULL, scene, ob, ob->pose)) {
516  return OPERATOR_CANCELLED;
517  }
518 
519  /* use Preview Range or Full Frame Range - whichever is in use */
520  ob->pose->avs.path_sf = PSFRA;
521  ob->pose->avs.path_ef = PEFRA;
522 
523  /* tag for updates */
526 
527  return OPERATOR_FINISHED;
528 }
529 
531 {
532  /* identifiers */
533  ot->name = "Update Range from Scene";
534  ot->idname = "POSE_OT_paths_range_update";
535  ot->description = "Update frame range for motion paths from the Scene's current frame range";
536 
537  /* callbacks */
540 
541  /* flags */
543 }
544 
545 /* ********************************************** */
546 
548 {
549  Main *bmain = CTX_data_main(C);
550  ViewLayer *view_layer = CTX_data_view_layer(C);
551  View3D *v3d = CTX_wm_view3d(C);
552  const bool do_strip_numbers = RNA_boolean_get(op->ptr, "do_strip_numbers");
553 
554  FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, OB_ARMATURE, OB_MODE_POSE, ob) {
555  bArmature *arm = ob->data;
556  ListBase bones_names = {NULL};
557 
559  BLI_addtail(&bones_names, BLI_genericNodeN(pchan->name));
560  }
562 
563  ED_armature_bones_flip_names(bmain, arm, &bones_names, do_strip_numbers);
564 
565  BLI_freelistN(&bones_names);
566 
567  /* since we renamed stuff... */
569 
570  /* note, notifier might evolve */
572  }
574 
575  return OPERATOR_FINISHED;
576 }
577 
579 {
580  /* identifiers */
581  ot->name = "Flip Names";
582  ot->idname = "POSE_OT_flip_names";
583  ot->description = "Flips (and corrects) the axis suffixes of the names of selected bones";
584 
585  /* api callbacks */
588 
589  /* flags */
591 
593  "do_strip_numbers",
594  false,
595  "Strip Numbers",
596  "Try to remove right-most dot-number from flipped names.\n"
597  "Warning: May result in incoherent naming in some cases");
598 }
599 
600 /* ------------------ */
601 
603 {
604  Main *bmain = CTX_data_main(C);
605  char newname[MAXBONENAME];
606  short axis = RNA_enum_get(op->ptr, "axis");
607  Object *ob_prev = NULL;
608 
609  /* loop through selected bones, auto-naming them */
610  CTX_DATA_BEGIN_WITH_ID (C, bPoseChannel *, pchan, selected_pose_bones, Object *, ob) {
611  bArmature *arm = ob->data;
612  BLI_strncpy(newname, pchan->name, sizeof(newname));
613  if (bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis])) {
614  ED_armature_bone_rename(bmain, arm, pchan->name, newname);
615  }
616 
617  if (ob_prev != ob) {
618  /* since we renamed stuff... */
620 
621  /* note, notifier might evolve */
623  ob_prev = ob;
624  }
625  }
626  CTX_DATA_END;
627 
628  return OPERATOR_FINISHED;
629 }
630 
632 {
633  static const EnumPropertyItem axis_items[] = {
634  {0, "XAXIS", 0, "X-Axis", "Left/Right"},
635  {1, "YAXIS", 0, "Y-Axis", "Front/Back"},
636  {2, "ZAXIS", 0, "Z-Axis", "Top/Bottom"},
637  {0, NULL, 0, NULL, NULL},
638  };
639 
640  /* identifiers */
641  ot->name = "Auto-Name by Axis";
642  ot->idname = "POSE_OT_autoside_names";
643  ot->description =
644  "Automatically renames the selected bones according to which side of the target axis they "
645  "fall on";
646 
647  /* api callbacks */
651 
652  /* flags */
654 
655  /* settings */
656  ot->prop = RNA_def_enum(ot->srna, "axis", axis_items, 0, "Axis", "Axis tag names with");
657 }
658 
659 /* ********************************************** */
660 
662 {
663  const int mode = RNA_enum_get(op->ptr, "type");
664  Object *prev_ob = NULL;
665 
666  /* set rotation mode of selected bones */
667  CTX_DATA_BEGIN_WITH_ID (C, bPoseChannel *, pchan, selected_pose_bones, Object *, ob) {
668  /* use API Method for conversions... */
670  pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle, pchan->rotmode, (short)mode);
671 
672  /* finally, set the new rotation type */
673  pchan->rotmode = mode;
674 
675  if (prev_ob != ob) {
676  /* Notifiers and updates. */
680  prev_ob = ob;
681  }
682  }
683  CTX_DATA_END;
684 
685  return OPERATOR_FINISHED;
686 }
687 
689 {
690  /* identifiers */
691  ot->name = "Set Rotation Mode";
692  ot->idname = "POSE_OT_rotation_mode_set";
693  ot->description = "Set the rotation representation used by selected bones";
694 
695  /* callbacks */
699 
700  /* flags */
702 
703  /* properties */
704  ot->prop = RNA_def_enum(
705  ot->srna, "type", rna_enum_object_rotation_mode_items, 0, "Rotation Mode", "");
706 }
707 
708 /* ********************************************** */
709 
711 {
712  /* Armature layers operators can be used in posemode OR editmode for armatures */
714 }
715 
717 {
718  bArmature *arm = NULL;
719 
720  /* Sanity checking and handling of posemode. */
721  if (*ob) {
723  if (tob) {
724  *ob = tob;
725  arm = (*ob)->data;
726  }
727  else if ((*ob)->type == OB_ARMATURE) {
728  arm = (*ob)->data;
729  }
730  }
731 
732  return arm;
733 }
734 
735 /* Show all armature layers */
736 
738 {
741  PointerRNA ptr;
742  int maxLayers = (RNA_boolean_get(op->ptr, "all")) ? 32 : 16;
743  /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
744  bool layers[32] = {false};
745 
746  /* sanity checking */
747  if (arm == NULL) {
748  return OPERATOR_CANCELLED;
749  }
750 
751  /* use RNA to set the layers
752  * although it would be faster to just set directly using bitflags, we still
753  * need to setup a RNA pointer so that we get the "update" callbacks for free...
754  */
755  RNA_id_pointer_create(&arm->id, &ptr);
756 
757  for (int i = 0; i < maxLayers; i++) {
758  layers[i] = 1;
759  }
760 
761  RNA_boolean_set_array(&ptr, "layers", layers);
762 
763  /* note, notifier might evolve */
766 
767  /* done */
768  return OPERATOR_FINISHED;
769 }
770 
772 {
773  /* identifiers */
774  ot->name = "Show All Layers";
775  ot->idname = "ARMATURE_OT_layers_show_all";
776  ot->description = "Make all armature layers visible";
777 
778  /* callbacks */
781 
782  /* flags */
784 
785  /* properties */
787  ot->srna, "all", 1, "All Layers", "Enable all layers or just the first 16 (top row)");
788 }
789 
790 /* ------------------- */
791 
792 /* Present a popup to get the layers that should be used */
793 static int armature_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
794 {
797  PointerRNA ptr;
798  /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
799  bool layers[32];
800 
801  /* sanity checking */
802  if (arm == NULL) {
803  return OPERATOR_CANCELLED;
804  }
805 
806  /* Get RNA pointer to armature data to use that to retrieve the layers as ints
807  * to init the operator. */
808  RNA_id_pointer_create((ID *)arm, &ptr);
809  RNA_boolean_get_array(&ptr, "layers", layers);
810  RNA_boolean_set_array(op->ptr, "layers", layers);
811 
812  /* part to sync with other similar operators... */
813  return WM_operator_props_popup(C, op, event);
814 }
815 
816 /* Set the visible layers for the active armature (edit and pose modes) */
818 {
821  PointerRNA ptr;
822  /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
823  bool layers[32];
824 
825  if (arm == NULL) {
826  return OPERATOR_CANCELLED;
827  }
828 
829  /* get the values set in the operator properties */
830  RNA_boolean_get_array(op->ptr, "layers", layers);
831 
832  /* get pointer for armature, and write data there... */
833  RNA_id_pointer_create((ID *)arm, &ptr);
834  RNA_boolean_set_array(&ptr, "layers", layers);
835 
836  /* note, notifier might evolve */
839 
840  return OPERATOR_FINISHED;
841 }
842 
844 {
845  /* identifiers */
846  ot->name = "Change Armature Layers";
847  ot->idname = "ARMATURE_OT_armature_layers";
848  ot->description = "Change the visible armature layers";
849 
850  /* callbacks */
854 
855  /* flags */
857 
858  /* properties */
860  ot->srna, "layers", 32, NULL, "Layer", "Armature layers to make visible");
861 }
862 
863 /* ------------------- */
864 
865 /* Present a popup to get the layers that should be used */
866 static int pose_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
867 {
868  /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
869  bool layers[32] = {0};
870 
871  /* get layers that are active already */
872  CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
873  short bit;
874 
875  /* loop over the bits for this pchan's layers, adding layers where they're needed */
876  for (bit = 0; bit < 32; bit++) {
877  layers[bit] = (pchan->bone->layer & (1u << bit)) != 0;
878  }
879  }
880  CTX_DATA_END;
881 
882  /* copy layers to operator */
883  RNA_boolean_set_array(op->ptr, "layers", layers);
884 
885  /* part to sync with other similar operators... */
886  return WM_operator_props_popup(C, op, event);
887 }
888 
889 /* Set the visible layers for the active armature (edit and pose modes) */
891 {
892  PointerRNA ptr;
893  /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
894  bool layers[32];
895 
896  /* get the values set in the operator properties */
897  RNA_boolean_get_array(op->ptr, "layers", layers);
898 
899  Object *prev_ob = NULL;
900 
901  /* Make sure that the pose bone data is up to date.
902  * (May not always be the case after undo/redo e.g.).
903  */
904  struct Main *bmain = CTX_data_main(C);
905  wmWindow *win = CTX_wm_window(C);
906  View3D *v3d = CTX_wm_view3d(C); /* This may be NULL in a lot of cases. */
907  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
908 
909  FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, OB_ARMATURE, OB_MODE_POSE, ob_iter) {
910  bArmature *arm = ob_iter->data;
911  BKE_pose_ensure(bmain, ob_iter, arm, true);
912  }
914 
915  /* set layers of pchans based on the values set in the operator props */
916  CTX_DATA_BEGIN_WITH_ID (C, bPoseChannel *, pchan, selected_pose_bones, Object *, ob) {
917  /* get pointer for pchan, and write flags this way */
918  RNA_pointer_create((ID *)ob->data, &RNA_Bone, pchan->bone, &ptr);
919  RNA_boolean_set_array(&ptr, "layers", layers);
920 
921  if (prev_ob != ob) {
922  /* Note, notifier might evolve. */
925  prev_ob = ob;
926  }
927  }
928  CTX_DATA_END;
929  return OPERATOR_FINISHED;
930 }
931 
933 {
934  /* identifiers */
935  ot->name = "Change Bone Layers";
936  ot->idname = "POSE_OT_bone_layers";
937  ot->description = "Change the layers that the selected bones belong to";
938 
939  /* callbacks */
943 
944  /* flags */
946 
947  /* properties */
949  ot->srna, "layers", 32, NULL, "Layer", "Armature layers that bone belongs to");
950 }
951 
952 /* ------------------- */
953 
954 /* Present a popup to get the layers that should be used */
955 static int armature_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
956 {
957  /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
958  bool layers[32] = {0};
959 
960  /* get layers that are active already */
961  CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
962  short bit;
963 
964  /* loop over the bits for this pchan's layers, adding layers where they're needed */
965  for (bit = 0; bit < 32; bit++) {
966  if (ebone->layer & (1u << bit)) {
967  layers[bit] = 1;
968  }
969  }
970  }
971  CTX_DATA_END;
972 
973  /* copy layers to operator */
974  RNA_boolean_set_array(op->ptr, "layers", layers);
975 
976  /* part to sync with other similar operators... */
977  return WM_operator_props_popup(C, op, event);
978 }
979 
980 /* Set the visible layers for the active armature (edit and pose modes) */
982 {
984  PointerRNA ptr;
985  /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
986  bool layers[32];
987 
988  /* get the values set in the operator properties */
989  RNA_boolean_get_array(op->ptr, "layers", layers);
990 
991  /* set layers of pchans based on the values set in the operator props */
992  CTX_DATA_BEGIN_WITH_ID (C, EditBone *, ebone, selected_editable_bones, bArmature *, arm) {
993  /* get pointer for pchan, and write flags this way */
994  RNA_pointer_create((ID *)arm, &RNA_EditBone, ebone, &ptr);
995  RNA_boolean_set_array(&ptr, "layers", layers);
996  }
997  CTX_DATA_END;
998 
1000 
1001  /* note, notifier might evolve */
1004 
1005  return OPERATOR_FINISHED;
1006 }
1007 
1009 {
1010  /* identifiers */
1011  ot->name = "Change Bone Layers";
1012  ot->idname = "ARMATURE_OT_bone_layers";
1013  ot->description = "Change the layers that the selected bones belong to";
1014 
1015  /* callbacks */
1019 
1020  /* flags */
1022 
1023  /* properties */
1025  ot->srna, "layers", 32, NULL, "Layer", "Armature layers that bone belongs to");
1026 }
1027 
1028 /* ********************************************** */
1029 /* Show/Hide Bones */
1030 
1031 static int hide_pose_bone_fn(Object *ob, Bone *bone, void *ptr)
1032 {
1033  bArmature *arm = ob->data;
1034  const bool hide_select = (bool)POINTER_AS_INT(ptr);
1035  int count = 0;
1036  if (arm->layer & bone->layer) {
1037  if (((bone->flag & BONE_SELECTED) != 0) == hide_select) {
1038  bone->flag |= BONE_HIDDEN_P;
1039  /* only needed when 'hide_select' is true, but harmless. */
1040  bone->flag &= ~BONE_SELECTED;
1041  if (arm->act_bone == bone) {
1042  arm->act_bone = NULL;
1043  }
1044  count += 1;
1045  }
1046  }
1047  return count;
1048 }
1049 
1050 /* active object is armature in posemode, poll checked */
1052 {
1053  ViewLayer *view_layer = CTX_data_view_layer(C);
1054  uint objects_len;
1055  Object **objects = BKE_object_pose_array_get_unique(view_layer, CTX_wm_view3d(C), &objects_len);
1056  bool changed_multi = false;
1057 
1058  const int hide_select = !RNA_boolean_get(op->ptr, "unselected");
1059  void *hide_select_p = POINTER_FROM_INT(hide_select);
1060 
1061  for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
1062  Object *ob_iter = objects[ob_index];
1063  bArmature *arm = ob_iter->data;
1064 
1065  if (ob_iter->proxy != NULL) {
1066  BKE_report(op->reports, RPT_INFO, "Undo of hiding can only be done with Reveal Selected");
1067  }
1068 
1069  bool changed = bone_looper(ob_iter, arm->bonebase.first, hide_select_p, hide_pose_bone_fn) !=
1070  0;
1071  if (changed) {
1072  changed_multi = true;
1075  }
1076  }
1077  MEM_freeN(objects);
1078 
1079  return changed_multi ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
1080 }
1081 
1083 {
1084  /* identifiers */
1085  ot->name = "Hide Selected";
1086  ot->idname = "POSE_OT_hide";
1087  ot->description = "Tag selected bones to not be visible in Pose Mode";
1088 
1089  /* api callbacks */
1090  ot->exec = pose_hide_exec;
1092 
1093  /* flags */
1095 
1096  /* props */
1097  RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "");
1098 }
1099 
1100 static int show_pose_bone_cb(Object *ob, Bone *bone, void *data)
1101 {
1102  const bool select = POINTER_AS_INT(data);
1103 
1104  bArmature *arm = ob->data;
1105  int count = 0;
1106  if (arm->layer & bone->layer) {
1107  if (bone->flag & BONE_HIDDEN_P) {
1108  if (!(bone->flag & BONE_UNSELECTABLE)) {
1110  }
1111  bone->flag &= ~BONE_HIDDEN_P;
1112  count += 1;
1113  }
1114  }
1115 
1116  return count;
1117 }
1118 
1119 /* active object is armature in posemode, poll checked */
1121 {
1122  ViewLayer *view_layer = CTX_data_view_layer(C);
1123  uint objects_len;
1124  Object **objects = BKE_object_pose_array_get_unique(view_layer, CTX_wm_view3d(C), &objects_len);
1125  bool changed_multi = false;
1126  const bool select = RNA_boolean_get(op->ptr, "select");
1127  void *select_p = POINTER_FROM_INT(select);
1128 
1129  for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
1130  Object *ob_iter = objects[ob_index];
1131  bArmature *arm = ob_iter->data;
1132 
1133  bool changed = bone_looper(ob_iter, arm->bonebase.first, select_p, show_pose_bone_cb);
1134  if (changed) {
1135  changed_multi = true;
1138  }
1139  }
1140  MEM_freeN(objects);
1141 
1142  return changed_multi ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
1143 }
1144 
1146 {
1147  /* identifiers */
1148  ot->name = "Reveal Selected";
1149  ot->idname = "POSE_OT_reveal";
1150  ot->description = "Reveal all bones hidden in Pose Mode";
1151 
1152  /* api callbacks */
1155 
1156  /* flags */
1158 
1159  RNA_def_boolean(ot->srna, "select", true, "Select", "");
1160 }
1161 
1162 /* ********************************************** */
1163 /* Flip Quats */
1164 
1166 {
1169 
1170  bool changed_multi = false;
1171 
1172  ViewLayer *view_layer = CTX_data_view_layer(C);
1173  View3D *v3d = CTX_wm_view3d(C);
1174  FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, OB_ARMATURE, OB_MODE_POSE, ob_iter) {
1175  bool changed = false;
1176  /* loop through all selected pchans, flipping and keying (as needed) */
1177  FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN (ob_iter, pchan) {
1178  /* only if bone is using quaternion rotation */
1179  if (pchan->rotmode == ROT_MODE_QUAT) {
1180  changed = true;
1181  /* quaternions have 720 degree range */
1182  negate_v4(pchan->quat);
1183 
1184  ED_autokeyframe_pchan(C, scene, ob_iter, pchan, ks);
1185  }
1186  }
1188 
1189  if (changed) {
1190  changed_multi = true;
1191  /* notifiers and updates */
1192  DEG_id_tag_update(&ob_iter->id, ID_RECALC_GEOMETRY);
1194  }
1195  }
1197 
1198  return changed_multi ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
1199 }
1200 
1202 {
1203  /* identifiers */
1204  ot->name = "Flip Quats";
1205  ot->idname = "POSE_OT_quaternions_flip";
1206  ot->description =
1207  "Flip quaternion values to achieve desired rotations, while maintaining the same "
1208  "orientations";
1209 
1210  /* callbacks */
1213 
1214  /* flags */
1216 }
Blender kernel action and pose functionality.
void animviz_free_motionpath(struct bMotionPath *mpath)
struct bMotionPath * animviz_verify_motionpaths(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan)
void BKE_pose_ensure(struct Main *bmain, struct Object *ob, struct bArmature *arm, const bool do_id_user)
Definition: armature.c:2608
#define FOREACH_PCHAN_SELECTED_IN_OBJECT_END
Definition: BKE_armature.h:353
void BKE_rotMode_change_values(float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode)
Definition: armature.c:1984
#define FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN(_ob, _pchan)
Definition: BKE_armature.h:349
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)
Definition: BKE_context.h:266
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:714
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
struct Object * CTX_data_edit_object(const bContext *C)
Definition: context.c:1296
#define CTX_DATA_BEGIN(C, Type, instance, member)
Definition: BKE_context.h:252
struct ViewLayer * CTX_data_view_layer(const bContext *C)
Definition: context.c:1044
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Definition: context.c:1424
struct Object * CTX_data_active_object(const bContext *C)
Definition: context.c:1279
struct View3D * CTX_wm_view3d(const bContext *C)
Definition: context.c:760
struct ReportList * CTX_wm_reports(const bContext *C)
Definition: context.c:751
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1018
#define CTX_DATA_END
Definition: BKE_context.h:260
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:699
support for deformation groups and hooks.
#define FOREACH_OBJECT_IN_MODE_END
Definition: BKE_layer.h:284
#define FOREACH_OBJECT_IN_MODE_BEGIN(_view_layer, _v3d, _object_type, _object_mode, _instance)
Definition: BKE_layer.h:280
General operations, lookup, etc. for blender objects.
struct Object * BKE_object_pose_armature_get(struct Object *ob)
Definition: object.c:2487
struct Object ** BKE_object_pose_array_get_unique(struct ViewLayer *view_layer, struct View3D *v3d, unsigned int *r_objects_len)
Definition: object.c:2552
void BKE_report(ReportList *reports, ReportType type, const char *message)
Definition: report.c:104
#define BLI_assert(a)
Definition: BLI_assert.h:58
struct LinkData * BLI_genericNodeN(void *data)
Definition: listbase.c:923
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:547
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:110
MINLINE void negate_v4(float r[4])
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
Definition: string.c:108
unsigned int uint
Definition: BLI_sys_types.h:83
#define POINTER_FROM_INT(i)
#define UNUSED(x)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define POINTER_AS_INT(i)
#define ELEM(...)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
void DEG_id_tag_update_ex(struct Main *bmain, struct ID *id, int flag)
void DEG_graph_free(Depsgraph *graph)
Definition: depsgraph.cc:314
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_PARAMETERS
Definition: DNA_ID.h:668
@ ID_RECALC_COPY_ON_WRITE
Definition: DNA_ID.h:654
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:611
#define ID_IS_LINKED(_id)
Definition: DNA_ID.h:426
@ MOTIONPATH_BAKE_HEADS
@ MOTIONPATH_BAKE_HAS_PATHS
@ ROT_MODE_QUAT
@ 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 MINFRAME
#define MINAFRAME
#define PSFRA
#define PEFRA
#define MAXFRAME
@ SPACE_PROPERTIES
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
eAnimvizCalcRange
Definition: ED_anim_api.h:873
@ ANIMVIZ_CALC_RANGE_FULL
Definition: ED_anim_api.h:881
@ ANIMVIZ_CALC_RANGE_CURRENT_FRAME
Definition: ED_anim_api.h:875
@ ANIMVIZ_CALC_RANGE_CHANGED
Definition: ED_anim_api.h:878
ePosePathCalcRange
Definition: ED_armature.h:200
@ POSE_PATH_CALC_RANGE_CURRENT_FRAME
Definition: ED_armature.h:201
@ POSE_PATH_CALC_RANGE_CHANGED
Definition: ED_armature.h:202
@ POSE_PATH_CALC_RANGE_FULL
Definition: ED_armature.h:203
#define ANIM_KS_LOC_ROT_SCALE_ID
struct Object * ED_object_context(const struct bContext *C)
bool ED_operator_posemode(struct bContext *C)
Definition: screen_ops.c:484
bool ED_operator_posemode_local(struct bContext *C)
Definition: screen_ops.c:500
bool ED_operator_editarmature(struct bContext *C)
Definition: screen_ops.c:437
bool ED_operator_posemode_exclusive(struct bContext *C)
check for pose mode (no mixed modes)
Definition: screen_ops.c:453
Read Guarded memory(de)allocation.
Platform independent time functions.
Utility defines for timing/benchmarks.
#define TIMEIT_START(var)
#define TIMEIT_END(var)
StructRNA RNA_Bone
StructRNA RNA_EditBone
StructRNA RNA_AnimVizMotionPaths
@ PROP_SKIP_SAVE
Definition: RNA_types.h:204
#define C
Definition: RandGen.cpp:39
@ OPTYPE_UNDO
Definition: WM_types.h:155
@ OPTYPE_REGISTER
Definition: WM_types.h:153
#define ND_MODE
Definition: WM_types.h:345
#define NC_SCENE
Definition: WM_types.h:279
#define ND_POSE
Definition: WM_types.h:359
#define NS_MODE_OBJECT
Definition: WM_types.h:441
#define ND_TRANSFORM
Definition: WM_types.h:357
#define NS_MODE_POSE
Definition: WM_types.h:450
#define ND_BONE_SELECT
Definition: WM_types.h:361
#define NC_OBJECT
Definition: WM_types.h:280
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)
Depsgraph * animviz_depsgraph_build(Main *bmain, Scene *scene, ViewLayer *view_layer, ListBase *targets)
int bone_looper(struct Object *ob, struct Bone *bone, void *data, int(*bone_func)(struct Object *, struct 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)
void ED_armature_edit_refresh_layer_used(bArmature *arm)
Scene scene
const Depsgraph * depsgraph
int count
bool ED_autokeyframe_pchan(bContext *C, Scene *scene, Object *ob, bPoseChannel *pchan, KeyingSet *ks)
Definition: keyframing.c:3023
KeyingSet * ANIM_builtin_keyingset_get_named(KeyingSet *prevKS, const char name[])
Definition: keyingsets.c:550
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
static void error(const char *str)
Definition: meshlaplacian.c:65
static void area(int d1, int d2, int e1, int e2, float weights[2])
static int pose_clear_paths_exec(bContext *C, wmOperator *op)
Definition: pose_edit.c:459
static int pose_update_paths_range_exec(bContext *C, wmOperator *UNUSED(op))
Definition: pose_edit.c:510
void POSE_OT_hide(wmOperatorType *ot)
Definition: pose_edit.c:1082
void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob, ePosePathCalcRange range)
Definition: pose_edit.c:203
void POSE_OT_paths_range_update(wmOperatorType *ot)
Definition: pose_edit.c:530
static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
Definition: pose_edit.c:261
static int armature_bone_layers_exec(bContext *C, wmOperator *op)
Definition: pose_edit.c:981
static int pose_autoside_names_exec(bContext *C, wmOperator *op)
Definition: pose_edit.c:602
void POSE_OT_quaternions_flip(wmOperatorType *ot)
Definition: pose_edit.c:1201
void ARMATURE_OT_bone_layers(wmOperatorType *ot)
Definition: pose_edit.c:1008
void POSE_OT_paths_update(wmOperatorType *ot)
Definition: pose_edit.c:409
static int armature_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: pose_edit.c:955
bool ED_object_posemode_enter(bContext *C, Object *ob)
Definition: pose_edit.c:114
static int pose_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: pose_edit.c:866
static bArmature * armature_layers_get_data(Object **ob)
Definition: pose_edit.c:716
static void ED_pose_clear_paths(Object *ob, bool only_selected)
Definition: pose_edit.c:427
static int pose_bone_layers_exec(bContext *C, wmOperator *op)
Definition: pose_edit.c:890
static int show_pose_bone_cb(Object *ob, Bone *bone, void *data)
Definition: pose_edit.c:1100
void ARMATURE_OT_layers_show_all(wmOperatorType *ot)
Definition: pose_edit.c:771
void POSE_OT_reveal(wmOperatorType *ot)
Definition: pose_edit.c:1145
static eAnimvizCalcRange pose_path_convert_range(ePosePathCalcRange range)
Definition: pose_edit.c:185
Object * ED_pose_object_from_context(bContext *C)
Definition: pose_edit.c:76
static int hide_pose_bone_fn(Object *ob, Bone *bone, void *ptr)
Definition: pose_edit.c:1031
bool ED_object_posemode_enter_ex(struct Main *bmain, Object *ob)
Definition: pose_edit.c:94
void POSE_OT_flip_names(wmOperatorType *ot)
Definition: pose_edit.c:578
void POSE_OT_paths_clear(wmOperatorType *ot)
Definition: pose_edit.c:487
static int pose_reveal_exec(bContext *C, wmOperator *op)
Definition: pose_edit.c:1120
bool ED_object_posemode_exit_ex(struct Main *bmain, Object *ob)
Definition: pose_edit.c:129
static bool armature_layers_poll(bContext *C)
Definition: pose_edit.c:710
static int pose_flip_quats_exec(bContext *C, wmOperator *UNUSED(op))
Definition: pose_edit.c:1165
static int armature_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: pose_edit.c:793
void POSE_OT_autoside_names(wmOperatorType *ot)
Definition: pose_edit.c:631
static int pose_calculate_paths_exec(bContext *C, wmOperator *op)
Definition: pose_edit.c:289
void POSE_OT_paths_calculate(wmOperatorType *ot)
Definition: pose_edit.c:335
static int pose_flip_names_exec(bContext *C, wmOperator *op)
Definition: pose_edit.c:547
static int pose_clear_paths_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: pose_edit.c:479
void POSE_OT_rotation_mode_set(wmOperatorType *ot)
Definition: pose_edit.c:688
static int pose_bone_rotmode_exec(bContext *C, wmOperator *op)
Definition: pose_edit.c:661
static int pose_hide_exec(bContext *C, wmOperator *op)
Definition: pose_edit.c:1051
static int pose_update_paths_exec(bContext *C, wmOperator *UNUSED(op))
Definition: pose_edit.c:390
static int pose_armature_layers_showall_exec(bContext *C, wmOperator *op)
Definition: pose_edit.c:737
static int armature_layers_exec(bContext *C, wmOperator *op)
Definition: pose_edit.c:817
void ARMATURE_OT_armature_layers(wmOperatorType *ot)
Definition: pose_edit.c:843
static bool pose_update_paths_poll(bContext *C)
Definition: pose_edit.c:380
bool ED_object_posemode_exit(bContext *C, Object *ob)
Definition: pose_edit.c:142
void POSE_OT_bone_layers(wmOperatorType *ot)
Definition: pose_edit.c:932
void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const bool *values)
Definition: rna_access.c:6296
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:146
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
Definition: rna_access.c:122
void RNA_boolean_get_array(PointerRNA *ptr, const char *name, bool *values)
Definition: rna_access.c:6284
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
Definition: rna_access.c:6272
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:6319
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6308
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:6685
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6261
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:6413
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6402
const EnumPropertyItem rna_enum_motionpath_bake_location_items[]
Definition: rna_animviz.c:40
PropertyRNA * RNA_def_boolean_layer_member(StructOrFunctionRNA *cont_, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3541
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3481
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1512
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3585
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3771
const EnumPropertyItem rna_enum_object_rotation_mode_items[]
Definition: rna_object.c:286
float tail[3]
float head[3]
Definition: DNA_ID.h:273
void * first
Definition: DNA_listBase.h:47
Definition: BKE_main.h:116
ListBase objects
Definition: BKE_main.h:148
int restore_mode
struct bPose * pose
struct Object * proxy
void * data
ListBase bonebase
unsigned int layer
unsigned int layer_protected
struct Bone * bone
bMotionPath * mpath
struct bPoseChannel * next
ListBase chanbase
bAnimVizSettings avs
short shift
Definition: WM_types.h:618
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:752
const char * name
Definition: WM_types.h:721
const char * idname
Definition: WM_types.h:723
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:776
struct StructRNA * srna
Definition: WM_types.h:802
const char * description
Definition: WM_types.h:726
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:736
PropertyRNA * prop
Definition: WM_types.h:814
struct ReportList * reports
struct PointerRNA * ptr
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
Definition: util_avxb.h:167
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3157
wmOperatorType * ot
Definition: wm_files.c:3156
int WM_operator_props_popup(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width)
int WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
Definition: wm_operators.c:982
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
Definition: wm_window.c:2286