forked from bartvdbraak/blender
Nodes: (Un)pack, filepath, refresh buttons for Environment Texture nodes
The same buttons are already used for other image textures and since the environment tex node does only allow images as well, it makes sense to have this here too. Approved by @lukastoenne and @venomgfx, requested by @venomgfx
This commit is contained in:
parent
53c4033b5b
commit
64ef6e74f7
@ -845,6 +845,35 @@ static void node_shader_buts_tex_environment(uiLayout *layout, bContext *C, Poin
|
||||
node_buts_image_user(layout, C, &iuserptr, &imaptr, &iuserptr);
|
||||
}
|
||||
|
||||
static void node_shader_buts_tex_environment_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
PointerRNA imaptr = RNA_pointer_get(ptr, "image");
|
||||
PointerRNA iuserptr = RNA_pointer_get(ptr, "image_user");
|
||||
Image *ima = imaptr.data;
|
||||
|
||||
uiLayoutSetContextPointer(layout, "image_user", &iuserptr);
|
||||
uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
|
||||
|
||||
if (ima && ima->source != IMA_SRC_GENERATED) {
|
||||
uiLayout *row = uiLayoutRow(layout, true);
|
||||
|
||||
if (ima->packedfile)
|
||||
uiItemO(row, "", ICON_PACKAGE, "image.unpack");
|
||||
else
|
||||
uiItemO(row, "", ICON_UGLYPACKAGE, "image.pack");
|
||||
|
||||
row = uiLayoutRow(row, true);
|
||||
uiLayoutSetEnabled(row, ima->packedfile == NULL);
|
||||
uiItemR(row, &imaptr, "filepath", 0, "", ICON_NONE);
|
||||
uiItemO(row, "", ICON_FILE_REFRESH, "image.reload");
|
||||
}
|
||||
|
||||
uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE);
|
||||
uiItemR(layout, ptr, "projection", 0, "", ICON_NONE);
|
||||
|
||||
node_buts_image_user(layout, C, &iuserptr, &imaptr, &iuserptr);
|
||||
}
|
||||
|
||||
static void node_shader_buts_tex_sky(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "sky_type", 0, "", ICON_NONE);
|
||||
@ -1106,6 +1135,7 @@ static void node_shader_set_butfunc(bNodeType *ntype)
|
||||
break;
|
||||
case SH_NODE_TEX_ENVIRONMENT:
|
||||
ntype->draw_buttons = node_shader_buts_tex_environment;
|
||||
ntype->draw_buttons_ex = node_shader_buts_tex_environment_ex;
|
||||
break;
|
||||
case SH_NODE_TEX_GRADIENT:
|
||||
ntype->draw_buttons = node_shader_buts_tex_gradient;
|
||||
|
Loading…
Reference in New Issue
Block a user