diff options
Diffstat (limited to 'source/blender/editors/space_node/drawnode.c')
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 5ba2c1c27c8..7e79b4b822e 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -349,11 +349,21 @@ static void node_shader_buts_vect_math(uiLayout *layout, bContext *C, PointerRNA static void node_shader_buts_geometry(uiLayout *layout, bContext *C, PointerRNA *ptr) { + PointerRNA obptr= CTX_data_pointer_get(C, "active_object"); uiLayout *col; - + col= uiLayoutColumn(layout, 0); - uiItemR(col, ptr, "uv_layer", 0, "UV", 0); - uiItemR(col, ptr, "color_layer", 0, "VCol", 0); + + if(obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) { + PointerRNA dataptr= RNA_pointer_get(&obptr, "data"); + + uiItemPointerR(col, ptr, "uv_layer", &dataptr, "uv_textures", "", 0); + uiItemPointerR(col, ptr, "color_layer", &dataptr, "vertex_colors", "", 0); + } + else { + uiItemR(col, ptr, "uv_layer", 0, "UV", 0); + uiItemR(col, ptr, "color_layer", 0, "VCol", 0); + } } static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA *ptr) @@ -1293,14 +1303,17 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage) glMatrixMode(GL_MODELVIEW); glPushMatrix(); + /* keep this, saves us from a version patch */ + if(snode->zoom==0.0f) snode->zoom= 1.0f; + /* somehow the offset has to be calculated inverse */ glaDefine2DArea(&ar->winrct); /* ortho at pixel level curarea */ wmOrtho2(-0.375, ar->winx-0.375, -0.375, ar->winy-0.375); - x = (ar->winx-ibuf->x)/2 + snode->xof; - y = (ar->winy-ibuf->y)/2 + snode->yof; + x = (ar->winx-snode->zoom*ibuf->x)/2 + snode->xof; + y = (ar->winy-snode->zoom*ibuf->y)/2 + snode->yof; if(!ibuf->rect) { if(color_manage) @@ -1310,8 +1323,11 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage) IMB_rect_from_float(ibuf); } - if(ibuf->rect) + if(ibuf->rect) { + glPixelZoom(snode->zoom, snode->zoom); glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); + glPixelZoom(1.0f, 1.0f); + } glMatrixMode(GL_PROJECTION); glPopMatrix(); |