44#include "RNA_prototypes.hh"
87 user->
index = users->count();
108 user->
index = users->count();
119 const char *category,
133 user->
index = users->count();
141 const char *category)
153 const char *category)
169 else if (
node->is_group() &&
node->id) {
179 ListBaseT<ButsTextureUser> *users,
184 for (
bNode *
node : node_tree->all_nodes()) {
189 ob, nmd, id_cast<bNodeTree *>(
node->id), users, handled_groups);
205 if (tex !=
nullptr) {
213 N_(
"Geometry Nodes"),
227 ListBaseT<ButsTextureUser> *users =
static_cast<ListBaseT<ButsTextureUser> *
>(user_data);
240 users, &ob->
id, *ptr, texture_prop,
N_(
"Modifiers"), modifier_type->
icon, md->
name);
248 Scene *scene =
nullptr;
258 scene = id_cast<Scene *>(pinid);
261 ob = id_cast<Object *>(pinid);
267 linestyle = id_cast<FreestyleLineStyle *>(pinid);
277 if (!pinid || id_type ==
ID_SCE) {
289 users->clear_no_delete();
298 if (linestyle && !limited_mode) {
299 for (
int i = 0; i <
MAX_MTEX; i++) {
300 if (linestyle->
mtex[i] && linestyle->
mtex[i]->
tex) {
305 users, &linestyle->
id, linestyle->
nodetree,
N_(
"Line Style"));
317 if (psys && !limited_mode) {
325 &psys->
part->
id, RNA_ParticleSettingsTextureSlot, mtex);
347 users, &ob->
id, ptr, prop,
N_(
"Fields"), ICON_FORCE_TEXTURE,
IFACE_(
"Texture Field"));
360 users, &
brush->id, ptr, prop,
N_(
"Brush"), ICON_BRUSH_DATA,
IFACE_(
"Brush"));
367 users, &
brush->id, ptr, prop,
N_(
"Brush"), ICON_BRUSH_DATA,
IFACE_(
"Brush Mask"));
386 ct->
users.clear_no_delete();
393 ct->
texture = id_cast<Tex *>(pinid);
466 if (user->
ptr.
type == RNA_ParticleSettingsTextureSlot) {
494 const char *last_category =
nullptr;
500 if (!last_category || !
STREQ(last_category, user.
category)) {
522 button_funcN_set(but,
524 MEM_new<ButsTextureUser>(
"ButsTextureUser", user),
553 layout->
label(
TIP_(
"No textures in context"), ICON_NONE);
561 but = uiDefIconTextMenuBut(block,
578 button_type_set_menu_from_pulldown(but);
595 if (pinid ==
nullptr || ((
GS(pinid->name) ==
ID_OB) && id_cast<Object *>(pinid) == ob)) {
607 if (area !=
nullptr) {
616 if (data_p ==
nullptr || prop_p ==
nullptr) {
621 if (area ==
nullptr) {
632 for (user = ct->users.first(); user; user = user->
next) {
633 if (user->
ptr.
data == data_p && user->
prop == prop_p) {
674 bool user_found =
false;
676 for (user = ct->
users.first(); user; user = user->
next) {
687 but = uiDefIconBut(block,
697 TIP_(
"Show texture in texture tab"));
700 user_found ? user->
ptr.
data :
nullptr,
701 user_found ? user->
prop :
nullptr);
703 button_disable(but,
"No (unpinned) Properties Editor found to display texture in");
705 else if (!user_found) {
706 button_disable(but,
"No texture user found");
Blender kernel freestyle line style functionality.
#define NODE_CLASS_TEXTURE
#define SNPRINTF_UTF8(dst, format,...)
#define STRNCPY_UTF8(dst, src)
ID and Library types, which are fundamental for SDNA.
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
bool node_set_selected(bNode &node, bool select)
void * but_func_argN_copy(const void *argN)
void but_func_argN_free(void *argN)
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)
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)
void ED_node_set_active(Main *bmain, SpaceNode *snode, bNodeTree *ntree, bNode *node, bool *r_active_texture_changed)
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)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
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)
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)
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)
ID_Type GS(const char *name)
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)
ListBaseT< ButsTextureUser > users
struct ButsTextureUser * user
struct bNodeTree * nodetree
struct bNodeTree * node_group
struct bNodeTree * node_group
ListBaseT< SceneCompositorEffect > compositor_effects
ListBaseT< SpaceLink > spacedata
eSpaceButtons_Context mainb
eSpaceButtons_Context mainbuser
ListBaseT< struct ScrArea > areabase
void label(StringRef name, int icon)