[Bf-blender-cvs] [2b77b1c] master: remove double-checked conditions

2016-07-21 Thread Mike Erwin
Commit: 2b77b1ce465ab09052567a58d1b9f6a014a563cd
Author: Mike Erwin
Date:   Thu Jul 21 21:31:37 2016 -0400
Branches: master
https://developer.blender.org/rB2b77b1ce465ab09052567a58d1b9f6a014a563cd

remove double-checked conditions

Checking a condition right after we’ve checked it (and it hasn’t
changed). Most of these are trivial to understand.

split_quads in convertblender.c:
It seems quads should be processed and triangles should be marked as
not needing split. So I removed the outer vlr->v4 check.

Found with PVS-Studio T48917

===

M   source/blender/blenkernel/intern/sequencer.c
M   source/blender/editors/mesh/editmesh_rip.c
M   source/blender/editors/sculpt_paint/paint_vertex.c
M   source/blender/editors/transform/transform_conversions.c
M   source/blender/render/intern/source/convertblender.c

===

diff --git a/source/blender/blenkernel/intern/sequencer.c 
b/source/blender/blenkernel/intern/sequencer.c
index 2f497d8..6067a8b 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -3558,7 +3558,7 @@ static ImBuf *seq_render_strip(
 
if (ibuf == NULL) {
/* MOVIECLIPs have their own proxy management */
-   if (ibuf == NULL && seq->type != 
SEQ_TYPE_MOVIECLIP) {
+   if (seq->type != SEQ_TYPE_MOVIECLIP) {
ibuf = seq_proxy_fetch(context, seq, 
cfra);
is_proxy_image = (ibuf != NULL);
}
diff --git a/source/blender/editors/mesh/editmesh_rip.c 
b/source/blender/editors/mesh/editmesh_rip.c
index 2cdb002..e31e409 100644
--- a/source/blender/editors/mesh/editmesh_rip.c
+++ b/source/blender/editors/mesh/editmesh_rip.c
@@ -748,10 +748,8 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator 
*op, const wmEvent *eve
}
 
if (do_fill) {
-   if (do_fill) {
-   /* match extrude vert-order */
-   BM_edge_create(bm, vout[1], vout[0], 
NULL, BM_CREATE_NOP);
-   }
+   /* match extrude vert-order */
+   BM_edge_create(bm, vout[1], vout[0], NULL, 
BM_CREATE_NOP);
}
 
MEM_freeN(vout);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c 
b/source/blender/editors/sculpt_paint/paint_vertex.c
index 7b29647..991025a 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -257,9 +257,7 @@ static bool make_vertexcol(Object *ob)  /* single ob */
 
/* copies from shadedisplist to mcol */
if (!me->mloopcol && me->totloop) {
-   if (!me->mloopcol) {
-   CustomData_add_layer(&me->ldata, CD_MLOOPCOL, 
CD_DEFAULT, NULL, me->totloop);
-   }
+   CustomData_add_layer(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, 
me->totloop);
BKE_mesh_update_customdata_pointers(me, true);
}
 
diff --git a/source/blender/editors/transform/transform_conversions.c 
b/source/blender/editors/transform/transform_conversions.c
index fc32613..b7456fa 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -5273,13 +5273,9 @@ static void ObjectToTransData(TransInfo *t, TransData 
*td, Object *ob)
skip_invert = true;
 
if (skip_invert == false && constinv == false) {
-   if (constinv == false)
-   ob->transflag |= OB_NO_CONSTRAINTS;  /* 
BKE_object_where_is_calc_time checks this */
-   
+   ob->transflag |= OB_NO_CONSTRAINTS;  /* 
BKE_object_where_is_calc_time checks this */
BKE_object_where_is_calc(t->scene, ob);
-   
-   if (constinv == false)
-   ob->transflag &= ~OB_NO_CONSTRAINTS;
+   ob->transflag &= ~OB_NO_CONSTRAINTS;
}
else
BKE_object_where_is_calc(t->scene, ob);
diff --git a/source/blender/render/intern/source/convertblender.c 
b/source/blender/render/intern/source/convertblender.c
index ab828a0..86961cdd 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -4192,7 +4192,7 @@ static void split_quads(ObjectRen *obr, int dir)
vlr= RE_findOrAddVlak(obr, a);

/* test if rendering as a quad or triangle, skip wire */
-   if (vlr->v4 && (vlr->flag & R_STRAND)==0 && 
(vlr->mat->material_type != MA_TYPE_W

[Bf-blender-cvs] [a7e742f] master: use bool consistently, fix redundant conditional

2016-07-21 Thread Mike Erwin
Commit: a7e742f9c4abd7ebdc05d1d1356350a6ec0e109a
Author: Mike Erwin
Date:   Fri Jul 22 02:17:25 2016 -0400
Branches: master
https://developer.blender.org/rBa7e742f9c4abd7ebdc05d1d1356350a6ec0e109a

use bool consistently, fix redundant conditional

Redundant conditional (line 939) found with PVS-Studio T48917

There’s still a lot of true/false, 1/0, SELECT/DESELECT usage nearby.
Not a problem, just confusing to read.

===

M   source/blender/editors/curve/editcurve_select.c

===

diff --git a/source/blender/editors/curve/editcurve_select.c 
b/source/blender/editors/curve/editcurve_select.c
index a292662..cad7044 100644
--- a/source/blender/editors/curve/editcurve_select.c
+++ b/source/blender/editors/curve/editcurve_select.c
@@ -294,11 +294,11 @@ static void select_adjacent_cp(
if (next < 0) bezt = &nu->bezt[a - 1];
while (a--) {
if (a - abs(next) < 0) break;
-   if ((lastsel == 0) && (bezt->hide == 0) && 
((bezt->f2 & SELECT) || (selstatus == DESELECT))) {
+   if ((lastsel == false) && (bezt->hide == 0) && 
((bezt->f2 & SELECT) || (selstatus == DESELECT))) {
bezt += next;
if (!(bezt->f2 & SELECT) || (selstatus 
== DESELECT)) {
-   short sel = 
select_beztriple(bezt, selstatus, SELECT, VISIBLE);
-   if ((sel == 1) && (cont == 0)) 
lastsel = true;
+   bool sel = 
select_beztriple(bezt, selstatus, SELECT, VISIBLE);
+   if (sel && !cont) lastsel = 
true;
}
}
else {
@@ -315,11 +315,11 @@ static void select_adjacent_cp(
if (next < 0) bp = &nu->bp[a - 1];
while (a--) {
if (a - abs(next) < 0) break;
-   if ((lastsel == 0) && (bp->hide == 0) && 
((bp->f1 & SELECT) || (selstatus == DESELECT))) {
+   if ((lastsel == false) && (bp->hide == 0) && 
((bp->f1 & SELECT) || (selstatus == DESELECT))) {
bp += next;
if (!(bp->f1 & SELECT) || (selstatus == 
DESELECT)) {
-   short sel = select_bpoint(bp, 
selstatus, SELECT, VISIBLE);
-   if ((sel == 1) && (cont == 0)) 
lastsel = true;
+   bool sel = select_bpoint(bp, 
selstatus, SELECT, VISIBLE);
+   if (sel && !cont) lastsel = 
true;
}
}
else {
@@ -820,7 +820,7 @@ static int select_less_exec(bContext *C, wmOperator 
*UNUSED(op))
BezTriple *bezt;
int a;
int sel = 0;
-   short lastsel = false;
+   bool lastsel = false;
 
if (obedit->type == OB_SURF) {
for (nu = editnurb->first; nu; nu = nu->next) {
@@ -935,9 +935,8 @@ static int select_less_exec(bContext *C, wmOperator 
*UNUSED(op))
a = nu->pntsu * nu->pntsv;
bp = nu->bp;
while (a--) {
-   if ((lastsel == 0) && (bp->hide == 0) 
&& (bp->f1 & SELECT)) {
-   if (lastsel != 0) sel = 1;
-   else sel = 0;
+   if ((lastsel == false) && (bp->hide == 
0) && (bp->f1 & SELECT)) {
+   sel = 0;
 
/* first and last are 
exceptions */
if (a == nu->pntsu * nu->pntsv 
- 1) {

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


[Bf-blender-cvs] [bd52875] master: Add Subdivide Edge-Ring to menu

2016-07-21 Thread Campbell Barton
Commit: bd52875dd67ea907273730c686d849828240e7b3
Author: Campbell Barton
Date:   Fri Jul 22 15:50:41 2016 +1000
Branches: master
https://developer.blender.org/rBbd52875dd67ea907273730c686d849828240e7b3

Add Subdivide Edge-Ring to menu

===

M   release/scripts/startup/bl_ui/space_view3d.py

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 5e8eaf5..fdf0996 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -2472,6 +2472,7 @@ class VIEW3D_MT_edit_mesh_edges(Menu):
 
 layout.operator("mesh.edge_face_add")
 layout.operator("mesh.subdivide")
+layout.operator("mesh.subdivide_edgering")
 layout.operator("mesh.unsubdivide")
 
 layout.separator()

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


[Bf-blender-cvs] [192df29] master: Fix T48926: Subdivide edge-ring crash

2016-07-21 Thread Campbell Barton
Commit: 192df299d946c5c4748490153c018661f2d9a5ee
Author: Campbell Barton
Date:   Fri Jul 22 15:41:56 2016 +1000
Branches: master
https://developer.blender.org/rB192df299d946c5c4748490153c018661f2d9a5ee

Fix T48926: Subdivide edge-ring crash

Also resolves: T34294

===

M   source/blender/bmesh/operators/bmo_subdivide_edgering.c

===

diff --git a/source/blender/bmesh/operators/bmo_subdivide_edgering.c 
b/source/blender/bmesh/operators/bmo_subdivide_edgering.c
index b4a77bf..ce031e1 100644
--- a/source/blender/bmesh/operators/bmo_subdivide_edgering.c
+++ b/source/blender/bmesh/operators/bmo_subdivide_edgering.c
@@ -1099,7 +1099,8 @@ void bmo_subdivide_edgering_exec(BMesh *bm, BMOperator 
*op)
BMFace *f;
 
BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) {
-   if (!BMO_face_flag_test(bm, f, FACE_OUT)) {
+   /* could support ngons, other areas would need updating 
too, see T48926. */
+   if ((f->len <= 4) && !BMO_face_flag_test(bm, f, 
FACE_OUT)) {
BMIter liter;
BMLoop *l;
bool ok = false;

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


[Bf-blender-cvs] [d572da5] soc-2016-multiview: Merge branch 'master' into soc-2016-multiview

2016-07-21 Thread Tianwei Shen
Commit: d572da5b12cda9489c2ff787b79d79d60a9ba0f0
Author: Tianwei Shen
Date:   Thu Jul 21 19:43:35 2016 +0800
Branches: soc-2016-multiview
https://developer.blender.org/rBd572da5b12cda9489c2ff787b79d79d60a9ba0f0

Merge branch 'master' into soc-2016-multiview

===



===



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


[Bf-blender-cvs] [929e969] soc-2016-multiview: trying to shift window for secondary clip

2016-07-21 Thread Tianwei Shen
Commit: 929e9694f4e4740e2301e1e996d9c466d24da58c
Author: Tianwei Shen
Date:   Fri Jul 22 11:43:50 2016 +0800
Branches: soc-2016-multiview
https://developer.blender.org/rB929e9694f4e4740e2301e1e996d9c466d24da58c

trying to shift window for secondary clip

===

M   source/blender/editors/space_clip/clip_draw.c
M   source/blender/editors/space_clip/space_clip.c

===

diff --git a/source/blender/editors/space_clip/clip_draw.c 
b/source/blender/editors/space_clip/clip_draw.c
index 455afb7..99e1202 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -1750,7 +1750,71 @@ void clip_draw_main(const bContext *C, SpaceClip *sc, 
ARegion *ar)
 
 void clip_draw_secondary_clip(const bContext *C, SpaceClip *sc, ARegion *ar)
 {
+   MovieClip *sclip = ED_space_clip_get_secondary_clip(sc);
+   Scene *scene = CTX_data_scene(C);
+   ImBuf *ibuf = NULL;
+   int width, height;
+   float zoomx, zoomy;
+
+   ED_space_clip_get_size(sc, &width, &height);
+   ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
+
+   /* if no clip, nothing to do */
+   if (!sclip) {
+   ED_region_grid_draw(ar, zoomx, zoomy);
+   return;
+   }
+
+   if (sc->flag & SC_SHOW_STABLE) {
+   float translation[2];
+   float aspect = sclip->tracking.camera.pixel_aspect;
+   float smat[4][4], ismat[4][4];
+
+   if ((sc->flag & SC_MUTE_FOOTAGE) == 0) {
+   ibuf = ED_space_clip_get_stable_buffer(sc, sc->loc,
+  &sc->scale, 
&sc->angle);
+   }
 
+   if (ibuf != NULL && width != ibuf->x)
+   mul_v2_v2fl(translation, sc->loc, (float)width / 
ibuf->x);
+   else
+   copy_v2_v2(translation, sc->loc);
+
+   BKE_tracking_stabilization_data_to_mat4(width, height, aspect, 
translation,
+   sc->scale, sc->angle, 
sc->stabmat);
+
+   unit_m4(smat);
+   smat[0][0] = 1.0f / width;
+   smat[1][1] = 1.0f / height;
+   invert_m4_m4(ismat, smat);
+
+   mul_m4_series(sc->unistabmat, smat, sc->stabmat, ismat);
+   }
+   else if ((sc->flag & SC_MUTE_FOOTAGE) == 0) {
+   ibuf = ED_space_clip_get_buffer(sc);
+
+   zero_v2(sc->loc);
+   sc->scale = 1.0f;
+   unit_m4(sc->stabmat);
+   unit_m4(sc->unistabmat);
+   }
+
+   if (ibuf) {
+   draw_movieclip_buffer(C, sc, ar, ibuf, width, height, zoomx, 
zoomy);
+   IMB_freeImBuf(ibuf);
+   }
+   else if (sc->flag & SC_MUTE_FOOTAGE) {
+   draw_movieclip_muted(ar, width, height, zoomx, zoomy);
+   }
+   else {
+   ED_region_grid_draw(ar, zoomx, zoomy);
+   }
+
+   if (width && height) {
+   draw_stabilization_border(sc, ar, width, height, zoomx, zoomy);
+   draw_tracking_tracks(sc, scene, ar, sclip, width, height, 
zoomx, zoomy);
+   draw_distortion(sc, ar, sclip, width, height, zoomx, zoomy);
+   }
 }
 
 void clip_draw_cache_and_notes(const bContext *C, SpaceClip *sc, ARegion *ar)
diff --git a/source/blender/editors/space_clip/space_clip.c 
b/source/blender/editors/space_clip/space_clip.c
index bf36cbb..8189494 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -1143,6 +1143,53 @@ static void movieclip_main_area_set_view2d(const 
bContext *C, ARegion *ar)
ar->v2d.cur.ymax /= h;
 }
 
+/* sets up the fields of the View2D from zoom and offset for secondary clip in 
correspondence mode*/
+static void movieclip_secondary_clip_set_view2d(const bContext *C, ARegion *ar)
+{
+   SpaceClip *sc = CTX_wm_space_clip(C);
+   float x1, y1, w, h, aspx, aspy;
+   int width, height, winx, winy;
+
+   ED_space_clip_get_size(sc, &width, &height);
+   ED_space_clip_get_aspect(sc, &aspx, &aspy);
+
+   w = width * aspx;
+   h = height * aspy;
+
+   winx = BLI_rcti_size_x(&ar->winrct) + 1;
+   winy = BLI_rcti_size_y(&ar->winrct) + 1;
+
+   ar->v2d.tot.xmin = 0;
+   ar->v2d.tot.ymin = 0;
+   ar->v2d.tot.xmax = w;
+   ar->v2d.tot.ymax = h;
+
+   ar->v2d.mask.xmin = ar->v2d.mask.ymin = 0;
+   ar->v2d.mask.xmax = winx;
+   ar->v2d.mask.ymax = winy;
+
+   /* which part of the image space do we see? */
+   x1 = ar->winrct.xmin + (winx - sc->zoom * w) / 2.0f;
+   y1 = ar->winrct.ymin + (winy - sc->zoom * h) / 2.0f;
+
+   x1 -= sc->zoom * sc->xof;
+   y1 -= sc->zoom * sc->yof;
+
+   /* relative display right */
+   ar->v2d.cur.xmin = (ar->winrct.xmin 

[Bf-blender-cvs] [c10b484] cycles_disney_brdf: Rollback attempt to fix sss crashing, it prevented crash by disabling sss completely, thus useless

2016-07-21 Thread Jens Verwiebe
Commit: c10b484dcad3412c34455736e9656cd38716bcb0
Author: Jens Verwiebe
Date:   Fri Jul 22 01:15:21 2016 +0200
Branches: cycles_disney_brdf
https://developer.blender.org/rBc10b484dcad3412c34455736e9656cd38716bcb0

Rollback attempt to fix sss crashing, it prevented crash by disabling sss 
completely, thus useless

===

M   intern/cycles/kernel/svm/svm_closure.h

===

diff --git a/intern/cycles/kernel/svm/svm_closure.h 
b/intern/cycles/kernel/svm/svm_closure.h
index 2b1a081..64a290d 100644
--- a/intern/cycles/kernel/svm/svm_closure.h
+++ b/intern/cycles/kernel/svm/svm_closure.h
@@ -187,13 +187,6 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, 
ShaderData *sd, float *
float3 weight = sc->weight;
float sample_weight = sc->sample_weight;
 
-#ifdef __BSDF_DISNEY_DIFFUSE__
-#  ifndef __SPLIT_KERNEL__
-#define sc_next(sc) sc++
-#  else
-#define sc_next(sc) sc = ccl_fetch_array(sd, closure, ccl_fetch(sd, 
num_closure))
-#  endif
-
/* subsurface */
float3 albedo = baseColor;
float3 subsurf_weight = baseColor * sc->weight * 
mix_weight * subsurface * diffuse_weight;
@@ -222,7 +215,6 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, 
ShaderData *sd, float *
ccl_fetch(sd, flag) |= bssrdf_setup(sc, 
(ClosureType)CLOSURE_BSSRDF_BURLEY_ID);
 
ccl_fetch(sd, num_closure)++;
-   sc_next(sc);
}
 
if (fabsf(subsurf_weight.y) > 0.0f) {
@@ -241,7 +233,6 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, 
ShaderData *sd, float *
ccl_fetch(sd, flag) |= bssrdf_setup(sc, 
(ClosureType)CLOSURE_BSSRDF_BURLEY_ID);
 
ccl_fetch(sd, num_closure)++;
-   sc_next(sc);
}
 
if (fabsf(subsurf_weight.z) > 0.0f) {
@@ -260,13 +251,9 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, 
ShaderData *sd, float *
ccl_fetch(sd, flag) |= bssrdf_setup(sc, 
(ClosureType)CLOSURE_BSSRDF_BURLEY_ID);
 
ccl_fetch(sd, num_closure)++;
-   sc_next(sc);
}
}
 
-#  undef sc_next
-#endif // __BSDF_DISNEY_DIFFUSE__
-
/* diffuse */
if (metallic < 1.0f) {
if (ccl_fetch(sd, num_closure) < MAX_CLOSURE) {

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


[Bf-blender-cvs] [9ff8d4a] master: fix enum type / values mismatch

2016-07-21 Thread Mike Erwin
Commit: 9ff8d4a9578619786a39abfd40174e227df38152
Author: Mike Erwin
Date:   Thu Jul 21 18:26:54 2016 -0400
Branches: master
https://developer.blender.org/rB9ff8d4a9578619786a39abfd40174e227df38152

fix enum type / values mismatch

Found with PVS-Studio T48917

===

M   source/blender/editors/space_outliner/outliner_tools.c

===

diff --git a/source/blender/editors/space_outliner/outliner_tools.c 
b/source/blender/editors/space_outliner/outliner_tools.c
index 111e60e..e38886a 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -1345,7 +1345,7 @@ static int outliner_lib_operation_exec(bContext *C, 
wmOperator *op)
Scene *scene = CTX_data_scene(C);
SpaceOops *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
-   eOutlinerIdOpTypes event;
+   eOutlinerLibOpTypes event;
 
/* check for invalid states */
if (soops == NULL)

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


[Bf-blender-cvs] [08e1bba] master: fix confusing operator precedence

2016-07-21 Thread Mike Erwin
Commit: 08e1bba10c17fb0733b1795447f6c95a4318bdca
Author: Mike Erwin
Date:   Thu Jul 21 18:52:44 2016 -0400
Branches: master
https://developer.blender.org/rB08e1bba10c17fb0733b1795447f6c95a4318bdca

fix confusing operator precedence

Assigning within a conditional is confusing and error prone so I
rewrote in a more straightforward way.

Found with PVS-Studio T48917

===

M   source/blender/blenfont/intern/blf_font.c

===

diff --git a/source/blender/blenfont/intern/blf_font.c 
b/source/blender/blenfont/intern/blf_font.c
index dfebaec..44a1d08 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -370,12 +370,10 @@ static void blf_font_draw_buffer_ex(
fbuf[3] = 1.0f;
}
else {
-   float alphatest;
fbuf[0] = 
(b_col_float[0] * a) + (fbuf[0] * (1.0f - a));
fbuf[1] = 
(b_col_float[1] * a) + (fbuf[1] * (1.0f - a));
fbuf[2] = 
(b_col_float[2] * a) + (fbuf[2] * (1.0f - a));
-   fbuf[3] = 
(alphatest = (fbuf[3] + a)) < 1.0f ?
- 
alphatest : 1.0f;
+   fbuf[3] = 
MIN2(fbuf[3] + a, 1.0f); /* clamp to 1.0 */
}
}
}
@@ -407,12 +405,10 @@ static void blf_font_draw_buffer_ex(
cbuf[3] = 255;
}
else {
-   int alphatest;
cbuf[0] = 
(unsigned char)((b_col_char[0] * a) + (cbuf[0] * (1.0f - a)));
cbuf[1] = 
(unsigned char)((b_col_char[1] * a) + (cbuf[1] * (1.0f - a)));
cbuf[2] = 
(unsigned char)((b_col_char[2] * a) + (cbuf[2] * (1.0f - a)));
-   cbuf[3] = 
(unsigned char)(((alphatest = ((int)cbuf[3] + (int)(a * 255))) < 255) ?
- 
alphatest : 255);
+   cbuf[3] = 
(unsigned char)MIN2((int)cbuf[3] + (int)(a * 255), 255); /* clamp to 255 */
}
}
}

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


[Bf-blender-cvs] [7c99b71] master: fix null pointer dereferences

2016-07-21 Thread Mike Erwin
Commit: 7c99b7110e89636e16035e10ee2795a192295024
Author: Mike Erwin
Date:   Thu Jul 21 18:15:54 2016 -0400
Branches: master
https://developer.blender.org/rB7c99b7110e89636e16035e10ee2795a192295024

fix null pointer dereferences

Found with PVS-Studio T48917

===

M   source/blender/blenkernel/intern/tracking_util.c
M   source/blender/freestyle/intern/view_map/Functions1D.cpp

===

diff --git a/source/blender/blenkernel/intern/tracking_util.c 
b/source/blender/blenkernel/intern/tracking_util.c
index a40e4f7..a90b1de 100644
--- a/source/blender/blenkernel/intern/tracking_util.c
+++ b/source/blender/blenkernel/intern/tracking_util.c
@@ -762,8 +762,8 @@ static ImBuf *accessor_get_ibuf(TrackingImageAccessor 
*accessor,
final_ibuf = IMB_dupImBuf(orig_ibuf);
}
IMB_scaleImBuf(final_ibuf,
-  ibuf->x / (1 << downscale),
-  ibuf->y / (1 << downscale));
+  orig_ibuf->x / (1 << downscale),
+  orig_ibuf->y / (1 << downscale));
}
 
if (transform != NULL) {
@@ -780,7 +780,7 @@ static ImBuf *accessor_get_ibuf(TrackingImageAccessor 
*accessor,
}
 
if (input_mode == LIBMV_IMAGE_MODE_RGBA) {
-   BLI_assert(ibuf->channels == 3 || ibuf->channels == 4);
+   BLI_assert(orig_ibuf->channels == 3 || orig_ibuf->channels == 
4);
/* pass */
}
else /* if (input_mode == LIBMV_IMAGE_MODE_MONO) */ {
diff --git a/source/blender/freestyle/intern/view_map/Functions1D.cpp 
b/source/blender/freestyle/intern/view_map/Functions1D.cpp
index 11e0cc3..8f16f78 100644
--- a/source/blender/freestyle/intern/view_map/Functions1D.cpp
+++ b/source/blender/freestyle/intern/view_map/Functions1D.cpp
@@ -104,7 +104,7 @@ int QuantitativeInvisibilityF1D::operator()(Interface1D& 
inter)
}
FEdge *fe = dynamic_cast(&inter);
if (fe) {
-   result = ve->qi();
+   result = fe->qi();
return 0;
}
result = integrate(_func, inter.verticesBegin(), inter.verticesEnd(), 
_integration);

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


[Bf-blender-cvs] [23f1b20] master: fix comparison of identicals

2016-07-21 Thread Mike Erwin
Commit: 23f1b2073f4a98256dc368fccb9603295d04fa6a
Author: Mike Erwin
Date:   Thu Jul 21 18:14:58 2016 -0400
Branches: master
https://developer.blender.org/rB23f1b2073f4a98256dc368fccb9603295d04fa6a

fix comparison of identicals

Some of these check that dimensions match before running code that
assumes they do match.

For imb_stereo3d_write_anaglyph I *assume* this change reflects the
intended behavior. Before it was always grabbing alpha from buffer 0.

Found with PVS-Studio T48917

===

M   intern/libmv/libmv/numeric/numeric.cc
M   source/blender/imbuf/intern/filter.c
M   source/blender/imbuf/intern/stereoimbuf.c

===

diff --git a/intern/libmv/libmv/numeric/numeric.cc 
b/intern/libmv/libmv/numeric/numeric.cc
index 9007663..3fc1e3b 100644
--- a/intern/libmv/libmv/numeric/numeric.cc
+++ b/intern/libmv/libmv/numeric/numeric.cc
@@ -109,7 +109,7 @@ void MeanAndVarianceAlongRows(const Mat &A,
 }
 
 void HorizontalStack(const Mat &left, const Mat &right, Mat *stacked) {
-  assert(left.rows() == left.rows());
+  assert(left.rows() == right.rows());
   int n = left.rows();
   int m1 = left.cols();
   int m2 = right.cols();
diff --git a/source/blender/imbuf/intern/filter.c 
b/source/blender/imbuf/intern/filter.c
index 26ced49..1987c6d 100644
--- a/source/blender/imbuf/intern/filter.c
+++ b/source/blender/imbuf/intern/filter.c
@@ -206,7 +206,7 @@ void imb_filterx(struct ImBuf *ibuf)
 static void imb_filterN(ImBuf *out, ImBuf *in)
 {
BLI_assert(out->channels == in->channels);
-   BLI_assert(out->x == in->x && out->y == out->y);
+   BLI_assert(out->x == in->x && out->y == in->y);
 
const int channels = in->channels;
const int rowlen = in->x;
diff --git a/source/blender/imbuf/intern/stereoimbuf.c 
b/source/blender/imbuf/intern/stereoimbuf.c
index a55cef6..a441844 100644
--- a/source/blender/imbuf/intern/stereoimbuf.c
+++ b/source/blender/imbuf/intern/stereoimbuf.c
@@ -117,7 +117,7 @@ static void imb_stereo3d_write_anaglyph(Stereo3DData *s3d, 
enum eStereo3dAnaglyp
to[0] = from[r][0];
to[1] = from[g][1];
to[2] = from[b][2];
-   to[3] = MAX2(from[0][3], from[0][3]);
+   to[3] = MAX2(from[0][3], from[1][3]);
}
}
}
@@ -154,7 +154,7 @@ static void imb_stereo3d_write_anaglyph(Stereo3DData *s3d, 
enum eStereo3dAnaglyp
to[0] = from[r][0];
to[1] = from[g][1];
to[2] = from[b][2];
-   to[3] = MAX2(from[0][3], from[0][3]);
+   to[3] = MAX2(from[0][3], from[1][3]);
}
}
}

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


[Bf-blender-cvs] [432e811] gsoc2016-improved_extrusion: Curves: Trim operator

2016-07-21 Thread João Araújo
Commit: 432e811eacc67171a62377b90d55d00166927f87
Author: João Araújo
Date:   Thu Jul 21 22:43:21 2016 +0100
Branches: gsoc2016-improved_extrusion
https://developer.blender.org/rB432e811eacc67171a62377b90d55d00166927f87

Curves: Trim operator

The trim operator works fine in 1/3 cases.

===

M   source/blender/editors/curve/editcurve.c

===

diff --git a/source/blender/editors/curve/editcurve.c 
b/source/blender/editors/curve/editcurve.c
index 4ff2e41..47b4c04 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -6938,7 +6938,7 @@ static float ratio_to_segment(float *x, float *p1, float 
*p2, float *p3, float *
 
for (int i = 0; i < res; i++) {
if (is_between(x, &seg[3 * i], &seg[3 * (i + 1)])) {
-   length = len_v2v2(&seg[3 * i], x);
+   length += len_v2v2(&seg[3 * i], x);
MEM_freeN(seg);
return length/seg_length;
}
@@ -7015,21 +7015,15 @@ static void split_segment(float t, float *p1, float 
*p2, float *p3, float *p4,
 static void chop(float *x, float *p1, float *p2, float *p3, float *p4, int res,
 float *r_s1, float *r_s2)
 {
-   float ratio = ratio_to_segment(x, p1, p2, p3, p4, res), *s1, *s2;
-
-   s1 = (float *)MEM_callocN(4 * 3 * sizeof(float), "chop1"); // All this 
s1 and s2 junk is useless
-   s2 = (float *)MEM_callocN(4 * 3 * sizeof(float), "chop2"); // Delete it 
all after fixing the memory leaks
+   float ratio = ratio_to_segment(x, p1, p2, p3, p4, res);
 
if (ratio != 0) {
split_segment(ratio, p1, p2, p3, p4, r_s1, r_s2);
}
else
{
-   s1 = s2 = NULL;
+   r_s1 = r_s2 = NULL;
}
-
-   MEM_freeN(s1);
-   MEM_freeN(s2);
 }
 
 static int trim_curve_exec(bContext *C, wmOperator *op)
@@ -7149,7 +7143,7 @@ static int trim_curve_exec(bContext *C, wmOperator *op)
new_spl->bezt[new_spl->pntsu - 1].h2 = HD_FREE;
new_spl->bezt[new_spl->pntsu - 2].h1 = HD_FREE;
new_spl->bezt[new_spl->pntsu - 2].h2 = HD_FREE;
-   copy_v3_v3(new_spl->bezt[new_spl->pntsu - 1].vec[1], ((XShape 
*)((LinkData *)low->first)->data)->intersections);
+   copy_v3_v3(new_spl->bezt[new_spl->pntsu - 1].vec[1], ((XShape 
*)((LinkData *)low->last)->data)->intersections);
copy_v3_v3(new_spl->bezt[new_spl->pntsu - 2].vec[2], s1 + 3);
copy_v3_v3(new_spl->bezt[new_spl->pntsu - 1].vec[0], s1 + 6);
copy_v3_v3(new_spl->bezt[new_spl->pntsu - 1].vec[2], s2 + 3);
@@ -7166,7 +7160,7 @@ static int trim_curve_exec(bContext *C, wmOperator *op)
new_spl->bezt[0].h2 = HD_FREE;
new_spl->bezt[1].h1 = HD_FREE;
new_spl->bezt[1].h2 = HD_FREE;
-   copy_v3_v3(new_spl->bezt[0].vec[1], ((XShape *)((LinkData 
*)low->first)->data)->intersections);
+   copy_v3_v3(new_spl->bezt[0].vec[1], ((XShape *)((LinkData 
*)high->first)->data)->intersections);
copy_v3_v3(new_spl->bezt[0].vec[0], s3 + 6);
copy_v3_v3(new_spl->bezt[0].vec[2], s4 + 3);
copy_v3_v3(new_spl->bezt[1].vec[0], s4 + 6);
@@ -7181,8 +7175,8 @@ static int trim_curve_exec(bContext *C, wmOperator *op)
if (len_low > 0 && len_high == 0) {
int low_last_order = ((XShape *)((LinkData 
*)low->last)->data)->order;
Nurb *new_spl = BKE_nurb_duplicate(nu);
-   new_spl->bezt = (BezTriple 
*)MEM_callocN((low_last_order + 1) * sizeof(BezTriple), "trimexec5");
-   new_spl->pntsu = low_last_order + 1;
+   // new_spl->bezt = (BezTriple 
*)MEM_callocN((low_last_order + 1) * sizeof(BezTriple), "trimexec5");
+   new_spl->pntsu = low_last_order + 2;
BezTriple *bezt = new_spl->bezt;
BezTriple *old_bezt = nu->bezt;
for (int i = 0; i < new_spl->pntsu; i++) {
@@ -7204,7 +7198,7 @@ static int trim_curve_exec(bContext *C, wmOperator *op)
new_spl->bezt[new_spl->pntsu - 1].h2 = HD_FREE;
new_spl->bezt[new_spl->pntsu - 2].h1 = HD_FREE;
new_spl->bezt[new_spl->pntsu - 2].h2 = HD_FREE;
-   copy_v3_v3(new_spl->bezt[new_spl->pntsu - 1].vec[1], 
((XShape *)((LinkData *)low->first)->data)->intersections);
+   copy_v3_v3(new_spl->bezt[new_spl->pntsu - 1].vec[1], 
((XShape *)((LinkData *)low->last)->data)->intersections);
copy_v3_v3(new_spl->bezt[new_spl->pntsu - 2].vec[2], s1 
+ 3);
copy_v3_v3(new_spl->bezt[n

[Bf-blender-cvs] [d1f9342] master: Cleanup: pass pointer to texture draw state

2016-07-21 Thread Campbell Barton
Commit: d1f9342e37c3ead139559249b8a2cb35fdabad55
Author: Campbell Barton
Date:   Fri Jul 22 07:33:29 2016 +1000
Branches: master
https://developer.blender.org/rBd1f9342e37c3ead139559249b8a2cb35fdabad55

Cleanup: pass pointer to texture draw state

===

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

===

diff --git a/source/blender/editors/space_view3d/drawmesh.c 
b/source/blender/editors/space_view3d/drawmesh.c
index 791ece1..f5289a0 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -237,7 +237,9 @@ static struct TextureDrawState {
bool texpaint_material; /* use material slots for texture painting */
 } Gtexdraw = {NULL, NULL, NULL, false, 0, 0, 0, false, false, {0, 0, 0, 0}, 
false, false};
 
-static bool set_draw_settings_cached(int clearcache, MTexPoly *texface, 
Material *ma, struct TextureDrawState gtexdraw)
+static bool set_draw_settings_cached(
+int clearcache, MTexPoly *texface, Material *ma,
+const struct TextureDrawState *gtexdraw)
 {
static Material *c_ma;
static int c_textured;
@@ -253,7 +255,7 @@ static bool set_draw_settings_cached(int clearcache, 
MTexPoly *texface, Material
int lit = 0;
int has_texface = texface != NULL;
bool need_set_tpage = false;
-   bool texpaint = ((gtexdraw.ob->mode & OB_MODE_TEXTURE_PAINT) != 0);
+   bool texpaint = ((gtexdraw->ob->mode & OB_MODE_TEXTURE_PAINT) != 0);
 
Image *ima = NULL;
 
@@ -271,16 +273,18 @@ static bool set_draw_settings_cached(int clearcache, 
MTexPoly *texface, Material
c_ma = NULL;
}
else {
-   textured = gtexdraw.is_tex;
+   textured = gtexdraw->is_tex;
}
 
/* convert number of lights into boolean */
-   if (gtexdraw.is_lit) lit = 1;
+   if (gtexdraw->is_lit) {
+   lit = 1;
+   }
 
-   backculled = gtexdraw.use_backface_culling;
+   backculled = gtexdraw->use_backface_culling;
if (ma) {
if (ma->mode & MA_SHLESS) lit = 0;
-   if (gtexdraw.use_game_mat) {
+   if (gtexdraw->use_game_mat) {
backculled = backculled || (ma->game.flag & 
GEMAT_BACKCULL);
alphablend = ma->game.alpha_blend;
}
@@ -294,10 +298,10 @@ static bool set_draw_settings_cached(int clearcache, 
MTexPoly *texface, Material
alphablend = GPU_BLEND_ALPHA;
}
else if (texpaint) {
-   if (gtexdraw.texpaint_material)
+   if (gtexdraw->texpaint_material)
ima = ma && ma->texpaintslot ? 
ma->texpaintslot[ma->paint_active_slot].ima : NULL;
else
-   ima = gtexdraw.canvas;
+   ima = gtexdraw->canvas;
}
else
textured = 0;
@@ -375,7 +379,7 @@ static bool set_draw_settings_cached(int clearcache, 
MTexPoly *texface, Material
if (c_textured && !c_badtex) {
options |= GPU_SHADER_TEXTURE_2D;
}
-   if (gtexdraw.two_sided_lighting) {
+   if (gtexdraw->two_sided_lighting) {
options |= GPU_SHADER_TWO_SIDED;
}
 
@@ -495,7 +499,7 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, 
RegionView3D *rv3d, O
Gtexdraw.two_sided_lighting = (me->flag & ME_TWOSIDED);
 
memcpy(Gtexdraw.obcol, obcol, sizeof(obcol));
-   set_draw_settings_cached(1, NULL, NULL, Gtexdraw);
+   set_draw_settings_cached(1, NULL, NULL, &Gtexdraw);
glCullFace(GL_BACK);
 }
 
@@ -553,7 +557,7 @@ static DMDrawOption draw_tface__set_draw_legacy(MTexPoly 
*mtexpoly, const bool h
if (ma && (ma->game.flag & GEMAT_INVISIBLE))
return DM_DRAW_OPTION_SKIP;
 
-   invalidtexture = set_draw_settings_cached(0, mtexpoly, ma, Gtexdraw);
+   invalidtexture = set_draw_settings_cached(0, mtexpoly, ma, &Gtexdraw);
 
if (mtexpoly && invalidtexture) {
glColor3ub(0xFF, 0x00, 0xFF);
@@ -594,7 +598,7 @@ static DMDrawOption draw_tface__set_draw(MTexPoly 
*mtexpoly, const bool UNUSED(h
if (ma && (ma->game.flag & GEMAT_INVISIBLE)) return DM_DRAW_OPTION_SKIP;
 
if (mtexpoly || Gtexdraw.is_texpaint)
-   set_draw_settings_cached(0, mtexpoly, ma, Gtexdraw);
+   set_draw_settings_cached(0, mtexpoly, ma, &Gtexdraw);
 
/* always use color from mcol, as set in update_tface_color_layer */
return DM_DRAW_OPTION_NORMAL;
@@ -664,7 +668,7 @@ static void update_tface_color_layer(DerivedMesh *dm, bool 
use_mcol)
copy_mode = COPY_PREV;
}
}
-   else if (mtexpoly && set_dr

[Bf-blender-cvs] [cddef55] master: BMesh: compare face angles as angles cosine

2016-07-21 Thread Campbell Barton
Commit: cddef5589a3df1396c071afdb568909cc95e3a16
Author: Campbell Barton
Date:   Fri Jul 22 07:20:42 2016 +1000
Branches: master
https://developer.blender.org/rBcddef5589a3df1396c071afdb568909cc95e3a16

BMesh: compare face angles as angles cosine

===

M   source/blender/bmesh/operators/bmo_connect_nonplanar.c

===

diff --git a/source/blender/bmesh/operators/bmo_connect_nonplanar.c 
b/source/blender/bmesh/operators/bmo_connect_nonplanar.c
index 9b3e1d3..b8acc9d 100644
--- a/source/blender/bmesh/operators/bmo_connect_nonplanar.c
+++ b/source/blender/bmesh/operators/bmo_connect_nonplanar.c
@@ -63,7 +63,7 @@ static float bm_face_subset_calc_planar(BMLoop *l_first, 
BMLoop *l_last, const f
return delta_z;
 }
 
-static bool bm_face_split_find(BMesh *bm, BMFace *f, BMLoop *l_pair[2], float 
*r_angle)
+static bool bm_face_split_find(BMesh *bm, BMFace *f, BMLoop *l_pair[2], float 
*r_angle_cos)
 {
BMLoop *l_iter, *l_first;
BMLoop **l_arr = BLI_array_alloca(l_arr, f->len);
@@ -73,7 +73,7 @@ static bool bm_face_split_find(BMesh *bm, BMFace *f, BMLoop 
*l_pair[2], float *r
 
/* angle finding */
float err_best = FLT_MAX;
-   float angle_best = FLT_MAX;
+   float angle_best_cos = -FLT_MAX;
 
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
i_a = 0;
@@ -108,7 +108,7 @@ static bool bm_face_split_find(BMesh *bm, BMFace *f, BMLoop 
*l_pair[2], float *r
l_pair[0] = l_a;
l_pair[1] = l_b;
 
-   angle_best = 
angle_normalized_v3v3(no_a, no_b);
+   angle_best_cos = 
dot_v3v3(no_a, no_b);
found = true;
}
}
@@ -117,17 +117,17 @@ static bool bm_face_split_find(BMesh *bm, BMFace *f, 
BMLoop *l_pair[2], float *r
}
}
 
-   *r_angle = angle_best;
+   *r_angle_cos = angle_best_cos;
 
return found;
 }
 
-static bool bm_face_split_by_angle(BMesh *bm, BMFace *f, BMFace *r_f_pair[2], 
const float angle_limit)
+static bool bm_face_split_by_angle(BMesh *bm, BMFace *f, BMFace *r_f_pair[2], 
const float angle_limit_cos)
 {
BMLoop *l_pair[2];
-   float angle;
+   float angle_cos;
 
-   if (bm_face_split_find(bm, f, l_pair, &angle) && (angle > angle_limit)) 
{
+   if (bm_face_split_find(bm, f, l_pair, &angle_cos) && (angle_cos < 
angle_limit_cos)) {
BMFace *f_new;
BMLoop *l_new;
 
@@ -154,7 +154,7 @@ void bmo_connect_verts_nonplanar_exec(BMesh *bm, BMOperator 
*op)
bool changed = false;
BLI_LINKSTACK_DECLARE(fstack, BMFace *);
 
-   const float angle_limit = BMO_slot_float_get(op->slots_in, 
"angle_limit");
+   const float angle_limit_cos = cosf(BMO_slot_float_get(op->slots_in, 
"angle_limit"));
 
BLI_LINKSTACK_INIT(fstack);
 
@@ -166,7 +166,7 @@ void bmo_connect_verts_nonplanar_exec(BMesh *bm, BMOperator 
*op)
 
while ((f = BLI_LINKSTACK_POP(fstack))) {
BMFace *f_pair[2];
-   if (bm_face_split_by_angle(bm, f, f_pair, angle_limit)) {
+   if (bm_face_split_by_angle(bm, f, f_pair, angle_limit_cos)) {
int j;
for (j = 0; j < 2; j++) {
BM_face_normal_update(f_pair[j]);

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


[Bf-blender-cvs] [462bba3] cycles_disney_brdf: Add an undef for sc_next for safety

2016-07-21 Thread Jens Verwiebe
Commit: 462bba3f97fcc41834e0e20cc806a7958e5106f5
Author: Jens Verwiebe
Date:   Thu Jul 21 23:11:59 2016 +0200
Branches: cycles_disney_brdf
https://developer.blender.org/rB462bba3f97fcc41834e0e20cc806a7958e5106f5

Add an undef for sc_next for safety

===

M   intern/cycles/kernel/svm/svm_closure.h

===

diff --git a/intern/cycles/kernel/svm/svm_closure.h 
b/intern/cycles/kernel/svm/svm_closure.h
index 2c04e9c..2b1a081 100644
--- a/intern/cycles/kernel/svm/svm_closure.h
+++ b/intern/cycles/kernel/svm/svm_closure.h
@@ -264,6 +264,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, 
ShaderData *sd, float *
}
}
 
+#  undef sc_next
 #endif // __BSDF_DISNEY_DIFFUSE__
 
/* diffuse */

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


[Bf-blender-cvs] [875c131] master: Fix broken proxy object deletion.

2016-07-21 Thread Bastien Montagne
Commit: 875c1313b12db97ad7dc00868566d4652be3316a
Author: Bastien Montagne
Date:   Thu Jul 21 23:02:37 2016 +0200
Branches: master
https://developer.blender.org/rB875c1313b12db97ad7dc00868566d4652be3316a

Fix broken proxy object deletion.

Check to ensure we do not delete last instancing of an indirectly used object 
(forbidden
because it creates 'ghost' objects user have no real way to re-instance) was 
defeated by
the backward pointer 'proxy_from', which generated a 'false' indirect usage of 
(local)
proxy object itself (the one we are trying to delete).

Fixed by actually considering that ID usage as local if proxy object itself is 
local
(because that pointer actually does not 'pertain' to the object holding it, but 
to its proxy).

Yeah, it's... complicated, twisted and ugly - it's proxy.

===

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

===

diff --git a/source/blender/blenkernel/intern/library_query.c 
b/source/blender/blenkernel/intern/library_query.c
index 0413211..1ded6f6 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -442,7 +442,16 @@ void BKE_library_foreach_ID_link(ID *id, 
LibraryIDLinkCallback callback, void *u
/* object->proxy is refcounted, but not 
object->proxy_group... *sigh* */
CALLBACK_INVOKE(object->proxy, IDWALK_USER);
CALLBACK_INVOKE(object->proxy_group, 
IDWALK_NOP);
+
+   /* Special case!
+* Since this field is set/owned by 'user' of 
this ID (and not ID itself), it is only indirect usage
+* if proxy object is linked... Twisted. */
+   if (object->proxy_from) {
+   data.cd_flag = 
ID_IS_LINKED_DATABLOCK(object->proxy_from) ? IDWALK_INDIRECT_USAGE : 0;
+   }
CALLBACK_INVOKE(object->proxy_from, IDWALK_NOP);
+   data.cd_flag = data_cd_flag;
+
CALLBACK_INVOKE(object->poselib, IDWALK_USER);
 
data.cd_flag |= proxy_cd_flag;

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


[Bf-blender-cvs] [6ebce7e] master: fix typo in condition

2016-07-21 Thread Mike Erwin
Commit: 6ebce7e9480c87c5d574f1d48242c8272b873964
Author: Mike Erwin
Date:   Thu Jul 21 14:13:20 2016 -0400
Branches: master
https://developer.blender.org/rB6ebce7e9480c87c5d574f1d48242c8272b873964

fix typo in condition

(A - A).norm() is always 0 so condition is always true.

(A - B).norm() and (B - A).norm() both compute the same distance so I
picked one to match surrounding code.

Found with PVS-Studio T48917

===

M   source/blender/freestyle/intern/stroke/Curve.cpp

===

diff --git a/source/blender/freestyle/intern/stroke/Curve.cpp 
b/source/blender/freestyle/intern/stroke/Curve.cpp
index 69c5dcd..a8dbce8 100644
--- a/source/blender/freestyle/intern/stroke/Curve.cpp
+++ b/source/blender/freestyle/intern/stroke/Curve.cpp
@@ -133,7 +133,7 @@ iA_B_eq_iB_A:
//_t2d = t3;
_t2d = t2 * t3;
}
-   else if ((iA->getPoint2D() - iA->getPoint2D()).norm() < 1.0e-6) 
{
+   else if ((iA->getPoint2D() - iB->getPoint2D()).norm() < 1.0e-6) 
{
__A = iB->A();
__B = iB->B();
//_t2d = t3;

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


[Bf-blender-cvs] [b5ba14e] master: Fix T48915: Wrong threshold on scaled objects and ortho view.

2016-07-21 Thread Germano Cavalcante
Commit: b5ba14ef7097c18080834aff03a70c5398745579
Author: Germano Cavalcante
Date:   Thu Jul 21 16:36:20 2016 -0300
Branches: master
https://developer.blender.org/rBb5ba14ef7097c18080834aff03a70c5398745579

Fix T48915: Wrong threshold on scaled objects and ortho view.

`ray_is_normalized` == true in DerivedMesh

===

M   source/blender/editors/transform/transform_snap_object.c

===

diff --git a/source/blender/editors/transform/transform_snap_object.c 
b/source/blender/editors/transform/transform_snap_object.c
index 5b68bdc..1d4872c 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -1362,7 +1362,7 @@ static bool snapDerivedMesh(
 
if (BLI_bvhtree_find_nearest_to_ray(
treedata->tree, ray_org_local, 
ray_normal_local,
-   false, ob_scale, &nearest, 
cb_test_ray_dist, &userdata) != -1)
+   true, ob_scale, &nearest, 
cb_test_ray_dist, &userdata) != -1)
{
copy_v3_v3(r_loc, nearest.co);
mul_m4_v3(obmat, r_loc);

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


[Bf-blender-cvs] [14995c5] master: Fix crash w/ auto-insert offset

2016-07-21 Thread Campbell Barton
Commit: 14995c5617d130dd876e57cb52b1523eb21ccebe
Author: Campbell Barton
Date:   Fri Jul 22 04:17:24 2016 +1000
Branches: master
https://developer.blender.org/rB14995c5617d130dd876e57cb52b1523eb21ccebe

Fix crash w/ auto-insert offset

===

M   source/blender/editors/space_node/node_relationships.c

===

diff --git a/source/blender/editors/space_node/node_relationships.c 
b/source/blender/editors/space_node/node_relationships.c
index d724989..ea3869e 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -1726,7 +1726,7 @@ static int node_insert_offset_modal(bContext *C, 
wmOperator *UNUSED(op), const w
float duration;
bool redraw = false;
 
-   if (!snode || event->type != TIMER || iofsd->anim_timer != 
event->customdata)
+   if (!snode || event->type != TIMER || iofsd == NULL || 
iofsd->anim_timer != event->customdata)
return OPERATOR_PASS_THROUGH;
 
duration = (float)iofsd->anim_timer->duration;

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


[Bf-blender-cvs] [01f5b36] strand_nodes: Each node gets expanded to two function calls for autodiff.

2016-07-21 Thread Lukas Tönne
Commit: 01f5b367cf216b561e9de5993df8304a0be61ff2
Author: Lukas Tönne
Date:   Thu Jul 21 20:11:35 2016 +0200
Branches: strand_nodes
https://developer.blender.org/rB01f5b367cf216b561e9de5993df8304a0be61ff2

Each node gets expanded to two function calls for autodiff.

The value is calculated without any derivative inputs (this is not a 
differential equation).
The derivatives in both variables also depend on the partial derivatives of the 
inputs.

===

M   source/blender/blenvm/glsl/glsl_codegen.cc
M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/intern/gpu_strands_shader.c
D   source/blender/gpu/shaders/gpu_shader_strand_effects.glsl
A   source/blender/gpu/shaders/gpu_shader_strand_nodes.glsl

===

diff --git a/source/blender/blenvm/glsl/glsl_codegen.cc 
b/source/blender/blenvm/glsl/glsl_codegen.cc
index c5a175d..059d362 100644
--- a/source/blender/blenvm/glsl/glsl_codegen.cc
+++ b/source/blender/blenvm/glsl/glsl_codegen.cc
@@ -50,6 +50,7 @@ namespace blenvm {
 static string sanitize_name(const string &name)
 {
string s = name;
+   
string::const_iterator it = s.begin();
string::iterator nit = s.begin();
for (; it != s.end(); ++it) {
@@ -59,6 +60,7 @@ static string sanitize_name(const string &name)
++nit;
}
}
+   s = s.substr(0, nit - s.begin());
return s;
 }
 
@@ -164,8 +166,6 @@ void GLSLCodeGenerator::node_graph_begin(const string 
&name, const NodeGraph *gr
}

size_t num_outputs = graph->outputs.size();
-   if (num_inputs > 0)
-   m_code << ", ";
for (int i = 0; i < num_outputs; ++i) {
const NodeGraph::Output *output = graph->get_output(i);
const TypeSpec *typespec = output->typedesc.get_typespec();
@@ -179,7 +179,7 @@ void GLSLCodeGenerator::node_graph_begin(const string 
&name, const NodeGraph *gr
 create_value(typespec, basename + 
"_DX", false),
 create_value(typespec, basename + 
"_DY", false));

-   if (i > 0)
+   if (i + num_inputs > 0)
m_code << ", ";
m_code << "out " << typestring << " " << 
dval.value()->name()
   << ", out " << typestring << " " << 
dval.dx()->name()
@@ -280,7 +280,10 @@ void GLSLCodeGenerator::eval_node(const NodeType *nodetype,
   ArrayRef input_args,
   ArrayRef output_args)
 {
-   m_code << nodetype->name() << "(";
+   stringstream args_value;
+   stringstream args_dx;
+   stringstream args_dy;
+   const char *sep;

 // if (nodetype->use_globals()) {
 // evalargs.push_back(m_globals_ptr);
@@ -292,38 +295,32 @@ void GLSLCodeGenerator::eval_node(const NodeType 
*nodetype,
bool is_constant = (input->value_type == INPUT_CONSTANT);
const DualValue &dval = get_value(input_args[i]);

-   if (i > 0)
-   m_code << ", ";
+   sep = (i > 0) ? ", " : "";
+   args_value << sep << dval.value()->name();
+   args_dx << sep << dval.value()->name();
+   args_dy << sep << dval.value()->name();
if (!is_constant && bvm_glsl_type_has_dual_value(typespec)) {
-   m_code << dval.value()->name()
-  << ", " << dval.dx()->name()
-  << ", " << dval.dy()->name();
-   }
-   else {
-   m_code << dval.value()->name();
+   args_dx << ", " << dval.dx()->name();
+   args_dy << ", " << dval.dy()->name();
}
}

-   if (nodetype->num_inputs() > 0)
-   m_code << ", ";
for (int i = 0; i < nodetype->num_outputs(); ++i) {
const NodeOutput *output = nodetype->find_output(i);
const TypeSpec *typespec = output->typedesc.get_typespec();
const DualValue &dval = get_value(output_args[i]);

-   if (i > 0)
-   m_code << ", ";
+   sep = (i + nodetype->num_inputs() > 0) ? ", " : "";
+   args_value << sep << dval.value()->name();
if (bvm_glsl_type_has_dual_value(typespec)) {
-   m_code << dval.value()->name()
-  << ", " << dval.dx()->name()
-  << ", " << dval.dy()->name();
-   }
-   else {
-   m_code << dval.value()->name();
+   args_dx << sep 

[Bf-blender-cvs] [f53dc5a] strand_nodes: Incorporate the generated GLSL code for hair displacement into the strands vertex shader.

2016-07-21 Thread Lukas Tönne
Commit: f53dc5a34bc47ae948bcc2263ac252a243ce53fa
Author: Lukas Tönne
Date:   Thu Jul 21 18:32:19 2016 +0200
Branches: strand_nodes
https://developer.blender.org/rBf53dc5a34bc47ae948bcc2263ac252a243ce53fa

Incorporate the generated GLSL code for hair displacement into the strands 
vertex shader.

===

M   source/blender/blenvm/glsl/glsl_codegen.cc
M   source/blender/gpu/intern/gpu_strands_shader.c

===

diff --git a/source/blender/blenvm/glsl/glsl_codegen.cc 
b/source/blender/blenvm/glsl/glsl_codegen.cc
index 6922b0e..c5a175d 100644
--- a/source/blender/blenvm/glsl/glsl_codegen.cc
+++ b/source/blender/blenvm/glsl/glsl_codegen.cc
@@ -43,14 +43,21 @@ extern "C" {
 
 namespace blenvm {
 
-/* replace non-alphanumeric chars with underscore */
+/* Remove non-alphanumeric chars
+ * Note: GLSL does not allow double underscores __
+ *   so just remove them to avoid issues.
+ */
 static string sanitize_name(const string &name)
 {
string s = name;
-   for (string::iterator it = s.begin(); it != s.end(); ++it) {
-   char &c = *it;
-   if (c != '_' && !isalnum(c))
-   c = '_';
+   string::const_iterator it = s.begin();
+   string::iterator nit = s.begin();
+   for (; it != s.end(); ++it) {
+   const char &c = *it;
+   if (isalnum(c)) {
+   *nit = c;
+   ++nit;
+   }
}
return s;
 }
diff --git a/source/blender/gpu/intern/gpu_strands_shader.c 
b/source/blender/gpu/intern/gpu_strands_shader.c
index ef71129..f4e2d2b 100644
--- a/source/blender/gpu/intern/gpu_strands_shader.c
+++ b/source/blender/gpu/intern/gpu_strands_shader.c
@@ -79,14 +79,21 @@ extern char datatoc_gpu_shader_strand_debug_vert_glsl[];
 extern char datatoc_gpu_shader_strand_effects_glsl[];
 extern char datatoc_gpu_shader_strand_util_glsl[];
 
-static char *codegen(const char *basecode)
+static char *codegen(const char *basecode, const char *nodecode)
 {
char *code;

+   if (!basecode)
+   return NULL;
+   
DynStr *ds = BLI_dynstr_new();

BLI_dynstr_append(ds, datatoc_gpu_shader_strand_util_glsl);
BLI_dynstr_append(ds, datatoc_gpu_shader_strand_effects_glsl);
+   
+   if (nodecode)
+   BLI_dynstr_append(ds, nodecode);
+   
BLI_dynstr_append(ds, basecode);

code = BLI_dynstr_get_cstring(ds);
@@ -211,7 +218,14 @@ GPUStrandsShader 
*GPU_strand_shader_create(GPUStrandsShaderParams *params)
 {
bool use_geometry_shader = params->use_geomshader;

-   BVM_gen_hair_deform_function_glsl(params->nodes, "displace_vertex");
+   char *vertex_basecode = datatoc_gpu_shader_strand_vert_glsl;
+   char *geometry_basecode = use_geometry_shader ? 
datatoc_gpu_shader_strand_geom_glsl : NULL;
+   char *fragment_basecode = datatoc_gpu_shader_strand_frag_glsl;
+   char *vertex_debug_basecode = datatoc_gpu_shader_strand_debug_vert_glsl;
+   char *geometry_debug_basecode = use_geometry_shader ? 
datatoc_gpu_shader_strand_debug_geom_glsl : NULL;
+   char *fragment_debug_basecode = 
datatoc_gpu_shader_strand_debug_frag_glsl;
+   
+   char *nodecode = BVM_gen_hair_deform_function_glsl(params->nodes, 
"displace_vertex");

GPUStrandsShader *gpu_shader = MEM_callocN(sizeof(GPUStrandsShader), 
"GPUStrands");

@@ -220,9 +234,9 @@ GPUStrandsShader 
*GPU_strand_shader_create(GPUStrandsShaderParams *params)
get_defines(params, defines);

/* Main shader */
-   char *vertexcode = codegen(datatoc_gpu_shader_strand_vert_glsl);
-   char *geometrycode = use_geometry_shader ? 
codegen(datatoc_gpu_shader_strand_geom_glsl) : NULL;
-   char *fragmentcode = codegen(datatoc_gpu_shader_strand_frag_glsl);
+   char *vertexcode = codegen(vertex_basecode, nodecode);
+   char *geometrycode = codegen(geometry_basecode, NULL);
+   char *fragmentcode = codegen(fragment_basecode, NULL);
GPUShader *shader = GPU_shader_create_ex(vertexcode, fragmentcode, 
geometrycode, NULL,
 defines, 0, 0, 0, flags);
if (shader) {
@@ -244,9 +258,9 @@ GPUStrandsShader 
*GPU_strand_shader_create(GPUStrandsShaderParams *params)
}

/* Debug shader */
-   char *debug_vertexcode = 
codegen(datatoc_gpu_shader_strand_debug_vert_glsl);
-   char *debug_geometrycode = 
codegen(datatoc_gpu_shader_strand_debug_geom_glsl);
-   char *debug_fragmentcode = 
codegen(datatoc_gpu_shader_strand_debug_frag_glsl);
+   char *debug_vertexcode = codegen(vertex_debug_basecode, nodecode);
+   char *debug_geometrycode = codegen(geometry_debug_basecode, NULL);
+   char *debug_fragmentcode = codegen(fragment_debug_basecode, NU

[Bf-blender-cvs] [74e2186] strand_nodes: Emit function calls for each node.

2016-07-21 Thread Lukas Tönne
Commit: 74e21867ffcd445735ab2144f19545487f7be056
Author: Lukas Tönne
Date:   Thu Jul 21 18:03:16 2016 +0200
Branches: strand_nodes
https://developer.blender.org/rB74e21867ffcd445735ab2144f19545487f7be056

Emit function calls for each node.

Base functions are yet to be defined.

===

M   source/blender/blenvm/glsl/glsl_codegen.cc

===

diff --git a/source/blender/blenvm/glsl/glsl_codegen.cc 
b/source/blender/blenvm/glsl/glsl_codegen.cc
index f23001b..6922b0e 100644
--- a/source/blender/blenvm/glsl/glsl_codegen.cc
+++ b/source/blender/blenvm/glsl/glsl_codegen.cc
@@ -273,6 +273,50 @@ void GLSLCodeGenerator::eval_node(const NodeType *nodetype,
   ArrayRef input_args,
   ArrayRef output_args)
 {
+   m_code << nodetype->name() << "(";
+   
+// if (nodetype->use_globals()) {
+// evalargs.push_back(m_globals_ptr);
+// }
+   
+   for (int i = 0; i < nodetype->num_inputs(); ++i) {
+   const NodeInput *input = nodetype->find_input(i);
+   const TypeSpec *typespec = input->typedesc.get_typespec();
+   bool is_constant = (input->value_type == INPUT_CONSTANT);
+   const DualValue &dval = get_value(input_args[i]);
+   
+   if (i > 0)
+   m_code << ", ";
+   if (!is_constant && bvm_glsl_type_has_dual_value(typespec)) {
+   m_code << dval.value()->name()
+  << ", " << dval.dx()->name()
+  << ", " << dval.dy()->name();
+   }
+   else {
+   m_code << dval.value()->name();
+   }
+   }
+   
+   if (nodetype->num_inputs() > 0)
+   m_code << ", ";
+   for (int i = 0; i < nodetype->num_outputs(); ++i) {
+   const NodeOutput *output = nodetype->find_output(i);
+   const TypeSpec *typespec = output->typedesc.get_typespec();
+   const DualValue &dval = get_value(output_args[i]);
+   
+   if (i > 0)
+   m_code << ", ";
+   if (bvm_glsl_type_has_dual_value(typespec)) {
+   m_code << dval.value()->name()
+  << ", " << dval.dx()->name()
+  << ", " << dval.dy()->name();
+   }
+   else {
+   m_code << dval.value()->name();
+   }
+   }
+   
+   m_code << ");\n";
 }
 
 } /* namespace blenvm */

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


[Bf-blender-cvs] [1cc0ce5] master: Cleanup: warnings

2016-07-21 Thread Campbell Barton
Commit: 1cc0ce58fd082a819431a766fa3e2f897dd46a4e
Author: Campbell Barton
Date:   Fri Jul 22 04:05:38 2016 +1000
Branches: master
https://developer.blender.org/rB1cc0ce58fd082a819431a766fa3e2f897dd46a4e

Cleanup: warnings

===

M   source/blender/blenkernel/intern/camera.c
M   source/blender/blenkernel/intern/dynamicpaint.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/blenloader/intern/versioning_270.c
M   source/blender/editors/mesh/editmesh_tools.c
M   source/blender/makesdna/intern/dna_genfile.c
M   source/blender/makesrna/intern/rna_armature.c
M   source/blender/makesrna/intern/rna_camera.c
M   source/blender/modifiers/intern/MOD_normal_edit.c

===

diff --git a/source/blender/blenkernel/intern/camera.c 
b/source/blender/blenkernel/intern/camera.c
index b7e6e40..4229b2a 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -78,8 +78,8 @@ void BKE_camera_init(Camera *cam)
/* stereoscopy 3d */
cam->stereo.interocular_distance = 0.065f;
cam->stereo.convergence_distance = 30.f * 0.065f;
-   cam->stereo.pole_merge_angle_from = DEG2RAD(60.0f);
-   cam->stereo.pole_merge_angle_to = DEG2RAD(75.0f);
+   cam->stereo.pole_merge_angle_from = DEG2RADF(60.0f);
+   cam->stereo.pole_merge_angle_to = DEG2RADF(75.0f);
 }
 
 void *BKE_camera_add(Main *bmain, const char *name)
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c 
b/source/blender/blenkernel/intern/dynamicpaint.c
index 2b097f3..d35de6f 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -4483,7 +4483,7 @@ static void dynamicPaint_doSmudge(DynamicPaintSurface 
*surface, DynamicPaintBrus
CLAMP_MIN(max_velocity, vel);
}
 
-   steps = (int)ceil(max_velocity / bData->average_dist * timescale);
+   steps = (int)ceil((double)max_velocity / bData->average_dist * 
(double)timescale);
CLAMP(steps, 0, 12);
eff_scale = brush->smudge_strength / (float)steps * timescale;
 
@@ -4634,7 +4634,7 @@ static int dynamicPaint_prepareEffectStep(
 
/* calculate average values (single thread) */
for (int index = 0; index < sData->total_points; 
index++) {
-   average_force += (*force)[index * 4 + 3];
+   average_force += (double)(*force)[index * 4 + 
3];
}
average_force /= sData->total_points;
}
@@ -4651,7 +4651,7 @@ static int dynamicPaint_prepareEffectStep(
shrink_speed = surface->shrink_speed;
 
fastest_effect = max_fff(spread_speed, shrink_speed, average_force);
-   avg_dist = bData->average_dist * CANVAS_REL_SIZE / 
getSurfaceDimension(sData);
+   avg_dist = bData->average_dist * (double)CANVAS_REL_SIZE / 
(double)getSurfaceDimension(sData);
 
steps = (int)ceilf(1.5f * EFF_MOVEMENT_PER_FRAME * fastest_effect / 
avg_dist * timescale);
CLAMP(steps, 1, 20);
@@ -5009,7 +5009,8 @@ static void dynamicPaint_doWaveStep(DynamicPaintSurface 
*surface, float timescal
const float wave_scale = CANVAS_REL_SIZE / canvas_size;
 
/* allocate memory */
-   PaintWavePoint *prevPoint = MEM_mallocN(sData->total_points * 
sizeof(PaintWavePoint), "Temp previous points for wave simulation");
+   PaintWavePoint *prevPoint = MEM_mallocN(
+   sData->total_points * sizeof(PaintWavePoint), __func__);
if (!prevPoint)
return;
 
@@ -5019,13 +5020,14 @@ static void dynamicPaint_doWaveStep(DynamicPaintSurface 
*surface, float timescal
int numOfNeighs = sData->adj_data->n_num[index];
 
for (i = 0; i < numOfNeighs; i++) {
-   average_dist += bNeighs[sData->adj_data->n_index[index] 
+ i].dist;
+   average_dist += 
(double)bNeighs[sData->adj_data->n_index[index] + i].dist;
}
}
-   average_dist  *= wave_scale / sData->adj_data->total_targets;
+   average_dist  *= (double)wave_scale / sData->adj_data->total_targets;
 
/* determine number of required steps */
-   steps = (int)ceil((WAVE_TIME_FAC * timescale * surface->wave_timescale) 
/ (average_dist / wave_speed / 3));
+   steps = (int)ceil((double)(WAVE_TIME_FAC * timescale * 
surface->wave_timescale) /
+ (average_dist / (double)wave_speed / 3));
CLAMP(steps, 1, 20);
timescale /= steps;
 
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index a25b56b..2fbdc1a 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -1280,7 +1280,7 @@ void 

[Bf-blender-cvs] [9279bee] master: remove repeated codec-supports-alpha check

2016-07-21 Thread Mike Erwin
Commit: 9279bee58302f70fed3549887835e1374a032bd7
Author: Mike Erwin
Date:   Thu Jul 21 13:50:35 2016 -0400
Branches: master
https://developer.blender.org/rB9279bee58302f70fed3549887835e1374a032bd7

remove repeated codec-supports-alpha check

I don’t think any other codec enum makes sense here, so probably just
an extra copy/paste. Here are the video codecs:

AV_CODEC_ID_NONE
AV_CODEC_ID_MPEG4
AV_CODEC_ID_MJPEG
AV_CODEC_ID_DNXHD
AV_CODEC_ID_MPEG2VIDEO
AV_CODEC_ID_MPEG1VIDEO
AV_CODEC_ID_DVVIDEO
AV_CODEC_ID_THEORA
AV_CODEC_ID_PNG <— alpha
AV_CODEC_ID_QTRLE <— alpha
AV_CODEC_ID_FFV1 <— alpha (if enabled)
AV_CODEC_ID_HUFFYUV <— alpha
AV_CODEC_ID_H264
AV_CODEC_ID_FLV1

Found with PVS-Studio T48917

===

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

===

diff --git a/source/blender/blenkernel/intern/writeffmpeg.c 
b/source/blender/blenkernel/intern/writeffmpeg.c
index edeccf4..9dbc045 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -1672,9 +1672,6 @@ bool BKE_ffmpeg_alpha_channel_is_supported(RenderData *rd)
if (codec == AV_CODEC_ID_PNG)
return true;
 
-   if (codec == AV_CODEC_ID_PNG)
-   return true;
-
if (codec == AV_CODEC_ID_HUFFYUV)
return true;

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


[Bf-blender-cvs] [379a573] soc-2016-uv_tools: WIP Simulated Annealing

2016-07-21 Thread Phil Gosch
Commit: 379a57348b2e1e2d43ee35c3e0acf5e4db9664ab
Author: Phil Gosch
Date:   Thu Jul 21 18:32:39 2016 +0200
Branches: soc-2016-uv_tools
https://developer.blender.org/rB379a57348b2e1e2d43ee35c3e0acf5e4db9664ab

WIP Simulated Annealing

Iterations now only recompute placement of one random chart according to the 
main reference paper
Also includes stubs for margin computation

===

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 2e95848..6c7dcc5 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -231,6 +231,7 @@ typedef struct PChart {
PConvexHull *convex_hull; /* ToDo (SaphireS): Only 
convex for now */
PPointUV *best_pos;
float area, scale;
+   float sa_params[3]; /* 0 = Theta, 1 = r, 2 = f  
according to Rotational placement of irregular polygons over containers with 
fixed dimensions using simulated annealing and no-fit polygons*/
} ipack; 
} u;
 
@@ -5037,6 +5038,11 @@ void p_convex_hull_restore_direction(PConvexHull *item)
p_convex_hull_compute_edge_components(item);
 }
 
+void p_convex_hull_grow(PConvexHull *chull, float margin)
+{
+
+}
+
 PNoFitPolygon *p_inner_fit_polygon_create(PConvexHull *item)
 {
PNoFitPolygon *nfp = (PNoFitPolygon *)MEM_callocN(sizeof(*nfp), 
"PNoFitPolygon");
@@ -5227,7 +5233,6 @@ void p_place_chart(PChart* item, PConvexHull *ch_item,  
PPointUV *pos)
 
 bool p_chart_pack_individual(PHandle *phandle,  PChart *item)
 {
-   /* ToDo SaphireS */
PNoFitPolygon **nfps = (PNoFitPolygon 
**)MEM_callocN(sizeof(PNoFitPolygon *) * phandle->ncharts, "PNoFitPolygons");
PConvexHull *ch_item = item->u.ipack.convex_hull;
PChart *fixed;
@@ -5405,20 +5410,21 @@ bool p_compute_packing_solution(PHandle *phandle /* 
ToDo SaphireS: Simulated Ann

p_convex_hull_compute_horizontal_angles(chart->u.ipack.convex_hull); /* ToDo: 
Shouldn't be necessary! */

p_convex_hull_compute_edge_components(chart->u.ipack.convex_hull);
p_chart_pack_individual(phandle, chart);
+   chart->u.ipack.convex_hull->placed = true;
}
}
}
 
/* Un-set placed property of charts so next iteration works as expected 
*/
-   for (i = 0; i < phandle->ncharts; i++) {
+   /*for (i = 0; i < phandle->ncharts; i++) {
chart = phandle->charts[i];
chart->u.ipack.convex_hull->placed = false;
-   }
+   }*/
 
return true;
 }
 
-void param_irregular_pack_begin(ParamHandle *handle, float *w_area, int 
rot_step)
+void param_irregular_pack_begin(ParamHandle *handle, float *w_area, float 
margin, int rot_step)
 {
PHandle *phandle = (PHandle *)handle;
PChart *chart;
@@ -5449,9 +5455,19 @@ void param_irregular_pack_begin(ParamHandle *handle, 
float *w_area, int rot_step
/* ToDo: Do this in p_compute_packing_solution */
/*p_chart_uv_scale_origin(chart, init_scale); */
 
-   /* Initial random rotation */
+   /* Initial random Simulated Annealing parameters*/
+   randf1 = BLI_rng_get_float(phandle->rng);
+   chart->u.ipack.sa_params[0] = randf1; /* theta */
+   printf("-init theta for chart[%i]: %f\n", i, 
chart->u.ipack.sa_params[0]);
+   randf1 = BLI_rng_get_float(phandle->rng);
+   chart->u.ipack.sa_params[1] = randf1; /* m */
+   printf("-init m for chart[%i]: %f\n", i, 
chart->u.ipack.sa_params[1]);
randf1 = BLI_rng_get_float(phandle->rng);
-   rot = (int)(randf1 * (float)rot_step) * (2 * M_PI / 
(float)rot_step);
+   chart->u.ipack.sa_params[2] = randf1; /* f */
+   printf("-init f for chart[%i]: %f\n", i, 
chart->u.ipack.sa_params[2]);
+
+   /* Initial rotation */
+   rot = (int)(chart->u.ipack.sa_params[0] * (float)rot_step) * (2 
* M_PI / (float)rot_step);
printf("init rot for chart[%i]: %f\n", i, rot);
p_chart_rotate(chart, rot);
 
@@ -5467,38 +5483,47 @@ void param_irregular_pack_begin(ParamHandle *handle, 
float *w_area, int rot_step
/* Compute edge lengths */

p_convex_hull_compute_edge_components(chart->u.ipack.convex_hull);
 
-   chart->u.ipack.area = p_chart_uv_area_signed(chart);
+   chart->u.

[Bf-blender-cvs] [75dbf6d] alembic_basic_io: Make sure edges are computed.

2016-07-21 Thread Kévin Dietrich
Commit: 75dbf6d9c4fae846523f619d6b0e552761820184
Author: Kévin Dietrich
Date:   Thu Jul 21 18:13:42 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB75dbf6d9c4fae846523f619d6b0e552761820184

Make sure edges are computed.

===

M   source/blender/alembic/intern/abc_mesh.cc

===

diff --git a/source/blender/alembic/intern/abc_mesh.cc 
b/source/blender/alembic/intern/abc_mesh.cc
index 888c281..86fcc87 100644
--- a/source/blender/alembic/intern/abc_mesh.cc
+++ b/source/blender/alembic/intern/abc_mesh.cc
@@ -1000,6 +1000,7 @@ void AbcMeshReader::readObjectData(Main *bmain, float 
time)
read_mesh_sample(m_settings, m_schema, sample_sel, m_mesh_data, 
has_smooth_normals);
 
BKE_mesh_calc_normals(mesh);
+   BKE_mesh_calc_edges(mesh, false, false);
 
if (m_settings->validate_meshes) {
BKE_mesh_validate(mesh, false, false);
@@ -1167,6 +1168,7 @@ void AbcSubDReader::readObjectData(Main *bmain, float 
time)
}
 
BKE_mesh_calc_normals(mesh);
+   BKE_mesh_calc_edges(mesh, false, false);
 
if (m_settings->validate_meshes) {
BKE_mesh_validate(mesh, false, false);

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


[Bf-blender-cvs] [b044546] strand_nodes: Node API for generating hair deformation GLSL code.

2016-07-21 Thread Lukas Tönne
Commit: b044546587f049eaf39dd672217ac701bd828fac
Author: Lukas Tönne
Date:   Wed Jul 20 12:15:54 2016 +0200
Branches: strand_nodes
https://developer.blender.org/rBb044546587f049eaf39dd672217ac701bd828fac

Node API for generating hair deformation GLSL code.

This is just a stub atm. The BVM system will use nodes to generate
a GLSL function, which can then be inserted into and compiled with
a framework shader. The deformation function itself is just a simple
expression (with autodiff for tangents), so it doesn't need to know
about the topology of index buffers and the like.

===

M   release/scripts/nodes/bvm_debug.py
M   source/blender/blenvm/BVM_api.h
M   source/blender/blenvm/intern/bvm_api.cc
M   source/blender/editors/space_view3d/drawstrands.c
M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/GPU_strands.h
M   source/blender/gpu/intern/gpu_strands_shader.c
M   source/blender/makesrna/intern/rna_nodetree.c

===

diff --git a/release/scripts/nodes/bvm_debug.py 
b/release/scripts/nodes/bvm_debug.py
index 3063501..b3f890c 100644
--- a/release/scripts/nodes/bvm_debug.py
+++ b/release/scripts/nodes/bvm_debug.py
@@ -75,6 +75,8 @@ def draw_depshow_op(layout, ntree):
 funtype = 'TEXTURE'
 elif isinstance(ntree, bpy.types.ForceFieldNodeTree):
 funtype = 'FORCEFIELD'
+elif isinstance(ntree, bpy.types.HairNodeTree):
+funtype = 'HAIR_DEFORM'
 else:
 return
 
diff --git a/source/blender/blenvm/BVM_api.h b/source/blender/blenvm/BVM_api.h
index 74cfe90..d9cb19a 100644
--- a/source/blender/blenvm/BVM_api.h
+++ b/source/blender/blenvm/BVM_api.h
@@ -201,6 +201,11 @@ void BVM_eval_dupli_bvm(struct BVMEvalGlobals *globals,
 struct Object *object,
 struct DupliContainer *duplicont);
 
+/* - */
+
+char *BVM_gen_hair_deform_function_glsl(struct bNodeTree *btree);
+void BVM_debug_hair_deform_nodes(struct bNodeTree *btree, FILE *debug_file, 
const char *label, BVMDebugMode mode);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/blenvm/intern/bvm_api.cc 
b/source/blender/blenvm/intern/bvm_api.cc
index 2a9b493..af88eef 100644
--- a/source/blender/blenvm/intern/bvm_api.cc
+++ b/source/blender/blenvm/intern/bvm_api.cc
@@ -96,6 +96,8 @@ static std::vector modifier_inputs;
 static std::vector modifier_outputs;
 static std::vector dupli_inputs;
 static std::vector dupli_outputs;
+static std::vector hair_deform_inputs;
+static std::vector hair_deform_outputs;
 
 static void register_graph_types()
 {
@@ -121,6 +123,11 @@ static void register_graph_types()

dupli_inputs.push_back(NodeInputParam("dupli.object", "RNAPOINTER"));
dupli_outputs.push_back(NodeOutputParam("dupli.result", "DUPLIS", 
__empty_duplilist__));
+   
+   hair_deform_inputs.push_back(NodeInputParam("location", "FLOAT3"));
+   hair_deform_inputs.push_back(NodeInputParam("parameter", "FLOAT"));
+   hair_deform_inputs.push_back(NodeInputParam("target", "MATRIX44"));
+   hair_deform_outputs.push_back(NodeOutputParam("offset", "FLOAT3", 
zerovec));
 }
 
 }
@@ -909,3 +916,17 @@ void BVM_eval_dupli_bvm(struct BVMEvalGlobals *globals,
}
result.reset();
 }
+
+/* - */
+
+char *BVM_gen_hair_deform_function_glsl(bNodeTree *btree)
+{
+   using namespace blenvm;
+   return gen_function_glsl(btree, hair_deform_inputs, 
hair_deform_outputs);
+}
+
+void BVM_debug_hair_deform_nodes(bNodeTree *btree, FILE *debug_file, const 
char *label, BVMDebugMode mode)
+{
+   using namespace blenvm;
+   debug_nodes(btree, debug_file, label, mode, hair_deform_inputs, 
hair_deform_outputs);
+}
diff --git a/source/blender/editors/space_view3d/drawstrands.c 
b/source/blender/editors/space_view3d/drawstrands.c
index 78ca113..3dfe049 100644
--- a/source/blender/editors/space_view3d/drawstrands.c
+++ b/source/blender/editors/space_view3d/drawstrands.c
@@ -32,6 +32,7 @@
 #include "MEM_guardedalloc.h"
 
 #include "DNA_modifier_types.h"
+#include "DNA_node_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
@@ -146,6 +147,21 @@ void draw_strands(Scene *scene, View3D *UNUSED(v3d), 
RegionView3D *rv3d,
shader_params.use_geomshader = use_geomshader;
shader_params.shader_model = 
get_shader_model(smd->shader_model);

+   /* XXX TODO not nice, we can potentially have multiple hair
+* subtrees and it's not clear yet how these would be combined.
+* For the time being just select the first and expect it to be 
the only one ...
+*/
+   shader_params.nodes = NULL;
+

[Bf-blender-cvs] [878c339] strand_nodes: First steps for the GLSL code generator and hair displacement nodes.

2016-07-21 Thread Lukas Tönne
Commit: 878c339cdeaaec6f55734d2ae497f1bdd29cb56f
Author: Lukas Tönne
Date:   Thu Jul 21 15:33:01 2016 +0200
Branches: strand_nodes
https://developer.blender.org/rB878c339cdeaaec6f55734d2ae497f1bdd29cb56f

First steps for the GLSL code generator and hair displacement nodes.

===

M   release/scripts/nodes/hair_nodes.py
M   source/blender/blenkernel/intern/DerivedMesh.c
M   source/blender/blenkernel/intern/effect.c
M   source/blender/blenkernel/intern/object_dupli.c
M   source/blender/blenkernel/intern/texture.c
M   source/blender/blenvm/BVM_api.h
M   source/blender/blenvm/glsl/CMakeLists.txt
M   source/blender/blenvm/glsl/glsl_codegen.cc
M   source/blender/blenvm/glsl/glsl_codegen.h
A   source/blender/blenvm/glsl/glsl_types.cc
A   source/blender/blenvm/glsl/glsl_types.h
A   source/blender/blenvm/glsl/glsl_value.h
M   source/blender/blenvm/intern/bvm_api.cc
M   source/blender/blenvm/util/util_string.h
M   source/blender/gpu/intern/gpu_strands_shader.c
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/render/intern/source/render_texture.c

===

diff --git a/release/scripts/nodes/hair_nodes.py 
b/release/scripts/nodes/hair_nodes.py
index 0d5b1fc..83fd4e1 100644
--- a/release/scripts/nodes/hair_nodes.py
+++ b/release/scripts/nodes/hair_nodes.py
@@ -91,6 +91,34 @@ class HairNodesNew(Operator):
 
 ###
 
+class HairInputNode(HairNodeBase, ObjectNode):
+'''Hair inputs'''
+bl_idname = 'HairInputNode'
+bl_label = 'Hair'
+
+def init(self, context):
+self.outputs.new('NodeSocketVector', "Location")
+self.outputs.new('NodeSocketFloat', "Parameter")
+self.outputs.new('TransformSocket', "Target")
+
+def compile(self, compiler):
+compiler.map_output(0, compiler.graph_input("location"))
+compiler.map_output(1, compiler.graph_input("parameter"))
+compiler.map_output(2, compiler.graph_input("target"))
+
+class HairDeformNode(HairNodeBase, ObjectNode):
+'''Hair displacement result'''
+bl_idname = 'HairDeformNode'
+bl_label = 'Hair Displacement'
+
+def init(self, context):
+self.inputs.new('NodeSocketVector', "Target")
+
+def compile(self, compiler):
+compiler.map_input(0, compiler.graph_output("offset"))
+
+###
+
 def register():
 bpy.utils.register_module(__name__)
 gnode, ginput, goutput = group_nodes.make_node_group_types(
@@ -98,6 +126,7 @@ def register():
 
 node_categories = [
 HairNodeCategory("GEO_INPUT", "Input", items=[
+NodeItem("HairInputNode"),
 NodeItem(ginput.bl_idname),
 NodeItem("ObjectValueFloatNode"),
 NodeItem("ObjectValueIntNode"),
@@ -105,6 +134,7 @@ def register():
 NodeItem("ObjectValueColorNode"),
 ]),
 HairNodeCategory("GEO_OUTPUT", "Output", items=[
+NodeItem("HairDeformNode"),
 NodeItem(goutput.bl_idname),
 ]),
 HairNodeCategory("GEO_CONVERTER", "Converter", items=[
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c 
b/source/blender/blenkernel/intern/DerivedMesh.c
index 70ce07a..c18f466 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1728,7 +1728,7 @@ static DerivedMesh *mesh_calc_modifier_nodes(Scene 
*UNUSED(scene), Object *ob, b
Mesh *me = ob->data;
DerivedMesh *dm, *result;

-   struct BVMFunction *fn = BVM_gen_modifier_function_llvm(ntree, true);
+   struct BVMFunction *fn = BVM_gen_modifier_function_llvm(ntree, NULL, 
true);
if (fn) {
struct BVMEvalGlobals *globals = BVM_globals_create();
BVM_globals_add_nodetree_relations(globals, ntree);
diff --git a/source/blender/blenkernel/intern/effect.c 
b/source/blender/blenkernel/intern/effect.c
index 7bebf22..fdfac58 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -212,7 +212,7 @@ static void add_object_nodes_to_effectors(EffectorContext 
*effctx, Scene *scene,

BVM_globals_add_nodetree_relations(effctx->eval_globals, ff_ntree);

EffectorCache *eff = 
new_effector_cache(effctx, scene, ob, NULL, ob->pd);
-   eff->function = 
BVM_gen_forcefield_function_bvm(ff_ntree, true);
+   eff->function = 
BVM_gen_forcefield_function_bvm(ff_ntree, NULL, true);
}

break;
dif

[Bf-blender-cvs] [89dd302] strand_nodes: Merge branch 'strand_gpu' into strand_nodes

2016-07-21 Thread Lukas Tönne
Commit: 89dd3022d180cc4c0fabcb05c58166b261b1441f
Author: Lukas Tönne
Date:   Wed Jul 20 10:36:04 2016 +0200
Branches: strand_nodes
https://developer.blender.org/rB89dd3022d180cc4c0fabcb05c58166b261b1441f

Merge branch 'strand_gpu' into strand_nodes

===



===



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


[Bf-blender-cvs] [831a4a3] strand_nodes: Support dual values for autodiff'ing in GLSL codegen right from the start.

2016-07-21 Thread Lukas Tönne
Commit: 831a4a3f96c9ab1ffae5ce62aedf7547749a9e37
Author: Lukas Tönne
Date:   Thu Jul 21 17:38:33 2016 +0200
Branches: strand_nodes
https://developer.blender.org/rB831a4a3f96c9ab1ffae5ce62aedf7547749a9e37

Support dual values for autodiff'ing in GLSL codegen right from the start.

Note that for the hair displacement function we would only be interested
in a single derivative (the tangent). For now we just use the existing
2-variable duals, later on this can be generalized to avoid unnecessary
and confusing code emission.

===

M   source/blender/blenvm/glsl/glsl_codegen.cc
M   source/blender/blenvm/glsl/glsl_codegen.h
M   source/blender/blenvm/llvm/llvm_codegen.cc
M   source/blender/blenvm/llvm/llvm_modules.cc
M   source/blender/blenvm/llvm/llvm_types.cc
M   source/blender/blenvm/llvm/llvm_types.h

===

diff --git a/source/blender/blenvm/glsl/glsl_codegen.cc 
b/source/blender/blenvm/glsl/glsl_codegen.cc
index 9095c4f..f23001b 100644
--- a/source/blender/blenvm/glsl/glsl_codegen.cc
+++ b/source/blender/blenvm/glsl/glsl_codegen.cc
@@ -43,6 +43,19 @@ extern "C" {
 
 namespace blenvm {
 
+/* replace non-alphanumeric chars with underscore */
+static string sanitize_name(const string &name)
+{
+   string s = name;
+   for (string::iterator it = s.begin(); it != s.end(); ++it) {
+   char &c = *it;
+   if (c != '_' && !isalnum(c))
+   c = '_';
+   }
+   return s;
+}
+
+
 GLSLValue::GLSLValue(const string &name) :
 m_name(name)
 {
@@ -62,14 +75,23 @@ GLSLCodeGenerator::~GLSLCodeGenerator()
 {
 }
 
-ValueHandle GLSLCodeGenerator::get_handle(const GLSLValue *value)
+ValueHandle GLSLCodeGenerator::get_handle(const GLSLCodeGenerator::DualValue 
&value)
 {
-   return (ValueHandle)value;
+   return (ValueHandle)value.value();
 }
 
-GLSLValue *GLSLCodeGenerator::get_value(ValueHandle handle)
+ValueHandle GLSLCodeGenerator::register_value(const DualValue &value)
 {
-   return (GLSLValue *)handle;
+   ValueHandle handle = get_handle(value);
+   bool ok = m_valuemap.insert(HandleValueMap::value_type(handle, 
value)).second;
+   BLI_assert(ok && "Could not register value");
+   UNUSED_VARS(ok);
+   return handle;
+}
+
+const GLSLCodeGenerator::DualValue &GLSLCodeGenerator::get_value(ValueHandle 
handle) const
+{
+   return m_valuemap.at(handle);
 }
 
 GLSLValue *GLSLCodeGenerator::create_value(const TypeSpec *UNUSED(typespec), 
const string &name, bool make_unique)
@@ -105,14 +127,33 @@ void GLSLCodeGenerator::node_graph_begin(const string 
&name, const NodeGraph *gr
for (int i = 0; i < num_inputs; ++i) {
const NodeGraph::Input *input = graph->get_input(i);
const TypeSpec *typespec = input->typedesc.get_typespec();
+   string typestring = bvm_glsl_get_type(typespec, true);
+   string basename = sanitize_name(input->name);

-   /* Note: argument names are unique! */
-   GLSLValue *value = create_value(typespec, input->name, false);
-   m_input_args.push_back(value);
+   DualValue dval;
+   if (bvm_glsl_type_has_dual_value(typespec)) {
+   /* Note: argument names are already unique */
+   dval = DualValue(create_value(typespec, basename + 
"_V", false),
+create_value(typespec, basename + 
"_DX", false),
+create_value(typespec, basename + 
"_DY", false));
+   
+   if (i > 0)
+   m_code << ", ";
+   m_code << "in " << typestring << " " << 
dval.value()->name()
+  << ", in " << typestring << " " << 
dval.dx()->name()
+  << ", in " << typestring << " " << 
dval.dy()->name();
+   }
+   else {
+   /* Note: argument names are already unique */
+   dval = DualValue(create_value(typespec, basename, 
false), NULL, NULL);
+   
+   if (i > 0)
+   m_code << ", ";
+   m_code << "in " << typestring << " " << 
dval.value()->name();
+   }

-   if (i > 0)
-   m_code << ", ";
-   m_code << "in " << bvm_glsl_get_type(typespec, true)<< " " << 
value->name();
+   register_value(dval);
+   m_input_args.push_back(dval);
}

size_t num_outputs = graph->outputs.size();
@@ -121,14 +162,33 @@ void GLSLCodeGenerator::node_graph_begin(const string 
&name, const NodeGraph *gr
for (int i = 0; i < num_outputs; ++i) {
const NodeG

[Bf-blender-cvs] [99c1b7b] strand_nodes: Added new node tree type for hair nodes.

2016-07-21 Thread Lukas Tönne
Commit: 99c1b7b5f48a9834366944689db5c9652d0e18a1
Author: Lukas Tönne
Date:   Tue Jul 19 13:24:59 2016 +0200
Branches: strand_nodes
https://developer.blender.org/rB99c1b7b5f48a9834366944689db5c9652d0e18a1

Added new node tree type for hair nodes.

===

M   release/scripts/nodes/__init__.py
A   release/scripts/nodes/hair_nodes.py
M   release/scripts/nodes/object_nodes.py
M   source/blender/editors/space_node/node_draw.c

===

diff --git a/release/scripts/nodes/__init__.py 
b/release/scripts/nodes/__init__.py
index e65021b..22cc2c7 100644
--- a/release/scripts/nodes/__init__.py
+++ b/release/scripts/nodes/__init__.py
@@ -29,6 +29,7 @@ _modules = [
 "group_nodes",
 "forcefield_nodes",
 "geometry_nodes",
+"hair_nodes",
 "rigidbody_nodes",
 "smokesim_nodes",
 "object_nodes",
diff --git a/release/scripts/nodes/hair_nodes.py 
b/release/scripts/nodes/hair_nodes.py
new file mode 100644
index 000..0d5b1fc
--- /dev/null
+++ b/release/scripts/nodes/hair_nodes.py
@@ -0,0 +1,149 @@
+# # BEGIN GPL LICENSE BLOCK #
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# # END GPL LICENSE BLOCK #
+
+# 
+
+import bpy
+import nodeitems_utils
+from bpy.types import Operator, ObjectNode, NodeTree, Node
+from bpy.props import *
+from nodeitems_utils import NodeCategory, NodeItem
+from mathutils import *
+from common_nodes import NodeTreeBase, NodeBase, DynamicSocketListNode, 
enum_property_copy, enum_property_value_prop
+import group_nodes
+
+###
+
+
+# our own base class with an appropriate poll function,
+# so the categories only show up in our own tree type
+class HairNodeCategory(NodeCategory):
+@classmethod
+def poll(cls, context):
+tree = context.space_data.edit_tree
+return tree and tree.bl_idname == 'HairNodeTree'
+
+###
+
+class HairNodeTree(NodeTreeBase, NodeTree):
+'''Hair nodes'''
+bl_idname = 'HairNodeTree'
+bl_label = 'Hair Nodes'
+bl_icon = 'MESH_DATA'
+
+# does not show up in the editor header
+@classmethod
+def poll(cls, context):
+return False
+
+def init_default(self):
+pass
+
+
+class HairNodeBase(NodeBase):
+@classmethod
+def poll(cls, ntree):
+return ntree.bl_idname == 'HairNodeTree'
+
+###
+
+class HairNodesNew(Operator):
+"""Create new hair node tree"""
+bl_idname = "object_nodes.hair_nodes_new"
+bl_label = "New"
+bl_options = {'REGISTER', 'UNDO'}
+
+name = StringProperty(
+name="Name",
+default="HairNodes",
+)
+
+@classmethod
+def make_node_tree(cls, name="HairNodes"):
+ntree = bpy.data.node_groups.new(name, HairNodeTree.bl_idname)
+if ntree:
+ntree.init_default()
+return ntree
+
+def execute(self, context):
+node = getattr(context, "node", None)
+ntree = self.make_node_tree(self.name)
+if ntree is None:
+return {'CANCELLED'}
+if node:
+node.id = ntree
+return {'FINISHED'}
+
+###
+
+def register():
+bpy.utils.register_module(__name__)
+gnode, ginput, goutput = group_nodes.make_node_group_types(
+"Hair", HairNodeTree, HairNodeBase)
+
+node_categories = [
+HairNodeCategory("GEO_INPUT", "Input", items=[
+NodeItem(ginput.bl_idname),
+NodeItem("ObjectValueFloatNode"),
+NodeItem("ObjectValueIntNode"),
+NodeItem("ObjectValueVectorNode"),
+NodeItem("ObjectValueColorNode"),
+]),
+HairNodeCategory("GEO_OUTPUT", "Output", items=[
+NodeItem(goutput.bl_idname),
+]),
+HairNodeCategory("GEO_CONVERTER", "Converter", items=[
+NodeItem("ObjectSeparateVectorNode"),
+NodeItem("ObjectCombineVectorNode"),
+]),
+HairNodeCategory("GEO_MATH", 

[Bf-blender-cvs] [454cae8] strand_nodes: Smarter handling of debug_mode enum in the debugging utility script.

2016-07-21 Thread Lukas Tönne
Commit: 454cae8361392fea5c241cf89da5f9f2dd2080b5
Author: Lukas Tönne
Date:   Wed Jul 20 12:10:18 2016 +0200
Branches: strand_nodes
https://developer.blender.org/rB454cae8361392fea5c241cf89da5f9f2dd2080b5

Smarter handling of debug_mode enum in the debugging utility script.

===

M   release/scripts/nodes/bvm_debug.py

===

diff --git a/release/scripts/nodes/bvm_debug.py 
b/release/scripts/nodes/bvm_debug.py
index 8ecd594..3063501 100644
--- a/release/scripts/nodes/bvm_debug.py
+++ b/release/scripts/nodes/bvm_debug.py
@@ -35,13 +35,16 @@ def enum_property_copy(prop):
 default=prop.default,
 items=items)
 
+_prop_funtype = 
bpy.types.NodeTree.bl_rna.functions['bvm_debug_graphviz'].parameters['function_type']
+_prop_debug_mode = 
bpy.types.NodeTree.bl_rna.functions['bvm_debug_graphviz'].parameters['debug_mode']
+
 class BVMNodeGraphvizOperator(Operator):
 bl_idname = "node.bvm_graphviz_show"
 bl_label = "Show Debug Graphviz Nodes"
 bl_options = {'REGISTER', 'UNDO'}
 
-function_type = 
enum_property_copy(bpy.types.NodeTree.bl_rna.functions['bvm_debug_graphviz'].parameters['function_type'])
-debug_mode = 
enum_property_copy(bpy.types.NodeTree.bl_rna.functions['bvm_debug_graphviz'].parameters['debug_mode'])
+function_type = enum_property_copy(_prop_funtype)
+debug_mode = enum_property_copy(_prop_debug_mode)
 
 def execute(self, context):
 if not hasattr(context, "debug_nodetree"):
@@ -78,21 +81,10 @@ def draw_depshow_op(layout, ntree):
 layout.context_pointer_set("debug_nodetree", ntree)
 
 col = layout.column(align=True)
-props = col.operator(BVMNodeGraphvizOperator.bl_idname, text="Nodes")
-props.function_type = funtype
-props.debug_mode = 'NODES'
-props = col.operator(BVMNodeGraphvizOperator.bl_idname, text="Nodes 
(unoptimized)")
-props.function_type = funtype
-props.debug_mode = 'NODES_UNOPTIMIZED'
-props = col.operator(BVMNodeGraphvizOperator.bl_idname, text="BVM Code")
-props.function_type = funtype
-props.debug_mode = 'BVM_CODE'
-props = col.operator(BVMNodeGraphvizOperator.bl_idname, text="LLVM Code")
-props.function_type = funtype
-props.debug_mode = 'LLVM_CODE'
-props = col.operator(BVMNodeGraphvizOperator.bl_idname, text="LLVM Code 
(unoptimized)")
-props.function_type = funtype
-props.debug_mode = 'LLVM_CODE_UNOPTIMIZED'
+for item in _prop_debug_mode.enum_items:
+props = col.operator(BVMNodeGraphvizOperator.bl_idname, text=item.name)
+props.function_type = funtype
+props.debug_mode = item.identifier
 
 class BVMNodeGraphvizPanel(Panel):
 bl_idname = "node.bvm_graphviz_panel"

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


[Bf-blender-cvs] [a655c35] strand_nodes: Merge branch 'strand_gpu' into strand_nodes

2016-07-21 Thread Lukas Tönne
Commit: a655c3520be22baee208d0732b1d45697b0b30da
Author: Lukas Tönne
Date:   Tue Jul 19 17:13:10 2016 +0200
Branches: strand_nodes
https://developer.blender.org/rBa655c3520be22baee208d0732b1d45697b0b30da

Merge branch 'strand_gpu' into strand_nodes

===



===



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


[Bf-blender-cvs] [c4f8562] strand_nodes: New code generator for GLSL code.

2016-07-21 Thread Lukas Tönne
Commit: c4f85627c34a3a79d91b15946508d0b725514599
Author: Lukas Tönne
Date:   Wed Jul 20 12:08:59 2016 +0200
Branches: strand_nodes
https://developer.blender.org/rBc4f85627c34a3a79d91b15946508d0b725514599

New code generator for GLSL code.

This can be used as part of shaders.

===

M   build_files/cmake/macros.cmake
M   source/blender/blenvm/BVM_api.h
M   source/blender/blenvm/CMakeLists.txt
A   source/blender/blenvm/glsl/CMakeLists.txt
A   source/blender/blenvm/glsl/glsl_codegen.cc
A   source/blender/blenvm/glsl/glsl_codegen.h
M   source/blender/blenvm/intern/bvm_api.cc
M   source/blender/blenvm/util/util_string.h
M   source/blenderplayer/CMakeLists.txt

===

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 595b634..9949436 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -597,6 +597,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
bf_blenvm
bf_blenvm_compile
bf_blenvm_bvm
+   bf_blenvm_glsl
bf_physics
bf_nodes
bf_rna
diff --git a/source/blender/blenvm/BVM_api.h b/source/blender/blenvm/BVM_api.h
index ee1bdcf..74cfe90 100644
--- a/source/blender/blenvm/BVM_api.h
+++ b/source/blender/blenvm/BVM_api.h
@@ -123,6 +123,7 @@ typedef enum BVMDebugMode {
BVM_DEBUG_BVM_CODE,
BVM_DEBUG_LLVM_CODE,
BVM_DEBUG_LLVM_CODE_UNOPTIMIZED,
+   BVM_DEBUG_GLSL_CODE,
 } BVMDebugMode;
 
 /* - */
diff --git a/source/blender/blenvm/CMakeLists.txt 
b/source/blender/blenvm/CMakeLists.txt
index 184a0ec..0f9f4f2 100644
--- a/source/blender/blenvm/CMakeLists.txt
+++ b/source/blender/blenvm/CMakeLists.txt
@@ -27,6 +27,7 @@ set(INC
.
bvm
compile
+   glsl
llvm
intern
util
@@ -111,6 +112,7 @@ endif()
 
 add_subdirectory(bvm)
 add_subdirectory(compile)
+add_subdirectory(glsl)
 
 if(WITH_LLVM)
add_subdirectory(llvm)
diff --git a/source/blender/blenvm/glsl/CMakeLists.txt 
b/source/blender/blenvm/glsl/CMakeLists.txt
new file mode 100644
index 000..8e684e8
--- /dev/null
+++ b/source/blender/blenvm/glsl/CMakeLists.txt
@@ -0,0 +1,48 @@
+# * BEGIN GPL LICENSE BLOCK *
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# The Original Code is Copyright (C) 2016, Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): Lukas Toenne.
+#
+# * END GPL LICENSE BLOCK *
+
+set(INC
+   .
+   ..
+   ../compile
+   ../intern
+   ../modules
+   ../util
+   ../../blenkernel
+   ../../blenlib
+   ../../makesdna
+   ../../makesrna
+   ../../../../intern/guardedalloc
+)
+
+set(INC_SYS
+)
+
+set(SRC
+   glsl_codegen.cc
+   glsl_codegen.h
+)
+
+blender_add_lib(bf_blenvm_glsl "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/blenvm/glsl/glsl_codegen.cc 
b/source/blender/blenvm/glsl/glsl_codegen.cc
new file mode 100644
index 000..2197f70
--- /dev/null
+++ b/source/blender/blenvm/glsl/glsl_codegen.cc
@@ -0,0 +1,150 @@
+/*
+ * * BEGIN GPL LICENSE BLOCK *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Lukas Toenne
+ *
+ * * END GPL LICENSE BLOCK **

[Bf-blender-cvs] [ecebe94] strand_nodes: Merge branch 'strand_gpu' into strand_nodes

2016-07-21 Thread Lukas Tönne
Commit: ecebe940e042ec03f432e413ea422bf79705f3c6
Author: Lukas Tönne
Date:   Tue Jul 19 11:09:26 2016 +0200
Branches: strand_nodes
https://developer.blender.org/rBecebe940e042ec03f432e413ea422bf79705f3c6

Merge branch 'strand_gpu' into strand_nodes

===



===



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


[Bf-blender-cvs] [571c9d7] strand_nodes: Merge branch 'master' into strand_nodes

2016-07-21 Thread Lukas Tönne
Commit: 571c9d7520adf7795704703eb34458e99c113fb8
Author: Lukas Tönne
Date:   Tue Jul 19 11:43:27 2016 +0200
Branches: strand_nodes
https://developer.blender.org/rB571c9d7520adf7795704703eb34458e99c113fb8

Merge branch 'master' into strand_nodes

===



===



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


[Bf-blender-cvs] [9d0cbbe] master: Tracking: Fix bug when tracker will keep trying tracking past the footage

2016-07-21 Thread Sergey Sharybin
Commit: 9d0cbbe1dd97a0346d8e10f9ddc2608181bf1148
Author: Sergey Sharybin
Date:   Thu Jul 21 17:01:26 2016 +0200
Branches: master
https://developer.blender.org/rB9d0cbbe1dd97a0346d8e10f9ddc2608181bf1148

Tracking: Fix bug when tracker will keep trying tracking past the footage

===

M   intern/libmv/intern/autotrack.cc

===

diff --git a/intern/libmv/intern/autotrack.cc b/intern/libmv/intern/autotrack.cc
index f0cbc68..3b7c9c5 100644
--- a/intern/libmv/intern/autotrack.cc
+++ b/intern/libmv/intern/autotrack.cc
@@ -67,12 +67,12 @@ int libmv_autoTrackMarker(libmv_AutoTrack* libmv_autotrack,
   libmv_apiMarkerToMarker(*libmv_tracked_marker, &tracked_marker);
   libmv_configureTrackRegionOptions(*libmv_options,
 &options);
-  (((AutoTrack*) libmv_autotrack)->TrackMarker(&tracked_marker,
-   &result,
-   &options));
+  bool ok = (((AutoTrack*) libmv_autotrack)->TrackMarker(&tracked_marker,
+ &result,
+ &options));
   libmv_markerToApiMarker(tracked_marker, libmv_tracked_marker);
   libmv_regionTrackergetResult(result, libmv_result);
-  return result.is_usable();
+  return ok && result.is_usable();
 }
 
 void libmv_autoTrackAddMarker(libmv_AutoTrack* libmv_autotrack,

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


[Bf-blender-cvs] [85761d4] alembic_basic_io: Make mesh validation optional.

2016-07-21 Thread Kévin Dietrich
Commit: 85761d4779500753a38aa2368c460454c1cb49b3
Author: Kévin Dietrich
Date:   Thu Jul 21 17:27:52 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB85761d4779500753a38aa2368c460454c1cb49b3

Make mesh validation optional.

===

M   source/blender/alembic/ABC_alembic.h
M   source/blender/alembic/intern/abc_mesh.cc
M   source/blender/alembic/intern/abc_object.h
M   source/blender/alembic/intern/abc_points.cc
M   source/blender/alembic/intern/alembic_capi.cc
M   source/blender/editors/io/io_alembic.c

===

diff --git a/source/blender/alembic/ABC_alembic.h 
b/source/blender/alembic/ABC_alembic.h
index bb735b1..1d642bb 100644
--- a/source/blender/alembic/ABC_alembic.h
+++ b/source/blender/alembic/ABC_alembic.h
@@ -81,7 +81,8 @@ void ABC_import(struct bContext *C,
 bool is_sequence,
 bool set_frame_range,
 int sequence_len,
-int offset);
+int offset,
+bool validate_meshes);
 
 AbcArchiveHandle *ABC_create_handle(const char *filename, struct ListBase 
*object_paths);
 
diff --git a/source/blender/alembic/intern/abc_mesh.cc 
b/source/blender/alembic/intern/abc_mesh.cc
index 83c7eba..888c281 100644
--- a/source/blender/alembic/intern/abc_mesh.cc
+++ b/source/blender/alembic/intern/abc_mesh.cc
@@ -1000,7 +1000,10 @@ void AbcMeshReader::readObjectData(Main *bmain, float 
time)
read_mesh_sample(m_settings, m_schema, sample_sel, m_mesh_data, 
has_smooth_normals);
 
BKE_mesh_calc_normals(mesh);
-   BKE_mesh_validate(mesh, false, false);
+
+   if (m_settings->validate_meshes) {
+   BKE_mesh_validate(mesh, false, false);
+   }
 
readFaceSetsSample(bmain, mesh, 0, sample_sel);
 
@@ -1164,7 +1167,10 @@ void AbcSubDReader::readObjectData(Main *bmain, float 
time)
}
 
BKE_mesh_calc_normals(mesh);
-   BKE_mesh_validate(mesh, false, false);
+
+   if (m_settings->validate_meshes) {
+   BKE_mesh_validate(mesh, false, false);
+   }
 
if (has_animations(m_schema, m_settings)) {
addCacheModifier();
diff --git a/source/blender/alembic/intern/abc_object.h 
b/source/blender/alembic/intern/abc_object.h
index f665254..ded565b 100644
--- a/source/blender/alembic/intern/abc_object.h
+++ b/source/blender/alembic/intern/abc_object.h
@@ -103,6 +103,8 @@ struct ImportSettings {
 
int flag;
 
+   bool validate_meshes;
+
CacheFile *cache_file;
 
ImportSettings()
@@ -115,6 +117,7 @@ struct ImportSettings {
, sequence_len(1)
, offset(0)
, flag(0)
+   , validate_meshes(false)
, cache_file(NULL)
{}
 };
diff --git a/source/blender/alembic/intern/abc_points.cc 
b/source/blender/alembic/intern/abc_points.cc
index c8b346a..b0be0e9 100644
--- a/source/blender/alembic/intern/abc_points.cc
+++ b/source/blender/alembic/intern/abc_points.cc
@@ -173,7 +173,9 @@ void AbcPointsReader::readObjectData(Main *bmain, float 
time)
 
read_mverts(mesh->mvert, positions, vnormals);
 
-   BKE_mesh_validate(mesh, false, false);
+   if (m_settings->validate_meshes) {
+   BKE_mesh_validate(mesh, false, false);
+   }
 
m_object = BKE_object_add_only_object(bmain, OB_MESH, 
m_object_name.c_str());
m_object->data = mesh;
diff --git a/source/blender/alembic/intern/alembic_capi.cc 
b/source/blender/alembic/intern/alembic_capi.cc
index d7a1500..c54b8ad 100644
--- a/source/blender/alembic/intern/alembic_capi.cc
+++ b/source/blender/alembic/intern/alembic_capi.cc
@@ -757,7 +757,7 @@ static void import_freejob(void *user_data)
delete data;
 }
 
-void ABC_import(bContext *C, const char *filepath, float scale, bool 
is_sequence, bool set_frame_range, int sequence_len, int offset)
+void ABC_import(bContext *C, const char *filepath, float scale, bool 
is_sequence, bool set_frame_range, int sequence_len, int offset, bool 
validate_meshes)
 {
/* Using new here since MEM_* funcs do not call ctor to properly 
initialize
 * data. */
@@ -771,6 +771,7 @@ void ABC_import(bContext *C, const char *filepath, float 
scale, bool is_sequence
job->settings.set_frame_range = set_frame_range;
job->settings.sequence_len = sequence_len;
job->settings.offset = offset;
+   job->settings.validate_meshes = validate_meshes;
job->parent_map = NULL;
job->error_code = ABC_NO_ERROR;
job->was_cancelled = false;
diff --git a/source/blender/editors/io/io_alembic.c 
b/source/blender/editors/io/io_alembic.c
index a344609..42d1ced 100644
--- a/source/blender/editors/io/io_alembic.c
+++ b/source/blender/editors/io/io_alembic.c
@@ -383,6 +383,9 @@ static void ui_alembic_import_settings(uiLayout *layout, 
PointerRNA *imfptr)
 
ro

[Bf-blender-cvs] [9be4cd5] alembic_basic_io: Merge branch 'master' into alembic_basic_io

2016-07-21 Thread Kévin Dietrich
Commit: 9be4cd52a795c1139700348be1bcc5d38150f0e5
Author: Kévin Dietrich
Date:   Thu Jul 21 17:12:09 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB9be4cd52a795c1139700348be1bcc5d38150f0e5

Merge branch 'master' into alembic_basic_io

Conflicts:
source/blender/blenkernel/intern/library.c

===



===

diff --cc source/blender/blenkernel/intern/library.c
index 54bb080,c31df68..39bdb10
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@@ -352,11 -404,14 +407,16 @@@ bool id_make_local(Main *bmain, ID *id
case ID_WM:
return false; /* can't be linked */
case ID_GD:
-   return false; /* not implemented */
+   if (!test) BKE_gpencil_make_local(bmain, (bGPdata *)id, 
lib_local);
+   return true;
+   case ID_MSK:
+   if (!test) BKE_mask_make_local(bmain, (Mask *)id, 
lib_local);
+   return true;
case ID_LS:
-   return false; /* not implemented */
+   if (!test) BKE_linestyle_make_local(bmain, 
(FreestyleLineStyle *)id, lib_local);
+   return true;
 +  case ID_CF:
 +  return false;  /* not implemented */
}
  
return false;

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


[Bf-blender-cvs] [01fed3d] alembic_basic_io: Add a make local function to CacheFile id block.

2016-07-21 Thread Kévin Dietrich
Commit: 01fed3dc55ff67b651055913d2b93c76cfffb5dd
Author: Kévin Dietrich
Date:   Thu Jul 21 17:20:32 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB01fed3dc55ff67b651055913d2b93c76cfffb5dd

Add a make local function to CacheFile id block.

===

M   source/blender/blenkernel/BKE_cachefile.h
M   source/blender/blenkernel/intern/cachefile.c
M   source/blender/blenkernel/intern/library.c

===

diff --git a/source/blender/blenkernel/BKE_cachefile.h 
b/source/blender/blenkernel/BKE_cachefile.h
index c3f1781..8d94688 100644
--- a/source/blender/blenkernel/BKE_cachefile.h
+++ b/source/blender/blenkernel/BKE_cachefile.h
@@ -44,6 +44,8 @@ void BKE_cachefile_free(struct CacheFile *cache_file);
 
 struct CacheFile *BKE_cachefile_copy(struct Main *bmain, struct CacheFile 
*cache_file);
 
+void BKE_cachefile_make_local(struct Main *bmain, struct CacheFile 
*cache_file, const bool lib_local);
+
 void BKE_cachefile_reload(const struct Main *bmain, struct CacheFile 
*cache_file);
 
 void BKE_cachefile_update_frame(struct Main *bmain, struct Scene *scene, float 
ctime, const float fps);
diff --git a/source/blender/blenkernel/intern/cachefile.c 
b/source/blender/blenkernel/intern/cachefile.c
index 1c0d740..a5442f1 100644
--- a/source/blender/blenkernel/intern/cachefile.c
+++ b/source/blender/blenkernel/intern/cachefile.c
@@ -96,6 +96,11 @@ CacheFile *BKE_cachefile_copy(Main *bmain, CacheFile 
*cache_file)
return new_cache_file;
 }
 
+void BKE_cachefile_make_local(Main *bmain, CacheFile *cache_file, const bool 
lib_local)
+{
+   BKE_id_make_local_generic(bmain, &cache_file->id, true, lib_local);
+}
+
 void BKE_cachefile_reload(const Main *bmain, CacheFile *cache_file)
 {
char filepath[FILE_MAX];
diff --git a/source/blender/blenkernel/intern/library.c 
b/source/blender/blenkernel/intern/library.c
index 39bdb10..2b85113 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -416,7 +416,8 @@ bool id_make_local(Main *bmain, ID *id, const bool test, 
const bool lib_local)
if (!test) BKE_linestyle_make_local(bmain, 
(FreestyleLineStyle *)id, lib_local);
return true;
case ID_CF:
-   return false;  /* not implemented */
+   if (!test) BKE_cachefile_make_local(bmain, (CacheFile 
*)id, lib_local);
+   return true;
}
 
return false;

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


[Bf-blender-cvs] [2977dcf] master: Tracking: Fix possible cases when tracker will try tracking failed tracks

2016-07-21 Thread Sergey Sharybin
Commit: 2977dcf2f7471e00079100803fd4203fcf97f20a
Author: Sergey Sharybin
Date:   Thu Jul 21 16:53:45 2016 +0200
Branches: master
https://developer.blender.org/rB2977dcf2f7471e00079100803fd4203fcf97f20a

Tracking: Fix possible cases when tracker will try tracking failed tracks

===

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

===

diff --git a/source/blender/blenkernel/intern/tracking_auto.c 
b/source/blender/blenkernel/intern/tracking_auto.c
index 9df30a8..3b56ea2 100644
--- a/source/blender/blenkernel/intern/tracking_auto.c
+++ b/source/blender/blenkernel/intern/tracking_auto.c
@@ -376,6 +376,9 @@ bool BKE_autotrack_context_step(AutoTrackContext *context)
 #pragma omp parallel for if (context->num_tracks > 1)
for (track = 0; track < context->num_tracks; ++track) {
AutoTrackOptions *options = &context->options[track];
+   if (options->is_failed) {
+   continue;
+   }
libmv_Marker libmv_current_marker,
 libmv_reference_marker,
 libmv_tracked_marker;
@@ -463,16 +466,25 @@ void BKE_autotrack_context_sync(AutoTrackContext *context)
AutoTrackOptions *options = &context->options[track];
int track_frame = 
BKE_movieclip_remap_scene_to_clip_frame(
context->clips[options->clip_index], frame);
-   if (options->is_failed && options->failed_frame == 
track_frame) {
-   MovieTrackingMarker *prev_marker =
-   
BKE_tracking_marker_get_exact(options->track, frame);
-   if (prev_marker) {
-   marker = *prev_marker;
-   marker.framenr = context->backwards ?
-track_frame - 1 :
-track_frame + 1;
-   marker.flag |= MARKER_DISABLED;
-   
BKE_tracking_marker_insert(options->track, &marker);
+   if (options->is_failed) {
+   if (options->failed_frame == track_frame) {
+   MovieTrackingMarker *prev_marker =
+   BKE_tracking_marker_get_exact(
+   options->track,
+   context->backwards
+   ? frame + 1
+   : frame - 1);
+   if (prev_marker) {
+   marker = *prev_marker;
+   marker.framenr = track_frame;
+   marker.flag |= MARKER_DISABLED;
+   
BKE_tracking_marker_insert(options->track, &marker);
+   continue;
+   }
+   }
+   if ((context->backwards && 
options->failed_frame > track_frame) ||
+   (!context->backwards && 
options->failed_frame < track_frame))
+   {
continue;
}
}

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


[Bf-blender-cvs] [db0c2be] master: BKE mesh mapping: add new BKE_mesh_edge_loop_map_create().

2016-07-21 Thread Bastien Montagne
Commit: db0c2be55e8705f939c944430be1c9d55598a211
Author: Bastien Montagne
Date:   Thu Jul 21 16:30:57 2016 +0200
Branches: master
https://developer.blender.org/rBdb0c2be55e8705f939c944430be1c9d55598a211

BKE mesh mapping: add new BKE_mesh_edge_loop_map_create().

Maps edges to all their pair of loops.

===

M   source/blender/blenkernel/BKE_mesh_mapping.h
M   source/blender/blenkernel/intern/mesh_mapping.c

===

diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h 
b/source/blender/blenkernel/BKE_mesh_mapping.h
index dff79b6..7689591 100644
--- a/source/blender/blenkernel/BKE_mesh_mapping.h
+++ b/source/blender/blenkernel/BKE_mesh_mapping.h
@@ -125,6 +125,11 @@ void BKE_mesh_vert_edge_map_create(
 void BKE_mesh_vert_edge_vert_map_create(
 MeshElemMap **r_map, int **r_mem,
 const struct MEdge *medge, int totvert, int totedge);
+void BKE_mesh_edge_loop_map_create(
+MeshElemMap **r_map, int **r_mem,
+const struct MEdge *medge, const int totedge,
+const struct MPoly *mpoly, const int totpoly,
+const struct MLoop *mloop, const int totloop);
 void BKE_mesh_edge_poly_map_create(
 MeshElemMap **r_map, int **r_mem,
 const struct MEdge *medge, const int totedge,
diff --git a/source/blender/blenkernel/intern/mesh_mapping.c 
b/source/blender/blenkernel/intern/mesh_mapping.c
index a472b6e..dc2e953 100644
--- a/source/blender/blenkernel/intern/mesh_mapping.c
+++ b/source/blender/blenkernel/intern/mesh_mapping.c
@@ -393,6 +393,60 @@ void BKE_mesh_vert_edge_vert_map_create(
 }
 
 /**
+ * Generates a map where the key is the edge and the value is a list of loops 
that use that edge.
+ * Loops indices of a same poly are contiguous and in winding order.
+ * The lists are allocated from one memory pool.
+ */
+void BKE_mesh_edge_loop_map_create(MeshElemMap **r_map, int **r_mem,
+   const MEdge *UNUSED(medge), const int 
totedge,
+   const MPoly *mpoly, const int totpoly,
+   const MLoop *mloop, const int totloop)
+{
+   MeshElemMap *map = MEM_callocN(sizeof(MeshElemMap) * (size_t)totedge, 
"edge-poly map");
+   int *indices = MEM_mallocN(sizeof(int) * (size_t)totloop * 2, 
"edge-poly map mem");
+   int *index_step;
+   const MPoly *mp;
+   int i;
+
+   /* count face users */
+   for (i = 0, mp = mpoly; i < totpoly; mp++, i++) {
+   const MLoop *ml;
+   int j = mp->totloop;
+   for (ml = &mloop[mp->loopstart]; j--; ml++) {
+   map[ml->e].count += 2;
+   }
+   }
+
+   /* create offsets */
+   index_step = indices;
+   for (i = 0; i < totedge; i++) {
+   map[i].indices = index_step;
+   index_step += map[i].count;
+
+   /* re-count, using this as an index below */
+   map[i].count = 0;
+   }
+
+   /* assign loop-edge users */
+   for (i = 0, mp = mpoly; i < totpoly; mp++, i++) {
+   const MLoop *ml;
+   MeshElemMap *map_ele;
+   const int max_loop = mp->loopstart + mp->totloop;
+   int j = mp->loopstart;
+   for (ml = &mloop[j]; j < max_loop; j++, ml++) {
+   map_ele = &map[ml->e];
+   map_ele->indices[map_ele->count++] = j;
+   map_ele->indices[map_ele->count++] = j + 1;
+   }
+   /* last edge/loop of poly, must point back to first loop! */
+   map_ele->indices[map_ele->count - 1] = mp->loopstart;
+   }
+
+   *r_map = map;
+   *r_mem = indices;
+}
+
+/**
  * Generates a map where the key is the edge and the value is a list of 
polygons that use that edge.
  * The lists are allocated from one memory pool.
  */

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


[Bf-blender-cvs] [b156674] master: Fix missing datablocks types in id_make_local.

2016-07-21 Thread Bastien Montagne
Commit: b1566742516a66d2b68ebb4bacb6802582c09489
Author: Bastien Montagne
Date:   Thu Jul 21 16:09:08 2016 +0200
Branches: master
https://developer.blender.org/rBb1566742516a66d2b68ebb4bacb6802582c09489

Fix missing datablocks types in id_make_local.

Adding make_local for vfont/gpencil/group/freestyle 
linestyle/mask/scene/sound/text.

Note that there are still some lose ends here, since some type are not handled 
by id_copy
(Scene, Sound and VFont), which means in case a datablock of that type is used 
both
directly and indirectly, localization will fail.

Scene copying might be doable though (maybe with a simple new 'full shalow' 
mode to existing BKE_scene_copy?),
not sure about sounds and vfonts... Situations where this becomes an issue 
should be very rare corner cases anyway.

===

M   source/blender/blenkernel/BKE_font.h
M   source/blender/blenkernel/BKE_gpencil.h
M   source/blender/blenkernel/BKE_group.h
M   source/blender/blenkernel/BKE_linestyle.h
M   source/blender/blenkernel/BKE_mask.h
M   source/blender/blenkernel/BKE_scene.h
M   source/blender/blenkernel/BKE_sound.h
M   source/blender/blenkernel/BKE_text.h
M   source/blender/blenkernel/intern/font.c
M   source/blender/blenkernel/intern/gpencil.c
M   source/blender/blenkernel/intern/group.c
M   source/blender/blenkernel/intern/library.c
M   source/blender/blenkernel/intern/linestyle.c
M   source/blender/blenkernel/intern/mask.c
M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenkernel/intern/sound.c
M   source/blender/blenkernel/intern/text.c

===

diff --git a/source/blender/blenkernel/BKE_font.h 
b/source/blender/blenkernel/BKE_font.h
index 0711c42..6775639 100644
--- a/source/blender/blenkernel/BKE_font.h
+++ b/source/blender/blenkernel/BKE_font.h
@@ -82,6 +82,8 @@ struct VFont *BKE_vfont_load(struct Main *bmain, const char 
*filepath);
 struct VFont *BKE_vfont_load_exists_ex(struct Main *bmain, const char 
*filepath, bool *r_exists);
 struct VFont *BKE_vfont_load_exists(struct Main *bmain, const char *filepath);
 
+void BKE_vfont_make_local(struct Main *bmain, struct VFont *vfont, const bool 
lib_local);
+
 bool BKE_vfont_to_curve_ex(struct Main *bmain, struct Object *ob, int mode,
struct ListBase *r_nubase,
const wchar_t **r_text, int *r_text_len, bool 
*r_text_free,
diff --git a/source/blender/blenkernel/BKE_gpencil.h 
b/source/blender/blenkernel/BKE_gpencil.h
index 6159531..e9e3cd3 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -56,6 +56,8 @@ struct bGPDframe *gpencil_frame_duplicate(struct bGPDframe 
*src);
 struct bGPDlayer *gpencil_layer_duplicate(struct bGPDlayer *src);
 struct bGPdata *gpencil_data_duplicate(struct Main *bmain, struct bGPdata 
*gpd, bool internal_copy);
 
+void BKE_gpencil_make_local(struct Main *bmain, struct bGPdata *gpd, const 
bool lib_local);
+
 void gpencil_frame_delete_laststroke(struct bGPDlayer *gpl, struct bGPDframe 
*gpf);
 
 
diff --git a/source/blender/blenkernel/BKE_group.h 
b/source/blender/blenkernel/BKE_group.h
index 4f2c890..09a069e 100644
--- a/source/blender/blenkernel/BKE_group.h
+++ b/source/blender/blenkernel/BKE_group.h
@@ -43,6 +43,7 @@ struct Scene;
 void  BKE_group_free(struct Group *group);
 struct Group *BKE_group_add(struct Main *bmain, const char *name);
 struct Group *BKE_group_copy(struct Main *bmain, struct Group *group);
+void  BKE_group_make_local(struct Main *bmain, struct Group *group, 
const bool lib_local);
 bool  BKE_group_object_add(struct Group *group, struct Object *ob, 
struct Scene *scene, struct Base *base);
 bool  BKE_group_object_unlink(struct Group *group, struct Object *ob, 
struct Scene *scene, struct Base *base);
 struct Group *BKE_group_object_find(struct Group *group, struct Object *ob);
diff --git a/source/blender/blenkernel/BKE_linestyle.h 
b/source/blender/blenkernel/BKE_linestyle.h
index e343cd2..e96ef4e 100644
--- a/source/blender/blenkernel/BKE_linestyle.h
+++ b/source/blender/blenkernel/BKE_linestyle.h
@@ -54,6 +54,8 @@ FreestyleLineStyle *BKE_linestyle_new(struct Main *bmain, 
const char *name);
 voidBKE_linestyle_free(FreestyleLineStyle *linestyle);
 FreestyleLineStyle *BKE_linestyle_copy(struct Main *bmain, FreestyleLineStyle 
*linestyle);
 
+void BKE_linestyle_make_local(struct Main *bmain, struct FreestyleLineStyle 
*linestyle, const bool lib_local);
+
 FreestyleLineStyle *BKE_linestyle_active_from_scene(struct Scene *scene);
 
 LineStyleModifier *BKE_linestyle_color_modifier_add(FreestyleLineStyle 
*linestyle, const char *name, int type);
diff --git a/source/blender/blenkernel/BKE_mask.h 
b/source/blender/blenkernel/BKE_mask.h
index 97bfd0f..3349bff 100644
--- a/source/blender/blenk

[Bf-blender-cvs] [d4342b3] master: Fix (unreported) memleak in image copy function.

2016-07-21 Thread Bastien Montagne
Commit: d4342b38971b26d50d86e1bb47fed804db1aef6d
Author: Bastien Montagne
Date:   Thu Jul 21 16:27:30 2016 +0200
Branches: master
https://developer.blender.org/rBd4342b38971b26d50d86e1bb47fed804db1aef6d

Fix (unreported) memleak in image copy function.

===

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

===

diff --git a/source/blender/blenkernel/intern/image.c 
b/source/blender/blenkernel/intern/image.c
index 44bea5c..017eb41 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -456,7 +456,8 @@ Image *BKE_image_copy(Main *bmain, Image *ima)
 
copy_image_packedfiles(&nima->packedfiles, &ima->packedfiles);
 
-   nima->stereo3d_format = MEM_dupallocN(ima->stereo3d_format);
+   /* nima->stere3d_format is already allocated by image_alloc... */
+   *nima->stereo3d_format = *ima->stereo3d_format;
BLI_duplicatelist(&nima->views, &ima->views);
 
BKE_previewimg_id_copy(&nima->id, &ima->id);

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


[Bf-blender-cvs] [2969b30] master: Fix stupid (harmless) mistake in recent commit.

2016-07-21 Thread Bastien Montagne
Commit: 2969b308130e44538b8e40a1c17a434f5aa29062
Author: Bastien Montagne
Date:   Thu Jul 21 16:25:12 2016 +0200
Branches: master
https://developer.blender.org/rB2969b308130e44538b8e40a1c17a434f5aa29062

Fix stupid (harmless) mistake in recent commit.

===

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

===

diff --git a/source/blender/blenkernel/intern/group.c 
b/source/blender/blenkernel/intern/group.c
index d20b0ce..f58d26f 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -107,7 +107,7 @@ Group *BKE_group_copy(Main *bmain, Group *group)
 
 void BKE_group_make_local(Main *bmain, Group *group, const bool lib_local)
 {
-   BKE_id_make_local_generic(bmain, group, true, lib_local);
+   BKE_id_make_local_generic(bmain, &group->id, true, lib_local);
 }
 
 /* external */

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


[Bf-blender-cvs] [aedff9d] master: Add BKE_mesh_calc_islands_loop_poly_uvmap and use it in new OSD UV subdiv.

2016-07-21 Thread Bastien Montagne
Commit: aedff9dbef6c5847b6d8e855eb64401d44611f20
Author: Bastien Montagne
Date:   Thu Jul 21 16:53:00 2016 +0200
Branches: master
https://developer.blender.org/rBaedff9dbef6c5847b6d8e855eb64401d44611f20

Add BKE_mesh_calc_islands_loop_poly_uvmap and use it in new OSD UV subdiv.

Also renamed BKE_mesh_calc_islands_loop_poly_uv to 
BKE_mesh_calc_islands_loop_poly_edgeseam,
to avoid confusion...

===

M   source/blender/blenkernel/BKE_mesh_mapping.h
M   source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c
M   source/blender/blenkernel/intern/data_transfer.c
M   source/blender/blenkernel/intern/mesh_mapping.c

===

diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h 
b/source/blender/blenkernel/BKE_mesh_mapping.h
index 7689591..b5b5443 100644
--- a/source/blender/blenkernel/BKE_mesh_mapping.h
+++ b/source/blender/blenkernel/BKE_mesh_mapping.h
@@ -191,13 +191,21 @@ typedef bool (*MeshRemapIslandsCalc)(
 /* Above vert/UV mapping stuff does not do what we need here, but does things 
we do not need here.
  * So better keep them separated for now, I think.
  */
-bool BKE_mesh_calc_islands_loop_poly_uv(
+bool BKE_mesh_calc_islands_loop_poly_edgeseam(
 struct MVert *verts, const int totvert,
 struct MEdge *edges, const int totedge,
 struct MPoly *polys, const int totpoly,
 struct MLoop *loops, const int totloop,
 MeshIslandStore *r_island_store);
 
+bool BKE_mesh_calc_islands_loop_poly_uvmap(
+struct MVert *verts, const int totvert,
+struct MEdge *edges, const int totedge,
+struct MPoly *polys, const int totpoly,
+struct MLoop *loops, const int totloop,
+const struct MLoopUV *luvs,
+MeshIslandStore *r_island_store);
+
 int *BKE_mesh_calc_smoothgroups(
 const struct MEdge *medge, const int totedge,
 const struct MPoly *mpoly, const int totpoly,
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c 
b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c
index 9e8c97a..5c68e50 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c
@@ -322,11 +322,12 @@ static void conv_dm_precalc_uv_layer(const 
OpenSubdiv_Converter *converter,
}
 
/* Calculate islands connectivity of the UVs. */
-   BKE_mesh_calc_islands_loop_poly_uv(
+   BKE_mesh_calc_islands_loop_poly_uvmap(
storage->mvert, dm->getNumVerts(dm),
storage->medge, dm->getNumEdges(dm),
storage->mpoly, dm->getNumPolys(dm),
storage->mloop, dm->getNumLoops(dm),
+   mloopuv,
&storage->island_store);
 
/* Here we "weld" duplicated vertices from island to the same UV value.
diff --git a/source/blender/blenkernel/intern/data_transfer.c 
b/source/blender/blenkernel/intern/data_transfer.c
index 7292ed2..839673c 100644
--- a/source/blender/blenkernel/intern/data_transfer.c
+++ b/source/blender/blenkernel/intern/data_transfer.c
@@ -356,7 +356,7 @@ static MeshRemapIslandsCalc 
data_transfer_get_loop_islands_generator(const int c
 {
switch (cddata_type) {
case CD_FAKE_UV:
-   return BKE_mesh_calc_islands_loop_poly_uv;
+   return BKE_mesh_calc_islands_loop_poly_edgeseam;
default:
break;
}
diff --git a/source/blender/blenkernel/intern/mesh_mapping.c 
b/source/blender/blenkernel/intern/mesh_mapping.c
index dc2e953..1a20300 100644
--- a/source/blender/blenkernel/intern/mesh_mapping.c
+++ b/source/blender/blenkernel/intern/mesh_mapping.c
@@ -593,12 +593,12 @@ void BKE_mesh_origindex_map_create_looptri(
  */
 typedef bool (*MeshRemap_CheckIslandBoundary)(
 const struct MPoly *mpoly, const struct MLoop *mloop, const struct 
MEdge *medge,
-const int nbr_egde_users);
+const int nbr_egde_users, void *user_data);
 
 static void poly_edge_loop_islands_calc(
 const MEdge *medge, const int totedge, const MPoly *mpoly, const int 
totpoly,
 const MLoop *mloop, const int totloop, MeshElemMap *edge_poly_map,
-const bool use_bitflags, MeshRemap_CheckIslandBoundary 
edge_boundary_check,
+const bool use_bitflags, MeshRemap_CheckIslandBoundary 
edge_boundary_check, void *edge_boundary_check_data,
 int **r_poly_groups, int *r_totgroup, BLI_bitmap **r_edge_borders, int 
*r_totedgeborder)
 {
int *poly_groups;
@@ -680,7 +680,7 @@ static void poly_edge_loop_islands_calc(
const MeshElemMap *map_ele = 
&edge_poly_map[me_idx];
const int *p = map_ele->indices;
int i = map_ele->count;
-   if (!

[Bf-blender-cvs] [77ff125] master: BKE_library_make_local: clear behind us no more used linked datablocks.

2016-07-21 Thread Bastien Montagne
Commit: 77ff125232baf35c29e327d19f6c2e3799326f46
Author: Bastien Montagne
Date:   Thu Jul 21 16:18:05 2016 +0200
Branches: master
https://developer.blender.org/rB77ff125232baf35c29e327d19f6c2e3799326f46

BKE_library_make_local: clear behind us no more used linked datablocks.

This is really not elegant solution, but simplest for now.

Ideally, we'd check all IDs first and directly 'make local' (without need to 
copy)
those only indirectly used by other datablocks to be made local. Would also 
save us from the
need of the extra 'lib_local' parameter recently added to id_make_local.

Current code seems to work well enough though, and this is not high priority to 
fix imho.

===

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

===

diff --git a/source/blender/blenkernel/intern/library.c 
b/source/blender/blenkernel/intern/library.c
index 4dd66ac..c31df68 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1591,6 +1591,20 @@ void BKE_main_id_clear_newpoins(Main *bmain)
  * \param untagged_only If true, only make local datablocks not tagged with 
LIB_TAG_PRE_EXISTING.
  * \param set_fake If true, set fake user on all localized datablocks (except 
group and objects ones).
  */
+/* XXX TODO This function should probably be reworked.
+ *
+ * Old (2.77) version was simply making (tagging) datablocks as local, without 
actually making any check whether
+ * they were also indirectly used or not...
+ *
+ * Current version uses regular id_make_local callback, but this is not 
super-efficient since this ends up
+ * duplicating some IDs and then removing original ones (due to missing 
knowledge of which ID uses some other ID).
+ *
+ * We could first check all IDs and detect those to be made local that are 
only used by other local or future-local
+ * datablocks, and directly tag those as local (instead of going through 
id_make_local) maybe...
+ *
+ * We'll probably need at some point a true dependency graph between 
datablocks, but for now this should work
+ * good enough (performances is not a critical point here anyway).
+ */
 void BKE_library_make_local(Main *bmain, const Library *lib, const bool 
untagged_only, const bool set_fake)
 {
ListBase *lbarray[MAX_LIBARRAY];
@@ -1640,6 +1654,27 @@ void BKE_library_make_local(Main *bmain, const Library 
*lib, const bool untagged
}
}
}
+
+   /* Third step: remove datablocks that have been copied to be localized 
and are no more used in the end...
+* Note that we may have to loop more than once here, to tackle 
dependencies between linked objects... */
+   bool do_loop = true;
+   while (do_loop) {
+   do_loop = false;
+   for (a = set_listbasepointers(bmain, lbarray); a--; ) {
+   for (id = lbarray[a]->first; id; id = id_next) {
+   id_next = id->next;
+   if (id->newid) {
+   bool is_local = false, is_lib = false;
+
+   BKE_library_ID_test_usages(bmain, id, 
&is_local, &is_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] [af2deb5] master: Fix (unreported) crash in some case when remapping armature data.

2016-07-21 Thread Bastien Montagne
Commit: af2deb5438e8f402901d31edd94a8457f006c4f1
Author: Bastien Montagne
Date:   Thu Jul 21 16:15:00 2016 +0200
Branches: master
https://developer.blender.org/rBaf2deb5438e8f402901d31edd94a8457f006c4f1

Fix (unreported) crash in some case when remapping armature data.

Those bone pointers in object's pose bite again - turns out they can be accessed
before pose actually gets rebuilt in some cases (e.g. from undo writefile), so
we need to clear the pointers immediately.

===

M   source/blender/blenkernel/BKE_armature.h
M   source/blender/blenkernel/intern/armature.c
M   source/blender/blenkernel/intern/library_remap.c

===

diff --git a/source/blender/blenkernel/BKE_armature.h 
b/source/blender/blenkernel/BKE_armature.h
index 226cc6a..c232310 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -95,6 +95,7 @@ float distfactor_to_bone(const float vec[3], const float 
b1[3], const float b2[3
 
 void BKE_armature_where_is(struct bArmature *arm);
 void BKE_armature_where_is_bone(struct Bone *bone, struct Bone *prevbone, 
const bool use_recursion);
+void BKE_pose_clear_pointers(struct bPose *pose);
 void BKE_pose_rebuild(struct Object *ob, struct bArmature *arm);
 void BKE_pose_where_is(struct Scene *scene, struct Object *ob);
 void BKE_pose_where_is_bone(struct Scene *scene, struct Object *ob, struct 
bPoseChannel *pchan, float ctime, bool do_extra);
diff --git a/source/blender/blenkernel/intern/armature.c 
b/source/blender/blenkernel/intern/armature.c
index b618eb5..790272c 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1906,6 +1906,17 @@ static int rebuild_pose_bone(bPose *pose, Bone *bone, 
bPoseChannel *parchan, int
return counter;
 }
 
+/**
+ * Clear pointers of object's pose (needed in remap case, since we cannot 
always wait for a complete pose rebuild).
+ */
+void BKE_pose_clear_pointers(bPose *pose)
+{
+   for (bPoseChannel *pchan = pose->chanbase.first; pchan; pchan = 
pchan->next) {
+   pchan->bone = NULL;
+   pchan->child = NULL;
+   }
+}
+
 /* only after leave editmode, duplicating, validating older files, library 
syncing */
 /* NOTE: pose->flag is set for it */
 void BKE_pose_rebuild(Object *ob, bArmature *arm)
@@ -1926,10 +1937,7 @@ void BKE_pose_rebuild(Object *ob, bArmature *arm)
pose = ob->pose;
 
/* clear */
-   for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
-   pchan->bone = NULL;
-   pchan->child = NULL;
-   }
+   BKE_pose_clear_pointers(pose);
 
/* first step, check if all channels are there */
for (bone = arm->bonebase.first; bone; bone = bone->next) {
diff --git a/source/blender/blenkernel/intern/library_remap.c 
b/source/blender/blenkernel/intern/library_remap.c
index f3e6ec1..74b3b1b 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -296,6 +296,9 @@ static void libblock_remap_data_preprocess(IDRemap 
*r_id_remap_data)
if (ob->pose && (!old_id || ob->data == 
old_id)) {
BLI_assert(ob->type == OB_ARMATURE);
ob->pose->flag |= POSE_RECALC;
+   /* We need to clear pose bone pointers 
immediately, things like undo writefile may be called
+* before pose is actually recomputed, 
can lead to segfault... */
+   BKE_pose_clear_pointers(ob->pose);
}
}
break;

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


[Bf-blender-cvs] [5dc7dc7] master: Cleanup: get rid of lib_indirect_test_id.

2016-07-21 Thread Bastien Montagne
Commit: 5dc7dc70ea4df712a2cf9144aa32ccfaf88442b1
Author: Bastien Montagne
Date:   Wed Jul 20 19:59:21 2016 +0200
Branches: master
https://developer.blender.org/rB5dc7dc70ea4df712a2cf9144aa32ccfaf88442b1

Cleanup: get rid of lib_indirect_test_id.

id_make_local and later remapping are supposed to handle that already,
and in a much much saner and more complete way.

===

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

===

diff --git a/source/blender/blenkernel/intern/library.c 
b/source/blender/blenkernel/intern/library.c
index 0ecc223..9323b4b 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1570,53 +1570,6 @@ void BKE_main_id_clear_newpoins(Main *bmain)
}
 }
 
-static void lib_indirect_test_id(ID *id, const Library *lib)
-{
-#define LIBTAG(a) \
-   if (a && a->id.lib) { a->id.tag &= ~LIB_TAG_INDIRECT; a->id.tag |= 
LIB_TAG_EXTERN; } (void)0
-   
-   if (ID_IS_LINKED_DATABLOCK(id)) {
-   /* datablocks that were indirectly related are now direct links
-* without this, appending data that has a link to other data 
will fail to write */
-   if (lib && id->lib->parent == lib) {
-   id_lib_extern(id);
-   }
-   return;
-   }
-   
-   if (GS(id->name) == ID_OB) {
-   Object *ob = (Object *)id;
-   Mesh *me;
-
-   int a;
-
-#if 0   /* XXX OLD ANIMSYS, NLASTRIPS ARE NO LONGER USED */
-   /* XXX old animation system! 
-- */
-   {
-   bActionStrip *strip;
-   for (strip = ob->nlastrips.first; strip; strip = 
strip->next) {
-   LIBTAG(strip->object);
-   LIBTAG(strip->act);
-   LIBTAG(strip->ipo);
-   }
-   }
-   /* XXX: new animation system needs something like this? */
-#endif
-
-   for (a = 0; a < ob->totcol; a++) {
-   LIBTAG(ob->mat[a]);
-   }
-   
-   LIBTAG(ob->dup_group);
-   LIBTAG(ob->proxy);
-   
-   me = ob->data;
-   LIBTAG(me);
-   }
-
-#undef LIBTAG
-}
-
 /** Make linked datablocks local.
  *
  * \param bmain Almost certainly G.main.
@@ -1671,7 +1624,6 @@ void BKE_library_make_local(Main *bmain, const Library 
*lib, const bool untagged
if (id->newid) {
BKE_libblock_remap(bmain, id, id->newid, 
ID_REMAP_SKIP_INDIRECT_USAGE);
}
-   lib_indirect_test_id(id, lib);
}
}
 }

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


[Bf-blender-cvs] [d8d4bef] master: Refactor/deduplicate even more make_local code (and fix part of T48907).

2016-07-21 Thread Bastien Montagne
Commit: d8d4bef6ccc3556a5691e5b633ebad895a795872
Author: Bastien Montagne
Date:   Wed Jul 20 19:49:45 2016 +0200
Branches: master
https://developer.blender.org/rBd8d4bef6ccc3556a5691e5b633ebad895a795872

Refactor/deduplicate even more make_local code (and fix part of T48907).

Turns out most BKE_foo_make_local datablock-specific functions are actually 
doing
exactly the same thing, only two currently need special additional operations
(object and brush ones). So added a BKE_id_make_local_generic instead
of copying same code over and over.

Also, changed a bit how make_local works in case we are localizing a whole 
library.
We need to do the 'remap' step (from old linked ID to new local one) in the 
second loop,
otherwise we miss some dependencies. This fixes main part of T48907.

===

M   source/blender/blenkernel/BKE_action.h
M   source/blender/blenkernel/BKE_armature.h
M   source/blender/blenkernel/BKE_brush.h
M   source/blender/blenkernel/BKE_camera.h
M   source/blender/blenkernel/BKE_curve.h
M   source/blender/blenkernel/BKE_image.h
M   source/blender/blenkernel/BKE_lamp.h
M   source/blender/blenkernel/BKE_lattice.h
M   source/blender/blenkernel/BKE_library.h
M   source/blender/blenkernel/BKE_material.h
M   source/blender/blenkernel/BKE_mball.h
M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/BKE_object.h
M   source/blender/blenkernel/BKE_particle.h
M   source/blender/blenkernel/BKE_speaker.h
M   source/blender/blenkernel/BKE_texture.h
M   source/blender/blenkernel/BKE_world.h
M   source/blender/blenkernel/intern/action.c
M   source/blender/blenkernel/intern/armature.c
M   source/blender/blenkernel/intern/brush.c
M   source/blender/blenkernel/intern/camera.c
M   source/blender/blenkernel/intern/curve.c
M   source/blender/blenkernel/intern/image.c
M   source/blender/blenkernel/intern/lamp.c
M   source/blender/blenkernel/intern/lattice.c
M   source/blender/blenkernel/intern/library.c
M   source/blender/blenkernel/intern/material.c
M   source/blender/blenkernel/intern/mball.c
M   source/blender/blenkernel/intern/mesh.c
M   source/blender/blenkernel/intern/node.c
M   source/blender/blenkernel/intern/object.c
M   source/blender/blenkernel/intern/particle.c
M   source/blender/blenkernel/intern/speaker.c
M   source/blender/blenkernel/intern/texture.c
M   source/blender/blenkernel/intern/world.c

===

diff --git a/source/blender/blenkernel/BKE_action.h 
b/source/blender/blenkernel/BKE_action.h
index ac9b0b6..6527ba7 100644
--- a/source/blender/blenkernel/BKE_action.h
+++ b/source/blender/blenkernel/BKE_action.h
@@ -63,7 +63,7 @@ struct bAction *BKE_action_copy(struct Main *bmain, struct 
bAction *src);
 /* Deallocate all of the Action's data, but not the Action itself */
 void BKE_action_free(struct bAction *act);
 
-void BKE_action_make_local(struct Main *bmain, struct bAction *act, const bool 
force_local);
+void BKE_action_make_local(struct Main *bmain, struct bAction *act, const bool 
lib_local);
 
 
 /* Action API - */
diff --git a/source/blender/blenkernel/BKE_armature.h 
b/source/blender/blenkernel/BKE_armature.h
index bfd4a7e..226cc6a 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -76,7 +76,7 @@ struct bArmature *BKE_armature_from_object(struct Object *ob);
 int  BKE_armature_bonelist_count(struct ListBase *lb);
 void BKE_armature_bonelist_free(struct ListBase *lb);
 void BKE_armature_free(struct bArmature *arm);
-void BKE_armature_make_local(struct Main *bmain, struct bArmature *arm, const 
bool force_local);
+void BKE_armature_make_local(struct Main *bmain, struct bArmature *arm, const 
bool lib_local);
 struct bArmature *BKE_armature_copy(struct Main *bmain, struct bArmature *arm);
 
 /* Bounding box. */
diff --git a/source/blender/blenkernel/BKE_brush.h 
b/source/blender/blenkernel/BKE_brush.h
index 4be4d95..8bd4bdf 100644
--- a/source/blender/blenkernel/BKE_brush.h
+++ b/source/blender/blenkernel/BKE_brush.h
@@ -45,7 +45,7 @@ void BKE_brush_init(struct Brush *brush);
 struct Brush *BKE_brush_add(struct Main *bmain, const char *name, short 
ob_mode);
 struct Brush *BKE_brush_first_search(struct Main *bmain, short ob_mode);
 struct Brush *BKE_brush_copy(struct Main *bmain, struct Brush *brush);
-void BKE_brush_make_local(struct Main *bmain, struct Brush *brush, const bool 
force_local);
+void BKE_brush_make_local(struct Main *bmain, struct Brush *brush, const bool 
lib_local);
 void BKE_brush_unlink(struct Main *bmain, struct Brush *brush);
 void BKE_brush_free(struct Brush *brush);
 
diff --git a/source/blender/blenkernel/BKE_camera.h 
b/source/blender/blenkernel/BKE_camera.h
index 3ae0e0e..31a732c

[Bf-blender-cvs] [1c9a324] alembic_basic_io: Merge branch 'master' into alembic_basic_io

2016-07-21 Thread Kévin Dietrich
Commit: 1c9a32477dc9fbaebffae654c0c19c99352a608e
Author: Kévin Dietrich
Date:   Thu Jul 21 12:51:21 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB1c9a32477dc9fbaebffae654c0c19c99352a608e

Merge branch 'master' into alembic_basic_io

===



===



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


[Bf-blender-cvs] [d8f8423] alembic_basic_io: Merge branch 'master' into alembic_basic_io

2016-07-21 Thread Kévin Dietrich
Commit: d8f84235102e05b9eefdf522425b8c7c8a8a4ef7
Author: Kévin Dietrich
Date:   Thu Jul 21 16:17:15 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rBd8f84235102e05b9eefdf522425b8c7c8a8a4ef7

Merge branch 'master' into alembic_basic_io

===



===



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


[Bf-blender-cvs] [fc74cd5] alembic_basic_io: Implement CacheFile in the legacy dependency graph.

2016-07-21 Thread Kévin Dietrich
Commit: fc74cd55886fe6232ab14be9e44fb78b512f5e8e
Author: Kévin Dietrich
Date:   Thu Jul 21 15:05:37 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rBfc74cd55886fe6232ab14be9e44fb78b512f5e8e

Implement CacheFile in the legacy dependency graph.

===

M   source/blender/blenkernel/intern/depsgraph.c
M   source/blender/makesrna/intern/rna_cachefile.c
M   source/blender/modifiers/intern/MOD_meshsequencecache.c

===

diff --git a/source/blender/blenkernel/intern/depsgraph.c 
b/source/blender/blenkernel/intern/depsgraph.c
index c445c9c..986c1d8 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -46,6 +46,7 @@
 
 #include "DNA_anim_types.h"
 #include "DNA_camera_types.h"
+#include "DNA_cachefile_types.h"
 #include "DNA_group_types.h"
 #include "DNA_lamp_types.h"
 #include "DNA_lattice_types.h"
@@ -3006,6 +3007,33 @@ void DAG_id_tag_update_ex(Main *bmain, ID *id, short 
flag)
/* BLI_assert(!"invalid flag for this 'idtype'"); */
}
}
+   else if (GS(id->name) == ID_CF) {
+   for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+   ModifierData *md = modifiers_findByType(ob, 
eModifierType_MeshSequenceCache);
+
+   if (md) {
+   MeshSeqCacheModifierData *mcmd = 
(MeshSeqCacheModifierData *)md;
+
+   if (mcmd->cache_file && (&mcmd->cache_file->id 
== id)) {
+   ob->recalc |= OB_RECALC_DATA;
+   continue;
+   }
+   }
+
+   for (bConstraint *con = ob->constraints.first; con; con 
= con->next) {
+   if (con->type != 
CONSTRAINT_TYPE_TRANSFORM_CACHE) {
+   continue;
+   }
+
+   bTransformCacheConstraint *data = con->data;
+
+   if (data->cache_file && (&data->cache_file->id 
== id)) {
+   ob->recalc |= OB_RECALC_DATA;
+   break;
+   }
+   }
+   }
+   }
 }
 
 void DAG_id_tag_update(ID *id, short flag)
diff --git a/source/blender/makesrna/intern/rna_cachefile.c 
b/source/blender/makesrna/intern/rna_cachefile.c
index 37cfe01..574c9e4 100644
--- a/source/blender/makesrna/intern/rna_cachefile.c
+++ b/source/blender/makesrna/intern/rna_cachefile.c
@@ -50,18 +50,12 @@ static void rna_CacheFile_update(Main *bmain, Scene *scene, 
PointerRNA *ptr)
 {
CacheFile *cache_file = (CacheFile *)ptr->data;
 
-   if (!DEG_depsgraph_use_legacy()) {
-   DAG_id_tag_update(&cache_file->id, 0);
-   /* XXX - how to tag the whole scene for redraw?
-* (NC_SCENE | ND_DRAW, scene) doesn't seem to work. */
-   WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
-   }
-   else {
-   /* TODO(kevin): implement in old dependency graph. */
-   WM_main_add_notifier(NC_SCENE | ND_FRAME, scene);
-   }
-
-   UNUSED_VARS(bmain);
+   DAG_id_tag_update(&cache_file->id, 0);
+   /* XXX - how to tag the whole scene for redraw?
+* (NC_SCENE | ND_DRAW, scene) doesn't seem to work. */
+   WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
+
+   UNUSED_VARS(bmain, scene);
 }
 
 static void rna_CacheFile_update_handle(Main *bmain, Scene *scene, PointerRNA 
*ptr)
diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c 
b/source/blender/modifiers/intern/MOD_meshsequencecache.c
index d088ce0..d894aa7 100644
--- a/source/blender/modifiers/intern/MOD_meshsequencecache.c
+++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c
@@ -35,6 +35,7 @@
 #include "BKE_library_query.h"
 #include "BKE_scene.h"
 
+#include "depsgraph_private.h"
 #include "DEG_depsgraph_build.h"
 
 #include "MOD_modifiertypes.h"
@@ -128,6 +129,24 @@ static void foreachIDLink(ModifierData *md, Object *ob,
walk(userData, ob, (ID **)&mcmd->cache_file, IDWALK_USER);
 }
 
+
+static void updateDepgraph(ModifierData *md, DagForest *forest,
+   struct Main *bmain,
+   struct Scene *scene,
+   Object *ob, DagNode *obNode)
+{
+   MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *) md;
+
+   if (mcmd->cache_file != NULL) {
+   DagNode *curNode = dag_get_node(forest, mcmd->cache_file);
+
+   dag_add_relation(forest, curNode, obNode,
+DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Cache File 
Modifier");
+   }
+
+   UNUSED_VARS(bmain,

[Bf-blender-cvs] [1deb01a] master: Attempt to fix compilation on Windows, take 2

2016-07-21 Thread Kévin Dietrich
Commit: 1deb01a9b9c00bb31fa9bad7a3b00087e29e054c
Author: Kévin Dietrich
Date:   Thu Jul 21 16:12:31 2016 +0200
Branches: master
https://developer.blender.org/rB1deb01a9b9c00bb31fa9bad7a3b00087e29e054c

Attempt to fix compilation on Windows, take 2

Previous patch was wrong apparently... :|

===

M   intern/opensubdiv/CMakeLists.txt

===

diff --git a/intern/opensubdiv/CMakeLists.txt b/intern/opensubdiv/CMakeLists.txt
index 55a4b22..f8e80de 100644
--- a/intern/opensubdiv/CMakeLists.txt
+++ b/intern/opensubdiv/CMakeLists.txt
@@ -70,7 +70,7 @@ add_definitions(-DGLEW_STATIC)
 
 if(WIN32)
add_definitions(-DNOMINMAX)
-   add_definitions(-D_USE_MATH_DEFINITIONS)
+   add_definitions(-D_USE_MATH_DEFINES)
 endif()
 
 # TODO(sergey): Put CUEW back when CUDA is officially supported by OSD.

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


[Bf-blender-cvs] [be1c854] master: Attempt to fix compilation error on Windows.

2016-07-21 Thread Kévin Dietrich
Commit: be1c854019a26f6472abea6d9d9948b7dab4dc12
Author: Kévin Dietrich
Date:   Thu Jul 21 15:45:07 2016 +0200
Branches: master
https://developer.blender.org/rBbe1c854019a26f6472abea6d9d9948b7dab4dc12

Attempt to fix compilation error on Windows.

Patch from @fjuhec.

===

M   intern/opensubdiv/CMakeLists.txt

===

diff --git a/intern/opensubdiv/CMakeLists.txt b/intern/opensubdiv/CMakeLists.txt
index ab660b8..55a4b22 100644
--- a/intern/opensubdiv/CMakeLists.txt
+++ b/intern/opensubdiv/CMakeLists.txt
@@ -70,6 +70,7 @@ add_definitions(-DGLEW_STATIC)
 
 if(WIN32)
add_definitions(-DNOMINMAX)
+   add_definitions(-D_USE_MATH_DEFINITIONS)
 endif()
 
 # TODO(sergey): Put CUEW back when CUDA is officially supported by OSD.

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


[Bf-blender-cvs] [9628be3] soc-2016-multiview: fix bug in secondary clip open button

2016-07-21 Thread Tianwei Shen
Commit: 9628be36799f623230da4b9e80863524427bdd1c
Author: Tianwei Shen
Date:   Thu Jul 21 19:15:27 2016 +0800
Branches: soc-2016-multiview
https://developer.blender.org/rB9628be36799f623230da4b9e80863524427bdd1c

fix bug in secondary clip open button

after consulting Sergey, I have exposed secondary_clip via RNA and then
fix the corresponding python ui bugs. The operator show now be able to load a
clip to secondary_clip pointer

===

M   release/scripts/startup/bl_ui/space_clip.py
M   source/blender/editors/space_clip/clip_buttons.c
M   source/blender/editors/space_clip/clip_draw.c
M   source/blender/editors/space_clip/clip_intern.h
M   source/blender/editors/space_clip/space_clip.c
M   source/blender/makesrna/intern/rna_space.c

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index f4d53a2..577e47d 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -159,7 +159,7 @@ class CLIP_HT_header(Header):
 row.template_ID(sc, "clip", open="clip.open")
 
 row = layout.row()  # clip open for witness camera
-row.template_ID(sc, "clip", open="clip.open_secondary")
+row.template_ID(sc, "secondary_clip", open="clip.open_secondary")
 
 if clip:
 tracking = clip.tracking
diff --git a/source/blender/editors/space_clip/clip_buttons.c 
b/source/blender/editors/space_clip/clip_buttons.c
index 91f28f8..71bd2c3 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -107,7 +107,6 @@ void uiTemplateMovieClip(uiLayout *layout, bContext *C, 
PointerRNA *ptr, const c
 
if (!compact) {
uiTemplateID(layout, C, ptr, propname, NULL, "CLIP_OT_open", 
NULL);
-   uiTemplateID(layout, C, ptr, propname, NULL, 
"CLIP_OT_open_secondary", NULL);
}
 
if (clip) {
diff --git a/source/blender/editors/space_clip/clip_draw.c 
b/source/blender/editors/space_clip/clip_draw.c
index 38d795e..455afb7 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -1748,6 +1748,11 @@ void clip_draw_main(const bContext *C, SpaceClip *sc, 
ARegion *ar)
}
 }
 
+void clip_draw_secondary_clip(const bContext *C, SpaceClip *sc, ARegion *ar)
+{
+
+}
+
 void clip_draw_cache_and_notes(const bContext *C, SpaceClip *sc, ARegion *ar)
 {
Scene *scene = CTX_data_scene(C);
diff --git a/source/blender/editors/space_clip/clip_intern.h 
b/source/blender/editors/space_clip/clip_intern.h
index 69f39e1..91f394e 100644
--- a/source/blender/editors/space_clip/clip_intern.h
+++ b/source/blender/editors/space_clip/clip_intern.h
@@ -71,6 +71,7 @@ void CLIP_OT_dopesheet_view_all(struct wmOperatorType *ot);
 
 /* clip_draw.c */
 void clip_draw_main(const struct bContext *C, struct SpaceClip *sc, struct 
ARegion *ar);
+void clip_draw_secondary_clip(const struct bContext *C, struct SpaceClip *sc, 
struct ARegion *ar);
 void clip_draw_grease_pencil(struct bContext *C, int onlyv2d);
 void clip_draw_cache_and_notes(const bContext *C, SpaceClip *sc, ARegion *ar);
 
diff --git a/source/blender/editors/space_clip/space_clip.c 
b/source/blender/editors/space_clip/space_clip.c
index 18c6ef8..bf36cbb 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -1200,6 +1200,10 @@ static void clip_main_region_draw(const bContext *C, 
ARegion *ar)
movieclip_main_area_set_view2d(C, ar);
 
clip_draw_main(C, sc, ar);
+   if (sc->mode == SC_MODE_CORRESPONDENCE) {
+   //TODO(tianwei): draw correspondence related code
+   clip_draw_secondary_clip(C, sc, ar);
+   }
 
/* TODO(sergey): would be nice to find a way to de-duplicate all this 
space conversions */
UI_view2d_view_to_region_fl(&ar->v2d, 0.0f, 0.0f, &x, &y);
diff --git a/source/blender/makesrna/intern/rna_space.c 
b/source/blender/makesrna/intern/rna_space.c
index 441d071..859def6 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1543,6 +1543,14 @@ static void rna_SpaceClipEditor_clip_set(PointerRNA 
*ptr, PointerRNA value)
ED_space_clip_set_clip(NULL, screen, sc, (MovieClip *)value.data);
 }
 
+static void rna_SpaceClipEditor_secondary_clip_set(PointerRNA *ptr, PointerRNA 
value)
+{
+   SpaceClip *sc = (SpaceClip *)(ptr->data);
+   bScreen *screen = (bScreen *)ptr->id.data;
+
+   ED_space_clip_set_secondary_clip(NULL, screen, sc, (MovieClip 
*)value.data);
+}
+
 static void rna_SpaceClipEditor_mask_set(PointerRNA *ptr, PointerRNA value)
 {
SpaceClip *sc = (SpaceClip *)(ptr->data);
@@ -4512,6 +4520,13 @@ static void rna_def_space_clip(BlenderRNA 

[Bf-blender-cvs] [aa316c7] master: OpenSubdiv: Prepare majority of things to have proper subdivided UV

2016-07-21 Thread Sergey Sharybin
Commit: aa316c73e015be6bb7b93e59c779c53316510590
Author: Sergey Sharybin
Date:   Thu Jul 21 12:33:11 2016 +0200
Branches: master
https://developer.blender.org/rBaa316c73e015be6bb7b93e59c779c53316510590

OpenSubdiv: Prepare majority of things to have proper subdivided UV

Mainly the changes are related on establishing API to feed UV islands
to OpenSubdiv, so it will know all the connectivity information and
will be able to do proper interpolation.

Island calculation is currently rather slow, not sure how to make it
fast and not use lots of allocations.

Shouldn't be THAT bad, since this code is only runs once when creating
OSD mesh, and it's probably still faster than our orientation code.

===

M   intern/opensubdiv/opensubdiv_converter.cc
M   intern/opensubdiv/opensubdiv_converter_capi.h
M   source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c

===

diff --git a/intern/opensubdiv/opensubdiv_converter.cc 
b/intern/opensubdiv/opensubdiv_converter.cc
index e6c8985..f637f51 100644
--- a/intern/opensubdiv/opensubdiv_converter.cc
+++ b/intern/opensubdiv/opensubdiv_converter.cc
@@ -53,6 +53,11 @@ inline void reverse_face_verts(int *face_verts, int 
num_verts)
face_verts[0] = last_vert;
 }
 
+struct TopologyRefinerData {
+   const OpenSubdiv_Converter& conv;
+   std::vector *uvs;
+};
+
 }  /* namespace */
 #endif /* OPENSUBDIV_ORIENT_TOPOLOGY */
 
@@ -141,10 +146,11 @@ inline void check_oriented_vert_connectivity(const int 
num_vert_edges,
 }  /* namespace */
 
 template <>
-inline bool 
TopologyRefinerFactory::resizeComponentTopology(
+inline bool 
TopologyRefinerFactory::resizeComponentTopology(
 TopologyRefiner& refiner,
-const OpenSubdiv_Converter& conv)
+const TopologyRefinerData& cb_data)
 {
+   const OpenSubdiv_Converter& conv = cb_data.conv;
/* Faces and face-verts */
const int num_faces = conv.get_num_faces(&conv);
setNumBaseFaces(refiner, num_faces);
@@ -172,10 +178,11 @@ inline bool 
TopologyRefinerFactory::resizeComponentTopolog
 }
 
 template <>
-inline bool 
TopologyRefinerFactory::assignComponentTopology(
+inline bool 
TopologyRefinerFactory::assignComponentTopology(
  TopologyRefiner& refiner,
-const OpenSubdiv_Converter& conv)
+ const TopologyRefinerData &cb_data)
 {
+   const OpenSubdiv_Converter& conv = cb_data.conv;
using Far::IndexArray;
/* Face relations. */
const int num_faces = conv.get_num_faces(&conv);
@@ -430,10 +437,11 @@ inline bool 
TopologyRefinerFactory::assignComponentTopolog
 };
 
 template <>
-inline bool TopologyRefinerFactory::assignComponentTags(
+inline bool TopologyRefinerFactory::assignComponentTags(
 TopologyRefiner& refiner,
-const OpenSubdiv_Converter& conv)
+const TopologyRefinerData& cb_data)
 {
+   const OpenSubdiv_Converter& conv = cb_data.conv;
typedef OpenSubdiv::Sdc::Crease Crease;
 
int num_edges = conv.get_num_edges(&conv);
@@ -480,43 +488,48 @@ inline bool 
TopologyRefinerFactory::assignComponentTags(
 }
 
 template <>
-inline void 
TopologyRefinerFactory::reportInvalidTopology(
+inline void TopologyRefinerFactory::reportInvalidTopology(
 TopologyError /*errCode*/,
 const char *msg,
-const OpenSubdiv_Converter& /*mesh*/)
+const TopologyRefinerData& /*mesh*/)
 {
printf("OpenSubdiv Error: %s\n", msg);
 }
 
 template <>
-inline bool 
TopologyRefinerFactory::assignFaceVaryingTopology(
+inline bool 
TopologyRefinerFactory::assignFaceVaryingTopology(
 TopologyRefiner& refiner,
-const OpenSubdiv_Converter& conv)
+const TopologyRefinerData& cb_data)
 {
-   if (conv.get_num_uv_layers(&conv) <= 0) {
+   const OpenSubdiv_Converter& conv = cb_data.conv;
+   const int num_layers = conv.get_num_uv_layers(&conv);
+   if (num_layers <= 0) {
/* No UV maps, we can skip any face-varying data. */
return true;
}
-   /* Count overall number of UV data.
-* NOTE: We only do single UV layer here, and we don't "merge" loops
-* together as it is done in OpenSubdiv examples.x
-*/
const int num_faces = getNumBaseFaces(refiner);
-   int num_uvs = 0;
-   for (int face = 0; face < num_faces; ++face) {
-   IndexArray face_verts = getBaseFaceVertices(refiner, face);
-   num_uvs += face_verts.size();
-   }
-   /* Fill in actual UV offsets. */
-   const int channel = createBaseFVarChannel(refiner, num_uvs);
-   for (int face = 0, offset = 0; face < num_faces; ++face) {
-   Far::IndexArray dst_face_uvs = getBaseFaceFVarValues(refiner,
-face,
-