Blender  V3.3
screen_context.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2008 Blender Foundation. All rights reserved. */
3 
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11 
12 #include "MEM_guardedalloc.h"
13 
14 #include "DNA_anim_types.h"
15 #include "DNA_armature_types.h"
16 #include "DNA_gpencil_types.h"
17 #include "DNA_object_types.h"
18 #include "DNA_scene_types.h"
19 #include "DNA_screen_types.h"
20 #include "DNA_sequence_types.h"
21 #include "DNA_space_types.h"
23 #include "DNA_workspace_types.h"
24 
25 #include "BLI_ghash.h"
26 #include "BLI_listbase.h"
27 #include "BLI_utildefines.h"
28 
29 #include "BKE_action.h"
30 #include "BKE_armature.h"
31 #include "BKE_blender.h"
32 #include "BKE_context.h"
33 #include "BKE_gpencil.h"
34 #include "BKE_layer.h"
35 #include "BKE_object.h"
36 #include "BKE_tracking.h"
37 
38 #include "RNA_access.h"
39 #include "RNA_prototypes.h"
40 
41 #include "ED_anim_api.h"
42 #include "ED_armature.h"
43 #include "ED_clip.h"
44 #include "ED_gpencil.h"
45 
46 #include "SEQ_channels.h"
47 #include "SEQ_select.h"
48 #include "SEQ_sequencer.h"
49 #include "SEQ_transform.h"
50 
51 #include "UI_interface.h"
52 #include "WM_api.h"
53 
54 #include "screen_intern.h"
55 
56 const char *screen_context_dir[] = {
57  "scene",
58  "view_layer",
59  "visible_objects",
60  "selectable_objects",
61  "selected_objects",
62  "editable_objects",
63  "selected_editable_objects",
64  "objects_in_mode",
65  "objects_in_mode_unique_data",
66  "visible_bones",
67  "editable_bones",
68  "selected_bones",
69  "selected_editable_bones",
70  "visible_pose_bones",
71  "selected_pose_bones",
72  "selected_pose_bones_from_active_object",
73  "active_bone",
74  "active_pose_bone",
75  "active_object",
76  "object",
77  "edit_object",
78  "sculpt_object",
79  "vertex_paint_object",
80  "weight_paint_object",
81  "image_paint_object",
82  "particle_edit_object",
83  "pose_object",
84  "active_sequence_strip",
85  "sequences",
86  "selected_sequences",
87  "selected_editable_sequences", /* sequencer */
88  "active_nla_track",
89  "active_nla_strip",
90  "selected_nla_strips", /* nla editor */
91  "selected_movieclip_tracks",
92  "gpencil_data",
93  "gpencil_data_owner", /* grease pencil data */
94  "annotation_data",
95  "annotation_data_owner",
96  "visible_gpencil_layers",
97  "editable_gpencil_layers",
98  "editable_gpencil_strokes",
99  "active_gpencil_layer",
100  "active_gpencil_frame",
101  "active_annotation_layer",
102  "active_operator",
103  "active_action",
104  "selected_visible_actions",
105  "selected_editable_actions",
106  "visible_fcurves",
107  "editable_fcurves",
108  "selected_visible_fcurves",
109  "selected_editable_fcurves",
110  "active_editable_fcurve",
111  "selected_editable_keyframes",
112  "ui_list",
113  "asset_library_ref",
114  NULL,
115 };
116 
117 /* Each function `screen_ctx_XXX()` will be called when the screen context "XXX" is requested.
118  * ensure_ed_screen_context_functions() is responsible for creating the hash map from context
119  * member name to function. */
120 
122 {
123  wmWindow *win = CTX_wm_window(C);
126  return CTX_RESULT_OK;
127 }
129 {
130  wmWindow *win = CTX_wm_window(C);
131  View3D *v3d = CTX_wm_view3d(C); /* This may be NULL in a lot of cases. */
132  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
133 
134  LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
135  if (BASE_VISIBLE(v3d, base)) {
136  CTX_data_id_list_add(result, &base->object->id);
137  }
138  }
140  return CTX_RESULT_OK;
141 }
143 {
144  wmWindow *win = CTX_wm_window(C);
145  View3D *v3d = CTX_wm_view3d(C); /* This may be NULL in a lot of cases. */
146  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
147 
148  LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
149  if (BASE_SELECTABLE(v3d, base)) {
150  CTX_data_id_list_add(result, &base->object->id);
151  }
152  }
154  return CTX_RESULT_OK;
155 }
157 {
158  wmWindow *win = CTX_wm_window(C);
159  View3D *v3d = CTX_wm_view3d(C); /* This may be NULL in a lot of cases. */
160  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
161 
162  LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
163  if (BASE_SELECTED(v3d, base)) {
164  CTX_data_id_list_add(result, &base->object->id);
165  }
166  }
168  return CTX_RESULT_OK;
169 }
172 {
173  wmWindow *win = CTX_wm_window(C);
174  View3D *v3d = CTX_wm_view3d(C); /* This may be NULL in a lot of cases. */
175  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
176 
177  LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
178  if (BASE_SELECTED_EDITABLE(v3d, base)) {
179  CTX_data_id_list_add(result, &base->object->id);
180  }
181  }
183  return CTX_RESULT_OK;
184 }
186 {
187  wmWindow *win = CTX_wm_window(C);
188  View3D *v3d = CTX_wm_view3d(C); /* This may be NULL in a lot of cases. */
189  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
190 
191  /* Visible + Editable, but not necessarily selected */
192  LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
193  if (BASE_EDITABLE(v3d, base)) {
194  CTX_data_id_list_add(result, &base->object->id);
195  }
196  }
198  return CTX_RESULT_OK;
199 }
201 {
202  wmWindow *win = CTX_wm_window(C);
203  View3D *v3d = CTX_wm_view3d(C); /* This may be NULL in a lot of cases. */
204  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
205  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
206 
207  if (obact && (obact->mode != OB_MODE_OBJECT)) {
208  FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, obact->type, obact->mode, ob_iter) {
209  CTX_data_id_list_add(result, &ob_iter->id);
210  }
212  }
214  return CTX_RESULT_OK;
215 }
218 {
219  wmWindow *win = CTX_wm_window(C);
220  View3D *v3d = CTX_wm_view3d(C); /* This may be NULL in a lot of cases. */
221  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
222  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
223 
224  if (obact && (obact->mode != OB_MODE_OBJECT)) {
225  FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, obact->type, obact->mode, ob_iter) {
226  ob_iter->id.tag |= LIB_TAG_DOIT;
227  }
229  FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, obact->type, obact->mode, ob_iter) {
230  if (ob_iter->id.tag & LIB_TAG_DOIT) {
231  ob_iter->id.tag &= ~LIB_TAG_DOIT;
232  CTX_data_id_list_add(result, &ob_iter->id);
233  }
234  }
236  }
238  return CTX_RESULT_OK;
239 }
242  const bool editable_bones)
243 {
244  wmWindow *win = CTX_wm_window(C);
245  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
246  Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
247 
248  bArmature *arm = (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
249  EditBone *flipbone = NULL;
250 
251  if (arm && arm->edbo) {
252  uint objects_len;
254  view_layer, CTX_wm_view3d(C), &objects_len);
255  for (uint i = 0; i < objects_len; i++) {
256  Object *ob = objects[i];
257  arm = ob->data;
258 
259  /* Attention: X-Axis Mirroring is also handled here... */
260  LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
261  /* first and foremost, bone must be visible and selected */
262  if (EBONE_VISIBLE(arm, ebone)) {
263  /* Get 'x-axis mirror equivalent' bone if the X-Axis Mirroring option is enabled
264  * so that most users of this data don't need to explicitly check for it themselves.
265  *
266  * We need to make sure that these mirrored copies are not selected, otherwise some
267  * bones will be operated on twice.
268  */
269  if (arm->flag & ARM_MIRROR_EDIT) {
270  flipbone = ED_armature_ebone_get_mirrored(arm->edbo, ebone);
271  }
272 
273  /* if we're filtering for editable too, use the check for that instead,
274  * as it has selection check too */
275  if (editable_bones) {
276  /* only selected + editable */
277  if (EBONE_EDITABLE(ebone)) {
278  CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
279 
280  if ((flipbone) && !(flipbone->flag & BONE_SELECTED)) {
281  CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
282  }
283  }
284  }
285  else {
286  /* only include bones if visible */
287  CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
288 
289  if ((flipbone) && EBONE_VISIBLE(arm, flipbone) == 0) {
290  CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
291  }
292  }
293  }
294  }
295  }
296  MEM_freeN(objects);
297 
299  return CTX_RESULT_OK;
300  }
301  return CTX_RESULT_NO_DATA;
302 }
304 {
306 }
308 {
310 }
313  const bool selected_editable_bones)
314 {
315  wmWindow *win = CTX_wm_window(C);
316  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
317  Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
318  bArmature *arm = (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
319  EditBone *flipbone = NULL;
320 
321  if (arm && arm->edbo) {
322  uint objects_len;
324  view_layer, CTX_wm_view3d(C), &objects_len);
325  for (uint i = 0; i < objects_len; i++) {
326  Object *ob = objects[i];
327  arm = ob->data;
328 
329  /* Attention: X-Axis Mirroring is also handled here... */
330  LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
331  /* first and foremost, bone must be visible and selected */
332  if (EBONE_VISIBLE(arm, ebone) && (ebone->flag & BONE_SELECTED)) {
333  /* Get 'x-axis mirror equivalent' bone if the X-Axis Mirroring option is enabled
334  * so that most users of this data don't need to explicitly check for it themselves.
335  *
336  * We need to make sure that these mirrored copies are not selected, otherwise some
337  * bones will be operated on twice.
338  */
339  if (arm->flag & ARM_MIRROR_EDIT) {
340  flipbone = ED_armature_ebone_get_mirrored(arm->edbo, ebone);
341  }
342 
343  /* if we're filtering for editable too, use the check for that instead,
344  * as it has selection check too */
345  if (selected_editable_bones) {
346  /* only selected + editable */
347  if (EBONE_EDITABLE(ebone)) {
348  CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
349 
350  if ((flipbone) && !(flipbone->flag & BONE_SELECTED)) {
351  CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
352  }
353  }
354  }
355  else {
356  /* only include bones if selected */
357  CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
358 
359  if ((flipbone) && !(flipbone->flag & BONE_SELECTED)) {
360  CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
361  }
362  }
363  }
364  }
365  }
366  MEM_freeN(objects);
367 
369  return CTX_RESULT_OK;
370  }
371  return CTX_RESULT_NO_DATA;
372 }
374 {
375  return screen_ctx_selected_bones_(C, result, false);
376 }
379 {
380  return screen_ctx_selected_bones_(C, result, true);
381 }
383 {
384  wmWindow *win = CTX_wm_window(C);
385  View3D *v3d = CTX_wm_view3d(C); /* This may be NULL in a lot of cases. */
386  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
387  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
388  Object *obpose = BKE_object_pose_armature_get(obact);
389  if (obpose && obpose->pose && obpose->data) {
390  if (obpose != obact) {
391  FOREACH_PCHAN_VISIBLE_IN_OBJECT_BEGIN (obpose, pchan) {
392  CTX_data_list_add(result, &obpose->id, &RNA_PoseBone, pchan);
393  }
395  }
396  else if (obact->mode & OB_MODE_POSE) {
397  FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, OB_ARMATURE, OB_MODE_POSE, ob_iter) {
398  FOREACH_PCHAN_VISIBLE_IN_OBJECT_BEGIN (ob_iter, pchan) {
399  CTX_data_list_add(result, &ob_iter->id, &RNA_PoseBone, pchan);
400  }
402  }
404  }
406  return CTX_RESULT_OK;
407  }
408  return CTX_RESULT_NO_DATA;
409 }
411 {
412  wmWindow *win = CTX_wm_window(C);
413  View3D *v3d = CTX_wm_view3d(C); /* This may be NULL in a lot of cases. */
414  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
415  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
416  Object *obpose = BKE_object_pose_armature_get(obact);
417  if (obpose && obpose->pose && obpose->data) {
418  if (obpose != obact) {
420  CTX_data_list_add(result, &obpose->id, &RNA_PoseBone, pchan);
421  }
423  }
424  else if (obact->mode & OB_MODE_POSE) {
425  FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, OB_ARMATURE, OB_MODE_POSE, ob_iter) {
426  FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN (ob_iter, pchan) {
427  CTX_data_list_add(result, &ob_iter->id, &RNA_PoseBone, pchan);
428  }
430  }
432  }
434  return CTX_RESULT_OK;
435  }
436  return CTX_RESULT_NO_DATA;
437 }
440 {
441  wmWindow *win = CTX_wm_window(C);
442  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
443  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
444  Object *obpose = BKE_object_pose_armature_get(obact);
445  if (obpose && obpose->pose && obpose->data) {
446  if (obpose != obact) {
448  CTX_data_list_add(result, &obpose->id, &RNA_PoseBone, pchan);
449  }
451  }
452  else if (obact->mode & OB_MODE_POSE) {
454  CTX_data_list_add(result, &obact->id, &RNA_PoseBone, pchan);
455  }
457  }
459  return CTX_RESULT_OK;
460  }
461  return CTX_RESULT_NO_DATA;
462 }
464 {
465  wmWindow *win = CTX_wm_window(C);
466  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
467  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
468  if (obact && obact->type == OB_ARMATURE) {
469  bArmature *arm = obact->data;
470  if (arm->edbo) {
471  if (arm->act_edbone) {
472  CTX_data_pointer_set(result, &arm->id, &RNA_EditBone, arm->act_edbone);
473  return CTX_RESULT_OK;
474  }
475  }
476  else {
477  if (arm->act_bone) {
478  CTX_data_pointer_set(result, &arm->id, &RNA_Bone, arm->act_bone);
479  return CTX_RESULT_OK;
480  }
481  }
482  }
483  return CTX_RESULT_NO_DATA;
484 }
486 {
487  wmWindow *win = CTX_wm_window(C);
488  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
489  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
490  Object *obpose = BKE_object_pose_armature_get(obact);
491 
493  if (pchan) {
494  CTX_data_pointer_set(result, &obpose->id, &RNA_PoseBone, pchan);
495  return CTX_RESULT_OK;
496  }
497  return CTX_RESULT_NO_DATA;
498 }
500 {
501  wmWindow *win = CTX_wm_window(C);
502  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
503  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
504 
505  if (obact) {
507  }
508 
509  return CTX_RESULT_OK;
510 }
512 {
513  wmWindow *win = CTX_wm_window(C);
514  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
515  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
516 
517  if (obact) {
519  }
520 
521  return CTX_RESULT_OK;
522 }
524 {
525  wmWindow *win = CTX_wm_window(C);
526  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
527  Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
528  /* convenience for now, 1 object per scene in editmode */
529  if (obedit) {
530  CTX_data_id_pointer_set(result, &obedit->id);
531  }
532 
533  return CTX_RESULT_OK;
534 }
536 {
537  wmWindow *win = CTX_wm_window(C);
538  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
539  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
540 
541  if (obact && (obact->mode & OB_MODE_SCULPT)) {
543  }
544 
545  return CTX_RESULT_OK;
546 }
548 {
549  wmWindow *win = CTX_wm_window(C);
550  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
551  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
552  if (obact && (obact->mode & OB_MODE_VERTEX_PAINT)) {
554  }
555 
556  return CTX_RESULT_OK;
557 }
559 {
560  wmWindow *win = CTX_wm_window(C);
561  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
562  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
563  if (obact && (obact->mode & OB_MODE_ALL_WEIGHT_PAINT)) {
565  }
566 
567  return CTX_RESULT_OK;
568 }
570 {
571  wmWindow *win = CTX_wm_window(C);
572  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
573  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
574  if (obact && (obact->mode & OB_MODE_TEXTURE_PAINT)) {
576  }
577 
578  return CTX_RESULT_OK;
579 }
582 {
583  wmWindow *win = CTX_wm_window(C);
584  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
585  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
586  if (obact && (obact->mode & OB_MODE_PARTICLE_EDIT)) {
588  }
589 
590  return CTX_RESULT_OK;
591 }
593 {
594  wmWindow *win = CTX_wm_window(C);
595  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
596  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
597  Object *obpose = BKE_object_pose_armature_get(obact);
598  if (obpose) {
599  CTX_data_id_pointer_set(result, &obpose->id);
600  }
601  return CTX_RESULT_OK;
602 }
605 {
606  wmWindow *win = CTX_wm_window(C);
609  if (seq) {
610  CTX_data_pointer_set(result, &scene->id, &RNA_Sequence, seq);
611  return CTX_RESULT_OK;
612  }
613  return CTX_RESULT_NO_DATA;
614 }
616 {
617  wmWindow *win = CTX_wm_window(C);
620  if (ed) {
621  LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
622  CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
623  }
625  return CTX_RESULT_OK;
626  }
627  return CTX_RESULT_NO_DATA;
628 }
630 {
631  wmWindow *win = CTX_wm_window(C);
634  if (ed) {
635  LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
636  if (seq->flag & SELECT) {
637  CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
638  }
639  }
641  return CTX_RESULT_OK;
642  }
643  return CTX_RESULT_NO_DATA;
644 }
647 {
648  wmWindow *win = CTX_wm_window(C);
651  if (ed == NULL) {
652  return CTX_RESULT_NO_DATA;
653  }
654 
656  LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
657  if (seq->flag & SELECT && !SEQ_transform_is_locked(channels, seq)) {
658  CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
659  }
660  }
662  return CTX_RESULT_OK;
663 }
664 
666 {
667  PointerRNA ptr;
670  return CTX_RESULT_OK;
671  }
672  return CTX_RESULT_NO_DATA;
673 }
675 {
676  PointerRNA ptr;
679  return CTX_RESULT_OK;
680  }
681  return CTX_RESULT_NO_DATA;
682 }
684 {
685  bAnimContext ac;
686  if (ANIM_animdata_get_context(C, &ac) != 0) {
687  ListBase anim_data = {NULL, NULL};
688 
689  ANIM_animdata_filter(&ac, &anim_data, ANIMFILTER_DATA_VISIBLE, ac.data, ac.datatype);
690  LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) {
691  if (ale->datatype != ALE_NLASTRIP) {
692  continue;
693  }
694  NlaTrack *nlt = (NlaTrack *)ale->data;
695  LISTBASE_FOREACH (NlaStrip *, strip, &nlt->strips) {
696  if (strip->flag & NLASTRIP_FLAG_SELECT) {
697  CTX_data_list_add(result, ale->id, &RNA_NlaStrip, strip);
698  }
699  }
700  }
701  ANIM_animdata_freelist(&anim_data);
702 
704  return CTX_RESULT_OK;
705  }
706  return CTX_RESULT_NO_DATA;
707 }
710 {
711  SpaceClip *space_clip = CTX_wm_space_clip(C);
712  if (space_clip == NULL) {
713  return CTX_RESULT_NO_DATA;
714  }
715  MovieClip *clip = ED_space_clip_get_clip(space_clip);
716  if (clip == NULL) {
717  return CTX_RESULT_NO_DATA;
718  }
719  MovieTracking *tracking = &clip->tracking;
720  if (tracking == NULL) {
721  return CTX_RESULT_NO_DATA;
722  }
723 
724  ListBase *tracks_list = BKE_tracking_get_active_tracks(tracking);
725  LISTBASE_FOREACH (MovieTrackingTrack *, track, tracks_list) {
726  if (!TRACK_SELECTED(track)) {
727  continue;
728  }
729  CTX_data_list_add(result, &clip->id, &RNA_MovieTrackingTrack, track);
730  }
731 
733  return CTX_RESULT_OK;
734 }
736 {
737  wmWindow *win = CTX_wm_window(C);
739  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
740  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
741  /* FIXME: for some reason, CTX_data_active_object(C) returns NULL when called from these
742  * situations (as outlined above - see Campbell's #ifdefs).
743  * That causes the get_active function to fail when called from context.
744  * For that reason, we end up using an alternative where we pass everything in!
745  */
747 
748  if (gpd) {
750  return CTX_RESULT_OK;
751  }
752  return CTX_RESULT_NO_DATA;
753 }
755 {
756  wmWindow *win = CTX_wm_window(C);
758  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
759  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
760 
761  /* Pointer to which data/datablock owns the reference to the Grease Pencil data being used
762  * (as gpencil_data). */
763  PointerRNA ptr;
764  bGPdata **gpd_ptr = ED_gpencil_data_get_pointers_direct(area, obact, &ptr);
765 
766  if (gpd_ptr) {
768  return CTX_RESULT_OK;
769  }
770  return CTX_RESULT_NO_DATA;
771 }
773 {
774  wmWindow *win = CTX_wm_window(C);
775  bScreen *screen = CTX_wm_screen(C);
779 
780  if (gpd) {
782  return CTX_RESULT_OK;
783  }
784  return CTX_RESULT_NO_DATA;
785 }
788 {
789  wmWindow *win = CTX_wm_window(C);
790  bScreen *screen = CTX_wm_screen(C);
793 
794  /* Pointer to which data/datablock owns the reference to the Grease Pencil data being used. */
795  PointerRNA ptr;
796  bGPdata **gpd_ptr = ED_annotation_data_get_pointers_direct((ID *)screen, area, scene, &ptr);
797 
798  if (gpd_ptr) {
800  return CTX_RESULT_OK;
801  }
802  return CTX_RESULT_NO_DATA;
803 }
806 {
807  wmWindow *win = CTX_wm_window(C);
809  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
810  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
812 
813  if (gpd) {
815 
816  if (gpl) {
817  CTX_data_pointer_set(result, &gpd->id, &RNA_GPencilLayer, gpl);
818  return CTX_RESULT_OK;
819  }
820  }
821  return CTX_RESULT_NO_DATA;
822 }
825 {
826  wmWindow *win = CTX_wm_window(C);
827  bScreen *screen = CTX_wm_screen(C);
831 
832  if (gpd) {
834 
835  if (gpl) {
836  CTX_data_pointer_set(result, &gpd->id, &RNA_GPencilLayer, gpl);
837  return CTX_RESULT_OK;
838  }
839  }
840  return CTX_RESULT_NO_DATA;
841 }
844 {
845  wmWindow *win = CTX_wm_window(C);
847  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
848  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
850 
851  if (gpd) {
853 
854  if (gpl) {
855  CTX_data_pointer_set(result, &gpd->id, &RNA_GPencilLayer, gpl->actframe);
856  return CTX_RESULT_OK;
857  }
858  }
859  return CTX_RESULT_NO_DATA;
860 }
863 {
864  wmWindow *win = CTX_wm_window(C);
866  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
867  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
869 
870  if (gpd) {
871  LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
872  if ((gpl->flag & GP_LAYER_HIDE) == 0) {
873  CTX_data_list_add(result, &gpd->id, &RNA_GPencilLayer, gpl);
874  }
875  }
877  return CTX_RESULT_OK;
878  }
879  return CTX_RESULT_NO_DATA;
880 }
883 {
884  wmWindow *win = CTX_wm_window(C);
886  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
887  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
889 
890  if (gpd) {
891  LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
893  CTX_data_list_add(result, &gpd->id, &RNA_GPencilLayer, gpl);
894  }
895  }
897  return CTX_RESULT_OK;
898  }
899  return CTX_RESULT_NO_DATA;
900 }
903 {
904  wmWindow *win = CTX_wm_window(C);
906  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
907  Object *obact = view_layer->basact ? view_layer->basact->object : NULL;
908 
910  const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
911 
912  if (gpd == NULL) {
913  return CTX_RESULT_NO_DATA;
914  }
915 
916  LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
917  if (BKE_gpencil_layer_is_editable(gpl) && (gpl->actframe)) {
918  bGPDframe *gpf;
919  bGPDframe *init_gpf = gpl->actframe;
920  if (is_multiedit) {
921  init_gpf = gpl->frames.first;
922  }
923 
924  for (gpf = init_gpf; gpf; gpf = gpf->next) {
925  if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) {
926  LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
928  /* check if the color is editable */
929  if (ED_gpencil_stroke_material_editable(obact, gpl, gps) == false) {
930  continue;
931  }
932 
933  CTX_data_list_add(result, &gpd->id, &RNA_GPencilStroke, gps);
934  }
935  }
936  }
937  /* If not multi-edit out of loop. */
938  if (!is_multiedit) {
939  break;
940  }
941  }
942  }
943  }
945  return CTX_RESULT_OK;
946 }
948 {
949  wmOperator *op = NULL;
950 
951  SpaceFile *sfile = CTX_wm_space_file(C);
952  if (sfile) {
953  op = sfile->op;
954  }
955  else if ((op = UI_context_active_operator_get(C))) {
956  /* do nothing */
957  }
958  else {
959  /* NOTE: this checks poll, could be a problem, but this also
960  * happens for the toolbar */
961  op = WM_operator_last_redo(C);
962  }
963  /* TODO: get the operator from popup's. */
964 
965  if (op && op->ptr) {
966  CTX_data_pointer_set(result, NULL, &RNA_Operator, op);
967  return CTX_RESULT_OK;
968  }
969  return CTX_RESULT_NO_DATA;
970 }
973  bool active_only,
974  bool editable)
975 {
976  bAnimContext ac;
978  /* In the Action and Shape Key editor always use the action field at the top. */
979  if (ac.spacetype == SPACE_ACTION) {
980  SpaceAction *saction = (SpaceAction *)ac.sl;
981 
983  if (active_only) {
984  CTX_data_id_pointer_set(result, (ID *)saction->action);
985  }
986  else {
987  if (saction->action && !(editable && ID_IS_LINKED(saction->action))) {
988  CTX_data_id_list_add(result, &saction->action->id);
989  }
990 
992  }
993 
994  return CTX_RESULT_OK;
995  }
996  }
997 
998  /* Search for selected animation data items. */
999  ListBase anim_data = {NULL, NULL};
1000 
1002  bool check_selected = false;
1003 
1004  switch (ac.spacetype) {
1005  case SPACE_GRAPH:
1007  (active_only ? ANIMFILTER_ACTIVE : ANIMFILTER_SEL);
1008  break;
1009 
1010  case SPACE_ACTION:
1012  check_selected = true;
1013  break;
1014  }
1015 
1016  ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
1017 
1018  GSet *seen_set = active_only ? NULL : BLI_gset_ptr_new("seen actions");
1019 
1020  LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) {
1021  /* In dopesheet check selection status of individual items, skipping
1022  * if not selected or has no selection flag. This is needed so that
1023  * selecting action or group rows without any channels works. */
1024  if (check_selected && ANIM_channel_setting_get(&ac, ale, ACHANNEL_SETTING_SELECT) <= 0) {
1025  continue;
1026  }
1027 
1028  bAction *action = ANIM_channel_action_get(ale);
1029 
1030  if (action) {
1031  if (active_only) {
1032  CTX_data_id_pointer_set(result, (ID *)action);
1033  break;
1034  }
1035  else {
1036  if (editable && ID_IS_LINKED(action)) {
1037  continue;
1038  }
1039 
1040  /* Add the action to the output list if not already added. */
1041  if (BLI_gset_add(seen_set, action)) {
1042  CTX_data_id_list_add(result, &action->id);
1043  }
1044  }
1045  }
1046  }
1047 
1048  ANIM_animdata_freelist(&anim_data);
1049 
1050  if (!active_only) {
1051  BLI_gset_free(seen_set, NULL);
1052 
1054  }
1055 
1056  return CTX_RESULT_OK;
1057  }
1058  return CTX_RESULT_NO_DATA;
1059 }
1061 {
1062  return screen_ctx_sel_actions_impl(C, result, true, false);
1063 }
1066 {
1067  return screen_ctx_sel_actions_impl(C, result, false, false);
1068 }
1071 {
1072  return screen_ctx_sel_actions_impl(C, result, false, true);
1073 }
1076  const int extra_filter)
1077 {
1078  bAnimContext ac;
1080  ListBase anim_data = {NULL, NULL};
1081 
1083  (ac.spacetype == SPACE_GRAPH ?
1086  extra_filter;
1087 
1088  ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
1089 
1090  LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) {
1091  if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) {
1092  CTX_data_list_add(result, ale->fcurve_owner_id, &RNA_FCurve, ale->data);
1093  }
1094  }
1095 
1096  ANIM_animdata_freelist(&anim_data);
1097 
1099  return CTX_RESULT_OK;
1100  }
1101  return CTX_RESULT_NO_DATA;
1102 }
1104 {
1106 }
1108 {
1110 }
1113 {
1115 }
1118 {
1120 }
1123 {
1124  bAnimContext ac;
1126  ListBase anim_data = {NULL, NULL};
1127 
1130 
1131  ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
1132 
1133  LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) {
1134  if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) {
1135  CTX_data_pointer_set(result, ale->fcurve_owner_id, &RNA_FCurve, ale->data);
1136  break;
1137  }
1138  }
1139 
1140  ANIM_animdata_freelist(&anim_data);
1141  return CTX_RESULT_OK;
1142  }
1143  return CTX_RESULT_NO_DATA;
1144 }
1147 {
1148  bAnimContext ac;
1150  ListBase anim_data = {NULL, NULL};
1151 
1152  /* Use keyframes from editable selected FCurves. */
1154  ANIMFILTER_SEL) |
1155  (ac.spacetype == SPACE_GRAPH ?
1158 
1159  ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
1160 
1161  int i;
1162  FCurve *fcurve;
1163  BezTriple *bezt;
1164  LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) {
1165  if (!ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) {
1166  continue;
1167  }
1168 
1169  fcurve = (FCurve *)ale->data;
1170  if (fcurve->bezt == NULL) {
1171  /* Skip baked FCurves. */
1172  continue;
1173  }
1174 
1175  for (i = 0, bezt = fcurve->bezt; i < fcurve->totvert; i++, bezt++) {
1176  if ((bezt->f2 & SELECT) == 0) {
1177  continue;
1178  }
1179 
1180  CTX_data_list_add(result, ale->fcurve_owner_id, &RNA_Keyframe, bezt);
1181  }
1182  }
1183 
1184  ANIM_animdata_freelist(&anim_data);
1185 
1187  return CTX_RESULT_OK;
1188  }
1189  return CTX_RESULT_NO_DATA;
1190 }
1191 
1193 {
1194  WorkSpace *workspace = CTX_wm_workspace(C);
1196  result, &workspace->id, &RNA_AssetLibraryReference, &workspace->asset_library_ref);
1197  return CTX_RESULT_OK;
1198 }
1199 
1201 {
1202  wmWindow *win = CTX_wm_window(C);
1203  ARegion *region = CTX_wm_region(C);
1204  if (region) {
1205  uiList *list = UI_list_find_mouse_over(region, win->eventstate);
1206  if (list) {
1207  CTX_data_pointer_set(result, NULL, &RNA_UIList, list);
1208  return CTX_RESULT_OK;
1209  }
1210  }
1211  return CTX_RESULT_NO_DATA;
1212 }
1213 
1214 /* Registry of context callback functions. */
1215 
1218 
1220 {
1222 }
1223 static inline void register_context_function(const char *member, context_callback function)
1224 {
1225  BLI_ghash_insert(ed_screen_context_functions, (void *)member, function);
1226 }
1227 
1229 {
1231  return;
1232  }
1233 
1234  /* Murmur hash is faster for smaller strings (according to BLI_hash_mm2). */
1237 
1239 
1247  register_context_function("objects_in_mode_unique_data", screen_ctx_objects_in_mode_unique_data);
1254  register_context_function("selected_pose_bones_from_active_object",
1270  register_context_function("selected_editable_sequences", screen_ctx_selected_editable_sequences);
1294  register_context_function("selected_editable_keyframes", screen_ctx_selected_editable_keyframes);
1297 }
1298 
1299 int ed_screen_context(const bContext *C, const char *member, bContextDataResult *result)
1300 {
1301  if (CTX_data_dir(member)) {
1303  return CTX_RESULT_OK;
1304  }
1305 
1308  if (callback == NULL) {
1310  }
1311 
1312  return callback(C, result);
1313 }
Blender kernel action and pose functionality.
struct bPoseChannel * BKE_pose_channel_active_if_layer_visible(struct Object *ob)
Definition: action.c:720
#define FOREACH_PCHAN_SELECTED_IN_OBJECT_END
Definition: BKE_armature.h:564
#define FOREACH_PCHAN_VISIBLE_IN_OBJECT_BEGIN(_ob, _pchan)
Definition: BKE_armature.h:569
#define FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN(_ob, _pchan)
Definition: BKE_armature.h:560
#define FOREACH_PCHAN_VISIBLE_IN_OBJECT_END
Definition: BKE_armature.h:572
Blender util stuff.
void BKE_blender_atexit_register(void(*func)(void *user_data), void *user_data)
Definition: blender.c:396
struct WorkSpace * CTX_wm_workspace(const bContext *C)
Definition: context.c:728
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:738
struct SpaceClip * CTX_wm_space_clip(const bContext *C)
Definition: context.c:923
void CTX_data_dir_set(bContextDataResult *result, const char **dir)
Definition: context.c:696
void CTX_data_pointer_set(bContextDataResult *result, struct ID *id, StructRNA *type, void *data)
Definition: context.c:649
void CTX_data_id_pointer_set(bContextDataResult *result, struct ID *id)
Definition: context.c:644
bool CTX_data_dir(const char *member)
Definition: context.c:639
void CTX_data_id_list_add(bContextDataResult *result, struct ID *id)
Definition: context.c:659
@ CTX_DATA_TYPE_COLLECTION
Definition: BKE_context.h:233
struct View3D * CTX_wm_view3d(const bContext *C)
Definition: context.c:784
eContextResult
Definition: BKE_context.h:70
@ CTX_RESULT_MEMBER_NOT_FOUND
Definition: BKE_context.h:75
@ CTX_RESULT_OK
Definition: BKE_context.h:72
@ CTX_RESULT_NO_DATA
Definition: BKE_context.h:79
void CTX_data_list_add(bContextDataResult *result, struct ID *id, StructRNA *type, void *data)
Definition: context.c:667
struct bScreen * CTX_wm_screen(const bContext *C)
Definition: context.c:733
void CTX_data_type_set(struct bContextDataResult *result, short type)
Definition: context.c:701
void CTX_data_pointer_set_ptr(bContextDataResult *result, const PointerRNA *ptr)
Definition: context.c:654
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:749
struct SpaceFile * CTX_wm_space_file(const bContext *C)
Definition: context.c:842
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:723
struct bGPDlayer * BKE_gpencil_layer_active_get(struct bGPdata *gpd)
Definition: gpencil.c:1558
bool BKE_gpencil_layer_is_editable(const struct bGPDlayer *gpl)
#define BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, v3d, r_len)
Definition: BKE_layer.h:542
#define FOREACH_OBJECT_IN_MODE_END
Definition: BKE_layer.h:384
#define FOREACH_OBJECT_IN_MODE_BEGIN(_view_layer, _v3d, _object_type, _object_mode, _instance)
Definition: BKE_layer.h:380
General operations, lookup, etc. for blender objects.
struct Object * BKE_object_pose_armature_get(struct Object *ob)
Definition: object.cc:2511
struct ListBase * BKE_tracking_get_active_tracks(struct MovieTracking *tracking)
Definition: tracking.c:346
#define TRACK_SELECTED(track)
Definition: BKE_tracking.h:823
struct GSet GSet
Definition: BLI_ghash.h:340
bool BLI_ghashutil_strcmp(const void *a, const void *b)
GSet * BLI_gset_ptr_new(const char *info)
GHash * BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.c:689
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.c:734
unsigned int BLI_ghashutil_strhash_p_murmur(const void *ptr)
void BLI_ghash_insert(GHash *gh, void *key, void *val)
Definition: BLI_ghash.c:710
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
Definition: BLI_ghash.c:863
void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp)
Definition: BLI_ghash.c:1037
bool BLI_gset_add(GSet *gs, void *key)
Definition: BLI_ghash.c:969
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
unsigned int uint
Definition: BLI_sys_types.h:67
#define UNUSED(x)
#define ELEM(...)
#define ID_IS_LINKED(_id)
Definition: DNA_ID.h:566
@ LIB_TAG_DOIT
Definition: DNA_ID.h:707
@ SACTCONT_ACTION
@ SACTCONT_SHAPEKEY
@ NLASTRIP_FLAG_SELECT
@ BONE_SELECTED
@ ARM_MIRROR_EDIT
#define GPENCIL_MULTIEDIT_SESSIONS_ON(gpd)
@ GP_LAYER_HIDE
@ GP_FRAME_SELECT
@ BASE_SELECTABLE
@ BASE_SELECTED
#define OB_MODE_ALL_WEIGHT_PAINT
@ OB_MODE_PARTICLE_EDIT
@ OB_MODE_SCULPT
@ OB_MODE_POSE
@ OB_MODE_TEXTURE_PAINT
@ OB_MODE_OBJECT
@ OB_MODE_VERTEX_PAINT
Object is a sort of wrapper for general info.
@ OB_ARMATURE
#define OBEDIT_FROM_VIEW_LAYER(view_layer)
#define BASE_SELECTED_EDITABLE(v3d, base)
#define BASE_EDITABLE(v3d, base)
#define BASE_VISIBLE(v3d, base)
@ SPACE_ACTION
@ SPACE_GRAPH
@ ANIMTYPE_NLACURVE
Definition: ED_anim_api.h:202
@ ANIMTYPE_FCURVE
Definition: ED_anim_api.h:199
@ ALE_NLASTRIP
Definition: ED_anim_api.h:253
bool ANIM_nla_context_track_ptr(const struct bContext *C, struct PointerRNA *r_ptr)
bool ANIM_nla_context_strip_ptr(const struct bContext *C, struct PointerRNA *r_ptr)
@ ACHANNEL_SETTING_SELECT
Definition: ED_anim_api.h:561
@ ANIMFILTER_ACTIVE
Definition: ED_anim_api.h:303
@ ANIMFILTER_FOREDIT
Definition: ED_anim_api.h:312
@ ANIMFILTER_DATA_VISIBLE
Definition: ED_anim_api.h:292
@ ANIMFILTER_CURVE_VISIBLE
Definition: ED_anim_api.h:297
@ ANIMFILTER_LIST_VISIBLE
Definition: ED_anim_api.h:295
@ ANIMFILTER_LIST_CHANNELS
Definition: ED_anim_api.h:300
@ ANIMFILTER_NODUPLIS
Definition: ED_anim_api.h:325
@ ANIMFILTER_FCURVESONLY
Definition: ED_anim_api.h:328
@ ANIMFILTER_SEL
Definition: ED_anim_api.h:308
#define EBONE_VISIBLE(arm, ebone)
Definition: ED_armature.h:47
#define EBONE_EDITABLE(ebone)
Definition: ED_armature.h:55
struct MovieClip * ED_space_clip_get_clip(struct SpaceClip *sc)
Definition: clip_editor.c:570
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a producing a negative Combine Generate a color from its and blue channels(Deprecated)") DefNode(ShaderNode
#define C
Definition: RandGen.cpp:25
struct wmOperator * UI_context_active_operator_get(const struct bContext *C)
struct uiList * UI_list_find_mouse_over(const struct ARegion *region, const struct wmEvent *event)
short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting)
bAction * ANIM_channel_action_get(const bAnimListElem *ale)
void ANIM_animdata_freelist(ListBase *anim_data)
Definition: anim_deps.c:397
bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
Definition: anim_filter.c:379
size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_Flags filter_mode, void *data, eAnimCont_Types datatype)
Definition: anim_filter.c:3447
EditBone * ED_armature_ebone_get_mirrored(const ListBase *edbo, EditBone *ebo)
ListBase * SEQ_channels_displayed_get(Editing *ed)
Definition: channels.c:23
#define SELECT
Scene scene
void * user_data
DEGForeachIDComponentCallback callback
bool ED_gpencil_stroke_material_editable(Object *ob, const bGPDlayer *gpl, const bGPDstroke *gps)
bool ED_gpencil_stroke_can_use_direct(const ScrArea *area, const bGPDstroke *gps)
bGPdata * ED_gpencil_data_get_active_direct(ScrArea *area, Object *ob)
bGPdata ** ED_annotation_data_get_pointers_direct(ID *screen_id, ScrArea *area, Scene *scene, PointerRNA *r_ptr)
bGPdata ** ED_gpencil_data_get_pointers_direct(ScrArea *area, Object *ob, PointerRNA *r_ptr)
Definition: gpencil_utils.c:85
bGPdata * ED_annotation_data_get_active_direct(ID *screen_id, ScrArea *area, Scene *scene)
DO_INLINE void filter(lfVector *V, fmatrix3x3 *S)
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
static void area(int d1, int d2, int e1, int e2, float weights[2])
static eContextResult screen_ctx_selected_pose_bones(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_objects_in_mode_unique_data(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_selected_editable_objects(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_active_operator(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_sel_edit_fcurves_(const bContext *C, bContextDataResult *result, const int extra_filter)
static eContextResult screen_ctx_asset_library(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_ui_list(const bContext *C, bContextDataResult *result)
const char * screen_context_dir[]
static eContextResult screen_ctx_selected_objects(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_selected_bones(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_active_sequence_strip(const bContext *C, bContextDataResult *result)
eContextResult(* context_callback)(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_selected_editable_sequences(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_selected_nla_strips(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_editable_objects(const bContext *C, bContextDataResult *result)
static GHash * ed_screen_context_functions
static eContextResult screen_ctx_selected_sequences(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_visible_gpencil_layers(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_active_annotation_layer(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_visible_pose_bones(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_pose_object(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_active_gpencil_layer(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_selected_visible_fcurves(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_gpencil_data_owner(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_annotation_data(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_edit_object(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_active_bone(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_objects_in_mode(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_selectable_objects(const bContext *C, bContextDataResult *result)
static void register_context_function(const char *member, context_callback function)
static eContextResult screen_ctx_editable_gpencil_layers(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_annotation_data_owner(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_selected_visible_actions(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_editable_gpencil_strokes(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_visible_fcurves(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_editable_fcurves(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_active_object(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_selected_editable_actions(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_particle_edit_object(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_selected_editable_bones(const bContext *C, bContextDataResult *result)
int ed_screen_context(const bContext *C, const char *member, bContextDataResult *result)
static eContextResult screen_ctx_visible_objects(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_editable_bones(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_selected_editable_keyframes(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_selected_editable_fcurves(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_sel_actions_impl(const bContext *C, bContextDataResult *result, bool active_only, bool editable)
static eContextResult screen_ctx_object(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_active_editable_fcurve(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_selected_bones_(const bContext *C, bContextDataResult *result, const bool selected_editable_bones)
static eContextResult screen_ctx_gpencil_data(const bContext *C, bContextDataResult *result)
static void free_context_function_ghash(void *UNUSED(user_data))
static eContextResult screen_ctx_selected_pose_bones_from_active_object(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_visible_bones(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_sequences(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_vertex_paint_object(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_active_pose_bone(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_sculpt_object(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_active_nla_strip(const bContext *C, bContextDataResult *result)
static void ensure_ed_screen_context_functions(void)
static eContextResult screen_ctx_visible_or_editable_bones_(const bContext *C, bContextDataResult *result, const bool editable_bones)
static eContextResult screen_ctx_active_nla_track(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_active_gpencil_frame(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_image_paint_object(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_scene(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_weight_paint_object(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_active_action(const bContext *C, bContextDataResult *result)
static eContextResult screen_ctx_selected_movieclip_tracks(const bContext *C, bContextDataResult *result)
Editing * SEQ_editing_get(const Scene *scene)
Definition: sequencer.c:241
Sequence * SEQ_select_active_get(Scene *scene)
Definition: strip_select.c:18
bool SEQ_transform_is_locked(ListBase *channels, Sequence *seq)
struct Object * object
uint8_t f2
ListBase * seqbasep
BezTriple * bezt
Definition: DNA_ID.h:368
struct MovieTracking tracking
ListBase strips
struct bPose * pose
void * data
bAction * action
struct wmOperator * op
struct Base * basact
ListBase object_bases
AssetLibraryReference asset_library_ref
short spacetype
Definition: ED_anim_api.h:67
short datatype
Definition: ED_anim_api.h:62
void * data
Definition: ED_anim_api.h:60
struct SpaceLink * sl
Definition: ED_anim_api.h:74
struct EditBone * act_edbone
ListBase * edbo
struct bGPDframe * next
ListBase strokes
bGPDframe * actframe
ListBase layers
struct PointerRNA * ptr
struct wmEvent * eventstate
PointerRNA * ptr
Definition: wm_files.c:3480
wmOperator * WM_operator_last_redo(const bContext *C)
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
Definition: wm_window.c:2217
Scene * WM_window_get_active_scene(const wmWindow *win)
Definition: wm_window.c:2183