Blender  V3.3
buttons_context.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2009 Blender Foundation. All rights reserved. */
3 
8 #include <stdlib.h>
9 #include <string.h>
10 
11 #include "MEM_guardedalloc.h"
12 
13 #include "BLI_listbase.h"
14 #include "BLI_utildefines.h"
15 
16 #include "BLT_translation.h"
17 
18 #include "DNA_armature_types.h"
19 #include "DNA_brush_types.h"
20 #include "DNA_collection_types.h"
21 #include "DNA_linestyle_types.h"
22 #include "DNA_material_types.h"
23 #include "DNA_node_types.h"
24 #include "DNA_scene_types.h"
26 #include "DNA_world_types.h"
27 
28 #include "BKE_action.h"
29 #include "BKE_armature.h"
30 #include "BKE_context.h"
31 #include "BKE_layer.h"
32 #include "BKE_linestyle.h"
33 #include "BKE_material.h"
34 #include "BKE_modifier.h"
35 #include "BKE_object.h"
36 #include "BKE_paint.h"
37 #include "BKE_particle.h"
38 #include "BKE_screen.h"
39 
40 #include "RNA_access.h"
41 #include "RNA_prototypes.h"
42 
43 #include "ED_buttons.h"
44 #include "ED_physics.h"
45 #include "ED_screen.h"
46 
47 #include "UI_interface.h"
48 #include "UI_resources.h"
49 
50 #include "WM_api.h"
51 
52 #include "buttons_intern.h" /* own include */
53 
55 {
56  for (int i = 0; i < path->len; i++) {
57  PointerRNA *ptr = &path->ptr[i];
58 
59  if (RNA_struct_is_a(ptr->type, type)) {
61  return CTX_RESULT_OK;
62  }
63  }
64 
66 }
67 
69 {
70  for (int i = 0; i < path->len; i++) {
71  PointerRNA *ptr = &path->ptr[i];
72 
73  if (RNA_struct_is_a(ptr->type, type)) {
74  return ptr;
75  }
76  }
77 
78  return NULL;
79 }
80 
81 /************************* Creating the Path ************************/
82 
84 {
85  PointerRNA *ptr = &path->ptr[path->len - 1];
86 
87  /* this one just verifies */
88  return RNA_struct_is_a(ptr->type, &RNA_Scene);
89 }
90 
92 {
93  PointerRNA *ptr = &path->ptr[path->len - 1];
94 
95  /* View Layer may have already been resolved in a previous call
96  * (e.g. in buttons_context_path_linestyle). */
97  if (RNA_struct_is_a(ptr->type, &RNA_ViewLayer)) {
98  return true;
99  }
100 
101  if (buttons_context_path_scene(path)) {
102  Scene *scene = path->ptr[path->len - 1].data;
103  ViewLayer *view_layer = (win->scene == scene) ? WM_window_get_active_view_layer(win) :
105 
106  RNA_pointer_create(&scene->id, &RNA_ViewLayer, view_layer, &path->ptr[path->len]);
107  path->len++;
108  return true;
109  }
110 
111  return false;
112 }
113 
114 /* NOTE: this function can return true without adding a world to the path
115  * so the buttons stay visible, but be sure to check the ID type if a ID_WO */
117 {
118  PointerRNA *ptr = &path->ptr[path->len - 1];
119 
120  /* if we already have a (pinned) world, we're done */
121  if (RNA_struct_is_a(ptr->type, &RNA_World)) {
122  return true;
123  }
124  /* if we have a scene, use the scene's world */
125  if (buttons_context_path_scene(path)) {
126  Scene *scene = path->ptr[path->len - 1].data;
127  World *world = scene->world;
128 
129  if (world) {
130  RNA_id_pointer_create(&scene->world->id, &path->ptr[path->len]);
131  path->len++;
132  return true;
133  }
134 
135  return true;
136  }
137 
138  /* no path to a world possible */
139  return false;
140 }
141 
143  ButsContextPath *path,
144  wmWindow *window)
145 {
146  PointerRNA *ptr = &path->ptr[path->len - 1];
147 
148  /* if we already have a (pinned) collection, we're done */
149  if (RNA_struct_is_a(ptr->type, &RNA_Collection)) {
150  return true;
151  }
152 
154 
155  /* if we have a view layer, use the view layer's active collection */
156  if (buttons_context_path_view_layer(path, window)) {
157  ViewLayer *view_layer = path->ptr[path->len - 1].data;
158  Collection *c = view_layer->active_collection->collection;
159 
160  /* Do not show collection tab for master collection. */
161  if (c == scene->master_collection) {
162  return false;
163  }
164 
165  if (c) {
166  RNA_id_pointer_create(&c->id, &path->ptr[path->len]);
167  path->len++;
168  return true;
169  }
170  }
171 
172  /* no path to a collection possible */
173  return false;
174 }
175 
177 {
178  PointerRNA *ptr = &path->ptr[path->len - 1];
179 
180  /* if we already have a (pinned) linestyle, we're done */
181  if (RNA_struct_is_a(ptr->type, &RNA_FreestyleLineStyle)) {
182  return true;
183  }
184  /* if we have a view layer, use the lineset's linestyle */
185  if (buttons_context_path_view_layer(path, window)) {
186  ViewLayer *view_layer = path->ptr[path->len - 1].data;
188  if (linestyle) {
189  RNA_id_pointer_create(&linestyle->id, &path->ptr[path->len]);
190  path->len++;
191  return true;
192  }
193  }
194 
195  /* no path to a linestyle possible */
196  return false;
197 }
198 
200 {
201  PointerRNA *ptr = &path->ptr[path->len - 1];
202 
203  /* if we already have a (pinned) object, we're done */
204  if (RNA_struct_is_a(ptr->type, &RNA_Object)) {
205  return true;
206  }
207  if (!RNA_struct_is_a(ptr->type, &RNA_ViewLayer)) {
208  return false;
209  }
210 
211  ViewLayer *view_layer = ptr->data;
212  Object *ob = (view_layer->basact) ? view_layer->basact->object : NULL;
213 
214  if (ob) {
215  RNA_id_pointer_create(&ob->id, &path->ptr[path->len]);
216  path->len++;
217 
218  return true;
219  }
220 
221  /* no path to a object possible */
222  return false;
223 }
224 
226 {
227  PointerRNA *ptr = &path->ptr[path->len - 1];
228 
229  /* if we already have a data, we're done */
230  if (RNA_struct_is_a(ptr->type, &RNA_Mesh) && (ELEM(type, -1, OB_MESH))) {
231  return true;
232  }
233  if (RNA_struct_is_a(ptr->type, &RNA_Curve) &&
234  (type == -1 || ELEM(type, OB_CURVES_LEGACY, OB_SURF, OB_FONT))) {
235  return true;
236  }
237  if (RNA_struct_is_a(ptr->type, &RNA_Armature) && (ELEM(type, -1, OB_ARMATURE))) {
238  return true;
239  }
240  if (RNA_struct_is_a(ptr->type, &RNA_MetaBall) && (ELEM(type, -1, OB_MBALL))) {
241  return true;
242  }
243  if (RNA_struct_is_a(ptr->type, &RNA_Lattice) && (ELEM(type, -1, OB_LATTICE))) {
244  return true;
245  }
246  if (RNA_struct_is_a(ptr->type, &RNA_Camera) && (ELEM(type, -1, OB_CAMERA))) {
247  return true;
248  }
249  if (RNA_struct_is_a(ptr->type, &RNA_Light) && (ELEM(type, -1, OB_LAMP))) {
250  return true;
251  }
252  if (RNA_struct_is_a(ptr->type, &RNA_Speaker) && (ELEM(type, -1, OB_SPEAKER))) {
253  return true;
254  }
255  if (RNA_struct_is_a(ptr->type, &RNA_LightProbe) && (ELEM(type, -1, OB_LIGHTPROBE))) {
256  return true;
257  }
258  if (RNA_struct_is_a(ptr->type, &RNA_GreasePencil) && (ELEM(type, -1, OB_GPENCIL))) {
259  return true;
260  }
261  if (RNA_struct_is_a(ptr->type, &RNA_Curves) && (ELEM(type, -1, OB_CURVES))) {
262  return true;
263  }
264 #ifdef WITH_POINT_CLOUD
265  if (RNA_struct_is_a(ptr->type, &RNA_PointCloud) && (ELEM(type, -1, OB_POINTCLOUD))) {
266  return true;
267  }
268 #endif
269  if (RNA_struct_is_a(ptr->type, &RNA_Volume) && (ELEM(type, -1, OB_VOLUME))) {
270  return true;
271  }
272  /* try to get an object in the path, no pinning supported here */
273  if (buttons_context_path_object(path)) {
274  Object *ob = path->ptr[path->len - 1].data;
275 
276  if (ob && (ELEM(type, -1, ob->type))) {
277  RNA_id_pointer_create(ob->data, &path->ptr[path->len]);
278  path->len++;
279 
280  return true;
281  }
282  }
283 
284  /* no path to data possible */
285  return false;
286 }
287 
289 {
290  if (buttons_context_path_object(path)) {
291  Object *ob = path->ptr[path->len - 1].data;
292 
293  if (ELEM(ob->type,
294  OB_MESH,
296  OB_FONT,
297  OB_SURF,
298  OB_LATTICE,
299  OB_GPENCIL,
300  OB_CURVES,
302  OB_VOLUME)) {
304  if (md != NULL) {
305  RNA_pointer_create(&ob->id, &RNA_Modifier, md, &path->ptr[path->len]);
306  path->len++;
307  }
308 
309  return true;
310  }
311  }
312 
313  return false;
314 }
315 
317 {
318  if (buttons_context_path_object(path)) {
319  Object *ob = path->ptr[path->len - 1].data;
320 
321  if (ob && ELEM(ob->type, OB_GPENCIL)) {
322  return true;
323  }
324  }
325 
326  return false;
327 }
328 
330 {
331  PointerRNA *ptr = &path->ptr[path->len - 1];
332 
333  /* if we already have a (pinned) material, we're done */
334  if (RNA_struct_is_a(ptr->type, &RNA_Material)) {
335  return true;
336  }
337  /* if we have an object, use the object material slot */
338  if (buttons_context_path_object(path)) {
339  Object *ob = path->ptr[path->len - 1].data;
340 
341  if (ob && OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
342  Material *ma = BKE_object_material_get(ob, ob->actcol);
343  if (ma != NULL) {
344  RNA_id_pointer_create(&ma->id, &path->ptr[path->len]);
345  path->len++;
346  }
347  return true;
348  }
349  }
350 
351  /* no path to a material possible */
352  return false;
353 }
354 
356 {
357  /* if we have an armature, get the active bone */
359  bArmature *arm = path->ptr[path->len - 1].data;
360 
361  if (arm->edbo) {
362  if (arm->act_edbone) {
363  EditBone *edbo = arm->act_edbone;
364  RNA_pointer_create(&arm->id, &RNA_EditBone, edbo, &path->ptr[path->len]);
365  path->len++;
366  return true;
367  }
368  }
369  else {
370  if (arm->act_bone) {
371  RNA_pointer_create(&arm->id, &RNA_Bone, arm->act_bone, &path->ptr[path->len]);
372  path->len++;
373  return true;
374  }
375  }
376  }
377 
378  /* no path to a bone possible */
379  return false;
380 }
381 
383 {
384  PointerRNA *ptr = &path->ptr[path->len - 1];
385 
386  /* if we already have a (pinned) PoseBone, we're done */
387  if (RNA_struct_is_a(ptr->type, &RNA_PoseBone)) {
388  return true;
389  }
390 
391  /* if we have an armature, get the active bone */
392  if (buttons_context_path_object(path)) {
393  Object *ob = path->ptr[path->len - 1].data;
394  bArmature *arm = ob->data; /* path->ptr[path->len-1].data - works too */
395 
396  if (ob->type != OB_ARMATURE || arm->edbo) {
397  return false;
398  }
399 
400  if (arm->act_bone) {
402  if (pchan) {
403  RNA_pointer_create(&ob->id, &RNA_PoseBone, pchan, &path->ptr[path->len]);
404  path->len++;
405  return true;
406  }
407  }
408  }
409 
410  /* no path to a bone possible */
411  return false;
412 }
413 
415 {
416  PointerRNA *ptr = &path->ptr[path->len - 1];
417 
418  /* if we already have (pinned) particle settings, we're done */
419  if (RNA_struct_is_a(ptr->type, &RNA_ParticleSettings)) {
420  return true;
421  }
422  /* if we have an object, get the active particle system */
423  if (buttons_context_path_object(path)) {
424  Object *ob = path->ptr[path->len - 1].data;
425 
426  if (ob && ob->type == OB_MESH) {
427  ParticleSystem *psys = psys_get_current(ob);
428 
429  RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &path->ptr[path->len]);
430  path->len++;
431  return true;
432  }
433  }
434 
435  /* no path to a particle system possible */
436  return false;
437 }
438 
440 {
441  PointerRNA *ptr = &path->ptr[path->len - 1];
442 
443  /* if we already have a (pinned) brush, we're done */
444  if (RNA_struct_is_a(ptr->type, &RNA_Brush)) {
445  return true;
446  }
447  /* if we have a scene, use the toolsettings brushes */
448  if (buttons_context_path_scene(path)) {
449  Scene *scene = path->ptr[path->len - 1].data;
450 
451  Brush *br = NULL;
452  if (scene) {
453  wmWindow *window = CTX_wm_window(C);
454  ViewLayer *view_layer = WM_window_get_active_view_layer(window);
455  br = BKE_paint_brush(BKE_paint_get_active(scene, view_layer));
456  }
457 
458  if (br) {
459  RNA_id_pointer_create((ID *)br, &path->ptr[path->len]);
460  path->len++;
461 
462  return true;
463  }
464  }
465 
466  /* no path to a brush possible */
467  return false;
468 }
469 
471  ButsContextPath *path,
472  ButsContextTexture *ct)
473 {
474  PointerRNA *ptr = &path->ptr[path->len - 1];
475 
476  if (!ct) {
477  return false;
478  }
479 
480  /* if we already have a (pinned) texture, we're done */
481  if (RNA_struct_is_a(ptr->type, &RNA_Texture)) {
482  return true;
483  }
484 
485  if (!ct->user) {
486  return false;
487  }
488 
489  ID *id = ct->user->id;
490 
491  if (id) {
492  if (GS(id->name) == ID_BR) {
494  }
495  else if (GS(id->name) == ID_PA) {
497  }
498  else if (GS(id->name) == ID_OB) {
500  }
501  else if (GS(id->name) == ID_LS) {
503  }
504  }
505 
506  if (ct->texture) {
507  RNA_id_pointer_create(&ct->texture->id, &path->ptr[path->len]);
508  path->len++;
509  }
510 
511  return true;
512 }
513 
514 #ifdef WITH_FREESTYLE
515 static bool buttons_context_linestyle_pinnable(const bContext *C, ViewLayer *view_layer)
516 {
517  wmWindow *window = CTX_wm_window(C);
519 
520  /* if Freestyle is disabled in the scene */
521  if ((scene->r.mode & R_EDGE_FRS) == 0) {
522  return false;
523  }
524  /* if Freestyle is not in the Parameter Editor mode */
525  FreestyleConfig *config = &view_layer->freestyle_config;
526  if (config->mode != FREESTYLE_CONTROL_EDITOR_MODE) {
527  return false;
528  }
529  /* if the scene has already been pinned */
531  if (sbuts->pinid && sbuts->pinid == &scene->id) {
532  return false;
533  }
534  return true;
535 }
536 #endif
537 
539  const bContext *C, SpaceProperties *sbuts, ButsContextPath *path, int mainb, int flag)
540 {
541  /* Note we don't use CTX_data here, instead we get it from the window.
542  * Otherwise there is a loop reading the context that we are setting. */
543  wmWindow *window = CTX_wm_window(C);
545  ViewLayer *view_layer = WM_window_get_active_view_layer(window);
546 
547  memset(path, 0, sizeof(*path));
548  path->flag = flag;
549 
550  /* If some ID datablock is pinned, set the root pointer. */
551  if (sbuts->pinid) {
552  ID *id = sbuts->pinid;
553 
554  RNA_id_pointer_create(id, &path->ptr[0]);
555  path->len++;
556  }
557  /* No pinned root, use scene as initial root. */
558  else if (mainb != BCONTEXT_TOOL) {
559  RNA_id_pointer_create(&scene->id, &path->ptr[0]);
560  path->len++;
561 
562  if (!ELEM(mainb,
567  BCONTEXT_WORLD)) {
568  RNA_pointer_create(NULL, &RNA_ViewLayer, view_layer, &path->ptr[path->len]);
569  path->len++;
570  }
571  }
572 
573  /* now for each buttons context type, we try to construct a path,
574  * tracing back recursively */
575  bool found;
576  switch (mainb) {
577  case BCONTEXT_SCENE:
578  case BCONTEXT_RENDER:
579  case BCONTEXT_OUTPUT:
580  found = buttons_context_path_scene(path);
581  break;
582  case BCONTEXT_VIEW_LAYER:
583 #ifdef WITH_FREESTYLE
584  if (buttons_context_linestyle_pinnable(C, view_layer)) {
585  found = buttons_context_path_linestyle(path, window);
586  if (found) {
587  break;
588  }
589  }
590 #endif
591  found = buttons_context_path_view_layer(path, window);
592  break;
593  case BCONTEXT_WORLD:
594  found = buttons_context_path_world(path);
595  break;
596  case BCONTEXT_COLLECTION: /* This is for Line Art collection flags */
597  found = buttons_context_path_collection(C, path, window);
598  break;
599  case BCONTEXT_TOOL:
600  found = true;
601  break;
602  case BCONTEXT_OBJECT:
603  case BCONTEXT_PHYSICS:
604  case BCONTEXT_CONSTRAINT:
605  found = buttons_context_path_object(path);
606  break;
607  case BCONTEXT_MODIFIER:
608  found = buttons_context_path_modifier(path);
609  break;
610  case BCONTEXT_SHADERFX:
611  found = buttons_context_path_shaderfx(path);
612  break;
613  case BCONTEXT_DATA:
614  found = buttons_context_path_data(path, -1);
615  break;
616  case BCONTEXT_PARTICLE:
617  found = buttons_context_path_particle(path);
618  break;
619  case BCONTEXT_MATERIAL:
620  found = buttons_context_path_material(path);
621  break;
622  case BCONTEXT_TEXTURE:
623  found = buttons_context_path_texture(C, path, sbuts->texuser);
624  break;
625  case BCONTEXT_BONE:
626  found = buttons_context_path_bone(path);
627  if (!found) {
628  found = buttons_context_path_data(path, OB_ARMATURE);
629  }
630  break;
632  found = buttons_context_path_pose_bone(path);
633  break;
634  default:
635  found = false;
636  break;
637  }
638 
639  return found;
640 }
641 
642 static bool buttons_shading_context(const bContext *C, int mainb)
643 {
644  wmWindow *window = CTX_wm_window(C);
645  ViewLayer *view_layer = WM_window_get_active_view_layer(window);
646  Object *ob = OBACT(view_layer);
647 
649  return true;
650  }
651  if (mainb == BCONTEXT_DATA && ob && ELEM(ob->type, OB_LAMP, OB_CAMERA)) {
652  return true;
653  }
654 
655  return false;
656 }
657 
658 static int buttons_shading_new_context(const bContext *C, int flag)
659 {
660  wmWindow *window = CTX_wm_window(C);
661  ViewLayer *view_layer = WM_window_get_active_view_layer(window);
662  Object *ob = OBACT(view_layer);
663 
664  if (flag & (1 << BCONTEXT_MATERIAL)) {
665  return BCONTEXT_MATERIAL;
666  }
667  if (ob && ELEM(ob->type, OB_LAMP, OB_CAMERA) && (flag & (1 << BCONTEXT_DATA))) {
668  return BCONTEXT_DATA;
669  }
670  if (flag & (1 << BCONTEXT_WORLD)) {
671  return BCONTEXT_WORLD;
672  }
673 
674  return BCONTEXT_RENDER;
675 }
676 
678 {
679  if (!sbuts->path) {
680  sbuts->path = MEM_callocN(sizeof(ButsContextPath), "ButsContextPath");
681  }
682 
683  ButsContextPath *path = sbuts->path;
684 
685  int pflag = 0;
686  int flag = 0;
687 
688  /* Set scene path. */
689  buttons_context_path(C, sbuts, path, BCONTEXT_SCENE, pflag);
690 
692 
693  /* for each context, see if we can compute a valid path to it, if
694  * this is the case, we know we have to display the button */
695  for (int i = 0; i < BCONTEXT_TOT; i++) {
696  if (buttons_context_path(C, sbuts, path, i, pflag)) {
697  flag |= (1 << i);
698 
699  /* setting icon for data context */
700  if (i == BCONTEXT_DATA) {
701  PointerRNA *ptr = &path->ptr[path->len - 1];
702 
703  if (ptr->type) {
704  if (RNA_struct_is_a(ptr->type, &RNA_Light)) {
705  sbuts->dataicon = ICON_OUTLINER_DATA_LIGHT;
706  }
707  else {
708  sbuts->dataicon = RNA_struct_ui_icon(ptr->type);
709  }
710  }
711  else {
712  sbuts->dataicon = ICON_EMPTY_DATA;
713  }
714  }
715  }
716  }
717 
718  /* always try to use the tab that was explicitly
719  * set to the user, so that once that context comes
720  * back, the tab is activated again */
721  sbuts->mainb = sbuts->mainbuser;
722 
723  /* in case something becomes invalid, change */
724  if ((flag & (1 << sbuts->mainb)) == 0) {
725  if (sbuts->flag & SB_SHADING_CONTEXT) {
726  /* try to keep showing shading related buttons */
727  sbuts->mainb = buttons_shading_new_context(C, flag);
728  }
729  else if (flag & BCONTEXT_OBJECT) {
730  sbuts->mainb = BCONTEXT_OBJECT;
731  }
732  else {
733  for (int i = 0; i < BCONTEXT_TOT; i++) {
734  if (flag & (1 << i)) {
735  sbuts->mainb = i;
736  break;
737  }
738  }
739  }
740  }
741 
742  buttons_context_path(C, sbuts, path, sbuts->mainb, pflag);
743 
744  if (!(flag & (1 << sbuts->mainb))) {
745  if (flag & (1 << BCONTEXT_OBJECT)) {
746  sbuts->mainb = BCONTEXT_OBJECT;
747  }
748  else {
749  sbuts->mainb = BCONTEXT_SCENE;
750  }
751  }
752 
753  if (buttons_shading_context(C, sbuts->mainb)) {
754  sbuts->flag |= SB_SHADING_CONTEXT;
755  }
756  else {
757  sbuts->flag &= ~SB_SHADING_CONTEXT;
758  }
759 
760  sbuts->pathflag = flag;
761 }
762 
764 {
765  for (int i = 0; i < path->len; ++i) {
766  if (ptr->owner_id == path->ptr[i].owner_id) {
767  return true;
768  }
769  }
770  return false;
771 }
772 
774  const SpaceProperties *sbuts,
775  ScrArea *area)
776 {
777  ScrArea *active_area = CTX_wm_area(C);
778  const bool auto_sync = ED_area_has_shared_border(active_area, area) &&
780  return auto_sync || sbuts->outliner_sync == PROPERTIES_SYNC_ALWAYS;
781 }
782 
784  SpaceProperties *sbuts,
785  PointerRNA *ptr,
786  const int context)
787 {
788  ButsContextPath path;
789  if (buttons_context_path(C, sbuts, &path, context, 0) && is_pointer_in_path(&path, ptr)) {
790  sbuts->mainbuser = context;
791  sbuts->mainb = sbuts->mainbuser;
792  }
793 }
794 
795 /************************* Context Callback ************************/
796 
797 const char *buttons_context_dir[] = {
798  "texture_slot",
799  "scene",
800  "world",
801  "object",
802  "mesh",
803  "armature",
804  "lattice",
805  "curve",
806  "meta_ball",
807  "light",
808  "speaker",
809  "lightprobe",
810  "camera",
811  "material",
812  "material_slot",
813  "texture",
814  "texture_user",
815  "texture_user_property",
816  "bone",
817  "edit_bone",
818  "pose_bone",
819  "particle_system",
820  "particle_system_editable",
821  "particle_settings",
822  "cloth",
823  "soft_body",
824  "fluid",
825  "collision",
826  "brush",
827  "dynamic_paint",
828  "line_style",
829  "collection",
830  "gpencil",
831  "curves",
832 #ifdef WITH_POINT_CLOUD
833  "pointcloud",
834 #endif
835  "volume",
836  NULL,
837 };
838 
839 int /*eContextResult*/ buttons_context(const bContext *C,
840  const char *member,
842 {
844  if (sbuts && sbuts->path == NULL) {
845  /* path is cleared for SCREEN_OT_redo_last, when global undo does a file-read which clears the
846  * path (see lib_link_workspace_layout_restore). */
847  buttons_context_compute(C, sbuts);
848  }
849  ButsContextPath *path = sbuts ? sbuts->path : NULL;
850 
851  if (!path) {
853  }
854 
855  if (sbuts->mainb == BCONTEXT_TOOL) {
857  }
858 
859  /* here we handle context, getting data from precomputed path */
860  if (CTX_data_dir(member)) {
861  /* in case of new shading system we skip texture_slot, complex python
862  * UI script logic depends on checking if this is available */
863  if (sbuts->texuser) {
865  }
866  else {
868  }
869  return CTX_RESULT_OK;
870  }
871  if (CTX_data_equals(member, "scene")) {
872  /* Do not return one here if scene is not found in path,
873  * in this case we want to get default context scene! */
874  return set_pointer_type(path, result, &RNA_Scene);
875  }
876  if (CTX_data_equals(member, "world")) {
877  set_pointer_type(path, result, &RNA_World);
878  return CTX_RESULT_OK;
879  }
880  if (CTX_data_equals(member, "collection")) {
881  /* Do not return one here if collection is not found in path,
882  * in this case we want to get default context collection! */
883  return set_pointer_type(path, result, &RNA_Collection);
884  }
885  if (CTX_data_equals(member, "object")) {
886  set_pointer_type(path, result, &RNA_Object);
887  return CTX_RESULT_OK;
888  }
889  if (CTX_data_equals(member, "mesh")) {
890  set_pointer_type(path, result, &RNA_Mesh);
891  return CTX_RESULT_OK;
892  }
893  if (CTX_data_equals(member, "armature")) {
894  set_pointer_type(path, result, &RNA_Armature);
895  return CTX_RESULT_OK;
896  }
897  if (CTX_data_equals(member, "lattice")) {
898  set_pointer_type(path, result, &RNA_Lattice);
899  return CTX_RESULT_OK;
900  }
901  if (CTX_data_equals(member, "curve")) {
902  set_pointer_type(path, result, &RNA_Curve);
903  return CTX_RESULT_OK;
904  }
905  if (CTX_data_equals(member, "meta_ball")) {
906  set_pointer_type(path, result, &RNA_MetaBall);
907  return CTX_RESULT_OK;
908  }
909  if (CTX_data_equals(member, "light")) {
910  set_pointer_type(path, result, &RNA_Light);
911  return CTX_RESULT_OK;
912  }
913  if (CTX_data_equals(member, "camera")) {
914  set_pointer_type(path, result, &RNA_Camera);
915  return CTX_RESULT_OK;
916  }
917  if (CTX_data_equals(member, "speaker")) {
918  set_pointer_type(path, result, &RNA_Speaker);
919  return CTX_RESULT_OK;
920  }
921  if (CTX_data_equals(member, "lightprobe")) {
922  set_pointer_type(path, result, &RNA_LightProbe);
923  return CTX_RESULT_OK;
924  }
925  if (CTX_data_equals(member, "curves")) {
926  set_pointer_type(path, result, &RNA_Curves);
927  return CTX_RESULT_OK;
928  }
929 #ifdef WITH_POINT_CLOUD
930  if (CTX_data_equals(member, "pointcloud")) {
931  set_pointer_type(path, result, &RNA_PointCloud);
932  return CTX_RESULT_OK;
933  }
934 #endif
935  if (CTX_data_equals(member, "volume")) {
936  set_pointer_type(path, result, &RNA_Volume);
937  return CTX_RESULT_OK;
938  }
939  if (CTX_data_equals(member, "material")) {
940  set_pointer_type(path, result, &RNA_Material);
941  return CTX_RESULT_OK;
942  }
943  if (CTX_data_equals(member, "texture")) {
944  ButsContextTexture *ct = sbuts->texuser;
945 
946  if (ct) {
947  if (ct->texture == NULL) {
948  return CTX_RESULT_NO_DATA;
949  }
950 
951  CTX_data_pointer_set(result, &ct->texture->id, &RNA_Texture, ct->texture);
952  }
953 
954  return CTX_RESULT_OK;
955  }
956  if (CTX_data_equals(member, "material_slot")) {
957  PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
958 
959  if (ptr) {
960  Object *ob = ptr->data;
961 
962  if (ob && OB_TYPE_SUPPORT_MATERIAL(ob->type) && ob->totcol) {
963  /* a valid actcol isn't ensured T27526. */
964  int matnr = ob->actcol - 1;
965  if (matnr < 0) {
966  matnr = 0;
967  }
968  /* Keep aligned with rna_Object_material_slots_get. */
970  result, &ob->id, &RNA_MaterialSlot, (void *)(matnr + (uintptr_t)&ob->id));
971  }
972  }
973 
974  return CTX_RESULT_OK;
975  }
976  if (CTX_data_equals(member, "texture_user")) {
977  ButsContextTexture *ct = sbuts->texuser;
978 
979  if (!ct) {
980  return CTX_RESULT_NO_DATA;
981  }
982 
983  if (ct->user && ct->user->ptr.data) {
984  ButsTextureUser *user = ct->user;
986  }
987 
988  return CTX_RESULT_OK;
989  }
990  if (CTX_data_equals(member, "texture_user_property")) {
991  ButsContextTexture *ct = sbuts->texuser;
992 
993  if (!ct) {
994  return CTX_RESULT_NO_DATA;
995  }
996 
997  if (ct->user && ct->user->ptr.data) {
998  ButsTextureUser *user = ct->user;
999  CTX_data_pointer_set(result, NULL, &RNA_Property, user->prop);
1000  }
1001 
1002  return CTX_RESULT_OK;
1003  }
1004  if (CTX_data_equals(member, "texture_node")) {
1005  ButsContextTexture *ct = sbuts->texuser;
1006 
1007  if (ct) {
1008  /* new shading system */
1009  if (ct->user && ct->user->node) {
1010  CTX_data_pointer_set(result, &ct->user->ntree->id, &RNA_Node, ct->user->node);
1011  }
1012 
1013  return CTX_RESULT_OK;
1014  }
1015  return CTX_RESULT_NO_DATA;
1016  }
1017  if (CTX_data_equals(member, "texture_slot")) {
1018  ButsContextTexture *ct = sbuts->texuser;
1019  PointerRNA *ptr;
1020 
1021  /* Particles slots are used in both old and new textures handling. */
1022  if ((ptr = get_pointer_type(path, &RNA_ParticleSystem))) {
1023  ParticleSettings *part = ((ParticleSystem *)ptr->data)->part;
1024 
1025  if (part) {
1027  result, &part->id, &RNA_ParticleSettingsTextureSlot, part->mtex[(int)part->texact]);
1028  }
1029  }
1030  else if (ct) {
1031  return CTX_RESULT_MEMBER_NOT_FOUND; /* new shading system */
1032  }
1033  else if ((ptr = get_pointer_type(path, &RNA_FreestyleLineStyle))) {
1034  FreestyleLineStyle *ls = ptr->data;
1035 
1036  if (ls) {
1038  result, &ls->id, &RNA_LineStyleTextureSlot, ls->mtex[(int)ls->texact]);
1039  }
1040  }
1041 
1042  return CTX_RESULT_OK;
1043  }
1044  if (CTX_data_equals(member, "bone")) {
1045  set_pointer_type(path, result, &RNA_Bone);
1046  return CTX_RESULT_OK;
1047  }
1048  if (CTX_data_equals(member, "edit_bone")) {
1049  set_pointer_type(path, result, &RNA_EditBone);
1050  return CTX_RESULT_OK;
1051  }
1052  if (CTX_data_equals(member, "pose_bone")) {
1053  set_pointer_type(path, result, &RNA_PoseBone);
1054  return CTX_RESULT_OK;
1055  }
1056  if (CTX_data_equals(member, "particle_system")) {
1057  set_pointer_type(path, result, &RNA_ParticleSystem);
1058  return CTX_RESULT_OK;
1059  }
1060  if (CTX_data_equals(member, "particle_system_editable")) {
1061  if (PE_poll((bContext *)C)) {
1062  set_pointer_type(path, result, &RNA_ParticleSystem);
1063  }
1064  else {
1065  CTX_data_pointer_set(result, NULL, &RNA_ParticleSystem, NULL);
1066  }
1067  return CTX_RESULT_OK;
1068  }
1069  if (CTX_data_equals(member, "particle_settings")) {
1070  /* only available when pinned */
1071  PointerRNA *ptr = get_pointer_type(path, &RNA_ParticleSettings);
1072 
1073  if (ptr && ptr->data) {
1075  return CTX_RESULT_OK;
1076  }
1077 
1078  /* get settings from active particle system instead */
1079  ptr = get_pointer_type(path, &RNA_ParticleSystem);
1080 
1081  if (ptr && ptr->data) {
1082  ParticleSettings *part = ((ParticleSystem *)ptr->data)->part;
1083  CTX_data_pointer_set(result, ptr->owner_id, &RNA_ParticleSettings, part);
1084  return CTX_RESULT_OK;
1085  }
1086 
1087  set_pointer_type(path, result, &RNA_ParticleSettings);
1088  return CTX_RESULT_OK;
1089  }
1090  if (CTX_data_equals(member, "cloth")) {
1091  PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
1092 
1093  if (ptr && ptr->data) {
1094  Object *ob = ptr->data;
1096  CTX_data_pointer_set(result, &ob->id, &RNA_ClothModifier, md);
1097  return CTX_RESULT_OK;
1098  }
1099  return CTX_RESULT_NO_DATA;
1100  }
1101  if (CTX_data_equals(member, "soft_body")) {
1102  PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
1103 
1104  if (ptr && ptr->data) {
1105  Object *ob = ptr->data;
1107  CTX_data_pointer_set(result, &ob->id, &RNA_SoftBodyModifier, md);
1108  return CTX_RESULT_OK;
1109  }
1110  return CTX_RESULT_NO_DATA;
1111  }
1112 
1113  if (CTX_data_equals(member, "fluid")) {
1114  PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
1115 
1116  if (ptr && ptr->data) {
1117  Object *ob = ptr->data;
1119  CTX_data_pointer_set(result, &ob->id, &RNA_FluidModifier, md);
1120  return CTX_RESULT_OK;
1121  }
1122  return CTX_RESULT_NO_DATA;
1123  }
1124  if (CTX_data_equals(member, "collision")) {
1125  PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
1126 
1127  if (ptr && ptr->data) {
1128  Object *ob = ptr->data;
1130  CTX_data_pointer_set(result, &ob->id, &RNA_CollisionModifier, md);
1131  return CTX_RESULT_OK;
1132  }
1133  return CTX_RESULT_NO_DATA;
1134  }
1135  if (CTX_data_equals(member, "brush")) {
1136  set_pointer_type(path, result, &RNA_Brush);
1137  return CTX_RESULT_OK;
1138  }
1139  if (CTX_data_equals(member, "dynamic_paint")) {
1140  PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
1141 
1142  if (ptr && ptr->data) {
1143  Object *ob = ptr->data;
1145  CTX_data_pointer_set(result, &ob->id, &RNA_DynamicPaintModifier, md);
1146  return CTX_RESULT_OK;
1147  }
1148  return CTX_RESULT_NO_DATA;
1149  }
1150  if (CTX_data_equals(member, "line_style")) {
1151  set_pointer_type(path, result, &RNA_FreestyleLineStyle);
1152  return CTX_RESULT_OK;
1153  }
1154  if (CTX_data_equals(member, "gpencil")) {
1155  set_pointer_type(path, result, &RNA_GreasePencil);
1156  return CTX_RESULT_OK;
1157  }
1159 }
1160 
1161 /************************* Drawing the Path ************************/
1162 
1164 {
1166  return sbuts->mainb != BCONTEXT_TOOL;
1167 }
1168 
1169 static void buttons_panel_context_draw(const bContext *C, Panel *panel)
1170 {
1172  ButsContextPath *path = sbuts->path;
1173 
1174  if (!path) {
1175  return;
1176  }
1177 
1178  uiLayout *row = uiLayoutRow(panel->layout, true);
1180 
1181  bool first = true;
1182  for (int i = 0; i < path->len; i++) {
1183  PointerRNA *ptr = &path->ptr[i];
1184 
1185  /* Skip scene and view layer to save space. */
1186  if ((!ELEM(sbuts->mainb,
1191  BCONTEXT_WORLD) &&
1192  ptr->type == &RNA_Scene)) {
1193  continue;
1194  }
1195  if ((!ELEM(sbuts->mainb,
1200  BCONTEXT_WORLD) &&
1201  ptr->type == &RNA_ViewLayer)) {
1202  continue;
1203  }
1204 
1205  /* Add > triangle. */
1206  if (!first) {
1207  uiItemL(row, "", ICON_RIGHTARROW);
1208  }
1209 
1210  if (ptr->data == NULL) {
1211  continue;
1212  }
1213 
1214  /* Add icon and name. */
1215  int icon = RNA_struct_ui_icon(ptr->type);
1216  char namebuf[128];
1217  char *name = RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf), NULL);
1218 
1219  if (name) {
1220  uiItemLDrag(row, ptr, name, icon);
1221 
1222  if (name != namebuf) {
1223  MEM_freeN(name);
1224  }
1225  }
1226  else {
1227  uiItemL(row, "", icon);
1228  }
1229 
1230  first = false;
1231  }
1232 
1233  uiLayout *pin_row = uiLayoutRow(row, false);
1235  uiItemSpacer(pin_row);
1237  uiItemO(pin_row,
1238  "",
1239  (sbuts->flag & SB_PIN_CONTEXT) ? ICON_PINNED : ICON_UNPINNED,
1240  "BUTTONS_OT_toggle_pin");
1241 }
1242 
1244 {
1245  PanelType *pt = MEM_callocN(sizeof(PanelType), "spacetype buttons panel context");
1246  strcpy(pt->idname, "PROPERTIES_PT_context");
1247  strcpy(pt->label, N_("Context")); /* XXX C panels unavailable through RNA bpy.types! */
1252  BLI_addtail(&art->paneltypes, pt);
1253 }
1254 
1256 {
1258  ButsContextPath *path = sbuts->path;
1259 
1260  if (path->len == 0) {
1261  return NULL;
1262  }
1263 
1264  for (int i = path->len - 1; i >= 0; i--) {
1265  PointerRNA *ptr = &path->ptr[i];
1266 
1267  /* Pin particle settings instead of system, since only settings are an idblock. */
1268  if (sbuts->mainb == BCONTEXT_PARTICLE && sbuts->flag & SB_PIN_CONTEXT) {
1269  if (ptr->type == &RNA_ParticleSystem && ptr->data) {
1270  ParticleSystem *psys = ptr->data;
1271  return &psys->part->id;
1272  }
1273  }
1274 
1275  /* There is no valid image ID panel, Image Empty objects need this workaround. */
1276  if (sbuts->mainb == BCONTEXT_DATA && sbuts->flag & SB_PIN_CONTEXT) {
1277  if (ptr->type == &RNA_Image && ptr->data) {
1278  continue;
1279  }
1280  }
1281 
1282  if (ptr->owner_id) {
1283  return ptr->owner_id;
1284  }
1285  }
1286 
1287  return NULL;
1288 }
Blender kernel action and pose functionality.
struct bPoseChannel * BKE_pose_channel_find_name(const struct bPose *pose, const char *name)
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:738
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
void CTX_data_dir_set(bContextDataResult *result, const char **dir)
Definition: context.c:696
struct SpaceProperties * CTX_wm_space_properties(const bContext *C)
Definition: context.c:833
bool CTX_data_equals(const char *member, const char *str)
Definition: context.c:634
void CTX_data_pointer_set(bContextDataResult *result, struct ID *id, StructRNA *type, void *data)
Definition: context.c:649
bool CTX_data_dir(const char *member)
Definition: context.c:639
@ 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_pointer_set_ptr(bContextDataResult *result, const PointerRNA *ptr)
Definition: context.c:654
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:723
struct ViewLayer * BKE_view_layer_default_view(const struct Scene *scene)
Blender kernel freestyle line style functionality.
FreestyleLineStyle * BKE_linestyle_active_from_view_layer(struct ViewLayer *view_layer)
Definition: linestyle.c:806
General operations, lookup, etc. for materials.
struct Material * BKE_object_material_get(struct Object *ob, short act)
Definition: material.c:687
struct ModifierData * BKE_modifiers_findby_type(const struct Object *ob, ModifierType type)
General operations, lookup, etc. for blender objects.
struct ModifierData * BKE_object_active_modifier(const struct Object *ob)
struct Paint * BKE_paint_get_active(struct Scene *sce, struct ViewLayer *view_layer)
Definition: paint.c:444
struct Brush * BKE_paint_brush(struct Paint *paint)
Definition: paint.c:607
struct ParticleSystem * psys_get_current(struct Object *ob)
Definition: particle.c:634
@ PANEL_TYPE_NO_HEADER
Definition: BKE_screen.h:280
@ PANEL_TYPE_NO_SEARCH
Definition: BKE_screen.h:287
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:80
#define UNUSED(x)
#define ELEM(...)
#define BLT_I18NCONTEXT_DEFAULT_BPYRNA
@ ID_LS
Definition: DNA_ID_enums.h:75
@ ID_BR
Definition: DNA_ID_enums.h:69
@ ID_OB
Definition: DNA_ID_enums.h:47
@ ID_PA
Definition: DNA_ID_enums.h:70
Object groups, one object can be in many groups at once.
@ FREESTYLE_CONTROL_EDITOR_MODE
@ eModifierType_Cloth
@ eModifierType_Fluid
@ eModifierType_Collision
@ eModifierType_DynamicPaint
@ eModifierType_Softbody
@ OB_SPEAKER
@ OB_LATTICE
@ OB_MBALL
@ OB_SURF
@ OB_CAMERA
@ OB_FONT
@ OB_ARMATURE
@ OB_LAMP
@ OB_MESH
@ OB_POINTCLOUD
@ OB_VOLUME
@ OB_CURVES_LEGACY
@ OB_CURVES
@ OB_GPENCIL
@ OB_LIGHTPROBE
#define OB_TYPE_SUPPORT_MATERIAL(_type)
#define OBACT(_view_layer)
#define R_EDGE_FRS
@ SB_SHADING_CONTEXT
@ SB_PIN_CONTEXT
@ PROPERTIES_SYNC_ALWAYS
@ PROPERTIES_SYNC_AUTO
@ BCONTEXT_CONSTRAINT
@ BCONTEXT_COLLECTION
@ BCONTEXT_OUTPUT
@ BCONTEXT_VIEW_LAYER
@ BCONTEXT_MATERIAL
@ BCONTEXT_TOT
@ BCONTEXT_SHADERFX
@ BCONTEXT_MODIFIER
@ BCONTEXT_BONE
@ BCONTEXT_DATA
@ BCONTEXT_OBJECT
@ BCONTEXT_BONE_CONSTRAINT
@ BCONTEXT_PHYSICS
@ BCONTEXT_SCENE
@ BCONTEXT_WORLD
@ BCONTEXT_RENDER
@ BCONTEXT_TEXTURE
@ BCONTEXT_TOOL
@ BCONTEXT_PARTICLE
bool PE_poll(struct bContext *C)
Definition: particle_edit.c:80
bool ED_area_has_shared_border(struct ScrArea *a, struct ScrArea *b)
Definition: area.c:1897
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
#define C
Definition: RandGen.cpp:25
@ UI_LAYOUT_ALIGN_LEFT
@ UI_LAYOUT_ALIGN_RIGHT
@ UI_EMBOSS_NONE
Definition: UI_interface.h:109
void uiItemL(uiLayout *layout, const char *name, int icon)
void uiLayoutSetAlignment(uiLayout *layout, char alignment)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void uiItemSpacer(uiLayout *layout)
void uiLayoutSetEmboss(uiLayout *layout, eUIEmbossType emboss)
void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname)
void uiItemLDrag(uiLayout *layout, struct PointerRNA *ptr, const char *name, int icon)
static bool buttons_context_path(const bContext *C, SpaceProperties *sbuts, ButsContextPath *path, int mainb, int flag)
static bool buttons_context_path_shaderfx(ButsContextPath *path)
static bool buttons_context_path_bone(ButsContextPath *path)
static bool buttons_context_path_scene(ButsContextPath *path)
static int set_pointer_type(ButsContextPath *path, bContextDataResult *result, StructRNA *type)
static bool buttons_context_path_data(ButsContextPath *path, int type)
const char * buttons_context_dir[]
static PointerRNA * get_pointer_type(ButsContextPath *path, StructRNA *type)
static bool buttons_panel_context_poll(const bContext *C, PanelType *UNUSED(pt))
int buttons_context(const bContext *C, const char *member, bContextDataResult *result)
void ED_buttons_set_context(const bContext *C, SpaceProperties *sbuts, PointerRNA *ptr, const int context)
ID * buttons_context_id_path(const bContext *C)
void buttons_context_compute(const bContext *C, SpaceProperties *sbuts)
void buttons_context_register(ARegionType *art)
static bool buttons_context_path_material(ButsContextPath *path)
static bool buttons_context_path_texture(const bContext *C, ButsContextPath *path, ButsContextTexture *ct)
static bool buttons_context_path_pose_bone(ButsContextPath *path)
static bool buttons_context_path_object(ButsContextPath *path)
static int buttons_shading_new_context(const bContext *C, int flag)
static bool buttons_context_path_particle(ButsContextPath *path)
bool ED_buttons_should_sync_with_outliner(const bContext *C, const SpaceProperties *sbuts, ScrArea *area)
static bool buttons_context_path_view_layer(ButsContextPath *path, wmWindow *win)
static bool buttons_context_path_linestyle(ButsContextPath *path, wmWindow *window)
static bool buttons_shading_context(const bContext *C, int mainb)
static bool is_pointer_in_path(ButsContextPath *path, PointerRNA *ptr)
static bool buttons_context_path_brush(const bContext *C, ButsContextPath *path)
static bool buttons_context_path_collection(const bContext *C, ButsContextPath *path, wmWindow *window)
static bool buttons_context_path_world(ButsContextPath *path)
static void buttons_panel_context_draw(const bContext *C, Panel *panel)
static bool buttons_context_path_modifier(ButsContextPath *path)
void buttons_texture_context_compute(const struct bContext *C, struct SpaceProperties *sbuts)
Scene scene
FreestyleLineStyle linestyle
World world
#define GS(x)
Definition: iris.c:225
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
static unsigned c
Definition: RandGen.cpp:83
static void area(int d1, int d2, int e1, int e2, float weights[2])
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
Definition: rna_access.c:695
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:136
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
Definition: rna_access.c:112
char * RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, int *r_len)
Definition: rna_access.c:907
int RNA_struct_ui_icon(const StructRNA *type)
Definition: rna_access.c:601
_W64 unsigned int uintptr_t
Definition: stdint.h:119
ListBase paneltypes
Definition: BKE_screen.h:198
struct Object * object
char name[64]
PointerRNA ptr[8]
struct ButsTextureUser * user
struct Tex * texture
struct ID * id
struct bNodeTree * ntree
struct bNode * node
PointerRNA ptr
PropertyRNA * prop
struct MTex * mtex[18]
Definition: DNA_ID.h:368
char name[66]
Definition: DNA_ID.h:378
struct Collection * collection
struct bPose * pose
void * data
void(* draw)(const struct bContext *C, struct Panel *panel)
Definition: BKE_screen.h:248
bool(* poll)(const struct bContext *C, struct PanelType *pt)
Definition: BKE_screen.h:242
char idname[BKE_ST_MAXNAME]
Definition: BKE_screen.h:223
char translation_context[BKE_ST_MAXNAME]
Definition: BKE_screen.h:226
char label[BKE_ST_MAXNAME]
Definition: BKE_screen.h:224
struct uiLayout * layout
struct MTex * mtex[18]
ParticleSettings * part
struct StructRNA * type
Definition: RNA_types.h:37
void * data
Definition: RNA_types.h:38
struct ID * owner_id
Definition: RNA_types.h:36
struct Collection * master_collection
struct RenderData r
struct World * world
struct FreestyleConfig freestyle_config
LayerCollection * active_collection
struct Base * basact
struct EditBone * act_edbone
ListBase * edbo
struct Scene * scene
#define N_(msgid)
PointerRNA * ptr
Definition: wm_files.c:3480
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