[Bf-blender-cvs] [625f1a1] blender2.8: OpenGL: draw cameras using new matrix API

2016-10-18 Thread Mike Erwin
Commit: 625f1a1c3058dd64a0814ba075b12ba0c5b28fcb
Author: Mike Erwin
Date:   Tue Oct 18 20:57:36 2016 -0400
Branches: blender2.8
https://developer.blender.org/rB625f1a1c3058dd64a0814ba075b12ba0c5b28fcb

OpenGL: draw cameras using new matrix API

Also removed some extra push/pops.
Ref T49450

===

M   source/blender/editors/space_view3d/drawobject.c

===

diff --git a/source/blender/editors/space_view3d/drawobject.c 
b/source/blender/editors/space_view3d/drawobject.c
index b41d4b2..5dfbfc4 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -90,6 +90,7 @@
 #include "GPU_basic_shader.h"
 #include "GPU_shader.h"
 #include "GPU_immediate.h"
+#include "GPU_matrix.h"
 
 #include "ED_mesh.h"
 #include "ED_screen.h"
@@ -1902,15 +1903,13 @@ static void drawcamera_stereo3d(
 
/* caller bound GPU_SHADER_3D_UNIFORM_COLOR, passed in pos attribute ID 
*/
 
-   glPushMatrix();
-
for (int i = 0; i < 2; i++) {
ob = BKE_camera_multiview_render(scene, ob, names[i]);
cam_lr[i] = ob->data;
 
-   glLoadMatrixf(rv3d->viewmat);
+   gpuLoadMatrix3D(rv3d->viewmat);
BKE_camera_multiview_model_matrix(>r, ob, names[i], 
obmat);
-   glMultMatrixf(obmat);
+   gpuMultMatrix3D(obmat);
 
copy_m3_m3(vec_lr[i], vec);
copy_v3_v3(vec_lr[i][3], vec[3]);
@@ -1945,7 +1944,7 @@ static void drawcamera_stereo3d(
}
 
/* the remaining drawing takes place in the view space */
-   glLoadMatrixf(rv3d->viewmat);
+   gpuLoadMatrix3D(rv3d->viewmat);
 
if (is_stereo3d_cameras) {
/* draw connecting lines */
@@ -2042,8 +2041,6 @@ static void drawcamera_stereo3d(
}
}
}
-
-   glPopMatrix();
 }
 
 /* flag similar to draw_object() */
@@ -2111,6 +2108,8 @@ static void drawcamera(Scene *scene, View3D *v3d, 
RegionView3D *rv3d, Base *base
BKE_camera_view_frame_ex(scene, cam, cam->drawsize, is_view, scale,
 asp, shift, , vec);
 
+   gpuMatrixBegin3D_legacy();
+
unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, 
KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (ob_wire_col) {
@@ -2126,13 +2125,13 @@ static void drawcamera(Scene *scene, View3D *v3d, 
RegionView3D *rv3d, Base *base
float obmat[4][4];
bool is_left = v3d->multiview_eye == STEREO_LEFT_ID;
 
-   glPushMatrix();
-   glLoadMatrixf(rv3d->viewmat);
+   gpuPushMatrix();
+   gpuLoadMatrix3D(rv3d->viewmat);
BKE_camera_multiview_model_matrix(>r, ob, 
is_left ? STEREO_LEFT_NAME : STEREO_RIGHT_NAME, obmat);
-   glMultMatrixf(obmat);
+   gpuMultMatrix3D(obmat);
 
drawcamera_frame(vec, false, pos);
-   glPopMatrix();
+   gpuPopMatrix();
}
else {
drawcamera_frame(vec, false, pos);
@@ -2141,6 +2140,7 @@ static void drawcamera(Scene *scene, View3D *v3d, 
RegionView3D *rv3d, Base *base
 
if (is_view) {
immUnbindProgram();
+   gpuMatrixEnd();
return;
}
 
@@ -2183,9 +2183,8 @@ static void drawcamera(Scene *scene, View3D *v3d, 
RegionView3D *rv3d, Base *base
copy_m4_m4(nobmat, ob->obmat);
normalize_m4(nobmat);
 
-   glPushMatrix();
-   glLoadMatrixf(rv3d->viewmat);
-   glMultMatrixf(nobmat);
+   gpuLoadMatrix3D(rv3d->viewmat);
+   gpuMultMatrix3D(nobmat);
 
if (cam->flag & CAM_SHOWLIMITS) {
const unsigned char col[3] = {128, 128, 60}, 
col_hi[3] = {255, 255, 120};
@@ -2204,7 +2203,6 @@ static void drawcamera(Scene *scene, View3D *v3d, 
RegionView3D *rv3d, Base *base
dflag, (is_active ? 
col_hi : col), pos);
}
}
-   glPopMatrix();
}
}
 
@@ -2214,6 +2212,7 @@ static void drawcamera(Scene *scene, View3D *v3d, 
RegionView3D *rv3d, Base *base
}
 
immUnbindProgram();
+   gpuMatrixEnd();
 }
 
 /* flag similar to draw_object() */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [05117d7] blender2.8: OpenGL: draw cameras with new immediate mode

2016-10-18 Thread Mike Erwin
Commit: 05117d71a35d69a978a5e26da185b3617333d98c
Author: Mike Erwin
Date:   Tue Oct 18 20:27:24 2016 -0400
Branches: blender2.8
https://developer.blender.org/rB05117d71a35d69a978a5e26da185b3617333d98c

OpenGL: draw cameras with new immediate mode

Mostly the same as before. Except:
- avoid drawing same lines multiple times
- helper functions take "bool filled" argument instead of GLenum
- drawcamera_volume draws its own near & far planes

===

M   source/blender/editors/space_view3d/drawobject.c

===

diff --git a/source/blender/editors/space_view3d/drawobject.c 
b/source/blender/editors/space_view3d/drawobject.c
index 02702af..b41d4b2 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -1557,36 +1557,38 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base 
*base,
glPopMatrix();
 }
 
-static void draw_limit_line(float sta, float end, const short dflag, const 
unsigned char col[3])
+static void draw_limit_line(float sta, float end, const short dflag, const 
unsigned char col[3], unsigned pos)
 {
-   glBegin(GL_LINES);
-   glVertex3f(0.0, 0.0, -sta);
-   glVertex3f(0.0, 0.0, -end);
-   glEnd();
+   immBegin(GL_LINES, 2);
+   immVertex3f(pos, 0.0, 0.0, -sta);
+   immVertex3f(pos, 0.0, 0.0, -end);
+   immEnd();
 
if (!(dflag & DRAW_PICKING)) {
glPointSize(3.0);
-   glBegin(GL_POINTS);
+   /* would like smooth round points here, but that means binding 
another shader...
+* if it's really desired, pull these points into their own 
function to be called after */
+   immBegin(GL_POINTS, 2);
if ((dflag & DRAW_CONSTCOLOR) == 0) {
-   glColor3ubv(col);
+   immUniformColor3ubv(col);
}
-   glVertex3f(0.0, 0.0, -sta);
-   glVertex3f(0.0, 0.0, -end);
-   glEnd();
+   immVertex3f(pos, 0.0, 0.0, -sta);
+   immVertex3f(pos, 0.0, 0.0, -end);
+   immEnd();
}
 }
 
 
 /* yafray: draw camera focus point (cross, similar to aqsis code in tuhopuu) */
 /* qdn: now also enabled for Blender to set focus point for defocus composite 
node */
-static void draw_focus_cross(float dist, float size)
+static void draw_focus_cross(float dist, float size, unsigned pos)
 {
-   glBegin(GL_LINES);
-   glVertex3f(-size, 0.0f, -dist);
-   glVertex3f(size, 0.0f, -dist);
-   glVertex3f(0.0f, -size, -dist);
-   glVertex3f(0.0f, size, -dist);
-   glEnd();
+   immBegin(GL_LINES, 4);
+   immVertex3f(pos, -size, 0.0f, -dist);
+   immVertex3f(pos, size, 0.0f, -dist);
+   immVertex3f(pos, 0.0f, -size, -dist);
+   immVertex3f(pos, 0.0f, size, -dist);
+   immEnd();
 }
 
 #ifdef VIEW3D_CAMERA_BORDER_HACK
@@ -1809,59 +1811,68 @@ static void draw_viewport_reconstruction(
GPU_select_load_id(base->selcol);
 }
 
-static void drawcamera_volume(float near_plane[4][3], float far_plane[4][3], 
const GLenum mode)
-{
-   glBegin(mode);
-   glVertex3fv(near_plane[0]);
-   glVertex3fv(far_plane[0]);
-   glVertex3fv(far_plane[1]);
-   glVertex3fv(near_plane[1]);
-   glEnd();
-
-   glBegin(mode);
-   glVertex3fv(near_plane[1]);
-   glVertex3fv(far_plane[1]);
-   glVertex3fv(far_plane[2]);
-   glVertex3fv(near_plane[2]);
-   glEnd();
-
-   glBegin(mode);
-   glVertex3fv(near_plane[2]);
-   glVertex3fv(near_plane[1]);
-   glVertex3fv(far_plane[1]);
-   glVertex3fv(far_plane[2]);
-   glEnd();
-
-   glBegin(mode);
-   glVertex3fv(far_plane[0]);
-   glVertex3fv(near_plane[0]);
-   glVertex3fv(near_plane[3]);
-   glVertex3fv(far_plane[3]);
-   glEnd();
-}
-
 /* camera frame */
-static void drawcamera_frame(float vec[4][3], const GLenum mode)
+static void drawcamera_frame(float vec[4][3], bool filled, unsigned pos)
 {
-   glBegin(mode);
-   glVertex3fv(vec[0]);
-   glVertex3fv(vec[1]);
-   glVertex3fv(vec[2]);
-   glVertex3fv(vec[3]);
-   glEnd();
+   immBegin(filled ? GL_QUADS : GL_LINE_LOOP, 4);
+   immVertex3fv(pos, vec[0]);
+   immVertex3fv(pos, vec[1]);
+   immVertex3fv(pos, vec[2]);
+   immVertex3fv(pos, vec[3]);
+   immEnd();
 }
 
 /* center point to camera frame */
-static void drawcamera_framelines(float vec[4][3], float origin[3])
+static void drawcamera_framelines(float vec[4][3], float origin[3], unsigned 
pos)
+{
+   immBegin(GL_LINES, 8);
+   immVertex3fv(pos, origin);
+   immVertex3fv(pos, vec[0]);
+   immVertex3fv(pos, origin);
+   immVertex3fv(pos, vec[1]);
+   immVertex3fv(pos, origin);
+   immVertex3fv(pos, vec[2]);
+   immVertex3fv(pos, origin);
+   

[Bf-blender-cvs] [54a0ff3] blender2.8: Gawain: yet another way to set uniform color

2016-10-18 Thread Mike Erwin
Commit: 54a0ff3ab5a46d2acf5761e799e9fa3604d980e5
Author: Mike Erwin
Date:   Tue Oct 18 20:22:22 2016 -0400
Branches: blender2.8
https://developer.blender.org/rB54a0ff3ab5a46d2acf5761e799e9fa3604d980e5

Gawain: yet another way to set uniform color

===

M   source/blender/gpu/gawain/immediate.c
M   source/blender/gpu/gawain/immediate.h

===

diff --git a/source/blender/gpu/gawain/immediate.c 
b/source/blender/gpu/gawain/immediate.c
index 2287950..30c82fd 100644
--- a/source/blender/gpu/gawain/immediate.c
+++ b/source/blender/gpu/gawain/immediate.c
@@ -736,6 +736,11 @@ void immUniformColor4fv(const float rgba[4])
immUniform4fv("color", rgba);
}
 
+void immUniformColor3f(float r, float g, float b)
+   {
+   immUniform4f("color", r, g, b, 1.0f);
+   }
+
 void immUniformColor3fv(const float rgb[3])
{
immUniform4f("color", rgb[0], rgb[1], rgb[2], 1.0f);
diff --git a/source/blender/gpu/gawain/immediate.h 
b/source/blender/gpu/gawain/immediate.h
index 271d844..ccf7ebe 100644
--- a/source/blender/gpu/gawain/immediate.h
+++ b/source/blender/gpu/gawain/immediate.h
@@ -83,6 +83,7 @@ void immUniform4fv(const char* name, const float data[4]);
 // the rgb functions have implicit alpha = 1.0
 void immUniformColor4f(float r, float g, float b, float a);
 void immUniformColor4fv(const float rgba[4]);
+void immUniformColor3f(float r, float g, float b);
 void immUniformColor3fv(const float rgb[3]);
 void immUniformColor3fvAlpha(const float rgb[3], float a);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [91fc0c4] transform-manipulators: Initial implementation of a new transform manipulator

2016-10-18 Thread Julian Eisel
Commit: 91fc0c4f2a8dcd71b3ad1f96ac7718ab2e222962
Author: Julian Eisel
Date:   Wed Oct 19 00:10:49 2016 +0200
Branches: transform-manipulators
https://developer.blender.org/rB91fc0c4f2a8dcd71b3ad1f96ac7718ab2e222962

Initial implementation of a new transform manipulator

This commit adds the basic framework for the new transform manipulators and 
also includes working manipulators for translation.

Wasn't really happy with the new transform manipulators code in the 
custom-manipulators (used to be wiggly-widgets) branch, especially since it 
reused quite some code of the old manipulator which is messy as hell. I decided 
to refactor this code by rewriting it from scratch. I'm doing this in an own 
branch so it can easily be merged into blender 2.8 when ready.

The new transform manipulators are part of the space_view3d module, IMHO they 
fit better into this than into transform module.

===

M   source/blender/editors/include/ED_transform.h
M   source/blender/editors/space_view3d/CMakeLists.txt
M   source/blender/editors/space_view3d/space_view3d.c
M   source/blender/editors/space_view3d/view3d_draw.c
M   source/blender/editors/space_view3d/view3d_draw_legacy.c
M   source/blender/editors/space_view3d/view3d_edit.c
M   source/blender/editors/space_view3d/view3d_intern.h
M   source/blender/editors/space_view3d/view3d_ops.c
A   source/blender/editors/space_view3d/view3d_transform_manipulators.c
M   source/blender/editors/transform/transform.h
M   source/blender/editors/transform/transform_manipulator.c
M   source/blender/editors/transform/transform_orientations.c
M   source/blender/makesdna/DNA_view3d_types.h
M   source/blender/windowmanager/CMakeLists.txt
M   source/blender/windowmanager/WM_api.h
A   source/blender/windowmanager/manipulators/WM_manipulator_library.h
M   source/blender/windowmanager/manipulators/WM_manipulator_types.h
A   
source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c
M   
source/blender/windowmanager/manipulators/intern/manipulator_library/manipulator_library_intern.h
M   source/blender/windowmanager/manipulators/intern/wm_manipulator.c
M   source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.h
M   source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h

===

diff --git a/source/blender/editors/include/ED_transform.h 
b/source/blender/editors/include/ED_transform.h
index ebd2a3d..a77d9ab 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -130,7 +130,10 @@ void BIF_createTransformOrientation(struct bContext *C, 
struct ReportList *repor
 void BIF_selectTransformOrientation(struct bContext *C, struct 
TransformOrientation *ts);
 void BIF_selectTransformOrientationValue(struct bContext *C, int orientation);
 
-void ED_getTransformOrientationMatrix(const struct bContext *C, float 
orientation_mat[3][3], const short around);
+void ED_getLocalTransformOrientationMatrix(const struct bContext *C, float 
orientation_mat[3][3], const short around);
+void ED_getTransformOrientationMatrix(
+const struct bContext *C, const char orientation_type, const short 
around,
+float r_orientation_mat[3][3]);
 
 int BIF_countTransformOrientation(const struct bContext *C);
 
diff --git a/source/blender/editors/space_view3d/CMakeLists.txt 
b/source/blender/editors/space_view3d/CMakeLists.txt
index 8fca2ed..e73d0cf 100644
--- a/source/blender/editors/space_view3d/CMakeLists.txt
+++ b/source/blender/editors/space_view3d/CMakeLists.txt
@@ -64,6 +64,7 @@ set(SRC
view3d_select.c
view3d_snap.c
view3d_toolbar.c
+   view3d_transform_manipulators.c
view3d_view.c
 
view3d_intern.h
diff --git a/source/blender/editors/space_view3d/space_view3d.c 
b/source/blender/editors/space_view3d/space_view3d.c
index 4526d12..f5e28df 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -488,6 +488,12 @@ static void view3d_main_region_init(wmWindowManager *wm, 
ARegion *ar)
ListBase *lb;
wmKeyMap *keymap;
 
+   if (!ar->manipulator_map) {
+   ar->manipulator_map = WM_manipulatormap_new_from_type(&(const 
struct wmManipulatorMapType_Params) {
+   "View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW});
+   }
+   WM_manipulatormap_add_handlers(ar, ar->manipulator_map);
+
/* object ops. */

/* important to be before Pose keymap since they can both be enabled at 
once */
@@ -813,7 +819,8 @@ static void view3d_main_region_listener(bScreen *sc, 
ScrArea *sa, ARegion *ar, w
 {
Scene *scene = sc->scene;
View3D *v3d = sa->spacedata.first;
-   
+   wmManipulatorMap *mmap = 

[Bf-blender-cvs] [e9268ab] blender2.8: fix narrow text entry fields

2016-10-18 Thread Mike Erwin
Commit: e9268abf4a4b1a2ca72dad6088a0847b13cf381c
Author: Mike Erwin
Date:   Tue Oct 18 17:34:29 2016 -0400
Branches: blender2.8
https://developer.blender.org/rBe9268abf4a4b1a2ca72dad6088a0847b13cf381c

fix narrow text entry fields

widget_draw_text was calculating wrong display length when field is too narrow 
to show entire input string. Gawain assert caught this 11 function calls away!

Thanks to @ianwill for reporting.

===

M   source/blender/editors/interface/interface_widgets.c

===

diff --git a/source/blender/editors/interface/interface_widgets.c 
b/source/blender/editors/interface/interface_widgets.c
index 62e676d..80fc47e 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1461,37 +1461,40 @@ static void widget_draw_text(uiFontStyle *fstyle, 
uiWidgetColors *wcol, uiBut *b
/* for underline drawing */
float font_xofs, font_yofs;
 
-   UI_fontstyle_draw_ex(fstyle, rect, drawstr + but->ofs,
-  drawstr_left_len - but->ofs, _xofs, 
_yofs);
+   int drawlen = (drawstr_left_len == INT_MAX) ? strlen(drawstr + 
but->ofs) : (drawstr_left_len - but->ofs);
 
-   if (but->menu_key != '\0') {
-   char fixedbuf[128];
-   const char *str;
+   if (drawlen > 0) {
+   UI_fontstyle_draw_ex(fstyle, rect, drawstr + but->ofs, 
drawlen, _xofs, _yofs);
 
-   BLI_strncpy(fixedbuf, drawstr + but->ofs, 
min_ii(sizeof(fixedbuf), drawstr_left_len));
+   if (but->menu_key != '\0') {
+   char fixedbuf[128];
+   const char *str;
 
-   str = strchr(fixedbuf, but->menu_key - 32); /* upper 
case */
-   if (str == NULL)
-   str = strchr(fixedbuf, but->menu_key);
+   BLI_strncpy(fixedbuf, drawstr + but->ofs, 
min_ii(sizeof(fixedbuf), drawlen));
 
-   if (str) {
-   int ul_index = -1;
-   float ul_advance;
+   str = strchr(fixedbuf, but->menu_key - 32); /* 
upper case */
+   if (str == NULL)
+   str = strchr(fixedbuf, but->menu_key);
 
-   ul_index = (int)(str - fixedbuf);
+   if (str) {
+   int ul_index = -1;
+   float ul_advance;
 
-   if (fstyle->kerning == 1) {
-   BLF_enable(fstyle->uifont_id, 
BLF_KERNING_DEFAULT);
-   }
+   ul_index = (int)(str - fixedbuf);
+
+   if (fstyle->kerning == 1) {
+   BLF_enable(fstyle->uifont_id, 
BLF_KERNING_DEFAULT);
+   }
 
-   fixedbuf[ul_index] = '\0';
-   ul_advance = BLF_width(fstyle->uifont_id, 
fixedbuf, ul_index);
+   fixedbuf[ul_index] = '\0';
+   ul_advance = 
BLF_width(fstyle->uifont_id, fixedbuf, ul_index);
 
-   BLF_position(fstyle->uifont_id, rect->xmin + 
font_xofs + ul_advance, rect->ymin + font_yofs, 0.0f);
-   BLF_draw(fstyle->uifont_id, "_", 2);
+   BLF_position(fstyle->uifont_id, 
rect->xmin + font_xofs + ul_advance, rect->ymin + font_yofs, 0.0f);
+   BLF_draw(fstyle->uifont_id, "_", 2);
 
-   if (fstyle->kerning == 1) {
-   BLF_disable(fstyle->uifont_id, 
BLF_KERNING_DEFAULT);
+   if (fstyle->kerning == 1) {
+   BLF_disable(fstyle->uifont_id, 
BLF_KERNING_DEFAULT);
+   }
}
}
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [46a0698] blender2.8: draw gpencil dots smooth

2016-10-18 Thread Mike Erwin
Commit: 46a069822a50a417fe74be100a3ce798f6ad6589
Author: Mike Erwin
Date:   Tue Oct 18 13:07:35 2016 -0400
Branches: blender2.8
https://developer.blender.org/rB46a069822a50a417fe74be100a3ce798f6ad6589

draw gpencil dots smooth

Some strokes are just single dots. Draw these smooth / antialiased.

===

M   source/blender/editors/gpencil/drawgpencil.c

===

diff --git a/source/blender/editors/gpencil/drawgpencil.c 
b/source/blender/editors/gpencil/drawgpencil.c
index 29230df..c406a0d 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -629,10 +629,10 @@ static void gp_draw_stroke_point(
unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
 
if (sflag & GP_STROKE_3DSPACE) {
-   
immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_UNIFORM_COLOR);
+   
immBindBuiltinProgram(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_SMOOTH);
}
else {
-   
immBindBuiltinProgram(GPU_SHADER_2D_POINT_FIXED_SIZE_UNIFORM_COLOR);
+   
immBindBuiltinProgram(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_SMOOTH);
 
/* get 2D coordinates of point */
float co[3] = { 0.0f };
@@ -641,9 +641,8 @@ static void gp_draw_stroke_point(
}
 
gp_set_point_uniform_color(pt, ink);
-
/* set point thickness (since there's only one of these) */
-   glPointSize((float)(thickness + 2) * pt->pressure);
+   immUniform1f("size", (float)(thickness + 2) * pt->pressure);
 
immBegin(GL_POINTS, 1);
immVertex3fv(pos, fpt);
@@ -999,6 +998,8 @@ static void gp_draw_strokes(
short sthickness;
float ink[4];
 
+   GPU_enable_program_point_size();
+
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
/* check if stroke can be drawn */
if (gp_can_draw_stroke(gps, dflag) == false) {
@@ -1161,6 +1162,8 @@ static void gp_draw_strokes(
}
}
}
+
+   GPU_disable_program_point_size();
 }
 
 /* Draw selected verts for strokes being edited */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [117af23] blender2.8: skip drawing of gpencil strokes with overall thickness <= zero

2016-10-18 Thread Mike Erwin
Commit: 117af2356a54063b294b8aacd2ba713526ef37f0
Author: Mike Erwin
Date:   Tue Oct 18 13:12:40 2016 -0400
Branches: blender2.8
https://developer.blender.org/rB117af2356a54063b294b8aacd2ba713526ef37f0

skip drawing of gpencil strokes with overall thickness <= zero

Fixes an assert in drawing code.

Might need further work to support variable-thickness strokes (from 
pressure-sensitive stylus). This all is due for geometry shader overhaul anyway.

===

M   source/blender/editors/gpencil/drawgpencil.c

===

diff --git a/source/blender/editors/gpencil/drawgpencil.c 
b/source/blender/editors/gpencil/drawgpencil.c
index c406a0d..181f85e 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -1018,6 +1018,10 @@ static void gp_draw_strokes(
/* calculate thickness */
sthickness = gps->thickness + lthick;
 
+   if (sthickness <= 0) {
+   continue;
+   }
+
/* check which stroke-drawer to use */
if (dflag & GP_DRAWDATA_ONLY3D) {
const int no_xray = (dflag & GP_DRAWDATA_NO_XRAY);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [827ad41] blender2.8: OpenGL: new built-in shader for smooth round 3D points

2016-10-18 Thread Mike Erwin
Commit: 827ad4125cf32caa32d53a3234c3ab7bd062f404
Author: Mike Erwin
Date:   Tue Oct 18 13:03:30 2016 -0400
Branches: blender2.8
https://developer.blender.org/rB827ad4125cf32caa32d53a3234c3ab7bd062f404

OpenGL: new built-in shader for smooth round 3D points

===

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_3D_point_uniform_size_smooth_vert.glsl

===

diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index e960a81..d8925b1 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -149,6 +149,7 @@ 
data_to_c_simple(shaders/gpu_shader_point_varying_color_frag.glsl SRC)
 
data_to_c_simple(shaders/gpu_shader_3D_point_fixed_size_varying_color_vert.glsl 
SRC)
 data_to_c_simple(shaders/gpu_shader_3D_point_varying_size_vert.glsl SRC)
 
data_to_c_simple(shaders/gpu_shader_3D_point_varying_size_varying_color_vert.glsl
 SRC)
+data_to_c_simple(shaders/gpu_shader_3D_point_uniform_size_smooth_vert.glsl SRC)
 
data_to_c_simple(shaders/gpu_shader_3D_point_uniform_size_outline_smooth_vert.glsl
 SRC)
 
data_to_c_simple(shaders/gpu_shader_2D_point_varying_size_varying_color_vert.glsl
 SRC)
 data_to_c_simple(shaders/gpu_shader_2D_point_uniform_size_smooth_vert.glsl SRC)
diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h
index 1fe0f6f..7a47b5a 100644
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@ -112,6 +112,7 @@ typedef enum GPUBuiltinShader {
GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR,
GPU_SHADER_3D_POINT_FIXED_SIZE_UNIFORM_COLOR,
GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR,
+   GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_SMOOTH,
GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_SMOOTH,
GPU_SHADER_3D_POINT_VARYING_SIZE_UNIFORM_COLOR,
GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR,
diff --git a/source/blender/gpu/intern/gpu_shader.c 
b/source/blender/gpu/intern/gpu_shader.c
index e8ea642..db133fd 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -69,6 +69,7 @@ extern char 
datatoc_gpu_shader_point_varying_color_frag_glsl[];
 extern char datatoc_gpu_shader_3D_point_fixed_size_varying_color_vert_glsl[];
 extern char datatoc_gpu_shader_3D_point_varying_size_vert_glsl[];
 extern char datatoc_gpu_shader_3D_point_varying_size_varying_color_vert_glsl[];
+extern char datatoc_gpu_shader_3D_point_uniform_size_smooth_vert_glsl[];
 extern char 
datatoc_gpu_shader_3D_point_uniform_size_outline_smooth_vert_glsl[];
 extern char datatoc_gpu_shader_2D_point_varying_size_varying_color_vert_glsl[];
 extern char datatoc_gpu_shader_2D_point_uniform_size_smooth_vert_glsl[];
@@ -127,6 +128,7 @@ static struct GPUShadersGlobal {
GPUShader *point_fixed_size_varying_color_3D;
GPUShader *point_varying_size_uniform_color_3D;
GPUShader *point_varying_size_varying_color_3D;
+   GPUShader *point_uniform_size_uniform_color_smooth_3D;
GPUShader *point_uniform_size_uniform_color_outline_smooth_3D;
} shaders;
 } GG = {{NULL}};
@@ -795,6 +797,14 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader 
shader)
NULL, NULL, NULL, 0, 0, 0);
retval = GG.shaders.point_varying_size_varying_color_3D;
break;
+   case GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_SMOOTH:
+   if 
(!GG.shaders.point_uniform_size_uniform_color_smooth_3D)
+   
GG.shaders.point_uniform_size_uniform_color_smooth_3D = GPU_shader_create(
+   
datatoc_gpu_shader_3D_point_uniform_size_smooth_vert_glsl,
+   
datatoc_gpu_shader_point_uniform_color_smooth_frag_glsl,
+   NULL, NULL, NULL, 0, 0, 0);
+   retval = 
GG.shaders.point_uniform_size_uniform_color_smooth_3D;
+   break;
case 
GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_SMOOTH:
if 
(!GG.shaders.point_uniform_size_uniform_color_outline_smooth_3D)

GG.shaders.point_uniform_size_uniform_color_outline_smooth_3D = 
GPU_shader_create(
@@ -1002,6 +1012,11 @@ void GPU_shader_free_builtin_shaders(void)
GG.shaders.point_varying_size_varying_color_3D = NULL;
}
 
+   if (GG.shaders.point_uniform_size_uniform_color_smooth_3D) {
+   
GPU_shader_free(GG.shaders.point_uniform_size_uniform_color_smooth_3D);
+   

[Bf-blender-cvs] [63a604e] cycles_split_kernel: Cycles: Implement enqueue_split_kernel_data_init for OpenCL devices

2016-10-18 Thread Mai Lavelle
Commit: 63a604e0cf8a43f37c2e5444d71102d345350308
Author: Mai Lavelle
Date:   Tue Oct 18 18:09:42 2016 +0200
Branches: cycles_split_kernel
https://developer.blender.org/rB63a604e0cf8a43f37c2e5444d71102d345350308

Cycles: Implement enqueue_split_kernel_data_init for OpenCL devices

The `enqueue_split_kernel_data_init()` function will allow each device type to
set up the various data buffers how ever they need to without concerning the
rest of the split kernel logic.

===

M   intern/cycles/device/device.h
M   intern/cycles/device/opencl/opencl_split.cpp
M   intern/cycles/render/buffers.cpp
M   intern/cycles/render/buffers.h

===

diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index f79678d..31dbb90 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -296,7 +296,20 @@ public:
{ return true; }
 
/* split kernel */
-   virtual bool enqueue_split_kernel_data_init()
+   virtual bool enqueue_split_kernel_data_init(const KernelDimensions& 
/*dim*/,
+   RenderTile& /*rtile*/,
+   int /*num_global_elements*/,
+   int 
/*num_parallel_samples*/,
+   device_memory& 
/*kernel_globals*/,
+   device_memory& 
/*kernel_data*/,
+   device_memory& 
/*split_data*/,
+   device_memory& 
/*ray_state*/,
+   device_memory& 
/*queue_index*/,
+   device_memory& 
/*use_queues_flag*/
+#ifdef __WORK_STEALING__
+   , device_memory& 
/*work_pool_wgs*/
+#endif
+   )
{
assert(!"not implemented for this device");
return false;
diff --git a/intern/cycles/device/opencl/opencl_split.cpp 
b/intern/cycles/device/opencl/opencl_split.cpp
index 7d8dd95..6efeb70 100644
--- a/intern/cycles/device/opencl/opencl_split.cpp
+++ b/intern/cycles/device/opencl/opencl_split.cpp
@@ -29,62 +29,6 @@
 
 CCL_NAMESPACE_BEGIN
 
-/* TODO(sergey): This is to keep tile split on OpenCL level working
- * for now, since without this view-port render does not work as it
- * should.
- *
- * Ideally it'll be done on the higher level, but we need to get ready
- * for merge rather soon, so let's keep split logic private here in
- * the file.
- */
-class SplitRenderTile : public RenderTile {
-public:
-   SplitRenderTile()
-   : RenderTile(),
- buffer_offset_x(0),
- buffer_offset_y(0),
- rng_state_offset_x(0),
- rng_state_offset_y(0),
- buffer_rng_state_stride(0) {}
-
-   explicit SplitRenderTile(RenderTile& tile)
-   : RenderTile(),
- buffer_offset_x(0),
- buffer_offset_y(0),
- rng_state_offset_x(0),
- rng_state_offset_y(0),
- buffer_rng_state_stride(0)
-   {
-   x = tile.x;
-   y = tile.y;
-   w = tile.w;
-   h = tile.h;
-   start_sample = tile.start_sample;
-   num_samples = tile.num_samples;
-   sample = tile.sample;
-   resolution = tile.resolution;
-   offset = tile.offset;
-   stride = tile.stride;
-   buffer = tile.buffer;
-   rng_state = tile.rng_state;
-   buffers = tile.buffers;
-   }
-
-   /* Split kernel is device global memory constrained;
-* hence split kernel cant render big tile size's in
-* one go. If the user sets a big tile size (big tile size
-* is a term relative to the available device global memory),
-* we split the tile further and then call path_trace on
-* each of those split tiles. The following variables declared,
-* assist in achieving that purpose
-*/
-   int buffer_offset_x;
-   int buffer_offset_y;
-   int rng_state_offset_x;
-   int rng_state_offset_y;
-   int buffer_rng_state_stride;
-};
-
 class OpenCLSplitKernelFunction : public SplitKernelFunction {
 public:
OpenCLDeviceBase* device;
@@ -346,20 +290,101 @@ public:
 #endif
}
 
+   virtual bool enqueue_split_kernel_data_init(const KernelDimensions& dim,
+   RenderTile& rtile,
+   int num_global_elements,
+   int 

[Bf-blender-cvs] [82f842c] master: [msvc] Minor cleanup in blenkernel.

2016-10-18 Thread lazydodo
Commit: 82f842c27f4ff483be0fda6c02d3a4527cc20ff2
Author: lazydodo
Date:   Tue Oct 18 09:25:14 2016 -0600
Branches: master
https://developer.blender.org/rB82f842c27f4ff483be0fda6c02d3a4527cc20ff2

[msvc] Minor cleanup in blenkernel.

this patch resolves the following warnings;

```
Warning C4028   formal parameter 1 different from declaration   
blenkernel\intern\ocean.c   764
Warning C4098   'attach_stabilization_baseline_data': 'void' function returning 
a value blenkernel\intern\tracking_stabilize.c  139
Warning C4028   formal parameter 3 different from declaration   
blenkernel\intern\cachefile.c   148
Warning C4028   formal parameter 3 different from declaration   
blenkernel\intern\paint.c   413
Warning C4028   formal parameter 1 different from declaration   
blenkernel\intern\editderivedmesh.c 591
Warning C4028   formal parameter 3 different from declaration   
blenkernel\intern\library_remap.c   709
Warning C4028   formal parameter 1 different from declaration   
blenkernel\intern\ocean.c   754
Warning C4028   formal parameter 1 different from declaration   
blenkernel\intern\ocean.c   758
Warning C4028   formal parameter 1 different from declaration   
blenkernel\intern\ocean.c   759
Warning C4028   formal parameter 1 different from declaration   
blenkernel\intern\ocean.c   763
Warning C4028   formal parameter 1 different from declaration   
blenkernel\intern\ocean.c   764
Warning C4028   formal parameter 1 different from declaration   
blenkernel\intern\ocean.c   765
Warning C4028   formal parameter 1 different from declaration   
blenkernel\intern\ocean.c   769
Warning C4028   formal parameter 1 different from declaration   
blenkernel\intern\ocean.c   770
Warning C4028   formal parameter 1 different from declaration   
blenkernel\intern\DerivedMesh.c 3458
```

It's mostly things where the signature in the .h and the actual implementation 
in the .c do not match.  And a bunch functions who do not match the 
TaskRunFunction declaration cause they leave out the __restrict keyword.

Reviewers: brecht, juicyfruit, sergey

Reviewed By: sergey

Subscribers: Blendify

Differential Revision: https://developer.blender.org/D2268

===

M   source/blender/blenkernel/BKE_cachefile.h
M   source/blender/blenkernel/BKE_library.h
M   source/blender/blenkernel/intern/DerivedMesh.c
M   source/blender/blenkernel/intern/editderivedmesh.c
M   source/blender/blenkernel/intern/ocean.c
M   source/blender/blenkernel/intern/paint.c
M   source/blender/blenkernel/intern/tracking_stabilize.c

===

diff --git a/source/blender/blenkernel/BKE_cachefile.h 
b/source/blender/blenkernel/BKE_cachefile.h
index b30143c..a55cb51 100644
--- a/source/blender/blenkernel/BKE_cachefile.h
+++ b/source/blender/blenkernel/BKE_cachefile.h
@@ -55,7 +55,7 @@ void BKE_cachefile_reload(const struct Main *bmain, struct 
CacheFile *cache_file
 
 void BKE_cachefile_ensure_handle(const struct Main *bmain, struct CacheFile 
*cache_file);
 
-void BKE_cachefile_update_frame(struct Main *bmain, struct Scene *scene, float 
ctime, const float fps);
+void BKE_cachefile_update_frame(struct Main *bmain, struct Scene *scene,const 
float ctime, const float fps);
 
 bool BKE_cachefile_filepath_get(
 const struct Main *bmain, const struct CacheFile *cache_file, float 
frame,
diff --git a/source/blender/blenkernel/BKE_library.h 
b/source/blender/blenkernel/BKE_library.h
index e49019f..0d82de0 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -64,7 +64,7 @@ struct ID *BKE_libblock_find_name(const short type, const 
char *name) ATTR_WARN_
 
 /* library_remap.c (keep here since they're general functions) */
 void  BKE_libblock_free(struct Main *bmain, void *idv) ATTR_NONNULL();
-void  BKE_libblock_free_ex(struct Main *bmain, void *idv, bool do_id_user) 
ATTR_NONNULL();
+void  BKE_libblock_free_ex(struct Main *bmain, void *idv, const bool 
do_id_user) ATTR_NONNULL();
 void  BKE_libblock_free_us(struct Main *bmain, void *idv) ATTR_NONNULL();
 void  BKE_libblock_free_data(struct Main *bmain, struct ID *id) ATTR_NONNULL();
 void  BKE_libblock_delete(struct Main *bmain, void *idv) ATTR_NONNULL();
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c 
b/source/blender/blenkernel/intern/DerivedMesh.c
index f75b3c0..ae18f52 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -3256,7 +3256,7 @@ void DM_calc_tangents_names_from_gpu(
*r_tangent_names_count = count;
 }
 
-static void DM_calc_loop_tangents_thread(TaskPool *UNUSED(pool), void 
*taskdata, int UNUSED(threadid))
+static void DM_calc_loop_tangents_thread(TaskPool * 

[Bf-blender-cvs] [3541f7c] master: [windows] Create A Blender Desktop Shortcut in the msi installer , fixes T49522

2016-10-18 Thread lazydodo
Commit: 3541f7c47d8e709731089bd139d7edc4f410f772
Author: lazydodo
Date:   Tue Oct 18 09:21:58 2016 -0600
Branches: master
https://developer.blender.org/rB3541f7c47d8e709731089bd139d7edc4f410f772

[windows] Create A Blender Desktop Shortcut in the msi installer , fixes T49522

===

M   build_files/cmake/packaging.cmake

===

diff --git a/build_files/cmake/packaging.cmake 
b/build_files/cmake/packaging.cmake
index 1563331..c7063ed 100644
--- a/build_files/cmake/packaging.cmake
+++ b/build_files/cmake/packaging.cmake
@@ -97,6 +97,8 @@ if(WIN32)
 endif()
 
 set(CPACK_PACKAGE_EXECUTABLES "blender" "blender")
+set(CPACK_CREATE_DESKTOP_LINKS "blender" "blender")
+
 include(CPack)
 
 # Target for build_archive.py script, to automatically pass along

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [70c659b] cycles_split_kernel: Cycles: Add SplitKernelFunction with OpenCL implementation

2016-10-18 Thread Mai Lavelle
Commit: 70c659b77e11ac339775fdc4f5dc30947d7f9815
Author: Mai Lavelle
Date:   Tue Oct 18 16:51:02 2016 +0200
Branches: cycles_split_kernel
https://developer.blender.org/rB70c659b77e11ac339775fdc4f5dc30947d7f9815

Cycles: Add SplitKernelFunction with OpenCL implementation

SplitKernelFunction can represent a split kernel function for any device its
been implemented for. Currently this is only for OpenCL to simplify the
enqueueing of the split kernels and move another step closer to a split
kernel that can run on any device.

===

M   intern/cycles/device/device.h
M   intern/cycles/device/opencl/opencl.h
M   intern/cycles/device/opencl/opencl_mega.cpp
M   intern/cycles/device/opencl/opencl_split.cpp

===

diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index 014e5fc..f79678d 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -190,6 +190,28 @@ public:
 std::ostream& operator <<(std::ostream ,
   const DeviceRequestedFeatures& requested_features);
 
+/* Types used for split kernel */
+
+class KernelDimensions {
+public:
+   size_t global_size[2];
+   size_t local_size[2];
+
+   KernelDimensions(size_t global_size_[2], size_t local_size_[2])
+   {
+   memcpy(global_size, global_size_, 2*sizeof(size_t));
+   memcpy(local_size, local_size_, 2*sizeof(size_t));
+   }
+};
+
+class SplitKernelFunction {
+public:
+   virtual ~SplitKernelFunction() {}
+
+   /* enqueue the kernel, returns false if there is an error */
+   virtual bool enqueue(const KernelDimensions& dim, device_memory& kg, 
device_memory& data) = 0;
+};
+
 /* Device */
 
 struct DeviceDrawParams {
@@ -273,6 +295,18 @@ public:
const DeviceRequestedFeatures& /*requested_features*/)
{ return true; }
 
+   /* split kernel */
+   virtual bool enqueue_split_kernel_data_init()
+   {
+   assert(!"not implemented for this device");
+   return false;
+   }
+   virtual SplitKernelFunction* get_split_kernel_function(string 
/*kernel_name*/, const DeviceRequestedFeatures&)
+   {
+   assert(!"not implemented for this device");
+   return NULL;
+   }
+
/* tasks */
virtual int get_split_task_count(DeviceTask& task) = 0;
virtual void task_add(DeviceTask& task) = 0;
diff --git a/intern/cycles/device/opencl/opencl.h 
b/intern/cycles/device/opencl/opencl.h
index 83603b2..dc2a5b2 100644
--- a/intern/cycles/device/opencl/opencl.h
+++ b/intern/cycles/device/opencl/opencl.h
@@ -261,7 +261,7 @@ public:
 
/* Has to be implemented by the real device classes.
 * The base device will then load all these programs. */
-   virtual void load_kernels(const DeviceRequestedFeatures& 
requested_features,
+   virtual bool load_kernels(const DeviceRequestedFeatures& 
requested_features,
  vector ) = 0;
 
void mem_alloc(device_memory& mem, MemoryType type);
@@ -417,6 +417,8 @@ protected:
 
virtual string build_options_for_base_program(
const DeviceRequestedFeatures& /*requested_features*/);
+
+   friend class OpenCLSplitKernelFunction;
 };
 
 Device *opencl_create_mega_device(DeviceInfo& info, Stats& stats, bool 
background);
diff --git a/intern/cycles/device/opencl/opencl_mega.cpp 
b/intern/cycles/device/opencl/opencl_mega.cpp
index 369c086..65feba8 100644
--- a/intern/cycles/device/opencl/opencl_mega.cpp
+++ b/intern/cycles/device/opencl/opencl_mega.cpp
@@ -39,11 +39,12 @@ public:
{
}
 
-   virtual void load_kernels(const DeviceRequestedFeatures& 
/*requested_features*/,
+   virtual bool load_kernels(const DeviceRequestedFeatures& 
/*requested_features*/,
  vector )
{
path_trace_program.add_kernel(ustring("path_trace"));
programs.push_back(_trace_program);
+   return true;
}
 
~OpenCLDeviceMegaKernel()
diff --git a/intern/cycles/device/opencl/opencl_split.cpp 
b/intern/cycles/device/opencl/opencl_split.cpp
index e1e1f54..7d8dd95 100644
--- a/intern/cycles/device/opencl/opencl_split.cpp
+++ b/intern/cycles/device/opencl/opencl_split.cpp
@@ -85,22 +85,57 @@ public:
int buffer_rng_state_stride;
 };
 
+class OpenCLSplitKernelFunction : public SplitKernelFunction {
+public:
+   OpenCLDeviceBase* device;
+   OpenCLDeviceBase::OpenCLProgram program;
+
+   OpenCLSplitKernelFunction(OpenCLDeviceBase* device) : device(device) {}
+   ~OpenCLSplitKernelFunction() { program.release(); }
+
+   virtual bool enqueue(const KernelDimensions& dim, device_memory& kg, 
device_memory& data)
+   {
+   

[Bf-blender-cvs] [7500f6c] master: Fix: Append 'Object proxy' hack checking for local/linked usages before those flags were set!

2016-10-18 Thread Bastien Montagne
Commit: 7500f6c9d98b76f3841d892e719c4959b09a4058
Author: Bastien Montagne
Date:   Tue Oct 18 14:15:59 2016 +0200
Branches: master
https://developer.blender.org/rB7500f6c9d98b76f3841d892e719c4959b09a4058

Fix: Append 'Object proxy' hack checking for local/linked usages before those 
flags were set!

Dummy mistake, to be backported to 2.78a.

===

M   source/blender/blenkernel/intern/library.c

===

diff --git a/source/blender/blenkernel/intern/library.c 
b/source/blender/blenkernel/intern/library.c
index 93bf5e1..8b09e51 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1713,6 +1713,8 @@ void BKE_library_make_local(Main *bmain, const Library 
*lib, const bool untagged
if (id->newid) {
bool is_local = false, is_lib = false;
 
+   BKE_library_ID_test_usages(bmain, id, 
_local, _lib);
+
/* Attempt to re-link copied proxy 
objects. This allows appending of an entire scene
 * from another blend file into this 
one, even when that blend file contains proxified
 * armatures that have local 
references. Since the proxified object needs to be linked
@@ -1752,7 +1754,6 @@ void BKE_library_make_local(Main *bmain, const Library 
*lib, const bool untagged
id_us_ensure_real(id->newid);
}
 
-   BKE_library_ID_test_usages(bmain, id, 
_local, _lib);
if (!is_local && !is_lib) {
BKE_libblock_free(bmain, id);
do_loop = true;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [bc8e3a3] cycles_split_kernel: Cycles: Replace use of cl_mem with device_memory in split kernel device

2016-10-18 Thread Mai Lavelle
Commit: bc8e3a3d868d19719f67ec2e5ed2d0b516a98312
Author: Mai Lavelle
Date:   Tue Oct 18 11:30:25 2016 +0200
Branches: cycles_split_kernel
https://developer.blender.org/rBbc8e3a3d868d19719f67ec2e5ed2d0b516a98312

Cycles: Replace use of cl_mem with device_memory in split kernel device

Working towards using only device agnostic types and methods in the host.

===

M   intern/cycles/device/device.h
M   intern/cycles/device/device_memory.h
M   intern/cycles/device/opencl/opencl.h
M   intern/cycles/device/opencl/opencl_split.cpp

===

diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index 77dc1fa..014e5fc 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -226,6 +226,25 @@ public:
virtual void mem_zero(device_memory& mem) = 0;
virtual void mem_free(device_memory& mem) = 0;
 
+   /* setup and allocate a device_memory object for use on device only (no 
host side buffer)*/
+   void mem_alloc(device_memory& mem, size_t size, MemoryType type = 
MEM_READ_WRITE)
+   {
+   mem.data_type = device_type_traits::data_type;
+   mem.data_elements = 1;
+   mem.data_pointer = 0;
+   mem.data_size = size;
+   mem.device_size = 0;
+   mem.data_width = size;
+   mem.data_height = 1;
+   mem.data_depth = 1;
+
+   assert(mem.data_elements > 0);
+
+   mem.device_pointer = 0;
+
+   mem_alloc(mem, type);
+   }
+
/* constant memory */
virtual void const_copy_to(const char *name, void *host, size_t size) = 
0;
 
diff --git a/intern/cycles/device/device_memory.h 
b/intern/cycles/device/device_memory.h
index 5b5b4dc..0093c93 100644
--- a/intern/cycles/device/device_memory.h
+++ b/intern/cycles/device/device_memory.h
@@ -180,10 +180,20 @@ public:
/* device pointer */
device_ptr device_pointer;
 
-protected:
-   device_memory() {}
+   device_memory() {
+   data_type = device_type_traits::data_type;
+   data_elements = device_type_traits::num_elements;
+   data_pointer = 0;
+   data_size = 0;
+   device_size = 0;
+   data_width = 0;
+   data_height = 0;
+   data_depth = 0;
+   device_pointer = 0;
+   }
virtual ~device_memory() { assert(!device_pointer); }
 
+protected:
/* no copying */
device_memory(const device_memory&);
device_memory& operator = (const device_memory&);
diff --git a/intern/cycles/device/opencl/opencl.h 
b/intern/cycles/device/opencl/opencl.h
index 30a35ac..83603b2 100644
--- a/intern/cycles/device/opencl/opencl.h
+++ b/intern/cycles/device/opencl/opencl.h
@@ -265,6 +265,7 @@ public:
  vector ) = 0;
 
void mem_alloc(device_memory& mem, MemoryType type);
+   using Device::mem_alloc;
void mem_copy_to(device_memory& mem);
void mem_copy_from(device_memory& mem, int y, int w, int h, int elem);
void mem_zero(device_memory& mem);
@@ -321,16 +322,39 @@ protected:
 
class ArgumentWrapper {
public:
-   ArgumentWrapper() : size(0), pointer(NULL) {}
-   template 
+   ArgumentWrapper() : size(0), pointer(NULL)
+   {
+   }
+
+   ArgumentWrapper(device_memory& argument) : size(sizeof(void*)),
+  
pointer((void*)(_pointer))
+   {
+   }
+
+   template
+   ArgumentWrapper(device_vector& argument) : 
size(sizeof(void*)),
+ 
pointer((void*)(_pointer))
+   {
+   }
+
+   template
ArgumentWrapper(T& argument) : size(sizeof(argument)),
-  pointer() { }
+  pointer()
+   {
+   }
+
ArgumentWrapper(int argument) : size(sizeof(int)),
int_value(argument),
-   pointer(_value) { }
+   pointer(_value)
+   {
+   }
+
ArgumentWrapper(float argument) : size(sizeof(float)),
  float_value(argument),
- pointer(_value) { }
+ pointer(_value)
+   {
+   }
+
size_t size;
int int_value;
float float_value;
diff --git 

[Bf-blender-cvs] [ab4c921] master: Clarified warning in EnumProperty

2016-10-18 Thread Sybren A. Stüvel
Commit: ab4c921e82a37d1a34879b0db7fd125749691272
Author: Sybren A. Stüvel
Date:   Tue Oct 18 11:24:33 2016 +0200
Branches: master
https://developer.blender.org/rBab4c921e82a37d1a34879b0db7fd125749691272

Clarified warning in EnumProperty

Blender doesn't necessarily crash when Python doesn't keep references to
the returned strings. As a result, someone that implements this incorrectly
could be lulled into a false sense of correctness by Blender not crashing.

===

M   source/blender/python/intern/bpy_props.c

===

diff --git a/source/blender/python/intern/bpy_props.c 
b/source/blender/python/intern/bpy_props.c
index 3baeae0..e610188 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -2648,7 +2648,8 @@ PyDoc_STRVAR(BPy_EnumProperty_doc,
 "  .. warning::\n"
 "\n"
 " There is a known bug with using a callback,\n"
-" Python must keep a reference to the strings returned or Blender will 
crash.\n"
+" Python must keep a reference to the strings returned or Blender will 
misbehave\n"
+" or even crash."
 "\n"
 "   :type items: sequence of string tuples or a function\n"
 BPY_PROPDEF_NAME_DOC

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs