Compositor: add button to add a new texture in the Texture node

This replaces the plain texture selector with a proper TemplateID,
resulting in buttons to add a new texture if none is there yet, and if
there is one, there will be the usual conveniece buttons to add a fake
user, create single user copies, ..., as well as the button to go to the
textures tab in the Properties Editor for more fine-grained control over
the texture.

Fixes #126856

Pull Request: https://projects.blender.org/blender/blender/pulls/126890
This commit is contained in:
Philipp Oeser
2024-08-28 16:54:19 +02:00
committed by Philipp Oeser
parent 52bf292349
commit d1f0084a33

View File

@@ -198,14 +198,23 @@ static void node_buts_normal(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr
uiItemR(layout, &sockptr, "default_value", DEFAULT_FLAGS, "", ICON_NONE);
}
static void node_buts_texture(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
static void node_buts_texture(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
bNode *node = (bNode *)ptr->data;
short multi = (node->id && ((Tex *)node->id)->use_nodes && (node->type != CMP_NODE_TEXTURE) &&
(node->type != TEX_NODE_TEXTURE));
uiItemR(layout, ptr, "texture", DEFAULT_FLAGS, "", ICON_NONE);
uiTemplateID(layout,
C,
ptr,
"texture",
"texture.new",
nullptr,
nullptr,
UI_TEMPLATE_ID_FILTER_ALL,
false,
nullptr);
if (multi) {
/* Number Drawing not optimal here, better have a list. */