Blender V5.3
buttons_context.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <algorithm>
10#include <cstdlib>
11#include <cstring>
12
13#include "MEM_guardedalloc.h"
14
15#include "BLI_listbase.hh"
16#include "BLI_string_utf8.hh"
17#include "BLI_utildefines.hh"
18
19#include "BLT_translation.hh"
20
21#include "DNA_armature_types.h"
23#include "DNA_linestyle_types.h"
24#include "DNA_material_types.h"
25#include "DNA_node_types.h"
26#include "DNA_scene_types.h"
27#include "DNA_sequence_types.h"
29#include "DNA_world_types.h"
30
31#include "BKE_action.hh"
32#include "BKE_compositor.hh"
33#include "BKE_context.hh"
34#include "BKE_layer.hh"
35#include "BKE_linestyle.h"
36#include "BKE_material.hh"
37#include "BKE_modifier.hh"
38#include "BKE_object.hh"
39#include "BKE_paint.hh"
40#include "BKE_particle.h"
41#include "BKE_screen.hh"
42
43#include "SEQ_modifier.hh"
44#include "SEQ_select.hh"
45
46#include "RNA_access.hh"
47#include "RNA_prototypes.hh"
48
49#include "ED_buttons.hh"
50#include "ED_physics.hh"
51#include "ED_screen.hh"
52
53#include "UI_interface.hh"
55#include "UI_resources.hh"
56
57#include "WM_api.hh"
58
59#include "buttons_intern.hh" /* own include */
60
61namespace blender {
62
64{
65 for (int i = 0; i < path->len; i++) {
66 PointerRNA *ptr = &path->ptr[i];
67
68 if (RNA_struct_is_a(ptr->type, type)) {
70 return CTX_RESULT_OK;
71 }
72 }
73
75}
76
78{
79 for (int i = 0; i < path->len; i++) {
80 PointerRNA *ptr = &path->ptr[i];
81
82 if (RNA_struct_is_a(ptr->type, type)) {
83 return ptr;
84 }
85 }
86
87 return nullptr;
88}
89
90/************************* Creating the Path ************************/
91
93{
94 PointerRNA *ptr = &path->ptr[path->len - 1];
95
96 /* this one just verifies */
97 return RNA_struct_is_a(ptr->type, RNA_Scene);
98}
99
101{
102 PointerRNA *ptr = &path->ptr[path->len - 1];
103
104 /* View Layer may have already been resolved in a previous call
105 * (e.g. in buttons_context_path_linestyle). */
106 if (RNA_struct_is_a(ptr->type, RNA_ViewLayer)) {
107 return true;
108 }
109
110 if (buttons_context_path_scene(path)) {
111 Scene *scene = static_cast<Scene *>(path->ptr[path->len - 1].data);
112 ViewLayer *view_layer = (win->scene == scene) ? WM_window_get_active_view_layer(win) :
114
115 path->ptr[path->len] = RNA_pointer_create_discrete(&scene->id, RNA_ViewLayer, view_layer);
116 path->len++;
117 return true;
118 }
119
120 return false;
121}
122
123/* NOTE: this function can return true without adding a world to the path
124 * so the buttons stay visible, but be sure to check the ID type if a ID_WO */
126{
127 PointerRNA *ptr = &path->ptr[path->len - 1];
128
129 /* if we already have a (pinned) world, we're done */
130 if (RNA_struct_is_a(ptr->type, RNA_World)) {
131 return true;
132 }
133 /* if we have a scene, use the scene's world */
134 if (buttons_context_path_scene(path)) {
135 Scene *scene = static_cast<Scene *>(path->ptr[path->len - 1].data);
136 World *world = scene->world;
137
138 if (world) {
139 path->ptr[path->len] = RNA_id_pointer_create(&scene->world->id);
140 path->len++;
141 return true;
142 }
143
144 return true;
145 }
146
147 /* no path to a world possible */
148 return false;
149}
150
152 ButsContextPath *path,
153 wmWindow *window)
154{
155 PointerRNA *ptr = &path->ptr[path->len - 1];
156
157 /* if we already have a (pinned) collection, we're done */
158 if (RNA_struct_is_a(ptr->type, RNA_Collection)) {
159 return true;
160 }
161
162 const Main *bmain = CTX_data_main(C);
163 Scene *scene = CTX_data_scene(C);
164
165 /* if we have a view layer, use the view layer's active collection */
166 if (buttons_context_path_view_layer(path, window)) {
167 ViewLayer *view_layer = static_cast<ViewLayer *>(path->ptr[path->len - 1].data);
168 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
170
171 /* Do not show collection tab for master collection. */
172 if (c == scene->master_collection) {
173 return false;
174 }
175
176 if (c) {
177 path->ptr[path->len] = RNA_id_pointer_create(&c->id);
178 path->len++;
179 return true;
180 }
181 }
182
183 /* no path to a collection possible */
184 return false;
185}
186
188{
189 PointerRNA *ptr = &path->ptr[path->len - 1];
190
191 /* if we already have a (pinned) linestyle, we're done */
192 if (RNA_struct_is_a(ptr->type, RNA_FreestyleLineStyle)) {
193 return true;
194 }
195 /* if we have a view layer, use the lineset's linestyle */
196 if (buttons_context_path_view_layer(path, window)) {
197 ViewLayer *view_layer = static_cast<ViewLayer *>(path->ptr[path->len - 1].data);
199 if (linestyle) {
200 path->ptr[path->len] = RNA_id_pointer_create(&linestyle->id);
201 path->len++;
202 return true;
203 }
204 }
205
206 /* no path to a linestyle possible */
207 return false;
208}
209
211{
212 PointerRNA *ptr = &path->ptr[path->len - 1];
213
214 /* if we already have a (pinned) object, we're done */
215 if (RNA_struct_is_a(ptr->type, RNA_Object)) {
216 return true;
217 }
218 if (!RNA_struct_is_a(ptr->type, RNA_ViewLayer)) {
219 return false;
220 }
221
222 ViewLayer *view_layer = static_cast<ViewLayer *>(ptr->data);
224
225 if (ob) {
226 path->ptr[path->len] = RNA_id_pointer_create(&ob->id);
227 path->len++;
228
229 return true;
230 }
231
232 /* no path to a object possible */
233 return false;
234}
235
236static bool buttons_context_path_data(ButsContextPath *path, int type)
237{
238 PointerRNA *ptr = &path->ptr[path->len - 1];
239
240 /* if we already have a data, we're done */
241 if (RNA_struct_is_a(ptr->type, RNA_Mesh) && ELEM(type, -1, OB_MESH)) {
242 return true;
243 }
244 if (RNA_struct_is_a(ptr->type, RNA_Curve) &&
245 (type == -1 || ELEM(type, OB_CURVES_LEGACY, OB_SURF, OB_FONT)))
246 {
247 return true;
248 }
249 if (RNA_struct_is_a(ptr->type, RNA_Armature) && ELEM(type, -1, OB_ARMATURE)) {
250 return true;
251 }
252 if (RNA_struct_is_a(ptr->type, RNA_MetaBall) && ELEM(type, -1, OB_MBALL)) {
253 return true;
254 }
255 if (RNA_struct_is_a(ptr->type, RNA_Lattice) && ELEM(type, -1, OB_LATTICE)) {
256 return true;
257 }
258 if (RNA_struct_is_a(ptr->type, RNA_Camera) && ELEM(type, -1, OB_CAMERA)) {
259 return true;
260 }
261 if (RNA_struct_is_a(ptr->type, RNA_Light) && ELEM(type, -1, OB_LAMP)) {
262 return true;
263 }
264 if (RNA_struct_is_a(ptr->type, RNA_Speaker) && ELEM(type, -1, OB_SPEAKER)) {
265 return true;
266 }
267 if (RNA_struct_is_a(ptr->type, RNA_LightProbe) && ELEM(type, -1, OB_LIGHTPROBE)) {
268 return true;
269 }
270 if (RNA_struct_is_a(ptr->type, RNA_GreasePencil) && ELEM(type, -1, OB_GREASE_PENCIL)) {
271 return true;
272 }
273 if (RNA_struct_is_a(ptr->type, RNA_Curves) && ELEM(type, -1, OB_CURVES)) {
274 return true;
275 }
276 if (RNA_struct_is_a(ptr->type, RNA_PointCloud) && ELEM(type, -1, OB_POINTCLOUD)) {
277 return true;
278 }
279 if (RNA_struct_is_a(ptr->type, RNA_Volume) && ELEM(type, -1, OB_VOLUME)) {
280 return true;
281 }
282 /* try to get an object in the path, no pinning supported here */
283 if (buttons_context_path_object(path)) {
284 Object *ob = static_cast<Object *>(path->ptr[path->len - 1].data);
285
286 if (ob && ELEM(type, -1, ob->type)) {
287 if (ob->type == OB_EMPTY && ob->empty_drawtype != OB_EMPTY_IMAGE) {
288 if (ID *id = ob->data; id && GS(id->name) == ID_IM) {
289 path->ptr[path->len] = {};
290 path->len++;
291 return true;
292 }
293 }
294 path->ptr[path->len] = RNA_id_pointer_create(ob->data);
295 path->len++;
296
297 return true;
298 }
299 }
300
301 /* no path to data possible */
302 return false;
303}
304
306{
307 if (buttons_context_path_object(path)) {
308 Object *ob = static_cast<Object *>(path->ptr[path->len - 1].data);
309
310 if (ELEM(ob->type,
311 OB_EMPTY,
312 OB_MESH,
314 OB_FONT,
315 OB_SURF,
318 OB_CURVES,
320 OB_VOLUME))
321 {
323 if (md != nullptr) {
324 path->ptr[path->len] = RNA_pointer_create_discrete(&ob->id, RNA_Modifier, md);
325 path->len++;
326 }
327
328 return true;
329 }
330 }
331
332 return false;
333}
334
336{
337 if (buttons_context_path_object(path)) {
338 Object *ob = static_cast<Object *>(path->ptr[path->len - 1].data);
339
340 if (ob && ob->type == OB_GREASE_PENCIL) {
341 return true;
342 }
343 }
344
345 return false;
346}
347
349{
350 PointerRNA *ptr = &path->ptr[path->len - 1];
351
352 /* if we already have a (pinned) material, we're done */
353 if (RNA_struct_is_a(ptr->type, RNA_Material)) {
354 return true;
355 }
356 /* if we have an object, use the object material slot */
357 if (buttons_context_path_object(path)) {
358 Object *ob = static_cast<Object *>(path->ptr[path->len - 1].data);
359
360 if (ob && OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
362
363 const int slot = math::max(ob->actcol - 1, 0);
364 if (ob->matbits && ob->matbits[slot] == 0) {
365 /* When material from active slot is stored in object data, include it in context path, see
366 * !134968. */
368 }
369 if (ma != nullptr) {
370 path->ptr[path->len] = RNA_id_pointer_create(&ma->id);
371 path->len++;
372 }
373 return true;
374 }
375 }
376
377 /* no path to a material possible */
378 return false;
379}
380
382{
383 /* if we have an armature, get the active bone */
385 bArmature *arm = static_cast<bArmature *>(path->ptr[path->len - 1].data);
386
387 if (arm->edbo) {
388 if (arm->act_edbone) {
389 EditBone *edbo = arm->act_edbone;
390 path->ptr[path->len] = RNA_pointer_create_discrete(&arm->id, RNA_EditBone, edbo);
391 path->len++;
392 return true;
393 }
394 }
395 else {
396 if (arm->act_bone) {
397 path->ptr[path->len] = RNA_pointer_create_discrete(&arm->id, RNA_Bone, arm->act_bone);
398 path->len++;
399 return true;
400 }
401 }
402 }
403
404 /* no path to a bone possible */
405 return false;
406}
407
409{
410 PointerRNA *ptr = &path->ptr[path->len - 1];
411
412 /* if we already have a (pinned) PoseBone, we're done */
413 if (RNA_struct_is_a(ptr->type, RNA_PoseBone)) {
414 return true;
415 }
416
417 /* if we have an armature, get the active bone */
418 if (buttons_context_path_object(path)) {
419 Object *ob = static_cast<Object *>(path->ptr[path->len - 1].data);
420 if (ob->type != OB_ARMATURE) {
421 return false;
422 }
423
424 bArmature *arm = id_cast<bArmature *>(ob->data); /* path->ptr[path->len-1].data - works too */
425 if (arm->edbo) {
426 return false;
427 }
428
429 if (arm->act_bone) {
431 if (pchan) {
432 path->ptr[path->len] = RNA_pointer_create_discrete(&ob->id, RNA_PoseBone, pchan);
433 path->len++;
434 return true;
435 }
436 }
437 }
438
439 /* no path to a bone possible */
440 return false;
441}
442
444{
445 PointerRNA *ptr = &path->ptr[path->len - 1];
446
447 /* if we already have (pinned) particle settings, we're done */
448 if (RNA_struct_is_a(ptr->type, RNA_ParticleSettings)) {
449 return true;
450 }
451 /* if we have an object, get the active particle system */
452 if (buttons_context_path_object(path)) {
453 Object *ob = static_cast<Object *>(path->ptr[path->len - 1].data);
454
455 if (ob && ob->type == OB_MESH) {
457 if (psys != nullptr) {
458 path->ptr[path->len] = RNA_pointer_create_discrete(&ob->id, RNA_ParticleSystem, psys);
459 path->len++;
460 }
461 return true;
462 }
463 }
464
465 /* no path to a particle system possible */
466 return false;
467}
468
470{
471 PointerRNA *ptr = &path->ptr[path->len - 1];
472
473 /* if we already have a (pinned) brush, we're done */
474 if (RNA_struct_is_a(ptr->type, RNA_Brush)) {
475 return true;
476 }
477 /* If we have a scene, use the tool-settings brushes. */
478 if (buttons_context_path_scene(path)) {
479 Scene *scene = static_cast<Scene *>(path->ptr[path->len - 1].data);
480
481 Brush *br = nullptr;
482 if (scene) {
483 const Main *bmain = CTX_data_main(C);
484 wmWindow *window = CTX_wm_window(C);
485 ViewLayer *view_layer = WM_window_get_active_view_layer(window);
486 br = BKE_paint_brush(BKE_paint_get_active(*bmain, scene, view_layer));
487 }
488
489 if (br) {
490 path->ptr[path->len] = RNA_id_pointer_create(reinterpret_cast<ID *>(br));
491 path->len++;
492
493 return true;
494 }
495 }
496
497 /* no path to a brush possible */
498 return false;
499}
500
502 ButsContextPath *path,
504{
505 PointerRNA *ptr = &path->ptr[path->len - 1];
506
507 if (!ct) {
508 return false;
509 }
510
511 /* if we already have a (pinned) texture, we're done */
512 if (RNA_struct_is_a(ptr->type, RNA_Texture)) {
513 return true;
514 }
515
516 if (!ct->user) {
517 return false;
518 }
519
520 ID *id = ct->user->id;
521
522 if (id) {
523 if (GS(id->name) == ID_BR) {
525 }
526 else if (GS(id->name) == ID_PA) {
528 }
529 else if (GS(id->name) == ID_OB) {
531 }
532 else if (GS(id->name) == ID_LS) {
534 }
535 }
536
537 if (ct->texture) {
538 path->ptr[path->len] = RNA_id_pointer_create(&ct->texture->id);
539 path->len++;
540 }
541
542 return true;
543}
544
546{
547 PointerRNA *ptr = &path->ptr[path->len - 1];
548 /* If we already have a (pinned) strip, we're done. */
549 if (RNA_struct_is_a(ptr->type, RNA_Strip)) {
550 return true;
551 }
552
553 if (buttons_context_path_scene(path)) {
554 Scene *scene = static_cast<Scene *>(path->ptr[path->len - 1].data);
555 Strip *active_strip = seq::select_active_get(scene);
556 if (active_strip == nullptr) {
557 return false;
558 }
559
560 path->ptr[path->len] = RNA_pointer_create_discrete(&scene->id, RNA_Strip, active_strip);
561 path->len++;
562 return true;
563 }
564
565 return false;
566}
567
569{
570 if (sequencer_scene && buttons_context_path_strip(path)) {
571 Strip *active_strip = static_cast<Strip *>(path->ptr[path->len - 1].data);
572
573 StripModifierData *smd = seq::modifier_get_active(active_strip);
574 if (smd) {
575 path->ptr[path->len] = RNA_pointer_create_discrete(
576 &sequencer_scene->id, RNA_StripModifier, smd);
577 path->len++;
578 }
579 return true;
580 }
581
582 return false;
583}
584
586{
587 PointerRNA *ptr = &path->ptr[path->len - 1];
588
589 /* If we already have a pinned effect, we're done. */
590 if (RNA_struct_is_a(ptr->type, RNA_SceneCompositorEffect)) {
591 return true;
592 }
593
594 if (buttons_context_path_scene(path)) {
595 Scene *scene = ptr->data_as<Scene>();
597 if (effect) {
598 path->ptr[path->len] = RNA_pointer_create_discrete(
599 &scene->id, RNA_SceneCompositorEffect, effect);
600 path->len++;
601 }
602 return true;
603 }
604
605 return false;
606}
607
608#ifdef WITH_FREESTYLE
609static bool buttons_context_linestyle_pinnable(const bContext *C, ViewLayer *view_layer)
610{
611 wmWindow *window = CTX_wm_window(C);
612 Scene *scene = WM_window_get_active_scene(window);
613
614 /* if Freestyle is disabled in the scene */
615 if ((scene->r.mode & R_EDGE_FRS) == 0) {
616 return false;
617 }
618 /* if Freestyle is not in the Parameter Editor mode */
619 FreestyleConfig *config = &view_layer->freestyle_config;
620 if (config->mode != FREESTYLE_CONTROL_EDITOR_MODE) {
621 return false;
622 }
623 /* if the scene has already been pinned */
625 if (sbuts->pinid && sbuts->pinid == &scene->id) {
626 return false;
627 }
628 return true;
629}
630#endif
631
633 const bContext *C, SpaceProperties *sbuts, ButsContextPath *path, int mainb, int flag)
634{
635 /* Note we don't use CTX_data here, instead we get it from the window.
636 * Otherwise there is a loop reading the context that we are setting. */
637 wmWindow *window = CTX_wm_window(C);
638 Scene *scene = WM_window_get_active_scene(window);
639 WorkSpace *workspace = WM_window_get_active_workspace(window);
640 Scene *sequencer_scene = workspace->sequencer_scene;
641 ViewLayer *view_layer = WM_window_get_active_view_layer(window);
642
643 *path = {};
644 path->flag = flag;
645
646 /* If some ID datablock is pinned, set the root pointer. */
647 if (sbuts->pinid) {
648 ID *id = sbuts->pinid;
649
650 path->ptr[0] = RNA_id_pointer_create(id);
651 path->len++;
652 }
653 /* No pinned root, use scene as initial root. */
654 else if (mainb != BCONTEXT_TOOL) {
656 if (!sequencer_scene) {
657 return false;
658 }
659 path->ptr[0] = RNA_id_pointer_create(&sequencer_scene->id);
660 }
661 else {
662 path->ptr[0] = RNA_id_pointer_create(&scene->id);
663 }
664
665 path->len++;
666
667 if (!ELEM(mainb,
676 {
677 path->ptr[path->len] = RNA_pointer_create_discrete(nullptr, RNA_ViewLayer, view_layer);
678 path->len++;
679 }
680 }
681
682 /* now for each buttons context type, we try to construct a path,
683 * tracing back recursively */
684 bool found;
685 switch (mainb) {
686 case BCONTEXT_SCENE:
687 case BCONTEXT_RENDER:
688 case BCONTEXT_OUTPUT:
689 found = buttons_context_path_scene(path);
690 break;
692#ifdef WITH_FREESTYLE
693 if (buttons_context_linestyle_pinnable(C, view_layer)) {
694 found = buttons_context_path_linestyle(path, window);
695 if (found) {
696 break;
697 }
698 }
699#endif
700 found = buttons_context_path_view_layer(path, window);
701 break;
702 case BCONTEXT_WORLD:
703 found = buttons_context_path_world(path);
704 break;
705 case BCONTEXT_COLLECTION: /* This is for Line Art collection flags */
706 found = buttons_context_path_collection(C, path, window);
707 break;
708 case BCONTEXT_TOOL:
709 found = true;
710 break;
711 case BCONTEXT_OBJECT:
712 case BCONTEXT_PHYSICS:
714 found = buttons_context_path_object(path);
715 break;
717 found = buttons_context_path_modifier(path);
718 break;
720 found = buttons_context_path_shaderfx(path);
721 break;
722 case BCONTEXT_DATA:
723 found = buttons_context_path_data(path, -1);
724 break;
726 found = buttons_context_path_particle(path);
727 break;
729 found = buttons_context_path_material(path);
730 break;
731 case BCONTEXT_TEXTURE:
733 C, path, static_cast<ButsContextTexture *>(sbuts->texuser));
734 break;
735 case BCONTEXT_BONE:
736 found = buttons_context_path_bone(path);
737 if (!found) {
739 }
740 break;
742 found = buttons_context_path_pose_bone(path);
743 break;
744 case BCONTEXT_STRIP:
745 found = buttons_context_path_strip(path);
746 break;
748 found = buttons_context_path_strip_modifier(sequencer_scene, path);
749 break;
752 break;
753 default:
754 found = false;
755 break;
756 }
757
758 return found;
759}
760
761static bool buttons_shading_context(const bContext *C, int mainb)
762{
763 wmWindow *window = CTX_wm_window(C);
764 const Main *bmain = CTX_data_main(C);
765 const Scene *scene = WM_window_get_active_scene(window);
766 ViewLayer *view_layer = WM_window_get_active_view_layer(window);
767 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
769
771 return true;
772 }
773 if (mainb == BCONTEXT_DATA && ob && ELEM(ob->type, OB_LAMP, OB_CAMERA)) {
774 return true;
775 }
776
777 return false;
778}
779
781{
782 wmWindow *window = CTX_wm_window(C);
783 const Main *bmain = CTX_data_main(C);
784 const Scene *scene = WM_window_get_active_scene(window);
785 ViewLayer *view_layer = WM_window_get_active_view_layer(window);
786 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
788
789 if (flag & (1 << BCONTEXT_MATERIAL)) {
790 return BCONTEXT_MATERIAL;
791 }
792 if (ob && ELEM(ob->type, OB_LAMP, OB_CAMERA) && (flag & (1 << BCONTEXT_DATA))) {
793 return BCONTEXT_DATA;
794 }
795 if (flag & (1 << BCONTEXT_WORLD)) {
796 return BCONTEXT_WORLD;
797 }
798
799 return BCONTEXT_RENDER;
800}
801
803{
804 if (!sbuts->path) {
805 sbuts->path = MEM_new<ButsContextPath>("ButsContextPath");
806 }
807
808 ButsContextPath *path = static_cast<ButsContextPath *>(sbuts->path);
809
810 int pflag = 0;
811 int flag = 0;
812
813 /* Set scene path. */
814 buttons_context_path(C, sbuts, path, BCONTEXT_SCENE, pflag);
815
817
818 /* for each context, see if we can compute a valid path to it, if
819 * this is the case, we know we have to display the button */
820 for (int i = 0; i < BCONTEXT_TOT; i++) {
821 if (buttons_context_path(C, sbuts, path, i, pflag)) {
822 flag |= (1 << i);
823
824 /* setting icon for data context */
825 if (i == BCONTEXT_DATA) {
826 PointerRNA *ptr = &path->ptr[path->len - 1];
827
828 if (ptr->has_type()) {
829 if (RNA_struct_is_a(ptr->type, RNA_Light)) {
830 sbuts->dataicon = ICON_OUTLINER_DATA_LIGHT;
831 }
832 else {
833 sbuts->dataicon = RNA_struct_ui_icon(ptr->type);
834 }
835 }
836 else {
837 sbuts->dataicon = ICON_EMPTY_DATA;
838 }
839 }
840 }
841 }
842
843 /* always try to use the tab that was explicitly
844 * set to the user, so that once that context comes
845 * back, the tab is activated again */
846 sbuts->mainb = sbuts->mainbuser;
847
848 /* in case something becomes invalid, change */
849 if ((flag & (1 << sbuts->mainb)) == 0) {
850 if (sbuts->flag & SB_SHADING_CONTEXT) {
851 /* try to keep showing shading related buttons */
852 sbuts->mainb = buttons_shading_new_context(C, flag);
853 }
854 else if (flag & BCONTEXT_OBJECT) {
855 sbuts->mainb = BCONTEXT_OBJECT;
856 }
857 else {
858 for (int i = 0; i < BCONTEXT_TOT; i++) {
859 if (flag & (1 << i)) {
860 sbuts->mainb = eSpaceButtons_Context(i);
861 break;
862 }
863 }
864 }
865 }
866
867 buttons_context_path(C, sbuts, path, sbuts->mainb, pflag);
868
869 if (!(flag & (1 << sbuts->mainb))) {
870 if (flag & (1 << BCONTEXT_OBJECT)) {
871 sbuts->mainb = BCONTEXT_OBJECT;
872 }
873 else {
874 sbuts->mainb = BCONTEXT_SCENE;
875 }
876 }
877
878 if (buttons_shading_context(C, sbuts->mainb)) {
879 sbuts->flag |= SB_SHADING_CONTEXT;
880 }
881 else {
882 sbuts->flag &= ~SB_SHADING_CONTEXT;
883 }
884
885 sbuts->pathflag = flag;
886}
887
889{
890 for (int i = 0; i < path->len; ++i) {
891 if (ptr->owner_id == path->ptr[i].owner_id) {
892 return true;
893 }
894 }
895 return false;
896}
897
899 const SpaceProperties *sbuts,
900 ScrArea *area)
901{
902 ScrArea *active_area = CTX_wm_area(C);
903 const bool auto_sync = ED_area_has_shared_border(active_area, area) &&
905 return auto_sync || sbuts->outliner_sync == PROPERTIES_SYNC_ALWAYS;
906}
907
909 SpaceProperties *sbuts,
910 PointerRNA *ptr,
911 const eSpaceButtons_Context context)
912{
913 ButsContextPath path;
914 if (buttons_context_path(C, sbuts, &path, context, 0) && is_pointer_in_path(&path, ptr)) {
915 sbuts->mainbuser = context;
916 sbuts->mainb = sbuts->mainbuser;
917 }
918}
919
920/************************* Context Callback ************************/
921
922const char *buttons_context_dir[] = {
923 "texture_slot",
924 "scene",
925 "world",
926 "object",
927 "mesh",
928 "armature",
929 "lattice",
930 "curve",
931 "meta_ball",
932 "light",
933 "speaker",
934 "lightprobe",
935 "camera",
936 "material",
937 "material_slot",
938 "texture",
939 "texture_user",
940 "texture_user_property",
941 "texture_node",
942 "bone",
943 "edit_bone",
944 "pose_bone",
945 "particle_system",
946 "particle_system_editable",
947 "particle_settings",
948 "cloth",
949 "soft_body",
950 "fluid",
951 "collision",
952 "brush",
953 "dynamic_paint",
954 "line_style",
955 "collection",
956 "gpencil",
957 "grease_pencil",
958 "curves",
959 "pointcloud",
960 "volume",
961 "strip",
962 "strip_modifier",
963 nullptr,
964};
965
966int /*eContextResult*/ buttons_context(const bContext *C,
967 const char *member,
969{
971 if (sbuts && sbuts->path == nullptr) {
972 /* path is cleared for #SCREEN_OT_redo_last, when global undo does a file-read which clears the
973 * path (see lib_link_workspace_layout_restore). */
975 }
976 ButsContextPath *path = static_cast<ButsContextPath *>(sbuts ? sbuts->path : nullptr);
977
978 if (!path) {
980 }
981
982 if (sbuts->mainb == BCONTEXT_TOOL) {
984 }
985
986 /* here we handle context, getting data from precomputed path */
987 if (CTX_data_dir(member)) {
988 /* in case of new shading system we skip texture_slot, complex python
989 * UI script logic depends on checking if this is available */
990 if (sbuts->texuser) {
992 }
993 else {
995 }
996 return CTX_RESULT_OK;
997 }
998 if (CTX_data_equals(member, "scene")) {
999 /* Do not return one here if scene is not found in path,
1000 * in this case we want to get default context scene! */
1001 return set_pointer_type(path, result, RNA_Scene);
1002 }
1003 if (CTX_data_equals(member, "world")) {
1004 set_pointer_type(path, result, RNA_World);
1005 return CTX_RESULT_OK;
1006 }
1007 if (CTX_data_equals(member, "collection")) {
1008 /* Do not return one here if collection is not found in path,
1009 * in this case we want to get default context collection! */
1010 return set_pointer_type(path, result, RNA_Collection);
1011 }
1012 if (CTX_data_equals(member, "object")) {
1013 set_pointer_type(path, result, RNA_Object);
1014 return CTX_RESULT_OK;
1015 }
1016 if (CTX_data_equals(member, "mesh")) {
1017 set_pointer_type(path, result, RNA_Mesh);
1018 return CTX_RESULT_OK;
1019 }
1020 if (CTX_data_equals(member, "armature")) {
1021 set_pointer_type(path, result, RNA_Armature);
1022 return CTX_RESULT_OK;
1023 }
1024 if (CTX_data_equals(member, "lattice")) {
1025 set_pointer_type(path, result, RNA_Lattice);
1026 return CTX_RESULT_OK;
1027 }
1028 if (CTX_data_equals(member, "curve")) {
1029 set_pointer_type(path, result, RNA_Curve);
1030 return CTX_RESULT_OK;
1031 }
1032 if (CTX_data_equals(member, "meta_ball")) {
1033 set_pointer_type(path, result, RNA_MetaBall);
1034 return CTX_RESULT_OK;
1035 }
1036 if (CTX_data_equals(member, "light")) {
1037 set_pointer_type(path, result, RNA_Light);
1038 return CTX_RESULT_OK;
1039 }
1040 if (CTX_data_equals(member, "camera")) {
1041 set_pointer_type(path, result, RNA_Camera);
1042 return CTX_RESULT_OK;
1043 }
1044 if (CTX_data_equals(member, "speaker")) {
1045 set_pointer_type(path, result, RNA_Speaker);
1046 return CTX_RESULT_OK;
1047 }
1048 if (CTX_data_equals(member, "lightprobe")) {
1049 set_pointer_type(path, result, RNA_LightProbe);
1050 return CTX_RESULT_OK;
1051 }
1052 if (CTX_data_equals(member, "curves")) {
1053 set_pointer_type(path, result, RNA_Curves);
1054 return CTX_RESULT_OK;
1055 }
1056 if (CTX_data_equals(member, "pointcloud")) {
1057 set_pointer_type(path, result, RNA_PointCloud);
1058 return CTX_RESULT_OK;
1059 }
1060 if (CTX_data_equals(member, "volume")) {
1061 set_pointer_type(path, result, RNA_Volume);
1062 return CTX_RESULT_OK;
1063 }
1064 if (CTX_data_equals(member, "material")) {
1065 set_pointer_type(path, result, RNA_Material);
1066 return CTX_RESULT_OK;
1067 }
1068 if (CTX_data_equals(member, "texture")) {
1069 ButsContextTexture *ct = static_cast<ButsContextTexture *>(sbuts->texuser);
1070
1071 if (ct) {
1072 if (ct->texture == nullptr) {
1073 return CTX_RESULT_NO_DATA;
1074 }
1075
1076 CTX_data_pointer_set(result, &ct->texture->id, RNA_Texture, ct->texture);
1077 }
1078
1079 return CTX_RESULT_OK;
1080 }
1081 if (CTX_data_equals(member, "material_slot")) {
1082 PointerRNA *ptr = get_pointer_type(path, RNA_Object);
1083
1084 if (ptr) {
1085 Object *ob = static_cast<Object *>(ptr->data);
1086
1087 if (ob && OB_TYPE_SUPPORT_MATERIAL(ob->type) && ob->totcol) {
1088 /* a valid actcol isn't ensured #27526. */
1089 int matnr = ob->actcol - 1;
1090 matnr = std::max(matnr, 0);
1091 /* Keep aligned with rna_Object_material_slots_get. */
1093 &ob->id,
1094 RNA_MaterialSlot,
1095 reinterpret_cast<void *>(matnr + uintptr_t(&ob->id)));
1096 }
1097 }
1098
1099 return CTX_RESULT_OK;
1100 }
1101 if (CTX_data_equals(member, "texture_user")) {
1102 ButsContextTexture *ct = static_cast<ButsContextTexture *>(sbuts->texuser);
1103
1104 if (!ct) {
1105 return CTX_RESULT_NO_DATA;
1106 }
1107
1108 if (ct->user && ct->user->ptr) {
1109 ButsTextureUser *user = ct->user;
1111 }
1112
1113 return CTX_RESULT_OK;
1114 }
1115 if (CTX_data_equals(member, "texture_user_property")) {
1116 ButsContextTexture *ct = static_cast<ButsContextTexture *>(sbuts->texuser);
1117
1118 if (!ct) {
1119 return CTX_RESULT_NO_DATA;
1120 }
1121
1122 if (ct->user && ct->user->ptr) {
1123 ButsTextureUser *user = ct->user;
1124 CTX_data_pointer_set(result, nullptr, RNA_Property, user->prop);
1125 }
1126
1127 return CTX_RESULT_OK;
1128 }
1129 if (CTX_data_equals(member, "texture_node")) {
1130 ButsContextTexture *ct = static_cast<ButsContextTexture *>(sbuts->texuser);
1131
1132 if (ct) {
1133 /* new shading system */
1134 if (ct->user && ct->user->node) {
1135 CTX_data_pointer_set(result, &ct->user->ntree->id, RNA_Node, ct->user->node);
1136 }
1137
1138 return CTX_RESULT_OK;
1139 }
1140 return CTX_RESULT_NO_DATA;
1141 }
1142 if (CTX_data_equals(member, "texture_slot")) {
1143 ButsContextTexture *ct = static_cast<ButsContextTexture *>(sbuts->texuser);
1144 PointerRNA *ptr;
1145
1146 /* Particles slots are used in both old and new textures handling. */
1147 if ((ptr = get_pointer_type(path, RNA_ParticleSystem))) {
1148 ParticleSettings *part = (static_cast<ParticleSystem *>(ptr->data))->part;
1149
1150 if (part) {
1152 result, &part->id, RNA_ParticleSettingsTextureSlot, part->mtex[int(part->texact)]);
1153 }
1154 }
1155 else if (ct) {
1156 return CTX_RESULT_MEMBER_NOT_FOUND; /* new shading system */
1157 }
1158 else if ((ptr = get_pointer_type(path, RNA_FreestyleLineStyle))) {
1159 FreestyleLineStyle *ls = static_cast<FreestyleLineStyle *>(ptr->data);
1160
1161 if (ls) {
1162 CTX_data_pointer_set(result, &ls->id, RNA_LineStyleTextureSlot, ls->mtex[int(ls->texact)]);
1163 }
1164 }
1165
1166 return CTX_RESULT_OK;
1167 }
1168 if (CTX_data_equals(member, "bone")) {
1169 set_pointer_type(path, result, RNA_Bone);
1170 return CTX_RESULT_OK;
1171 }
1172 if (CTX_data_equals(member, "edit_bone")) {
1173 set_pointer_type(path, result, RNA_EditBone);
1174 return CTX_RESULT_OK;
1175 }
1176 if (CTX_data_equals(member, "pose_bone")) {
1177 set_pointer_type(path, result, RNA_PoseBone);
1178 return CTX_RESULT_OK;
1179 }
1180 if (CTX_data_equals(member, "particle_system")) {
1181 set_pointer_type(path, result, RNA_ParticleSystem);
1182 return CTX_RESULT_OK;
1183 }
1184 if (CTX_data_equals(member, "particle_system_editable")) {
1185 if (PE_poll(const_cast<bContext *>(C))) {
1186 set_pointer_type(path, result, RNA_ParticleSystem);
1187 }
1188 else {
1189 CTX_data_pointer_set(result, nullptr, RNA_ParticleSystem, nullptr);
1190 }
1191 return CTX_RESULT_OK;
1192 }
1193 if (CTX_data_equals(member, "particle_settings")) {
1194 /* only available when pinned */
1195 PointerRNA *ptr = get_pointer_type(path, RNA_ParticleSettings);
1196
1197 if (ptr && *ptr) {
1199 return CTX_RESULT_OK;
1200 }
1201
1202 /* get settings from active particle system instead */
1203 ptr = get_pointer_type(path, RNA_ParticleSystem);
1204
1205 if (ptr && *ptr) {
1206 ParticleSettings *part = (static_cast<ParticleSystem *>(ptr->data))->part;
1207 CTX_data_pointer_set(result, ptr->owner_id, RNA_ParticleSettings, part);
1208 return CTX_RESULT_OK;
1209 }
1210
1211 set_pointer_type(path, result, RNA_ParticleSettings);
1212 return CTX_RESULT_OK;
1213 }
1214 if (CTX_data_equals(member, "cloth")) {
1215 PointerRNA *ptr = get_pointer_type(path, RNA_Object);
1216
1217 if (ptr && *ptr) {
1218 Object *ob = static_cast<Object *>(ptr->data);
1220 CTX_data_pointer_set(result, &ob->id, RNA_ClothModifier, md);
1221 return CTX_RESULT_OK;
1222 }
1223 return CTX_RESULT_NO_DATA;
1224 }
1225 if (CTX_data_equals(member, "soft_body")) {
1226 PointerRNA *ptr = get_pointer_type(path, RNA_Object);
1227
1228 if (ptr && *ptr) {
1229 Object *ob = static_cast<Object *>(ptr->data);
1231 CTX_data_pointer_set(result, &ob->id, RNA_SoftBodyModifier, md);
1232 return CTX_RESULT_OK;
1233 }
1234 return CTX_RESULT_NO_DATA;
1235 }
1236
1237 if (CTX_data_equals(member, "fluid")) {
1238 PointerRNA *ptr = get_pointer_type(path, RNA_Object);
1239
1240 if (ptr && *ptr) {
1241 Object *ob = static_cast<Object *>(ptr->data);
1243 CTX_data_pointer_set(result, &ob->id, RNA_FluidModifier, md);
1244 return CTX_RESULT_OK;
1245 }
1246 return CTX_RESULT_NO_DATA;
1247 }
1248 if (CTX_data_equals(member, "collision")) {
1249 PointerRNA *ptr = get_pointer_type(path, RNA_Object);
1250
1251 if (ptr && *ptr) {
1252 Object *ob = static_cast<Object *>(ptr->data);
1254 CTX_data_pointer_set(result, &ob->id, RNA_CollisionModifier, md);
1255 return CTX_RESULT_OK;
1256 }
1257 return CTX_RESULT_NO_DATA;
1258 }
1259 if (CTX_data_equals(member, "brush")) {
1260 set_pointer_type(path, result, RNA_Brush);
1261 return CTX_RESULT_OK;
1262 }
1263 if (CTX_data_equals(member, "dynamic_paint")) {
1264 PointerRNA *ptr = get_pointer_type(path, RNA_Object);
1265
1266 if (ptr && *ptr) {
1267 Object *ob = static_cast<Object *>(ptr->data);
1269 CTX_data_pointer_set(result, &ob->id, RNA_DynamicPaintModifier, md);
1270 return CTX_RESULT_OK;
1271 }
1272 return CTX_RESULT_NO_DATA;
1273 }
1274 if (CTX_data_equals(member, "line_style")) {
1275 set_pointer_type(path, result, RNA_FreestyleLineStyle);
1276 return CTX_RESULT_OK;
1277 }
1278 if (CTX_data_equals(member, "gpencil")) {
1279 set_pointer_type(path, result, RNA_Annotation);
1280 return CTX_RESULT_OK;
1281 }
1282 if (CTX_data_equals(member, "grease_pencil")) {
1283 set_pointer_type(path, result, RNA_GreasePencil);
1284 return CTX_RESULT_OK;
1285 }
1286 if (CTX_data_equals(member, "strip")) {
1287 set_pointer_type(path, result, RNA_Strip);
1288 return CTX_RESULT_OK;
1289 }
1290 if (CTX_data_equals(member, "strip_modifier")) {
1291 set_pointer_type(path, result, RNA_StripModifier);
1292 return CTX_RESULT_OK;
1293 }
1295}
1296
1297/************************* Drawing the Path ************************/
1298
1299static bool buttons_panel_context_poll(const bContext *C, PanelType * /*pt*/)
1300{
1302 return sbuts->mainb != BCONTEXT_TOOL;
1303}
1304
1305static void buttons_panel_context_draw(const bContext *C, Panel *panel)
1306{
1308 ButsContextPath *path = static_cast<ButsContextPath *>(sbuts->path);
1309
1310 if (!path) {
1311 return;
1312 }
1313
1314 ui::Layout &row = panel->layout->row(true);
1316
1317 bool first = true;
1318 for (int i = 0; i < path->len; i++) {
1319 PointerRNA *ptr = &path->ptr[i];
1320
1321 /* Skip scene and view layer to save space. */
1322 if (!ELEM(sbuts->mainb,
1331 ptr->type == RNA_Scene)
1332 {
1333 continue;
1334 }
1335 if (!ELEM(sbuts->mainb,
1340 BCONTEXT_WORLD) &&
1341 ptr->type == RNA_ViewLayer)
1342 {
1343 continue;
1344 }
1345
1346 if (!*ptr) {
1347 continue;
1348 }
1349
1350 /* Add > triangle. */
1351 if (!first) {
1352 row.label("", ICON_RIGHTARROW);
1353 }
1354
1355 /* Add icon and name. */
1356 int icon = RNA_struct_ui_icon(ptr->type);
1357 char namebuf[128];
1358 char *name = RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf), nullptr);
1359
1360 if (name) {
1361 uiItemLDrag(&row, ptr, name, icon);
1362
1363 if (name != namebuf) {
1364 MEM_delete(name);
1365 }
1366 }
1367 else {
1368 row.label("", icon);
1369 }
1370
1371 first = false;
1372 }
1373
1374 ui::Layout &pin_row = row.row(false);
1376 pin_row.separator_spacer();
1378 pin_row.op(
1379 "BUTTONS_OT_toggle_pin", "", (sbuts->flag & SB_PIN_CONTEXT) ? ICON_PINNED : ICON_UNPINNED);
1380}
1381
1383{
1384 PanelType *pt = MEM_new_zeroed<PanelType>("spacetype buttons panel context");
1385 STRNCPY_UTF8(pt->idname, "PROPERTIES_PT_context");
1386 STRNCPY_UTF8(pt->label, N_("Context")); /* XXX C panels unavailable through RNA bpy.types! */
1391 BLI_addtail(&art->paneltypes, pt);
1392}
1393
1395{
1397 ButsContextPath *path = static_cast<ButsContextPath *>(sbuts->path);
1398
1399 if (path->len == 0) {
1400 return nullptr;
1401 }
1402
1403 for (int i = path->len - 1; i >= 0; i--) {
1404 PointerRNA *ptr = &path->ptr[i];
1405
1406 /* Pin particle settings instead of system, since only settings are an ID-block. */
1407 if (sbuts->mainb == BCONTEXT_PARTICLE && sbuts->flag & SB_PIN_CONTEXT) {
1408 if (ptr->type == RNA_ParticleSystem && *ptr) {
1409 ParticleSystem *psys = static_cast<ParticleSystem *>(ptr->data);
1410 return &psys->part->id;
1411 }
1412 }
1413
1414 /* There is no valid image ID panel, Image Empty objects need this workaround. */
1415 if (sbuts->mainb == BCONTEXT_DATA && sbuts->flag & SB_PIN_CONTEXT) {
1416 if (ptr->type == RNA_Image && *ptr) {
1417 continue;
1418 }
1419 }
1420
1421 if (ptr->owner_id) {
1422 return ptr->owner_id;
1423 }
1424 }
1425
1426 return nullptr;
1427}
1428
1429} // namespace blender
Blender kernel action and pose functionality.
Blender kernel freestyle line style functionality.
General operations, lookup, etc. for materials.
General operations, lookup, etc. for blender objects.
#define STRNCPY_UTF8(dst, src)
#define BLT_I18NCONTEXT_DEFAULT_BPYRNA
Object groups, one object can be in many groups at once.
#define OB_TYPE_SUPPORT_MATERIAL(_type)
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define ELEM(...)
Definition scene.h:133
SceneCompositorEffect * get_active_effect(const Scene &scene)
T max(const T &a, const T &b)
Strip * select_active_get(const Scene *scene)
StripModifierData * modifier_get_active(const Strip *strip)
BMesh Iterators.
static bool buttons_context_path_world(ButsContextPath *path)
static eSpaceButtons_Context buttons_shading_new_context(const bContext *C, int flag)
bool ED_buttons_should_sync_with_outliner(const bContext *C, const SpaceProperties *sbuts, ScrArea *area)
ScrArea * CTX_wm_area(const bContext *C)
static bool buttons_context_path_strip_modifier(Scene *sequencer_scene, ButsContextPath *path)
@ PROPERTIES_SYNC_ALWAYS
void ED_buttons_set_context(const bContext *C, SpaceProperties *sbuts, PointerRNA *ptr, eSpaceButtons_Context context)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
static int set_pointer_type(ButsContextPath *path, bContextDataResult *result, StructRNA *type)
static bool buttons_context_path_compositor(ButsContextPath *path)
void CTX_data_dir_set(bContextDataResult *result, const char **dir)
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
int buttons_context(const bContext *C, const char *member, bContextDataResult *result)
struct ParticleSystem * psys_get_current(struct Object *ob)
Definition particle.cc:571
PointerRNA RNA_id_pointer_create(ID *id)
static bool buttons_context_path_texture(const bContext *C, ButsContextPath *path, ButsContextTexture *ct)
ID * buttons_context_id_path(const bContext *C)
Material * BKE_object_material_get(Object *ob, short act)
void buttons_context_register(ARegionType *art)
static bool buttons_context_path(const bContext *C, SpaceProperties *sbuts, ButsContextPath *path, int mainb, int flag)
const char * buttons_context_dir[]
@ eModifierType_DynamicPaint
static bool buttons_context_path_shaderfx(ButsContextPath *path)
static bool buttons_context_path_bone(ButsContextPath *path)
wmWindow * CTX_wm_window(const bContext *C)
char * RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, int *r_len)
static bool buttons_panel_context_poll(const bContext *C, PanelType *)
bool CTX_data_equals(const char *member, const char *str)
bool ED_area_has_shared_border(ScrArea *a, ScrArea *b)
Definition area.cc:2328
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
static bool buttons_context_path_brush(const bContext *C, ButsContextPath *path)
ViewLayer * BKE_view_layer_default_view(const Scene *scene)
ModifierData * BKE_object_active_modifier(const Object *ob)
Definition object.cc:1427
static bool buttons_context_path_strip(ButsContextPath *path)
static bool buttons_context_path_pose_bone(ButsContextPath *path)
static bool is_pointer_in_path(ButsContextPath *path, PointerRNA *ptr)
Scene * WM_window_get_active_scene(const wmWindow *win)
LayerCollection * BKE_view_layer_active_collection_get(ViewLayer *view_layer)
void buttons_context_compute(const bContext *C, SpaceProperties *sbuts)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
static PointerRNA * get_pointer_type(ButsContextPath *path, StructRNA *type)
void CTX_data_pointer_set_ptr(bContextDataResult *result, const PointerRNA *ptr)
void CTX_data_pointer_set(bContextDataResult *result, ID *id, StructRNA *type, void *data)
static bool buttons_context_path_data(ButsContextPath *path, int type)
static bool buttons_context_path_material(ButsContextPath *path)
WorkSpace * WM_window_get_active_workspace(const wmWindow *win)
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
@ BCONTEXT_STRIP_MODIFIER
@ BCONTEXT_BONE_CONSTRAINT
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
static bool buttons_context_path_particle(ButsContextPath *path)
static bool buttons_shading_context(const bContext *C, int mainb)
bool CTX_data_dir(const char *member)
_W64 unsigned int uintptr_t
Definition BKE_text.h:120
static bool buttons_context_path_collection(const bContext *C, ButsContextPath *path, wmWindow *window)
int RNA_struct_ui_icon(const StructRNA *type)
static bool buttons_context_path_object(ButsContextPath *path)
static bool buttons_context_path_scene(ButsContextPath *path)
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
Main * CTX_data_main(const bContext *C)
@ PANEL_TYPE_NO_HEADER
@ PANEL_TYPE_NO_SEARCH
static void buttons_panel_context_draw(const bContext *C, Panel *panel)
FreestyleLineStyle * BKE_linestyle_active_from_view_layer(struct ViewLayer *view_layer)
Definition linestyle.cc:773
ID_Type GS(const char *name)
Definition DNA_ID.h:410
static bool buttons_context_path_linestyle(ButsContextPath *path, wmWindow *window)
Brush * BKE_paint_brush(Paint *paint)
Scene * CTX_data_scene(const bContext *C)
bool PE_poll(bContext *C)
@ CTX_RESULT_MEMBER_NOT_FOUND
@ CTX_RESULT_NO_DATA
void buttons_texture_context_compute(const bContext *C, SpaceProperties *sbuts)
SpaceProperties * CTX_wm_space_properties(const bContext *C)
bPoseChannel * BKE_pose_channel_find_name(const bPose *pose, const char *name)
static bool buttons_context_path_view_layer(ButsContextPath *path, wmWindow *win)
Paint * BKE_paint_get_active(const Main &bmain, Scene *sce, ViewLayer *view_layer)
static bool buttons_context_path_modifier(ButsContextPath *path)
@ FREESTYLE_CONTROL_EDITOR_MODE
ListBaseT< PanelType > paneltypes
struct ButsTextureUser * user
struct Collection * collection
eObject_EmptyDrawType empty_drawtype
struct bPose * pose
char translation_context[BKE_ST_MAXNAME]
void(*) draw(const bContext *C, Panel *panel)
bool(*) poll(const bContext *C, PanelType *pt)
char idname[BKE_ST_MAXNAME]
char label[BKE_ST_MAXNAME]
ui::Layout * layout
T * data_as() const
Definition RNA_types.hh:139
bool has_type() const
Definition RNA_types.hh:180
StructRNA * type
Definition RNA_types.hh:63
struct World * world
struct Collection * master_collection
eSpaceButtons_Flag flag
eSpaceButtons_Context mainb
eSpaceButtons_Context mainbuser
eSpaceButtons_OutlinerSync outliner_sync
struct Scene * sequencer_scene
ListBaseT< EditBone > * edbo
struct EditBone * act_edbone
void alignment_set(LayoutAlign alignment)
void label(StringRef name, int icon)
PointerRNA op(wmOperatorType *ot, std::optional< StringRef > name, int icon, wm::OpCallContext context, eUI_Item_Flag flag)
Layout & row(bool align)
void emboss_set(EmbossType emboss)
#define N_(msgid)