Blender V5.3
buttons_texture.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 <cstdlib>
10#include <cstring>
11
12#include "MEM_guardedalloc.h"
13
14#include "BLI_listbase.hh"
15#include "BLI_string_utf8.hh"
16#include "BLI_utildefines.hh"
17
18#include "BLT_translation.hh"
19
20#include "DNA_ID.h"
21#include "DNA_brush_types.h"
22#include "DNA_linestyle_types.h"
23#include "DNA_modifier_types.h"
24#include "DNA_node_types.h"
26#include "DNA_object_types.h"
27#include "DNA_particle_types.h"
28#include "DNA_scene_types.h"
29#include "DNA_screen_types.h"
30#include "DNA_space_types.h"
32
33#include "BKE_context.hh"
34#include "BKE_layer.hh"
35#include "BKE_lib_id.hh"
36#include "BKE_linestyle.h"
37#include "BKE_modifier.hh"
39#include "BKE_node_runtime.hh"
40#include "BKE_paint.hh"
41#include "BKE_particle.h"
42
43#include "RNA_access.hh"
44#include "RNA_prototypes.hh"
45
46#include "UI_interface.hh"
48#include "UI_resources.hh"
49
50#include "ED_node.hh"
51#include "ED_screen.hh"
52
53#include "WM_api.hh"
54#include "WM_types.hh"
55
56#include "buttons_intern.hh" /* own include */
57
58namespace blender {
59
62
63/************************* Texture User **************************/
64
65static void buttons_texture_user_socket_property_add(ListBaseT<ButsTextureUser> *users,
66 ID *id,
67 PointerRNA ptr,
68 PropertyRNA *prop,
69 bNodeTree *ntree,
70 bNode *node,
71 bNodeSocket *socket,
72 const char *category,
73 int icon,
74 const char *name)
75{
76 ButsTextureUser *user = MEM_new<ButsTextureUser>("ButsTextureUser");
77
78 user->id = id;
79 user->ptr = ptr;
80 user->prop = prop;
81 user->ntree = ntree;
82 user->node = node;
83 user->socket = socket;
84 user->category = category;
85 user->icon = icon;
86 user->name = name;
87 user->index = users->count();
88
89 BLI_addtail(users, user);
90}
91
92static void buttons_texture_user_property_add(ListBaseT<ButsTextureUser> *users,
93 ID *id,
94 PointerRNA ptr,
95 PropertyRNA *prop,
96 const char *category,
97 int icon,
98 const char *name)
99{
100 ButsTextureUser *user = MEM_new<ButsTextureUser>("ButsTextureUser");
101
102 user->id = id;
103 user->ptr = ptr;
104 user->prop = prop;
105 user->category = category;
106 user->icon = icon;
107 user->name = name;
108 user->index = users->count();
109
110 BLI_addtail(users, user);
111}
112
113static void buttons_texture_user_node_add(ListBaseT<ButsTextureUser> *users,
114 ID *id,
115 bNodeTree *ntree,
116 bNode *node,
117 PointerRNA ptr,
118 PropertyRNA *prop,
119 const char *category,
120 int icon,
121 const char *name)
122{
123 ButsTextureUser *user = MEM_new<ButsTextureUser>("ButsTextureUser");
124
125 user->id = id;
126 user->ntree = ntree;
127 user->node = node;
128 user->ptr = ptr;
129 user->prop = prop;
130 user->category = category;
131 user->icon = icon;
132 user->name = name;
133 user->index = users->count();
134
135 BLI_addtail(users, user);
136}
137
138static void buttons_texture_user_mtex_add(ListBaseT<ButsTextureUser> *users,
139 ID *id,
140 MTex *mtex,
141 const char *category)
142{
143 PointerRNA ptr = RNA_pointer_create_discrete(id, RNA_TextureSlot, mtex);
144 PropertyRNA *prop = RNA_struct_find_property(&ptr, "texture");
145
147 users, id, ptr, prop, category, RNA_struct_ui_icon(ptr.type), BKE_id_name(mtex->tex->id));
148}
149
150static void buttons_texture_users_find_nodetree(ListBaseT<ButsTextureUser> *users,
151 ID *id,
152 bNodeTree *ntree,
153 const char *category)
154{
155 if (ntree) {
156 for (bNode *node : ntree->all_nodes()) {
157 if (node->typeinfo->nclass == NODE_CLASS_TEXTURE) {
158 PointerRNA ptr = RNA_pointer_create_discrete(&ntree->id, RNA_Node, node);
160 id,
161 ntree,
162 node,
163 {},
164 nullptr,
165 category,
167 node->name);
168 }
169 else if (node->is_group() && node->id) {
170 buttons_texture_users_find_nodetree(users, id, id_cast<bNodeTree *>(node->id), category);
171 }
172 }
173 }
174}
175
178 bNodeTree *node_tree,
179 ListBaseT<ButsTextureUser> *users,
180 Set<const bNodeTree *> &handled_groups)
181{
182 PropertyRNA *prop;
183
184 for (bNode *node : node_tree->all_nodes()) {
185 if (node->is_group() && node->id) {
186 if (handled_groups.add(reinterpret_cast<bNodeTree *>(node->id))) {
187 /* Recurse into the node group */
189 ob, nmd, id_cast<bNodeTree *>(node->id), users, handled_groups);
190 }
191 }
192 for (bNodeSocket &socket : node->inputs) {
193 if (socket.flag & SOCK_UNAVAIL) {
194 continue;
195 }
196 if (socket.type != SOCK_TEXTURE) {
197 continue;
198 }
199 PointerRNA ptr = RNA_pointer_create_discrete(&node_tree->id, RNA_NodeSocket, &socket);
200 prop = RNA_struct_find_property(&ptr, "default_value");
201
202 PointerRNA texptr = RNA_property_pointer_get(&ptr, prop);
203 Tex *tex = RNA_struct_is_a(texptr.type, RNA_Texture) ? static_cast<Tex *>(texptr.data) :
204 nullptr;
205 if (tex != nullptr) {
207 &ob->id,
208 ptr,
209 prop,
210 node_tree,
211 node,
212 &socket,
213 N_("Geometry Nodes"),
215 nmd->modifier.name);
216 }
217 }
218 }
219}
220
221static void buttons_texture_modifier_foreach(void *user_data,
222 Object *ob,
223 ModifierData *md,
224 const PointerRNA *ptr,
225 PropertyRNA *texture_prop)
226{
227 ListBaseT<ButsTextureUser> *users = static_cast<ListBaseT<ButsTextureUser> *>(user_data);
228
229 if (md->type == eModifierType_Nodes) {
230 NodesModifierData *nmd = reinterpret_cast<NodesModifierData *>(md);
231 if (nmd->node_group != nullptr && !ID_MISSING(nmd->node_group)) {
232 Set<const bNodeTree *> handled_groups;
233 buttons_texture_modifier_geonodes_users_add(ob, nmd, nmd->node_group, users, handled_groups);
234 }
235 }
236 else {
237 const ModifierTypeInfo *modifier_type = BKE_modifier_get_info(md->type);
238
240 users, &ob->id, *ptr, texture_prop, N_("Modifiers"), modifier_type->icon, md->name);
241 }
242}
243
244static void buttons_texture_users_from_context(ListBaseT<ButsTextureUser> *users,
245 const bContext *C,
246 SpaceProperties *sbuts)
247{
248 Scene *scene = nullptr;
249 Object *ob = nullptr;
250 FreestyleLineStyle *linestyle = nullptr;
251 Brush *brush = nullptr;
252 ID *pinid = sbuts->pinid;
253 bool limited_mode = (sbuts->flag & SB_TEX_USER_LIMITED) != 0;
254
255 /* get data from context */
256 if (pinid) {
257 if (GS(pinid->name) == ID_SCE) {
258 scene = id_cast<Scene *>(pinid);
259 }
260 else if (GS(pinid->name) == ID_OB) {
261 ob = id_cast<Object *>(pinid);
262 }
263 else if (GS(pinid->name) == ID_BR) {
264 brush = reinterpret_cast<Brush *>(pinid);
265 }
266 else if (GS(pinid->name) == ID_LS) {
267 linestyle = id_cast<FreestyleLineStyle *>(pinid);
268 }
269 }
270
271 if (!scene) {
272 scene = CTX_data_scene(C);
273 }
274 const Main *bmain = CTX_data_main(C);
275
276 const ID_Type id_type = ID_Type(pinid != nullptr ? GS(pinid->name) : -1);
277 if (!pinid || id_type == ID_SCE) {
278 wmWindow *win = CTX_wm_window(C);
279 ViewLayer *view_layer = (win->scene == scene) ? WM_window_get_active_view_layer(win) :
281
283 linestyle = BKE_linestyle_active_from_view_layer(view_layer);
284 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
285 ob = BKE_view_layer_active_object_get(view_layer);
286 }
287
288 /* fill users */
289 users->clear_no_delete();
290
291 for (SceneCompositorEffect &effect : scene->compositor_effects) {
292 if (!effect.node_group || ID_MISSING(effect.node_group)) {
293 continue;
294 }
295 buttons_texture_users_find_nodetree(users, &scene->id, effect.node_group, N_("Compositor"));
296 }
297
298 if (linestyle && !limited_mode) {
299 for (int i = 0; i < MAX_MTEX; i++) {
300 if (linestyle->mtex[i] && linestyle->mtex[i]->tex) {
301 buttons_texture_user_mtex_add(users, &linestyle->id, linestyle->mtex[i], N_("Line Style"));
302 }
303 }
305 users, &linestyle->id, linestyle->nodetree, N_("Line Style"));
306 }
307
308 if (ob) {
310 MTex *mtex;
311 int a;
312
313 /* modifiers */
315
316 /* particle systems */
317 if (psys && !limited_mode) {
318 for (a = 0; a < MAX_MTEX; a++) {
319 mtex = psys->part->mtex[a];
320
321 if (mtex) {
322 PropertyRNA *prop;
323
325 &psys->part->id, RNA_ParticleSettingsTextureSlot, mtex);
326 prop = RNA_struct_find_property(&ptr, "texture");
327
329 &psys->part->id,
330 ptr,
331 prop,
332 N_("Particles"),
333 RNA_struct_ui_icon(RNA_ParticleSettings),
334 psys->name);
335 }
336 }
337 }
338
339 /* field */
340 if (ob->pd && ob->pd->forcefield == PFIELD_TEXTURE) {
341 PropertyRNA *prop;
342
343 PointerRNA ptr = RNA_pointer_create_discrete(&ob->id, RNA_FieldSettings, ob->pd);
344 prop = RNA_struct_find_property(&ptr, "texture");
345
347 users, &ob->id, ptr, prop, N_("Fields"), ICON_FORCE_TEXTURE, IFACE_("Texture Field"));
348 }
349 }
350
351 /* brush */
352 if (brush) {
353 PropertyRNA *prop;
354
355 /* texture */
356 PointerRNA ptr = RNA_pointer_create_discrete(&brush->id, RNA_BrushTextureSlot, &brush->mtex);
357 prop = RNA_struct_find_property(&ptr, "texture");
358
360 users, &brush->id, ptr, prop, N_("Brush"), ICON_BRUSH_DATA, IFACE_("Brush"));
361
362 /* mask texture */
363 ptr = RNA_pointer_create_discrete(&brush->id, RNA_BrushTextureSlot, &brush->mask_mtex);
364 prop = RNA_struct_find_property(&ptr, "texture");
365
367 users, &brush->id, ptr, prop, N_("Brush"), ICON_BRUSH_DATA, IFACE_("Brush Mask"));
368 }
369}
370
372{
373 /* gather available texture users in context. runs on every draw of
374 * properties editor, before the buttons are created. */
375 ButsContextTexture *ct = static_cast<ButsContextTexture *>(sbuts->texuser);
376 ID *pinid = sbuts->pinid;
377
378 if (!ct) {
379 ct = MEM_new_zeroed<ButsContextTexture>("ButsContextTexture");
380 sbuts->texuser = ct;
381 }
382 else {
383 for (ButsTextureUser &user : ct->users.items_mutable()) {
384 MEM_delete(&user);
385 }
386 ct->users.clear_no_delete();
387 }
388
390
391 if (pinid && GS(pinid->name) == ID_TE) {
392 ct->user = nullptr;
393 ct->texture = id_cast<Tex *>(pinid);
394 }
395 else {
396 /* set one user as active based on active index */
397 if (ct->index >= BLI_listbase_count_at_most(&ct->users, ct->index + 1)) {
398 ct->index = 0;
399 }
400
401 ct->user = static_cast<ButsTextureUser *>(BLI_findlink(&ct->users, ct->index));
402 ct->texture = nullptr;
403
404 if (ct->user) {
405 if (ct->user->node != nullptr) {
406 /* Detect change of active texture node in same node tree, in that
407 * case we also automatically switch to the other node. */
408 if ((ct->user->node->flag & NODE_ACTIVE_TEXTURE) == 0) {
409 for (ButsTextureUser &user : ct->users) {
410 if (user.ntree == ct->user->ntree && user.node != ct->user->node) {
411 if (user.node->flag & NODE_ACTIVE_TEXTURE) {
412 ct->user = &user;
413 ct->index = BLI_findindex(&ct->users, &user);
414 break;
415 }
416 }
417 }
418 }
419 }
420 if (ct->user->ptr) {
421 PointerRNA texptr;
422 Tex *tex;
423
424 /* Get texture datablock pointer if it's a property. */
425 texptr = RNA_property_pointer_get(&ct->user->ptr, ct->user->prop);
426 tex = RNA_struct_is_a(texptr.type, RNA_Texture) ? static_cast<Tex *>(texptr.data) :
427 nullptr;
428
429 ct->texture = tex;
430 }
431 }
432 }
433}
434
435static void template_texture_select(bContext *C, void *user_p, void * /*arg*/)
436{
437 /* callback when selecting a texture user in the menu */
439 ButsContextTexture *ct = (sbuts) ? static_cast<ButsContextTexture *>(sbuts->texuser) : nullptr;
440 ButsTextureUser *user = static_cast<ButsTextureUser *>(user_p);
441 PointerRNA texptr;
442 Tex *tex;
443
444 if (!ct) {
445 return;
446 }
447
448 /* set user as active */
449 if (user->node) {
450 ED_node_set_active(CTX_data_main(C), nullptr, user->ntree, user->node, nullptr);
451 ct->texture = nullptr;
452
453 /* Not totally sure if we should also change selection? */
454 for (bNode *node : user->ntree->all_nodes()) {
456 }
457 bke::node_set_selected(*user->node, true);
459 }
460 if (user->ptr) {
461 texptr = RNA_property_pointer_get(&user->ptr, user->prop);
462 tex = RNA_struct_is_a(texptr.type, RNA_Texture) ? static_cast<Tex *>(texptr.data) : nullptr;
463
464 ct->texture = tex;
465
466 if (user->ptr.type == RNA_ParticleSettingsTextureSlot) {
467 /* stupid exception for particle systems which still uses influence
468 * from the old texture system, set the active texture slots as well */
469 ParticleSettings *part = id_cast<ParticleSettings *>(user->ptr.owner_id);
470 int a;
471
472 for (a = 0; a < MAX_MTEX; a++) {
473 if (user->ptr.data == part->mtex[a]) {
474 part->texact = a;
475 }
476 }
477 }
478
479 if (sbuts && tex) {
480 sbuts->preview = 1;
481 }
482 }
483
484 ct->user = user;
485 ct->index = user->index;
486}
487
488static void template_texture_user_menu(bContext *C, ui::Layout *layout, void * /*arg*/)
489{
490 /* callback when opening texture user selection menu, to create buttons. */
492 ButsContextTexture *ct = static_cast<ButsContextTexture *>(sbuts->texuser);
493 ui::Block *block = layout->block();
494 const char *last_category = nullptr;
495
496 for (ButsTextureUser &user : ct->users) {
497 char name[UI_MAX_NAME_STR];
498
499 /* add label per category */
500 if (!last_category || !STREQ(last_category, user.category)) {
501 layout->label(IFACE_(user.category), ICON_NONE);
502 }
503
504 /* create button */
505 if (user.prop) {
506 PointerRNA texptr = RNA_property_pointer_get(&user.ptr, user.prop);
507 Tex *tex = static_cast<Tex *>(texptr.data);
508
509 if (tex) {
510 SNPRINTF_UTF8(name, " %s - %s", user.name, tex->id.name + 2);
511 }
512 else {
513 SNPRINTF_UTF8(name, " %s", user.name);
514 }
515 }
516 else {
517 SNPRINTF_UTF8(name, " %s", user.name);
518 }
519
520 ui::Button *but = uiDefIconTextBut(
521 block, ui::ButtonType::But, user.icon, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, nullptr, "");
522 button_funcN_set(but,
524 MEM_new<ButsTextureUser>("ButsTextureUser", user),
525 nullptr,
528
529 last_category = user.category;
530 }
531}
532
534{
535 /* Texture user selection drop-down menu. the available users have been
536 * gathered before drawing in #ButsContextTexture, we merely need to
537 * display the current item. */
539 ButsContextTexture *ct = (sbuts) ? static_cast<ButsContextTexture *>(sbuts->texuser) : nullptr;
540 ui::Block *block = layout->block();
541 ui::Button *but;
542 ButsTextureUser *user;
543 char name[UI_MAX_NAME_STR];
544
545 if (!ct) {
546 return;
547 }
548
549 /* get current user */
550 user = ct->user;
551
552 if (!user) {
553 layout->label(TIP_("No textures in context"), ICON_NONE);
554 return;
555 }
556
557 /* create button */
558 STRNCPY_UTF8(name, user->name);
559
560 if (user->icon) {
561 but = uiDefIconTextMenuBut(block,
563 nullptr,
564 user->icon,
565 name,
566 0,
567 0,
568 UI_UNIT_X * 4,
569 UI_UNIT_Y,
570 "");
571 }
572 else {
573 but = uiDefMenuBut(
574 block, template_texture_user_menu, nullptr, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, "");
575 }
576
577 /* some cosmetic tweaks */
578 button_type_set_menu_from_pulldown(but);
579
580 button_flag_disable(but, ui::BUT_ICON_SUBMENU);
581}
582
583/************************* Texture Show **************************/
584
586{
587 bScreen *screen = CTX_wm_screen(C);
589
590 for (ScrArea &area : screen->areabase) {
591 if (area.spacetype == SPACE_PROPERTIES) {
592 /* Only if unpinned, or if pinned object matches. */
593 SpaceProperties *sbuts = area.spacedata.first_as<SpaceProperties>();
594 ID *pinid = sbuts->pinid;
595 if (pinid == nullptr || ((GS(pinid->name) == ID_OB) && id_cast<Object *>(pinid) == ob)) {
596 return &area;
597 }
598 }
599 }
600
601 return nullptr;
602}
603
605{
607 if (area != nullptr) {
608 return area->spacedata.first_as<SpaceProperties>();
609 }
610
611 return nullptr;
612}
613
614static void template_texture_show(bContext *C, void *data_p, void *prop_p)
615{
616 if (data_p == nullptr || prop_p == nullptr) {
617 return;
618 }
619
621 if (area == nullptr) {
622 return;
623 }
624
625 SpaceProperties *sbuts = area->spacedata.first_as<SpaceProperties>();
626 ButsContextTexture *ct = (sbuts) ? static_cast<ButsContextTexture *>(sbuts->texuser) : nullptr;
627 if (!ct) {
628 return;
629 }
630
631 ButsTextureUser *user;
632 for (user = ct->users.first(); user; user = user->next) {
633 if (user->ptr.data == data_p && user->prop == prop_p) {
634 break;
635 }
636 }
637
638 if (user) {
639 /* select texture */
640 template_texture_select(C, user, nullptr);
641
642 /* change context */
643 sbuts->mainb = BCONTEXT_TEXTURE;
644 sbuts->mainbuser = sbuts->mainb;
645 sbuts->preview = 1;
646
647 /* redraw editor */
648 ED_area_tag_redraw(area);
649 }
650}
651
653 const bContext *C,
654 PointerRNA *ptr,
655 PropertyRNA *prop)
656{
657 /* Only show the button if there is actually a texture assigned. */
658 Tex *texture = static_cast<Tex *>(RNA_property_pointer_get(ptr, prop).data);
659 if (texture == nullptr) {
660 return;
661 }
662
663 /* Only show the button if we are not in the Properties Editor's texture tab. */
664 SpaceProperties *sbuts_context = CTX_wm_space_properties(C);
665 if (sbuts_context != nullptr && sbuts_context->mainb == BCONTEXT_TEXTURE) {
666 return;
667 }
668
670 ButsContextTexture *ct = (sbuts) ? static_cast<ButsContextTexture *>(sbuts->texuser) : nullptr;
671
672 /* find corresponding texture user */
673 ButsTextureUser *user;
674 bool user_found = false;
675 if (ct != nullptr) {
676 for (user = ct->users.first(); user; user = user->next) {
677 if (user->ptr.data == ptr->data && user->prop == prop) {
678 user_found = true;
679 break;
680 }
681 }
682 }
683
684 /* Draw button (disabled if we cannot find a Properties Editor to display this in). */
685 ui::Block *block = layout->block();
686 ui::Button *but;
687 but = uiDefIconBut(block,
689 ICON_PROPERTIES,
690 0,
691 0,
692 UI_UNIT_X,
693 UI_UNIT_Y,
694 nullptr,
695 0.0,
696 0.0,
697 TIP_("Show texture in texture tab"));
698 button_func_set(but,
700 user_found ? user->ptr.data : nullptr,
701 user_found ? user->prop : nullptr);
702 if (ct == nullptr) {
703 button_disable(but, "No (unpinned) Properties Editor found to display texture in");
704 }
705 else if (!user_found) {
706 button_disable(but, "No texture user found");
707 }
708}
709
710} // namespace blender
Blender kernel freestyle line style functionality.
#define NODE_CLASS_TEXTURE
Definition BKE_node.hh:488
#define SNPRINTF_UTF8(dst, format,...)
#define STRNCPY_UTF8(dst, src)
#define TIP_(msgid)
#define IFACE_(msgid)
ID and Library types, which are fundamental for SDNA.
#define ID_MISSING(_id)
Definition DNA_ID.h:695
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define MAX_MTEX
Definition Stroke.h:31
#define UI_UNIT_Y
#define UI_UNIT_X
#define UI_MAX_NAME_STR
#define NC_NODE
Definition WM_types.hh:407
#define NA_SELECTED
Definition WM_types.hh:639
#define STREQ(a, b)
bool add(const Key &key)
Definition BLI_set.hh:248
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
bool node_set_selected(bNode &node, bool select)
Definition node.cc:5455
void * but_func_argN_copy(const void *argN)
void but_func_argN_free(void *argN)
BMesh Iterators.
static void buttons_texture_modifier_geonodes_users_add(Object *ob, NodesModifierData *nmd, bNodeTree *node_tree, ListBaseT< ButsTextureUser > *users, Set< const bNodeTree * > &handled_groups)
static void buttons_texture_user_mtex_add(ListBaseT< ButsTextureUser > *users, ID *id, MTex *mtex, const char *category)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
@ NODE_ACTIVE_TEXTURE
static void buttons_texture_user_property_add(ListBaseT< ButsTextureUser > *users, ID *id, PointerRNA ptr, PropertyRNA *prop, const char *category, int icon, const char *name)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
struct ParticleSystem * psys_get_current(struct Object *ob)
Definition particle.cc:571
void ED_node_set_active(Main *bmain, SpaceNode *snode, bNodeTree *ntree, bNode *node, bool *r_active_texture_changed)
Definition node_edit.cc:237
void uiTemplateTextureUser(ui::Layout *layout, bContext *C)
static void template_texture_show(bContext *C, void *data_p, void *prop_p)
static ScrArea * find_area_properties(const bContext *C)
static void buttons_texture_users_find_nodetree(ListBaseT< ButsTextureUser > *users, ID *id, bNodeTree *ntree, const char *category)
wmWindow * CTX_wm_window(const bContext *C)
const char * BKE_id_name(const ID &id)
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
ViewLayer * BKE_view_layer_default_view(const Scene *scene)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:541
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:593
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
static void buttons_texture_users_from_context(ListBaseT< ButsTextureUser > *users, const bContext *C, SpaceProperties *sbuts)
static void buttons_texture_user_node_add(ListBaseT< ButsTextureUser > *users, ID *id, bNodeTree *ntree, bNode *node, PointerRNA ptr, PropertyRNA *prop, const char *category, int icon, const char *name)
int BLI_listbase_count_at_most(const ListBase *listbase, int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:518
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int RNA_struct_ui_icon(const StructRNA *type)
void uiTemplateTextureShow(ui::Layout *layout, const bContext *C, PointerRNA *ptr, PropertyRNA *prop)
static SpaceProperties * find_space_properties(const bContext *C)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
Main * CTX_data_main(const bContext *C)
Paint * BKE_paint_get_active_from_context(const bContext *C)
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
Brush * BKE_paint_brush(Paint *paint)
Scene * CTX_data_scene(const bContext *C)
bScreen * CTX_wm_screen(const bContext *C)
static void template_texture_select(bContext *C, void *user_p, void *)
static void buttons_texture_user_socket_property_add(ListBaseT< ButsTextureUser > *users, ID *id, PointerRNA ptr, PropertyRNA *prop, bNodeTree *ntree, bNode *node, bNodeSocket *socket, const char *category, int icon, const char *name)
void buttons_texture_context_compute(const bContext *C, SpaceProperties *sbuts)
SpaceProperties * CTX_wm_space_properties(const bContext *C)
static void buttons_texture_modifier_foreach(void *user_data, Object *ob, ModifierData *md, const PointerRNA *ptr, PropertyRNA *texture_prop)
Object * CTX_data_active_object(const bContext *C)
void BKE_modifiers_foreach_tex_link(Object *ob, TexWalkFunc walk, void *user_data)
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
static void template_texture_user_menu(bContext *C, ui::Layout *layout, void *)
void ED_area_tag_redraw(ScrArea *area)
Definition area.cc:784
ListBaseT< ButsTextureUser > users
struct ButsTextureUser * user
char name[258]
Definition DNA_ID.h:433
struct PartDeflect * pd
StructRNA * type
Definition RNA_types.hh:63
ListBaseT< SceneCompositorEffect > compositor_effects
ListBaseT< SpaceLink > spacedata
eSpaceButtons_Flag flag
eSpaceButtons_Context mainb
eSpaceButtons_Context mainbuser
eNodeSocketDatatype type
ListBaseT< struct ScrArea > areabase
void label(StringRef name, int icon)
#define N_(msgid)