[Bf-blender-cvs] [4c6190d08f] blender2.8: Add immDrawBorderCorners function
Commit: 4c6190d08f00d48cbfb6ec8b0bbc3edf18c2152b Author: Luca Rood Date: Fri Feb 24 00:16:46 2017 -0300 Branches: blender2.8 https://developer.blender.org/rB4c6190d08f00d48cbfb6ec8b0bbc3edf18c2152b Add immDrawBorderCorners function This replaces `glaDrawBorderCorners`. === M source/blender/editors/include/BIF_glutil.h M source/blender/editors/screen/glutil.c === diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index b81c7a8dcf..a3161b49d4 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -320,5 +320,7 @@ void glaDrawImBuf_glsl_ctx_clipping(const struct bContext *C, void glaDrawBorderCorners(const struct rcti *border, float zoomx, float zoomy); +void immDrawBorderCorners(unsigned int pos, const struct rcti *border, float zoomx, float zoomy); + #endif /* __BIF_GLUTIL_H__ */ diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 1b321c220a..a4befa48ee 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -1172,6 +1172,7 @@ void cpack(unsigned int x) void glaDrawBorderCorners(const rcti *border, float zoomx, float zoomy) { + /* DEPRECATED: use immDrawBorderCorners */ float delta_x = 4.0f * UI_DPI_FAC / zoomx; float delta_y = 4.0f * UI_DPI_FAC / zoomy; @@ -1206,3 +1207,40 @@ void glaDrawBorderCorners(const rcti *border, float zoomx, float zoomy) glVertex2f(border->xmax, border->ymax - delta_y); glEnd(); } + +void immDrawBorderCorners(unsigned int pos, const rcti *border, float zoomx, float zoomy) +{ + float delta_x = 4.0f * UI_DPI_FAC / zoomx; + float delta_y = 4.0f * UI_DPI_FAC / zoomy; + + delta_x = min_ff(delta_x, border->xmax - border->xmin); + delta_y = min_ff(delta_y, border->ymax - border->ymin); + + /* left bottom corner */ + immBegin(GL_LINE_STRIP, 3); + immVertex2f(pos, border->xmin, border->ymin + delta_y); + immVertex2f(pos, border->xmin, border->ymin); + immVertex2f(pos, border->xmin + delta_x, border->ymin); + immEnd(); + + /* left top corner */ + immBegin(GL_LINE_STRIP, 3); + immVertex2f(pos, border->xmin, border->ymax - delta_y); + immVertex2f(pos, border->xmin, border->ymax); + immVertex2f(pos, border->xmin + delta_x, border->ymax); + immEnd(); + + /* right bottom corner */ + immBegin(GL_LINE_STRIP, 3); + immVertex2f(pos, border->xmax - delta_x, border->ymin); + immVertex2f(pos, border->xmax, border->ymin); + immVertex2f(pos, border->xmax, border->ymin + delta_y); + immEnd(); + + /* right top corner */ + immBegin(GL_LINE_STRIP, 3); + immVertex2f(pos, border->xmax - delta_x, border->ymax); + immVertex2f(pos, border->xmax, border->ymax); + immVertex2f(pos, border->xmax, border->ymax - delta_y); + immEnd(); +} ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9dd86e2758] blender2.8: OpenGl immediate mode: drawnode.c
Commit: 9dd86e275865068165b73ec4fcd87c25855ab0fa Author: Luca Rood Date: Tue Feb 21 22:17:47 2017 -0300 Branches: blender2.8 https://developer.blender.org/rB9dd86e275865068165b73ec4fcd87c25855ab0fa OpenGl immediate mode: drawnode.c Part of T49043 === M source/blender/editors/space_node/drawnode.c === diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index ee93344cda..7367cc4312 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -353,6 +353,7 @@ static void node_draw_frame_label(bNodeTree *ntree, bNode *node, const float asp const int font_size = data->label_size / aspect; const float margin = (float)(NODE_DY / 4); int label_height; + unsigned char color[3]; nodeLabel(ntree, node, label, sizeof(label)); @@ -361,7 +362,8 @@ static void node_draw_frame_label(bNodeTree *ntree, bNode *node, const float asp BLF_size(fontid, MIN2(24, font_size), U.dpi); /* clamp otherwise it can suck up a LOT of memory */ /* title color */ - UI_ThemeColorBlendShade(TH_TEXT, color_id, 0.4f, 10); + UI_GetThemeColorBlendShade3ubv(TH_TEXT, color_id, 0.4f, 10, color); + BLF_color3ubv(fontid, color); width = BLF_width(fontid, label, sizeof(label)); ascender = BLF_ascender(fontid); @@ -3267,13 +3269,19 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b viewer_border->ymin < viewer_border->ymax) { rcti pixel_border; - UI_ThemeColor(TH_ACTIVE); BLI_rcti_init(_border, x + snode->zoom * viewer_border->xmin * ibuf->x, x + snode->zoom * viewer_border->xmax * ibuf->x, y + snode->zoom * viewer_border->ymin * ibuf->y, y + snode->zoom * viewer_border->ymax * ibuf->y); - glaDrawBorderCorners(_border, 1.0f, 1.0f); + + unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + immUniformThemeColor(TH_ACTIVE); + + immDrawBorderCorners(pos, _border, 1.0f, 1.0f); + + immUnbindProgram(); } } @@ -3393,6 +3401,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, float arrow[2], arrow1[2], arrow2[2]; const float px_fac = UI_DPI_WINDOW_FAC; glGetFloatv(GL_LINE_WIDTH, ); + unsigned int pos; /* we can reuse the dist variable here to increment the GL curve eval amount*/ dist = 1.0f / (float)LINK_RESOL; @@ -3416,57 +3425,84 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, arrow[0] = coord_array[LINK_ARROW][0]; arrow[1] = coord_array[LINK_ARROW][1]; } + + if (do_triple || drawarrow || (!do_shaded)) { + pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + } + if (do_triple) { - UI_ThemeColorShadeAlpha(th_col3, -80, -120); + immUniformThemeColorShadeAlpha(th_col3, -80, -120); glLineWidth(4.0f * px_fac); - - glBegin(GL_LINE_STRIP); + + immBegin(GL_LINE_STRIP, (LINK_RESOL + 1)); + for (i = 0; i <= LINK_RESOL; i++) { - glVertex2fv(coord_array[i]); + immVertex2fv(pos, coord_array[i]); } - glEnd(); + + immEnd(); + if (drawarrow) { - glBegin(GL_LINE_STRIP); - glVertex2fv(arrow1); - glVertex2fv(arrow); - glVertex2fv(arrow2); - glEnd(); + immBegin(GL_LINE_STRIP, 3); + immVertex2fv(pos, arrow1); + immVertex2fv(pos, arrow); + immVertex2fv(pos, arrow2); +
[Bf-blender-cvs] [ccec97ea0a] blender2.8: Opengl glaDrawPixels removal: editors/spaces
Commit: ccec97ea0a43dc2c3befbabe26474a890ac7f26f Author: Clément Foucault Date: Fri Feb 24 01:20:30 2017 +0100 Branches: blender2.8 https://developer.blender.org/rBccec97ea0a43dc2c3befbabe26474a890ac7f26f Opengl glaDrawPixels removal: editors/spaces === M source/blender/editors/space_file/file_draw.c M source/blender/editors/space_node/drawnode.c M source/blender/editors/space_node/node_draw.c M source/blender/editors/space_view3d/view3d_draw_legacy.c === diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index dff32a5f0d..31326e2c18 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -341,6 +341,7 @@ static void file_draw_preview( float scale; int ex, ey; bool use_dropshadow = !is_icon && (typeflags & FILE_TYPE_IMAGE); + float col[4] = {1.0f, 1.0f, 1.0f, 1.0f}; BLI_assert(imb != NULL); @@ -387,12 +388,11 @@ static void file_draw_preview( /* the image */ if (!is_icon && typeflags & FILE_TYPE_FTFONT) { - UI_ThemeColor(TH_TEXT); + UI_GetThemeColor4fv(TH_TEXT, col); } - else { - glColor4f(1.0, 1.0, 1.0, 1.0); - } - glaDrawPixelsTexScaled((float)xco, (float)yco, imb->x, imb->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, imb->rect, scale, scale); + + immDrawPixelsTexScaled((float)xco, (float)yco, imb->x, imb->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, imb->rect, + scale, scale, 1.0f, 1.0f, col); if (icon) { UI_icon_draw_aspect((float)xco, (float)yco, icon, icon_aspect, 1.0f); diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index be7e905786..ee93344cda 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -3178,6 +3178,7 @@ void ED_init_node_socket_type_virtual(bNodeSocketType *stype) void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeInstanceKey parent_key) { bNodeInstanceKey active_viewer_key = (snode->nodetree ? snode->nodetree->active_viewer_key : NODE_INSTANCE_KEY_NONE); + float shuffle[4] = {0.0f, 0.0f, 0.0f, 0.0f}; Image *ima; void *lock; ImBuf *ibuf; @@ -3210,43 +3211,27 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b unsigned char *display_buffer = NULL; void *cache_handle = NULL; - if (snode->flag & (SNODE_SHOW_R | SNODE_SHOW_G | SNODE_SHOW_B)) { - int ofs; + if (snode->flag & (SNODE_SHOW_R | SNODE_SHOW_G | SNODE_SHOW_B | SNODE_SHOW_ALPHA)) { display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, _handle); - -#ifdef __BIG_ENDIAN__ - if (snode->flag & SNODE_SHOW_R) ofs = 0; - else if (snode->flag & SNODE_SHOW_G) ofs = 1; - else ofs = 2; -#else - if (snode->flag & SNODE_SHOW_R) ofs = 1; - else if (snode->flag & SNODE_SHOW_G) ofs = 2; - else ofs = 3; -#endif - - glPixelZoom(snode->zoom, snode->zoom); - /* swap bytes, so alpha is most significant one, then just draw it as luminance int */ - - glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, - display_buffer - (4 - ofs)); - - glPixelZoom(1.0f, 1.0f); - } - else if (snode->flag & SNODE_SHOW_ALPHA) { - display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, _handle); - - glPixelZoom(snode->zoom, snode->zoom); - /* swap bytes, so alpha is most significant one, then just draw it as luminance int */ -#ifdef __BIG_ENDIAN__ - glPixelStorei(GL_UNPACK_SWAP_BYTES, 1); -#endif - glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, display_buffer); - -#ifdef __BIG_ENDIAN__ -
[Bf-blender-cvs] [ab8958bbd5] blender2.8: Opengl glaDrawPixels removal: image_draw.c
Commit: ab8958bbd585997e5121d46f38ef3a35173bfe5f Author: Clément Foucault Date: Fri Feb 24 01:22:58 2017 +0100 Branches: blender2.8 https://developer.blender.org/rBab8958bbd585997e5121d46f38ef3a35173bfe5f Opengl glaDrawPixels removal: image_draw.c Using float buffer is still laggy because of the data volume we have to transfer to the GC. === M source/blender/editors/space_image/image_draw.c === diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 1f97bf6f25..00b2845798 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -71,6 +71,8 @@ #include "ED_render.h" #include "ED_screen.h" +#include "GPU_shader.h" + #include "UI_interface.h" #include "UI_resources.h" #include "UI_view2d.h" @@ -406,63 +408,36 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d } /* image drawing */ - -static void sima_draw_alpha_pixels(float x1, float y1, int rectx, int recty, unsigned int *recti) +static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, int *rect, + float zoomx, float zoomy) { - - /* swap bytes, so alpha is most significant one, then just draw it as luminance int */ - if (ENDIAN_ORDER == B_ENDIAN) - glPixelStorei(GL_UNPACK_SWAP_BYTES, 1); + float red[4] = {1.0f, 0.0f, 0.0f, 0.0f}; - glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_LUMINANCE, GL_UNSIGNED_INT, recti); - glPixelStorei(GL_UNPACK_SWAP_BYTES, 0); -} + /* Slo */ + int *recti = MEM_mallocN(rectx * recty * sizeof(int), "temp"); + for (int a = rectx * recty - 1; a >= 0; a--) { + /* zbuffer values are signed, so we need to shift color range */ + recti[a] = rect[a] * 0.5f + 0.5f; + } -static void sima_draw_alpha_pixelsf(float x1, float y1, int rectx, int recty, float *rectf) -{ - float *trectf = MEM_mallocN(rectx * recty * 4, "temp"); - int a, b; - - for (a = rectx * recty - 1, b = 4 * a + 3; a >= 0; a--, b -= 4) - trectf[a] = rectf[b]; - - glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_LUMINANCE, GL_FLOAT, trectf); - MEM_freeN(trectf); - /* ogl trick below is slower... (on ATI 9600) */ -// glColorMask(1, 0, 0, 0); -// glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_RGBA, GL_FLOAT, rectf + 3); -// glColorMask(0, 1, 0, 0); -// glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_RGBA, GL_FLOAT, rectf + 2); -// glColorMask(0, 0, 1, 0); -// glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_RGBA, GL_FLOAT, rectf + 1); -// glColorMask(1, 1, 1, 1); -} + GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR); + GPU_shader_bind(shader); + GPU_shader_uniform_vector(shader, GPU_shader_get_uniform(shader, "shuffle"), 4, 1, red); -static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, int *recti) -{ - /* zbuffer values are signed, so we need to shift color range */ - glPixelTransferf(GL_RED_SCALE, 0.5f); - glPixelTransferf(GL_GREEN_SCALE, 0.5f); - glPixelTransferf(GL_BLUE_SCALE, 0.5f); - glPixelTransferf(GL_RED_BIAS, 0.5f); - glPixelTransferf(GL_GREEN_BIAS, 0.5f); - glPixelTransferf(GL_BLUE_BIAS, 0.5f); - - glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_LUMINANCE, GL_INT, recti); - - glPixelTransferf(GL_RED_SCALE, 1.0f); - glPixelTransferf(GL_GREEN_SCALE, 1.0f); - glPixelTransferf(GL_BLUE_SCALE, 1.0f); - glPixelTransferf(GL_RED_BIAS, 0.0f); - glPixelTransferf(GL_GREEN_BIAS, 0.0f); - glPixelTransferf(GL_BLUE_BIAS, 0.0f); + immDrawPixelsTex(x1, y1, rectx, recty, GL_RED, GL_INT, GL_NEAREST, recti, zoomx, zoomy, NULL); + + GPU_shader_unbind(); + + MEM_freeN(recti); } -static void sima_draw_zbuffloat_pixels(Scene *scene, float x1, float y1, int rectx, int recty, float *rect_float) +static void sima_draw_zbuffloat_pixels(Scene *scene, float x1, float y1, int rectx, int recty, + float *rect_float, float zoomx, float zoomy) { float bias, scale, *rectf, clipend; int a; - + float red[4] = {1.0f, 0.0f, 0.0f, 0.0f}; + if (scene->camera && scene->camera->type == OB_CAMERA) { bias = ((Camera *)scene->camera->data)->clipsta; clipend = ((Camera *)scene->camera->data)->clipend; @@ -473,8 +448,8 @@ static void sima_draw_zbuffloat_pixels(Scene *scene, float x1, float y1, int rec scale = 0.01f; clipend = 100.0f; } - - rectf = MEM_mallocN(rectx * recty * 4,
[Bf-blender-cvs] [2ea5446197] blender2.8: Opengl glaDrawPixels removal: interface
Commit: 2ea544619718796a7cb07558b680a7fe7716e877 Author: Clément Foucault Date: Fri Feb 24 01:21:02 2017 +0100 Branches: blender2.8 https://developer.blender.org/rB2ea544619718796a7cb07558b680a7fe7716e877 Opengl glaDrawPixels removal: interface === M source/blender/editors/interface/interface_draw.c M source/blender/editors/interface/interface_icons.c M source/blender/editors/interface/interface_panel.c === diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index afb6422ec4..b48eb4d79d 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -476,6 +476,9 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w ImBuf *ibuf = (ImBuf *)but->poin; if (!ibuf) return; + + float facx = 1.0f; + float facy = 1.0f; int w = BLI_rcti_size_x(rect); int h = BLI_rcti_size_y(rect); @@ -492,16 +495,14 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w #endif glEnable(GL_BLEND); - glColor4f(0.0f, 0.0f, 0.0f, 0.0f); if (w != ibuf->x || h != ibuf->y) { - float facx = (float)w / (float)ibuf->x; - float facy = (float)h / (float)ibuf->y; - glPixelZoom(facx, facy); + facx = (float)w / (float)ibuf->x; + facy = (float)h / (float)ibuf->y; } - glaDrawPixelsAuto((float)rect->xmin, (float)rect->ymin, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, ibuf->rect); - - glPixelZoom(1.0f, 1.0f); + + immDrawPixelsTex((float)rect->xmin, (float)rect->ymin, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, ibuf->rect, +facx, facy, NULL); glDisable(GL_BLEND); @@ -1726,7 +1727,6 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc if (width > 0 && height > 0) { ImBuf *drawibuf = scopes->track_preview; - float img_col[4] = {1.0f, 1.0f, 1.0f, 1.0f}; float col_sel[4], col_outline[4]; if (scopes->use_track_mask) { @@ -1736,7 +1736,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc } GPU_shader_unbind(); /* make sure there is no program bound */ - immDrawPixelsTex(rect.xmin, rect.ymin + 1, drawibuf->x, drawibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_LINEAR, drawibuf->rect, 1.0f, 1.0f, img_col); + immDrawPixelsTex(rect.xmin, rect.ymin + 1, drawibuf->x, drawibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_LINEAR, drawibuf->rect, 1.0f, 1.0f, NULL); /* draw cross for pixel position */ gpuTranslate3f(rect.xmin + scopes->track_pos[0], rect.ymin + scopes->track_pos[1], 0.0f); diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index d6dcd0208f..3def3e3598 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -975,15 +975,13 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), BLI_assert(!"invalid icon size"); return; } - /* modulate color */ - if (alpha != 1.0f) - glPixelTransferf(GL_ALPHA_SCALE, alpha); + float col[4] = {1.0f, 1.0f, 1.0f, alpha}; if (rgb) { - glPixelTransferf(GL_RED_SCALE, rgb[0]); - glPixelTransferf(GL_GREEN_SCALE, rgb[1]); - glPixelTransferf(GL_BLUE_SCALE, rgb[2]); + col[0] = rgb[0]; + col[1] = rgb[1]; + col[2] = rgb[2]; } /* rect contains image in 'rendersize', we only scale if needed */ @@ -1009,31 +1007,26 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), } /* draw */ +#if 0 if (is_preview) { - glaDrawPixelsSafe(draw_x, draw_y, draw_w, draw_h, draw_w, GL_RGBA, GL_UNSIGNED_BYTE, rect); + immDrawPixelsTex(draw_x, draw_y, draw_w, draw_h, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, rect, +1.0f, 1.0f, col); } else { +#endif int bound_options; GPU_BASIC_SHADER_DISABLE_AND_STORE(bound_options); - glRasterPos2f(draw_x, draw_y); - glDrawPixels(draw_w, draw_h, GL_RGBA, GL_UNSIGNED_BYTE, rect); + immDrawPixelsTex(draw_x, draw_y, draw_w, draw_h, GL_RGBA, GL_UNSIGNED_BYTE,
[Bf-blender-cvs] [7b744f9e1a] blender2.8: Opengl glaDrawPixels removal: mask_draw.c
Commit: 7b744f9e1aac8960afab5b97c64a436e79c56f38 Author: Clément Foucault Date: Fri Feb 24 01:24:09 2017 +0100 Branches: blender2.8 https://developer.blender.org/rB7b744f9e1aac8960afab5b97c64a436e79c56f38 Opengl glaDrawPixels removal: mask_draw.c === M source/blender/editors/mask/mask_draw.c === diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index b20862e763..f431efd80e 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -54,6 +54,7 @@ #include "GPU_immediate.h" #include "GPU_draw.h" +#include "GPU_shader.h" #include "UI_resources.h" #include "UI_view2d.h" @@ -753,17 +754,11 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar, if (draw_flag & MASK_DRAWFLAG_OVERLAY) { float *buffer = threaded_mask_rasterize(mask, width, height); - int format; - if (overlay_mode == MASK_OVERLAY_ALPHACHANNEL) { - glColor3f(1.0f, 1.0f, 1.0f); - format = GL_LUMINANCE; - } - else { + if (overlay_mode != MASK_OVERLAY_ALPHACHANNEL) { /* More blending types could be supported in the future. */ glEnable(GL_BLEND); - glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA); - format = GL_ALPHA; + glBlendFunc(GL_DST_COLOR, GL_ZERO); } glPushMatrix(); @@ -772,7 +767,12 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar, if (stabmat) { glMultMatrixf((const float *) stabmat); } - glaDrawPixelsTex(0.0f, 0.0f, width, height, format, GL_FLOAT, GL_NEAREST, buffer); + GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR); + GPU_shader_bind(shader); + float red[4] = {1.0f, 0.0f, 0.0f, 0.0f}; + GPU_shader_uniform_vector(shader, GPU_shader_get_uniform(shader, "shuffle"), 4, 1, red); + immDrawPixelsTex(0.0f, 0.0f, width, height, GL_RED, GL_FLOAT, GL_NEAREST, buffer, 1.0f, 1.0f, NULL); + GPU_shader_unbind(); glPopMatrix(); if (overlay_mode != MASK_OVERLAY_ALPHACHANNEL) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c2453007f4] blender2.8: Opengl glaDrawPixels removal: #if 0 glDrawPixels...
Commit: c2453007f4f61c2dda84a6a9dda0f9d275659f3f Author: Clément Foucault Date: Fri Feb 24 01:25:24 2017 +0100 Branches: blender2.8 https://developer.blender.org/rBc2453007f4f61c2dda84a6a9dda0f9d275659f3f Opengl glaDrawPixels removal: #if 0 glDrawPixels... === M source/blender/editors/include/BIF_glutil.h M source/blender/editors/screen/glutil.c === diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index 3ba8e2e2ec..b81c7a8dcf 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -172,6 +172,7 @@ int glaGetOneInt(int param); */ void glaRasterPosSafe2f(float x, float y, float known_good_x, float known_good_y); +#if 0 /* Obsolete / unused */ /** * Functions like a limited glDrawPixels, except ensures that * the image is displayed onscreen even if the \a x and \a y @@ -205,11 +206,10 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo * modelview and projection matrices are assumed to define a * 1-to-1 mapping to screen space. */ - void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect); void glaDrawPixelsTex_clipping(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y); - +#endif /** * immDrawPixelsTex - Functions like a limited glDrawPixels, but actually draws the * image using textures, which can be tremendously faster on low-end @@ -227,7 +227,7 @@ void immDrawPixelsTex(float x, float y, int img_w, int img_h, int format, int ty void immDrawPixelsTex_clipping(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float xzoom, float yzoom, float color[4]); - +#if 0 /* Obsolete / unused */ /** * glaDrawPixelsAuto - Switches between texture or pixel drawing using UserDef. * only RGBA @@ -241,6 +241,7 @@ void glaDrawPixelsAuto_clipping(float x, float y, int img_w, int img_h, int form void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float scaleX, float scaleY); void glaDrawPixelsTexScaled_clipping(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float scaleX, float scaleY, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y); +#endif void immDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float scaleX, float scaleY, float xzoom, float yzoom, float color[4]); @@ -261,7 +262,6 @@ void immDrawPixelsTexScaled_clipping(float x, float y, int img_w, int img_h, int * \param screen_rect The screen rectangle to be defined for 2D drawing. */ void glaDefine2DArea(struct rcti *screen_rect); - #if 0 /* UNUSED */ typedef struct gla2DDrawInfo gla2DDrawInfo; diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 8f228b2817..1b321c220a 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -352,6 +352,7 @@ static int get_cached_work_texture(int *r_w, int *r_h) return texid; } +#if 0 /* Obsolete / unused */ /* DEPRECATED: use immDrawPixelsTexScaled_clipping instead */ void glaDrawPixelsTexScaled_clipping(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, @@ -617,6 +618,7 @@ void glaDrawPixelsAuto(float x, float y, int img_w, int img_h, int format, int t glaDrawPixelsAuto_clipping(x, y, img_w, img_h, format, type, zoomfilter, rect, 0.0f, 0.0f, 0.0f, 0.0f); } +#endif /* Use the currently bound shader if there is one. * To let it draw without other shaders use glUseProgram(0) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [6628446bdf] blender2.8: Opengl glaDrawPixels removal: editors/render
Commit: 6628446bdf47ae526e89755e5b0e31702a88457c Author: Clément Foucault Date: Fri Feb 24 01:16:33 2017 +0100 Branches: blender2.8 https://developer.blender.org/rB6628446bdf47ae526e89755e5b0e31702a88457c Opengl glaDrawPixels removal: editors/render === M source/blender/editors/render/render_internal.c M source/blender/editors/render/render_preview.c === diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 950214b895..abb65d1ef1 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -1537,11 +1537,10 @@ void render_view3d_draw(RenderEngine *engine, const bContext *C) if (force_fallback == false) { if (IMB_colormanagement_setup_glsl_draw(>view_settings, >display_settings, dither, true)) { glEnable(GL_BLEND); - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - glPixelZoom(scale_x, scale_y); - glaDrawPixelsTex(xof, yof, rres.rectx, rres.recty, -GL_RGBA, GL_FLOAT, GL_NEAREST, rres.rectf); - glPixelZoom(1.0f, 1.0f); + glUseProgram(0); /* immDrawPixelsTex use it's own shader */ + immDrawPixelsTex(xof, yof, rres.rectx, rres.recty, +GL_RGBA, GL_FLOAT, GL_NEAREST, rres.rectf, +scale_x, scale_y, NULL);; glDisable(GL_BLEND); IMB_colormanagement_finish_glsl_draw(); @@ -1558,12 +1557,11 @@ void render_view3d_draw(RenderEngine *engine, const bContext *C) 4, dither, >view_settings, >display_settings); glEnable(GL_BLEND); - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - glPixelZoom(scale_x, scale_y); - glaDrawPixelsAuto(xof, yof, rres.rectx, rres.recty, - GL_RGBA, GL_UNSIGNED_BYTE, - GL_NEAREST, display_buffer); - glPixelZoom(1.0f, 1.0f); + glUseProgram(0); /* immDrawPixelsTex use it's own shader */ + immDrawPixelsTex(xof, yof, rres.rectx, rres.recty, +GL_RGBA, GL_UNSIGNED_BYTE, +GL_NEAREST, display_buffer, +scale_x, scale_y, NULL); glDisable(GL_BLEND); MEM_freeN(display_buffer); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index b4c92ef0f9..c651cfdce0 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -599,7 +599,8 @@ static bool ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti *rect, if (re) RE_AcquiredResultGet32(re, , (unsigned int *)rect_byte, 0); - glaDrawPixelsSafe(fx, fy, rres.rectx, rres.recty, rres.rectx, GL_RGBA, GL_UNSIGNED_BYTE, rect_byte); + immDrawPixelsTex(fx, fy, rres.rectx, rres.recty, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, rect_byte, +1.0f, 1.0f, NULL); MEM_freeN(rect_byte); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [45711c3fde] blender2.8: OpenGL immediate mode: new shader image shuffle color
Commit: 45711c3fde183a07810e33bd041aa3b74bd2d066 Author: Clément Foucault Date: Fri Feb 24 01:07:40 2017 +0100 Branches: blender2.8 https://developer.blender.org/rB45711c3fde183a07810e33bd041aa3b74bd2d066 OpenGL immediate mode: new shader image shuffle color new shader to draw an image with one isolated channel === M source/blender/gpu/CMakeLists.txt M source/blender/gpu/GPU_shader.h M source/blender/gpu/intern/gpu_shader.c A source/blender/gpu/shaders/gpu_shader_image_shuffle_color_frag.glsl === diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 98c7331e8d..f4627231af 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -143,6 +143,7 @@ data_to_c_simple(shaders/gpu_shader_2D_flat_color_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_2D_smooth_color_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_2D_smooth_color_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_2D_image_vert.glsl SRC) +data_to_c_simple(shaders/gpu_shader_image_shuffle_color_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_image_mask_uniform_color_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_image_modulate_alpha_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_image_color_frag.glsl SRC) diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h index 9fe7c7a1c1..57309c2ebd 100644 --- a/source/blender/gpu/GPU_shader.h +++ b/source/blender/gpu/GPU_shader.h @@ -117,6 +117,7 @@ typedef enum GPUBuiltinShader { GPU_SHADER_3D_SMOOTH_COLOR, GPU_SHADER_3D_DEPTH_ONLY, /* basic image drawing */ + GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR, GPU_SHADER_2D_IMAGE_MASK_UNIFORM_COLOR, GPU_SHADER_3D_IMAGE_MODULATE_ALPHA, GPU_SHADER_3D_IMAGE_RECT_MODULATE_ALPHA, diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c index e5c1dfb5bc..a9a8a10cc7 100644 --- a/source/blender/gpu/intern/gpu_shader.c +++ b/source/blender/gpu/intern/gpu_shader.c @@ -62,6 +62,7 @@ extern char datatoc_gpu_shader_2D_image_vert_glsl[]; extern char datatoc_gpu_shader_3D_image_vert_glsl[]; extern char datatoc_gpu_shader_image_color_frag_glsl[]; +extern char datatoc_gpu_shader_image_shuffle_color_frag_glsl[]; extern char datatoc_gpu_shader_image_interlace_frag_glsl[]; extern char datatoc_gpu_shader_image_mask_uniform_color_frag_glsl[]; extern char datatoc_gpu_shader_image_modulate_alpha_frag_glsl[]; @@ -690,6 +691,8 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader) datatoc_gpu_shader_2D_smooth_color_frag_glsl }, [GPU_SHADER_2D_IMAGE_COLOR] = { datatoc_gpu_shader_2D_image_vert_glsl, datatoc_gpu_shader_image_color_frag_glsl }, + [GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR] = { datatoc_gpu_shader_2D_image_vert_glsl, + datatoc_gpu_shader_image_shuffle_color_frag_glsl }, [GPU_SHADER_3D_UNIFORM_COLOR] = { datatoc_gpu_shader_3D_vert_glsl, datatoc_gpu_shader_uniform_color_frag_glsl }, [GPU_SHADER_3D_FLAT_COLOR] = { datatoc_gpu_shader_3D_flat_color_vert_glsl, datatoc_gpu_shader_flat_color_frag_glsl }, diff --git a/source/blender/gpu/shaders/gpu_shader_image_shuffle_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_shuffle_color_frag.glsl new file mode 100644 index 00..fa4f41b79f --- /dev/null +++ b/source/blender/gpu/shaders/gpu_shader_image_shuffle_color_frag.glsl @@ -0,0 +1,22 @@ + +#if __VERSION__ == 120 + varying vec2 texCoord_interp; + #define fragColor gl_FragColor +#else + in vec2 texCoord_interp; + out vec4 fragColor; + #define texture2D texture +#endif + +uniform sampler2D image; +uniform vec4 color; +uniform vec4 shuffle; + +void main() +{ + vec4 sample = texture2D(image, texCoord_interp); + fragColor = vec4(sample.r * shuffle.r + +sample.g * shuffle.g + +sample.b * shuffle.b + +sample.a * shuffle.a) * color; +} ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [071fdfbfb3] blender2.8: OpenGL immediate mode: fix asserts in clip dopesheet
Commit: 071fdfbfb3ad51b83da57628d9336bbce5cb8a79 Author: Clément Foucault Date: Thu Feb 23 16:38:29 2017 +0100 Branches: blender2.8 https://developer.blender.org/rB071fdfbfb3ad51b83da57628d9336bbce5cb8a79 OpenGL immediate mode: fix asserts in clip dopesheet === M source/blender/editors/space_clip/clip_dopesheet_draw.c === diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c index 872e62dbc9..14d2ca21b0 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.c +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c @@ -216,7 +216,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene) format = immVertexFormat(); pos_id = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); unsigned int size_id = add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT); - unsigned int color_id = add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + unsigned int color_id = add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT); unsigned int outline_color_id = add_attrib(format, "outlineColor", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); @@ -225,7 +225,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene) /* all same size with black outline */ immAttrib1f(size_id, 2.0f * STRIP_HEIGHT_HALF); - immAttrib3ub(outline_color_id, 0, 0, 0); + immAttrib4ub(outline_color_id, 0, 0, 0, 255); y = (float) CHANNEL_FIRST; /* start again at the top */ for (channel = dopesheet->channels.first; channel; channel = channel->next) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e5799d1389] blender2.8: OpenGL immediate mode: gpu_framebuffer.c
Commit: e5799d13897e43410758af4fcef9e1e71a25e719 Author: Clément Foucault Date: Wed Feb 22 19:57:58 2017 +0100 Branches: blender2.8 https://developer.blender.org/rBe5799d13897e43410758af4fcef9e1e71a25e719 OpenGL immediate mode: gpu_framebuffer.c I had to make some changes to the sep_gaussian_blur shader to be compliant for gl 3.3 leap === M source/blender/gpu/gawain/batch.c M source/blender/gpu/gawain/batch.h M source/blender/gpu/intern/gpu_framebuffer.c M source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_frag.glsl M source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_vert.glsl === diff --git a/source/blender/gpu/gawain/batch.c b/source/blender/gpu/gawain/batch.c index 81e694cc9b..a40e801d48 100644 --- a/source/blender/gpu/gawain/batch.c +++ b/source/blender/gpu/gawain/batch.c @@ -133,6 +133,17 @@ void Batch_done_using_program(Batch* batch) } } +void Batch_Uniform1i(Batch* batch, const char* name, int value) + { + int loc = glGetUniformLocation(batch->program, name); + +#if TRUST_NO_ONE + assert(loc != -1); +#endif + + glUniform1i(loc, value); + } + void Batch_Uniform1b(Batch* batch, const char* name, bool value) { int loc = glGetUniformLocation(batch->program, name); diff --git a/source/blender/gpu/gawain/batch.h b/source/blender/gpu/gawain/batch.h index 660ed9eb76..c12cc4e66a 100644 --- a/source/blender/gpu/gawain/batch.h +++ b/source/blender/gpu/gawain/batch.h @@ -50,6 +50,7 @@ void Batch_set_program(Batch*, GLuint program); void Batch_use_program(Batch*); // call before Batch_Uniform (temp hack?) void Batch_done_using_program(Batch*); +void Batch_Uniform1i(Batch*, const char* name, int value); void Batch_Uniform1b(Batch*, const char* name, bool value); void Batch_Uniform1f(Batch*, const char* name, float value); void Batch_Uniform2f(Batch*, const char* name, float x, float y); diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index 3b44abb479..eb52825e02 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -32,9 +32,11 @@ #include "BKE_global.h" +#include "GPU_batch.h" #include "GPU_debug.h" #include "GPU_glew.h" #include "GPU_framebuffer.h" +#include "GPU_matrix.h" #include "GPU_shader.h" #include "GPU_texture.h" @@ -379,20 +381,48 @@ void GPU_framebuffer_blur( GPUFrameBuffer *fb, GPUTexture *tex, GPUFrameBuffer *blurfb, GPUTexture *blurtex) { + const float fullscreencos[4][2] = {{-1.0f, -1.0f}, {1.0f, -1.0f}, {-1.0f, 1.0f}, {1.0f, 1.0f}}; + const float fullscreenuvs[4][2] = {{0.0f, 0.0f}, {1.0f, 0.0f}, {0.0f, 1.0f}, {1.0f, 1.0f}}; + + static VertexFormat format = {0}; + static VertexBuffer vbo = {0}; + static Batch batch = {0}; + const float scaleh[2] = {1.0f / GPU_texture_width(blurtex), 0.0f}; const float scalev[2] = {0.0f, 1.0f / GPU_texture_height(tex)}; GPUShader *blur_shader = GPU_shader_get_builtin_shader(GPU_SHADER_SEP_GAUSSIAN_BLUR); - int scale_uniform, texture_source_uniform; if (!blur_shader) return; - scale_uniform = GPU_shader_get_uniform(blur_shader, "ScaleU"); - texture_source_uniform = GPU_shader_get_uniform(blur_shader, "textureSource"); + /* Preparing to draw quad */ + if (format.attrib_ct == 0) { + unsigned int i = 0; + /* Vertex format */ + unsigned int pos = add_attrib(, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int uvs = add_attrib(, "uvs", GL_FLOAT, 2, KEEP_FLOAT); + + /* Vertices */ + VertexBuffer_init_with_format(, ); + VertexBuffer_allocate_data(, 36); + + for (int j = 0; j < 3; ++j) { + setAttrib(, uvs, i, fullscreenuvs[j]); setAttrib(, pos, i++, fullscreencos[j]); + } + for (int j = 1; j < 4; ++j) { + setAttrib(, uvs, i, fullscreenuvs[j]); setAttrib(, pos, i++, fullscreencos[j]); + } + + Batch_init(, GL_TRIANGLES, , NULL); + } - /* Blurring horizontally */ + glDisable(GL_DEPTH_TEST); + + /* Load fresh matrices */ + gpuMatrixBegin3D(); /* TODO: finish 2D API */ + /* Blurring horizontally */ /* We do the bind ourselves rather than using GPU_framebuffer_texture_bind() to avoid * pushing unnecessary matrices onto the OpenGL stack. */ glBindFramebuffer(GL_FRAMEBUFFER, blurfb->object); @@ -401,51 +431,32 @@ void GPU_framebuffer_blur( /* avoid warnings from texture binding */ GG.currentfb = blurfb->object; - GPU_shader_bind(blur_shader); -
[Bf-blender-cvs] [c9e8584e7f] blender2.8: Opengl glaDrawPixels removal: windowmanager
Commit: c9e8584e7f9af60f9e7b6d1ae136915e300a52cb Author: Clément Foucault Date: Fri Feb 24 01:17:48 2017 +0100 Branches: blender2.8 https://developer.blender.org/rBc9e8584e7f9af60f9e7b6d1ae136915e300a52cb Opengl glaDrawPixels removal: windowmanager === M source/blender/windowmanager/intern/wm_dragdrop.c M source/blender/windowmanager/intern/wm_gesture.c === diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index 2d1dcd7f3c..3cb767f130 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -332,8 +332,9 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect) if (rect) drag_rect_minmax(rect, x, y, x + drag->sx, y + drag->sy); else { - glColor4f(1.0, 1.0, 1.0, 0.65); /* this blends texture */ - glaDrawPixelsTexScaled(x, y, drag->imb->x, drag->imb->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, drag->imb->rect, drag->scale, drag->scale); + float col[4] = {1.0f, 1.0f, 1.0f, 0.65f}; /* this blends texture */ + immDrawPixelsTexScaled(x, y, drag->imb->x, drag->imb->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, + drag->imb->rect, drag->scale, drag->scale, 1.0f, 1.0f, col); } } else { diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index 4620eb..6114012404 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -52,8 +52,9 @@ #include "wm.h" #include "wm_subwindow.h" #include "wm_draw.h" -#include "GPU_basic_shader.h" +#include "GPU_basic_shader.h" +#include "GPU_shader.h" #include "BIF_glutil.h" @@ -253,6 +254,7 @@ static void draw_filled_lasso(wmWindow *win, wmGesture *gt) int i; rcti rect; rcti rect_win; + float red[4] = {1.0f, 0.0f, 0.0f, 0.0f}; for (i = 0; i < tot; i++, lasso += 2) { moves[i][0] = lasso[0]; @@ -278,28 +280,27 @@ static void draw_filled_lasso(wmWindow *win, wmGesture *gt) (const int (*)[2])moves, tot, draw_filled_lasso_px_cb, _fill_data); + /* Additive Blending */ + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glColor4f(1, 1, 1, 1); - glPixelTransferf(GL_RED_BIAS, 1); - glPixelTransferf(GL_GREEN_BIAS, 1); - glPixelTransferf(GL_BLUE_BIAS, 1); + GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR); + GPU_shader_bind(shader); + GPU_shader_uniform_vector(shader, GPU_shader_get_uniform(shader, "shuffle"), 4, 1, red); - GPU_basic_shader_bind(GPU_SHADER_TEXTURE_2D | GPU_SHADER_USE_COLOR); - - glEnable(GL_BLEND); - glaDrawPixelsTex(rect.xmin, rect.ymin, w, h, GL_ALPHA, GL_UNSIGNED_BYTE, GL_NEAREST, pixel_buf); - glDisable(GL_BLEND); + immDrawPixelsTex(rect.xmin, rect.ymin, w, h, GL_RED, GL_UNSIGNED_BYTE, GL_NEAREST, pixel_buf, 1.0f, 1.0f, NULL); + GPU_shader_unbind(); GPU_basic_shader_bind(GPU_SHADER_USE_COLOR); - glPixelTransferf(GL_RED_BIAS, 0); - glPixelTransferf(GL_GREEN_BIAS, 0); - glPixelTransferf(GL_BLUE_BIAS, 0); - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + MEM_freeN(pixel_buf); + + glDisable(GL_BLEND); } MEM_freeN(moves); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e437841239] blender2.8: OpenGL immediate mode: modifying immDrawPixelsTex
Commit: e4378412394caaf84215ae52af0a916b71804cd0 Author: Clément Foucault Date: Thu Feb 23 14:31:40 2017 +0100 Branches: blender2.8 https://developer.blender.org/rBe4378412394caaf84215ae52af0a916b71804cd0 OpenGL immediate mode: modifying immDrawPixelsTex This way OCIO can be used with it. === M source/blender/editors/interface/interface_draw.c M source/blender/editors/screen/glutil.c === diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index c96e5c7316..afb6422ec4 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1735,6 +1735,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc UI_draw_roundbox_gl_mode(GL_TRIANGLE_FAN, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f, color); } + GPU_shader_unbind(); /* make sure there is no program bound */ immDrawPixelsTex(rect.xmin, rect.ymin + 1, drawibuf->x, drawibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_LINEAR, drawibuf->rect, 1.0f, 1.0f, img_col); /* draw cross for pixel position */ diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index de24b8ec50..898fdb3bf9 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -618,8 +618,7 @@ void glaDrawPixelsAuto(float x, float y, int img_w, int img_h, int format, int t 0.0f, 0.0f, 0.0f, 0.0f); } -/* TODO this is utterly slow and need some love - * but in the meantime it's not using deprecated api */ +/* Use the currently bound shader if there is one */ void immDrawPixelsTexScaled_clipping(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float scaleX, float scaleY, @@ -687,9 +686,15 @@ void immDrawPixelsTexScaled_clipping(float x, float y, int img_w, int img_h, unsigned int pos = add_attrib(vert_format, "pos", GL_FLOAT, 2, KEEP_FLOAT); unsigned int texco = add_attrib(vert_format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); - immUniform4fv("color", color); - immUniform1i("image", 0); + unsigned int program = glaGetOneInt(GL_CURRENT_PROGRAM); + + if (program) + immBindProgram(program); + else { + immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); + immUniform1i("image", 0); + immUniform4fv("color", color); + } for (subpart_y = 0; subpart_y < nsubparts_y; subpart_y++) { for (subpart_x = 0; subpart_x < nsubparts_x; subpart_x++) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [44ea6fb857] blender2.8: OpenGL: Make glaDrawImBuf_glsl functions compatible with new immDrawPixels
Commit: 44ea6fb857fc9ea3b51734fb3782d8bfb5c05de6 Author: Clément Foucault Date: Fri Feb 24 01:15:21 2017 +0100 Branches: blender2.8 https://developer.blender.org/rB44ea6fb857fc9ea3b51734fb3782d8bfb5c05de6 OpenGL: Make glaDrawImBuf_glsl functions compatible with new immDrawPixels And change relevant function calls. === M source/blender/editors/include/BIF_glutil.h M source/blender/editors/screen/glutil.c M source/blender/editors/space_clip/clip_draw.c M source/blender/editors/space_image/image_draw.c M source/blender/editors/space_node/drawnode.c === diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index 2dd922be37..3ba8e2e2ec 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -297,22 +297,26 @@ void bgl_get_mats(bglMats *mats); /* Draw imbuf on a screen, preferably using GLSL display transform */ void glaDrawImBuf_glsl(struct ImBuf *ibuf, float x, float y, int zoomfilter, struct ColorManagedViewSettings *view_settings, - struct ColorManagedDisplaySettings *display_settings); + struct ColorManagedDisplaySettings *display_settings, + float zoom_x, float zoom_y); void glaDrawImBuf_glsl_clipping(struct ImBuf *ibuf, float x, float y, int zoomfilter, struct ColorManagedViewSettings *view_settings, struct ColorManagedDisplaySettings *display_settings, float clip_min_x, float clip_min_y, -float clip_max_x, float clip_max_y); +float clip_max_x, float clip_max_y, +float zoom_x, float zoom_y); /* Draw imbuf on a screen, preferably using GLSL display transform */ -void glaDrawImBuf_glsl_ctx(const struct bContext *C, struct ImBuf *ibuf, float x, float y, int zoomfilter); +void glaDrawImBuf_glsl_ctx(const struct bContext *C, struct ImBuf *ibuf, float x, float y, int zoomfilter, + float zoom_x, float zoom_y); void glaDrawImBuf_glsl_ctx_clipping(const struct bContext *C, struct ImBuf *ibuf, float x, float y, int zoomfilter, float clip_min_x, float clip_min_y, -float clip_max_x, float clip_max_y); +float clip_max_x, float clip_max_y, +float zoom_x, float zoom_y); void glaDrawBorderCorners(const struct rcti *border, float zoomx, float zoomy); diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 898fdb3bf9..8f228b2817 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -618,7 +618,11 @@ void glaDrawPixelsAuto(float x, float y, int img_w, int img_h, int format, int t 0.0f, 0.0f, 0.0f, 0.0f); } -/* Use the currently bound shader if there is one */ +/* Use the currently bound shader if there is one. + * To let it draw without other shaders use glUseProgram(0) + * or GPU_shader_unbind() before calling immDrawPixelsTex. + * + * If color is NULL then use white by default */ void immDrawPixelsTexScaled_clipping(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float scaleX, float scaleY, @@ -633,10 +637,8 @@ void immDrawPixelsTexScaled_clipping(float x, float y, int img_w, int img_h, int texid = get_cached_work_texture(_w, _h); int components; const bool use_clipping = ((clip_min_x < clip_max_x) && (clip_min_y < clip_max_y)); + float white[4] = {1.0f, 1.0f, 1.0f, 1.0f}; - /* Specify the color outside this function, and tex will modulate it. -* This is useful for changing alpha without using glPixelTransferf() -*/ glPixelStorei(GL_UNPACK_ROW_LENGTH, img_w); glBindTexture(GL_TEXTURE_2D, texid); @@ -688,14 +690,20 @@ void immDrawPixelsTexScaled_clipping(float x, float y, int img_w, int img_h, unsigned int program = glaGetOneInt(GL_CURRENT_PROGRAM); - if (program) + if (program) { immBindProgram(program); + + /* optionnal */ + if (glGetUniformLocation(program, "color") != -1) + immUniform4fv("color", (color) ? color : white); + } else { immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); immUniform1i("image", 0); -
[Bf-blender-cvs] [07a1c20398] workspaces: Merge branch 'blender2.8' into workspaces
Commit: 07a1c203987263680e353b511f1ae249627dd1cd Author: Julian Eisel Date: Fri Feb 24 00:57:17 2017 +0100 Branches: workspaces https://developer.blender.org/rB07a1c203987263680e353b511f1ae249627dd1cd Merge branch 'blender2.8' into workspaces Conflicts: source/blender/blenloader/intern/readfile.c source/blender/editors/workspace/screen_draw.c === === diff --cc source/blender/editors/space_time/space_time.c index bbe23adb60,986ac062b0..d39b8a323b --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@@ -511,18 -467,8 +467,8 @@@ static void time_draw_keyframes(const b /* */ - static void time_refresh(const bContext *UNUSED(C), ScrArea *sa) - { - /* find the main timeline region and refresh cache display*/ - ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); - if (ar) { - SpaceTime *stime = (SpaceTime *)sa->spacedata.first; - time_cache_refresh(stime); - } - } - /* editor level listener */ -static void time_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) +static void time_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, const Scene *UNUSED(scene)) { /* mainly for updating cache display */ diff --cc source/blender/editors/workspace/screen_draw.c index c275008628,7ba3c4b82b..25ebf951a3 --- a/source/blender/editors/workspace/screen_draw.c +++ b/source/blender/editors/workspace/screen_draw.c @@@ -268,24 -296,27 +297,27 @@@ void ED_screen_draw(wmWindow *win ScrArea *sa2 = NULL; ScrArea *sa3 = NULL; - wmSubWindowSet(win, win->screen->mainwin); + wmSubWindowSet(win, screen->mainwin); + unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + /* Note: first loop only draws if U.pixelsize > 1, skip otherwise */ if (U.pixelsize > 1.0f) { /* FIXME: doesn't our glLineWidth already scale by U.pixelsize? */ glLineWidth((2.0f * U.pixelsize) - 1); - glColor3ub(0x50, 0x50, 0x50); - glBegin(GL_LINES); - for (sa = screen->areabase.first; sa; sa = sa->next) - drawscredge_area(sa, winsize_x, winsize_y); - glEnd(); + immUniformColor3ub(0x50, 0x50, 0x50); + - for (sa = win->screen->areabase.first; sa; sa = sa->next) { ++ for (sa = screen->areabase.first; sa; sa = sa->next) { + drawscredge_area(sa, winsize_x, winsize_y, pos); + } } glLineWidth(1); - glColor3ub(0, 0, 0); - glBegin(GL_LINES); + immUniformColor3ub(0, 0, 0); + - for (sa = win->screen->areabase.first; sa; sa = sa->next) { + for (sa = screen->areabase.first; sa; sa = sa->next) { - drawscredge_area(sa, winsize_x, winsize_y); + drawscredge_area(sa, winsize_x, winsize_y, pos); /* gather area split/join info */ if (sa->flag & AREA_FLAG_DRAWJOINFROM) sa1 = sa; @@@ -348,7 -396,9 +397,9 @@@ glDisable(GL_BLEND); } + immUnbindProgram(); + - win->screen->do_draw = false; + screen->do_draw = false; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c394624b9f] temp-workspace-multi-window: Initial steps to remove layout entities from workspace level
Commit: c394624b9fb84683bb0726a0c25209031205d054 Author: Julian Eisel Date: Sun Feb 19 13:45:49 2017 +0100 Branches: temp-workspace-multi-window https://developer.blender.org/rBc394624b9fb84683bb0726a0c25209031205d054 Initial steps to remove layout entities from workspace level === M source/blender/blenkernel/BKE_workspace.h M source/blender/blenkernel/intern/library_query.c M source/blender/blenkernel/intern/workspace.c M source/blender/blenloader/intern/readfile.c M source/blender/blenloader/intern/writefile.c M source/blender/editors/workspace/workspace_edit.c === diff --git a/source/blender/blenkernel/BKE_workspace.h b/source/blender/blenkernel/BKE_workspace.h index 2555a74d1f..547c55bc85 100644 --- a/source/blender/blenkernel/BKE_workspace.h +++ b/source/blender/blenkernel/BKE_workspace.h @@ -74,7 +74,6 @@ void BKE_workspaces_transform_orientation_remove(const struct ListBase *workspac const struct TransformOrientation *orientation) ATTR_NONNULL(); WorkSpaceLayout *BKE_workspace_layout_find(const WorkSpace *ws, const struct bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; -WorkSpaceLayout *BKE_workspace_layout_find_exec(const WorkSpace *ws, const struct bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; #define BKE_workspace_layout_iter_begin(_layout, _start_layout) \ for (WorkSpaceLayout *_layout = _start_layout, *_layout##_next; _layout; _layout = _layout##_next) { \ diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c index 52cf29fe92..18b6079919 100644 --- a/source/blender/blenkernel/intern/library_query.c +++ b/source/blender/blenkernel/intern/library_query.c @@ -918,6 +918,16 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call CALLBACK_INVOKE(win->scene, IDWALK_CB_USER_ONE); + BKE_workspace_layout_iter_begin(layout, win->workspace_layouts.first) + { + bScreen *screen = BKE_workspace_layout_screen_get(layout); + + CALLBACK_INVOKE(screen, IDWALK_CB_NOP); + /* allow callback to set a different screen */ + BKE_workspace_layout_screen_set(layout, screen); + } + BKE_workspace_layout_iter_end; + CALLBACK_INVOKE_ID(workspace, IDWALK_CB_NOP); /* allow callback to set a different workspace */ win->workspace = (WorkSpace *)workspace; diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c index 7de053d76f..c16b3bc3b6 100644 --- a/source/blender/blenkernel/intern/workspace.c +++ b/source/blender/blenkernel/intern/workspace.c @@ -46,6 +46,22 @@ bool workspaces_is_screen_used(const Main *bmain, bScreen *screen); +static void workspace_layout_type_remove(WorkSpace *workspace, WorkSpaceLayoutType *layout_type) +{ + BLI_assert(BLI_findindex(>layout_types, layout_type) >= 0); + BLI_freelinkN(>layout_types, layout_type); +} + +static void workspace_layout_remove(WorkSpace *workspace, WorkSpaceLayout *layout, Main *bmain) +{ + bScreen *screen = BKE_workspace_layout_screen_get(layout); + + BLI_assert(BLI_findindex(>layouts, layout) >= 0); + BKE_libblock_free(bmain, screen); + BLI_freelinkN(>layouts, layout); +} + + /* */ /* Create, delete, init */ @@ -73,9 +89,14 @@ void BKE_workspace_remove(WorkSpace *workspace, Main *bmain) { BKE_workspace_layout_iter_begin(layout, workspace->layouts.first) { - BKE_workspace_layout_remove(workspace, layout, bmain); + workspace_layout_remove(workspace, layout, bmain); } BKE_workspace_layout_iter_end; + BKE_workspace_layout_type_iter_begin(layout_type, workspace->layout_types.first) + { + workspace_layout_type_remove(workspace, layout_type); + } + BKE_workspace_layout_type_iter_end; BKE_libblock_free(bmain, workspace); } @@ -116,13 +137,8 @@ WorkSpaceLayout *BKE_workspace_layout_add(WorkSpace *workspace, bScreen *screen) void BKE_workspace_layout_remove(WorkSpace *workspace, WorkSpaceLayout *layout, Main *bmain) { WorkSpaceLayoutType *layout_type = layout->type; - bScreen *screen = BKE_workspace_layout_screen_get(layout); - -
[Bf-blender-cvs] [49b524cfa8] temp-workspace-multi-window: Add/use macro to iterate over layout-types
Commit: 49b524cfa81e868efd25df95b9d0f181d068e75f Author: Julian Eisel Date: Thu Feb 16 20:16:37 2017 +0100 Branches: temp-workspace-multi-window https://developer.blender.org/rB49b524cfa81e868efd25df95b9d0f181d068e75f Add/use macro to iterate over layout-types === M source/blender/blenkernel/BKE_workspace.h M source/blender/windowmanager/intern/wm_window.c === diff --git a/source/blender/blenkernel/BKE_workspace.h b/source/blender/blenkernel/BKE_workspace.h index d6cbe43efc..2555a74d1f 100644 --- a/source/blender/blenkernel/BKE_workspace.h +++ b/source/blender/blenkernel/BKE_workspace.h @@ -88,6 +88,15 @@ WorkSpaceLayout *BKE_workspace_layout_iter_circular(const WorkSpace *workspace, bool (*callback)(const WorkSpaceLayout *layout, void *arg), void *arg, const bool iter_backward); +#define BKE_workspace_layout_type_iter_begin(_layout_type, _start_layout_type) \ + for (WorkSpaceLayoutType *_layout_type = _start_layout_type, *_layout_type##_next; \ +_layout_type; \ +_layout_type = _layout_type##_next) \ + { \ + _layout_type##_next = BKE_workspace_layout_type_next_get(_layout_type); /* support removing layout-type from list */ +#define BKE_workspace_layout_type_iter_end } (void)0 + + /* */ /* Getters/Setters */ diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 9b723bfb93..4ac1d83cda 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -1783,15 +1783,15 @@ WorkSpace *WM_window_get_active_workspace(const wmWindow *win) } void WM_window_set_active_workspace(wmWindow *win, WorkSpace *workspace) { + ListBase *layout_types = BKE_workspace_layout_types_get(workspace); + win->workspace = workspace; BLI_freelistN(>workspace_layouts); if (!workspace) { return; } - for (WorkSpaceLayoutType *layout_type = BKE_workspace_layout_types_get(workspace)->first; -layout_type != NULL; -layout_type = BKE_workspace_layout_type_next_get(layout_type)) + BKE_workspace_layout_type_iter_begin(layout_type, layout_types->first) { bScreen *screen = BLI_findstring(>screen, BKE_workspace_layout_type_name_get(layout_type), offsetof(ID, name) + 2); /* XXX */ @@ -1799,6 +1799,7 @@ void WM_window_set_active_workspace(wmWindow *win, WorkSpace *workspace) BLI_addhead(>workspace_layouts, layout); } + BKE_workspace_layout_type_iter_end; } WorkSpaceLayout *WM_window_get_active_layout(const wmWindow *win) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [675c4a0108] temp-workspace-multi-window: Multi-Window support: Store layout instances per window
Commit: 675c4a0108109efca604d486f9b20aad456bc6ea Author: Julian Eisel Date: Thu Feb 16 19:27:30 2017 +0100 Branches: temp-workspace-multi-window https://developer.blender.org/rB675c4a0108109efca604d486f9b20aad456bc6ea Multi-Window support: Store layout instances per window === M source/blender/blenkernel/BKE_workspace.h M source/blender/blenkernel/intern/workspace.c M source/blender/blenloader/intern/versioning_270.c M source/blender/makesdna/DNA_windowmanager_types.h M source/blender/makesdna/dna_workspace_types.h M source/blender/makesrna/intern/rna_workspace.c M source/blender/windowmanager/intern/wm_window.c === diff --git a/source/blender/blenkernel/BKE_workspace.h b/source/blender/blenkernel/BKE_workspace.h index 5bb1689f41..d6cbe43efc 100644 --- a/source/blender/blenkernel/BKE_workspace.h +++ b/source/blender/blenkernel/BKE_workspace.h @@ -56,7 +56,9 @@ WorkSpace *BKE_workspace_add(struct Main *bmain, const char *name); void BKE_workspace_free(WorkSpace *ws); void BKE_workspace_remove(WorkSpace *workspace, struct Main *bmain); -struct WorkSpaceLayout *BKE_workspace_layout_add(WorkSpace *workspace, struct bScreen *screen) ATTR_NONNULL(); +WorkSpaceLayout *BKE_workspace_layout_add_from_type(WorkSpace *workspace, WorkSpaceLayoutType *type, struct bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; +WorkSpaceLayoutType *BKE_workspace_layout_type_add(WorkSpace *workspace, struct bScreen *screen) ATTR_NONNULL(); +WorkSpaceLayout *BKE_workspace_layout_add(WorkSpace *workspace, struct bScreen *screen) ATTR_NONNULL(); void BKE_workspace_layout_remove(WorkSpace *workspace, WorkSpaceLayout *layout, struct Main *bmain) ATTR_NONNULL(); @@ -101,8 +103,10 @@ enum ObjectMode BKE_workspace_object_mode_get(const WorkSpace *workspace) ATTR_N voidBKE_workspace_object_mode_set(WorkSpace *workspace, const enum ObjectMode mode) ATTR_NONNULL(); #endif struct ListBase *BKE_workspace_layouts_get(WorkSpace *workspace) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; +WorkSpaceLayoutType *BKE_workspace_active_layout_type_get(WorkSpace *workspace) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; struct ListBase *BKE_workspace_layout_types_get(WorkSpace *workspace) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; const char *BKE_workspace_layout_type_name_get(WorkSpaceLayoutType *layout_type) ATTR_NONNULL(); +WorkSpaceLayoutType *BKE_workspace_layout_type_next_get(WorkSpaceLayoutType *layout_type) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; WorkSpaceLayout *BKE_workspace_new_layout_get(const WorkSpace *workspace) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; void BKE_workspace_new_layout_set(WorkSpace *workspace, WorkSpaceLayout *layout) ATTR_NONNULL(1); diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c index 4d4e643e78..7de053d76f 100644 --- a/source/blender/blenkernel/intern/workspace.c +++ b/source/blender/blenkernel/intern/workspace.c @@ -81,31 +81,45 @@ void BKE_workspace_remove(WorkSpace *workspace, Main *bmain) } -/** - * Add a new layout to \a workspace for \a screen. - */ -WorkSpaceLayout *BKE_workspace_layout_add(WorkSpace *workspace, bScreen *screen) +WorkSpaceLayout *BKE_workspace_layout_add_from_type(WorkSpace *workspace, WorkSpaceLayoutType *type, bScreen *screen) { - WorkSpaceLayoutType *layout_type = MEM_mallocN(sizeof(*layout_type), "WorkSpaceLayoutType"); WorkSpaceLayout *layout = MEM_mallocN(sizeof(*layout), __func__); - BLI_assert(!workspaces_is_screen_used(G.main, screen)); +// BLI_assert(!workspaces_is_screen_used(G.main, screen)); + + layout->type = type; layout->screen = screen; BLI_addhead(>layouts, layout); + return layout; +} + +WorkSpaceLayoutType *BKE_workspace_layout_type_add(WorkSpace *workspace, bScreen *screen) +{ + WorkSpaceLayoutType *layout_type = MEM_mallocN(sizeof(*layout_type), __func__); + layout_type->name = screen->id.name + 2; BLI_addhead(>layout_types, layout_type); - return layout; + return layout_type; +} + +/** + * Add a new layout to \a workspace for \a screen. + */ +WorkSpaceLayout *BKE_workspace_layout_add(WorkSpace *workspace, bScreen *screen) +{ + WorkSpaceLayoutType *layout_type = BKE_workspace_layout_type_add(workspace, screen); + return BKE_workspace_layout_add_from_type(workspace, layout_type, screen); } void BKE_workspace_layout_remove(WorkSpace *workspace, WorkSpaceLayout *layout, Main *bmain) { + WorkSpaceLayoutType *layout_type = layout->type; bScreen *screen = BKE_workspace_layout_screen_get(layout); - WorkSpaceLayoutType *layout_type = BLI_findptr(>layout_types, screen->id.name + 2, -
[Bf-blender-cvs] [cd15a54eaf] temp-workspace-multi-window: Add new screen-layouts to all instances of a workspace
Commit: cd15a54eafd4fced2e29783fa1a8e5d11f55bb10 Author: Julian Eisel Date: Fri Feb 24 00:29:29 2017 +0100 Branches: temp-workspace-multi-window https://developer.blender.org/rBcd15a54eafd4fced2e29783fa1a8e5d11f55bb10 Add new screen-layouts to all instances of a workspace === M source/blender/blenkernel/BKE_workspace.h M source/blender/blenkernel/intern/workspace.c M source/blender/editors/include/ED_screen.h M source/blender/editors/workspace/screen_edit.c M source/blender/editors/workspace/screen_ops.c M source/blender/editors/workspace/workspace_edit.c M source/blender/editors/workspace/workspace_layout_edit.c M source/blender/windowmanager/intern/wm_files.c M source/blender/windowmanager/intern/wm_window.c === diff --git a/source/blender/blenkernel/BKE_workspace.h b/source/blender/blenkernel/BKE_workspace.h index 547c55bc85..69d4066b3a 100644 --- a/source/blender/blenkernel/BKE_workspace.h +++ b/source/blender/blenkernel/BKE_workspace.h @@ -57,7 +57,7 @@ void BKE_workspace_free(WorkSpace *ws); void BKE_workspace_remove(WorkSpace *workspace, struct Main *bmain); WorkSpaceLayout *BKE_workspace_layout_add_from_type(WorkSpace *workspace, WorkSpaceLayoutType *type, struct bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; -WorkSpaceLayoutType *BKE_workspace_layout_type_add(WorkSpace *workspace, struct bScreen *screen) ATTR_NONNULL(); +WorkSpaceLayoutType *BKE_workspace_layout_type_add(WorkSpace *workspace, const char *name) ATTR_NONNULL(); WorkSpaceLayout *BKE_workspace_layout_add(WorkSpace *workspace, struct bScreen *screen) ATTR_NONNULL(); void BKE_workspace_layout_remove(WorkSpace *workspace, WorkSpaceLayout *layout, struct Main *bmain) ATTR_NONNULL(); diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c index c16b3bc3b6..d3206b9ad3 100644 --- a/source/blender/blenkernel/intern/workspace.c +++ b/source/blender/blenkernel/intern/workspace.c @@ -115,11 +115,11 @@ WorkSpaceLayout *BKE_workspace_layout_add_from_type(WorkSpace *workspace, WorkSp return layout; } -WorkSpaceLayoutType *BKE_workspace_layout_type_add(WorkSpace *workspace, bScreen *screen) +WorkSpaceLayoutType *BKE_workspace_layout_type_add(WorkSpace *workspace, const char *name) { WorkSpaceLayoutType *layout_type = MEM_mallocN(sizeof(*layout_type), __func__); - layout_type->name = screen->id.name + 2; + layout_type->name = name; BLI_addhead(>layout_types, layout_type); return layout_type; @@ -130,7 +130,7 @@ WorkSpaceLayoutType *BKE_workspace_layout_type_add(WorkSpace *workspace, bScreen */ WorkSpaceLayout *BKE_workspace_layout_add(WorkSpace *workspace, bScreen *screen) { - WorkSpaceLayoutType *layout_type = BKE_workspace_layout_type_add(workspace, screen); + WorkSpaceLayoutType *layout_type = BKE_workspace_layout_type_add(workspace, screen->id.name + 2); return BKE_workspace_layout_add_from_type(workspace, layout_type, screen); } diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 0641180883..07efdadfdb 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -126,10 +126,10 @@ voidED_screen_preview_render(const struct bScreen *screen, int size_x, int s bool ED_workspace_change(struct bContext *C, struct wmWindowManager *wm, struct wmWindow *win, struct WorkSpace *ws_new) ATTR_NONNULL(); struct WorkSpace *ED_workspace_duplicate(struct WorkSpace *workspace_old, struct Main *bmain, struct wmWindow *win); -struct WorkSpaceLayout *ED_workspace_layout_add(struct WorkSpace *workspace, struct wmWindow *win, const char *name) ATTR_NONNULL(); +void ED_workspace_layout_add(struct WorkSpace *workspace, ListBase *windows, const char *name) ATTR_NONNULL(); struct WorkSpaceLayout *ED_workspace_layout_duplicate(struct WorkSpace *workspace, const struct WorkSpaceLayout *layout_old, - struct wmWindow *win) ATTR_NONNULL(); + struct wmWindowManager *wm) ATTR_NONNULL(); bool ED_workspace_delete(struct Main *bmain, struct bContext *C, struct wmWindowManager *wm, struct wmWindow *win, struct WorkSpace *ws); diff --git a/source/blender/editors/workspace/screen_edit.c b/source/blender/editors/workspace/screen_edit.c index 2abd275a8b..ea0da00682 100644 --- a/source/blender/editors/workspace/screen_edit.c +++ b/source/blender/editors/workspace/screen_edit.c @@ -1515,7 +1515,8 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s
[Bf-blender-cvs] [5afda4b7fb] temp-workspace-multi-window: Multi-Window support: Store screen-types per workspace
Commit: 5afda4b7fbfea02ceb27f1a8156b6a058abf59dc Author: Julian Eisel Date: Tue Feb 14 21:02:36 2017 +0100 Branches: temp-workspace-multi-window https://developer.blender.org/rB5afda4b7fbfea02ceb27f1a8156b6a058abf59dc Multi-Window support: Store screen-types per workspace === M source/blender/blenkernel/BKE_workspace.h M source/blender/blenkernel/intern/workspace.c M source/blender/makesdna/dna_workspace_types.h M source/blender/makesrna/RNA_access.h M source/blender/makesrna/intern/rna_workspace.c === diff --git a/source/blender/blenkernel/BKE_workspace.h b/source/blender/blenkernel/BKE_workspace.h index 8cd884e193..5bb1689f41 100644 --- a/source/blender/blenkernel/BKE_workspace.h +++ b/source/blender/blenkernel/BKE_workspace.h @@ -36,6 +36,7 @@ struct WorkSpace; typedef struct WorkSpace WorkSpace; typedef struct WorkSpaceLayout WorkSpaceLayout; +typedef struct WorkSpaceLayoutType WorkSpaceLayoutType; /** * Plan is to store the object-mode per workspace, not per object anymore. @@ -100,6 +101,8 @@ enum ObjectMode BKE_workspace_object_mode_get(const WorkSpace *workspace) ATTR_N voidBKE_workspace_object_mode_set(WorkSpace *workspace, const enum ObjectMode mode) ATTR_NONNULL(); #endif struct ListBase *BKE_workspace_layouts_get(WorkSpace *workspace) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; +struct ListBase *BKE_workspace_layout_types_get(WorkSpace *workspace) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; +const char *BKE_workspace_layout_type_name_get(WorkSpaceLayoutType *layout_type) ATTR_NONNULL(); WorkSpaceLayout *BKE_workspace_new_layout_get(const WorkSpace *workspace) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; void BKE_workspace_new_layout_set(WorkSpace *workspace, WorkSpaceLayout *layout) ATTR_NONNULL(1); diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c index 37d4538cd0..4d4e643e78 100644 --- a/source/blender/blenkernel/intern/workspace.c +++ b/source/blender/blenkernel/intern/workspace.c @@ -65,6 +65,7 @@ WorkSpace *BKE_workspace_add(Main *bmain, const char *name) void BKE_workspace_free(WorkSpace *ws) { + BLI_freelistN(>layout_types); BLI_freelistN(>layouts); } @@ -85,19 +86,29 @@ void BKE_workspace_remove(WorkSpace *workspace, Main *bmain) */ WorkSpaceLayout *BKE_workspace_layout_add(WorkSpace *workspace, bScreen *screen) { + WorkSpaceLayoutType *layout_type = MEM_mallocN(sizeof(*layout_type), "WorkSpaceLayoutType"); WorkSpaceLayout *layout = MEM_mallocN(sizeof(*layout), __func__); BLI_assert(!workspaces_is_screen_used(G.main, screen)); layout->screen = screen; BLI_addhead(>layouts, layout); + layout_type->name = screen->id.name + 2; + BLI_addhead(>layout_types, layout_type); + return layout; } void BKE_workspace_layout_remove(WorkSpace *workspace, WorkSpaceLayout *layout, Main *bmain) { - BKE_libblock_free(bmain, BKE_workspace_layout_screen_get(layout)); + bScreen *screen = BKE_workspace_layout_screen_get(layout); + WorkSpaceLayoutType *layout_type = BLI_findptr(>layout_types, screen->id.name + 2, + offsetof(WorkSpaceLayoutType, name)); + + BLI_assert(layout_type); + BKE_libblock_free(bmain, screen); BLI_freelinkN(>layouts, layout); + BLI_freelinkN(>layout_types, layout_type); } @@ -246,6 +257,16 @@ ListBase *BKE_workspace_layouts_get(WorkSpace *workspace) return >layouts; } +ListBase *BKE_workspace_layout_types_get(WorkSpace *workspace) +{ + return >layout_types; +} + +const char *BKE_workspace_layout_type_name_get(WorkSpaceLayoutType *layout_type) +{ + return layout_type->name; +} + WorkSpace *BKE_workspace_next_get(const WorkSpace *workspace) { return workspace->id.next; diff --git a/source/blender/makesdna/dna_workspace_types.h b/source/blender/makesdna/dna_workspace_types.h index 956b0ef0b8..1eef392a13 100644 --- a/source/blender/makesdna/dna_workspace_types.h +++ b/source/blender/makesdna/dna_workspace_types.h @@ -46,9 +46,15 @@ typedef struct WorkSpaceLayout { struct bScreen *screen; } WorkSpaceLayout; +typedef struct WorkSpaceLayoutType { + struct WorkSpaceLayoutType *next, *prev; + const char *name; +} WorkSpaceLayoutType; + typedef struct WorkSpace { ID id; + ListBase layout_types; ListBase layouts; struct WorkSpaceLayout *act_layout; struct WorkSpaceLayout *new_layout; /* temporary when switching screens */ diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 9cda8c0883..9e0ee40233 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -710,6 +710,7 @@
[Bf-blender-cvs] [4c164487bc] master: Add "Gravitation" option to "Force" type force fields
Commit: 4c164487bc15854834577f2867623a83db75ed60 Author: Luca Rood Date: Thu Feb 23 19:00:03 2017 -0300 Branches: master https://developer.blender.org/rB4c164487bc15854834577f2867623a83db75ed60 Add "Gravitation" option to "Force" type force fields This adds an option to force fields of type "Force", which enables the simulation of gravitational behavior (dist^-2 falloff). Patch by @AndreasE Reviewers: #physics, LucaRood, mont29 Reviewed By: #physics, LucaRood, mont29 Tags: #physics Differential Revision: https://developer.blender.org/D2389 === M release/scripts/startup/bl_ui/properties_physics_common.py M source/blender/blenkernel/intern/effect.c M source/blender/makesdna/DNA_object_force.h M source/blender/makesrna/intern/rna_object_force.c === diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py index 277b59d187..4478c6a437 100644 --- a/release/scripts/startup/bl_ui/properties_physics_common.py +++ b/release/scripts/startup/bl_ui/properties_physics_common.py @@ -274,6 +274,8 @@ def basic_force_field_settings_ui(self, context, field): col.prop(field, "use_global_coords", text="Global") elif field.type == 'HARMONIC': col.prop(field, "use_multiple_springs") +if field.type == 'FORCE': +col.prop(field, "use_gravity_falloff", text="Gravitation") split = layout.split() diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index fe8f5ebdca..4eee24b378 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -848,6 +848,14 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected break; case PFIELD_FORCE: normalize_v3(force); + if (pd->flag & PFIELD_GRAVITATION){ /* Option: Multiply by 1/distance^2 */ + if (efd->distance < FLT_EPSILON){ + strength = 0.0f; + } + else { + strength *= powf(efd->distance, -2.0f); + } + } mul_v3_fl(force, strength * efd->falloff); break; case PFIELD_VORTEX: diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h index 59acefeffe..ed14c4b931 100644 --- a/source/blender/makesdna/DNA_object_force.h +++ b/source/blender/makesdna/DNA_object_force.h @@ -372,6 +372,7 @@ typedef struct SoftBody { #define PFIELD_DO_ROTATION (1<<15) #define PFIELD_GUIDE_PATH_WEIGHT (1<<16) /* apply curve weights */ #define PFIELD_SMOKE_DENSITY(1<<17)/* multiply smoke force by density */ +#define PFIELD_GRAVITATION (1<<18) /* used for (simple) force */ /* pd->falloff */ #define PFIELD_FALL_SPHERE 0 diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 1d89f7535c..514fca1b01 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -1275,7 +1275,7 @@ static void rna_def_field(BlenderRNA *brna) prop = RNA_def_property(srna, "falloff_power", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "f_power"); RNA_def_property_range(prop, 0.0f, 10.0f); - RNA_def_property_ui_text(prop, "Falloff Power", "Falloff power (real gravitational falloff = 2)"); + RNA_def_property_ui_text(prop, "Falloff Power", ""); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_NONE); @@ -1394,6 +1394,11 @@ static void rna_def_field(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_SMOKE_DENSITY); RNA_def_property_ui_text(prop, "Apply Density", "Adjust force strength based on smoke density"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); + prop = RNA_def_property(srna, "use_gravity_falloff", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GRAVITATION); + RNA_def_property_ui_text(prop, "Gravity Falloff", "Multiply force by 1/distance²"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); + /* Pointer */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [29859d0d5e] master: Fix some more minor issue with updated py doc generation.
Commit: 29859d0d5e6c0365fc86570fc235120314c6a9a4 Author: Bastien Montagne Date: Thu Feb 23 22:31:21 2017 +0100 Branches: master https://developer.blender.org/rB29859d0d5e6c0365fc86570fc235120314c6a9a4 Fix some more minor issue with updated py doc generation. === M doc/python_api/sphinx_doc_update.py === diff --git a/doc/python_api/sphinx_doc_update.py b/doc/python_api/sphinx_doc_update.py index 884ddeecff..561e58dec6 100755 --- a/doc/python_api/sphinx_doc_update.py +++ b/doc/python_api/sphinx_doc_update.py @@ -98,6 +98,7 @@ def main(): blenver = blenver_zip = "" api_name = "" +branch = "" is_release = False # I) Update local mirror using rsync. @@ -119,6 +120,7 @@ def main(): "is_release = bpy.app.version_cycle in {'rc', 'release'}\n" "branch = bpy.app.build_branch.split()[0].decode()\n" "f.write('%d\\n' % is_release)\n" +"f.write('%s\\n' % branch)\n" "f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n" "if is_release else '%s\\n' % branch)\n" "f.write('%d_%d%s_release' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n" @@ -127,7 +129,7 @@ def main(): "--python-expr", getver_script, "--", getver_file) subprocess.run(get_ver_cmd) with open(getver_file) as f: -is_release, blenver, blenver_zip = f.read().split("\n") +is_release, branch, blenver, blenver_zip = f.read().split("\n") is_release = bool(int(is_release)) os.remove(getver_file) @@ -166,7 +168,7 @@ def main(): with open(os.path.join(args.mirror_dir, "250PythonDoc/index.html"), 'w') as f: f.write("Redirecting...Redirecting..." % api_name) -else: +elif branch == "master": with open(os.path.join(args.mirror_dir, "blender_python_api/index.html"), 'w') as f: f.write("Redirecting...Redirecting..." % api_name) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [34c07c0d6d] blender2.8: Fix Py API doc generation - missing new context members definition.
Commit: 34c07c0d6d34e164e129787423f2f8085c2224c9 Author: Bastien Montagne Date: Thu Feb 23 22:27:49 2017 +0100 Branches: blender2.8 https://developer.blender.org/rB34c07c0d6d34e164e129787423f2f8085c2224c9 Fix Py API doc generation - missing new context members definition. === M doc/python_api/sphinx_doc_gen.py === diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 47bb323e57..0316b6cd23 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -1024,6 +1024,7 @@ context_type_map = { "brush": ("Brush", False), "camera": ("Camera", False), "cloth": ("ClothModifier", False), +"collection": ("LayerCollection", False), "collision": ("CollisionModifier", False), "curve": ("Curve", False), "dynamic_paint": ("DynamicPaintModifier", False), @@ -1055,6 +1056,7 @@ context_type_map = { "particle_system": ("ParticleSystem", False), "particle_system_editable": ("ParticleSystem", False), "pose_bone": ("PoseBone", False), +"render_layer": ("SceneLayer", False), "scene": ("Scene", False), "sculpt_object": ("Object", False), "selectable_bases": ("ObjectBase", True), ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [dec323659d] blender2.8: Merge branch 'master' into blender2.8
Commit: dec323659dfe953341f6edbfbeaa174153460079 Author: Bastien Montagne Date: Thu Feb 23 22:09:09 2017 +0100 Branches: blender2.8 https://developer.blender.org/rBdec323659dfe953341f6edbfbeaa174153460079 Merge branch 'master' into blender2.8 === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c067f1d0d4] master: Fix stupid mistake in previous commit for release builds of API doc.
Commit: c067f1d0d470ada577f2b722b543d814448ce550 Author: Bastien Montagne Date: Thu Feb 23 22:08:01 2017 +0100 Branches: master https://developer.blender.org/rBc067f1d0d470ada577f2b722b543d814448ce550 Fix stupid mistake in previous commit for release builds of API doc. === M doc/python_api/sphinx_doc_update.py === diff --git a/doc/python_api/sphinx_doc_update.py b/doc/python_api/sphinx_doc_update.py index c7717c4a80..884ddeecff 100755 --- a/doc/python_api/sphinx_doc_update.py +++ b/doc/python_api/sphinx_doc_update.py @@ -121,7 +121,7 @@ def main(): "f.write('%d\\n' % is_release)\n" "f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n" "if is_release else '%s\\n' % branch)\n" -"f.write('%d_%d%s_release\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n" +"f.write('%d_%d%s_release' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n" "if is_release else '%d_%d_%d' % bpy.app.version)\n") get_ver_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1", "--python-expr", getver_script, "--", getver_file) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c7ad27fc07] master: Update py API doc generation tools to comply to new name scheme on server.
Commit: c7ad27fc07d9aa7ff998c730af184c569995f61a Author: Bastien Montagne Date: Thu Feb 23 21:24:47 2017 +0100 Branches: master https://developer.blender.org/rBc7ad27fc07d9aa7ff998c730af184c569995f61a Update py API doc generation tools to comply to new name scheme on server. - for rc/release: /api/2.79c/, zip file named blender_python_reference_2.79c_release.zip - for dev: /api/master/, zip file named blender_python_reference_2_79_4.zip === M doc/python_api/sphinx_doc_gen.py M doc/python_api/sphinx_doc_update.py === diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index ec3131ca19..47bb323e57 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -427,9 +427,9 @@ if BLENDER_REVISION != "Unknown": BLENDER_VERSION_DOTS += " " + BLENDER_REVISION # '2.62.1 SHA1' BLENDER_VERSION_PATH = "_".join(blender_version_strings)# '2_62_1' -if bpy.app.version_cycle == "release": -BLENDER_VERSION_PATH = "%s%s_release" % ("_".join(blender_version_strings[:2]), - bpy.app.version_char) # '2_62_release' +if bpy.app.version_cycle in {"rc", "release"}: +# '2_62a_release' +BLENDER_VERSION_PATH = "%s%s_release" % ("_".join(blender_version_strings[:2]), bpy.app.version_char) # --DOWNLOADABLE FILES-- diff --git a/doc/python_api/sphinx_doc_update.py b/doc/python_api/sphinx_doc_update.py index 3d48c1145e..c7717c4a80 100755 --- a/doc/python_api/sphinx_doc_update.py +++ b/doc/python_api/sphinx_doc_update.py @@ -96,6 +96,10 @@ def main(): rsync_base = "rsync://%s@%s:%s" % (args.user, args.rsync_server, args.rsync_root) +blenver = blenver_zip = "" +api_name = "" +is_release = False + # I) Update local mirror using rsync. rsync_mirror_cmd = ("rsync", "--delete-after", "-avzz", rsync_base, args.mirror_dir) subprocess.run(rsync_mirror_cmd, env=dict(os.environ, RSYNC_PASSWORD=args.password)) @@ -108,19 +112,23 @@ def main(): subprocess.run(doc_gen_cmd) # III) Get Blender version info. -blenver = blenver_zip = "" getver_file = os.path.join(tmp_dir, "blendver.txt") getver_script = ("" "import sys, bpy\n" "with open(sys.argv[-1], 'w') as f:\n" +"is_release = bpy.app.version_cycle in {'rc', 'release'}\n" +"branch = bpy.app.build_branch.split()[0].decode()\n" +"f.write('%d\\n' % is_release)\n" +"f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n" +"if is_release else '%s\\n' % branch)\n" "f.write('%d_%d%s_release\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n" -"if bpy.app.version_cycle in {'rc', 'release'} else '%d_%d_%d\\n' % bpy.app.version)\n" -"f.write('%d_%d_%d' % bpy.app.version)\n") +"if is_release else '%d_%d_%d' % bpy.app.version)\n") get_ver_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1", "--python-expr", getver_script, "--", getver_file) subprocess.run(get_ver_cmd) with open(getver_file) as f: -blenver, blenver_zip = f.read().split("\n") +is_release, blenver, blenver_zip = f.read().split("\n") +is_release = bool(int(is_release)) os.remove(getver_file) # IV) Build doc. @@ -132,7 +140,7 @@ def main(): os.chdir(curr_dir) # V) Cleanup existing matching dir in server mirror (if any), and copy new doc. -api_name = "blender_python_api_%s" % blenver +api_name = blenver api_dir = os.path.join(args.mirror_dir, api_name) if os.path.exists(api_dir): shutil.rmtree(api_dir) @@ -150,19 +158,15 @@ def main(): os.rename(zip_path, os.path.join(api_dir, "%s.zip" % zip_name)) # VII) Create symlinks and html redirects. -#~ os.symlink(os.path.join(DEFAULT_SYMLINK_ROOT, api_name, "contents.html"), os.path.join(api_dir, "index.html")) os.symlink("./contents.html", os.path.join(api_dir, "index.html")) -if blenver.endswith("release"): -symlink = os.path.join(args.mirror_dir, "blender_python_api_current") +if is_release: +symlink = os.path.join(args.mirror_dir, "current") os.remove(symlink) os.symlink("./%s" % api_name, symlink) with open(os.path.join(args.mirror_dir, "250PythonDoc/index.html"), 'w') as f: f.write("Redirecting...Redirecting..." % api_name) else: -symlink = os.path.join(args.mirror_dir, "blender_python_api_master") -
[Bf-blender-cvs] [6a249bb000] master: Usual UI messages fixes...
Commit: 6a249bb00088811bd7bf39d5ce2ac76e100f1d5c Author: Bastien Montagne Date: Thu Feb 23 21:10:43 2017 +0100 Branches: master https://developer.blender.org/rB6a249bb00088811bd7bf39d5ce2ac76e100f1d5c Usual UI messages fixes... === M release/scripts/startup/bl_ui/space_sequencer.py M source/blender/makesrna/intern/rna_scene.c === diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 8ab5b4724b..23697c5e5e 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -683,7 +683,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel): row.label("") else: col.separator() -col.label(text="Two or more channels are needed below this strip.", icon="INFO") +col.label(text="Two or more channels are needed below this strip", icon="INFO") elif strip.type == 'TEXT': diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 8ee49045bc..121e4f56a6 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -411,7 +411,7 @@ EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = { /* interpolation */ {0, "", 0, N_("Interpolation"), "Standard transitions between keyframes"}, {GP_IPO_LINEAR, "LINEAR", ICON_IPO_LINEAR, "Linear", "Straight-line interpolation between A and B (i.e. no ease in/out)"}, - {GP_IPO_CURVEMAP, "CUSTOM", ICON_IPO_BEZIER, "Custom", "Custom interpolation defined using a curvemap"}, + {GP_IPO_CURVEMAP, "CUSTOM", ICON_IPO_BEZIER, "Custom", "Custom interpolation defined using a curve map"}, /* easing */ {0, "", 0, N_("Easing (by strength)"), "Predefined inertial transitions, useful for motion graphics (from least to most ''dramatic'')"}, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2e83814e18] blender2.8: OpenGl immediate mode: clip_draw.c and clip_graph_draw.c fixes
Commit: 2e83814e186f0d6746f0ce18123d6a5a67e07a64 Author: Luca Rood Date: Thu Feb 23 13:35:16 2017 -0300 Branches: blender2.8 https://developer.blender.org/rB2e83814e186f0d6746f0ce18123d6a5a67e07a64 OpenGl immediate mode: clip_draw.c and clip_graph_draw.c fixes Fixed little typo in clip_draw.c and special case assert in clip_graph_draw.c (track segments with single point). Part of T49043 === M source/blender/editors/space_clip/clip_draw.c M source/blender/editors/space_clip/clip_graph_draw.c M source/blender/editors/space_clip/clip_intern.h M source/blender/editors/space_clip/clip_utils.c === diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 670ed2f29e..6c1dc8c733 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -889,7 +889,7 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo float tilt_ctrl[2]; if (!outline) { - immUniformColor3fv((track->search_flag & SELECT) ? scol : col); + immUniformColor3fv((track->pat_flag & SELECT) ? scol : col); } /* pattern's corners sliding squares */ diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c index b373358b49..7afa2ae814 100644 --- a/source/blender/editors/space_clip/clip_graph_draw.c +++ b/source/blender/editors/space_clip/clip_graph_draw.c @@ -72,7 +72,7 @@ static void tracking_segment_point_cb(void *userdata, MovieTrackingTrack *UNUSED immVertex2f(data->pos, scene_framenr, val); } -static void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track, int coord) +static void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track, int coord, bool is_point) { TrackMotionCurveUserData *data = (TrackMotionCurveUserData *) userdata; float col[4] = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -90,8 +90,13 @@ static void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track, immUniformColor4fv(col); - /* Graph can be composed of smaller segments, if any marker is disabled */ - immBeginAtMost(GL_LINE_STRIP, track->markersnr); + if (is_point) { + immBeginAtMost(GL_POINTS, 1); + } + else { + /* Graph can be composed of smaller segments, if any marker is disabled */ + immBeginAtMost(GL_LINE_STRIP, track->markersnr); + } } static void tracking_segment_end_cb(void *UNUSED(userdata), int UNUSED(coord)) @@ -220,7 +225,7 @@ static void tracking_error_segment_point_cb(void *userdata, } } -static void tracking_error_segment_start_cb(void *userdata, MovieTrackingTrack *track, int coord) +static void tracking_error_segment_start_cb(void *userdata, MovieTrackingTrack *track, int coord, bool is_point) { if (coord == 1) { TrackErrorCurveUserData *data = (TrackErrorCurveUserData *) userdata; @@ -237,8 +242,13 @@ static void tracking_error_segment_start_cb(void *userdata, MovieTrackingTrack * immUniformColor4fv(col); - /* Graph can be composed of smaller segments, if any marker is disabled */ - immBeginAtMost(GL_LINE_STRIP, track->markersnr); + if (is_point) { /* This probably never happens here, but just in case... */ + immBeginAtMost(GL_POINTS, 1); + } + else { + /* Graph can be composed of smaller segments, if any marker is disabled */ + immBeginAtMost(GL_LINE_STRIP, track->markersnr); + } } } @@ -323,11 +333,12 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene) UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); UI_view2d_grid_free(grid); - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + if (clip) { + unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + glPointSize(3.0f); - if (clip) { if (sc->flag & SC_SHOW_GRAPH_TRACKS_MOTION) { draw_tracks_motion_curves(v2d, sc, pos); } @@ -339,9 +350,9 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene) if (sc->flag & SC_SHOW_GRAPH_FRAMES) { draw_frame_curves(sc, pos); } - } - immUnbindProgram(); + immUnbindProgram(); + } /* frame range */
[Bf-blender-cvs] [22570c0ab4] HMD_viewport: - Updated OpenHMD with fixes from their master (commit 2379647)
Commit: 22570c0ab4e81adb1a68c35a2b31a3a5f12541af Author: Joey Ferwerda Date: Thu Feb 23 20:04:56 2017 +0100 Branches: HMD_viewport https://developer.blender.org/rB22570c0ab4e81adb1a68c35a2b31a3a5f12541af - Updated OpenHMD with fixes from their master (commit 2379647) === M extern/openhmd/CMakeLists.txt M extern/openhmd/include/openhmd.h M extern/openhmd/src/drv_android/android.c M extern/openhmd/src/drv_dummy/dummy.c M extern/openhmd/src/drv_external/external.c M extern/openhmd/src/drv_oculus_rift/packet.c M extern/openhmd/src/drv_oculus_rift/rift.c M extern/openhmd/src/drv_oculus_rift/rift.h M extern/openhmd/src/fusion.c M extern/openhmd/src/omath.c M extern/openhmd/src/omath.h M extern/openhmd/src/openhmd.c M extern/openhmd/src/openhmdi.h M extern/openhmd/src/platform-posix.c M extern/openhmd/src/platform-win32.c M extern/openhmd/src/platform.h A extern/openhmd/src/queue.c A extern/openhmd/src/queue.h === diff --git a/extern/openhmd/CMakeLists.txt b/extern/openhmd/CMakeLists.txt index 7792c6fcdc..6dfef7a707 100644 --- a/extern/openhmd/CMakeLists.txt +++ b/extern/openhmd/CMakeLists.txt @@ -33,6 +33,7 @@ set(SRC src/omath.c src/platform-posix.c src/fusion.c + src/queue.c ) # TODO: Either remove this or move to main CMakeLists.txt diff --git a/extern/openhmd/include/openhmd.h b/extern/openhmd/include/openhmd.h index dafb806411..5468fb55b9 100644 --- a/extern/openhmd/include/openhmd.h +++ b/extern/openhmd/include/openhmd.h @@ -44,6 +44,7 @@ typedef enum { OHMD_S_UNKNOWN_ERROR = -1, OHMD_S_INVALID_PARAMETER = -2, OHMD_S_UNSUPPORTED = -3, + OHMD_S_INVALID_OPERATION = -4, /** OHMD_S_USER_RESERVED and below can be used for user purposes, such as errors within ohmd wrappers, etc. */ OHMD_S_USER_RESERVED = -16384, @@ -125,6 +126,14 @@ typedef enum { /** int[1] (get): Physical vertical resolution of the device screen. */ OHMD_SCREEN_VERTICAL_RESOLUTION = 1, + /** int[1] (get): Get number of events waiting in digital input event queue. */ + OHMD_BUTTON_EVENT_COUNT = 2, + /** int[1] (get): Get if the there was an overflow in the event queue causing events to be dropped. */ + OHMD_BUTTON_EVENT_OVERFLOW= 3, + /** int[1] (get): Get the number of physical digital input buttons on the device. */ + OHMD_BUTTON_COUNT = 4, + /** int[2] (get): Performs an event pop action. Format: [button_index, button_state], where button_state is either OHMD_BUTTON_DOWN or OHMD_BUTTON_UP */ + OHMD_BUTTON_POP_EVENT = 5, } ohmd_int_value; /** A collection of data information types used for setting information with ohmd_set_data(). */ @@ -146,6 +155,14 @@ typedef enum { OHMD_IDS_AUTOMATIC_UPDATE = 0, } ohmd_int_settings; +/** Button states for digital input events. */ +typedef enum { + /** Button was pressed. */ + OHMD_BUTTON_DOWN = 0, + /** Button was released. */ + OHMD_BUTTON_UP = 1 +} ohmd_button_state; + /** An opaque pointer to a context structure. */ typedef struct ohmd_context ohmd_context; diff --git a/extern/openhmd/src/drv_android/android.c b/extern/openhmd/src/drv_android/android.c index d021a21b89..9ba3e3fb76 100644 --- a/extern/openhmd/src/drv_android/android.c +++ b/extern/openhmd/src/drv_android/android.c @@ -191,8 +191,8 @@ static ohmd_device* open_device(ohmd_driver* driver, ohmd_device_desc* desc) priv->base.properties.vsize = 0.093600f; priv->base.properties.hres = 1280; priv->base.properties.vres = 800; - priv->base.properties.lens_sep = 0.063500; - priv->base.properties.lens_vpos = 0.046800; + priv->base.properties.lens_sep = 0.063500f; + priv->base.properties.lens_vpos = 0.046800f; priv->base.properties.fov = DEG_TO_RAD(125.5144f); priv->base.properties.ratio = (1280.0f / 800.0f) / 2.0f; diff --git a/extern/openhmd/src/drv_dummy/dummy.c b/extern/openhmd/src/drv_dummy/dummy.c index 2b5436ef62..9f9adf84d4 100644 --- a/extern/openhmd/src/drv_dummy/dummy.c +++ b/extern/openhmd/src/drv_dummy/dummy.c @@ -66,10 +66,11 @@ static ohmd_device* open_device(ohmd_driver* driver, ohmd_device_desc* desc) priv->base.properties.vsize = 0.093600f; priv->base.properties.hres = 1280; priv->base.properties.vres = 800; - priv->base.properties.lens_sep = 0.063500; - priv->base.properties.lens_vpos = 0.046800; + priv->base.properties.lens_sep = 0.063500f; + priv->base.properties.lens_vpos = 0.046800f; priv->base.properties.fov = DEG_TO_RAD(125.5144f); priv->base.properties.ratio = (1280.0f / 800.0f) /
[Bf-blender-cvs] [3e486c19ff] HMD_viewport: Merge branch 'HMD_viewport' of git.blender.org:blender into HMD_viewport
Commit: 3e486c1958c0944025bf7614a6adb3117e39 Author: Joey Ferwerda Date: Thu Feb 23 20:06:03 2017 +0100 Branches: HMD_viewport https://developer.blender.org/rB3e486c1958c0944025bf7614a6adb3117e39 Merge branch 'HMD_viewport' of git.blender.org:blender into HMD_viewport === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [441ca0202c] id_override_static: Merge branch 'master' into id_override_static
Commit: 441ca0202c5e30cfd7bbf9137a943f60c1e2e545 Author: Bastien Montagne Date: Thu Feb 23 19:41:36 2017 +0100 Branches: id_override_static https://developer.blender.org/rB441ca0202c5e30cfd7bbf9137a943f60c1e2e545 Merge branch 'master' into id_override_static === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [bc27652e57] blender-v2.78c-release: tests: Update hash for OBJ
Commit: bc27652e574a58755303442b4820620048d87615 Author: Sergey Sharybin Date: Wed Nov 2 15:35:18 2016 +0100 Branches: blender-v2.78c-release https://developer.blender.org/rBbc27652e574a58755303442b4820620048d87615 tests: Update hash for OBJ Was a recent update of UV precision. === M tests/python/CMakeLists.txt === diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt index d9731a5dfa..b76c47fcf2 100644 --- a/tests/python/CMakeLists.txt +++ b/tests/python/CMakeLists.txt @@ -135,7 +135,7 @@ add_test(export_obj_cube ${TEST_BLENDER_EXE} --run={'FINISHED'}_scene.obj\(filepath='${TEST_OUT_DIR}/export_obj_cube.obj',use_selection=False\) --md5_source=${TEST_OUT_DIR}/export_obj_cube.obj --md5_source=${TEST_OUT_DIR}/export_obj_cube.mtl - --md5=826f74e6b7a2128b0b61a52071ada36e --md5_method=FILE + --md5=e80660437ad9bfe082849641c361a233 --md5_method=FILE ) add_test(export_obj_nurbs ${TEST_BLENDER_EXE} ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/repos/bf-blender [61814] trunk/lib/tests/cycles/ctests/image/reference_renders: Cycles tests: Update half-float image limit tests
Revision: 61814 https://developer.blender.org/rBL61814 Author: sergey Date: 2017-02-23 17:59:48 +0100 (Thu, 23 Feb 2017) Log Message: --- Cycles tests: Update half-float image limit tests Modified Paths: -- trunk/lib/tests/cycles/ctests/image/reference_renders/image_texture_limit_half3.png trunk/lib/tests/cycles/ctests/image/reference_renders/image_texture_limit_half4.png Modified: trunk/lib/tests/cycles/ctests/image/reference_renders/image_texture_limit_half3.png === (Binary files differ) Modified: trunk/lib/tests/cycles/ctests/image/reference_renders/image_texture_limit_half4.png === (Binary files differ) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [27167ee3a4] blender-v2.78c-release: Cycles: Fix compilation error on 32bit Linux
Commit: 27167ee3a42b160f322418b40647b6053a15c978 Author: Sergey Sharybin Date: Thu Feb 23 17:30:26 2017 +0100 Branches: blender-v2.78c-release https://developer.blender.org/rB27167ee3a42b160f322418b40647b6053a15c978 Cycles: Fix compilation error on 32bit Linux === M intern/cycles/util/util_half.h === diff --git a/intern/cycles/util/util_half.h b/intern/cycles/util/util_half.h index 7285c6ef60..c1a47d58c5 100644 --- a/intern/cycles/util/util_half.h +++ b/intern/cycles/util/util_half.h @@ -18,6 +18,7 @@ #define __UTIL_HALF_H__ #include "util_types.h" +#include "util_math.h" #ifdef __KERNEL_SSE2__ #include "util_simd.h" ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [50328b41a7] master: Cycles: Fix compilation error on 32bit Linux
Commit: 50328b41a7dbadae330f4b2fdcfc023aef63f236 Author: Sergey Sharybin Date: Thu Feb 23 17:30:26 2017 +0100 Branches: master https://developer.blender.org/rB50328b41a7dbadae330f4b2fdcfc023aef63f236 Cycles: Fix compilation error on 32bit Linux === M intern/cycles/util/util_half.h === diff --git a/intern/cycles/util/util_half.h b/intern/cycles/util/util_half.h index 7285c6ef60..c1a47d58c5 100644 --- a/intern/cycles/util/util_half.h +++ b/intern/cycles/util/util_half.h @@ -18,6 +18,7 @@ #define __UTIL_HALF_H__ #include "util_types.h" +#include "util_math.h" #ifdef __KERNEL_SSE2__ #include "util_simd.h" ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [551265424b] blender-v2.78c-release: Fix T50243: libmv_panography_test is broken
Commit: 551265424b3b41bd87943215703715168d3212a2 Author: Sergey Sharybin Date: Wed Dec 14 10:44:57 2016 +0100 Branches: blender-v2.78c-release https://developer.blender.org/rB551265424b3b41bd87943215703715168d3212a2 Fix T50243: libmv_panography_test is broken There was fully wrong logic in comparison: was actually accessing memory past the array boundary. Run test manually and the figure seems correct to me now. Spotted by @LazyDodo, thanks! === M intern/libmv/libmv/multiview/panography_test.cc === diff --git a/intern/libmv/libmv/multiview/panography_test.cc b/intern/libmv/libmv/multiview/panography_test.cc index f6faf0f602..96d52acfc3 100644 --- a/intern/libmv/libmv/multiview/panography_test.cc +++ b/intern/libmv/libmv/multiview/panography_test.cc @@ -48,7 +48,7 @@ TEST(Panography, PrintSomeSharedFocalEstimationValues) { // Assert we found a valid solution. EXPECT_EQ(1, fs.size()); - EXPECT_NEAR(1.01667, fs[1], 1e-3); + EXPECT_NEAR(3.47194, fs[0], 1e-3); } TEST(Panography, GetR_FixedCameraCenterWithIdentity) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5793441a35] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration
Commit: 5793441a3532ddce477788fd0870f72e8f415098 Author: Aurel Gruber Date: Tue Nov 15 13:25:10 2016 +0100 Branches: uv_unwrapping_slim_algorithm https://developer.blender.org/rB5793441a3532ddce477788fd0870f72e8f415098 Category: UV Unwrapping SLIM Algorithm Integration added subfolder SLIM to CMakeFile of /intern === M intern/CMakeLists.txt === diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt index dd9889c81b..090966f3b3 100644 --- a/intern/CMakeLists.txt +++ b/intern/CMakeLists.txt @@ -92,3 +92,5 @@ endif() if(WITH_OPENVDB) add_subdirectory(openvdb) endif() + +add_subdirectory(SLIM) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9f7c4aa581] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration
Commit: 9f7c4aa581eaf42aa60db9941143c8ffceb47498 Author: Aurel Gruber Date: Thu Jan 26 10:06:38 2017 +0100 Branches: uv_unwrapping_slim_algorithm https://developer.blender.org/rB9f7c4aa581eaf42aa60db9941143c8ffceb47498 Category: UV Unwrapping SLIM Algorithm Integration fixing bug that causes weight-per-vertex mapping to be wrong === M intern/SLIM M source/blender/editors/uvedit/uvedit_parametrizer.c M source/blender/editors/uvedit/uvedit_parametrizer.h M source/blender/editors/uvedit/uvedit_unwrap_ops.c === diff --git a/intern/SLIM b/intern/SLIM index 7da79fe62d..fdce9c05a4 16 --- a/intern/SLIM +++ b/intern/SLIM @@ -1 +1 @@ -Subproject commit 7da79fe62d79adc1189fee09a96ecf592b92284a +Subproject commit fdce9c05a458dc7109f11c52b67f1f2f5f734f47 diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index cc4511606e..ea8bf4df4a 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -246,8 +246,8 @@ typedef struct PHandle { matrix_transfer *mt; int n_iterations; + int slim_global_method; bool skip_initialization; - bool fixed_boundary; bool pack_islands; bool with_weighted_parameterization; MDeformVert *weightMapData; @@ -4348,7 +4348,7 @@ void param_construct_end(ParamHandle *handle, ParamBool fill, ParamBool impl) } void add_index_to_vertices(BMEditMesh *em){ - + // AUREL THESIS iterate over bm edit mesh and set indices for weight retrieval, // This allows for later matching of vertices to weights. BMVert *vert; @@ -4372,7 +4372,6 @@ void param_slim_enrich_handle(Object *obedit, int weightMapIndex, int n_iterations, bool skip_initialization, - bool fixed_boundary, bool pack_islands, bool with_weighted_parameterization){ @@ -4381,7 +4380,6 @@ void param_slim_enrich_handle(Object *obedit, phandle->mt = mt; phandle->n_iterations = n_iterations; phandle->skip_initialization = skip_initialization; - phandle->fixed_boundary = fixed_boundary; phandle->pack_islands = pack_islands; phandle->with_weighted_parameterization = with_weighted_parameterization; phandle->weightMapData = dvert; @@ -4420,7 +4418,7 @@ void param_slim_begin(ParamHandle *handle) { void param_slim_solve(ParamHandle *handle) { PHandle *phandle = (PHandle *) handle; matrix_transfer *mt = phandle->mt; - param_slim_C(mt, phandle->n_iterations, phandle->fixed_boundary, phandle->skip_initialization); + param_slim_C(mt, phandle->n_iterations, mt->fixed_boundary, phandle->skip_initialization); } void param_slim_end(ParamHandle *handle) { @@ -5011,13 +5009,14 @@ void transfer_vertices(const int chartNr, const PHandle *phandle, matrix_transfe for (v = chart->verts; v; v = v->nextlink){ if (!v->on_boundary_flag){ - v->slimId = vid; - + // set v->slim_id to vid ONLY AFTER assigning weight! if (mt->with_weighted_parameterization){ weight = tempW[v->slimId]; - W[v->slimId] = weight; + W[vid] = weight; } + v->slimId = vid; + vid++; } @@ -5076,16 +5075,17 @@ void transfer_boundary_vertices(const int chartNr, const PHandle *phandle, const PEdge *be = outer; do{ - mt->nBoundaryVertices[chartNr] += 1; - be->vert->slimId = vid; - be->vert->on_boundary_flag = true; - B[vid] = vid; - + // set be->vert->slim_id to vid ONLY AFTER assigning weight! if (mt->with_weighted_parameterization){ weight = tempW[be->vert->slimId]; W[vid] = weight; } + mt->nBoundaryVertices[chartNr] += 1; + be->vert->slimId = vid; + be->vert->on_boundary_flag = true; + B[vid] = vid; + vid += 1; be = p_boundary_edge_next(be); diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h b/source/blender/editors/uvedit/uvedit_parametrizer.h index e939a3660a..bb5b9e16f4 100644 ---
[Bf-blender-cvs] [08d1b312be] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration
Commit: 08d1b312be5e06400672a2bc4b5fe7eed3600be2 Author: Aurel Gruber Date: Fri Nov 18 12:54:50 2016 +0100 Branches: uv_unwrapping_slim_algorithm https://developer.blender.org/rB08d1b312be5e06400672a2bc4b5fe7eed3600be2 Category: UV Unwrapping SLIM Algorithm Integration integrating SLIM including data gathering and transfer from Blender to SLIM This commit is huge, because I copied over the code from a different repository. Not commit-by-commit. The Algorithm can be invoked either by choosing SLIM from the dropdown in the unwrapping settings or by hitting ctrl. + m in the uv editor for relaxation. Tried adding it to the menu the same way as minimizing stretch is there but failed. === M intern/SLIM M source/blender/bmesh/bmesh_class.h M source/blender/editors/uvedit/CMakeLists.txt M source/blender/editors/uvedit/uvedit_intern.h M source/blender/editors/uvedit/uvedit_ops.c M source/blender/editors/uvedit/uvedit_parametrizer.c M source/blender/editors/uvedit/uvedit_parametrizer.h M source/blender/editors/uvedit/uvedit_unwrap_ops.c M source/blender/makesdna/DNA_scene_types.h === diff --git a/intern/SLIM b/intern/SLIM index fa4b84c7dd..e897ae04d5 16 --- a/intern/SLIM +++ b/intern/SLIM @@ -1 +1 @@ -Subproject commit fa4b84c7dd2aac4502887999f6b4ee9c524adedf +Subproject commit e897ae04d52607970344a601fc85c1329f2314ed diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h index 104df625ee..49077b19be 100644 --- a/source/blender/bmesh/bmesh_class.h +++ b/source/blender/bmesh/bmesh_class.h @@ -99,6 +99,8 @@ typedef struct BMVert { * which is a bit of an abuse of internal bmesh data but also works OK for now (use with care!). */ struct BMEdge *e; + /* AUREL */ + int id; } BMVert; typedef struct BMVert_OFlag { diff --git a/source/blender/editors/uvedit/CMakeLists.txt b/source/blender/editors/uvedit/CMakeLists.txt index 543ef0e066..a7e2da0508 100644 --- a/source/blender/editors/uvedit/CMakeLists.txt +++ b/source/blender/editors/uvedit/CMakeLists.txt @@ -31,6 +31,8 @@ set(INC ../../../../intern/guardedalloc ../../../../intern/eigen ../../../../intern/glew-mx + + ../../../../intern/SLIM/src ) set(INC_SYS @@ -56,3 +58,4 @@ endif() add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_uvedit "${SRC}" "${INC}" "${INC_SYS}") +target_link_libraries(bf_editor_uvedit bf_intern_slim) diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h index e028c08091..e8dbb337cf 100644 --- a/source/blender/editors/uvedit/uvedit_intern.h +++ b/source/blender/editors/uvedit/uvedit_intern.h @@ -75,6 +75,8 @@ void UV_OT_cube_project(struct wmOperatorType *ot); void UV_OT_cylinder_project(struct wmOperatorType *ot); void UV_OT_project_from_view(struct wmOperatorType *ot); void UV_OT_minimize_stretch(struct wmOperatorType *ot); +// AUREL SLIM interactive parameterization +void UV_OT_minimize_stretch_slim(struct wmOperatorType *ot); void UV_OT_pack_islands(struct wmOperatorType *ot); void UV_OT_reset(struct wmOperatorType *ot); void UV_OT_sphere_project(struct wmOperatorType *ot); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 193b006cf0..6cdce37ab0 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -4265,6 +4265,8 @@ void ED_operatortypes_uvedit(void) WM_operatortype_append(UV_OT_cylinder_project); WM_operatortype_append(UV_OT_project_from_view); WM_operatortype_append(UV_OT_minimize_stretch); + // AUREL SLIM Interactive Parameterization + WM_operatortype_append(UV_OT_minimize_stretch_slim); WM_operatortype_append(UV_OT_pack_islands); WM_operatortype_append(UV_OT_reset); WM_operatortype_append(UV_OT_sphere_project); @@ -4341,6 +4343,8 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf) /* unwrap */ WM_keymap_add_item(keymap, "UV_OT_unwrap", EKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "UV_OT_minimize_stretch", VKEY, KM_PRESS, KM_CTRL, 0); + // AUREL SLIM Interactive Parameterization + WM_keymap_add_item(keymap, "UV_OT_minimize_stretch_slim", MKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "UV_OT_pack_islands", PKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "UV_OT_average_islands_scale", AKEY, KM_PRESS, KM_CTRL, 0); diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index bdfff123aa..759af69fd3 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -35,6 +35,9 @@ #include
[Bf-blender-cvs] [15785145b1] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration
Commit: 15785145b163d18136dfe3178709b5fabfcc4ea8 Author: Aurel Gruber Date: Thu Feb 23 13:22:30 2017 +0100 Branches: uv_unwrapping_slim_algorithm https://developer.blender.org/rB15785145b163d18136dfe3178709b5fabfcc4ea8 Category: UV Unwrapping SLIM Algorithm Integration correcting wrong comment on SLIM phases === M intern/SLIM M source/blender/editors/uvedit/uvedit_parametrizer.h === diff --git a/intern/SLIM b/intern/SLIM index cffc347ba2..8bdd2ea2de 16 --- a/intern/SLIM +++ b/intern/SLIM @@ -1 +1 @@ -Subproject commit cffc347ba26c31b04f9080916b99b1e603d4ee5c +Subproject commit 8bdd2ea2ded2dffa5b02ba51cd00e46af19af87d diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h b/source/blender/editors/uvedit/uvedit_parametrizer.h index 8dcaf952ed..abfc4a0162 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.h +++ b/source/blender/editors/uvedit/uvedit_parametrizer.h @@ -112,16 +112,12 @@ void param_begin(ParamHandle *handle, ParamBool abf, bool useSlim); void param_solve(ParamHandle *handle, bool useSlim); void param_end(ParamHandle *handle, bool useSlim); -/* Least Squares Conformal Maps: +/* SLIM: * - - * - charts with less than two pinned vertices are assigned 2 pins - * - lscm is divided in three steps: - * - begin: compute matrix and it's factorization (expensive) - * - solve using pinned coordinates (cheap) + * - begin: Data is gathered into matrices and transferred to SLIM + * - solve: compute cheap initialization (if necessary) and refine iteratively * - end: clean up - * - uv coordinates are allowed to change within begin/end, for - * quick re-solving - */ +*/ void param_slim_begin(ParamHandle *handle); void param_slim_solve(ParamHandle *handle); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [7e2e77714c] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration
Commit: 7e2e77714c050de0c25932046396b6254b3c92ad Author: Aurel Gruber Date: Thu Feb 23 16:26:08 2017 +0100 Branches: uv_unwrapping_slim_algorithm https://developer.blender.org/rB7e2e77714c050de0c25932046396b6254b3c92ad Category: UV Unwrapping SLIM Algorithm Integration Adding SLIM code by means of git read-tree === D intern/SLIM A intern/SLIM/.gitignore A intern/SLIM/CMakeLists.txt A intern/SLIM/LICENSE A intern/SLIM/ext/libigl_extract/EPS.cpp A intern/SLIM/ext/libigl_extract/EPS.h A intern/SLIM/ext/libigl_extract/IndexComparison.h A intern/SLIM/ext/libigl_extract/cat.cpp A intern/SLIM/ext/libigl_extract/cat.h A intern/SLIM/ext/libigl_extract/colon.cpp A intern/SLIM/ext/libigl_extract/colon.h A intern/SLIM/ext/libigl_extract/cotmatrix.cpp A intern/SLIM/ext/libigl_extract/cotmatrix.h A intern/SLIM/ext/libigl_extract/cotmatrix_entries.cpp A intern/SLIM/ext/libigl_extract/cotmatrix_entries.h A intern/SLIM/ext/libigl_extract/dihedral_angles.cpp A intern/SLIM/ext/libigl_extract/dihedral_angles.h A intern/SLIM/ext/libigl_extract/doublearea.cpp A intern/SLIM/ext/libigl_extract/doublearea.h A intern/SLIM/ext/libigl_extract/edge_lengths.cpp A intern/SLIM/ext/libigl_extract/edge_lengths.h A intern/SLIM/ext/libigl_extract/face_areas.cpp A intern/SLIM/ext/libigl_extract/face_areas.h A intern/SLIM/ext/libigl_extract/find.cpp A intern/SLIM/ext/libigl_extract/find.h A intern/SLIM/ext/libigl_extract/flip_avoiding_line_search.cpp A intern/SLIM/ext/libigl_extract/flip_avoiding_line_search.h A intern/SLIM/ext/libigl_extract/grad.cpp A intern/SLIM/ext/libigl_extract/grad.h A intern/SLIM/ext/libigl_extract/igl/Timer.h A intern/SLIM/ext/libigl_extract/igl/harmonic.cpp A intern/SLIM/ext/libigl_extract/igl/harmonic.h A intern/SLIM/ext/libigl_extract/igl/map_vertices_to_circle.cpp A intern/SLIM/ext/libigl_extract/igl/map_vertices_to_circle.h A intern/SLIM/ext/libigl_extract/igl_inline.h A intern/SLIM/ext/libigl_extract/invert_diag.cpp A intern/SLIM/ext/libigl_extract/invert_diag.h A intern/SLIM/ext/libigl_extract/is_symmetric.cpp A intern/SLIM/ext/libigl_extract/is_symmetric.h A intern/SLIM/ext/libigl_extract/isdiag.cpp A intern/SLIM/ext/libigl_extract/isdiag.h A intern/SLIM/ext/libigl_extract/line_search.cpp A intern/SLIM/ext/libigl_extract/line_search.h A intern/SLIM/ext/libigl_extract/local_basis.cpp A intern/SLIM/ext/libigl_extract/local_basis.h A intern/SLIM/ext/libigl_extract/massmatrix.cpp A intern/SLIM/ext/libigl_extract/massmatrix.h A intern/SLIM/ext/libigl_extract/min_quad_with_fixed.cpp A intern/SLIM/ext/libigl_extract/min_quad_with_fixed.h A intern/SLIM/ext/libigl_extract/normalize_row_sums.cpp A intern/SLIM/ext/libigl_extract/normalize_row_sums.h A intern/SLIM/ext/libigl_extract/parallel_for.cpp A intern/SLIM/ext/libigl_extract/parallel_for.h A intern/SLIM/ext/libigl_extract/per_face_normals.cpp A intern/SLIM/ext/libigl_extract/per_face_normals.h A intern/SLIM/ext/libigl_extract/polar_svd.cpp A intern/SLIM/ext/libigl_extract/polar_svd.h A intern/SLIM/ext/libigl_extract/reorder.cpp A intern/SLIM/ext/libigl_extract/reorder.h A intern/SLIM/ext/libigl_extract/repmat.cpp A intern/SLIM/ext/libigl_extract/repmat.h A intern/SLIM/ext/libigl_extract/slice.cpp A intern/SLIM/ext/libigl_extract/slice.h A intern/SLIM/ext/libigl_extract/sort.cpp A intern/SLIM/ext/libigl_extract/sort.h A intern/SLIM/ext/libigl_extract/sparse.cpp A intern/SLIM/ext/libigl_extract/sparse.h A intern/SLIM/ext/libigl_extract/squared_edge_lengths.cpp A intern/SLIM/ext/libigl_extract/squared_edge_lengths.h A intern/SLIM/ext/libigl_extract/verbose.h A intern/SLIM/ext/libigl_extract/volume.cpp A intern/SLIM/ext/libigl_extract/volume.h A intern/SLIM/src/Slim.cpp A intern/SLIM/src/Slim.h A intern/SLIM/src/UVInitializer.cpp A intern/SLIM/src/UVInitializer.h A intern/SLIM/src/area_compensation.cpp A intern/SLIM/src/area_compensation.h A intern/SLIM/src/geometry_data_retrieval.cpp A intern/SLIM/src/geometry_data_retrieval.h A intern/SLIM/src/least_squares_relocator.cpp A intern/SLIM/src/least_squares_relocator.h A intern/SLIM/src/matrix_transfer.h A intern/SLIM/src/slim_C_interface.cpp A intern/SLIM/src/slim_C_interface.h A intern/SLIM/src/slim_parametrizer.cpp A intern/SLIM/src/slim_parametrizer.h M release/datafiles/locale M release/scripts/addons M release/scripts/addons_contrib M source/tools
[Bf-blender-cvs] [2bf059ad3b] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration
Commit: 2bf059ad3ba57aa300af6c5b5ab5c017efa980c8 Author: Aurel Gruber Date: Sat Feb 4 14:42:19 2017 +0100 Branches: uv_unwrapping_slim_algorithm https://developer.blender.org/rB2bf059ad3ba57aa300af6c5b5ab5c017efa980c8 Category: UV Unwrapping SLIM Algorithm Integration slim interactive exec now only for changing parameters === M intern/SLIM M source/blender/editors/uvedit/uvedit_unwrap_ops.c === diff --git a/intern/SLIM b/intern/SLIM index 94ed5ce815..8c6ee9dbdc 16 --- a/intern/SLIM +++ b/intern/SLIM @@ -1 +1 @@ -Subproject commit 94ed5ce815517fc0c1215411ef2404686d80e1a0 +Subproject commit 8c6ee9dbdc60a9e2c3543eec38e71f9ca4fcd971 diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 247c43c4c5..5920ecfecd 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -903,21 +903,10 @@ static void minimize_stretch_SLIM_exit(bContext *C, wmOperator *op, bool cancel) } /* AUREL THESIS - NON-interactive version of interactive parametrisation. Every modal operator of blender has this mode. - In this case, it's obviously never used, since the "normal" non-interactive unwrapping method is to be preferred. + Used Only to adjust parameters. */ static int minimize_stretch_SLIM_exec(bContext *C, wmOperator *op) { - int n_iterations = 1; - - if (!minimize_stretch_SLIM_init(C, op)) - return OPERATOR_CANCELLED; - - MinStretchSlim *mss = op->customdata; - - param_slim_C(mss->mt, n_iterations, true, true); - - minimize_stretch_SLIM_exit(C, op, false); return OPERATOR_FINISHED; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [1f88850826] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration
Commit: 1f8885082654bc7ffaeefca03ee2f72de752a0e7 Author: Aurel Gruber Date: Tue Jan 31 12:49:17 2017 +0100 Branches: uv_unwrapping_slim_algorithm https://developer.blender.org/rB1f8885082654bc7ffaeefca03ee2f72de752a0e7 Category: UV Unwrapping SLIM Algorithm Integration adjustments to the UI parameters === M intern/SLIM M source/blender/editors/uvedit/uvedit_unwrap_ops.c M source/blender/makesdna/DNA_scene_types.h === diff --git a/intern/SLIM b/intern/SLIM index fdce9c05a4..94ed5ce815 16 --- a/intern/SLIM +++ b/intern/SLIM @@ -1 +1 @@ -Subproject commit fdce9c05a458dc7109f11c52b67f1f2f5f734f47 +Subproject commit 94ed5ce815517fc0c1215411ef2404686d80e1a0 diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 6dd754c96d..a19336643e 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -768,7 +768,7 @@ void UV_OT_minimize_stretch(wmOperatorType *ot) /* AUREL THESIS Minimize Stretch SLIM operator */ -/* AUREL THESIS +/* AUREL GRUBER Holds all necessary state for one session of interactive parametrisation. */ typedef struct { @@ -810,6 +810,11 @@ static bool minimize_stretch_SLIM_init(bContext *C, wmOperator *op) mss->fixBorder = true; mss->mt->fixed_boundary = true; + scene->toolsettings->slim_skip_initialization = true; + scene->toolsettings->slim_pack_islands = false; + scene->toolsettings->slim_fixed_boundary = true; + + enrich_handle_slim(scene, obedit, em, handle, mss->mt); param_slim_begin(handle); @@ -1456,6 +1461,9 @@ void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel) const bool fill_holes = (scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES) != 0; const bool correct_aspect = (scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT) == 0; + scene->toolsettings->slim_skip_initialization = false; + scene->toolsettings->slim_pack_islands = true; + scene->toolsettings->slim_fixed_boundary = false; bool use_subsurf; bool use_slim_method = (scene->toolsettings->unwrapper == 2); @@ -1497,9 +1505,7 @@ static int unwrap_exec(bContext *C, wmOperator *op) int method = RNA_enum_get(op->ptr, "method"); int n_slim_iterations = RNA_int_get(op->ptr, "slim_iterations"); - bool slim_pack_islands = RNA_int_get(op->ptr, "slim_pack_islands"); - bool slim_skip_initialization = RNA_int_get(op->ptr, "slim_skip_initialization"); - bool slim_fixed_boundary = RNA_int_get(op->ptr, "slim_fixed_boundary"); + double slim_weight_influence = RNA_float_get(op->ptr, "slim_weight_influence"); const bool fill_holes = RNA_boolean_get(op->ptr, "fill_holes"); const bool correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect"); @@ -1531,12 +1537,9 @@ static int unwrap_exec(bContext *C, wmOperator *op) else RNA_enum_set(op->ptr, "method", scene->toolsettings->unwrapper); - /* get number of iterations and methood in global phase for SLIM unwraping*/ + /* get number of iterations and method in global phase for SLIM unwraping*/ scene->toolsettings->slim_n_iterations = n_slim_iterations; - scene->toolsettings->slim_fixed_boundary = slim_fixed_boundary; - scene->toolsettings->slim_pack_islands = slim_pack_islands; - scene->toolsettings->slim_skip_initialization = slim_skip_initialization; - + scene->toolsettings->slim_weight_influence = slim_weight_influence; /* remember packing marging */ if (RNA_struct_property_is_set(op->ptr, "margin")) @@ -1600,12 +1603,8 @@ void UV_OT_unwrap(wmOperatorType *ot) RNA_def_int(ot->srna, "slim_iterations", 1, 0, 1, "SLIM Iterations", "Number of Iterations if the SLIM algorithm is used.", 1, 30); - RNA_def_boolean(ot->srna, "slim_skip_initialization", 0, "SLIM Skip Initialization", - "Use existing map as initialization for SLIM (May not contain flips!)."); - RNA_def_boolean(ot->srna, "slim_fixed_boundary", 0, "SLIM Fix Boundary", - "When using SLIM and skipping initialization, this pins the boundary vertices to stay in place."); - RNA_def_boolean(ot->srna, "slim_pack_islands", 1, "SLIM Pack Islands", - "When using SLIM, this skips the packing of islands afterwards."); + RNA_def_float(ot->srna, "slim_weight_influence", 1.0, -1.0, 1.0, "SLIM Weight Map Influence", + "How much influence the weightmap has for weighted parameterization, 0 being no
[Bf-blender-cvs] [979b1b1159] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration
Commit: 979b1b1159ef78a286f79adaee5ca665e9a9f5e9 Author: Aurel Gruber Date: Tue Nov 15 13:20:40 2016 +0100 Branches: uv_unwrapping_slim_algorithm https://developer.blender.org/rB979b1b1159ef78a286f79adaee5ca665e9a9f5e9 Category: UV Unwrapping SLIM Algorithm Integration Added SLIM Subfolder === M .gitmodules A intern/SLIM === diff --git a/.gitmodules b/.gitmodules index 0b8228e3f1..8abcc4584f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,4 +13,4 @@ [submodule "source/tools"] path = source/tools url = ../blender-dev-tools.git - ignore = all + ignore = all \ No newline at end of file diff --git a/intern/SLIM b/intern/SLIM new file mode 16 index 00..fa4b84c7dd --- /dev/null +++ b/intern/SLIM @@ -0,0 +1 @@ +Subproject commit fa4b84c7dd2aac4502887999f6b4ee9c524adedf ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [3e184a57c5] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration
Commit: 3e184a57c5372fff6cd3415a56b394e993911907 Author: Aurel Gruber Date: Mon Jan 23 13:51:17 2017 +0100 Branches: uv_unwrapping_slim_algorithm https://developer.blender.org/rB3e184a57c5372fff6cd3415a56b394e993911907 Category: UV Unwrapping SLIM Algorithm Integration adding more members to phandle and creating param_begin === M intern/SLIM M source/blender/editors/uvedit/uvedit_parametrizer.c M source/blender/editors/uvedit/uvedit_parametrizer.h M source/blender/editors/uvedit/uvedit_unwrap_ops.c === diff --git a/intern/SLIM b/intern/SLIM index 62a96ad0e8..7da79fe62d 16 --- a/intern/SLIM +++ b/intern/SLIM @@ -1 +1 @@ -Subproject commit 62a96ad0e853e1008bd971272e5f79231cd4308c +Subproject commit 7da79fe62d79adc1189fee09a96ecf592b92284a diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 0e3d343401..cc4511606e 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -241,6 +241,19 @@ typedef struct PHandle { RNG *rng; float blend; char do_aspect; + + // SLIM + + matrix_transfer *mt; + int n_iterations; + bool skip_initialization; + bool fixed_boundary; + bool pack_islands; + bool with_weighted_parameterization; + MDeformVert *weightMapData; + int weightMapIndex; + BMesh *bm; + } PHandle; /* PHash @@ -4334,6 +4347,89 @@ void param_construct_end(ParamHandle *handle, ParamBool fill, ParamBool impl) phandle->state = PHANDLE_STATE_CONSTRUCTED; } +void add_index_to_vertices(BMEditMesh *em){ + + // AUREL THESIS iterate over bm edit mesh and set indices for weight retrieval, + // This allows for later matching of vertices to weights. + BMVert *vert; + BMIter iter; + int i; + BM_ITER_MESH_INDEX(vert, , em->bm, BM_VERTS_OF_MESH, i){ + vert->id = i; + } +} + +int retrieve_weightmap_index(Object *obedit){ + char *name = "slim"; + return defgroup_name_index(obedit, name); +} + +void param_slim_enrich_handle(Object *obedit, + BMEditMesh *em, + ParamHandle *handle, + matrix_transfer *mt, + MDeformVert *dvert, + int weightMapIndex, + int n_iterations, + bool skip_initialization, + bool fixed_boundary, + bool pack_islands, + bool with_weighted_parameterization){ + + PHandle *phandle = (PHandle *)handle; + + phandle->mt = mt; + phandle->n_iterations = n_iterations; + phandle->skip_initialization = skip_initialization; + phandle->fixed_boundary = fixed_boundary; + phandle->pack_islands = pack_islands; + phandle->with_weighted_parameterization = with_weighted_parameterization; + phandle->weightMapData = dvert; + phandle->weightMapIndex = weightMapIndex; + phandle->bm = em->bm; +} + +void param_begin(ParamHandle *handle, ParamBool abf, bool use_slim) { + if (use_slim){ + param_slim_begin(handle); + } else { + param_lscm_begin(handle, PARAM_FALSE, abf); + } +} + +void param_solve(ParamHandle *handle, bool use_slim) { + if (use_slim){ + param_slim_solve(handle); + } else { + param_lscm_solve(handle); + } +} + +void param_end(ParamHandle *handle, bool use_slim) { + if (use_slim){ + param_slim_end(handle); + } else { + param_lscm_end(handle); + } +} + +void param_slim_begin(ParamHandle *handle) { + transfer_data_to_slim(handle); +} + +void param_slim_solve(ParamHandle *handle) { + PHandle *phandle = (PHandle *) handle; + matrix_transfer *mt = phandle->mt; + param_slim_C(mt, phandle->n_iterations, phandle->fixed_boundary, phandle->skip_initialization); +} + +void param_slim_end(ParamHandle *handle) { + PHandle *phandle = (PHandle *) handle; + matrix_transfer *mt = phandle->mt; + set_uv_param_slim(handle, mt); +} + + void param_lscm_begin(ParamHandle *handle, ParamBool live, ParamBool abf) { PHandle *phandle = (PHandle *)handle; @@ -4716,18 +4812,34 @@ void param_flush_restore(ParamHandle *handle) /* AUREL THESIS In the
[Bf-blender-cvs] [b6ab20876b] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration
Commit: b6ab20876b08bb8e6f85253f6c569a3e5630c5ce Author: Aurel Gruber Date: Thu Jan 19 16:03:34 2017 +0100 Branches: uv_unwrapping_slim_algorithm https://developer.blender.org/rBb6ab20876b08bb8e6f85253f6c569a3e5630c5ce Category: UV Unwrapping SLIM Algorithm Integration preserving vertex ids and gathering weights === M intern/SLIM M source/blender/editors/uvedit/uvedit_parametrizer.c M source/blender/editors/uvedit/uvedit_parametrizer.h M source/blender/editors/uvedit/uvedit_unwrap_ops.c === diff --git a/intern/SLIM b/intern/SLIM index e897ae04d5..62a96ad0e8 16 --- a/intern/SLIM +++ b/intern/SLIM @@ -1 +1 @@ -Subproject commit e897ae04d52607970344a601fc85c1329f2314ed +Subproject commit 62a96ad0e853e1008bd971272e5f79231cd4308c diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 759af69fd3..0e3d343401 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -744,7 +744,7 @@ static void p_face_restore_uvs(PFace *f) /* Construction (use only during construction, relies on u.key being set */ -static PVert *p_vert_add(PHandle *handle, PHashKey key, const float co[3], PEdge *e) +static PVert *p_vert_add(PHandle *handle, PHashKey key, const float co[3], float id, PEdge *e) { PVert *v = (PVert *)BLI_memarena_alloc(handle->arena, sizeof(*v)); copy_v3_v3(v->co, co); @@ -761,20 +761,21 @@ static PVert *p_vert_add(PHandle *handle, PHashKey key, const float co[3], PEdge v->u.key = key; v->edge = e; v->flag = 0; + v->slimId = id; phash_insert(handle->hash_verts, (PHashLink *)v); return v; } -static PVert *p_vert_lookup(PHandle *handle, PHashKey key, const float co[3], PEdge *e) +static PVert *p_vert_lookup(PHandle *handle, PHashKey key, const float co[3], float id, PEdge *e) { PVert *v = (PVert *)phash_lookup(handle->hash_verts, key); if (v) return v; else - return p_vert_add(handle, key, co, e); + return p_vert_add(handle, key, co, id, e); } static PVert *p_vert_copy(PChart *chart, PVert *v) @@ -1115,15 +1116,15 @@ static PFace *p_face_add(PHandle *handle) } static PFace *p_face_add_construct(PHandle *handle, ParamKey key, ParamKey *vkeys, - float *co[4], float *uv[4], int i1, int i2, int i3, + float *co[4], float *uv[4], float id[4], int i1, int i2, int i3, ParamBool *pin, ParamBool *select) { PFace *f = p_face_add(handle); PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next; - e1->vert = p_vert_lookup(handle, vkeys[i1], co[i1], e1); - e2->vert = p_vert_lookup(handle, vkeys[i2], co[i2], e2); - e3->vert = p_vert_lookup(handle, vkeys[i3], co[i3], e3); + e1->vert = p_vert_lookup(handle, vkeys[i1], co[i1], id[i1], e1); + e2->vert = p_vert_lookup(handle, vkeys[i2], co[i2], id[i2], e2); + e3->vert = p_vert_lookup(handle, vkeys[i3], co[i3], id[i3], e3); e1->orig_uv = uv[i1]; e2->orig_uv = uv[i2]; @@ -4174,7 +4175,7 @@ void param_delete(ParamHandle *handle) } static void p_add_ngon(ParamHandle *handle, ParamKey key, int nverts, - ParamKey *vkeys, float **co, float **uv, + ParamKey *vkeys, float **co, float **uv, float *id, ParamBool *pin, ParamBool *select, const float normal[3]) { int *boundary = BLI_array_alloca(boundary, nverts); @@ -4229,10 +4230,11 @@ static void p_add_ngon(ParamHandle *handle, ParamKey key, int nverts, ParamKey tri_vkeys[3] = {vkeys[v0], vkeys[v1], vkeys[v2]}; float *tri_co[3] = {co[v0], co[v1], co[v2]}; float *tri_uv[3] = {uv[v0], uv[v1], uv[v2]}; + float tri_id[3] = {id[v0], id[v1], id[v2]}; ParamBool tri_pin[3] = {pin[v0], pin[v1], pin[v2]}; ParamBool tri_select[3] = {select[v0], select[v1], select[v2]}; - param_face_add(handle, key, 3, tri_vkeys, tri_co, tri_uv, tri_pin, tri_select, NULL); + param_face_add(handle, key, 3, tri_vkeys, tri_co, tri_uv, tri_id, tri_pin, tri_select, NULL); } /* remove corner */ @@ -4244,7 +4246,7 @@ static void p_add_ngon(ParamHandle *handle, ParamKey key, int nverts, } void param_face_add(ParamHandle *handle, ParamKey key, int nverts, -ParamKey *vkeys, float *co[4], float *uv[4], +ParamKey *vkeys, float *co[4], float *uv[4], float id[4], ParamBool *pin, ParamBool
[Bf-blender-cvs] [88a327d3ed] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration
Commit: 88a327d3edeb325c59d60110d553122727c41fa0 Author: Aurel Gruber Date: Fri Feb 10 17:13:03 2017 +0100 Branches: uv_unwrapping_slim_algorithm https://developer.blender.org/rB88a327d3edeb325c59d60110d553122727c41fa0 Category: UV Unwrapping SLIM Algorithm Integration taking care of memory leaks === M intern/SLIM M source/blender/editors/uvedit/uvedit_parametrizer.c M source/blender/editors/uvedit/uvedit_parametrizer.h M source/blender/editors/uvedit/uvedit_unwrap_ops.c === diff --git a/intern/SLIM b/intern/SLIM index 8c6ee9dbdc..8686b499ce 16 --- a/intern/SLIM +++ b/intern/SLIM @@ -1 +1 @@ -Subproject commit 8c6ee9dbdc60a9e2c3543eec38e71f9ca4fcd971 +Subproject commit 8686b499ce3f23d537e1e56ab91412bc0b2aefb3 diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 1459f9d45c..472e293d8a 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -4428,6 +4428,7 @@ void param_slim_end(ParamHandle *handle) { PHandle *phandle = (PHandle *) handle; matrix_transfer *mt = phandle->mt; set_uv_param_slim(handle, mt); + free_matrix_transfer(mt); } @@ -4874,6 +4875,8 @@ void convert_blender_slim(ParamHandle *handle, bool selectionOnly, int weightMap mt->Pmatrices[chartNr] = MEM_reallocN_id(mt->Pmatrices[chartNr], mt->nPinnedVertices[chartNr] * sizeof(**mt->Pmatrices), " Pinned-Vertex Matrix"); mt->Bvectors[chartNr] = MEM_reallocN_id(mt->Bvectors[chartNr], mt->nBoundaryVertices[chartNr] * sizeof(**mt->Bvectors), " boundary-Vertex Matrix"); mt->Ematrices[chartNr] = MEM_reallocN_id(mt->Ematrices[chartNr], (mt->nEdges[chartNr] + mt->nBoundaryVertices[chartNr]) * 2 * sizeof(**mt->Ematrices), " boundarys-Vertex Matrix"); + + MEM_freeN(tempW); } if (mt->nPinnedVertices > 0){ @@ -5164,17 +5167,31 @@ void free_matrix_transfer(matrix_transfer *mt){ MEM_freeN(mt->Vmatrices[chartNr]); MEM_freeN(mt->UVmatrices[chartNr]); MEM_freeN(mt->Fmatrices[chartNr]); - + MEM_freeN(mt->PPmatrices[chartNr]); + MEM_freeN(mt->ELvectors[chartNr]); + MEM_freeN(mt->Wvectors[chartNr]); + MEM_freeN(mt->Pmatrices[chartNr]); + MEM_freeN(mt->Ematrices[chartNr]); + MEM_freeN(mt->Bvectors[chartNr]); } - MEM_freeN(mt->nVerts); - MEM_freeN(mt->nFaces); - MEM_freeN(mt->nPinnedVertices); + MEM_freeN(mt->Vmatrices); MEM_freeN(mt->UVmatrices); MEM_freeN(mt->Fmatrices); - MEM_freeN(mt->Pmatrices); MEM_freeN(mt->PPmatrices); + MEM_freeN(mt->ELvectors); + MEM_freeN(mt->Wvectors); + MEM_freeN(mt->Pmatrices); + MEM_freeN(mt->Ematrices); + MEM_freeN(mt->Bvectors); + + MEM_freeN(mt->nVerts); + MEM_freeN(mt->nFaces); + MEM_freeN(mt->nPinnedVertices); + MEM_freeN(mt->nBoundaryVertices); + MEM_freeN(mt->nEdges); + MEM_freeN(mt); } diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h b/source/blender/editors/uvedit/uvedit_parametrizer.h index ed5b10a594..2a3abaa35c 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.h +++ b/source/blender/editors/uvedit/uvedit_parametrizer.h @@ -175,7 +175,9 @@ void convert_blender_slim(ParamHandle *handle, bool selectionOnly, int weightMap void set_uv_param_slim(ParamHandle *handle, matrix_transfer *mt); bool transformIslands(ParamHandle *handle); bool mark_pins(ParamHandle *paramHandle); - +void add_index_to_vertices(BMEditMesh *em); +void free_matrix_transfer(matrix_transfer *mt); + #ifdef __cplusplus } #endif diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 5920ecfecd..ccce5ca230 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -787,9 +787,6 @@ typedef struct { bool noPins; } MinStretchSlim; -void add_index_to_vertices(BMEditMesh *em); -void free_matrix_transfer(matrix_transfer *mt); - /* AUREL THESIS Initialises SLIM and transfars data matrices */ @@ -865,6 +862,12 @@ static void minimize_stretch_SLIM_iteration(bContext *C, wmOperator *op, bool in WM_event_add_notifier(C, NC_GEOM | ND_DATA, mss->obedit->data); } +void free_slimPtrs(void **slimPtrs, int nCharts){ + for (int i = 0; i
[Bf-blender-cvs] [26fd7e084f] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration
Commit: 26fd7e084fdfa18354f6ad5fc420fbc6f955c013 Author: Aurel Gruber Date: Wed Feb 22 12:06:21 2017 +0100 Branches: uv_unwrapping_slim_algorithm https://developer.blender.org/rB26fd7e084fdfa18354f6ad5fc420fbc6f955c013 Category: UV Unwrapping SLIM Algorithm Integration adding relative scale, reflection mode and Vertex group input === M intern/SLIM M source/blender/editors/uvedit/uvedit_parametrizer.c M source/blender/editors/uvedit/uvedit_parametrizer.h M source/blender/editors/uvedit/uvedit_unwrap_ops.c M source/blender/makesdna/DNA_scene_types.h === diff --git a/intern/SLIM b/intern/SLIM index 8686b499ce..cffc347ba2 16 --- a/intern/SLIM +++ b/intern/SLIM @@ -1 +1 @@ -Subproject commit 8686b499ce3f23d537e1e56ab91412bc0b2aefb3 +Subproject commit cffc347ba26c31b04f9080916b99b1e603d4ee5c diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 472e293d8a..6ff5176491 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -253,6 +253,7 @@ typedef struct PHandle { MDeformVert *weightMapData; int weightMapIndex; double weightInfluence; + double relative_scale; BMesh *bm; } PHandle; @@ -4360,9 +4361,8 @@ void add_index_to_vertices(BMEditMesh *em){ } } -int retrieve_weightmap_index(Object *obedit){ - char *name = "slim"; - return defgroup_name_index(obedit, name); +int retrieve_weightmap_index(Object *obedit, char *vertex_group){ + return defgroup_name_index(obedit, vertex_group); } void param_slim_enrich_handle(Object *obedit, @@ -4372,6 +4372,7 @@ void param_slim_enrich_handle(Object *obedit, MDeformVert *dvert, int weightMapIndex, double weightInfluence, + double relative_scale, int n_iterations, bool skip_initialization, bool pack_islands, @@ -4387,6 +4388,7 @@ void param_slim_enrich_handle(Object *obedit, phandle->weightMapData = dvert; phandle->weightMapIndex = weightMapIndex; phandle->weightInfluence = weightInfluence; + phandle->relative_scale = relative_scale; phandle->bm = em->bm; } @@ -4428,7 +4430,6 @@ void param_slim_end(ParamHandle *handle) { PHandle *phandle = (PHandle *) handle; matrix_transfer *mt = phandle->mt; set_uv_param_slim(handle, mt); - free_matrix_transfer(mt); } @@ -4835,6 +4836,7 @@ void transfer_data_to_slim(ParamHandle *handle){ mt->transform_islands = true; mt->with_weighted_parameterization = phandle->with_weighted_parameterization; mt->weight_influence = phandle->weightInfluence; + mt->relative_scale = phandle->relative_scale; convert_blender_slim(handle, false, phandle->weightMapIndex); } diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h b/source/blender/editors/uvedit/uvedit_parametrizer.h index 2a3abaa35c..8dcaf952ed 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.h +++ b/source/blender/editors/uvedit/uvedit_parametrizer.h @@ -90,7 +90,7 @@ void param_delete(ParamHandle *chart); */ void add_index_to_vertices(BMEditMesh *em); -int retrieve_weightmap_index(Object *obedit); +int retrieve_weightmap_index(Object *obedit, char *vertex_group); void param_slim_enrich_handle(Object *obedit, BMEditMesh *em, ParamHandle *handle, @@ -98,6 +98,7 @@ void param_slim_enrich_handle(Object *obedit, MDeformVert *dvert, int weightMapIndex, double weightInfluence, + double relative_scale, int n_iterations, bool skip_initialization, bool pack_islands, diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index ccce5ca230..db56fc9399 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -511,26 +511,23 @@ static ParamHandle
[Bf-blender-cvs] [9c55a8374e] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration
Commit: 9c55a8374ef257c610027750ee6d3c1cf95cd360 Author: Aurel Gruber Date: Tue Jan 31 13:58:43 2017 +0100 Branches: uv_unwrapping_slim_algorithm https://developer.blender.org/rB9c55a8374ef257c610027750ee6d3c1cf95cd360 Category: UV Unwrapping SLIM Algorithm Integration adding weightinfluence === M source/blender/editors/uvedit/uvedit_parametrizer.c M source/blender/editors/uvedit/uvedit_parametrizer.h M source/blender/editors/uvedit/uvedit_unwrap_ops.c === diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index ea8bf4df4a..1459f9d45c 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -252,6 +252,7 @@ typedef struct PHandle { bool with_weighted_parameterization; MDeformVert *weightMapData; int weightMapIndex; + double weightInfluence; BMesh *bm; } PHandle; @@ -4370,6 +4371,7 @@ void param_slim_enrich_handle(Object *obedit, matrix_transfer *mt, MDeformVert *dvert, int weightMapIndex, + double weightInfluence, int n_iterations, bool skip_initialization, bool pack_islands, @@ -4384,6 +4386,7 @@ void param_slim_enrich_handle(Object *obedit, phandle->with_weighted_parameterization = with_weighted_parameterization; phandle->weightMapData = dvert; phandle->weightMapIndex = weightMapIndex; + phandle->weightInfluence = weightInfluence; phandle->bm = em->bm; } @@ -4830,6 +4833,7 @@ void transfer_data_to_slim(ParamHandle *handle){ mt->pinned_vertices = false; mt->transform_islands = true; mt->with_weighted_parameterization = phandle->with_weighted_parameterization; + mt->weight_influence = phandle->weightInfluence; convert_blender_slim(handle, false, phandle->weightMapIndex); } diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h b/source/blender/editors/uvedit/uvedit_parametrizer.h index bb5b9e16f4..ed5b10a594 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.h +++ b/source/blender/editors/uvedit/uvedit_parametrizer.h @@ -97,6 +97,7 @@ void param_slim_enrich_handle(Object *obedit, matrix_transfer *mt, MDeformVert *dvert, int weightMapIndex, + double weightInfluence, int n_iterations, bool skip_initialization, bool pack_islands, diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index a19336643e..247c43c4c5 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -530,6 +530,7 @@ void enrich_handle_slim(Scene *scene, Object *obedit, BMEditMesh *em, ParamHandl int n_iterations = scene->toolsettings->slim_n_iterations; bool skip_initialization = scene->toolsettings->slim_skip_initialization; bool pack_islands = scene->toolsettings->slim_pack_islands; + double weight_influence = scene->toolsettings->slim_weight_influence; MDeformVert *weightMapData = NULL; @@ -545,6 +546,7 @@ void enrich_handle_slim(Scene *scene, Object *obedit, BMEditMesh *em, ParamHandl mt, weightMapData, weightMapIndex, +weight_influence, n_iterations, skip_initialization, pack_islands, @@ -813,7 +815,7 @@ static bool minimize_stretch_SLIM_init(bContext *C, wmOperator *op) scene->toolsettings->slim_skip_initialization = true; scene->toolsettings->slim_pack_islands = false; scene->toolsettings->slim_fixed_boundary = true; - + scene->toolsettings->slim_weight_influence = RNA_float_get(op->ptr,
[Bf-blender-cvs] [15fb1fdb99] blender-v2.78c-release: [msvc] Set proper OpenSubdiv flags when not using find_package to find opensubdiv. Fixes T50548
Commit: 15fb1fdb99700d1efecf2e2934595ab18723960a Author: lazydodo Date: Sun Jan 29 10:00:11 2017 -0700 Branches: blender-v2.78c-release https://developer.blender.org/rB15fb1fdb99700d1efecf2e2934595ab18723960a [msvc] Set proper OpenSubdiv flags when not using find_package to find opensubdiv. Fixes T50548 === M build_files/cmake/platform/platform_win32_msvc.cmake === diff --git a/build_files/cmake/platform/platform_win32_msvc.cmake b/build_files/cmake/platform/platform_win32_msvc.cmake index 79efe31950..8968581b95 100644 --- a/build_files/cmake/platform/platform_win32_msvc.cmake +++ b/build_files/cmake/platform/platform_win32_msvc.cmake @@ -451,6 +451,12 @@ if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV) debug ${OPENSUBDIV_LIBPATH}/osdCPU_d.lib debug ${OPENSUBDIV_LIBPATH}/osdGPU_d.lib ) +set(OPENSUBDIV_HAS_OPENMP TRUE) + set(OPENSUBDIV_HAS_TBB FALSE) + set(OPENSUBDIV_HAS_OPENCL TRUE) + set(OPENSUBDIV_HAS_CUDA FALSE) + set(OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK TRUE) + set(OPENSUBDIV_HAS_GLSL_COMPUTE TRUE) windows_find_package(OpenSubdiv) endif() ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [7d77dcd190] blender-v2.78c-release: Blender 2.78c: Officially move to 'c'
Commit: 7d77dcd1904e260d7d393cd87bbf70f62945f3cb Author: Sergey Sharybin Date: Thu Feb 23 15:11:44 2017 +0100 Branches: blender-v2.78c-release https://developer.blender.org/rB7d77dcd1904e260d7d393cd87bbf70f62945f3cb Blender 2.78c: Officially move to 'c' === M build_files/cmake/macros.cmake M source/blender/blenkernel/BKE_blender_version.h === diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 1aa440bff3..ead4fd4f4d 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -1198,7 +1198,7 @@ function(get_blender_version) string(LENGTH "${_out_version_char}" _out_version_char_len) if(NOT _out_version_char_len EQUAL 1) set(_out_version_char "") - elseif(NOT ${_out_version_char} MATCHES "[a-z]+") + elseif(NOT ${_out_version_char} MATCHES "[a-z]?") message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_CHAR") endif() diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index 6dad0d79ab..63ac07a7d0 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -35,7 +35,7 @@ /* used by packaging tools */ /* can be left blank, otherwise a,b,c... etc with no quotes */ -#define BLENDER_VERSION_CHARb +#define BLENDER_VERSION_CHARc /* alpha/beta/rc/release, docs use this */ #define BLENDER_VERSION_CYCLE release ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [909c8ec07a] blender-v2.78c-release: Cycles: Fix wrong render results with texture limit and half-float textures
Commit: 909c8ec07aa87f35107ce6e30e7e3fa8fc5b019f Author: Sergey Sharybin Date: Thu Feb 23 14:46:22 2017 +0100 Branches: blender-v2.78c-release https://developer.blender.org/rB909c8ec07aa87f35107ce6e30e7e3fa8fc5b019f Cycles: Fix wrong render results with texture limit and half-float textures === M intern/cycles/util/util_half.h M intern/cycles/util/util_image_impl.h === diff --git a/intern/cycles/util/util_half.h b/intern/cycles/util/util_half.h index 5db3384cda..7285c6ef60 100644 --- a/intern/cycles/util/util_half.h +++ b/intern/cycles/util/util_half.h @@ -110,6 +110,28 @@ ccl_device_inline float4 half4_to_float4(half4 h) return f; } +ccl_device_inline half float_to_half(float f) +{ + const uint u = __float_as_uint(f); + /* Sign bit, shifted to it's position. */ + uint sign_bit = u & 0x8000; + sign_bit >>= 16; + /* Exponent. */ + uint exponent_bits = u & 0x7f80; + /* Non-sign bits. */ + uint value_bits = u & 0x7fff; + value_bits >>= 13; /* Align mantissa on MSB. */ + value_bits -= 0x1c000; /* Adjust bias. */ + /* Flush-to-zero. */ + value_bits = (exponent_bits < 0x3880) ? 0 : value_bits; + /* Clamp-to-max. */ + value_bits = (exponent_bits > 0x4700) ? 0x7bff : value_bits; + /* Denormals-as-zero. */ + value_bits = (exponent_bits == 0 ? 0 : value_bits); + /* Re-insert sign bit and return. */ + return (value_bits | sign_bit); +} + #endif #endif diff --git a/intern/cycles/util/util_image_impl.h b/intern/cycles/util/util_image_impl.h index 73ecfda085..4daf1eaac2 100644 --- a/intern/cycles/util/util_image_impl.h +++ b/intern/cycles/util/util_image_impl.h @@ -19,6 +19,7 @@ #include "util_algorithm.h" #include "util_debug.h" +#include "util_half.h" #include "util_image.h" CCL_NAMESPACE_BEGIN @@ -38,6 +39,52 @@ const T *util_image_read(const vector& pixels, return [index]; } +/* Cast input pixel from unknown storage to float. */ +template +inline float cast_to_float(T value); + +template<> +inline float cast_to_float(float value) +{ + return value; +} +template<> +inline float cast_to_float(uchar value) +{ + return (float)value / 255.0f; +} +template<> +inline float cast_to_float(half value) +{ + return half_to_float(value); +} + +/* Cast float value to output pixel type. */ +template +inline T cast_from_float(float value); + +template<> +inline float cast_from_float(float value) +{ + return value; +} +template<> +inline uchar cast_from_float(float value) +{ + if(value < 0.0f) { + return 0; + } + else if(value > (1.0f - 0.5f / 255.0f)) { + return 255; + } + return (uchar)((255.0f * value) + 0.5f); +} +template<> +inline half cast_from_float(float value) +{ + return float_to_half(value); +} + template void util_image_downscale_sample(const vector& pixels, const size_t width, @@ -71,15 +118,22 @@ void util_image_downscale_sample(const vector& pixels, components, nx, ny, nz); for(size_t k = 0; k < components; ++k) { - accum[k] += pixel[k]; + accum[k] += cast_to_float(pixel[k]); } ++count; } } } - const float inv_count = 1.0f / (float)count; - for(size_t k = 0; k < components; ++k) { - result[k] = T(accum[k] * inv_count); + if(count != 0) { + const float inv_count = 1.0f / (float)count; + for(size_t k = 0; k < components; ++k) { + result[k] = cast_from_float(accum[k] * inv_count); + } + } + else { + for(size_t k = 0; k < components; ++k) { + result[k] = T(0.0f); + } } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b95645c1ae] blender-v2.78c-release: Fix T50748: Render Time incorrect when refreshing rendered preview in GPU mode
Commit: b95645c1aec371be44460c82d3b559647b1a4491 Author: Sergey Sharybin Date: Thu Feb 23 10:50:46 2017 +0100 Branches: blender-v2.78c-release https://developer.blender.org/rBb95645c1aec371be44460c82d3b559647b1a4491 Fix T50748: Render Time incorrect when refreshing rendered preview in GPU mode === M intern/cycles/render/session.cpp === diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp index 7c01934cfd..420866c943 100644 --- a/intern/cycles/render/session.cpp +++ b/intern/cycles/render/session.cpp @@ -230,7 +230,9 @@ void Session::run_gpu() while(1) { scoped_timer pause_timer; pause_cond.wait(pause_lock); - progress.add_skip_time(pause_timer, params.background); + if(pause) { + progress.add_skip_time(pause_timer, params.background); + } update_status_time(pause, no_tiles); progress.set_update(); @@ -520,7 +522,9 @@ void Session::run_cpu() while(1) { scoped_timer pause_timer; pause_cond.wait(pause_lock); - progress.add_skip_time(pause_timer, params.background); + if(pause) { + progress.add_skip_time(pause_timer, params.background); + } update_status_time(pause, no_tiles); progress.set_update(); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [3fb0674a1a] HMD_viewport: Merge branch 'master' into HMD_viewport
Commit: 3fb0674a1a1aaf411f569710de2ac2375e8431b5 Author: Julian Eisel Date: Thu Feb 23 15:38:52 2017 +0100 Branches: HMD_viewport https://developer.blender.org/rB3fb0674a1a1aaf411f569710de2ac2375e8431b5 Merge branch 'master' into HMD_viewport Conflicts: source/blender/makesdna/DNA_scene_types.h === === diff --cc source/blender/makesdna/DNA_scene_types.h index 4a7bfd4839,918d0f0004..766ad882e3 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@@ -1712,10 -1712,11 +1712,11 @@@ typedef struct Scene /* flag */ /* use preview range */ -#define SCER_PRV_RANGE(1<<0) -#define SCER_LOCK_FRAME_SELECTION (1<<1) +#define SCER_PRV_RANGE(1 << 0) +#define SCER_LOCK_FRAME_SELECTION (1 << 1) /* timeline/keyframe jumping - only selected items (on by default) */ -#define SCE_KEYS_NO_SELONLY (1<<2) -#define SCER_SHOW_SUBFRAME(1<<3) +#define SCE_KEYS_NO_SELONLY (1 << 2) ++#define SCER_SHOW_SUBFRAME(1 << 3) /* mode (int now) */ #define R_OSA 0x0001 ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4e12113bea] master: Cycles: Fix wrong render results with texture limit and half-float textures
Commit: 4e12113beac6a9a48cf65fc5604513c36c02c5f3 Author: Sergey Sharybin Date: Thu Feb 23 14:46:22 2017 +0100 Branches: master https://developer.blender.org/rB4e12113beac6a9a48cf65fc5604513c36c02c5f3 Cycles: Fix wrong render results with texture limit and half-float textures === M intern/cycles/util/util_image_impl.h === diff --git a/intern/cycles/util/util_image_impl.h b/intern/cycles/util/util_image_impl.h index 73ecfda085..4daf1eaac2 100644 --- a/intern/cycles/util/util_image_impl.h +++ b/intern/cycles/util/util_image_impl.h @@ -19,6 +19,7 @@ #include "util_algorithm.h" #include "util_debug.h" +#include "util_half.h" #include "util_image.h" CCL_NAMESPACE_BEGIN @@ -38,6 +39,52 @@ const T *util_image_read(const vector& pixels, return [index]; } +/* Cast input pixel from unknown storage to float. */ +template +inline float cast_to_float(T value); + +template<> +inline float cast_to_float(float value) +{ + return value; +} +template<> +inline float cast_to_float(uchar value) +{ + return (float)value / 255.0f; +} +template<> +inline float cast_to_float(half value) +{ + return half_to_float(value); +} + +/* Cast float value to output pixel type. */ +template +inline T cast_from_float(float value); + +template<> +inline float cast_from_float(float value) +{ + return value; +} +template<> +inline uchar cast_from_float(float value) +{ + if(value < 0.0f) { + return 0; + } + else if(value > (1.0f - 0.5f / 255.0f)) { + return 255; + } + return (uchar)((255.0f * value) + 0.5f); +} +template<> +inline half cast_from_float(float value) +{ + return float_to_half(value); +} + template void util_image_downscale_sample(const vector& pixels, const size_t width, @@ -71,15 +118,22 @@ void util_image_downscale_sample(const vector& pixels, components, nx, ny, nz); for(size_t k = 0; k < components; ++k) { - accum[k] += pixel[k]; + accum[k] += cast_to_float(pixel[k]); } ++count; } } } - const float inv_count = 1.0f / (float)count; - for(size_t k = 0; k < components; ++k) { - result[k] = T(accum[k] * inv_count); + if(count != 0) { + const float inv_count = 1.0f / (float)count; + for(size_t k = 0; k < components; ++k) { + result[k] = cast_from_float(accum[k] * inv_count); + } + } + else { + for(size_t k = 0; k < components; ++k) { + result[k] = T(0.0f); + } } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [13e075600a] master: Cycles: Add utility function to convert float to half
Commit: 13e075600ac985bb0d5ff171d7554a4e465db829 Author: Sergey Sharybin Date: Thu Feb 23 14:42:06 2017 +0100 Branches: master https://developer.blender.org/rB13e075600ac985bb0d5ff171d7554a4e465db829 Cycles: Add utility function to convert float to half handles overflow and underflow, but not NaN/inf. === M intern/cycles/util/util_half.h === diff --git a/intern/cycles/util/util_half.h b/intern/cycles/util/util_half.h index 5db3384cda..7285c6ef60 100644 --- a/intern/cycles/util/util_half.h +++ b/intern/cycles/util/util_half.h @@ -110,6 +110,28 @@ ccl_device_inline float4 half4_to_float4(half4 h) return f; } +ccl_device_inline half float_to_half(float f) +{ + const uint u = __float_as_uint(f); + /* Sign bit, shifted to it's position. */ + uint sign_bit = u & 0x8000; + sign_bit >>= 16; + /* Exponent. */ + uint exponent_bits = u & 0x7f80; + /* Non-sign bits. */ + uint value_bits = u & 0x7fff; + value_bits >>= 13; /* Align mantissa on MSB. */ + value_bits -= 0x1c000; /* Adjust bias. */ + /* Flush-to-zero. */ + value_bits = (exponent_bits < 0x3880) ? 0 : value_bits; + /* Clamp-to-max. */ + value_bits = (exponent_bits > 0x4700) ? 0x7bff : value_bits; + /* Denormals-as-zero. */ + value_bits = (exponent_bits == 0 ? 0 : value_bits); + /* Re-insert sign bit and return. */ + return (value_bits | sign_bit); +} + #endif #endif ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/repos/bf-blender [61813] trunk/lib/tests/layers/layers_object_add_torus.json: Layer unittest: update after rBa9ff1314f90ce880851a4e640d98b8e6d1e5e639
Revision: 61813 https://developer.blender.org/rBL61813 Author: dfelinto Date: 2017-02-23 13:05:25 +0100 (Thu, 23 Feb 2017) Log Message: --- Layer unittest: update after rBa9ff1314f90ce880851a4e640d98b8e6d1e5e639 Modified Paths: -- trunk/lib/tests/layers/layers_object_add_torus.json Modified: trunk/lib/tests/layers/layers_object_add_torus.json === --- trunk/lib/tests/layers/layers_object_add_torus.json 2017-02-22 14:24:01 UTC (rev 61812) +++ trunk/lib/tests/layers/layers_object_add_torus.json 2017-02-23 12:05:25 UTC (rev 61813) @@ -12,8 +12,7 @@ "filter_objects": [], "name": "scorpion", "objects": [ -"T.3c", -"Torus" +"T.3c" ] } }, @@ -29,7 +28,8 @@ "filter_objects": [], "name": "1", "objects": [ -"T.1a" +"T.1a", +"Torus" ] }, "2": { @@ -94,8 +94,7 @@ "is_visible": true, "name": "scorpion", "objects": [ -"T.3c", -"Torus" +"T.3c" ] } }, @@ -113,7 +112,8 @@ "is_visible": true, "name": "1", "objects": [ -"T.1a" +"T.1a", +"Torus" ] }, "2": { @@ -151,8 +151,7 @@ "is_visible": true, "name": "scorpion", "objects": [ -"T.3c", -"Torus" +"T.3c" ] } }, @@ -170,7 +169,8 @@ "is_visible": true, "name": "1", "objects": [ -"T.1a" +"T.1a", +"Torus" ] }, "2": { @@ -286,8 +286,7 @@ "is_visible": true, "name": "scorpion", "objects": [ -"T.3c", -"Torus" +"T.3c" ] } }, @@ -305,7 +304,8 @@ "is_visible": true, "name": "1", "objects": [ -"T.1a" +"T.1a", +"Torus" ] }, "2": { @@ -385,8 +385,7 @@ "is_visible": true, "name": "scorpion", "objects": [ -"T.3c", -"Torus" +"T.3c" ] } }, @@ -404,7 +403,8 @@ "is_visible": true, "name": "1", "objects": [ -"T.1a" +"T.1a", +"Torus" ] }, "2": { @@ -468,8 +468,7 @@ "is_visible": true, "name": "scorpion", "objects": [ -"T.3c", -"Torus" +"T.3c" ] } }, @@ -513,8 +512,7 @@ "is_visible": true, "name": "scorpion", "objects": [ -"T.3c", -"Torus" +"T.3c" ] } }, @@ -532,7 +530,8 @@ "is_visible": true, "name": "1",
[Bf-blender-cvs] [ef60979029] blender2.8: Rework of BKE's mesh_render to support BMesh directly.
Commit: ef60979029793c04dab2df051b965a86eeb299f6 Author: Bastien Montagne Date: Thu Feb 23 11:54:40 2017 +0100 Branches: blender2.8 https://developer.blender.org/rBef60979029793c04dab2df051b965a86eeb299f6 Rework of BKE's mesh_render to support BMesh directly. Note that since there is no (efficient) ways to get arrays of MVert/MEdge/etc. out of a BMesh, I refactored quite heavily internals of BKE_mesh_render. Now, when you do need acess to mesh data to generate cached batches, you create an abstract struct from mesh (either Mesh or BMesh if available), and then use advanced helpers to extract needed data, on a per-item basis (no more handling of arrays of verts/edges/... in batches code). This allows to: * Avoid having to create arrays of BMesh elements. * Take advantage of existing advanced BMesh topology and connectivity data. Reviewers: dfelinto, fclem, merwin Differential Revision: https://developer.blender.org/D2521 === M source/blender/blenkernel/BKE_mesh_render.h M source/blender/blenkernel/intern/mesh_render.c === diff --git a/source/blender/blenkernel/BKE_mesh_render.h b/source/blender/blenkernel/BKE_mesh_render.h index 0538bac2dc..f4e322fca6 100644 --- a/source/blender/blenkernel/BKE_mesh_render.h +++ b/source/blender/blenkernel/BKE_mesh_render.h @@ -33,6 +33,7 @@ struct Batch; struct Mesh; void BKE_mesh_batch_cache_dirty(struct Mesh *me); +void BKE_mesh_batch_cache_clear(struct Mesh *me); void BKE_mesh_batch_cache_free(struct Mesh *me); struct Batch *BKE_mesh_batch_cache_get_all_edges(struct Mesh *me); struct Batch *BKE_mesh_batch_cache_get_all_triangles(struct Mesh *me); diff --git a/source/blender/blenkernel/intern/mesh_render.c b/source/blender/blenkernel/intern/mesh_render.c index b62451c4db..36dc202271 100644 --- a/source/blender/blenkernel/intern/mesh_render.c +++ b/source/blender/blenkernel/intern/mesh_render.c @@ -31,6 +31,8 @@ #include "MEM_guardedalloc.h" +#include "BLI_utildefines.h" +#include "BLI_edgehash.h" #include "BLI_math_vector.h" #include "DNA_mesh_types.h" @@ -43,201 +45,408 @@ #include "BKE_mesh.h" #include "BKE_mesh_render.h" +#include "bmesh.h" + #include "GPU_batch.h" /* -- */ -/* Mesh Interface */ - -#define MESH_RENDER_FUNCTION(func_name) \ - if (me->edit_btmesh && me->edit_btmesh->derivedFinal) { \ - return mesh_bmesh_##func_name(me); \ - } \ - else { \ - return mesh_struct_##func_name(me); \ - } - +/* Mesh/BMesh Interface, direct access to basic data. */ -/* Mesh Implementation */ - -static int mesh_struct_get_num_edges(Mesh *me) +static int mesh_render_verts_num_get(Mesh *me) { - return me->totedge; + return me->edit_btmesh ? me->edit_btmesh->bm->totvert : me->totvert; } -static int mesh_struct_get_num_verts(Mesh *me) +static int mesh_render_edges_num_get(Mesh *me) { - return me->totvert; + return me->edit_btmesh ? me->edit_btmesh->bm->totedge : me->totedge; } -static int mesh_struct_get_num_faces(Mesh *me) +static int mesh_render_looptri_num_get(Mesh *me) { - BKE_mesh_tessface_ensure(me); - return me->totface; + return me->edit_btmesh ? me->edit_btmesh->tottri : poly_to_tri_count(me->totpoly, me->totloop); } -static int mesh_struct_get_num_polys(Mesh *me) +static int mesh_render_polys_num_get(Mesh *me) { - return me->totpoly; + return me->edit_btmesh ? me->edit_btmesh->bm->totface : me->totpoly; } -static int mesh_struct_get_num_loops(Mesh *me) +static int UNUSED_FUNCTION(mesh_render_loops_num_get)(Mesh *me) { - return me->totloop; + return me->edit_btmesh ? me->edit_btmesh->bm->totloop : me->totloop; } -static MEdge *mesh_struct_get_array_edge(Mesh *me) -{ - return CustomData_get_layer(>edata, CD_MEDGE); -} +/* -- */ +/* Mesh/BMesh Interface, indirect, partially cached access to complex data. */ + +typedef struct EdgeAdjacentPolys { + int count; + int face_index[2]; +} EdgeAdjacentPolys; + +typedef struct MeshRenderData { + int types; + + int totvert; + int totedge; + int tottri; + int totloop; + int totpoly; + + BMEditMesh *edit_bmesh; + MVert *mvert; + MEdge *medge; + MLoop *mloop; + MPoly *mpoly; + + /* Data created on-demand (usually not for bmesh-based data). */ + EdgeHash *ehash; + EdgeAdjacentPolys *edges_adjacent_polys; + MLoopTri *mlooptri; + + float (*poly_normals)[3]; + short (*poly_normals_short)[3]; + short (*vert_normals_short)[3]; +} MeshRenderData; + +enum { + MR_DATATYPE_VERT= 1 << 0, +
[Bf-blender-cvs] [9eb647f1c8] master: Fix T50656: Compositing node editor is empty, no nodes can be added
Commit: 9eb647f1c8d8d7ea7da8f7dff7c19a2008afe26c Author: Sergey Sharybin Date: Thu Feb 23 11:23:49 2017 +0100 Branches: master https://developer.blender.org/rB9eb647f1c8d8d7ea7da8f7dff7c19a2008afe26c Fix T50656: Compositing node editor is empty, no nodes can be added === M source/blender/editors/space_node/node_edit.c === diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index ffe510016f..8a61857675 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -582,7 +582,7 @@ void snode_set_context(const bContext *C) } } - if (snode->nodetree != ntree || snode->id != id || snode->from != from) { + if (snode->nodetree != ntree || snode->id != id || snode->from != from || snode->treepath.last == NULL) { ED_node_tree_start(snode, ntree, id, from); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b46b2834b9] blender2.8: Merge branch 'master' into blender2.8
Commit: b46b2834b9596b9a7c026dd2e041a329cda9bb59 Author: Bastien Montagne Date: Thu Feb 23 10:56:28 2017 +0100 Branches: blender2.8 https://developer.blender.org/rBb46b2834b9596b9a7c026dd2e041a329cda9bb59 Merge branch 'master' into blender2.8 === === diff --cc source/blender/blenloader/intern/versioning_270.c index 3bd84c5f5c,7106cf6072..12045dfdb8 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@@ -1575,30 -1575,30 +1575,53 @@@ void blo_do_versions_270(FileData *fd, } } + /* Fix for T50736, Glare comp node using same var for two different things. */ + if (!DNA_struct_elem_find(fd->filesdna, "NodeGlare", "char", "star_45")) { + FOREACH_NODETREE(main, ntree, id) { + if (ntree->type == NTREE_COMPOSIT) { + ntreeSetTypes(NULL, ntree); + for (bNode *node = ntree->nodes.first; node; node = node->next) { + if (node->type == CMP_NODE_GLARE) { + NodeGlare *ndg = node->storage; + switch (ndg->type) { + case 2: /* G! magic numbers :( */ + ndg->streaks = ndg->angle; + break; + case 0: + ndg->star_45 = ndg->angle != 0; + break; + default: + break; + } + } + } + } + } FOREACH_NODETREE_END + } } + + { + if (!DNA_struct_elem_find(fd->filesdna, "View3DDebug", "char", "background")) { + bScreen *screen; + + for (screen = main->screen.first; screen; screen = screen->id.next) { + ScrArea *sa; + for (sa = screen->areabase.first; sa; sa = sa->next) { + SpaceLink *sl; + + for (sl = sa->spacedata.first; sl; sl = sl->next) { + switch (sl->spacetype) { + case SPACE_VIEW3D: + { + View3D *v3d = (View3D *)sl; + v3d->debug.background = V3D_DEBUG_BACKGROUND_NONE; + } + } + } + } + } + } + } } void do_versions_after_linking_270(Main *main) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [d751676cf3] blender2.8: Fix building full.
Commit: d751676cf319beb372ea12178729e0e3d00801c7 Author: Bastien Montagne Date: Thu Feb 23 11:03:56 2017 +0100 Branches: blender2.8 https://developer.blender.org/rBd751676cf319beb372ea12178729e0e3d00801c7 Fix building full. === M source/blender/gpu/intern/gpu_draw.c === diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index fa8e05b6bf..1fb1e23931 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -220,7 +220,7 @@ void GPU_render_text( /* Checking powers of two for images since OpenGL ES requires it */ -static bool UNUSED_FUNCTION(is_power_of_2_resolution)(int w, int h) +static bool is_power_of_2_resolution(int w, int h) { return is_power_of_2_i(w) && is_power_of_2_i(h); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [60592f6778] master: Fix T50748: Render Time incorrect when refreshing rendered preview in GPU mode
Commit: 60592f67781ebf1a73402241a4ebb5d9e4b95d91 Author: Sergey Sharybin Date: Thu Feb 23 10:50:46 2017 +0100 Branches: master https://developer.blender.org/rB60592f67781ebf1a73402241a4ebb5d9e4b95d91 Fix T50748: Render Time incorrect when refreshing rendered preview in GPU mode === M intern/cycles/render/session.cpp === diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp index 7c01934cfd..420866c943 100644 --- a/intern/cycles/render/session.cpp +++ b/intern/cycles/render/session.cpp @@ -230,7 +230,9 @@ void Session::run_gpu() while(1) { scoped_timer pause_timer; pause_cond.wait(pause_lock); - progress.add_skip_time(pause_timer, params.background); + if(pause) { + progress.add_skip_time(pause_timer, params.background); + } update_status_time(pause, no_tiles); progress.set_update(); @@ -520,7 +522,9 @@ void Session::run_cpu() while(1) { scoped_timer pause_timer; pause_cond.wait(pause_lock); - progress.add_skip_time(pause_timer, params.background); + if(pause) { + progress.add_skip_time(pause_timer, params.background); + } update_status_time(pause, no_tiles); progress.set_update(); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9dd194716b] master: Fix T50736: Zero streaks in Glare node.
Commit: 9dd194716b0f43fa02ae6cd32ada556d8d622390 Author: Bastien Montagne Date: Thu Feb 23 10:39:51 2017 +0100 Branches: master https://developer.blender.org/rB9dd194716b0f43fa02ae6cd32ada556d8d622390 Fix T50736: Zero streaks in Glare node. Please never, ever use same DNA var for two different things. Even worse if they do not have same type and ranges! This is only ensuring issues (as described in report, but also if animating both RNA props using same DNA var... yuck). And we were not even saving any byte in DNA, could reuse some padding there to store the two new needed vars (yes, two, since we cannot re-use existing one if we want to keep backward *and* forward compatibility). === M source/blender/blenloader/intern/versioning_270.c M source/blender/blenloader/intern/writefile.c M source/blender/compositor/operations/COM_GlareSimpleStarOperation.cpp M source/blender/compositor/operations/COM_GlareStreaksOperation.cpp M source/blender/makesdna/DNA_node_types.h M source/blender/makesrna/intern/rna_nodetree.c M source/blender/nodes/composite/nodes/node_composite_glare.c === diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 6235ebf28e..7106cf6072 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -1575,6 +1575,29 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) } } + /* Fix for T50736, Glare comp node using same var for two different things. */ + if (!DNA_struct_elem_find(fd->filesdna, "NodeGlare", "char", "star_45")) { + FOREACH_NODETREE(main, ntree, id) { + if (ntree->type == NTREE_COMPOSIT) { + ntreeSetTypes(NULL, ntree); + for (bNode *node = ntree->nodes.first; node; node = node->next) { + if (node->type == CMP_NODE_GLARE) { + NodeGlare *ndg = node->storage; + switch (ndg->type) { + case 2: /* G! magic numbers :( */ + ndg->streaks = ndg->angle; + break; + case 0: + ndg->star_45 = ndg->angle != 0; + break; + default: + break; + } + } + } + } + } FOREACH_NODETREE_END + } } } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 998d4161c2..38a032f490 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1026,6 +1026,25 @@ static void write_nodetree(WriteData *wd, bNodeTree *ntree) { /* pass */ } + else if ((ntree->type == NTREE_COMPOSIT) && (node->type == CMP_NODE_GLARE)) { + /* Simple forward compat for fix for T50736. +* Not ideal (there is no ideal solution here), but should do for now. */ + NodeGlare *ndg = node->storage; + /* Not in undo case. */ + if (!wd->current) { + switch (ndg->type) { + case 2: /* G! magic numbers :( */ + ndg->angle = ndg->streaks; + break; + case 0: + ndg->angle = ndg->star_45; + break; + default: + break; + } + } +
[Bf-blender-cvs] [53a9dec2bf] blender2.8: Silence "defined but not used" warnings
Commit: 53a9dec2bfecc8a2c863d850bcec05aafb008bac Author: Dalai Felinto Date: Thu Feb 23 10:24:59 2017 +0100 Branches: blender2.8 https://developer.blender.org/rB53a9dec2bfecc8a2c863d850bcec05aafb008bac Silence "defined but not used" warnings === M source/blender/editors/space_view3d/drawobject.c M source/blender/gpu/intern/gpu_draw.c M source/blender/modifiers/intern/MOD_uvwarp.c === diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 1b8acde421..8657991d1b 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -7459,7 +7459,7 @@ static void drawtube(const float vec[3], float radius, float height, float tmat[ } /* needs fixing if non-identity matrix used */ -static void imm_drawtube(const float vec[3], float radius, float height, float tmat[4][4], unsigned pos) +static void UNUSED_FUNCTION(imm_drawtube)(const float vec[3], float radius, float height, float tmat[4][4], unsigned pos) { float cur[3]; imm_drawcircball(vec, radius, tmat, pos); @@ -7505,7 +7505,7 @@ static void drawcone(const float vec[3], float radius, float height, float tmat[ } /* needs fixing if non-identity matrix used */ -static void imm_drawcone(const float vec[3], float radius, float height, float tmat[4][4], unsigned pos) +static void UNUSED_FUNCTION(imm_drawcone)(const float vec[3], float radius, float height, float tmat[4][4], unsigned pos) { float cur[3]; diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 1fb1e23931..fa8e05b6bf 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -220,7 +220,7 @@ void GPU_render_text( /* Checking powers of two for images since OpenGL ES requires it */ -static bool is_power_of_2_resolution(int w, int h) +static bool UNUSED_FUNCTION(is_power_of_2_resolution)(int w, int h) { return is_power_of_2_i(w) && is_power_of_2_i(h); } diff --git a/source/blender/modifiers/intern/MOD_uvwarp.c b/source/blender/modifiers/intern/MOD_uvwarp.c index 072267fc50..00ef6dd973 100644 --- a/source/blender/modifiers/intern/MOD_uvwarp.c +++ b/source/blender/modifiers/intern/MOD_uvwarp.c @@ -225,7 +225,7 @@ static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, walk(userData, ob, >object_src, IDWALK_CB_NOP); } -static void uv_warp_deps_object_bone(DagForest *forest, DagNode *obNode, +static void UNUSED_FUNCTION(uv_warp_deps_object_bone)(DagForest *forest, DagNode *obNode, Object *obj, const char *bonename) { if (obj) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs