From 5ea2ab3559cd1539fedb594d558ef4a9729f4c00 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Thu, 3 Apr 2025 15:06:37 +0200 Subject: [PATCH] Fix: Adding Freestyle texture doesn't add texture tab in properties Found while investigating #136359. Steps to reproduce: - Switch 3D View in Layout workspace to Texture Nodes Editor - Set the Texture Type selector to Line Style - Press New - Notice how no Texture tab appears in the Properties, even though there is a texture user on the frestyle line set now. Pull Request: https://projects.blender.org/blender/blender/pulls/136621 --- .../editors/space_buttons/buttons_texture.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source/blender/editors/space_buttons/buttons_texture.cc b/source/blender/editors/space_buttons/buttons_texture.cc index 7ed82fb0131..fa11f827cd6 100644 --- a/source/blender/editors/space_buttons/buttons_texture.cc +++ b/source/blender/editors/space_buttons/buttons_texture.cc @@ -32,6 +32,7 @@ #include "BKE_context.hh" #include "BKE_layer.hh" +#include "BKE_lib_id.hh" #include "BKE_linestyle.h" #include "BKE_modifier.hh" #include "BKE_node_legacy_types.hh" @@ -133,6 +134,18 @@ static void buttons_texture_user_node_add(ListBase *users, BLI_addtail(users, user); } +static void buttons_texture_user_mtex_add(ListBase *users, + ID *id, + MTex *mtex, + const char *category) +{ + PointerRNA ptr = RNA_pointer_create_discrete(id, &RNA_TextureSlot, mtex); + PropertyRNA *prop = RNA_struct_find_property(&ptr, "texture"); + + buttons_texture_user_property_add( + users, id, ptr, prop, category, RNA_struct_ui_icon(ptr.type), BKE_id_name(mtex->tex->id)); +} + static void buttons_texture_users_find_nodetree(ListBase *users, ID *id, bNodeTree *ntree, @@ -284,6 +297,11 @@ static void buttons_texture_users_from_context(ListBase *users, } if (linestyle && !limited_mode) { + for (int i = 0; i < MAX_MTEX; i++) { + if (linestyle->mtex[i] && linestyle->mtex[i]->tex) { + buttons_texture_user_mtex_add(users, &linestyle->id, linestyle->mtex[i], N_("Line Style")); + } + } buttons_texture_users_find_nodetree( users, &linestyle->id, linestyle->nodetree, N_("Line Style")); }