diff options
author | julianeisel <julian_eisel@web.de> | 2015-02-10 00:25:12 +0300 |
---|---|---|
committer | julianeisel <julian_eisel@web.de> | 2015-02-10 01:17:33 +0300 |
commit | 64ef6e74f7ba5a69c30eea39a9405b0fb826979b (patch) | |
tree | 78a89e45de853c713e095bc8bfae59a44d01158f /source/blender/editors/space_node/drawnode.c | |
parent | 53c4033b5b20ab652653446407d2b2cf910c30b3 (diff) |
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
Diffstat (limited to 'source/blender/editors/space_node/drawnode.c')
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index c986a249663..d853cfbd668 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -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; |