Blender V4.3
keyingsets.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009 Blender Authors, Joshua Leung. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include <cfloat>
10#include <cmath>
11#include <cstddef>
12#include <cstdio>
13#include <cstring>
14
15#include "MEM_guardedalloc.h"
16
17#include "BLI_blenlib.h"
18#include "BLI_utildefines.h"
19
20#include "DNA_anim_types.h"
21#include "DNA_object_types.h"
22#include "DNA_scene_types.h"
23
24#include "BKE_animsys.h"
25#include "BKE_context.hh"
26#include "BKE_main.hh"
27#include "BKE_report.hh"
28
29#include "DEG_depsgraph.hh"
30
31#include "ANIM_keyframing.hh"
32#include "ANIM_keyingsets.hh"
33
34#include "ED_keyframing.hh"
35#include "ED_screen.hh"
36
37#include "UI_interface.hh"
38#include "UI_resources.hh"
39
40#include "WM_api.hh"
41#include "WM_types.hh"
42
43#include "RNA_access.hh"
44#include "RNA_define.hh"
45#include "RNA_enum_types.hh"
46#include "RNA_path.hh"
47
48#include "anim_intern.hh"
49
50/* ************************************************** */
51/* KEYING SETS - OPERATORS (for use in UI panels) */
52/* These operators are really duplication of existing functionality, but just for completeness,
53 * they're here too, and will give the basic data needed...
54 */
55
56/* poll callback for adding default KeyingSet */
58{
59 /* As long as there's an active Scene, it's fine. */
60 return (CTX_data_scene(C) != nullptr);
61}
62
63/* Poll callback for editing active KeyingSet. */
65{
66 Scene *scene = CTX_data_scene(C);
67
68 if (scene == nullptr) {
69 return false;
70 }
71
72 /* There must be an active KeyingSet (and KeyingSets). */
73 return ((scene->active_keyingset > 0) && (scene->keyingsets.first));
74}
75
76/* poll callback for editing active KeyingSet Path */
78{
79 Scene *scene = CTX_data_scene(C);
80
81 if (scene == nullptr) {
82 return false;
83 }
84 if (scene->active_keyingset <= 0) {
85 return false;
86 }
87
88 KeyingSet *keyingset = static_cast<KeyingSet *>(
89 BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1));
90
91 /* there must be an active KeyingSet and an active path */
92 return ((keyingset) && (keyingset->paths.first) && (keyingset->active_path > 0));
93}
94
95/* Add a Default (Empty) Keying Set ------------------------- */
96
98{
99 Scene *scene = CTX_data_scene(C);
100
101 /* Validate flags
102 * - absolute KeyingSets should be created by default.
103 */
105
107
108 /* Call the API func, and set the active keyingset index. */
109 BKE_keyingset_add(&scene->keyingsets, nullptr, nullptr, flag, keyingflag);
110
111 scene->active_keyingset = BLI_listbase_count(&scene->keyingsets);
112
114
115 return OPERATOR_FINISHED;
116}
117
119{
120 /* Identifiers. */
121 ot->name = "Add Empty Keying Set";
122 ot->idname = "ANIM_OT_keying_set_add";
123 ot->description = "Add a new (empty) keying set to the active Scene";
124
125 /* Callbacks. */
128}
129
130/* Remove 'Active' Keying Set ------------------------- */
131
133{
134 Scene *scene = CTX_data_scene(C);
135
136 /* Verify the Keying Set to use:
137 * - use the active one
138 * - return error if it doesn't exist
139 */
140 if (scene->active_keyingset == 0) {
141 BKE_report(op->reports, RPT_ERROR, "No active Keying Set to remove");
142 return OPERATOR_CANCELLED;
143 }
144
145 if (scene->active_keyingset < 0) {
146 BKE_report(op->reports, RPT_ERROR, "Cannot remove built in keying set");
147 return OPERATOR_CANCELLED;
148 }
149
150 KeyingSet *keyingset = static_cast<KeyingSet *>(
151 BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1));
152
153 /* Free KeyingSet's data, then remove it from the scene. */
154 BKE_keyingset_free_paths(keyingset);
155 BLI_freelinkN(&scene->keyingsets, keyingset);
156
157 /* The active one should now be the previously second-to-last one. */
158 scene->active_keyingset--;
159
161
162 return OPERATOR_FINISHED;
163}
164
166{
167 /* Identifiers. */
168 ot->name = "Remove Active Keying Set";
169 ot->idname = "ANIM_OT_keying_set_remove";
170 ot->description = "Remove the active keying set";
171
172 /* Callbacks. */
175}
176
177/* Add Empty Keying Set Path ------------------------- */
178
180{
181 Scene *scene = CTX_data_scene(C);
182
183 /* Verify the Keying Set to use:
184 * - use the active one
185 * - return error if it doesn't exist
186 */
187 if (scene->active_keyingset == 0) {
188 BKE_report(op->reports, RPT_ERROR, "No active Keying Set to add empty path to");
189 return OPERATOR_CANCELLED;
190 }
191
192 KeyingSet *keyingset = static_cast<KeyingSet *>(
193 BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1));
194
195 /* Don't use the API method for this, since that checks on values... */
196 KS_Path *keyingset_path = static_cast<KS_Path *>(
197 MEM_callocN(sizeof(KS_Path), "KeyingSetPath Empty"));
198 BLI_addtail(&keyingset->paths, keyingset_path);
199 keyingset->active_path = BLI_listbase_count(&keyingset->paths);
200
201 keyingset_path->groupmode = KSP_GROUP_KSNAME; /* XXX? */
202 keyingset_path->idtype = ID_OB;
203 keyingset_path->flag = KSP_FLAG_WHOLE_ARRAY;
204
205 return OPERATOR_FINISHED;
206}
207
209{
210 /* Identifiers. */
211 ot->name = "Add Empty Keying Set Path";
212 ot->idname = "ANIM_OT_keying_set_path_add";
213 ot->description = "Add empty path to active keying set";
214
215 /* Callbacks. */
218}
219
220/* Remove Active Keying Set Path ------------------------- */
221
223{
224 Scene *scene = CTX_data_scene(C);
225 KeyingSet *keyingset = static_cast<KeyingSet *>(
226 BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1));
227
228 /* If there is a KeyingSet, find the nominated path to remove. */
229 if (!keyingset) {
230 BKE_report(op->reports, RPT_ERROR, "No active Keying Set to remove a path from");
231 return OPERATOR_CANCELLED;
232 }
233
234 KS_Path *keyingset_path = static_cast<KS_Path *>(
235 BLI_findlink(&keyingset->paths, keyingset->active_path - 1));
236 if (!keyingset_path) {
237 BKE_report(op->reports, RPT_ERROR, "No active Keying Set path to remove");
238 return OPERATOR_CANCELLED;
239 }
240
241 /* Remove the active path from the KeyingSet. */
242 BKE_keyingset_free_path(keyingset, keyingset_path);
243
244 /* The active path should now be the previously second-to-last active one. */
245 keyingset->active_path--;
246
247 return OPERATOR_FINISHED;
248}
249
251{
252 /* Identifiers. */
253 ot->name = "Remove Active Keying Set Path";
254 ot->idname = "ANIM_OT_keying_set_path_remove";
255 ot->description = "Remove active Path from active keying set";
256
257 /* Callbacks. */
260}
261
262/* ************************************************** */
263/* KEYING SETS - OPERATORS (for use in UI menus) */
264
265/* Add to KeyingSet Button Operator ------------------------ */
266
268{
269 PropertyRNA *prop = nullptr;
270 PointerRNA ptr = {nullptr};
271 int index = 0, pflag = 0;
272
273 if (!UI_context_active_but_prop_get(C, &ptr, &prop, &index)) {
274 /* Pass event on if no active button found. */
276 }
277
278 /* Verify the Keying Set to use:
279 * - use the active one for now (more control over this can be added later)
280 * - add a new one if it doesn't exist
281 */
282 KeyingSet *keyingset = nullptr;
283 Scene *scene = CTX_data_scene(C);
284 if (scene->active_keyingset == 0) {
285 /* Validate flags
286 * - absolute KeyingSets should be created by default
287 */
289
291
292 /* Call the API func, and set the active keyingset index. */
293 keyingset = BKE_keyingset_add(
294 &scene->keyingsets, "ButtonKeyingSet", "Button Keying Set", flag, keyingflag);
295
296 scene->active_keyingset = BLI_listbase_count(&scene->keyingsets);
297 }
298 else if (scene->active_keyingset < 0) {
299 BKE_report(op->reports, RPT_ERROR, "Cannot add property to built in keying set");
300 return OPERATOR_CANCELLED;
301 }
302 else {
303 keyingset = static_cast<KeyingSet *>(
304 BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1));
305 }
306
307 /* Check if property is able to be added. */
308 const bool all = RNA_boolean_get(op->ptr, "all");
309 bool changed = false;
310 if (ptr.owner_id && ptr.data && prop && RNA_property_anim_editable(&ptr, prop)) {
311 if (const std::optional<std::string> path = RNA_path_from_ID_to_property(&ptr, prop)) {
312 if (all) {
313 pflag |= KSP_FLAG_WHOLE_ARRAY;
314
315 /* We need to set the index for this to 0, even though it may break in some cases, this is
316 * necessary if we want the entire array for most cases to get included without the user
317 * having to worry about where they clicked.
318 */
319 index = 0;
320 }
321
322 /* Add path to this setting. */
324 keyingset, ptr.owner_id, nullptr, path->c_str(), index, pflag, KSP_GROUP_KSNAME);
325 keyingset->active_path = BLI_listbase_count(&keyingset->paths);
326 changed = true;
327 }
328 }
329
330 if (changed) {
332
333 /* Show notification/report header, so that users notice that something changed. */
334 BKE_reportf(op->reports, RPT_INFO, "Property added to Keying Set: '%s'", keyingset->name);
335 }
336
337 return (changed) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
338}
339
341{
342 /* Identifiers. */
343 ot->name = "Add to Keying Set";
344 ot->idname = "ANIM_OT_keyingset_button_add";
345 ot->description = "Add current UI-active property to current keying set";
346
347 /* Callbacks. */
349 // op->poll = ???
350
351 /* Flags. */
353
354 /* Properties. */
355 RNA_def_boolean(ot->srna, "all", true, "All", "Add all elements of the array to a Keying Set");
356}
357
358/* Remove from KeyingSet Button Operator ------------------------ */
359
361{
362 PropertyRNA *prop = nullptr;
363 PointerRNA ptr = {nullptr};
364 int index = 0;
365
366 if (!UI_context_active_but_prop_get(C, &ptr, &prop, &index)) {
367 /* Pass event on if no active button found. */
369 }
370
371 /* Verify the Keying Set to use:
372 * - use the active one for now (more control over this can be added later)
373 * - return error if it doesn't exist
374 */
375 Scene *scene = CTX_data_scene(C);
376 if (scene->active_keyingset == 0) {
377 BKE_report(op->reports, RPT_ERROR, "No active Keying Set to remove property from");
378 return OPERATOR_CANCELLED;
379 }
380
381 if (scene->active_keyingset < 0) {
382 BKE_report(op->reports, RPT_ERROR, "Cannot remove property from built in keying set");
383 return OPERATOR_CANCELLED;
384 }
385
386 KeyingSet *keyingset = static_cast<KeyingSet *>(
387 BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1));
388
389 bool changed = false;
390 if (ptr.owner_id && ptr.data && prop) {
391 if (const std::optional<std::string> path = RNA_path_from_ID_to_property(&ptr, prop)) {
392 /* Try to find a path matching this description. */
393 KS_Path *keyingset_path = BKE_keyingset_find_path(
394 keyingset, ptr.owner_id, keyingset->name, path->c_str(), index, KSP_GROUP_KSNAME);
395
396 if (keyingset_path) {
397 BKE_keyingset_free_path(keyingset, keyingset_path);
398 changed = true;
399 }
400 }
401 }
402
403 if (changed) {
405
406 /* Show warning. */
407 BKE_report(op->reports, RPT_INFO, "Property removed from keying set");
408 }
409
410 return (changed) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
411}
412
414{
415 /* Identifiers. */
416 ot->name = "Remove from Keying Set";
417 ot->idname = "ANIM_OT_keyingset_button_remove";
418 ot->description = "Remove current UI-active property from current keying set";
419
420 /* Callbacks. */
422 // op->poll = ???
423
424 /* Flags. */
426}
427
428/* ******************************************* */
429
430/* Change Active KeyingSet Operator ------------------------ */
431/* This operator checks if a menu should be shown
432 * for choosing the KeyingSet to make the active one. */
433
434static int keyingset_active_menu_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
435{
436 uiPopupMenu *pup;
437 uiLayout *layout;
438
439 /* Call the menu, which will call this operator again, hence the canceled. */
440 pup = UI_popup_menu_begin(C, op->type->name, ICON_NONE);
441 layout = UI_popup_menu_layout(pup);
442 uiItemsEnumO(layout, "ANIM_OT_keying_set_active_set", "type");
443 UI_popup_menu_end(C, pup);
444
445 return OPERATOR_INTERFACE;
446}
447
449{
450 Scene *scene = CTX_data_scene(C);
451 const int type = RNA_enum_get(op->ptr, "type");
452
453 /* If type == 0, it will deselect any active keying set. */
454 scene->active_keyingset = type;
455
457
458 return OPERATOR_FINISHED;
459}
460
461/* Build the enum for all keyingsets except the active keyingset. */
462static void build_keyingset_enum(bContext *C, EnumPropertyItem **item, int *totitem, bool *r_free)
463{
464 /* user-defined Keying Sets
465 * - these are listed in the order in which they were defined for the active scene
466 */
467 EnumPropertyItem item_tmp = {0};
468
469 Scene *scene = CTX_data_scene(C);
470 KeyingSet *keyingset;
471 int enum_index = 1;
472 if (scene->keyingsets.first) {
473 for (keyingset = static_cast<KeyingSet *>(scene->keyingsets.first); keyingset;
474 keyingset = keyingset->next, enum_index++)
475 {
476 if (ANIM_keyingset_context_ok_poll(C, keyingset)) {
477 item_tmp.identifier = keyingset->idname;
478 item_tmp.name = keyingset->name;
479 item_tmp.description = keyingset->description;
480 item_tmp.value = enum_index;
481 RNA_enum_item_add(item, totitem, &item_tmp);
482 }
483 }
484
485 RNA_enum_item_add_separator(item, totitem);
486 }
487
488 /* Builtin Keying Sets. */
489 enum_index = -1;
490 for (keyingset = static_cast<KeyingSet *>(builtin_keyingsets.first); keyingset;
491 keyingset = keyingset->next, enum_index--)
492 {
493 /* Only show KeyingSet if context is suitable. */
494 if (ANIM_keyingset_context_ok_poll(C, keyingset)) {
495 item_tmp.identifier = keyingset->idname;
496 item_tmp.name = keyingset->name;
497 item_tmp.description = keyingset->description;
498 item_tmp.value = enum_index;
499 RNA_enum_item_add(item, totitem, &item_tmp);
500 }
501 }
502
503 RNA_enum_item_end(item, totitem);
504 *r_free = true;
505}
506
508 PointerRNA * /*ptr*/,
509 PropertyRNA * /*prop*/,
510 bool *r_free)
511{
512 if (C == nullptr) {
514 }
515
516 /* Active Keying Set.
517 * - only include entry if it exists
518 */
519 Scene *scene = CTX_data_scene(C);
520 EnumPropertyItem *item = nullptr, item_tmp = {0};
521 int totitem = 0;
522 if (scene->active_keyingset) {
523 /* Active Keying Set. */
524 item_tmp.identifier = "__ACTIVE__";
525 item_tmp.name = "Clear Active Keying Set";
526 item_tmp.value = 0;
527 RNA_enum_item_add(&item, &totitem, &item_tmp);
528
529 RNA_enum_item_add_separator(&item, &totitem);
530 }
531
532 build_keyingset_enum(C, &item, &totitem, r_free);
533
534 return item;
535}
536
538{
539 PropertyRNA *prop;
540
541 /* Identifiers. */
542 ot->name = "Set Active Keying Set";
543 ot->idname = "ANIM_OT_keying_set_active_set";
544 ot->description = "Set a new active keying set";
545
546 /* Callbacks. */
550
551 /* Flags. */
553
554 /* Keyingset to use (dynamic enum). */
555 prop = RNA_def_enum(
556 ot->srna, "type", rna_enum_dummy_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
558}
559
560/* ******************************************* */
561/* REGISTERED KEYING SETS */
562
563/* Keying Set Type Info declarations. */
564static ListBase keyingset_type_infos = {nullptr, nullptr};
565
566ListBase builtin_keyingsets = {nullptr, nullptr};
567
568/* --------------- */
569
571{
572 if ((name == nullptr) || (name[0] == 0)) {
573 return nullptr;
574 }
575
576 /* Search by comparing names. */
577 return static_cast<KeyingSetInfo *>(
579}
580
582{
583 if (name[0] == 0) {
584 return nullptr;
585 }
586
587 /* Loop over KeyingSets checking names. */
589 if (STREQ(name, keyingset->idname)) {
590 return keyingset;
591 }
592 }
593
594/* Complain about missing keying sets on debug builds. */
595#ifndef NDEBUG
596 printf("%s: '%s' not found\n", __func__, name);
597#endif
598
599 /* no matches found */
600 return nullptr;
601}
602
603/* --------------- */
604
606{
607 /* Create a new KeyingSet
608 * - inherit name and keyframing settings from the typeinfo
609 */
611 keyingset_info->idname,
612 keyingset_info->name,
613 1,
614 keyingset_info->keyingflag);
615
616 /* Link this KeyingSet with its typeinfo. */
617 memcpy(&keyingset->typeinfo, keyingset_info->idname, sizeof(keyingset->typeinfo));
618
619 /* Copy description. */
620 STRNCPY(keyingset->description, keyingset_info->description);
621
622 /* Add type-info to the list. */
623 BLI_addtail(&keyingset_type_infos, keyingset_info);
624}
625
627{
628 /* Find relevant builtin KeyingSets which use this, and remove them. */
629 /* TODO: this isn't done now, since unregister is really only used at the moment when we
630 * reload the scripts, which kind of defeats the purpose of "builtin"? */
632 /* Remove if matching typeinfo name. */
633 if (!STREQ(keyingset->typeinfo, keyingset_info->idname)) {
634 continue;
635 }
636 Scene *scene;
637 BKE_keyingset_free_paths(keyingset);
638 BLI_remlink(&builtin_keyingsets, keyingset);
639
640 for (scene = static_cast<Scene *>(bmain->scenes.first); scene;
641 scene = static_cast<Scene *>(scene->id.next))
642 {
643 BLI_remlink_safe(&scene->keyingsets, keyingset);
644 }
645
646 MEM_freeN(keyingset);
647 }
648
649 BLI_freelinkN(&keyingset_type_infos, keyingset_info);
650}
651
653{
654 /* Free type infos. */
656 /* Free extra RNA data, and remove from list. */
657 if (keyingset_info->rna_ext.free) {
658 keyingset_info->rna_ext.free(keyingset_info->rna_ext.data);
659 }
660 BLI_freelinkN(&keyingset_type_infos, keyingset_info);
661 }
662
664}
665
667{
668 if (ELEM(nullptr, keyingset, id)) {
669 return false;
670 }
671
672 return BLI_findptr(&keyingset->paths, id, offsetof(KS_Path, id)) != nullptr;
673}
674
675/* ******************************************* */
676/* KEYING SETS API (for UI) */
677
678/* Getters for Active/Indices ----------------------------- */
679
681{
682 /* If no scene, we've got no hope of finding the Keying Set. */
683 if (scene == nullptr) {
684 return nullptr;
685 }
686
687 /* Currently, there are several possibilities here:
688 * - 0: no active keying set
689 * - > 0: one of the user-defined Keying Sets, but indices start from 0 (hence the -1)
690 * - < 0: a builtin keying set
691 */
692 if (scene->active_keyingset > 0) {
693 return static_cast<KeyingSet *>(BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1));
694 }
695 return static_cast<KeyingSet *>(
696 BLI_findlink(&builtin_keyingsets, (-scene->active_keyingset) - 1));
697}
698
700{
701 int index;
702
703 /* If no KeyingSet provided, have none. */
704 if (keyingset == nullptr) {
705 return 0;
706 }
707
708 /* Check if the KeyingSet exists in scene list. */
709 if (scene) {
710 /* Get index and if valid, return
711 * - (absolute) Scene KeyingSets are from (>= 1)
712 */
713 index = BLI_findindex(&scene->keyingsets, keyingset);
714 if (index != -1) {
715 return (index + 1);
716 }
717 }
718
719 /* Still here, so try built-ins list too:
720 * - Built-ins are from (<= -1).
721 * - None/Invalid is (= 0).
722 */
723 index = BLI_findindex(&builtin_keyingsets, keyingset);
724 if (index != -1) {
725 return -(index + 1);
726 }
727 return 0;
728}
729
730KeyingSet *ANIM_get_keyingset_for_autokeying(const Scene *scene, const char *transformKSName)
731{
732 /* Get KeyingSet to use
733 * - use the active KeyingSet if defined (and user wants to use it for all autokeying),
734 * or otherwise key transforms only
735 */
737 (scene->active_keyingset))
738 {
740 }
741
744 }
745
746 return ANIM_builtin_keyingset_get_named(transformKSName);
747}
748
750 const bContext *C,
752 const bool use_poll)
753{
754 /* Poll requires context. */
755 if (use_poll && (C == nullptr)) {
756 return;
757 }
758
759 Scene *scene = C ? CTX_data_scene(C) : nullptr;
760
761 /* Active Keying Set. */
762 if (!use_poll || (scene && scene->active_keyingset)) {
763 StringPropertySearchVisitParams visit_params{};
764 visit_params.text = "__ACTIVE__";
765 visit_params.info = "Active Keying Set";
766 visit_fn(visit_params);
767 }
768
769 /* User-defined Keying Sets. */
770 if (scene && scene->keyingsets.first) {
771 LISTBASE_FOREACH (KeyingSet *, keyingset, &scene->keyingsets) {
772 if (use_poll && !ANIM_keyingset_context_ok_poll((bContext *)C, keyingset)) {
773 continue;
774 }
775 StringPropertySearchVisitParams visit_params{};
776 visit_params.text = keyingset->idname;
777 visit_params.info = keyingset->name;
778 visit_fn(visit_params);
779 }
780 }
781
782 /* Builtin Keying Sets. */
784 if (use_poll && !ANIM_keyingset_context_ok_poll((bContext *)C, keyingset)) {
785 continue;
786 }
787 StringPropertySearchVisitParams visit_params{};
788 visit_params.text = keyingset->idname;
789 visit_params.info = keyingset->name;
790 visit_fn(visit_params);
791 }
792}
793
795 const bContext *C,
796 PointerRNA * /*ptr*/,
797 PropertyRNA * /*prop*/,
798 const char * /*edit_text*/,
800{
801 anim_keyingset_visit_for_search_impl(C, visit_fn, false);
802}
803
805 const bContext *C,
806 PointerRNA * /*ptr*/,
807 PropertyRNA * /*prop*/,
808 const char * /*edit_text*/,
810{
811 anim_keyingset_visit_for_search_impl(C, visit_fn, true);
812}
813
814/* Menu of All Keying Sets ----------------------------- */
815
817 PointerRNA * /*ptr*/,
818 PropertyRNA * /*prop*/,
819 bool *r_free)
820{
821 if (C == nullptr) {
823 }
824
825 /* Active Keying Set
826 * - only include entry if it exists
827 */
828 Scene *scene = CTX_data_scene(C);
829 EnumPropertyItem *item = nullptr, item_tmp = {0};
830 int totitem = 0;
831 if (scene->active_keyingset) {
832 /* Active Keying Set. */
833 item_tmp.identifier = "__ACTIVE__";
834 item_tmp.name = "Active Keying Set";
835 item_tmp.value = 0;
836 RNA_enum_item_add(&item, &totitem, &item_tmp);
837
838 RNA_enum_item_add_separator(&item, &totitem);
839 }
840
841 build_keyingset_enum(C, &item, &totitem, r_free);
842
843 return item;
844}
845
847{
848 if (type == 0) {
849 type = scene->active_keyingset;
850 }
851
852 if (type > 0) {
853 return static_cast<KeyingSet *>(BLI_findlink(&scene->keyingsets, type - 1));
854 }
855 else {
856 return static_cast<KeyingSet *>(BLI_findlink(&builtin_keyingsets, -type - 1));
857 }
858 return nullptr;
859}
860
862{
863 KeyingSet *keyingset = static_cast<KeyingSet *>(
864 BLI_findstring(&scene->keyingsets, idname, offsetof(KeyingSet, idname)));
865 if (keyingset == nullptr) {
866 keyingset = static_cast<KeyingSet *>(
868 }
869 return keyingset;
870}
871
872/* ******************************************* */
873/* KEYFRAME MODIFICATION */
874
875/* Polling API ----------------------------------------------- */
876
878{
879 if (keyingset->flag & KEYINGSET_ABSOLUTE) {
880 return true;
881 }
882
883 KeyingSetInfo *keyingset_info = ANIM_keyingset_info_find_name(keyingset->typeinfo);
884
885 /* Get the associated 'type info' for this KeyingSet. */
886 if (keyingset_info == nullptr) {
887 return false;
888 }
889 /* TODO: check for missing callbacks! */
890
891 /* Check if it can be used in the current context. */
892 return keyingset_info->poll(keyingset_info, C);
893}
894
895/* Special 'Overrides' Iterator for Relative KeyingSets ------ */
896
897/* Iterator used for overriding the behavior of iterators defined for
898 * relative Keying Sets, with the main usage of this being operators
899 * requiring Auto Keyframing. Internal Use Only!
900 */
901static void RKS_ITER_overrides_list(KeyingSetInfo *keyingset_info,
902 bContext *C,
903 KeyingSet *keyingset,
905{
906 for (PointerRNA ptr : sources) {
907 /* Run generate callback on this data. */
908 keyingset_info->generate(keyingset_info, C, keyingset, &ptr);
909 }
910}
911
913 ID *id,
914 StructRNA *srna,
915 void *data)
916{
917 if (ELEM(nullptr, srna, data, id)) {
918 return;
919 }
920 sources.append(RNA_pointer_create(id, srna, data));
921}
922
924{
925 if (id == nullptr) {
926 return;
927 }
928 sources.append(RNA_id_pointer_create(id));
929}
930
931/* KeyingSet Operations (Insert/Delete Keyframes) ------------ */
932
935 KeyingSet *keyingset)
936{
937 using namespace blender::animrig;
938 if (keyingset == nullptr) {
939 return ModifyKeyReturn::SUCCESS;
940 }
941
942 /* If relative Keying Sets, poll and build up the paths. */
943 if (keyingset->flag & KEYINGSET_ABSOLUTE) {
944 return ModifyKeyReturn::SUCCESS;
945 }
946
947 KeyingSetInfo *keyingset_info = ANIM_keyingset_info_find_name(keyingset->typeinfo);
948
949 /* Clear all existing paths
950 * NOTE: BKE_keyingset_free_paths() frees all of the paths for the KeyingSet, but not the set
951 * itself.
952 */
953 BKE_keyingset_free_paths(keyingset);
954
955 /* Get the associated 'type info' for this KeyingSet. */
956 if (keyingset_info == nullptr) {
957 return ModifyKeyReturn::MISSING_TYPEINFO;
958 }
959 /* TODO: check for missing callbacks! */
960
961 /* Check if it can be used in the current context. */
962 if (!keyingset_info->poll(keyingset_info, C)) {
963 /* Poll callback tells us that KeyingSet is useless in current context. */
964 /* FIXME: the poll callback needs to give us more info why. */
965 return ModifyKeyReturn::INVALID_CONTEXT;
966 }
967
968 /* If a list of data sources are provided, run a special iterator over them,
969 * otherwise, just continue per normal.
970 */
971 if (sources != nullptr) {
972 RKS_ITER_overrides_list(keyingset_info, C, keyingset, *sources);
973 }
974 else {
975 keyingset_info->iter(keyingset_info, C, keyingset);
976 }
977
978 /* If we don't have any paths now, then this still qualifies as invalid context. */
979 /* FIXME: we need some error conditions (to be retrieved from the iterator why this failed!)
980 */
981 if (BLI_listbase_is_empty(&keyingset->paths)) {
982 return ModifyKeyReturn::INVALID_CONTEXT;
983 }
984
985 return ModifyKeyReturn::SUCCESS;
986}
987
988/* Determine which keying flags apply based on the override flags. */
990 const eInsertKeyFlags overrides,
991 const eInsertKeyFlags own_flags)
992{
993 /* Pass through all flags by default (i.e. even not explicitly listed ones). */
994 eInsertKeyFlags result = base_flags;
995
996/* The logic for whether a keying flag applies is as follows:
997 * - If the flag in question is set in "overrides", that means that the
998 * status of that flag in "own_flags" is used
999 * - If however the flag isn't set, then its value in "base_flags" is used
1000 * instead (i.e. no override)
1001 */
1002#define APPLY_KEYINGFLAG_OVERRIDE(kflag) \
1003 if (overrides & kflag) { \
1004 result &= ~kflag; \
1005 result |= (own_flags & kflag); \
1006 }
1007
1008 /* Apply the flags one by one...
1009 * (See rna_def_common_keying_flags() for the supported flags)
1010 */
1013
1014#undef APPLY_KEYINGFLAG_OVERRIDE
1015
1016 return result;
1017}
1018
1020 KS_Path *keyingset_path,
1021 KeyingSet *keyingset,
1022 const eInsertKeyFlags insert_key_flags,
1024 const float frame)
1025{
1026 using namespace blender::animrig;
1027 /* Since keying settings can be defined on the paths too,
1028 * apply the settings for this path first. */
1029 const eInsertKeyFlags path_insert_key_flags = keyingset_apply_keying_flags(
1030 insert_key_flags,
1031 eInsertKeyFlags(keyingset_path->keyingoverride),
1032 eInsertKeyFlags(keyingset_path->keyingflag));
1033
1034 const char *groupname = nullptr;
1035 /* Get pointer to name of group to add channels to. */
1036 if (keyingset_path->groupmode == KSP_GROUP_NONE) {
1037 groupname = nullptr;
1038 }
1039 else if (keyingset_path->groupmode == KSP_GROUP_KSNAME) {
1040 groupname = keyingset->name;
1041 }
1042 else {
1043 groupname = keyingset_path->group;
1044 }
1045
1046 /* Init - array_length should be greater than array_index so that
1047 * normal non-array entries get keyframed correctly.
1048 */
1049 int array_index = keyingset_path->array_index;
1050 int array_length = array_index;
1051
1052 /* Get length of array if whole array option is enabled. */
1053 if (keyingset_path->flag & KSP_FLAG_WHOLE_ARRAY) {
1055 PropertyRNA *prop;
1056
1057 PointerRNA id_ptr = RNA_id_pointer_create(keyingset_path->id);
1058 if (RNA_path_resolve_property(&id_ptr, keyingset_path->rna_path, &ptr, &prop)) {
1059 array_length = RNA_property_array_length(&ptr, prop);
1060 /* Start from start of array, instead of the previously specified index - #48020 */
1061 array_index = 0;
1062 }
1063 }
1064
1065 /* We should do at least one step. */
1066 if (array_length == array_index) {
1067 array_length++;
1068 }
1069
1070 Main *bmain = CTX_data_main(C);
1071 ReportList *reports = CTX_wm_reports(C);
1072 Scene *scene = CTX_data_scene(C);
1074 scene->toolsettings->keyframe_type);
1075 /* For each possible index, perform operation
1076 * - Assume that array-length is greater than index. */
1077 Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
1079 frame);
1080 int keyed_channels = 0;
1081
1082 CombinedKeyingResult combined_result;
1083 for (; array_index < array_length; array_index++) {
1084 if (mode == ModifyKeyMode::INSERT) {
1085 const std::optional<blender::StringRefNull> group = groupname ? std::optional(groupname) :
1086 std::nullopt;
1087 const std::optional<int> index = array_index >= 0 ? std::optional(array_index) :
1088 std::nullopt;
1089 PointerRNA id_rna_pointer = RNA_id_pointer_create(keyingset_path->id);
1090 CombinedKeyingResult result = insert_keyframes(bmain,
1091 &id_rna_pointer,
1092 group,
1093 {{keyingset_path->rna_path, {}, index}},
1094 std::nullopt,
1095 anim_eval_context,
1096 keytype,
1097 path_insert_key_flags);
1098 keyed_channels += result.get_count(SingleKeyingResult::SUCCESS);
1099 combined_result.merge(result);
1100 }
1101 else if (mode == ModifyKeyMode::DELETE) {
1102 RNAPath rna_path = {keyingset_path->rna_path, std::nullopt, array_index};
1103 if (array_index < 0) {
1104 rna_path.index = std::nullopt;
1105 }
1106 keyed_channels += delete_keyframe(bmain, reports, keyingset_path->id, rna_path, frame);
1107 }
1108 }
1109
1110 if (combined_result.get_count(SingleKeyingResult::SUCCESS) == 0) {
1111 combined_result.generate_reports(reports);
1112 }
1113
1114 switch (GS(keyingset_path->id->name)) {
1115 case ID_OB: /* Object (or Object-Related) Keyframes */
1116 {
1117 Object *ob = (Object *)keyingset_path->id;
1118
1119 /* XXX: only object transforms? */
1121 break;
1122 }
1123 default:
1125 break;
1126 }
1127
1128 /* Send notifiers for updates (this doesn't require context to work!). */
1130
1131 return keyed_channels;
1132}
1133
1136 KeyingSet *keyingset,
1138 const float cfra)
1139{
1140 using namespace blender::animrig;
1141 if (keyingset == nullptr) {
1142 return 0;
1143 }
1144
1145 Scene *scene = CTX_data_scene(C);
1146 const eInsertKeyFlags base_kflags = get_keyframing_flags(scene);
1148 if (mode == ModifyKeyMode::INSERT) {
1149 /* use context settings as base */
1150 kflag = keyingset_apply_keying_flags(base_kflags,
1151 eInsertKeyFlags(keyingset->keyingoverride),
1152 eInsertKeyFlags(keyingset->keyingflag));
1153 }
1154 else if (mode == ModifyKeyMode::DELETE) {
1155 kflag = INSERTKEY_NOFLAGS;
1156 }
1157
1158 /* If relative Keying Sets, poll and build up the paths. */
1159 {
1160 const ModifyKeyReturn error = ANIM_validate_keyingset(C, sources, keyingset);
1161 if (error != ModifyKeyReturn::SUCCESS) {
1162 BLI_assert(int(error) < 0);
1163 return int(error);
1164 }
1165 }
1166
1167 ReportList *reports = CTX_wm_reports(C);
1168 int keyed_channels = 0;
1169
1170 /* Apply the paths as specified in the KeyingSet now. */
1171 LISTBASE_FOREACH (KS_Path *, keyingset_path, &keyingset->paths) {
1172 /* Skip path if no ID pointer is specified. */
1173 if (keyingset_path->id == nullptr) {
1174 BKE_reportf(reports,
1176 "Skipping path in keying set, as it has no ID (KS = '%s', path = '%s[%d]')",
1177 keyingset->name,
1178 keyingset_path->rna_path,
1179 keyingset_path->array_index);
1180 continue;
1181 }
1182
1183 keyed_channels += insert_key_to_keying_set_path(
1184 C, keyingset_path, keyingset, kflag, mode, cfra);
1185 }
1186
1187 /* Return the number of channels successfully affected. */
1188 BLI_assert(keyed_channels >= 0);
1189 return keyed_channels;
1190}
1191
1192/* ************************************************** */
Functions to insert, delete or modify keyframes.
Functionality to interact with keying sets.
struct KS_Path * BKE_keyingset_find_path(struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, int group_mode)
Definition anim_sys.cc:84
void BKE_keyingsets_free(struct ListBase *list)
Definition anim_sys.cc:283
AnimationEvalContext BKE_animsys_eval_context_construct(struct Depsgraph *depsgraph, float eval_time) ATTR_WARN_UNUSED_RESULT
Definition anim_sys.cc:734
void BKE_keyingset_free_paths(struct KeyingSet *ks)
Definition anim_sys.cc:267
struct KeyingSet * BKE_keyingset_add(struct ListBase *list, const char idname[], const char name[], short flag, short keyingflag)
Definition anim_sys.cc:134
struct KS_Path * BKE_keyingset_add_path(struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, short flag, short groupmode)
Definition anim_sys.cc:164
void BKE_keyingset_free_path(struct KeyingSet *ks, struct KS_Path *ksp)
Definition anim_sys.cc:227
ReportList * CTX_wm_reports(const bContext *C)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:125
#define BLI_assert(a)
Definition BLI_assert.h:50
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
void * BLI_findstring(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:269
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool BLI_remlink_safe(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:153
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:110
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:130
void * BLI_findptr(const struct ListBase *listbase, const void *ptr, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define STRNCPY(dst, src)
Definition BLI_string.h:593
#define ELEM(...)
#define STREQ(a, b)
void DEG_id_tag_update(ID *id, unsigned int flags)
@ ID_RECALC_TRANSFORM
Definition DNA_ID.h:1021
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1041
@ ID_RECALC_ANIMATION_NO_FLUSH
Definition DNA_ID.h:1143
@ ID_OB
eKS_Settings
@ KEYINGSET_ABSOLUTE
eInsertKeyFlags
@ INSERTKEY_MATRIX
@ INSERTKEY_NEEDED
@ INSERTKEY_NOFLAGS
@ KSP_GROUP_KSNAME
@ KSP_GROUP_NONE
@ KSP_FLAG_WHOLE_ARRAY
eBezTriple_KeyframeType
Object is a sort of wrapper for general info.
@ AUTOKEY_FLAG_ONLYKEYINGSET
@ AUTOKEY_FLAG_INSERTAVAILABLE
@ OPERATOR_PASS_THROUGH
#define ANIM_KS_AVAILABLE_ID
bool ED_operator_areaactive(bContext *C)
Read Guarded memory(de)allocation.
void UI_popup_menu_end(bContext *C, uiPopupMenu *pup)
uiPopupMenu * UI_popup_menu_begin(bContext *C, const char *title, int icon) ATTR_NONNULL()
uiBut * UI_context_active_but_prop_get(const bContext *C, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
uiLayout * UI_popup_menu_layout(uiPopupMenu *pup)
void uiItemsEnumO(uiLayout *layout, const char *opname, const char *propname)
@ OPTYPE_UNDO
Definition WM_types.hh:162
@ OPTYPE_REGISTER
Definition WM_types.hh:160
#define NC_ANIMATION
Definition WM_types.hh:355
#define ND_KEYINGSET
Definition WM_types.hh:415
#define NC_SCENE
Definition WM_types.hh:345
#define NA_ADDED
Definition WM_types.hh:552
#define ND_KEYFRAME
Definition WM_types.hh:461
void append(const T &value)
void merge(const CombinedKeyingResult &other)
int get_count(const SingleKeyingResult result) const
void generate_reports(ReportList *reports, eReportType report_level=RPT_ERROR)
#define printf
const Depsgraph * depsgraph
#define offsetof(t, d)
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
#define GS(x)
Definition iris.cc:202
void ANIM_keyingset_visit_for_search_no_poll(const bContext *C, PointerRNA *, PropertyRNA *, const char *, blender::FunctionRef< void(StringPropertySearchVisitParams)> visit_fn)
int ANIM_scene_get_keyingset_index(Scene *scene, KeyingSet *keyingset)
KeyingSetInfo * ANIM_keyingset_info_find_name(const char name[])
static ListBase keyingset_type_infos
void ANIM_relative_keyingset_add_source(blender::Vector< PointerRNA > &sources, ID *id, StructRNA *srna, void *data)
void ANIM_OT_keying_set_add(wmOperatorType *ot)
void ANIM_keyingset_infos_exit()
bool ANIM_keyingset_find_id(KeyingSet *keyingset, ID *id)
static int keyingset_active_menu_exec(bContext *C, wmOperator *op)
KeyingSet * ANIM_scene_get_active_keyingset(const Scene *scene)
static int insert_key_to_keying_set_path(bContext *C, KS_Path *keyingset_path, KeyingSet *keyingset, const eInsertKeyFlags insert_key_flags, const blender::animrig::ModifyKeyMode mode, const float frame)
static int remove_keyingset_button_exec(bContext *C, wmOperator *op)
static int remove_active_keyingset_exec(bContext *C, wmOperator *op)
static bool keyingset_poll_active_edit(bContext *C)
Definition keyingsets.cc:64
KeyingSet * ANIM_keyingset_get_from_idname(Scene *scene, const char *idname)
static eInsertKeyFlags keyingset_apply_keying_flags(const eInsertKeyFlags base_flags, const eInsertKeyFlags overrides, const eInsertKeyFlags own_flags)
void ANIM_OT_keying_set_path_remove(wmOperatorType *ot)
bool ANIM_keyingset_context_ok_poll(bContext *C, KeyingSet *keyingset)
void ANIM_keyingset_visit_for_search(const bContext *C, PointerRNA *, PropertyRNA *, const char *, blender::FunctionRef< void(StringPropertySearchVisitParams)> visit_fn)
static void build_keyingset_enum(bContext *C, EnumPropertyItem **item, int *totitem, bool *r_free)
void ANIM_keyingset_info_unregister(Main *bmain, KeyingSetInfo *keyingset_info)
static bool keyingset_poll_activePath_edit(bContext *C)
Definition keyingsets.cc:77
void ANIM_OT_keyingset_button_add(wmOperatorType *ot)
static const EnumPropertyItem * keyingset_set_active_enum_itemf(bContext *C, PointerRNA *, PropertyRNA *, bool *r_free)
static void RKS_ITER_overrides_list(KeyingSetInfo *keyingset_info, bContext *C, KeyingSet *keyingset, blender::Vector< PointerRNA > &sources)
void ANIM_OT_keying_set_remove(wmOperatorType *ot)
static bool keyingset_poll_default_add(bContext *C)
Definition keyingsets.cc:57
static int add_default_keyingset_exec(bContext *C, wmOperator *)
Definition keyingsets.cc:97
static int add_empty_ks_path_exec(bContext *C, wmOperator *op)
static int add_keyingset_button_exec(bContext *C, wmOperator *op)
static int keyingset_active_menu_invoke(bContext *C, wmOperator *op, const wmEvent *)
ListBase builtin_keyingsets
void ANIM_OT_keying_set_active_set(wmOperatorType *ot)
void ANIM_keyingset_info_register(KeyingSetInfo *keyingset_info)
blender::animrig::ModifyKeyReturn ANIM_validate_keyingset(bContext *C, blender::Vector< PointerRNA > *sources, KeyingSet *keyingset)
void ANIM_OT_keyingset_button_remove(wmOperatorType *ot)
void ANIM_OT_keying_set_path_add(wmOperatorType *ot)
static void anim_keyingset_visit_for_search_impl(const bContext *C, blender::FunctionRef< void(StringPropertySearchVisitParams)> visit_fn, const bool use_poll)
KeyingSet * ANIM_keyingset_get_from_enum_type(Scene *scene, int type)
#define APPLY_KEYINGFLAG_OVERRIDE(kflag)
KeyingSet * ANIM_get_keyingset_for_autokeying(const Scene *scene, const char *transformKSName)
const EnumPropertyItem * ANIM_keying_sets_enum_itemf(bContext *C, PointerRNA *, PropertyRNA *, bool *r_free)
KeyingSet * ANIM_builtin_keyingset_get_named(const char name[])
static int remove_active_ks_path_exec(bContext *C, wmOperator *op)
int ANIM_apply_keyingset(bContext *C, blender::Vector< PointerRNA > *sources, KeyingSet *keyingset, const blender::animrig::ModifyKeyMode mode, const float cfra)
void MEM_freeN(void *vmemh)
Definition mallocn.cc:105
void *(* MEM_callocN)(size_t len, const char *str)
Definition mallocn.cc:42
static void error(const char *str)
bool is_keying_flag(const Scene *scene, eKeying_Flag flag)
eInsertKeyFlags get_keyframing_flags(Scene *scene)
bool RNA_property_anim_editable(const PointerRNA *ptr, PropertyRNA *prop_orig)
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
PointerRNA RNA_pointer_create(ID *id, StructRNA *type, void *data)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PointerRNA RNA_id_pointer_create(ID *id)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_enum_item_add_separator(EnumPropertyItem **items, int *totitem)
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
std::optional< std::string > RNA_path_from_ID_to_property(const PointerRNA *ptr, PropertyRNA *prop)
Definition rna_path.cc:1166
bool RNA_path_resolve_property(const PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop)
Definition rna_path.cc:553
const EnumPropertyItem rna_enum_dummy_DEFAULT_items[]
Definition rna_rna.cc:35
const char * identifier
Definition RNA_types.hh:506
const char * name
Definition RNA_types.hh:510
const char * description
Definition RNA_types.hh:512
Definition DNA_ID.h:413
char name[66]
Definition DNA_ID.h:425
short keyingoverride
char group[64]
short keyingflag
short groupmode
char * rna_path
cbKeyingSet_Generate generate
char description[1024]
cbKeyingSet_Iterator iter
cbKeyingSet_Poll poll
char name[64]
char typeinfo[64]
char idname[64]
struct KeyingSet * next
ListBase paths
short keyingoverride
char description[1024]
void * first
ListBase scenes
Definition BKE_main.hh:210
ID * owner_id
Definition RNA_types.hh:40
void * data
Definition RNA_types.hh:42
std::optional< int > index
Definition RNA_path.hh:66
const char * name
Definition WM_types.hh:990
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1042
const char * idname
Definition WM_types.hh:992
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1022
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1006
const char * description
Definition WM_types.hh:996
StructRNA * srna
Definition WM_types.hh:1080
struct ReportList * reports
struct wmOperatorType * type
struct PointerRNA * ptr
void WM_main_add_notifier(uint type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4126
wmOperatorType * ot
Definition wm_files.cc:4125
uint8_t flag
Definition wm_window.cc:138