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
This commit is contained in:
Julian Eisel
2025-04-03 15:06:37 +02:00
committed by Julian Eisel
parent f8de6c31bc
commit 5ea2ab3559

View File

@@ -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"));
}