[Bf-blender-cvs] [f7e3efa4a2b] temp-lanpr-staging: LANPR: Fix wrong function for clearing list base.

2019-08-15 Thread YimingWu
Commit: f7e3efa4a2bad4fa0fc0f0e794842f8cc05d258a
Author: YimingWu
Date:   Fri Aug 16 13:54:05 2019 +0800
Branches: temp-lanpr-staging
https://developer.blender.org/rBf7e3efa4a2bad4fa0fc0f0e794842f8cc05d258a

LANPR: Fix wrong function for clearing list base.

===

M   source/blender/editors/lanpr/lanpr_cpu.c

===

diff --git a/source/blender/editors/lanpr/lanpr_cpu.c 
b/source/blender/editors/lanpr/lanpr_cpu.c
index 5fb44d23562..6c08bfce4e9 100644
--- a/source/blender/editors/lanpr/lanpr_cpu.c
+++ b/source/blender/editors/lanpr/lanpr_cpu.c
@@ -579,7 +579,7 @@ static int 
lanpr_make_next_occlusion_task_info(LANPR_RenderBuffer *rb, LANPR_Ren
 res = 1;
   }
   else {
-BLI_listbase_is_empty(>contour_pointers);
+BLI_listbase_clear(>contour_pointers);
 rti->contour = 0;
   }
 
@@ -595,7 +595,7 @@ static int 
lanpr_make_next_occlusion_task_info(LANPR_RenderBuffer *rb, LANPR_Ren
 res = 1;
   }
   else {
-BLI_listbase_is_empty(>intersection_pointers);
+BLI_listbase_clear(>intersection_pointers);
 rti->intersection = 0;
   }
 
@@ -611,7 +611,7 @@ static int 
lanpr_make_next_occlusion_task_info(LANPR_RenderBuffer *rb, LANPR_Ren
 res = 1;
   }
   else {
-BLI_listbase_is_empty(>crease_pointers);
+BLI_listbase_clear(>crease_pointers);
 rti->crease = 0;
   }
 
@@ -627,7 +627,7 @@ static int 
lanpr_make_next_occlusion_task_info(LANPR_RenderBuffer *rb, LANPR_Ren
 res = 1;
   }
   else {
-BLI_listbase_is_empty(>material_pointers);
+BLI_listbase_clear(>material_pointers);
 rti->material = 0;
   }
 
@@ -643,7 +643,7 @@ static int 
lanpr_make_next_occlusion_task_info(LANPR_RenderBuffer *rb, LANPR_Ren
 res = 1;
   }
   else {
-BLI_listbase_is_empty(>edge_mark_pointers);
+BLI_listbase_clear(>edge_mark_pointers);
 rti->edge_mark = 0;
   }
 
@@ -1807,8 +1807,8 @@ static void lanpr_make_render_geometry_buffers(Depsgraph 
*depsgraph,
   copy_m4_m4_db(proj, result);
   copy_m4_m4_db(rb->view_projection, proj);
 
-  BLI_listbase_is_empty(>triangle_buffer_pointers);
-  BLI_listbase_is_empty(>vertex_buffer_pointers);
+  BLI_listbase_clear(>triangle_buffer_pointers);
+  BLI_listbase_clear(>vertex_buffer_pointers);
 
   DEG_OBJECT_ITER_BEGIN (depsgraph,
  o,
@@ -2577,17 +2577,17 @@ void ED_lanpr_destroy_render_data(LANPR_RenderBuffer 
*rb)
   rb->edge_mark_count = 0;
   rb->edge_mark_managed = 0;
 
-  BLI_listbase_is_empty(>contours);
-  BLI_listbase_is_empty(>intersection_lines);
-  BLI_listbase_is_empty(>crease_lines);
-  BLI_listbase_is_empty(>material_lines);
-  BLI_listbase_is_empty(>edge_marks);
-  BLI_listbase_is_empty(>all_render_lines);
-  BLI_listbase_is_empty(>chains);
-
-  BLI_listbase_is_empty(>vertex_buffer_pointers);
-  BLI_listbase_is_empty(>line_buffer_pointers);
-  BLI_listbase_is_empty(>triangle_buffer_pointers);
+  BLI_listbase_clear(>contours);
+  BLI_listbase_clear(>intersection_lines);
+  BLI_listbase_clear(>crease_lines);
+  BLI_listbase_clear(>material_lines);
+  BLI_listbase_clear(>edge_marks);
+  BLI_listbase_clear(>all_render_lines);
+  BLI_listbase_clear(>chains);
+
+  BLI_listbase_clear(>vertex_buffer_pointers);
+  BLI_listbase_clear(>line_buffer_pointers);
+  BLI_listbase_clear(>triangle_buffer_pointers);
 
   BLI_spin_end(>cs_data);
   BLI_spin_end(>cs_info);

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


[Bf-blender-cvs] [d156139cbcc] soc-2019-outliner: Merge branch 'master' into soc-2019-outliner

2019-08-15 Thread Nathan Craddock
Commit: d156139cbccc16ee457974455624cf75e91a1670
Author: Nathan Craddock
Date:   Thu Aug 15 16:11:28 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rBd156139cbccc16ee457974455624cf75e91a1670

Merge branch 'master' into soc-2019-outliner

===



===

diff --cc source/blender/editors/space_outliner/outliner_select.c
index 19fd4511e50,7f45c4d22fa..531dd583d34
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@@ -1358,36 -1292,28 +1358,43 @@@ static int outliner_item_do_activate_fr
changed = true;
  }
}
 -  else if (outliner_item_is_co_within_close_toggle(te, view_mval[0])) {
 -outliner_item_toggle_closed(te, extend);
 -changed = true;
 -rebuild_tree = true;
 +  /* Don't allow toggle on scene collection */
 +  else if ((TREESTORE(te)->type != TSE_VIEW_COLLECTION_BASE) &&
 +   outliner_item_is_co_within_close_toggle(te, view_mval[0])) {
 +return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
}
else {
 -Scene *scene = CTX_data_scene(C);
  ViewLayer *view_layer = CTX_data_view_layer(C);
 -/* the row may also contain children, if one is hovered we want this 
instead of current te */
 -TreeElement *activate_te = outliner_find_item_at_x_in_row(soops, te, 
view_mval[0]);
 -TreeStoreElem *activate_tselem = TREESTORE(activate_te);
  
 -outliner_item_select(soops, activate_te, extend, extend);
 +/* The row may also contain children, if one is hovered we want this 
instead of current te */
 +bool merged_elements = false;
 +TreeElement *activate_te = outliner_find_item_at_x_in_row(
 +soops, te, view_mval[0], _elements);
  
 -/* Only change modes when clicking on the icon/text,
 - * otherwise we can't easily select without changing modes. */
 -if ((te->flag & TE_ICONROW) == 0) {
 -  if (view_mval[0] >= te->xs && view_mval[0] <= te->xend) {
 -do_outliner_item_activate_tree_element(
 -C, scene, view_layer, soops, activate_te, activate_tselem, 
extend, recursive);
 +/* If the selected icon was an aggregate of multiple elements, run the 
search popup */
 +if (merged_elements) {
 +  merged_element_search_menu_invoke(C, te, activate_te);
 +  return OPERATOR_CANCELLED;
 +}
 +
 +TreeStoreElem *activate_tselem = TREESTORE(activate_te);
 +
 +if (use_range) {
 +  do_outliner_range_select(C, soops, activate_te);
 +}
 +else {
 +  outliner_item_select(soops, activate_te, extend, extend);
-   do_outliner_item_activate_tree_element(
-   C, scene, view_layer, soops, activate_te, activate_tselem, extend, 
false);
++
++  /* Only change modes when clicking on the icon/text,
++   * otherwise we can't easily select without changing modes. */
++  if ((te->flag & TE_ICONROW) == 0) {
++if (view_mval[0] >= te->xs && view_mval[0] <= te->xend) {
++  do_outliner_item_activate_tree_element(
++  C, scene, view_layer, soops, activate_te, activate_tselem, 
extend, false);
++}
+   }
  }
 +
  changed = true;
}

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


[Bf-blender-cvs] [9ec72374c3f] temp-lanpr-staging: Cleanup: make format.

2019-08-15 Thread YimingWu
Commit: 9ec72374c3f16d2d695af96cd7de80b3909f201d
Author: YimingWu
Date:   Fri Aug 16 11:12:28 2019 +0800
Branches: temp-lanpr-staging
https://developer.blender.org/rB9ec72374c3f16d2d695af96cd7de80b3909f201d

Cleanup: make format.

===

M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenlib/intern/math_matrix.c
M   source/blender/draw/engines/lanpr/lanpr_cpu.c
M   source/blender/editors/include/ED_lanpr.h
M   source/blender/editors/lanpr/lanpr_cpu.c
M   source/blender/editors/lanpr/lanpr_util.c
M   source/blender/editors/space_buttons/buttons_context.c
M   source/blender/makesdna/DNA_scene_types.h

===

diff --git a/source/blender/blenkernel/intern/scene.c 
b/source/blender/blenkernel/intern/scene.c
index d73843663fd..8d087c05977 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1017,7 +1017,7 @@ void BKE_scene_init(Scene *sce)
   /* SceneLANPR */
 
   sce->lanpr.crease_threshold = 0.7;
-  
+
   sce->lanpr.enable_intersections = 1;
 
   sce->lanpr.line_color[0] = 1;
diff --git a/source/blender/blenlib/intern/math_matrix.c 
b/source/blender/blenlib/intern/math_matrix.c
index 48e9f905f18..ffd04e5aa29 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -141,7 +141,6 @@ void copy_m4_m3(float m1[4][4], const float m2[3][3]) /* no 
clear */
   m1[3][3] = 1.0f;
 }
 
-
 void copy_m4d_m4(double m1[4][4], const float m2[4][4])
 {
   m1[0][0] = m2[0][0];
@@ -269,7 +268,6 @@ void mul_m4_m4m4_uniq(float R[4][4], const float A[4][4], 
const float B[4][4])
 #endif
 }
 
-
 void mul_m4db_m4db_m4fl_uniq(double R[4][4], const double A[4][4], const float 
B[4][4])
 {
   BLI_assert(R != A && R != B);
diff --git a/source/blender/draw/engines/lanpr/lanpr_cpu.c 
b/source/blender/draw/engines/lanpr/lanpr_cpu.c
index 423ad643d9a..1088b082d90 100644
--- a/source/blender/draw/engines/lanpr/lanpr_cpu.c
+++ b/source/blender/draw/engines/lanpr/lanpr_cpu.c
@@ -94,8 +94,8 @@ static void 
lanpr_rebuild_render_draw_command(LANPR_RenderBuffer *rb, LANPR_Line
 
 GPU_vertbuf_data_alloc(vbo, vertCount);
 
-tv = v = MEM_callocN(sizeof(float)*6*Count, "temp v data");
-tn = N = MEM_callocN(sizeof(float)*6*Count, "temp n data");
+tv = v = MEM_callocN(sizeof(float) * 6 * Count, "temp v data");
+tn = N = MEM_callocN(sizeof(float) * 6 * Count, "temp n data");
 
 if (ll->contour.enabled) {
   tv = lanpr_make_leveled_edge_vertex_array(rb, >contours, tv, tn, 
, ll, 1.0f);
diff --git a/source/blender/editors/include/ED_lanpr.h 
b/source/blender/editors/include/ED_lanpr.h
index f9d10bd7b9e..129c4166233 100644
--- a/source/blender/editors/include/ED_lanpr.h
+++ b/source/blender/editors/include/ED_lanpr.h
@@ -454,7 +454,6 @@ typedef struct LANPR_BoundingArea {
 #define TNS_IN_TILE(RenderTile, Fx, Fy) \
   (TNS_IN_TILE_X(RenderTile, Fx) && TNS_IN_TILE_Y(RenderTile, Fy))
 
-
 BLI_INLINE int lanpr_TrangleLineBoundBoxTest(LANPR_RenderTriangle *rt, 
LANPR_RenderLine *rl)
 {
   if (MAX3(rt->v[0]->fbcoord[2], rt->v[1]->fbcoord[2], rt->v[2]->fbcoord[2]) >
@@ -567,7 +566,6 @@ void *mem_static_aquire(LANPR_StaticMemPool *smp, int size);
 void *mem_static_aquire_thread(LANPR_StaticMemPool *smp, int size);
 void *mem_static_destroy(LANPR_StaticMemPool *smp);
 
-
 void tmat_make_ortho_matrix_44d(
 double (*mProjection)[4], real xMin, real xMax, real yMin, real yMax, real 
zMin, real zMax);
 void tmat_make_perspective_matrix_44d(
diff --git a/source/blender/editors/lanpr/lanpr_cpu.c 
b/source/blender/editors/lanpr/lanpr_cpu.c
index b97f8aef36b..5fb44d23562 100644
--- a/source/blender/editors/lanpr/lanpr_cpu.c
+++ b/source/blender/editors/lanpr/lanpr_cpu.c
@@ -523,7 +523,7 @@ static void lanpr_cut_render_line(LANPR_RenderBuffer *rb,
   if (begin_segment) {
 if (begin_segment != ns) {
   ns->occlusion = begin_segment->prev ? (irls = 
begin_segment->prev)->occlusion : 0;
-  BLI_insertlinkbefore(>segments,(void *)begin_segment,(void *)ns);
+  BLI_insertlinkbefore(>segments, (void *)begin_segment, (void *)ns);
 }
   }
   else {
@@ -533,7 +533,7 @@ static void lanpr_cut_render_line(LANPR_RenderBuffer *rb,
   if (end_segment) {
 if (end_segment != ns2) {
   ns2->occlusion = end_segment->prev ? (irls = 
end_segment->prev)->occlusion : 0;
-  BLI_insertlinkbefore(>segments,(void *)end_segment,(void *)ns2);
+  BLI_insertlinkbefore(>segments, (void *)end_segment, (void *)ns2);
 }
   }
   else {
@@ -871,7 +871,7 @@ static int lanpr_point_inside_triangle3de(tnsVector3d v,
   /*  tmat_normalize_self_3d(r); */
   cross_v3_v3v3_db(N2, l, r);
 
-  if ((d = dot_v3v3_db(N1,  N2)) < 0) {
+  if ((d = dot_v3v3_db(N1, N2)) < 0) {
 return 0;
   }
   /*  if (dv[0]->gloc, cam_pos);
 sub_v3_v3v3_db(vv2, cam_pos, rt->v[2]->gloc);

[Bf-blender-cvs] [60f5cdaee92] temp-lanpr-staging: LANPR: Use BLI math functions.

2019-08-15 Thread YimingWu
Commit: 60f5cdaee92708cf31733f1d8617930336985797
Author: YimingWu
Date:   Fri Aug 16 11:11:04 2019 +0800
Branches: temp-lanpr-staging
https://developer.blender.org/rB60f5cdaee92708cf31733f1d8617930336985797

LANPR: Use BLI math functions.

===

M   source/blender/blenlib/BLI_math_matrix.h
M   source/blender/blenlib/BLI_math_vector.h
M   source/blender/blenlib/intern/math_matrix.c
M   source/blender/blenlib/intern/math_vector_inline.c
M   source/blender/editors/include/ED_lanpr.h
M   source/blender/editors/lanpr/lanpr_cpu.c
M   source/blender/editors/lanpr/lanpr_util.c

===

diff --git a/source/blender/blenlib/BLI_math_matrix.h 
b/source/blender/blenlib/BLI_math_matrix.h
index 52d976daa2d..432b1f8d4f8 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -41,6 +41,7 @@ void zero_m4(float R[4][4]);
 void unit_m2(float R[2][2]);
 void unit_m3(float R[3][3]);
 void unit_m4(float R[4][4]);
+void unit_m4_db(double m[4][4]);
 
 void copy_m2_m2(float R[2][2], const float A[2][2]);
 void copy_m3_m3(float R[3][3], const float A[3][3]);
@@ -48,9 +49,14 @@ void copy_m4_m4(float R[4][4], const float A[4][4]);
 void copy_m3_m4(float R[3][3], const float A[4][4]);
 void copy_m4_m3(float R[4][4], const float A[3][3]);
 
+void copy_m4_m4_db(double m1[4][4], const double m2[4][4]);
+
 /* double->float */
 void copy_m3_m3d(float R[3][3], const double A[3][3]);
 
+/* float->double */
+void copy_m4d_m4(double R[4][4], const float A[4][4]);
+
 void swap_m3m3(float A[3][3], float B[3][3]);
 void swap_m4m4(float A[4][4], float B[4][4]);
 
@@ -82,6 +88,7 @@ void mul_m3_m3m3_uniq(float R[3][3], const float A[3][3], 
const float B[3][3]);
 void mul_m3_m3_pre(float R[3][3], const float A[3][3]);
 void mul_m3_m3_post(float R[3][3], const float B[3][3]);
 void mul_m4_m4m4_uniq(float R[4][4], const float A[4][4], const float B[4][4]);
+void mul_m4db_m4db_m4fl_uniq(double R[4][4], const double A[4][4], const float 
B[4][4]);
 void mul_m4_m4_pre(float R[4][4], const float A[4][4]);
 void mul_m4_m4_post(float R[4][4], const float B[4][4]);
 
@@ -173,11 +180,14 @@ void _va_mul_m4_series_9(float R[4][4],
 
 void mul_m4_v3(const float M[4][4], float r[3]);
 void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3]);
+void mul_v3_m4v3_db(double r[3], const double mat[4][4], const double vec[3]);
+void mul_v4_m4v3_db(double r[4], const double mat[4][4], const double vec[3]);
 void mul_v2_m4v3(float r[2], const float M[4][4], const float v[3]);
 void mul_v2_m2v2(float r[2], const float M[2][2], const float v[2]);
 void mul_m2v2(const float M[2][2], float v[2]);
 void mul_mat3_m4_v3(const float M[4][4], float r[3]);
 void mul_v3_mat3_m4v3(float r[3], const float M[4][4], const float v[3]);
+void mul_v3_mat3_m4v3_db(double r[3], const double M[4][4], const double v[3]);
 void mul_m4_v4(const float M[4][4], float r[4]);
 void mul_v4_m4v4(float r[4], const float M[4][4], const float v[4]);
 void mul_v4_m4v3(float r[4], const float M[4][4], const float v[3]); /* v has 
implicit w = 1.0f */
diff --git a/source/blender/blenlib/BLI_math_vector.h 
b/source/blender/blenlib/BLI_math_vector.h
index 7f526585e3b..ccb42683d5a 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -197,6 +197,7 @@ MINLINE double dot_v3v3_db(const double a[3], const double 
b[3]) ATTR_WARN_UNUSE
 MINLINE float cross_v2v2(const float a[2], const float b[2]) 
ATTR_WARN_UNUSED_RESULT;
 MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3]);
 MINLINE void cross_v3_v3v3_hi_prec(float r[3], const float a[3], const float 
b[3]);
+MINLINE void cross_v3_v3v3_db(double r[3], const double a[3], const double 
b[3]);
 
 MINLINE void add_newell_cross_v3_v3v3(float n[3], const float v_prev[3], const 
float v_curr[3]);
 
diff --git a/source/blender/blenlib/intern/math_matrix.c 
b/source/blender/blenlib/intern/math_matrix.c
index 7c64206134b..48e9f905f18 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -71,6 +71,15 @@ void unit_m4(float m[4][4])
   m[3][0] = m[3][1] = m[3][2] = 0.0f;
 }
 
+void unit_m4_db(double m[4][4])
+{
+  m[0][0] = m[1][1] = m[2][2] = m[3][3] = 1.0f;
+  m[0][1] = m[0][2] = m[0][3] = 0.0f;
+  m[1][0] = m[1][2] = m[1][3] = 0.0f;
+  m[2][0] = m[2][1] = m[2][3] = 0.0f;
+  m[3][0] = m[3][1] = m[3][2] = 0.0f;
+}
+
 void copy_m2_m2(float m1[2][2], const float m2[2][2])
 {
   memcpy(m1, m2, sizeof(float[2][2]));
@@ -87,6 +96,11 @@ void copy_m4_m4(float m1[4][4], const float m2[4][4])
   memcpy(m1, m2, sizeof(float[4][4]));
 }
 
+void copy_m4_m4_db(double m1[4][4], const double m2[4][4])
+{
+  memcpy(m1, m2, sizeof(double[4][4]));
+}
+
 void copy_m3_m4(float m1[3][3], const float m2[4][4])
 {
   m1[0][0] = m2[0][0];
@@ -127,6 +141,30 @@ void 

[Bf-blender-cvs] [d515b4e205f] temp-lanpr-staging: Merge remote-tracking branch 'origin/master' into temp-lanpr-staging

2019-08-15 Thread YimingWu
Commit: d515b4e205f054170086be602f8aaee3e6d5e968
Author: YimingWu
Date:   Fri Aug 16 09:42:46 2019 +0800
Branches: temp-lanpr-staging
https://developer.blender.org/rBd515b4e205f054170086be602f8aaee3e6d5e968

Merge remote-tracking branch 'origin/master' into temp-lanpr-staging

===



===

diff --cc source/blender/draw/CMakeLists.txt
index 0ac2bec1f16,1112a7a87db..fc91ac371cb
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@@ -128,13 -129,8 +129,13 @@@ set(SR
engines/gpencil/gpencil_engine.h
engines/gpencil/gpencil_render.c
engines/gpencil/gpencil_shader_fx.c
 +  engines/lanpr/lanpr_dpix.c
 +  engines/lanpr/lanpr_engine.c
 +  # engines/lanpr/lanpr_snake.c  deprecated for now.
 +  engines/lanpr/lanpr_cpu.c
 +  engines/lanpr/lanpr_chain_draw.c
-   engines/select/select_engine.c
engines/select/select_draw_utils.c
+   engines/select/select_engine.c
  
DRW_engine.h
DRW_select_buffer.h

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


[Bf-blender-cvs] [b790e32dedb] temp-lanpr-staging: LANPR: Use BLI math functions. Some added.

2019-08-15 Thread YimingWu
Commit: b790e32dedb4ef31a8bc8a8a9a9ade1e38504db5
Author: YimingWu
Date:   Mon Aug 12 09:58:24 2019 +0800
Branches: temp-lanpr-staging
https://developer.blender.org/rBb790e32dedb4ef31a8bc8a8a9a9ade1e38504db5

LANPR: Use BLI math functions. Some added.

===

M   source/blender/blenlib/BLI_math_vector.h
M   source/blender/blenlib/intern/math_vector_inline.c
M   source/blender/draw/engines/lanpr/lanpr_cpu.c
M   source/blender/editors/include/ED_lanpr.h
M   source/blender/editors/lanpr/lanpr_cpu.c
M   source/blender/editors/lanpr/lanpr_util.c

===

diff --git a/source/blender/blenlib/BLI_math_vector.h 
b/source/blender/blenlib/BLI_math_vector.h
index 53e686c87a6..7f526585e3b 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -106,6 +106,7 @@ MINLINE void add_v2_v2(float r[2], const float a[2]);
 MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2]);
 MINLINE void add_v2_v2v2_int(int r[2], const int a[2], const int b[2]);
 MINLINE void add_v3_v3(float r[3], const float a[3]);
+MINLINE void add_v3_v3_db(double r[3], const double a[3]);
 MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3]);
 MINLINE void add_v4_v4(float r[4], const float a[4]);
 MINLINE void add_v4_v4v4(float r[4], const float a[4], const float b[4]);
@@ -119,6 +120,7 @@ MINLINE void sub_v2_v2v2_int(int r[2], const int a[2], 
const int b[2]);
 MINLINE void sub_v3_v3(float r[3], const float a[3]);
 MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3]);
 MINLINE void sub_v3_v3v3_int(int r[3], const int a[3], const int b[3]);
+MINLINE void sub_v3_v3v3_db(double r[3], const double a[3], const double b[3]);
 MINLINE void sub_v4_v4(float r[4], const float a[4]);
 MINLINE void sub_v4_v4v4(float r[4], const float a[4], const float b[4]);
 
@@ -127,6 +129,7 @@ MINLINE void sub_v3db_v3fl_v3fl(double r[3], const float 
a[3], const float b[3])
 MINLINE void mul_v2_fl(float r[2], float f);
 MINLINE void mul_v2_v2fl(float r[2], const float a[2], float f);
 MINLINE void mul_v3_fl(float r[3], float f);
+MINLINE void mul_v3db_db(double r[3], double f);
 MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f);
 MINLINE void mul_v2_v2(float r[2], const float a[2]);
 MINLINE void mul_v2_v2v2(float r[2], const float a[2], const float b[2]);
@@ -189,6 +192,8 @@ MINLINE float dot_v4v4(const float a[4], const float b[4]) 
ATTR_WARN_UNUSED_RESU
 
 MINLINE double dot_v3db_v3fl(const double a[3], const float b[3]) 
ATTR_WARN_UNUSED_RESULT;
 
+MINLINE double dot_v3v3_db(const double a[3], const double b[3]) 
ATTR_WARN_UNUSED_RESULT;
+
 MINLINE float cross_v2v2(const float a[2], const float b[2]) 
ATTR_WARN_UNUSED_RESULT;
 MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3]);
 MINLINE void cross_v3_v3v3_hi_prec(float r[3], const float a[3], const float 
b[3]);
diff --git a/source/blender/blenlib/intern/math_vector_inline.c 
b/source/blender/blenlib/intern/math_vector_inline.c
index 865c2f5dc25..f646907797c 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -374,6 +374,13 @@ MINLINE void add_v3_v3(float r[3], const float a[3])
   r[2] += a[2];
 }
 
+MINLINE void add_v3_v3_db(double r[3], const double a[3])
+{
+  r[0] += a[0];
+  r[1] += a[1];
+  r[2] += a[2];
+}
+
 MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
 {
   r[0] = a[0] + b[0];
@@ -450,6 +457,13 @@ MINLINE void sub_v3_v3v3_int(int r[3], const int a[3], 
const int b[3])
   r[2] = a[2] - b[2];
 }
 
+MINLINE void sub_v3_v3v3_db(double r[3], const double a[3], const double b[3])
+{
+  r[0] = a[0] - b[0];
+  r[1] = a[1] - b[1];
+  r[2] = a[2] - b[2];
+}
+
 MINLINE void sub_v3db_v3fl_v3fl(double r[3], const float a[3], const float 
b[3])
 {
   r[0] = (double)a[0] - (double)b[0];
@@ -492,6 +506,13 @@ MINLINE void mul_v3_fl(float r[3], float f)
   r[2] *= f;
 }
 
+MINLINE void mul_v3db_db(double r[3], double f)
+{
+  r[0] *= f;
+  r[1] *= f;
+  r[2] *= f;
+}
+
 MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
 {
   r[0] = a[0] * f;
@@ -836,6 +857,11 @@ MINLINE double dot_v3db_v3fl(const double a[3], const 
float b[3])
   return a[0] * (double)b[0] + a[1] * (double)b[1] + a[2] * (double)b[2];
 }
 
+MINLINE double dot_v3v3_db(const double a[3], const double b[3])
+{
+  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
+}
+
 MINLINE float cross_v2v2(const float a[2], const float b[2])
 {
   return a[0] * b[1] - a[1] * b[0];
diff --git a/source/blender/draw/engines/lanpr/lanpr_cpu.c 
b/source/blender/draw/engines/lanpr/lanpr_cpu.c
index 29def5bfd92..423ad643d9a 100644
--- a/source/blender/draw/engines/lanpr/lanpr_cpu.c
+++ b/source/blender/draw/engines/lanpr/lanpr_cpu.c
@@ -94,8 +94,8 @@ static void 

[Bf-blender-cvs] [33d3dcdb00c] temp-lanpr-staging: View3D: Circle Select optimization

2019-08-15 Thread mano-wii
Commit: 33d3dcdb00c99217333d8919565830807199d23f
Author: mano-wii
Date:   Sun Aug 11 22:12:11 2019 -0300
Branches: temp-lanpr-staging
https://developer.blender.org/rB33d3dcdb00c99217333d8919565830807199d23f

View3D: Circle Select optimization

Don't recreate `select_bitmap` for each edited object.

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_select.c 
b/source/blender/editors/space_view3d/view3d_select.c
index d20a854c022..3e2d387bcec 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -3392,7 +3392,9 @@ static bool mesh_circle_select(ViewContext *vc,
   struct EditSelectBuf_Cache *esel = wm_userdata->data;
 
   if (use_zbuf) {
-esel->select_bitmap = DRW_select_buffer_bitmap_from_circle(mval, (int)(rad 
+ 1.0f), NULL);
+if (esel->select_bitmap == NULL) {
+  esel->select_bitmap = DRW_select_buffer_bitmap_from_circle(mval, 
(int)(rad + 1.0f), NULL);
+}
   }
 
   if (ts->selectmode & SCE_SELECT_VERTEX) {
@@ -3432,13 +3434,6 @@ static bool mesh_circle_select(ViewContext *vc,
 }
   }
 
-  if (use_zbuf) {
-if (esel->select_bitmap != NULL) {
-  MEM_freeN(esel->select_bitmap);
-  esel->select_bitmap = NULL;
-}
-  }
-
   changed |= data.is_changed;
 
   if (changed) {
@@ -4020,6 +4015,13 @@ static int view3d_circle_select_exec(bContext *C, 
wmOperator *op)
   if (wm_userdata == _userdata_buf) {
 WM_generic_user_data_free(wm_userdata);
   }
+  else {
+struct EditSelectBuf_Cache *esel = wm_userdata->data;
+if (esel && esel->select_bitmap) {
+  MEM_freeN(esel->select_bitmap);
+  esel->select_bitmap = NULL;
+}
+  }
 
   return OPERATOR_FINISHED;
 }

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


[Bf-blender-cvs] [ccc113deba8] temp-lanpr-staging: Merge remote-tracking branch 'origin/master' into temp-lanpr-staging

2019-08-15 Thread YimingWu
Commit: ccc113deba817e17ad63ecd2169a4ae1cb05e17a
Author: YimingWu
Date:   Wed Aug 14 15:46:31 2019 +0800
Branches: temp-lanpr-staging
https://developer.blender.org/rBccc113deba817e17ad63ecd2169a4ae1cb05e17a

Merge remote-tracking branch 'origin/master' into temp-lanpr-staging

===



===

diff --cc source/blender/draw/CMakeLists.txt
index 8bb309d72d9,84302e3cf44..0ac2bec1f16
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@@ -127,14 -128,8 +128,13 @@@ set(SR
engines/gpencil/gpencil_engine.h
engines/gpencil/gpencil_render.c
engines/gpencil/gpencil_shader_fx.c
 +  engines/lanpr/lanpr_dpix.c
 +  engines/lanpr/lanpr_engine.c
 +  # engines/lanpr/lanpr_snake.c  deprecated for now.
 +  engines/lanpr/lanpr_cpu.c
 +  engines/lanpr/lanpr_chain_draw.c
engines/select/select_engine.c
engines/select/select_draw_utils.c
-   engines/select/select_buffer.c
  
DRW_engine.h
DRW_select_buffer.h

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


[Bf-blender-cvs] [e21a36b69ae] temp-lanpr-staging: Cleanup: Use "level_start".

2019-08-15 Thread YimingWu
Commit: e21a36b69aea038fea035f64529ad440f65465c6
Author: YimingWu
Date:   Sun Aug 11 17:22:43 2019 +0800
Branches: temp-lanpr-staging
https://developer.blender.org/rBe21a36b69aea038fea035f64529ad440f65465c6

Cleanup: Use "level_start".

===

M   release/scripts/startup/bl_ui/properties_collection.py
M   release/scripts/startup/bl_ui/properties_lanpr.py
M   source/blender/draw/engines/lanpr/lanpr_cpu.c
M   source/blender/draw/engines/lanpr/shaders/lanpr_software_chain_geom.glsl
M   source/blender/editors/lanpr/lanpr_cpu.c
M   source/blender/makesdna/DNA_collection_types.h
M   source/blender/makesdna/DNA_modifier_types.h
M   source/blender/makesrna/intern/rna_collection.c
M   source/blender/makesrna/intern/rna_modifier.c

===

diff --git a/release/scripts/startup/bl_ui/properties_collection.py 
b/release/scripts/startup/bl_ui/properties_collection.py
index 94b2a1aabd8..6393101fef3 100644
--- a/release/scripts/startup/bl_ui/properties_collection.py
+++ b/release/scripts/startup/bl_ui/properties_collection.py
@@ -93,10 +93,10 @@ class 
COLLECTION_PT_lanpr_collection(CollectionButtonsPanel, Panel):
 
 if lanpr.use_multiple_levels:
 col = layout.column(align=True)
-col.prop(lanpr,'level_begin',text="Level Begin")
+col.prop(lanpr,'level_start',text="Level Begin")
 col.prop(lanpr,'level_end',text="End")
 else:
-layout.prop(lanpr,'level_begin',text="Level")
+layout.prop(lanpr,'level_start',text="Level")
 
 layout.prop(lanpr,'enable_contour')
 layout.prop(lanpr,'enable_crease')
diff --git a/release/scripts/startup/bl_ui/properties_lanpr.py 
b/release/scripts/startup/bl_ui/properties_lanpr.py
index c895eb522e0..37c65640dbc 100644
--- a/release/scripts/startup/bl_ui/properties_lanpr.py
+++ b/release/scripts/startup/bl_ui/properties_lanpr.py
@@ -68,10 +68,10 @@ class OBJECT_PT_lanpr_settings(LanprButtonsPanel, Panel):
 layout.prop(md,'use_multiple_levels', text="Multiple Levels")
 if md.use_multiple_levels:
 col = layout.column(align=True)
-col.prop(md,'level_begin')
+col.prop(md,'level_start')
 col.prop(md,'level_end', text="End")
 else:
-layout.prop(md,'level_begin', text="Level")
+layout.prop(md,'level_start', text="Level")
 
 layout.prop(md,'enable_contour')
 layout.prop(md,'enable_crease')
diff --git a/source/blender/draw/engines/lanpr/lanpr_cpu.c 
b/source/blender/draw/engines/lanpr/lanpr_cpu.c
index 047cb6850be..1944e30cb9f 100644
--- a/source/blender/draw/engines/lanpr/lanpr_cpu.c
+++ b/source/blender/draw/engines/lanpr/lanpr_cpu.c
@@ -332,7 +332,7 @@ void lanpr_software_draw_scene(void *vedata, GPUFrameBuffer 
*dfb, int is_render)
 rb->ChainShgrp, "normal_thickness_end", >normal_thickness_end, 
1);
 DRW_shgroup_uniform_vec3(rb->ChainShgrp, "normal_direction", 
normal_object_direction, 1);
 
-DRW_shgroup_uniform_int(rb->ChainShgrp, "occlusion_level_begin", 
>qi_begin, 1);
+DRW_shgroup_uniform_int(rb->ChainShgrp, "occlusion_level_start", 
>qi_begin, 1);
 DRW_shgroup_uniform_int(rb->ChainShgrp,
 "occlusion_level_end",
 ll->use_multiple_levels ? >qi_end : 
>qi_begin,
diff --git 
a/source/blender/draw/engines/lanpr/shaders/lanpr_software_chain_geom.glsl 
b/source/blender/draw/engines/lanpr/shaders/lanpr_software_chain_geom.glsl
index 6db3e4fa5c9..3e867959bf3 100644
--- a/source/blender/draw/engines/lanpr/shaders/lanpr_software_chain_geom.glsl
+++ b/source/blender/draw/engines/lanpr/shaders/lanpr_software_chain_geom.glsl
@@ -27,7 +27,7 @@ uniform int enable_material;
 uniform int enable_edge_mark;
 uniform int enable_intersection;
 
-uniform int occlusion_level_begin;
+uniform int occlusion_level_start;
 uniform int occlusion_level_end;
 
 // implement these later.
@@ -238,7 +238,7 @@ void main()
 {
   int level = gLevel[1];
 
-  if (occlusion_level_begin > level || occlusion_level_end < level)
+  if (occlusion_level_start > level || occlusion_level_end < level)
 return;
 
   float asp1 = output_viewport.z / output_viewport.w;
diff --git a/source/blender/editors/lanpr/lanpr_cpu.c 
b/source/blender/editors/lanpr/lanpr_cpu.c
index 1e8b72f4362..7d15ad7ad41 100644
--- a/source/blender/editors/lanpr/lanpr_cpu.c
+++ b/source/blender/editors/lanpr/lanpr_cpu.c
@@ -2641,10 +2641,10 @@ static int 
lanpr_max_occlusion_in_collections(Collection *c)
   int max_occ = 0;
   int max;
   if (c->lanpr.use_multiple_levels) {
-max = MAX2(c->lanpr.level_begin, c->lanpr.level_end);
+max = MAX2(c->lanpr.level_start, c->lanpr.level_end);
   }
   else {
- 

[Bf-blender-cvs] [cfd060147bb] temp-lanpr-staging: Cleanup: Use "normal_thickness_start".

2019-08-15 Thread YimingWu
Commit: cfd060147bb1f74daf9ea54b797d533723991406
Author: YimingWu
Date:   Sun Aug 11 17:25:05 2019 +0800
Branches: temp-lanpr-staging
https://developer.blender.org/rBcfd060147bb1f74daf9ea54b797d533723991406

Cleanup: Use "normal_thickness_start".

===

M   release/scripts/startup/bl_ui/properties_render.py
M   source/blender/draw/engines/lanpr/lanpr_cpu.c
M   source/blender/draw/engines/lanpr/lanpr_engine.c
M   source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_geom.glsl
M   source/blender/draw/engines/lanpr/shaders/lanpr_software_chain_geom.glsl
M   
source/blender/draw/engines/lanpr/shaders/lanpr_software_line_chain_geom.glsl
M   source/blender/editors/lanpr/lanpr_cpu.c
M   source/blender/makesdna/DNA_lanpr_types.h
M   source/blender/makesrna/intern/rna_lanpr.c

===

diff --git a/release/scripts/startup/bl_ui/properties_render.py 
b/release/scripts/startup/bl_ui/properties_render.py
index 3945460d0f6..ec22f407d67 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -745,7 +745,7 @@ class RENDER_PT_lanpr(RenderButtonsPanel, Panel):
 txt = "Update" if mode == "SOFTWARE" else "Intersection Cache"
 if not lanpr.auto_update:
 c.operator("scene.lanpr_calculate", icon='FILE_REFRESH', 
text=txt)
-
+
 if mode == "DPIX" and len(lanpr.layers)==0:
 layout.label(text="You don't have a layer to display.")
 layout.operator("scene.lanpr_add_line_layer");
@@ -906,7 +906,7 @@ class 
RENDER_PT_lanpr_line_normal_effects(RenderButtonsPanel, Panel):
 col.prop(active_layer,"normal_ramp_begin")
 col.prop(active_layer,"normal_ramp_end", text="End")
 col = layout.column(align=True)
-col.prop(active_layer,"normal_thickness_begin", slider=True)
+col.prop(active_layer,"normal_thickness_start", slider=True)
 col.prop(active_layer,"normal_thickness_end", slider=True, 
text="End")
 
 class RENDER_PT_lanpr_line_gpu_effects(RenderButtonsPanel, Panel):
diff --git a/source/blender/draw/engines/lanpr/lanpr_cpu.c 
b/source/blender/draw/engines/lanpr/lanpr_cpu.c
index 1944e30cb9f..f4081fc979a 100644
--- a/source/blender/draw/engines/lanpr/lanpr_cpu.c
+++ b/source/blender/draw/engines/lanpr/lanpr_cpu.c
@@ -327,7 +327,7 @@ void lanpr_software_draw_scene(void *vedata, GPUFrameBuffer 
*dfb, int is_render)
 DRW_shgroup_uniform_float(rb->ChainShgrp, "normal_ramp_begin", 
>normal_ramp_begin, 1);
 DRW_shgroup_uniform_float(rb->ChainShgrp, "normal_ramp_end", 
>normal_ramp_end, 1);
 DRW_shgroup_uniform_float(
-rb->ChainShgrp, "normal_thickness_begin", 
>normal_thickness_begin, 1);
+rb->ChainShgrp, "normal_thickness_start", 
>normal_thickness_start, 1);
 DRW_shgroup_uniform_float(
 rb->ChainShgrp, "normal_thickness_end", >normal_thickness_end, 
1);
 DRW_shgroup_uniform_vec3(rb->ChainShgrp, "normal_direction", 
normal_object_direction, 1);
@@ -428,7 +428,7 @@ void lanpr_software_draw_scene(void *vedata, GPUFrameBuffer 
*dfb, int is_render)
   DRW_shgroup_uniform_float(ll->shgrp, "normal_ramp_begin", 
>normal_ramp_begin, 1);
   DRW_shgroup_uniform_float(ll->shgrp, "normal_ramp_end", 
>normal_ramp_end, 1);
   DRW_shgroup_uniform_float(
-  ll->shgrp, "normal_thickness_begin", 
>normal_thickness_begin, 1);
+  ll->shgrp, "normal_thickness_start", 
>normal_thickness_start, 1);
   DRW_shgroup_uniform_float(
   ll->shgrp, "normal_thickness_end", >normal_thickness_end, 1);
   DRW_shgroup_uniform_vec3(ll->shgrp, "normal_direction", 
normal_object_direction, 1);
diff --git a/source/blender/draw/engines/lanpr/lanpr_engine.c 
b/source/blender/draw/engines/lanpr/lanpr_engine.c
index 4ffac758ea0..12e3901877d 100644
--- a/source/blender/draw/engines/lanpr/lanpr_engine.c
+++ b/source/blender/draw/engines/lanpr/lanpr_engine.c
@@ -395,7 +395,7 @@ static void lanpr_cache_init(void *vedata)
 DRW_shgroup_uniform_float(
 stl->g_data->dpix_preview_shgrp, "normal_ramp_end", 
>normal_ramp_end, 1);
 DRW_shgroup_uniform_float(
-stl->g_data->dpix_preview_shgrp, "normal_thickness_begin", 
>normal_thickness_begin, 1);
+stl->g_data->dpix_preview_shgrp, "normal_thickness_start", 
>normal_thickness_start, 1);
 DRW_shgroup_uniform_float(
 stl->g_data->dpix_preview_shgrp, "normal_thickness_end", 
>normal_thickness_end, 1);
 DRW_shgroup_uniform_vec3(
diff --git 
a/source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_geom.glsl 
b/source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_geom.glsl
index 2abdf2a6125..4d83d47e4fc 100644
--- 

[Bf-blender-cvs] [01369f14000] temp-lanpr-staging: Cleanup: make format.

2019-08-15 Thread YimingWu
Commit: 01369f14000b2d7d2f77817149f98376bb57b56c
Author: YimingWu
Date:   Sun Aug 11 17:40:06 2019 +0800
Branches: temp-lanpr-staging
https://developer.blender.org/rB01369f14000b2d7d2f77817149f98376bb57b56c

Cleanup: make format.

===

M   source/blender/blenkernel/BKE_gpencil.h
M   source/blender/blenkernel/intern/gpencil.c
M   source/blender/draw/engines/lanpr/lanpr_cpu.c
M   source/blender/draw/engines/lanpr/lanpr_dpix.c
M   source/blender/draw/engines/lanpr/lanpr_engine.c
M   source/blender/draw/engines/lanpr/lanpr_snake.c
M   source/blender/editors/include/ED_lanpr.h
M   source/blender/makesrna/intern/rna_collection.c
M   source/blender/makesrna/intern/rna_modifier.c
M   source/blender/modifiers/intern/MOD_featureline.c

===

diff --git a/source/blender/blenkernel/BKE_gpencil.h 
b/source/blender/blenkernel/BKE_gpencil.h
index f4807c00ebf..2265666c345 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -136,7 +136,6 @@ struct bGPDframe *BKE_gpencil_layer_getframe(struct 
bGPDlayer *gpl,
 struct bGPDframe *BKE_gpencil_layer_find_frame(struct bGPDlayer *gpl, int 
cframe);
 bool BKE_gpencil_layer_delframe(struct bGPDlayer *gpl, struct bGPDframe *gpf);
 
-
 struct bGPDlayer *BKE_gpencil_layer_get_index(struct bGPdata *gpd,
   int index,
   int first_if_not_found);
diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index dcb920280ce..6988fd0f6c9 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1009,7 +1009,6 @@ bGPDlayer *BKE_gpencil_layer_get_index(bGPdata *gpd, int 
index, int first_if_not
   return NULL;
 }
 
-
 /* set the active gp-layer */
 void BKE_gpencil_layer_setactive(bGPdata *gpd, bGPDlayer *active)
 {
diff --git a/source/blender/draw/engines/lanpr/lanpr_cpu.c 
b/source/blender/draw/engines/lanpr/lanpr_cpu.c
index f4081fc979a..29def5bfd92 100644
--- a/source/blender/draw/engines/lanpr/lanpr_cpu.c
+++ b/source/blender/draw/engines/lanpr/lanpr_cpu.c
@@ -217,7 +217,7 @@ void lanpr_software_draw_scene(void *vedata, GPUFrameBuffer 
*dfb, int is_render)
   static int zero_value = 0;
 
   copy_v3_v3(use_background_color, >world->horr);
-  use_background_color[3] = scene->r.alphamode?0.0f:1.0f;
+  use_background_color[3] = scene->r.alphamode ? 0.0f : 1.0f;
 
   GPU_framebuffer_bind(fbl->software_ms);
   GPU_framebuffer_clear(
@@ -447,9 +447,9 @@ void lanpr_software_draw_scene(void *vedata, GPUFrameBuffer 
*dfb, int is_render)
   }
 }
 
-void ED_lanpr_update_render_progress(const char* text)
+void ED_lanpr_update_render_progress(const char *text)
 {
-  if(lanpr_share.re_render){
-RE_engine_update_stats(lanpr_share.re_render,NULL,text);
+  if (lanpr_share.re_render) {
+RE_engine_update_stats(lanpr_share.re_render, NULL, text);
   }
 }
diff --git a/source/blender/draw/engines/lanpr/lanpr_dpix.c 
b/source/blender/draw/engines/lanpr/lanpr_dpix.c
index c9401211840..62dfb5b3209 100644
--- a/source/blender/draw/engines/lanpr/lanpr_dpix.c
+++ b/source/blender/draw/engines/lanpr/lanpr_dpix.c
@@ -500,7 +500,7 @@ void lanpr_dpix_draw_scene(LANPR_TextureList *txl,
   pd->dpix_zfar = camera ? ((Camera *)camera->data)->clip_end : v3d->clip_end;
 
   copy_v3_v3(use_background_color, >world->horr);
-  use_background_color[3] = scene->r.alphamode?0.0f:1.0f;
+  use_background_color[3] = scene->r.alphamode ? 0.0f : 1.0f;
 
   GPU_point_size(1);
   /*  GPU_line_width(2); */
diff --git a/source/blender/draw/engines/lanpr/lanpr_engine.c 
b/source/blender/draw/engines/lanpr/lanpr_engine.c
index 12e3901877d..9f1a2394722 100644
--- a/source/blender/draw/engines/lanpr/lanpr_engine.c
+++ b/source/blender/draw/engines/lanpr/lanpr_engine.c
@@ -337,7 +337,7 @@ static void lanpr_cache_init(void *vedata)
  1);
 static float use_background_color[4];
 copy_v3_v3(use_background_color, >world->horr);
-use_background_color[3] = scene->r.alphamode?0.0f:1.0f;
+use_background_color[3] = scene->r.alphamode ? 0.0f : 1.0f;
 
 DRW_shgroup_uniform_vec4(
 stl->g_data->dpix_preview_shgrp, "background_color", 
use_background_color, 1);
diff --git a/source/blender/draw/engines/lanpr/lanpr_snake.c 
b/source/blender/draw/engines/lanpr/lanpr_snake.c
index 124c79f3ea5..a27b996cc0c 100644
--- a/source/blender/draw/engines/lanpr/lanpr_snake.c
+++ b/source/blender/draw/engines/lanpr/lanpr_snake.c
@@ -549,11 +549,10 @@ void lanpr_snake_draw_scene(LANPR_TextureList *txl,
   float use_background_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
 
   copy_v3_v3(use_background_color, >world->horr);
-  use_background_color[3] = scene->r.alphamode?0.0f:1.0f;
+  use_background_color[3] = scene->r.alphamode ? 

[Bf-blender-cvs] [255048842fa] temp-lanpr-staging: Cleanup: Remove tnsLinearItp().

2019-08-15 Thread YimingWu
Commit: 255048842fa83ed1c830dacb2cb77245ff99d048
Author: YimingWu
Date:   Mon Aug 12 10:24:09 2019 +0800
Branches: temp-lanpr-staging
https://developer.blender.org/rB255048842fa83ed1c830dacb2cb77245ff99d048

Cleanup: Remove tnsLinearItp().

===

M   source/blender/draw/engines/lanpr/lanpr_dpix.c
M   source/blender/draw/engines/lanpr/lanpr_snake.c
M   source/blender/editors/include/ED_lanpr.h
M   source/blender/editors/lanpr/lanpr_cpu.c

===

diff --git a/source/blender/draw/engines/lanpr/lanpr_dpix.c 
b/source/blender/draw/engines/lanpr/lanpr_dpix.c
index 62dfb5b3209..2e850500a83 100644
--- a/source/blender/draw/engines/lanpr/lanpr_dpix.c
+++ b/source/blender/draw/engines/lanpr/lanpr_dpix.c
@@ -318,8 +318,8 @@ int lanpr_feed_atlas_data_intersection_cache(void 
*UNUSED(vedata),
 static void lanpr_dpix_index_to_coord(int index, float *x, float *y)
 {
   int texture_size = lanpr_share.texture_size;
-  (*x) = tnsLinearItp(-1, 1, (float)(index % texture_size + 0.5) / 
(float)texture_size);
-  (*y) = tnsLinearItp(-1, 1, (float)(index / texture_size + 0.5) / 
(float)texture_size);
+  (*x) = interpf(1, -1, (float)(index % texture_size + 0.5) / 
(float)texture_size);
+  (*y) = interpf(1, -1, (float)(index / texture_size + 0.5) / 
(float)texture_size);
 }
 
 static void lanpr_dpix_index_to_coord_absolute(int index, float *x, float *y)
diff --git a/source/blender/draw/engines/lanpr/lanpr_snake.c 
b/source/blender/draw/engines/lanpr/lanpr_snake.c
index a27b996cc0c..aaec6ab289e 100644
--- a/source/blender/draw/engines/lanpr/lanpr_snake.c
+++ b/source/blender/draw/engines/lanpr/lanpr_snake.c
@@ -252,8 +252,8 @@ int lanpr_reverse_direction(int From)
 
 void lanpr_texture_to_ndc(int x, int y, int w, int h, float *x_ndc, float 
*y_ndc)
 {
-  *x_ndc = tnsLinearItp(-1, 1, (float)x / (float)w);
-  *y_ndc = tnsLinearItp(-1, 1, (float)y / (float)h);
+  *x_ndc = interpf(1, -1, (float)x / (float)w);
+  *y_ndc = interpf(1, -1, (float)y / (float)h);
 }
 
 void lanpr_count_drawing_elements(LANPR_PrivateData *pd,
diff --git a/source/blender/editors/include/ED_lanpr.h 
b/source/blender/editors/include/ED_lanpr.h
index 057107444c7..73edfa0ca55 100644
--- a/source/blender/editors/include/ED_lanpr.h
+++ b/source/blender/editors/include/ED_lanpr.h
@@ -34,8 +34,6 @@
 
 #include "DNA_lanpr_types.h"
 
-#define _CRT_SECURE_NO_WARNINGS
-
 #ifndef BYTE
 #  define BYTE unsigned char
 #endif
@@ -430,16 +428,10 @@ typedef struct LANPR_BoundingArea {
 /* #define TNS_OVERRIDE_ALL_OTHERS_IN_GROUP  3 */
 /* #define TNS_OVERRIDE_ALL_OTHERS   4 */
 
-#define tnsLinearItp(l, r, T) ((l) * (1.0f - (T)) + (r) * (T))
-
 #define TNS_TILE(tile, r, c, CCount) tile[r * CCount + c]
 
 #define TNS_CLAMP(a, Min, Max) a = a < Min ? Min : (a > Max ? Max : a)
 
-#define TNS_MAX2_INDEX(a, b) (a > b ? 0 : 1)
-
-#define TNS_MIN2_INDEX(a, b) (a < b ? 0 : 1)
-
 #define TNS_MAX3_INDEX(a, b, c) (a > b ? (a > c ? 0 : (b > c ? 1 : 2)) : (b > 
c ? 1 : 2))
 
 #define TNS_MIN3_INDEX(a, b, c) (a < b ? (a < c ? 0 : (b < c ? 1 : 2)) : (b < 
c ? 1 : 2))
@@ -521,14 +513,14 @@ BLI_INLINE int lanpr_LineIntersectTest2d(
   return 0;
 }
 double r2 = tMatGetLinearRatio(b1[0], b2[0], a1[0]);
-x = tnsLinearItp(b1[0], b2[0], r2);
-y = tnsLinearItp(b1[1], b2[1], r2);
+x = interpd(b2[0], b1[0], r2);
+y = interpd(b2[1], b1[1], r2);
 *aRatio = Ratio = tMatGetLinearRatio(a1[1], a2[1], y);
   }
   else {
 if (xDiff2 == 0) {
   Ratio = tMatGetLinearRatio(a1[0], a2[0], b1[0]);
-  x = tnsLinearItp(a1[0], a2[0], Ratio);
+  x = interpd(a2[0], a1[0], Ratio);
   *aRatio = Ratio;
 }
 else {
@@ -547,7 +539,7 @@ BLI_INLINE int lanpr_LineIntersectTest2d(
   }
 
   if (b1[0] == b2[0]) {
-y = tnsLinearItp(a1[1], a2[1], Ratio);
+y = interpd(a2[1], a1[1], Ratio);
 if (y > MAX2(b1[1], b2[1]) || y < MIN2(b1[1], b2[1]))
   return 0;
   }
@@ -560,15 +552,13 @@ BLI_INLINE int lanpr_LineIntersectTest2d(
 }
 BLI_INLINE double lanpr_GetLineZ(tnsVector3d l, tnsVector3d r, real Ratio)
 {
-  /*  double z = 1 / tnsLinearItp(1 / l[2], 1 / r[2], Ratio); */
-  double z = tnsLinearItp(l[2], r[2], Ratio);
+  double z = interpd(r[2], l[2], Ratio);
   return z;
 }
 BLI_INLINE double lanpr_GetLineZPoint(tnsVector3d l, tnsVector3d r, 
tnsVector3d FromL)
 {
   double ra = (FromL[0] - l[0]) / (r[0] - l[0]);
-  return tnsLinearItp(l[2], r[2], ra);
-  /*  return 1 / tnsLinearItp(1 / l[2], 1 / r[2], r); */
+  return interpd(r[2], l[2], ra);
 }
 BLI_INLINE double lanpr_GetLinearRatio(tnsVector3d l, tnsVector3d r, 
tnsVector3d FromL)
 {
@@ -582,71 +572,13 @@ BLI_INLINE double tMatGetLinearRatio(real l, real r, real 
FromL)
   return ra;
 }
 
-BLI_INLINE real tMatDirectionToRad(tnsVector2d Dir)
-{
-  real arcc = acos(Dir[0]);
-  real arcs = asin(Dir[1]);
-
-  if (Dir[0] >= 0) {
-if (Dir[1] >= 0)
-  

[Bf-blender-cvs] [17656a6e1fe] temp-lanpr-staging: LANPR: Use flag for enable field.

2019-08-15 Thread YimingWu
Commit: 17656a6e1fedbc344aa1492d83257262bcfca776
Author: YimingWu
Date:   Mon Aug 12 09:12:09 2019 +0800
Branches: temp-lanpr-staging
https://developer.blender.org/rB17656a6e1fedbc344aa1492d83257262bcfca776

LANPR: Use flag for enable field.

===

M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/editors/lanpr/lanpr_cpu.c
M   source/blender/editors/space_buttons/buttons_context.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/source/blender/blenkernel/intern/scene.c 
b/source/blender/blenkernel/intern/scene.c
index 3440c8dfb69..d73843663fd 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1017,13 +1017,7 @@ void BKE_scene_init(Scene *sce)
   /* SceneLANPR */
 
   sce->lanpr.crease_threshold = 0.7;
-
-  sce->lanpr.line_thickness = 1.5;
-  sce->lanpr.depth_clamp = 0.001;
-  sce->lanpr.depth_strength = 800;
-  sce->lanpr.normal_clamp = 2;
-  sce->lanpr.normal_strength = 10;
-
+  
   sce->lanpr.enable_intersections = 1;
 
   sce->lanpr.line_color[0] = 1;
diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index cc52bb8f2fd..c5880eed175 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -1796,12 +1796,6 @@ void blo_do_versions_280(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 
 scene->lanpr.crease_threshold = 0.7;
 
-scene->lanpr.line_thickness = 1.5;
-scene->lanpr.depth_clamp = 0.001;
-scene->lanpr.depth_strength = 800;
-scene->lanpr.normal_clamp = 2;
-scene->lanpr.normal_strength = 10;
-
 scene->lanpr.enable_intersections = 1;
 
 scene->lanpr.line_color[0] = 0.39;
@@ -3516,12 +3510,6 @@ void blo_do_versions_280(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 for (Scene *sce = bmain->scenes.first; sce; sce = sce->id.next) {
   sce->lanpr.crease_threshold = 0.7;
 
-  sce->lanpr.line_thickness = 1.5;
-  sce->lanpr.depth_clamp = 0.001;
-  sce->lanpr.depth_strength = 800;
-  sce->lanpr.normal_clamp = 2;
-  sce->lanpr.normal_strength = 10;
-
   sce->lanpr.enable_intersections = 1;
 
   zero_v4(sce->lanpr.line_color);
diff --git a/source/blender/editors/lanpr/lanpr_cpu.c 
b/source/blender/editors/lanpr/lanpr_cpu.c
index 4c1c254aea0..8d4ef34d51f 100644
--- a/source/blender/editors/lanpr/lanpr_cpu.c
+++ b/source/blender/editors/lanpr/lanpr_cpu.c
@@ -3756,7 +3756,7 @@ int ED_lanpr_compute_feature_lines_internal(Depsgraph 
*depsgraph, int intersecto
   SceneLANPR *lanpr = >lanpr;
   int is_lanpr_engine = !strcmp(s->r.engine, RE_engine_id_BLENDER_LANPR);
 
-  if (!is_lanpr_engine && !lanpr->enabled) {
+  if (!is_lanpr_engine && (lanpr->flag & LANPR_ENABLED)==0) {
 return OPERATOR_CANCELLED;
   }
 
@@ -3844,7 +3844,7 @@ static int lanpr_compute_feature_lines_exec(struct 
bContext *C, struct wmOperato
   int result;
   int is_lanpr_engine = !strcmp(scene->r.engine, RE_engine_id_BLENDER_LANPR);
 
-  if (!is_lanpr_engine && !lanpr->enabled) {
+  if (!is_lanpr_engine && (lanpr->flag & LANPR_ENABLED)==0) {
 return OPERATOR_CANCELLED;
   }
 
@@ -3899,7 +3899,7 @@ bool ED_lanpr_dpix_shader_error()
 }
 bool ED_lanpr_disable_edge_splits(Scene *s)
 {
-  return (s->lanpr.enabled && s->lanpr.disable_edge_splits);
+  return ((s->lanpr.flag & LANPR_ENABLED) && s->lanpr.disable_edge_splits);
 }
 
 /* GPencil bindings */
@@ -4283,7 +4283,7 @@ void OBJECT_OT_lanpr_update_gp_source(struct 
wmOperatorType *ot)
 
 void ED_lanpr_post_frame_update_external(Scene *s, Depsgraph *dg)
 {
-  if (!s->lanpr.enabled || !s->lanpr.auto_update) {
+  if ((s->lanpr.flag & LANPR_ENABLED)==0 || !s->lanpr.auto_update) {
 return;
   }
   if (strcmp(s->r.engine, RE_engine_id_BLENDER_LANPR)) {
diff --git a/source/blender/editors/space_buttons/buttons_context.c 
b/source/blender/editors/space_buttons/buttons_context.c
index bd7c8b8dbbd..2a28dc56607 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -604,7 +604,7 @@ static int buttons_context_path(const bContext *C, 
ButsContextPath *path, int ma
   found = buttons_context_path_collection(path, window);
   break;
 case BCONTEXT_LANPR:
-  if (scene && (scene->lanpr.enabled || !strcmp(scene->r.engine, 
"BLENDER_LANPR"))) {
+  if (scene && ((scene->lanpr.flag & LANPR_ENABLED) || 
!strcmp(scene->r.engine, "BLENDER_LANPR"))) {
 found = buttons_context_path_object(path);
   }
   else {
diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index a6544a7f950..590a46718dd 100644

[Bf-blender-cvs] [ddb78ea43b7] temp-lanpr-staging: Cleanup: Remove material LANPR settings for future integration.

2019-08-15 Thread YimingWu
Commit: ddb78ea43b73c150e29ddf1a1adf1ea86365f2cb
Author: YimingWu
Date:   Sun Aug 11 17:49:28 2019 +0800
Branches: temp-lanpr-staging
https://developer.blender.org/rBddb78ea43b73c150e29ddf1a1adf1ea86365f2cb

Cleanup: Remove material LANPR settings for future integration.

===

M   release/scripts/startup/bl_ui/properties_material.py
M   source/blender/makesdna/DNA_material_types.h
M   source/blender/makesrna/intern/rna_material.c

===

diff --git a/release/scripts/startup/bl_ui/properties_material.py 
b/release/scripts/startup/bl_ui/properties_material.py
index 011e8fffd57..e2cbab579d6 100644
--- a/release/scripts/startup/bl_ui/properties_material.py
+++ b/release/scripts/startup/bl_ui/properties_material.py
@@ -201,28 +201,6 @@ class EEVEE_MATERIAL_PT_volume(MaterialButtonsPanel, 
Panel):
 
 panel_node_draw(layout, mat.node_tree, 'OUTPUT_MATERIAL', "Volume")
 
-class EEVEE_MATERIAL_PT_lines(MaterialButtonsPanel, Panel):
-bl_label = "Lines"
-bl_context = "material"
-COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_LANPR'}
-
-def draw_header(self, context):
-layout = self.layout
-mat = context.material
-layout.prop(mat, "enable_lines", text="")
-
-def draw(self, context):
-layout = self.layout
-mat = context.material
-
-if mat.enable_lines: 
-layout.label(text="Transparency")
-layout.prop(mat,"mask_layers_count", expand=True)
-layout.label(text="Customization")
-layout.template_list("LANPR_linesets", "", mat, "line_layers", 
mat.line_layers, "active_layer_index", rows=1)
-else:
-layout.prop(mat, "exclude_line_geometry", toggle=True)
-
 class EEVEE_MATERIAL_PT_settings(MaterialButtonsPanel, Panel):
 bl_label = "Settings"
 bl_context = "material"
@@ -282,7 +260,6 @@ classes = (
 EEVEE_MATERIAL_PT_context_material,
 EEVEE_MATERIAL_PT_surface,
 EEVEE_MATERIAL_PT_volume,
-EEVEE_MATERIAL_PT_lines,
 EEVEE_MATERIAL_PT_settings,
 MATERIAL_PT_viewport,
 MATERIAL_PT_custom_props,
diff --git a/source/blender/makesdna/DNA_material_types.h 
b/source/blender/makesdna/DNA_material_types.h
index 7559c8821b9..39635f8b48f 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -139,14 +139,6 @@ typedef enum eMaterialGPencilStyle_Mode {
   GP_STYLE_MODE_BOX = 2,  /* rectangles */
 } eMaterialGPencilStyle_Mode;
 
-typedef enum eMaterialLANPRMaskLayerCount {
-  LANPR_MASK_NONE = 0,
-  LANPR_MASK_ONE = 1,
-  LANPR_MASK_TWO = 2,
-  LANPR_MASK_THREE = 3,
-  LANPR_MASK_FOUR = 4,
-} eMaterialLANPRMaskLayerCount;
-
 typedef struct Material {
   ID id;
   /** Animation data (must be immediately after id for utilities to use it). */
@@ -187,14 +179,6 @@ typedef struct Material {
   short line_priority;
   short vcol_alpha;
 
-  /* lanpr settings */
-  char mask_layers_count;
-  char exclude_line_display;
-  char exclude_line_geometry;
-  char _pad5;
-  struct LANPR_LineLayer *active_layer;
-  ListBase line_layers;
-
   /* Texture painting slots. */
   short paint_active_slot;
   short paint_clone_slot;
@@ -213,7 +197,6 @@ typedef struct Material {
* Cached slots for texture painting, must be refreshed in
* refresh_texpaint_image_cache before using.
*/
-  char _pad4[4];
   struct TexPaintSlot *texpaintslot;
 
   /** Runtime cache for GLSL materials. */
diff --git a/source/blender/makesrna/intern/rna_material.c 
b/source/blender/makesrna/intern/rna_material.c
index 57e5caa8126..6378ee15279 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -32,8 +32,6 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
-#include "BLI_math.h"
-
 const EnumPropertyItem rna_enum_ramp_blend_items[] = {
 {MA_RAMP_BLEND, "MIX", 0, "Mix", ""},
 {0, "", ICON_NONE, NULL, NULL},
@@ -350,68 +348,6 @@ static void rna_GpencilColorData_fill_image_set(PointerRNA 
*ptr,
   pcolor->ima = (struct Image *)id;
 }
 
-/* lanpr */
-
-static bool rna_lanpr_enable_lines_get(PointerRNA *ptr)
-{
-  Material *mat = (Material *)ptr->id.data;
-  return !mat->exclude_line_display;
-}
-static void rna_lanpr_enable_lines_set(PointerRNA *ptr, const bool value)
-{
-  Material *mat = (Material *)ptr->id.data;
-  mat->exclude_line_display = !(value);
-}
-
-void rna_lanpr_material_active_line_layer_index_range(
-PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int 
*UNUSED(softmax))
-{
-  Material *mat = (Material *)ptr->data;
-  *min = 0;
-  *max = max_ii(0, BLI_listbase_count(>line_layers) - 1);
-}
-
-int rna_lanpr_material_active_line_layer_index_get(PointerRNA *ptr)
-{
-  Material *mat = (Material *)ptr->data;
-  LANPR_LineLayer *ls;
-  int i = 0;
-  for (ls = mat->line_layers.first; ls; ls = ls->next) {
-if (ls == 

[Bf-blender-cvs] [f04a173d7b5] temp-lanpr-staging: Diff for adding LANPR only.

2019-08-15 Thread YimingWu
Commit: f04a173d7b5a7f1540ec64906e8314922300cd96
Author: YimingWu
Date:   Sun Aug 11 16:12:04 2019 +0800
Branches: temp-lanpr-staging
https://developer.blender.org/rBf04a173d7b5a7f1540ec64906e8314922300cd96

Diff for adding LANPR only.

===

M   release/datafiles/locale
M   release/scripts/addons
M   release/scripts/addons_contrib
M   release/scripts/startup/bl_operators/__init__.py
M   release/scripts/startup/bl_operators/freestyle.py
A   release/scripts/startup/bl_operators/lanpr.py
M   release/scripts/startup/bl_ui/__init__.py
A   release/scripts/startup/bl_ui/properties_collection.py
M   release/scripts/startup/bl_ui/properties_data_modifier.py
A   release/scripts/startup/bl_ui/properties_lanpr.py
M   release/scripts/startup/bl_ui/properties_material.py
M   release/scripts/startup/bl_ui/properties_render.py
M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/blenkernel/BKE_gpencil.h
M   source/blender/blenkernel/BKE_scene.h
M   source/blender/blenkernel/intern/customdata.c
M   source/blender/blenkernel/intern/data_transfer.c
M   source/blender/blenkernel/intern/gpencil.c
M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenlib/BLI_math_base.h
M   source/blender/blenlib/BLI_math_vector.h
M   source/blender/blenlib/intern/math_base_inline.c
M   source/blender/blenlib/intern/math_vector.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/blenloader/intern/writefile.c
M   source/blender/draw/CMakeLists.txt
A   source/blender/draw/engines/lanpr/lanpr_all.h
A   source/blender/draw/engines/lanpr/lanpr_chain_draw.c
A   source/blender/draw/engines/lanpr/lanpr_cpu.c
A   source/blender/draw/engines/lanpr/lanpr_dpix.c
A   source/blender/draw/engines/lanpr/lanpr_engine.c
A   source/blender/draw/engines/lanpr/lanpr_snake.c
A   source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_frag.glsl
A   source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_geom.glsl
A   
source/blender/draw/engines/lanpr/shaders/lanpr_dpix_project_clip_frag.glsl
A   
source/blender/draw/engines/lanpr/shaders/lanpr_dpix_project_passthrough_vert.glsl
A   source/blender/draw/engines/lanpr/shaders/lanpr_snake_edge_frag.glsl
A   
source/blender/draw/engines/lanpr/shaders/lanpr_snake_image_peel_frag.glsl
A   
source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_frag.glsl
A   
source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_geom.glsl
A   
source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_vert.glsl
A   
source/blender/draw/engines/lanpr/shaders/lanpr_snake_multichannel_frag.glsl
A   source/blender/draw/engines/lanpr/shaders/lanpr_software_chain_geom.glsl
A   
source/blender/draw/engines/lanpr/shaders/lanpr_software_line_chain_geom.glsl
A   
source/blender/draw/engines/lanpr/shaders/lanpr_software_passthrough_vert.glsl
M   source/blender/draw/intern/DRW_render.h
M   source/blender/draw/intern/draw_cache_impl_mesh.c
M   source/blender/draw/intern/draw_common.c
M   source/blender/draw/intern/draw_manager.c
M   source/blender/draw/intern/draw_manager_texture.c
M   source/blender/editors/CMakeLists.txt
A   source/blender/editors/include/ED_lanpr.h
M   source/blender/editors/include/UI_resources.h
M   source/blender/editors/interface/resources.c
A   source/blender/editors/lanpr/CMakeLists.txt
A   source/blender/editors/lanpr/lanpr_chain.c
A   source/blender/editors/lanpr/lanpr_cpu.c
A   source/blender/editors/lanpr/lanpr_ops.c
A   source/blender/editors/lanpr/lanpr_util.c
M   source/blender/editors/mesh/editmesh_path.c
M   source/blender/editors/mesh/editmesh_select_similar.c
M   source/blender/editors/mesh/editmesh_tools.c
M   source/blender/editors/mesh/mesh_intern.h
M   source/blender/editors/mesh/mesh_ops.c
M   source/blender/editors/render/render_update.c
M   source/blender/editors/space_api/spacetypes.c
M   source/blender/editors/space_buttons/buttons_context.c
M   source/blender/editors/space_buttons/space_buttons.c
M   source/blender/editors/space_view3d/space_view3d.c
M   source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
M   source/blender/makesdna/DNA_collection_types.h
M   source/blender/makesdna/DNA_customdata_types.h
M   source/blender/makesdna/DNA_gpencil_types.h
A   source/blender/makesdna/DNA_lanpr_types.h
M   source/blender/makesdna/DNA_material_types.h
M   source/blender/makesdna/DNA_meshdata_types.h
M   source/blender/makesdna/DNA_modifier_types.h
M   source/blender/makesdna/DNA_object_types.h
M   source/blender/makesdna/DNA_scene_types.h
M   

[Bf-blender-cvs] [875beb5f92d] temp-lanpr-staging: Merge remote-tracking branch 'origin/master' into temp-lanpr-staging

2019-08-15 Thread YimingWu
Commit: 875beb5f92d42c66a397b590447a143f10247f86
Author: YimingWu
Date:   Mon Aug 12 09:13:20 2019 +0800
Branches: temp-lanpr-staging
https://developer.blender.org/rB875beb5f92d42c66a397b590447a143f10247f86

Merge remote-tracking branch 'origin/master' into temp-lanpr-staging

===



===



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


[Bf-blender-cvs] [05b54a99efb] temp-lanpr-staging: Cleanup: if brackets.

2019-08-15 Thread YimingWu
Commit: 05b54a99efbcc8b3e97523252e9801d7463502e7
Author: YimingWu
Date:   Sun Aug 11 17:20:16 2019 +0800
Branches: temp-lanpr-staging
https://developer.blender.org/rB05b54a99efbcc8b3e97523252e9801d7463502e7

Cleanup: if brackets.

===

M   source/blender/modifiers/intern/MOD_featureline.c

===

diff --git a/source/blender/modifiers/intern/MOD_featureline.c 
b/source/blender/modifiers/intern/MOD_featureline.c
index a1b0f9141d8..173a22c5f51 100644
--- a/source/blender/modifiers/intern/MOD_featureline.c
+++ b/source/blender/modifiers/intern/MOD_featureline.c
@@ -96,8 +96,9 @@ static void foreachObjectLink(ModifierData *md, Object *ob, 
ObjectWalkFunc walk,
 static bool isDisabled(const struct Scene *scene, struct ModifierData *md, 
bool userRenderParams)
 {
   FeatureLineModifierData *flmd = (FeatureLineModifierData *)md;
-  if (!flmd->target)
+  if (!flmd->target){
 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] [6bd4ea0c2f1] temp-lanpr-staging: Cleanup: New line at EOF.

2019-08-15 Thread YimingWu
Commit: 6bd4ea0c2f1a4ccddec150d123c9b2a5885ffdab
Author: YimingWu
Date:   Sun Aug 11 16:30:43 2019 +0800
Branches: temp-lanpr-staging
https://developer.blender.org/rB6bd4ea0c2f1a4ccddec150d123c9b2a5885ffdab

Cleanup: New line at EOF.

===

M   source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_frag.glsl
M   source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_geom.glsl
M   source/blender/draw/engines/lanpr/shaders/lanpr_snake_edge_frag.glsl
M   
source/blender/draw/engines/lanpr/shaders/lanpr_snake_image_peel_frag.glsl
M   
source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_frag.glsl
M   
source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_vert.glsl
M   
source/blender/draw/engines/lanpr/shaders/lanpr_software_line_chain_geom.glsl
M   source/blender/makesdna/DNA_lanpr_types.h
M   source/blender/makesrna/intern/rna_lanpr.c

===

diff --git 
a/source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_frag.glsl 
b/source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_frag.glsl
index feaaee3e94e..87bcf1698b9 100644
--- a/source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_frag.glsl
+++ b/source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_frag.glsl
@@ -3,4 +3,4 @@ in vec4 out_color;
 void main()
 {
   gl_FragData[0] = vec4(out_color.rgb, 1);
-}
\ No newline at end of file
+}
diff --git 
a/source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_geom.glsl 
b/source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_geom.glsl
index 243324bf3aa..2abdf2a6125 100644
--- a/source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_geom.glsl
+++ b/source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_geom.glsl
@@ -190,4 +190,4 @@ void main()
   }
 
   draw_line(p1, p2, is_crease);
-}
\ No newline at end of file
+}
diff --git 
a/source/blender/draw/engines/lanpr/shaders/lanpr_snake_edge_frag.glsl 
b/source/blender/draw/engines/lanpr/shaders/lanpr_snake_edge_frag.glsl
index 17d8cb4742e..045089c6675 100644
--- a/source/blender/draw/engines/lanpr/shaders/lanpr_snake_edge_frag.glsl
+++ b/source/blender/draw/engines/lanpr/shaders/lanpr_snake_edge_frag.glsl
@@ -85,4 +85,4 @@ void main()
   vec4 diffuse = vec4(1, 1, 1, 1);
   vec4 color = (DetectEdge(tex_sampe_0, dc, ds) + DetectEdge(tex_sample_2, nc, 
ns));
   gl_FragColor = color;
-};
\ No newline at end of file
+};
diff --git 
a/source/blender/draw/engines/lanpr/shaders/lanpr_snake_image_peel_frag.glsl 
b/source/blender/draw/engines/lanpr/shaders/lanpr_snake_image_peel_frag.glsl
index bebb061cf33..c2a83cab0b8 100644
--- a/source/blender/draw/engines/lanpr/shaders/lanpr_snake_image_peel_frag.glsl
+++ b/source/blender/draw/engines/lanpr/shaders/lanpr_snake_image_peel_frag.glsl
@@ -326,4 +326,4 @@ void main()
 
   // if(decisions[test]==1) gl_FragColor=vec4(1,0,0,1);
   // else gl_FragColor=texelFetch(tex_sample_0, sp, 0);//vec4(1,1,1,1);
-}
\ No newline at end of file
+}
diff --git 
a/source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_frag.glsl
 
b/source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_frag.glsl
index ca02ddb8bd3..f27713b4262 100644
--- 
a/source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_frag.glsl
+++ 
b/source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_frag.glsl
@@ -3,4 +3,4 @@ uniform vec4 line_color;
 void main()
 {
   gl_FragColor = line_color;
-}
\ No newline at end of file
+}
diff --git 
a/source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_vert.glsl
 
b/source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_vert.glsl
index 3b0f45f81c3..8e745e20988 100644
--- 
a/source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_vert.glsl
+++ 
b/source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_vert.glsl
@@ -7,4 +7,4 @@ void main()
 {
   gl_Position = vec4(pos, 0.0, 1.0);
   gOffset = uvs;
-};
\ No newline at end of file
+}
diff --git 
a/source/blender/draw/engines/lanpr/shaders/lanpr_software_line_chain_geom.glsl 
b/source/blender/draw/engines/lanpr/shaders/lanpr_software_line_chain_geom.glsl
index 6bbf6147b03..54c38a07db6 100644
--- 
a/source/blender/draw/engines/lanpr/shaders/lanpr_software_line_chain_geom.glsl
+++ 
b/source/blender/draw/engines/lanpr/shaders/lanpr_software_line_chain_geom.glsl
@@ -182,4 +182,4 @@ void main()
   decide_color_and_thickness(gl_in[0].gl_Position.z);
 
   draw_line(p1, p2);
-}
\ No newline at end of file
+}
diff --git a/source/blender/makesdna/DNA_lanpr_types.h 
b/source/blender/makesdna/DNA_lanpr_types.h
index ce27f65b528..953a8edc3c5 100644
--- a/source/blender/makesdna/DNA_lanpr_types.h
+++ b/source/blender/makesdna/DNA_lanpr_types.h
@@ -134,4 +134,4 @@ typedef struct LANPR_LineLayer {
 
 } LANPR_LineLayer;
 
-#endif
\ No newline 

[Bf-blender-cvs] [f5057caca24] temp-lanpr-staging: Fix check that validates a selection index

2019-08-15 Thread mano-wii
Commit: f5057caca24d73f05cd57cd5d73e0fba68a00755
Author: mano-wii
Date:   Thu Aug 15 17:08:38 2019 -0300
Branches: temp-lanpr-staging
https://developer.blender.org/rBf5057caca24d73f05cd57cd5d73e0fba68a00755

Fix check that validates a selection index

===

M   source/blender/draw/intern/draw_select_buffer.c

===

diff --git a/source/blender/draw/intern/draw_select_buffer.c 
b/source/blender/draw/intern/draw_select_buffer.c
index 06bfd7a0d52..974ea22ccea 100644
--- a/source/blender/draw/intern/draw_select_buffer.c
+++ b/source/blender/draw/intern/draw_select_buffer.c
@@ -468,7 +468,7 @@ bool DRW_select_buffer_elem_get(const uint sel_id,
 }
   }
 
-  if (base_index == select_ctx->objects_len) {
+  if (base_index == select_ctx->objects_drawn_len) {
 return false;
   }

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


[Bf-blender-cvs] [f1bc61e1e4a] temp-lanpr-staging: Windows/MSI: Rework MSI installer.

2019-08-15 Thread Lazydodo
Commit: f1bc61e1e4a87ccbf3adc23a0355e96d0f3ab4f7
Author: Lazydodo
Date:   Thu Aug 15 13:43:27 2019 -0600
Branches: temp-lanpr-staging
https://developer.blender.org/rBf1bc61e1e4a87ccbf3adc23a0355e96d0f3ab4f7

Windows/MSI: Rework MSI installer.

The installer always upgraded the last version installed and did not allow for 
two versions to be installed side by side.

The reworked installer will allow side by side installs

install order:
```
2.81 -> 2.81a -> 2.82  : Allowed , will result in both 2.82 and 2.81a being 
installed
2.82 -> 2.81  -> 2.81a : Allowed , will result in both 2.82 and 2.81a being 
installed
2.82 -> 2.81a  : Allowed , will result in both 2.82 and 2.81a being 
installed
2.82 -> 2.81a -> 2.81  : Not Allowed, 2.81 will only install if you manually 
remove 2.81a first.
```

Do note though that this will not apply to any previously issued installers and 
even for 2.80a this is not something we can fix.

This patch is for landing in 2.81 *only* and should be excluded from any 
possible 2.80a release.

Second change is a change to the compression level, building the MSI takes 30 
minutes, which is crazy, perhaps worth it if the compression actually pays of.

```
MSI - none 1:35  247.0 MB (260,025,634 bytes)
MSI - mszip2:02   89.6 MB ( 94,022,946 bytes)
MSI - low  2:35   81.6 MB ( 85,646,626 bytes)
MSI - medium   4:11   77.3 MB ( 81,136,930 bytes)
MSI - high28:01   74.7 MB ( 78,384,418 bytes)

zip1:32   93.2 MB ( 97,732,293 bytes)
7Z 2:22   65.0 MB ( 68,171,614 bytes)
```

It didn't, so I lowered it to medium, seemed reasonable.

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

Reviewers: brecht, jesterking

===

M   build_files/cmake/packaging.cmake

===

diff --git a/build_files/cmake/packaging.cmake 
b/build_files/cmake/packaging.cmake
index 06a97fc9abb..5ace42646c5 100644
--- a/build_files/cmake/packaging.cmake
+++ b/build_files/cmake/packaging.cmake
@@ -80,22 +80,28 @@ if(APPLE)
 endif()
 
 if(WIN32)
-  set(CPACK_PACKAGE_INSTALL_DIRECTORY "Blender Foundation/Blender")
-  set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "Blender Foundation/Blender")
+  set(CPACK_PACKAGE_INSTALL_DIRECTORY "Blender Foundation/Blender 
${MAJOR_VERSION}.${MINOR_VERSION}")
+  set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "Blender Foundation/Blender 
${MAJOR_VERSION}.${MINOR_VERSION}")
 
   set(CPACK_NSIS_MUI_ICON 
${CMAKE_SOURCE_DIR}/release/windows/icons/winblender.ico)
   set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
 
   set(CPACK_RESOURCE_FILE_LICENSE 
${CMAKE_SOURCE_DIR}/release/text/GPL3-license.txt)
   set(CPACK_WIX_PRODUCT_ICON 
${CMAKE_SOURCE_DIR}/release/windows/icons/winblender.ico)
-  set(CPACK_WIX_UPGRADE_GUID "B767E4FD-7DE7-4094-B051-3AE62E13A17A")
+
+  set(BLENDER_NAMESPACE_GUID "507F933F-5898-404A-9A05-18282FD491A6")
+
+  string(UUID CPACK_WIX_UPGRADE_GUID
+NAMESPACE ${BLENDER_NAMESPACE_GUID}
+NAME ${CPACK_PACKAGE_INSTALL_DIRECTORY}
+TYPE SHA1 UPPER
+  )
 
   set(CPACK_WIX_TEMPLATE ${LIBDIR}/package/installer_wix/WIX.template)
   set(CPACK_WIX_UI_BANNER ${LIBDIR}/package/installer_wix/WIX_UI_BANNER.bmp)
   set(CPACK_WIX_UI_DIALOG ${LIBDIR}/package/installer_wix/WIX_UI_DIALOG.bmp)
 
-  #force lzma instead of deflate
-  set(CPACK_WIX_LIGHT_EXTRA_FLAGS -dcl:high)
+  set(CPACK_WIX_LIGHT_EXTRA_FLAGS -dcl:medium)
 endif()
 
 set(CPACK_PACKAGE_EXECUTABLES "blender" "blender")

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


[Bf-blender-cvs] [870bb404a0c] temp-lanpr-staging: Fix T68705: Changing any editor to the properties crashes Blender

2019-08-15 Thread Dalai Felinto
Commit: 870bb404a0c6813470c1f9f8fcaf436b9b970060
Author: Dalai Felinto
Date:   Thu Aug 15 16:38:31 2019 -0300
Branches: temp-lanpr-staging
https://developer.blender.org/rB870bb404a0c6813470c1f9f8fcaf436b9b970060

Fix T68705: Changing any editor to the properties crashes Blender

Issue introduced (more like exposed) in b7f86ff72273.

===

M   source/blender/editors/space_buttons/buttons_context.c

===

diff --git a/source/blender/editors/space_buttons/buttons_context.c 
b/source/blender/editors/space_buttons/buttons_context.c
index 2a28dc56607..2e4c51e8802 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -821,11 +821,11 @@ int buttons_context(const bContext *C, const char 
*member, bContextDataResult *r
   SpaceProperties *sbuts = CTX_wm_space_properties(C);
   ButsContextPath *path = sbuts ? sbuts->path : NULL;
 
-  if (sbuts->mainb == BCONTEXT_TOOL) {
+  if (!path) {
 return 0;
   }
 
-  if (!path) {
+  if (sbuts->mainb == BCONTEXT_TOOL) {
 return 0;
   }

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


[Bf-blender-cvs] [9c03720227c] temp-lanpr-staging: WM: reuse visible region calculation

2019-08-15 Thread Campbell Barton
Commit: 9c03720227cb53cc01c43df1a3ed2273fafdd707
Author: Campbell Barton
Date:   Fri Aug 16 05:41:43 2019 +1000
Branches: temp-lanpr-staging
https://developer.blender.org/rB9c03720227cb53cc01c43df1a3ed2273fafdd707

WM: reuse visible region calculation

Avoids calculating the visible part of a region whenever
on-screen overlays are drawn.

===

M   source/blender/draw/engines/eevee/eevee_lookdev.c
M   source/blender/draw/intern/draw_manager.c
M   source/blender/draw/intern/draw_manager_profiling.c
M   source/blender/draw/intern/draw_manager_profiling.h
M   source/blender/editors/gpencil/annotate_draw.c
M   source/blender/editors/gpencil/annotate_paint.c
M   source/blender/editors/gpencil/drawgpencil.c
M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/editors/include/ED_screen.h
M   source/blender/editors/interface/view2d_gizmo_navigate.c
M   source/blender/editors/screen/area.c
M   source/blender/editors/space_image/image_draw.c
M   source/blender/editors/space_image/space_image.c
M   source/blender/editors/space_sequencer/space_sequencer.c
M   source/blender/editors/space_view3d/view3d_draw.c
M   source/blender/editors/space_view3d/view3d_gizmo_navigate.c
M   source/blender/editors/transform/transform.c
M   source/blender/makesdna/DNA_screen_types.h

===

diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c 
b/source/blender/draw/engines/eevee/eevee_lookdev.c
index e6e699bef10..f52fcf31267 100644
--- a/source/blender/draw/engines/eevee/eevee_lookdev.c
+++ b/source/blender/draw/engines/eevee/eevee_lookdev.c
@@ -75,22 +75,21 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata,
 
   if (LOOK_DEV_OVERLAY_ENABLED(v3d)) {
 /* Viewport / Spheres size. */
-rcti rect;
-ED_region_visible_rect(draw_ctx->ar, );
+const rcti *rect = ED_region_visible_rect(draw_ctx->ar);
 
 /* Make the viewport width scale the lookdev spheres a bit.
  * Scale between 1000px and 2000px. */
 const float viewport_scale = clamp_f(
-BLI_rcti_size_x() / (2000.0f * U.dpi_fac), 0.5f, 1.0f);
+BLI_rcti_size_x(rect) / (2000.0f * U.dpi_fac), 0.5f, 1.0f);
 const int sphere_size = U.lookdev_sphere_size * U.dpi_fac * viewport_scale;
 
-if (sphere_size != effects->sphere_size || rect.xmax != effects->anchor[0] 
||
-rect.ymin != effects->anchor[1]) {
+if (sphere_size != effects->sphere_size || rect->xmax != 
effects->anchor[0] ||
+rect->ymin != effects->anchor[1]) {
   /* If sphere size or anchor point moves, reset TAA to avoid ghosting 
issue.
* This needs to happen early because we are changing 
taa_current_sample. */
   effects->sphere_size = sphere_size;
-  effects->anchor[0] = rect.xmax;
-  effects->anchor[1] = rect.ymin;
+  effects->anchor[0] = rect->xmax;
+  effects->anchor[1] = rect->ymin;
   EEVEE_temporal_sampling_reset(vedata);
 }
   }
diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index 501505c81e6..ebbe3694df8 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1726,9 +1726,9 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph,
 
   if (G.debug_value > 20 && G.debug_value < 30) {
 GPU_depth_test(false);
-rcti rect; /* local coordinate visible rect inside region, to accommodate 
overlapping ui */
-ED_region_visible_rect(DST.draw_ctx.ar, );
-DRW_stats_draw();
+/* local coordinate visible rect inside region, to accommodate overlapping 
ui */
+const rcti *rect = ED_region_visible_rect(DST.draw_ctx.ar);
+DRW_stats_draw(rect);
 GPU_depth_test(true);
   }
 
diff --git a/source/blender/draw/intern/draw_manager_profiling.c 
b/source/blender/draw/intern/draw_manager_profiling.c
index 5e21e5e576c..bab69cf7a57 100644
--- a/source/blender/draw/intern/draw_manager_profiling.c
+++ b/source/blender/draw/intern/draw_manager_profiling.c
@@ -200,7 +200,7 @@ void DRW_stats_reset(void)
   }
 }
 
-static void draw_stat_5row(rcti *rect, int u, int v, const char *txt, const 
int size)
+static void draw_stat_5row(const rcti *rect, int u, int v, const char *txt, 
const int size)
 {
   BLF_draw_default_ascii(rect->xmin + (1 + u * 5) * U.widget_unit,
  rect->ymax - (3 + v) * U.widget_unit,
@@ -209,13 +209,13 @@ static void draw_stat_5row(rcti *rect, int u, int v, 
const char *txt, const int
  size);
 }
 
-static void draw_stat(rcti *rect, int u, int v, const char *txt, const int 
size)
+static void draw_stat(const rcti *rect, int u, int v, const char *txt, const 
int size)
 {
   BLF_draw_default_ascii(
   rect->xmin + (1 + u) * U.widget_unit, rect->ymax - (3 + v) * 
U.widget_unit, 0.0f, txt, size);
 }
 
-void DRW_stats_draw(rcti *rect)

[Bf-blender-cvs] [4905de78eee] temp-lanpr-staging: Cleanup: use boolean

2019-08-15 Thread Campbell Barton
Commit: 4905de78eee437db02bf40108b3f46c205594d50
Author: Campbell Barton
Date:   Fri Aug 16 04:54:10 2019 +1000
Branches: temp-lanpr-staging
https://developer.blender.org/rB4905de78eee437db02bf40108b3f46c205594d50

Cleanup: use boolean

===

M   source/blender/blenkernel/BKE_context.h
M   source/blender/blenkernel/intern/context.c
M   source/blender/blenkernel/intern/image.c
M   source/blender/editors/object/object_vgroup.c
M   source/blender/editors/sculpt_paint/paint_image_undo.c
M   source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
M   source/creator/creator.c

===

diff --git a/source/blender/blenkernel/BKE_context.h 
b/source/blender/blenkernel/BKE_context.h
index 53976b4c1ad..755a155653b 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -137,8 +137,8 @@ void CTX_store_free(bContextStore *store);
 void CTX_store_free_list(ListBase *contexts);
 
 /* need to store if python is initialized or not */
-int CTX_py_init_get(bContext *C);
-void CTX_py_init_set(bContext *C, int value);
+bool CTX_py_init_get(bContext *C);
+void CTX_py_init_set(bContext *C, bool value);
 
 void *CTX_py_dict_get(const bContext *C);
 void CTX_py_dict_set(bContext *C, void *value);
diff --git a/source/blender/blenkernel/intern/context.c 
b/source/blender/blenkernel/intern/context.c
index 2cb98d8d90b..f536f21c3e5 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -89,7 +89,8 @@ struct bContext {
 struct Scene *scene;
 
 int recursion;
-int py_init; /* true if python is initialized */
+/** True if python is initialized. */
+bool py_init;
 void *py_context;
   } data;
 };
@@ -212,11 +213,11 @@ void CTX_store_free_list(ListBase *contexts)
 
 /* is python initialized? */
 
-int CTX_py_init_get(bContext *C)
+bool CTX_py_init_get(bContext *C)
 {
   return C->data.py_init;
 }
-void CTX_py_init_set(bContext *C, int value)
+void CTX_py_init_set(bContext *C, bool value)
 {
   C->data.py_init = value;
 }
diff --git a/source/blender/blenkernel/intern/image.c 
b/source/blender/blenkernel/intern/image.c
index 8e04ef2d3ca..a99407b9bf9 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -2766,8 +2766,8 @@ static void do_makepicstring(char *string,
  int frame,
  const char imtype,
  const ImageFormatData *im_format,
- const short use_ext,
- const short use_frames,
+ const bool use_ext,
+ const bool use_frames,
  const char *suffix)
 {
   if (string == NULL) {
diff --git a/source/blender/editors/object/object_vgroup.c 
b/source/blender/editors/object/object_vgroup.c
index a43ac59c9b8..08fe5e818b2 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -1139,7 +1139,7 @@ static bool vgroup_normalize(Object *ob)
   int i, dvert_tot = 0;
   const int def_nr = ob->actdef - 1;
 
-  const int use_vert_sel = vertex_group_use_vert_sel(ob);
+  const bool use_vert_sel = vertex_group_use_vert_sel(ob);
 
   if (!BLI_findlink(>defbase, def_nr)) {
 return false;
@@ -1623,7 +1623,7 @@ static bool vgroup_normalize_all(Object *ob,
   int i, dvert_tot = 0;
   const int def_nr = ob->actdef - 1;
 
-  const int use_vert_sel = vertex_group_use_vert_sel(ob);
+  const bool use_vert_sel = vertex_group_use_vert_sel(ob);
 
   if (subset_count == 0) {
 BKE_report(reports, RPT_ERROR, "No vertex groups to operate on");
@@ -2047,7 +2047,7 @@ static int vgroup_limit_total_subset(Object *ob,
 {
   MDeformVert *dv, **dvert_array = NULL;
   int i, dvert_tot = 0;
-  const int use_vert_sel = vertex_group_use_vert_sel(ob);
+  const bool use_vert_sel = vertex_group_use_vert_sel(ob);
   int remove_tot = 0;
 
   ED_vgroup_parray_alloc(ob->data, _array, _tot, use_vert_sel);
diff --git a/source/blender/editors/sculpt_paint/paint_image_undo.c 
b/source/blender/editors/sculpt_paint/paint_image_undo.c
index c7ec4f3f2b9..93dcd3ad0f6 100644
--- a/source/blender/editors/sculpt_paint/paint_image_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_image_undo.c
@@ -75,7 +75,8 @@ typedef struct UndoImageTile {
* adds unnecessary overhead restoring undo steps when most tiles share the 
same image. */
   UndoRefID_Image image_ref;
 
-  short source, use_float;
+  short source;
+  bool use_float;
   char gen_type;
   bool valid;
 
@@ -172,7 +173,7 @@ void *image_undo_find_tile(ListBase *undo_tiles,
bool validate)
 {
   UndoImageTile *tile;
-  short use_float = ibuf->rect_float ? 1 : 0;
+  const bool use_float = (ibuf->rect_float != NULL);

[Bf-blender-cvs] [477d470f810] temp-lanpr-staging: Fix broken text editing of integer number buttons, after recent changes

2019-08-15 Thread Brecht Van Lommel
Commit: 477d470f8103d849e2e37cd557f5c72574d9c7af
Author: Brecht Van Lommel
Date:   Thu Aug 15 18:20:33 2019 +0200
Branches: temp-lanpr-staging
https://developer.blender.org/rB477d470f8103d849e2e37cd557f5c72574d9c7af

Fix broken text editing of integer number buttons, after recent changes

===

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

===

diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 8fd39b5d120..0cb0dbdc85c 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4820,6 +4820,9 @@ static int ui_do_but_NUM(
 }
 button_activate_state(C, but, BUTTON_STATE_EXIT);
   }
+  else {
+button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
+  }
 }
 else {
   /* Float Value. */

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


[Bf-blender-cvs] [9b93610f1a1] temp-lanpr-staging: Outliner: only activate outliner items when clicking on icon/text

2019-08-15 Thread Campbell Barton
Commit: 9b93610f1a1ed363b7e4c78020ab1f3afcb181f5
Author: Campbell Barton
Date:   Fri Aug 16 07:02:22 2019 +1000
Branches: temp-lanpr-staging
https://developer.blender.org/rB9b93610f1a1ed363b7e4c78020ab1f3afcb181f5

Outliner: only activate outliner items when clicking on icon/text

This is 2.7x behavior, while there are plans to improve on this,
committing in case larger changes take longer.

Without this it's not easy to select object data without changing modes.

See D5493

===

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

===

diff --git a/source/blender/editors/space_outliner/outliner_select.c 
b/source/blender/editors/space_outliner/outliner_select.c
index c932766ab93..7f45c4d22fa 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -1305,8 +1305,15 @@ static int 
outliner_item_do_activate_from_cursor(bContext *C,
 TreeStoreElem *activate_tselem = TREESTORE(activate_te);
 
 outliner_item_select(soops, activate_te, extend, extend);
-do_outliner_item_activate_tree_element(
-C, scene, view_layer, soops, activate_te, activate_tselem, extend, 
recursive);
+
+/* Only change modes when clicking on the icon/text,
+ * otherwise we can't easily select without changing modes. */
+if ((te->flag & TE_ICONROW) == 0) {
+  if (view_mval[0] >= te->xs && view_mval[0] <= te->xend) {
+do_outliner_item_activate_tree_element(
+C, scene, view_layer, soops, activate_te, activate_tselem, extend, 
recursive);
+  }
+}
 changed = true;
   }

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


[Bf-blender-cvs] [b9fae89a35b] temp-lanpr-staging: Fix T68689 Fix infinite recursion cause by versioning code

2019-08-15 Thread Clément Foucault
Commit: b9fae89a35bf9b92fdae04033f5b19400cb08295
Author: Clément Foucault
Date:   Thu Aug 15 18:46:29 2019 +0200
Branches: temp-lanpr-staging
https://developer.blender.org/rBb9fae89a35bf9b92fdae04033f5b19400cb08295

Fix T68689 Fix infinite recursion cause by versioning code

Complex nodetrees could fire infinite recursion with previous algo.
Now using another gset we make sure we can only evaluate a tree once.

===

M   source/blender/blenloader/intern/versioning_280.c

===

diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index c9832863ab7..f2ff7bbdb60 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -737,7 +737,8 @@ static void 
do_versions_seq_alloc_transform_and_crop(ListBase *seqbase)
 /* Return true if there is something to convert. */
 static bool do_versions_material_convert_legacy_blend_mode(bNodeTree *ntree,
char blend_method,
-   GSet 
*nodegrp_tree_set)
+   GSet 
*nodegrp_tree_set,
+   GSet 
*nooutput_tree_set)
 {
   bool need_update = false;
   bool do_conversion = false;
@@ -758,9 +759,10 @@ static bool 
do_versions_material_convert_legacy_blend_mode(bNodeTree *ntree,
 bNodeTree *group_ntree = (bNodeTree *)fromnode->id;
 if (BLI_gset_add(nodegrp_tree_set, group_ntree)) {
   /* Recursive but not convert (blend_method = -1). Conversion happens 
after. */
-  if (!do_versions_material_convert_legacy_blend_mode(group_ntree, -1, 
nodegrp_tree_set)) {
-/* There is no output to convert in the tree, remove it. */
-BLI_gset_remove(nodegrp_tree_set, group_ntree, NULL);
+  if (!do_versions_material_convert_legacy_blend_mode(
+  group_ntree, -1, nodegrp_tree_set, nooutput_tree_set)) {
+/* There is no output to convert in the tree. */
+BLI_gset_add(nooutput_tree_set, group_ntree);
   }
 }
   }
@@ -768,9 +770,10 @@ static bool 
do_versions_material_convert_legacy_blend_mode(bNodeTree *ntree,
 bNodeTree *group_ntree = (bNodeTree *)tonode->id;
 if (BLI_gset_add(nodegrp_tree_set, group_ntree)) {
   /* Recursive but not convert (blend_method = -1). Conversion happens 
after. */
-  if (!do_versions_material_convert_legacy_blend_mode(group_ntree, -1, 
nodegrp_tree_set)) {
-/* There is no output to convert in the tree, remove it. */
-BLI_gset_remove(nodegrp_tree_set, group_ntree, NULL);
+  if (!do_versions_material_convert_legacy_blend_mode(
+  group_ntree, -1, nodegrp_tree_set, nooutput_tree_set)) {
+/* There is no output to convert in the tree. */
+BLI_gset_add(nooutput_tree_set, group_ntree);
   }
 }
   }
@@ -1259,32 +1262,45 @@ void do_versions_after_linking_280(Main *bmain, 
ReportList *reports)
 GSet *ntrees_additive = BLI_gset_new(BLI_ghashutil_ptrhash, 
BLI_ghashutil_ptrcmp, __func__);
 GSet *ntrees_multiply = BLI_gset_new(BLI_ghashutil_ptrhash, 
BLI_ghashutil_ptrcmp, __func__);
 GSet *ntrees_nolegacy = BLI_gset_new(BLI_ghashutil_ptrhash, 
BLI_ghashutil_ptrcmp, __func__);
+GSet *ntrees_nooutput = BLI_gset_new(BLI_ghashutil_ptrhash, 
BLI_ghashutil_ptrcmp, __func__);
 for (Material *ma = bmain->materials.first; ma; ma = ma->id.next) {
   bNodeTree *ntree = ma->nodetree;
   if (ma->blend_method == 1 /* MA_BM_ADD */) {
 if (ma->use_nodes) {
-  do_versions_material_convert_legacy_blend_mode(ntree, 
ma->blend_method, ntrees_additive);
+  do_versions_material_convert_legacy_blend_mode(
+  ntree, ma->blend_method, ntrees_additive, ntrees_nooutput);
 }
 ma->blend_method = MA_BM_BLEND;
   }
   else if (ma->blend_method == 2 /* MA_BM_MULTIPLY */) {
 if (ma->use_nodes) {
-  do_versions_material_convert_legacy_blend_mode(ntree, 
ma->blend_method, ntrees_multiply);
+  do_versions_material_convert_legacy_blend_mode(
+  ntree, ma->blend_method, ntrees_multiply, ntrees_nooutput);
 }
 ma->blend_method = MA_BM_BLEND;
   }
   else {
 /* Still tag the group nodes as not using legacy blend modes. */
 if (ma->use_nodes) {
-  do_versions_material_convert_legacy_blend_mode(ntree, -1, 
ntrees_nolegacy);
+  do_versions_material_convert_legacy_blend_mode(
+  ntree, -1, ntrees_nolegacy, ntrees_nooutput);
 }
   }
 }
-/* Remove group nodetree that are used by material using non-legacy blend 

[Bf-blender-cvs] [10ac2c1017a] temp-lanpr-staging: Fix T65461: IntProperty does not respect its 'step' field

2019-08-15 Thread Campbell Barton
Commit: 10ac2c1017a9866087912e9b2d23e800a462e7e4
Author: Campbell Barton
Date:   Thu Aug 15 22:50:30 2019 +1000
Branches: temp-lanpr-staging
https://developer.blender.org/rB10ac2c1017a9866087912e9b2d23e800a462e7e4

Fix T65461: IntProperty does not respect its 'step' field

Originally D5020 by @deadpin, refactored to make the change simpler.

===

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

===

diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 9c2eb4204e8..8fd39b5d120 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4807,7 +4807,8 @@ static int ui_do_but_NUM(
   /* Integer Value. */
   if (but->drawflag & (UI_BUT_ACTIVE_LEFT | UI_BUT_ACTIVE_RIGHT)) {
 button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
-const int value_step = 1;
+const int value_step = (int)but->a1;
+BLI_assert(value_step > 0);
 const double value_test = (but->drawflag & UI_BUT_ACTIVE_LEFT) ?
   (double)max_ii((int)softmin, 
(int)data->value - value_step) :
   (double)min_ii((int)softmax, 
(int)data->value + value_step);
@@ -4825,6 +4826,7 @@ static int ui_do_but_NUM(
   if (but->drawflag & (UI_BUT_ACTIVE_LEFT | UI_BUT_ACTIVE_RIGHT)) {
 button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 const double value_step = (double)but->a1 * UI_PRECISION_FLOAT_SCALE;
+BLI_assert(value_step > 0.0f);
 const double value_test = (but->drawflag & UI_BUT_ACTIVE_LEFT) ?
   (double)max_ff(softmin, 
(float)(data->value - value_step)) :
   (double)min_ff(softmax, 
(float)(data->value + value_step));

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


[Bf-blender-cvs] [aa34408b038] temp-lanpr-staging: DRW: New function DRW_culling_min_max_test

2019-08-15 Thread mano-wii
Commit: aa34408b038d0cab2837f10c5e6aa0d123603215
Author: mano-wii
Date:   Thu Aug 15 10:17:41 2019 -0300
Branches: temp-lanpr-staging
https://developer.blender.org/rBaa34408b038d0cab2837f10c5e6aa0d123603215

DRW: New function DRW_culling_min_max_test

For testing intersection with frustrum planes without having to transform all 
bound box vertices into global space.

===

M   source/blender/draw/intern/DRW_render.h
M   source/blender/draw/intern/draw_manager_exec.c

===

diff --git a/source/blender/draw/intern/DRW_render.h 
b/source/blender/draw/intern/DRW_render.h
index 383b57cb74e..8e4ca1cefab 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -608,6 +608,7 @@ bool DRW_view_is_persp_get(const DRWView *view);
 bool DRW_culling_sphere_test(const DRWView *view, const BoundSphere *bsphere);
 bool DRW_culling_box_test(const DRWView *view, const BoundBox *bbox);
 bool DRW_culling_plane_test(const DRWView *view, const float plane[4]);
+bool DRW_culling_min_max_test(const DRWView *view, float obmat[4][4], float 
min[3], float max[3]);
 
 void DRW_culling_frustum_corners_get(const DRWView *view, BoundBox *corners);
 void DRW_culling_frustum_planes_get(const DRWView *view, float planes[6][4]);
diff --git a/source/blender/draw/intern/draw_manager_exec.c 
b/source/blender/draw/intern/draw_manager_exec.c
index 949d3e1d38b..3bf442b4f39 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -22,6 +22,7 @@
 
 #include "draw_manager.h"
 
+#include "BLI_math.h"
 #include "BLI_math_bits.h"
 #include "BLI_memblock.h"
 
@@ -488,6 +489,26 @@ bool DRW_culling_plane_test(const DRWView *view, const 
float plane[4])
   return draw_culling_plane_test(>frustum_corners, plane);
 }
 
+/* Return True if the given box intersect the current view frustum.
+ * This function will have to be replaced when world space bb per objects is 
implemented. */
+bool DRW_culling_min_max_test(const DRWView *view, float obmat[4][4], float 
min[3], float max[3])
+{
+  view = view ? view : DST.view_default;
+  float tobmat[4][4];
+  transpose_m4_m4(tobmat, obmat);
+  for (int i = 6; i--;) {
+float frustum_plane_local[4], bb_near[3], bb_far[3];
+mul_v4_m4v4(frustum_plane_local, tobmat, view->frustum_planes[i]);
+aabb_get_near_far_from_plane(frustum_plane_local, min, max, bb_near, 
bb_far);
+
+if (plane_point_side_v3(frustum_plane_local, bb_far) < 0.0f) {
+  return false;
+}
+  }
+
+  return true;
+}
+
 void DRW_culling_frustum_corners_get(const DRWView *view, BoundBox *corners)
 {
   view = view ? view : DST.view_default;

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


[Bf-blender-cvs] [2bb2e46d2b9] temp-lanpr-staging: Cleanup: Silence C4115 warning

2019-08-15 Thread mano-wii
Commit: 2bb2e46d2b9bf2717fa4e77d086ca486707f2174
Author: mano-wii
Date:   Thu Aug 15 12:34:31 2019 -0300
Branches: temp-lanpr-staging
https://developer.blender.org/rB2bb2e46d2b9bf2717fa4e77d086ca486707f2174

Cleanup: Silence C4115 warning

`'ParticleSystem': named type definition in parentheses`
And prevent the need for struct `Object` to be defined.

===

M   source/blender/draw/intern/draw_cache.h

===

diff --git a/source/blender/draw/intern/draw_cache.h 
b/source/blender/draw/intern/draw_cache.h
index 129b180957a..5dadcdc1457 100644
--- a/source/blender/draw/intern/draw_cache.h
+++ b/source/blender/draw/intern/draw_cache.h
@@ -27,6 +27,7 @@ struct GPUBatch;
 struct GPUMaterial;
 struct ModifierData;
 struct Object;
+struct ParticleSystem;
 struct PTCacheEdit;
 
 void DRW_shape_cache_free(void);
@@ -58,7 +59,7 @@ struct GPUBatch 
**DRW_cache_object_surface_material_get(struct Object *ob,
 char 
**auto_layer_names,
 int 
**auto_layer_is_srgb,
 int *auto_layer_count);
-struct GPUBatch *DRW_cache_object_face_wireframe_get(Object *ob);
+struct GPUBatch *DRW_cache_object_face_wireframe_get(struct Object *ob);
 
 /* Empties */
 struct GPUBatch *DRW_cache_plain_axes_get(void);
@@ -152,7 +153,7 @@ struct GPUBatch **DRW_cache_curve_surface_shaded_get(struct 
Object *ob,
  uint gpumat_array_len);
 struct GPUBatch *DRW_cache_curve_loose_edges_get(struct Object *ob);
 struct GPUBatch *DRW_cache_curve_edge_wire_get(struct Object *ob);
-struct GPUBatch *DRW_cache_curve_face_wireframe_get(Object *ob);
+struct GPUBatch *DRW_cache_curve_face_wireframe_get(struct Object *ob);
 struct GPUBatch *DRW_cache_curve_edge_detection_get(struct Object *ob, bool 
*r_is_manifold);
 /* edit-mode */
 struct GPUBatch *DRW_cache_curve_edge_normal_get(struct Object *ob);
@@ -161,13 +162,13 @@ struct GPUBatch *DRW_cache_curve_vert_overlay_get(struct 
Object *ob, bool handle
 
 /* Font */
 struct GPUBatch *DRW_cache_text_surface_get(struct Object *ob);
-struct GPUBatch *DRW_cache_text_edge_detection_get(Object *ob, bool 
*r_is_manifold);
+struct GPUBatch *DRW_cache_text_edge_detection_get(struct Object *ob, bool 
*r_is_manifold);
 struct GPUBatch *DRW_cache_text_loose_edges_get(struct Object *ob);
 struct GPUBatch *DRW_cache_text_edge_wire_get(struct Object *ob);
 struct GPUBatch **DRW_cache_text_surface_shaded_get(struct Object *ob,
 struct GPUMaterial 
**gpumat_array,
 uint gpumat_array_len);
-struct GPUBatch *DRW_cache_text_face_wireframe_get(Object *ob);
+struct GPUBatch *DRW_cache_text_face_wireframe_get(struct Object *ob);
 
 /* Surface */
 struct GPUBatch *DRW_cache_surf_surface_get(struct Object *ob);
@@ -176,7 +177,7 @@ struct GPUBatch *DRW_cache_surf_loose_edges_get(struct 
Object *ob);
 struct GPUBatch **DRW_cache_surf_surface_shaded_get(struct Object *ob,
 struct GPUMaterial 
**gpumat_array,
 uint gpumat_array_len);
-struct GPUBatch *DRW_cache_surf_face_wireframe_get(Object *ob);
+struct GPUBatch *DRW_cache_surf_face_wireframe_get(struct Object *ob);
 struct GPUBatch *DRW_cache_surf_edge_detection_get(struct Object *ob, bool 
*r_is_manifold);
 
 /* Lattice */
@@ -206,7 +207,7 @@ struct GPUBatch *DRW_cache_mball_surface_get(struct Object 
*ob);
 struct GPUBatch **DRW_cache_mball_surface_shaded_get(struct Object *ob,
  struct GPUMaterial 
**gpumat_array,
  uint gpumat_array_len);
-struct GPUBatch *DRW_cache_mball_face_wireframe_get(Object *ob);
+struct GPUBatch *DRW_cache_mball_face_wireframe_get(struct Object *ob);
 struct GPUBatch *DRW_cache_mball_edge_detection_get(struct Object *ob, bool 
*r_is_manifold);
 
 #endif /* __DRAW_CACHE_H__ */

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


[Bf-blender-cvs] [9ba7255e743] temp-lanpr-staging: Windows: add cycles debug logging to helper batch file.

2019-08-15 Thread Lazydodo
Commit: 9ba7255e743d146044a938f8a4d0fb828f49676a
Author: Lazydodo
Date:   Thu Aug 15 09:42:00 2019 -0600
Branches: temp-lanpr-staging
https://developer.blender.org/rB9ba7255e743d146044a938f8a4d0fb828f49676a

Windows: add cycles debug logging to helper batch file.

===

M   release/windows/batch/blender_debug_log.cmd

===

diff --git a/release/windows/batch/blender_debug_log.cmd 
b/release/windows/batch/blender_debug_log.cmd
index ecb5803a5c9..2d708ea9104 100644
--- a/release/windows/batch/blender_debug_log.cmd
+++ b/release/windows/batch/blender_debug_log.cmd
@@ -12,5 +12,5 @@ mkdir "%temp%\blender\debug_logs" > NUL 2>&1
 echo.
 echo Starting blender and waiting for it to exit
 set PYTHONPATH=
-blender --debug --python-expr "import bpy; 
bpy.ops.wm.sysinfo(filepath=r'%temp%\blender\debug_logs\blender_system_info.txt')"
 > "%temp%\blender\debug_logs\blender_debug_output.txt" 2>&1 < %0
+blender --debug --debug-cycles --python-expr "import bpy; 
bpy.ops.wm.sysinfo(filepath=r'%temp%\blender\debug_logs\blender_system_info.txt')"
 > "%temp%\blender\debug_logs\blender_debug_output.txt" 2>&1 < %0
 explorer "%temp%\blender\debug_logs"

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


[Bf-blender-cvs] [81fe702792c] temp-lanpr-staging: Build: enable OpenImageDenoise, now that we have libraries for all platforms

2019-08-15 Thread Brecht Van Lommel
Commit: 81fe702792c455ebd35d97136dc92b4fbbdc46c3
Author: Brecht Van Lommel
Date:   Thu Aug 15 18:09:58 2019 +0200
Branches: temp-lanpr-staging
https://developer.blender.org/rB81fe702792c455ebd35d97136dc92b4fbbdc46c3

Build: enable OpenImageDenoise, now that we have libraries for all platforms

Note that we are still missing an update for install_deps.sh to easily build 
this
on Linux. Only "make deps" has it for now.

===

M   CMakeLists.txt
M   build_files/cmake/config/blender_full.cmake
M   build_files/cmake/config/blender_release.cmake

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2a7a020c428..16ac322ebdd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -182,6 +182,8 @@ if(UNIX AND NOT APPLE)
   set(_init_SDLOFF)
   set(_init_FFTW3  OFF)
   set(_init_OPENSUBDIV OFF)
+  set(_init_OPENVDBOFF)
+  set(_init_OPENIMAGEDENOISE   OFF)
 elseif(WIN32)
   set(_init_JACK   OFF)
 elseif(APPLE)
@@ -237,12 +239,12 @@ option(WITH_OPENCOLORIO   "Enable OpenColorIO color 
management" ${_init_OPENCOLO
 
 # Compositor
 option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
-option(WITH_OPENIMAGEDENOISE   "Enable the OpenImageDenoise compositing node" 
OFF)
+option(WITH_OPENIMAGEDENOISE   "Enable the OpenImageDenoise compositing node" 
${_init_OPENIMAGEDENOISE})
 
 option(WITH_OPENSUBDIV"Enable OpenSubdiv for surface subdivision" 
${_init_OPENSUBDIV})
 
-option(WITH_OPENVDB   "Enable features relying on OpenVDB" OFF)
-option(WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enable 
if OpenVDB was built with blosc support" OFF)
+option(WITH_OPENVDB   "Enable features relying on OpenVDB" 
${_init_OPENVDB})
+option(WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enable 
if OpenVDB was built with blosc support" ${_init_OPENVDB})
 option(WITH_OPENVDB_3_ABI_COMPATIBLE "Assume OpenVDB library has been compiled 
with version 3 ABI compatibility" OFF)
 mark_as_advanced(WITH_OPENVDB_3_ABI_COMPATIBLE)
 
diff --git a/build_files/cmake/config/blender_full.cmake 
b/build_files/cmake/config/blender_full.cmake
index 38371ccb60e..75c5e0f34c1 100644
--- a/build_files/cmake/config/blender_full.cmake
+++ b/build_files/cmake/config/blender_full.cmake
@@ -40,7 +40,7 @@ set(WITH_AUDASPACE   ON  CACHE BOOL "" FORCE)
 set(WITH_OPENAL  ON  CACHE BOOL "" FORCE)
 set(WITH_OPENCOLLADA ON  CACHE BOOL "" FORCE)
 set(WITH_OPENCOLORIO ON  CACHE BOOL "" FORCE)
-set(WITH_OPENIMAGEDENOISEOFF CACHE BOOL "" FORCE)
+set(WITH_OPENIMAGEDENOISEON  CACHE BOOL "" FORCE)
 set(WITH_OPENMP  ON  CACHE BOOL "" FORCE)
 set(WITH_OPENSUBDIV  ON  CACHE BOOL "" FORCE)
 set(WITH_OPENVDB ON  CACHE BOOL "" FORCE)
diff --git a/build_files/cmake/config/blender_release.cmake 
b/build_files/cmake/config/blender_release.cmake
index 682f456dd3d..08218a5e57c 100644
--- a/build_files/cmake/config/blender_release.cmake
+++ b/build_files/cmake/config/blender_release.cmake
@@ -41,7 +41,7 @@ set(WITH_AUDASPACE   ON  CACHE BOOL "" FORCE)
 set(WITH_OPENAL  ON  CACHE BOOL "" FORCE)
 set(WITH_OPENCOLLADA ON  CACHE BOOL "" FORCE)
 set(WITH_OPENCOLORIO ON  CACHE BOOL "" FORCE)
-set(WITH_OPENIMAGEDENOISEOFF CACHE BOOL "" FORCE)
+set(WITH_OPENIMAGEDENOISEON  CACHE BOOL "" FORCE)
 set(WITH_OPENMP  ON  CACHE BOOL "" FORCE)
 set(WITH_OPENSUBDIV  ON  CACHE BOOL "" FORCE)
 set(WITH_OPENVDB ON  CACHE BOOL "" FORCE)

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


[Bf-blender-cvs] [a43f4f7dc67] temp-lanpr-staging: UI: make int/float button clicking logic consistent

2019-08-15 Thread Campbell Barton
Commit: a43f4f7dc675342668c00f03513a87bb9516b633
Author: Campbell Barton
Date:   Thu Aug 15 22:36:28 2019 +1000
Branches: temp-lanpr-staging
https://developer.blender.org/rBa43f4f7dc675342668c00f03513a87bb9516b633

UI: make int/float button clicking logic consistent

- When no change is performed on a float button, cancel the action.
- Move left/right clicks into the same block.
- Replace ambiguous names: temp, tempf.

===

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

===

diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 6ae7793509d..9c2eb4204e8 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4800,64 +4800,40 @@ static int ui_do_but_NUM(
   if (click) {
 /* we can click on the side arrows to increment/decrement,
  * or click inside to edit the value directly */
-float tempf, softmin, softmax;
-int temp;
-
-softmin = but->softmin;
-softmax = but->softmax;
+const float softmin = but->softmin;
+const float softmax = but->softmax;
 
 if (!ui_but_is_float(but)) {
-  if (but->drawflag & UI_BUT_ACTIVE_LEFT) {
+  /* Integer Value. */
+  if (but->drawflag & (UI_BUT_ACTIVE_LEFT | UI_BUT_ACTIVE_RIGHT)) {
 button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
-
-temp = (int)data->value - 1;
-if (temp >= softmin && temp <= softmax) {
-  data->value = (double)temp;
-}
-else {
-  data->cancel = true;
-}
-
-button_activate_state(C, but, BUTTON_STATE_EXIT);
-  }
-  else if (but->drawflag & UI_BUT_ACTIVE_RIGHT) {
-button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
-
-temp = (int)data->value + 1;
-if (temp >= softmin && temp <= softmax) {
-  data->value = (double)temp;
+const int value_step = 1;
+const double value_test = (but->drawflag & UI_BUT_ACTIVE_LEFT) ?
+  (double)max_ii((int)softmin, 
(int)data->value - value_step) :
+  (double)min_ii((int)softmax, 
(int)data->value + value_step);
+if (value_test != data->value) {
+  data->value = (double)value_test;
 }
 else {
   data->cancel = true;
 }
-
 button_activate_state(C, but, BUTTON_STATE_EXIT);
   }
-  else {
-button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
-  }
 }
 else {
-  if (but->drawflag & UI_BUT_ACTIVE_LEFT) {
+  /* Float Value. */
+  if (but->drawflag & (UI_BUT_ACTIVE_LEFT | UI_BUT_ACTIVE_RIGHT)) {
 button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
-
-tempf = (float)data->value - (UI_PRECISION_FLOAT_SCALE * but->a1);
-if (tempf < softmin) {
-  tempf = softmin;
+const double value_step = (double)but->a1 * UI_PRECISION_FLOAT_SCALE;
+const double value_test = (but->drawflag & UI_BUT_ACTIVE_LEFT) ?
+  (double)max_ff(softmin, 
(float)(data->value - value_step)) :
+  (double)min_ff(softmax, 
(float)(data->value + value_step));
+if (value_test != data->value) {
+  data->value = value_test;
 }
-data->value = tempf;
-
-button_activate_state(C, but, BUTTON_STATE_EXIT);
-  }
-  else if (but->drawflag & UI_BUT_ACTIVE_RIGHT) {
-button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
-
-tempf = (float)data->value + (UI_PRECISION_FLOAT_SCALE * but->a1);
-if (tempf > softmax) {
-  tempf = softmax;
+else {
+  data->cancel = true;
 }
-data->value = tempf;
-
 button_activate_state(C, but, BUTTON_STATE_EXIT);
   }
   else {

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


[Bf-blender-cvs] [3ca8e524086] temp-lanpr-staging: Fix T68684: Vertex snapping with median not working if the object is not at center of the world

2019-08-15 Thread mano-wii
Commit: 3ca8e5240867210ece71410006ec45cbc6bbc25f
Author: mano-wii
Date:   Thu Aug 15 08:29:34 2019 -0300
Branches: temp-lanpr-staging
https://developer.blender.org/rB3ca8e5240867210ece71410006ec45cbc6bbc25f

Fix T68684: Vertex snapping with median not working if the object is not at 
center of the world

===

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

===

diff --git a/source/blender/editors/transform/transform_snap.c 
b/source/blender/editors/transform/transform_snap.c
index d45a0588003..dbcc6c1b04a 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1150,12 +1150,19 @@ static void TargetSnapMedian(TransInfo *t)
 add_v3_v3(v, td->center);
   }
 
+  if (i == 0) {
+/* Is this possible? */
+continue;
+  }
+
+  mul_v3_fl(v, 1.0 / i);
+
   if (tc->use_local_mat) {
 mul_m4_v3(tc->mat, v);
   }
 
   add_v3_v3(t->tsnap.snapTarget, v);
-  i_accum += i;
+  i_accum++;
 }
 
 mul_v3_fl(t->tsnap.snapTarget, 1.0 / i_accum);

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


[Bf-blender-cvs] [f12e7de7c0e] temp-lanpr-staging: Cleanup: Minor change to previous commit

2019-08-15 Thread Antonio Vazquez
Commit: f12e7de7c0e42eb6dc1fa5ed47869ba8d43dd835
Author: Antonio Vazquez
Date:   Thu Aug 15 13:17:28 2019 +0200
Branches: temp-lanpr-staging
https://developer.blender.org/rBf12e7de7c0e42eb6dc1fa5ed47869ba8d43dd835

Cleanup: Minor change to previous commit

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index db216c5eb2d..efe67e1ead0 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -565,7 +565,7 @@ static void gpencil_add_draw_data(void *vedata, Object *ob)
   bGPdata *gpd = (bGPdata *)ob->data;
   const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
   const DRWContextState *draw_ctx = DRW_context_state_get();
-  View3D *v3d = draw_ctx->v3d;
+  const View3D *v3d = draw_ctx->v3d;
 
   int i = stl->g_data->gp_cache_used - 1;
   tGPencilObjectCache *cache_ob = >g_data->gp_object_cache[i];

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


[Bf-blender-cvs] [810ee6dd4ae] temp-lanpr-staging: GPencil: Fix unreported missing VFX in Video Editor

2019-08-15 Thread Antonio Vazquez
Commit: 810ee6dd4aeb55a4ab35b5b5d4a76b01e34adffa
Author: Antonio Vazquez
Date:   Thu Aug 15 13:14:43 2019 +0200
Branches: temp-lanpr-staging
https://developer.blender.org/rB810ee6dd4aeb55a4ab35b5b5d4a76b01e34adffa

GPencil: Fix unreported missing VFX in Video Editor

As the video editor mode is not Render mode the VFX was omitted.

Now, the mode is only checked for View3D.

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 16162645f3d..db216c5eb2d 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -564,6 +564,8 @@ static void gpencil_add_draw_data(void *vedata, Object *ob)
   GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
   bGPdata *gpd = (bGPdata *)ob->data;
   const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
+  const DRWContextState *draw_ctx = DRW_context_state_get();
+  View3D *v3d = draw_ctx->v3d;
 
   int i = stl->g_data->gp_cache_used - 1;
   tGPencilObjectCache *cache_ob = >g_data->gp_object_cache[i];
@@ -580,7 +582,9 @@ static void gpencil_add_draw_data(void *vedata, Object *ob)
 
   /* FX passses */
   cache_ob->has_fx = false;
-  if ((!stl->storage->simplify_fx) && (!ELEM(cache_ob->shading_type[0], 
OB_WIRE, OB_SOLID)) &&
+  if ((!stl->storage->simplify_fx) &&
+  ((!ELEM(cache_ob->shading_type[0], OB_WIRE, OB_SOLID)) ||
+   ((v3d->spacetype != SPACE_VIEW3D))) &&
   (BKE_shaderfx_has_gpencil(ob))) {
 cache_ob->has_fx = true;
 if ((!stl->storage->simplify_fx) && (!is_multiedit)) {

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


[Bf-blender-cvs] [4ba9f580327] temp-lanpr-staging: Fix T56843 : fix case sensitive filenames on win10

2019-08-15 Thread Lazydodo
Commit: 4ba9f5803270a9c2246a38b7bcdddea66d38a529
Author: Lazydodo
Date:   Thu Aug 15 09:27:15 2019 -0600
Branches: temp-lanpr-staging
https://developer.blender.org/rB4ba9f5803270a9c2246a38b7bcdddea66d38a529

Fix T56843 : fix case sensitive filenames on win10

When building with case sensitive folders there were some linker errors.

===

M   build_files/cmake/platform/platform_win32.cmake

===

diff --git a/build_files/cmake/platform/platform_win32.cmake 
b/build_files/cmake/platform/platform_win32.cmake
index 80097e6c84f..42ac285f88d 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -418,7 +418,7 @@ endif()
 
 if(WITH_OPENIMAGEIO)
   windows_find_package(OpenImageIO)
-  set(OPENIMAGEIO ${LIBDIR}/openimageio)
+  set(OPENIMAGEIO ${LIBDIR}/OpenImageIO)
   set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
   set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
   set(OIIO_OPTIMIZED optimized ${OPENIMAGEIO_LIBPATH}/OpenImageIO.lib 
optimized ${OPENIMAGEIO_LIBPATH}/OpenImageIO_Util.lib)
@@ -459,14 +459,14 @@ if(WITH_LLVM)
 endif()
 
 if(WITH_OPENCOLORIO)
-  set(OPENCOLORIO ${LIBDIR}/opencolorio)
+  set(OPENCOLORIO ${LIBDIR}/OpenColorIO)
   set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
-  set(OPENCOLORIO_LIBPATH ${LIBDIR}/opencolorio/lib)
+  set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
   set(OPENCOLORIO_LIBRARIES
 optimized ${OPENCOLORIO_LIBPATH}/OpenColorIO.lib
 optimized ${OPENCOLORIO_LIBPATH}/tinyxml.lib
 optimized ${OPENCOLORIO_LIBPATH}/libyaml-cpp.lib
-debug ${OPENCOLORIO_LIBPATH}/OpenColorIO_d.lib
+debug ${OPENCOLORIO_LIBPATH}/OpencolorIO_d.lib
 debug ${OPENCOLORIO_LIBPATH}/tinyxml_d.lib
 debug ${OPENCOLORIO_LIBPATH}/libyaml-cpp_d.lib
   )
@@ -477,8 +477,8 @@ if(WITH_OPENVDB)
   set(BLOSC_LIBRARIES optimized ${LIBDIR}/blosc/lib/libblosc.lib debug 
${LIBDIR}/blosc/lib/libblosc_d.lib)
   set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug 
${LIBDIR}/tbb/lib/tbb_debug.lib)
   set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include)
-  set(OPENVDB ${LIBDIR}/openvdb)
-  set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
+  set(OPENVDB ${LIBDIR}/openVDB)
+  set(OPENVDB_LIBPATH ${OPENVDB}/lib)
   set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include ${TBB_INCLUDE_DIR})
   set(OPENVDB_LIBRARIES optimized ${OPENVDB_LIBPATH}/openvdb.lib debug 
${OPENVDB_LIBPATH}/openvdb_d.lib ${TBB_LIBRARIES} ${BLOSC_LIBRARIES})
   set(OPENVDB_DEFINITIONS -DNOMINMAX)
@@ -502,7 +502,7 @@ if(WITH_ALEMBIC)
   set(ALEMBIC_INCLUDE_DIR ${ALEMBIC}/include)
   set(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
   set(ALEMBIC_LIBPATH ${ALEMBIC}/lib)
-  set(ALEMBIC_LIBRARIES optimized ${ALEMBIC}/lib/alembic.lib debug 
${ALEMBIC}/lib/alembic_d.lib)
+  set(ALEMBIC_LIBRARIES optimized ${ALEMBIC}/lib/Alembic.lib debug 
${ALEMBIC}/lib/Alembic_d.lib)
   set(ALEMBIC_FOUND 1)
 endif()

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


[Bf-blender-cvs] [98fc7e533cf] temp-lanpr-staging: Edit Mesh Selection: Refactor: Redraw idmap buffer at runtime with only objects inside the rect

2019-08-15 Thread mano-wii
Commit: 98fc7e533cf790f0fe595e36672465670193e456
Author: mano-wii
Date:   Thu Aug 15 10:31:54 2019 -0300
Branches: temp-lanpr-staging
https://developer.blender.org/rB98fc7e533cf790f0fe595e36672465670193e456

Edit Mesh Selection: Refactor: Redraw idmap buffer at runtime with only objects 
inside the rect

But in the future the selection code may also be used in object mode (eg for 
snapping).
So to avoid using too much VRAM resources, it is good to avoid drawing all 
objects in the viewport.

The solution was to create an array with only objects that are detected within 
the selection area.
If the selection operator is modal, objects already detected are not removed 
from the array until view3d is moved or orbited.
To detect the object, its BoundBox is tested.
Since the Select Engine does not have a dedicated depth texture, whenever a new 
object is "found" the depth of the objects in the array already drawn is 
redrawn.

Reviewers: campbellbarton, fclem

Reviewed By: fclem

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

===

M   source/blender/draw/DRW_engine.h
M   source/blender/draw/DRW_select_buffer.h
M   source/blender/draw/engines/select/select_draw_utils.c
M   source/blender/draw/engines/select/select_engine.c
M   source/blender/draw/engines/select/select_private.h
M   source/blender/draw/intern/draw_manager.c
M   source/blender/draw/intern/draw_select_buffer.c
M   source/blender/editors/mesh/editmesh_select.c
M   source/blender/editors/mesh/meshtools.c
M   source/blender/editors/sculpt_paint/paint_utils.c
M   source/blender/editors/space_view3d/view3d_draw_legacy.c
M   source/blender/editors/space_view3d/view3d_select.c

===

diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h
index 53cec599b82..6cae9ceb7d6 100644
--- a/source/blender/draw/DRW_engine.h
+++ b/source/blender/draw/DRW_engine.h
@@ -141,9 +141,7 @@ void DRW_draw_depth_object(struct ARegion *ar,
 void DRW_draw_select_id(struct Depsgraph *depsgraph,
 struct ARegion *ar,
 struct View3D *v3d,
-struct Base **bases,
-const uint bases_len,
-short select_mode);
+const struct rcti *rect);
 
 /* grease pencil render */
 bool DRW_render_check_grease_pencil(struct Depsgraph *depsgraph);
diff --git a/source/blender/draw/DRW_select_buffer.h 
b/source/blender/draw/DRW_select_buffer.h
index ff40508b1a1..4aa1c403710 100644
--- a/source/blender/draw/DRW_select_buffer.h
+++ b/source/blender/draw/DRW_select_buffer.h
@@ -33,6 +33,13 @@ struct View3D;
 struct ViewLayer;
 struct rcti;
 
+typedef struct SELECTID_ObjectData {
+  DrawData dd;
+
+  uint drawn_index;
+  bool is_drawn;
+} SELECTID_ObjectData;
+
 struct ObjectOffsets {
   /* For convenience only. */
   union {
@@ -54,43 +61,75 @@ struct SELECTID_Context {
   struct GPUFrameBuffer *framebuffer_select_id;
   struct GPUTexture *texture_u32;
 
-  struct ObjectOffsets *index_offsets;
+  /* All context objects */
+  struct Object **objects;
   uint objects_len;
-  uint last_object_drawn;
-  /** Total number of items `base_array_index_offsets[bases_len - 1].vert`. */
-  uint last_index_drawn;
+
+  /* Array with only drawn objects. When a new object is found within the rect,
+   * it is added to the end of the list.
+   * The list is reset to any viewport or context update. */
+  struct ObjectOffsets *index_offsets;
+  struct Object **objects_drawn;
+  uint objects_drawn_len;
+
+  /** Total number of element indices `index_offsets[object_drawn_len - 
1].vert`. */
+  uint index_drawn_len;
 
   short select_mode;
+
+  /* To check for updates. */
+  float persmat[4][4];
+  bool is_dirty;
+
+  /* rect is used to check which objects whose indexes need to be drawn. */
+  rcti last_rect;
 };
 
-/* select_buffer.c */
-void DRW_select_buffer_context_create(struct Base **bases,
-  const uint bases_len,
-  short select_mode);
+/* draw_select_buffer.c */
 bool DRW_select_buffer_elem_get(const uint sel_id,
 uint *r_elem,
 uint *r_base_index,
 char *r_elem_type);
-uint DRW_select_buffer_context_offset_for_object_elem(const uint base_index, 
char elem_type);
-uint *DRW_select_buffer_read(const struct rcti *rect, uint *r_buf_len);
-void DRW_draw_select_id_object(struct Depsgraph *depsgraph,
-   struct ViewLayer *view_layer,
-   struct ARegion *ar,
-   struct View3D *v3d,
-   struct Object *ob,
-   short select_mode);
-uint *DRW_select_buffer_bitmap_from_rect(const 

[Bf-blender-cvs] [99474e2c40a] temp-lanpr-staging: Fix full-screen button overlapping navigation gizmo

2019-08-15 Thread Campbell Barton
Commit: 99474e2c40ae5490385bc31831d3331075860064
Author: Campbell Barton
Date:   Thu Aug 15 19:46:29 2019 +1000
Branches: temp-lanpr-staging
https://developer.blender.org/rB99474e2c40ae5490385bc31831d3331075860064

Fix full-screen button overlapping navigation gizmo

===

M   source/blender/editors/screen/area.c
M   source/blender/editors/screen/screen_ops.c

===

diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index 84ac3bfa29d..3cf39b67054 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -188,51 +188,17 @@ void ED_area_do_refresh(bContext *C, ScrArea *sa)
 /**
  * \brief Corner widget use for quitting fullscreen.
  */
-static void area_draw_azone_fullscreen(short x1, short y1, short x2, short y2, 
float alpha)
+static void area_draw_azone_fullscreen(
+short UNUSED(x1), short UNUSED(y1), short x2, short y2, float alpha)
 {
-  int x = x2 - ((float)x2 - x1) * 0.5f / UI_DPI_FAC;
-  int y = y2 - ((float)y2 - y1) * 0.5f / UI_DPI_FAC;
-
-  /* adjust the icon distance from the corner */
-  x += 36.0f / UI_DPI_FAC;
-  y += 36.0f / UI_DPI_FAC;
-
-  /* draws from the left bottom corner of the icon */
-  x -= UI_DPI_ICON_SIZE;
-  y -= UI_DPI_ICON_SIZE;
-
-  alpha = min_ff(alpha, 0.75f);
-
-  UI_icon_draw_ex(x, y, ICON_FULLSCREEN_EXIT, 0.7f * U.inv_dpi_fac, alpha, 
0.0f, NULL, false);
-
-  /* debug drawing :
-   * The click_rect is the same as defined in fullscreen_click_rcti_init
-   * Keep them both in sync */
-
-  if (G.debug_value == 101) {
-rcti click_rect;
-float icon_size = UI_DPI_ICON_SIZE + 7 * UI_DPI_FAC;
-
-BLI_rcti_init(_rect, x, x + icon_size, y, y + icon_size);
-
-GPUVertFormat *format = immVertexFormat();
-uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
-
-immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
-
-immUniformColor4f(1.0f, 0.0f, 0.0f, alpha);
-imm_draw_box_wire_2d(pos, click_rect.xmin, click_rect.ymin, 
click_rect.xmax, click_rect.ymax);
-
-immUniformColor4f(0.0f, 1.0f, 1.0f, alpha);
-immBegin(GPU_PRIM_LINES, 4);
-immVertex2f(pos, click_rect.xmin, click_rect.ymin);
-immVertex2f(pos, click_rect.xmax, click_rect.ymax);
-immVertex2f(pos, click_rect.xmin, click_rect.ymax);
-immVertex2f(pos, click_rect.xmax, click_rect.ymin);
-immEnd();
-
-immUnbindProgram();
-  }
+  UI_icon_draw_ex(x2 - U.widget_unit,
+  y2 - U.widget_unit,
+  ICON_FULLSCREEN_EXIT,
+  U.inv_dpi_fac,
+  min_ff(alpha, 0.75f),
+  0.0f,
+  NULL,
+  false);
 }
 
 /**
@@ -908,10 +874,10 @@ static void fullscreen_azone_initialize(ScrArea *sa, 
ARegion *ar)
   az->ar = ar;
   az->alpha = 0.0f;
 
-  az->x1 = ar->winrct.xmax - (AZONEFADEOUT - 1);
-  az->y1 = ar->winrct.ymax - (AZONEFADEOUT - 1);
   az->x2 = ar->winrct.xmax;
   az->y2 = ar->winrct.ymax;
+  az->x1 = az->x2 - AZONEFADEOUT;
+  az->y1 = az->y2 - AZONEFADEOUT;
   BLI_rcti_init(>rect, az->x1, az->x2, az->y1, az->y2);
 }
 
diff --git a/source/blender/editors/screen/screen_ops.c 
b/source/blender/editors/screen/screen_ops.c
index 4fb5e0c1af3..8377fd0e128 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -696,21 +696,9 @@ static bool actionzone_area_poll(bContext *C)
 
 /* the debug drawing of the click_rect is in area_draw_azone_fullscreen, keep 
both in sync */
 static void fullscreen_click_rcti_init(
-rcti *rect, const short x1, const short y1, const short x2, const short y2)
+rcti *rect, const short UNUSED(x1), const short UNUSED(y1), const short 
x2, const short y2)
 {
-  int x = x2 - ((float)x2 - x1) * 0.5f / UI_DPI_FAC;
-  int y = y2 - ((float)y2 - y1) * 0.5f / UI_DPI_FAC;
-  float icon_size = UI_DPI_ICON_SIZE + 7 * UI_DPI_FAC;
-
-  /* adjust the icon distance from the corner */
-  x += 36.0f / UI_DPI_FAC;
-  y += 36.0f / UI_DPI_FAC;
-
-  /* draws from the left bottom corner of the icon */
-  x -= UI_DPI_ICON_SIZE;
-  y -= UI_DPI_ICON_SIZE;
-
-  BLI_rcti_init(rect, x, x + icon_size, y, y + icon_size);
+  BLI_rcti_init(rect, x2 - U.widget_unit, x2, y2 - U.widget_unit, y2);
 }
 
 static bool azone_clipped_rect_calc(const AZone *az, rcti *r_rect_clip)

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


[Bf-blender-cvs] [6f90b323f0c] temp-lanpr-staging: Cleanup: Remove redundant headers

2019-08-15 Thread mano-wii
Commit: 6f90b323f0c6ff1e1dd650b46ff006cd13914ade
Author: mano-wii
Date:   Thu Aug 15 12:16:43 2019 -0300
Branches: temp-lanpr-staging
https://developer.blender.org/rB6f90b323f0c6ff1e1dd650b46ff006cd13914ade

Cleanup: Remove redundant headers

===

M   source/blender/draw/engines/select/select_engine.c

===

diff --git a/source/blender/draw/engines/select/select_engine.c 
b/source/blender/draw/engines/select/select_engine.c
index f437efe0c41..4c158312e0f 100644
--- a/source/blender/draw/engines/select/select_engine.c
+++ b/source/blender/draw/engines/select/select_engine.c
@@ -24,15 +24,11 @@
 
 #include "DNA_screen_types.h"
 
-#include "GPU_shader.h"
-
 #include "UI_resources.h"
 
 #include "DRW_engine.h"
 #include "DRW_select_buffer.h"
 
-#include "DRW_select_buffer.h"
-
 #include "draw_cache_impl.h"
 #include "draw_manager.h"

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


[Bf-blender-cvs] [d89055b48df] temp-lanpr-staging: Fix CDT bug causing crash with some output modes.

2019-08-15 Thread Howard Trickey
Commit: d89055b48df5c9b23ed94a1f7b67b6aa88f40d67
Author: Howard Trickey
Date:   Thu Aug 15 07:55:29 2019 -0400
Branches: temp-lanpr-staging
https://developer.blender.org/rBd89055b48df5c9b23ed94a1f7b67b6aa88f40d67

Fix CDT bug causing crash with some output modes.

Forgot to properly maintain the edge for faces while
dissolving edges.

===

M   source/blender/blenlib/intern/delaunay_2d.c
M   tests/gtests/blenlib/BLI_delaunay_2d_test.cc

===

diff --git a/source/blender/blenlib/intern/delaunay_2d.c 
b/source/blender/blenlib/intern/delaunay_2d.c
index 8e2687a6b2f..632847046a7 100644
--- a/source/blender/blenlib/intern/delaunay_2d.c
+++ b/source/blender/blenlib/intern/delaunay_2d.c
@@ -1961,13 +1961,17 @@ static void add_face_ids(
   }
 }
 
-/* Delete_edge but try not to mess up outer face. */
+/* Delete_edge but try not to mess up outer face. 
+ * Also faces have symedges now, so make sure not
+ * to mess those up either. */
 static void dissolve_symedge(CDT_state *cdt, SymEdge *se)
 {
-  if (sym(se)->face == cdt->outer_face) {
+  SymEdge *symse = sym(se);
+  if (symse->face == cdt->outer_face) {
 se = sym(se);
+symse = sym(se);
   }
-  if (cdt->outer_face->symedge == se || cdt->outer_face->symedge == sym(se)) {
+  if (cdt->outer_face->symedge == se || cdt->outer_face->symedge == symse) {
 /* Advancing by 2 to get past possible 'sym(se)'. */
 if (se->next->next == se) {
   cdt->outer_face->symedge = NULL;
@@ -1976,6 +1980,14 @@ static void dissolve_symedge(CDT_state *cdt, SymEdge *se)
   cdt->outer_face->symedge = se->next->next;
 }
   }
+  else {
+if (se->face->symedge == se) {
+  se->face->symedge = se->next;
+}
+if (symse->face->symedge == se) {
+  symse->face->symedge = symse->next;
+}
+  }
   delete_edge(cdt, se);
 }
 
diff --git a/tests/gtests/blenlib/BLI_delaunay_2d_test.cc 
b/tests/gtests/blenlib/BLI_delaunay_2d_test.cc
index 220c0a4100d..5b44c6277a3 100644
--- a/tests/gtests/blenlib/BLI_delaunay_2d_test.cc
+++ b/tests/gtests/blenlib/BLI_delaunay_2d_test.cc
@@ -616,6 +616,33 @@ TEST(delaunay, OverlapFaces)
   BLI_delaunay_2d_cdt_free(out);
 }
 
+TEST(delaunay, TwoSquaresOverlap)
+{
+  CDT_input in;
+  CDT_result *out;
+  float p[][2] = {
+  {1.0f, -1.0f},
+  {-1.0f, -1.0f},
+  {-1.0f, 1.0f},
+  {1.0f, 1.0f},
+  {-1.5f, 1.5f},
+  {0.5f, 1.5f},
+  {0.5f, -0.5f},
+  {-1.5f, -0.5f},
+  };
+  int f[] = {/* 0 */ 7, 6, 5, 4, /* 1 */ 3, 2, 1, 0};
+  int fstart[] = {0, 4};
+  int flen[] = {4, 4};
+
+  fill_input_verts(, p, 8);
+  add_input_faces(, f, fstart, flen, 2);
+  out = BLI_delaunay_2d_cdt_calc(, CDT_CONSTRAINTS_VALID_BMESH);
+  EXPECT_EQ(out->verts_len, 10);
+  EXPECT_EQ(out->edges_len, 12);
+  EXPECT_EQ(out->faces_len, 3);
+  BLI_delaunay_2d_cdt_free(out);
+}
+
 enum {
   RANDOM_PTS,
   RANDOM_SEGS,
@@ -623,7 +650,7 @@ enum {
 };
 
 // #define DO_TIMING
-static void rand_delaunay_test(int test_kind, int max_lg_size, int 
reps_per_size)
+static void rand_delaunay_test(int test_kind, int max_lg_size, int 
reps_per_size, CDT_output_type otype)
 {
   CDT_input in;
   CDT_result *out;
@@ -679,7 +706,7 @@ static void rand_delaunay_test(int test_kind, int 
max_lg_size, int reps_per_size
 add_input_edges(, e, size - 1 + (test_kind == RANDOM_POLY));
   }
   tstart = PIL_check_seconds_timer();
-  out = BLI_delaunay_2d_cdt_calc(, CDT_FULL);
+  out = BLI_delaunay_2d_cdt_calc(, otype);
   EXPECT_NE(out->verts_len, 0);
   BLI_delaunay_2d_cdt_free(out);
   times[lg_size] += PIL_check_seconds_timer() - tstart;
@@ -700,17 +727,32 @@ static void rand_delaunay_test(int test_kind, int 
max_lg_size, int reps_per_size
 
 TEST(delaunay, randompts)
 {
-  rand_delaunay_test(RANDOM_PTS, 7, 1);
+  rand_delaunay_test(RANDOM_PTS, 7, 1, CDT_FULL);
 }
 
 TEST(delaunay, randomsegs)
 {
-  rand_delaunay_test(RANDOM_SEGS, 7, 1);
+  rand_delaunay_test(RANDOM_SEGS, 7, 1, CDT_FULL);
 }
 
 TEST(delaunay, randompoly)
 {
-  rand_delaunay_test(RANDOM_POLY, 7, 1);
+  rand_delaunay_test(RANDOM_POLY, 7, 1, CDT_FULL);
+}
+
+TEST(delaunay, randompoly_inside)
+{
+  rand_delaunay_test(RANDOM_POLY, 7, 1, CDT_INSIDE);
+}
+
+TEST(delaunay, randompoly_constraints)
+{
+  rand_delaunay_test(RANDOM_POLY, 7, 1, CDT_CONSTRAINTS);
+}
+
+TEST(delaunay, randompoly_validbmesh)
+{
+  rand_delaunay_test(RANDOM_POLY, 7, 1, CDT_CONSTRAINTS_VALID_BMESH);
 }
 
 #if 0

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


[Bf-blender-cvs] [5d8ff9ad918] temp-lanpr-staging: Fix T64888: full-screen button overlaps side-bar

2019-08-15 Thread Campbell Barton
Commit: 5d8ff9ad91878cdf3f5f0bf969a72477ba5a1e86
Author: Campbell Barton
Date:   Thu Aug 15 20:55:24 2019 +1000
Branches: temp-lanpr-staging
https://developer.blender.org/rB5d8ff9ad91878cdf3f5f0bf969a72477ba5a1e86

Fix T64888: full-screen button overlaps side-bar

===

M   source/blender/editors/screen/area.c

===

diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index 3cf39b67054..d0a3382ee50 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -874,10 +874,19 @@ static void fullscreen_azone_initialize(ScrArea *sa, 
ARegion *ar)
   az->ar = ar;
   az->alpha = 0.0f;
 
-  az->x2 = ar->winrct.xmax;
-  az->y2 = ar->winrct.ymax;
+  if (U.uiflag2 & USER_REGION_OVERLAP) {
+rcti rect_visible;
+ED_region_visible_rect(ar, _visible);
+az->x2 = ar->winrct.xmin + rect_visible.xmax;
+az->y2 = ar->winrct.ymin + rect_visible.ymax;
+  }
+  else {
+az->x2 = ar->winrct.xmax;
+az->y2 = ar->winrct.ymax;
+  }
   az->x1 = az->x2 - AZONEFADEOUT;
   az->y1 = az->y2 - AZONEFADEOUT;
+
   BLI_rcti_init(>rect, az->x1, az->x2, az->y1, az->y2);
 }

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


[Bf-blender-cvs] [f23f80eef83] temp-lanpr-staging: Cleanup: clang-format, unused arg

2019-08-15 Thread Campbell Barton
Commit: f23f80eef8330f0f536935d865a6fd15bdd830ea
Author: Campbell Barton
Date:   Fri Aug 16 01:59:13 2019 +1000
Branches: temp-lanpr-staging
https://developer.blender.org/rBf23f80eef8330f0f536935d865a6fd15bdd830ea

Cleanup: clang-format, unused arg

===

M   source/blender/blenlib/intern/delaunay_2d.c
M   source/blender/editors/space_view3d/view3d_select.c
M   tests/gtests/blenlib/BLI_delaunay_2d_test.cc

===

diff --git a/source/blender/blenlib/intern/delaunay_2d.c 
b/source/blender/blenlib/intern/delaunay_2d.c
index 632847046a7..23f560c5463 100644
--- a/source/blender/blenlib/intern/delaunay_2d.c
+++ b/source/blender/blenlib/intern/delaunay_2d.c
@@ -1961,7 +1961,7 @@ static void add_face_ids(
   }
 }
 
-/* Delete_edge but try not to mess up outer face. 
+/* Delete_edge but try not to mess up outer face.
  * Also faces have symedges now, so make sure not
  * to mess those up either. */
 static void dissolve_symedge(CDT_state *cdt, SymEdge *se)
diff --git a/source/blender/editors/space_view3d/view3d_select.c 
b/source/blender/editors/space_view3d/view3d_select.c
index 9a37c10180d..725f655c8ce 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -200,9 +200,7 @@ struct EditSelectBuf_Cache {
   BLI_bitmap *select_bitmap;
 };
 
-static void editselect_buf_cache_init(struct EditSelectBuf_Cache *esel,
-  ViewContext *vc,
-  short select_mode)
+static void editselect_buf_cache_init(ViewContext *vc, short select_mode)
 {
   if (vc->obedit) {
 uint bases_len = 0;
@@ -240,7 +238,7 @@ static void 
editselect_buf_cache_init_with_generic_userdata(wmGenericUserData *w
   wm_userdata->data = esel;
   wm_userdata->free_fn = editselect_buf_cache_free_voidp;
   wm_userdata->use_free = true;
-  editselect_buf_cache_init(esel, vc, select_mode);
+  editselect_buf_cache_init(vc, select_mode);
 }
 
 /** \} */
diff --git a/tests/gtests/blenlib/BLI_delaunay_2d_test.cc 
b/tests/gtests/blenlib/BLI_delaunay_2d_test.cc
index 5b44c6277a3..ce84baf802a 100644
--- a/tests/gtests/blenlib/BLI_delaunay_2d_test.cc
+++ b/tests/gtests/blenlib/BLI_delaunay_2d_test.cc
@@ -650,7 +650,10 @@ enum {
 };
 
 // #define DO_TIMING
-static void rand_delaunay_test(int test_kind, int max_lg_size, int 
reps_per_size, CDT_output_type otype)
+static void rand_delaunay_test(int test_kind,
+   int max_lg_size,
+   int reps_per_size,
+   CDT_output_type otype)
 {
   CDT_input in;
   CDT_result *out;

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


[Bf-blender-cvs] [d148c79061b] temp-lanpr-staging: UI: Finalize old TODO in UI float number handling.

2019-08-15 Thread Bastien Montagne
Commit: d148c79061bb639848d6c11b14a195f80def592f
Author: Bastien Montagne
Date:   Thu Aug 15 11:07:44 2019 +0200
Branches: temp-lanpr-staging
https://developer.blender.org/rBd148c79061bb639848d6c11b14a195f80def592f

UI: Finalize old TODO in UI float number handling.

Just enable some commented-out code from rB636289b755f6ce (disabled at
that time because we were too close of 2.79 release...).

Issue raised in D5486, thanks.

===

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

===

diff --git a/source/blender/editors/interface/interface.c 
b/source/blender/editors/interface/interface.c
index f9c65249918..7a123599be5 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -2553,8 +2553,8 @@ void ui_but_string_get_ex(uiBut *but,
 }
   }
   else {
+const int int_digits_num = integer_digits_f(value);
 if (use_exp_float) {
-  const int int_digits_num = integer_digits_f(value);
   if (int_digits_num < -6 || int_digits_num > 12) {
 BLI_snprintf(str, maxlen, "%.*g", prec, value);
 if (r_use_exp_float) {
@@ -2568,10 +2568,8 @@ void ui_but_string_get_ex(uiBut *but,
   }
 }
 else {
-#if 0 /* TODO, but will likely break some stuff, so better after 2.79 release. 
*/
   prec -= int_digits_num;
   CLAMP(prec, 0, UI_PRECISION_FLOAT_MAX);
-#endif
   BLI_snprintf(str, maxlen, "%.*f", prec, value);
 }
   }

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


[Bf-blender-cvs] [6d6c75e1a0f] temp-lanpr-staging: Fix T68678: Invisible fullscreen button

2019-08-15 Thread Campbell Barton
Commit: 6d6c75e1a0f377161b8b5b6eba7b9fdfd57c2c6c
Author: Campbell Barton
Date:   Thu Aug 15 18:17:33 2019 +1000
Branches: temp-lanpr-staging
https://developer.blender.org/rB6d6c75e1a0f377161b8b5b6eba7b9fdfd57c2c6c

Fix T68678: Invisible fullscreen button

Regression from 6148ed8cf9ca

===

M   source/blender/editors/screen/area.c

===

diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index 5099c370a85..6f776d3115a 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -203,7 +203,7 @@ static void area_draw_azone_fullscreen(short x1, short y1, 
short x2, short y2, f
 
   alpha = min_ff(alpha, 0.75f);
 
-  UI_icon_draw_ex(x, y, ICON_FULLSCREEN_EXIT, 0.7f * U.inv_dpi_fac, 0.0f, 
alpha, NULL, false);
+  UI_icon_draw_ex(x, y, ICON_FULLSCREEN_EXIT, 0.7f * U.inv_dpi_fac, alpha, 
0.0f, NULL, false);
 
   /* debug drawing :
* The click_rect is the same as defined in fullscreen_click_rcti_init

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


[Bf-blender-cvs] [610de0a6565] temp-lanpr-staging: Fix T68675: particle edit mode makes blender crash

2019-08-15 Thread Philipp Oeser
Commit: 610de0a65652810ae3156fc3582213f197d5f439
Author: Philipp Oeser
Date:   Thu Aug 15 11:39:45 2019 +0200
Branches: temp-lanpr-staging
https://developer.blender.org/rB610de0a65652810ae3156fc3582213f197d5f439

Fix T68675: particle edit mode makes blender crash

In rB9c010c44f420, DRW_mesh_batch_cache_create_requested was changed to
take a scene (instead of toolsettings directly), but
DRW_draw_depth_object is calling this with with NULL, just checking for
this seems to fix...

Reviewers: fclem

Maniphest Tasks: T68675

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

===

M   source/blender/draw/intern/draw_cache_impl_mesh.c

===

diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c 
b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 8c89ac4703c..12c6a715685 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -969,7 +969,10 @@ void DRW_mesh_batch_cache_free_old(Mesh *me, int ctime)
 void DRW_mesh_batch_cache_create_requested(
 Object *ob, Mesh *me, const Scene *scene, const bool is_paint_mode, const 
bool use_hide)
 {
-  const ToolSettings *ts = scene->toolsettings;
+  const ToolSettings *ts = NULL;
+  if (scene) {
+ts = scene->toolsettings;
+  }
   MeshBatchCache *cache = mesh_batch_cache_get(me);
 
   /* Early out */

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


[Bf-blender-cvs] [5667aa410c7] temp-lanpr-staging: Cleanup: unused warnings

2019-08-15 Thread Campbell Barton
Commit: 5667aa410c77120c0e464fd6a2da62ce376db5ad
Author: Campbell Barton
Date:   Thu Aug 15 16:39:57 2019 +1000
Branches: temp-lanpr-staging
https://developer.blender.org/rB5667aa410c77120c0e464fd6a2da62ce376db5ad

Cleanup: unused warnings

Reminder not to leave in unused code, or comment why it should be kept.

===

M   source/blender/editors/sculpt_paint/sculpt.c

===

diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index cdd82b8ced3..4b47c521ca9 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -96,6 +96,9 @@
 
 /* Do not use these functions while working with PBVH_GRIDS data in 
SculptSession */
 
+/* TODO: why is this kept, should it be removed? */
+#if 0 /* UNUSED */
+
 static int sculpt_active_vertex_get(SculptSession *ss)
 {
   switch (BKE_pbvh_type(ss->pbvh)) {
@@ -206,7 +209,7 @@ static void sculpt_vertex_tag_update(SculptSession *ss, int 
index)
   }
 }
 
-#define SCULPT_VERTEX_NEIGHBOUR_FIXED_CAPACITY 256
+#  define SCULPT_VERTEX_NEIGHBOUR_FIXED_CAPACITY 256
 
 typedef struct SculptVertexNeighbourIter {
   int *neighbours;
@@ -309,17 +312,19 @@ static void sculpt_vertex_neighbours_get(SculptSession 
*ss,
   }
 }
 
-#define sculpt_vertex_neighbours_iter_begin(ss, v_index, neighbour_iterator) \
-  sculpt_vertex_neighbours_get(ss, v_index, _iterator); \
-  for (neighbour_iterator.i = 0; neighbour_iterator.i < 
neighbour_iterator.size; \
-   neighbour_iterator.i++) { \
-neighbour_iterator.index = ni.neighbours[ni.i];
+#  define sculpt_vertex_neighbours_iter_begin(ss, v_index, neighbour_iterator) 
\
+sculpt_vertex_neighbours_get(ss, v_index, _iterator); \
+for (neighbour_iterator.i = 0; neighbour_iterator.i < 
neighbour_iterator.size; \
+ neighbour_iterator.i++) { \
+  neighbour_iterator.index = ni.neighbours[ni.i];
 
-#define sculpt_vertex_neighbours_iter_end(neighbour_iterator) \
-  } \
-  if (neighbour_iterator.neighbours != neighbour_iterator.neighbours_fixed) { \
-MEM_freeN(neighbour_iterator.neighbours); \
-  }
+#  define sculpt_vertex_neighbours_iter_end(neighbour_iterator) \
+} \
+if (neighbour_iterator.neighbours != neighbour_iterator.neighbours_fixed) 
{ \
+  MEM_freeN(neighbour_iterator.neighbours); \
+}
+
+#endif /* UNUSED */
 
 /** \name Tool Capabilities
  *

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


[Bf-blender-cvs] [438ebed0c8f] temp-lanpr-staging: Cleanup: spelling

2019-08-15 Thread Campbell Barton
Commit: 438ebed0c8f2be33cc6a4249a1460dd60547e2a9
Author: Campbell Barton
Date:   Thu Aug 15 19:50:52 2019 +1000
Branches: temp-lanpr-staging
https://developer.blender.org/rB438ebed0c8f2be33cc6a4249a1460dd60547e2a9

Cleanup: spelling

Missed in recent commit.

===

M   source/blender/editors/sculpt_paint/sculpt.c

===

diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index e0e25ad0fb8..440c4d42cae 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -209,14 +209,14 @@ static void sculpt_vertex_tag_update(SculptSession *ss, 
int index)
   }
 }
 
-#  define SCULPT_VERTEX_NEIGHBOUR_FIXED_CAPACITY 256
+#  define SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY 256
 
 typedef struct SculptVertexNeighborIter {
   int *neighbors;
   int size;
   int capacity;
 
-  int neighbors_fixed[SCULPT_VERTEX_NEIGHBOUR_FIXED_CAPACITY];
+  int neighbors_fixed[SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY];
 
   int index;
   int i;
@@ -231,7 +231,7 @@ static void 
sculpt_vertex_neighbor_add(SculptVertexNeighborIter *iter, int neigh
   }
 
   if (iter->size >= iter->capacity) {
-iter->capacity += SCULPT_VERTEX_NEIGHBOUR_FIXED_CAPACITY;
+iter->capacity += SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY;
 
 if (iter->neighbors == iter->neighbors_fixed) {
   iter->neighbors = MEM_mallocN(iter->capacity * sizeof(int), "neighbor 
array");
@@ -255,7 +255,7 @@ static void sculpt_vertex_neighbors_get_bmesh(SculptSession 
*ss,
   BMIter liter;
   BMLoop *l;
   iter->size = 0;
-  iter->capacity = SCULPT_VERTEX_NEIGHBOUR_FIXED_CAPACITY;
+  iter->capacity = SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY;
   iter->neighbors = iter->neighbors_fixed;
 
   int i = 0;
@@ -277,7 +277,7 @@ static void sculpt_vertex_neighbors_get_faces(SculptSession 
*ss,
   int i;
   MeshElemMap *vert_map = >pmap[(int)index];
   iter->size = 0;
-  iter->capacity = SCULPT_VERTEX_NEIGHBOUR_FIXED_CAPACITY;
+  iter->capacity = SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY;
   iter->neighbors = iter->neighbors_fixed;
 
   for (i = 0; i < ss->pmap[(int)index].count; i++) {

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


[Bf-blender-cvs] [957ca418e4d] temp-lanpr-staging: UI: skip drawing the full-screen when alpha is zero

2019-08-15 Thread Campbell Barton
Commit: 957ca418e4d798932ae728483a737679526147c2
Author: Campbell Barton
Date:   Thu Aug 15 18:18:22 2019 +1000
Branches: temp-lanpr-staging
https://developer.blender.org/rB957ca418e4d798932ae728483a737679526147c2

UI: skip drawing the full-screen when alpha is zero

===

M   source/blender/editors/screen/area.c

===

diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index 6f776d3115a..84ac3bfa29d 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -368,7 +368,9 @@ static void region_draw_azones(ScrArea *sa, ARegion *ar)
 }
   }
   else if (az->type == AZONE_FULLSCREEN) {
-area_draw_azone_fullscreen(az->x1, az->y1, az->x2, az->y2, az->alpha);
+if (az->alpha > 0.0f) {
+  area_draw_azone_fullscreen(az->x1, az->y1, az->x2, az->y2, 
az->alpha);
+}
   }
 }
 if (!IS_EQF(az->alpha, 0.0f) && ELEM(az->type, AZONE_FULLSCREEN, 
AZONE_REGION_SCROLL)) {

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


[Bf-blender-cvs] [9354a8b130f] temp-lanpr-staging: Cleanup: replace commented out code by comment

2019-08-15 Thread Brecht Van Lommel
Commit: 9354a8b130ff97ffcc3e1fd8134e38fbe75020d1
Author: Brecht Van Lommel
Date:   Thu Aug 15 11:24:19 2019 +0200
Branches: temp-lanpr-staging
https://developer.blender.org/rB9354a8b130ff97ffcc3e1fd8134e38fbe75020d1

Cleanup: replace commented out code by comment

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_edit.c 
b/source/blender/editors/space_view3d/view3d_edit.c
index ec7c1c0b3b9..9a9fe81a13e 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -517,9 +517,6 @@ static void viewops_data_create(bContext *C,
 static void viewops_data_free(bContext *C, wmOperator *op)
 {
   ARegion *ar;
-#if 0
-  Paint *p = BKE_paint_get_active_from_context(C);
-#endif
   if (op->customdata) {
 ViewOpsData *vod = op->customdata;
 ar = vod->ar;
@@ -536,12 +533,9 @@ static void viewops_data_free(bContext *C, wmOperator *op)
 ar = CTX_wm_region(C);
   }
 
-#if 0
-  if (p && (p->flags & PAINT_FAST_NAVIGATE))
-#endif
-  {
-ED_region_tag_redraw(ar);
-  }
+  /* Need to redraw because drawing code uses RV3D_NAVIGATING to draw
+   * faster while navigation operator runs. */
+  ED_region_tag_redraw(ar);
 }
 
 /** \} */

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


[Bf-blender-cvs] [9579cba6ee9] temp-lanpr-staging: Mesh: bypass legacy tessface conversion step when remeshing

2019-08-15 Thread Campbell Barton
Commit: 9579cba6ee979e3ceb9b6b724dcc0f6291bde842
Author: Campbell Barton
Date:   Thu Aug 15 05:13:20 2019 +1000
Branches: temp-lanpr-staging
https://developer.blender.org/rB9579cba6ee979e3ceb9b6b724dcc0f6291bde842

Mesh: bypass legacy tessface conversion step when remeshing

===

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

===

diff --git a/source/blender/blenkernel/intern/mesh_remesh_voxel.c 
b/source/blender/blenkernel/intern/mesh_remesh_voxel.c
index 17347842216..a5136311a22 100644
--- a/source/blender/blenkernel/intern/mesh_remesh_voxel.c
+++ b/source/blender/blenkernel/intern/mesh_remesh_voxel.c
@@ -101,34 +101,38 @@ Mesh 
*BKE_mesh_remesh_voxel_ovdb_volume_to_mesh_nomain(struct OpenVDBLevelSet *l
   level_set, _mesh, isovalue, adaptivity, 
relax_disoriented_triangles);
 #  endif
 
-  Mesh *mesh = BKE_mesh_new_nomain(
-  output_mesh.totvertices, 0, output_mesh.totquads + 
output_mesh.tottriangles, 0, 0);
-  int q = output_mesh.totquads;
+  Mesh *mesh = BKE_mesh_new_nomain(output_mesh.totvertices,
+   0,
+   0,
+   (output_mesh.totquads * 4) + 
(output_mesh.tottriangles * 3),
+   output_mesh.totquads + 
output_mesh.tottriangles);
 
   for (int i = 0; i < output_mesh.totvertices; i++) {
-float vco[3] = {output_mesh.vertices[i * 3],
-output_mesh.vertices[i * 3 + 1],
-output_mesh.vertices[i * 3 + 2]};
-copy_v3_v3(mesh->mvert[i].co, vco);
+copy_v3_v3(mesh->mvert[i].co, _mesh.vertices[i * 3]);
   }
 
-  for (int i = 0; i < output_mesh.totquads; i++) {
-mesh->mface[i].v4 = output_mesh.quads[i * 4];
-mesh->mface[i].v3 = output_mesh.quads[i * 4 + 1];
-mesh->mface[i].v2 = output_mesh.quads[i * 4 + 2];
-mesh->mface[i].v1 = output_mesh.quads[i * 4 + 3];
+  MPoly *mp = mesh->mpoly;
+  MLoop *ml = mesh->mloop;
+  for (int i = 0; i < output_mesh.totquads; i++, mp++, ml += 4) {
+mp->loopstart = (int)(ml - mesh->mloop);
+mp->totloop = 4;
+
+ml[0].v = output_mesh.quads[i * 4 + 3];
+ml[1].v = output_mesh.quads[i * 4 + 2];
+ml[2].v = output_mesh.quads[i * 4 + 1];
+ml[3].v = output_mesh.quads[i * 4];
   }
 
-  for (int i = 0; i < output_mesh.tottriangles; i++) {
-mesh->mface[i + q].v4 = 0;
-mesh->mface[i + q].v3 = output_mesh.triangles[i * 3];
-mesh->mface[i + q].v2 = output_mesh.triangles[i * 3 + 1];
-mesh->mface[i + q].v1 = output_mesh.triangles[i * 3 + 2];
+  for (int i = 0; i < output_mesh.tottriangles; i++, mp++, ml += 3) {
+mp->loopstart = (int)(ml - mesh->mloop);
+mp->totloop = 3;
+
+ml[0].v = output_mesh.triangles[i * 3 + 2];
+ml[1].v = output_mesh.triangles[i * 3 + 1];
+ml[2].v = output_mesh.triangles[i * 3];
   }
 
-  BKE_mesh_calc_edges_tessface(mesh);
-  BKE_mesh_convert_mfaces_to_mpolys(mesh);
-  BKE_mesh_tessface_clear(mesh);
+  BKE_mesh_calc_edges(mesh, false, false);
   BKE_mesh_calc_normals(mesh);
 
   MEM_freeN(output_mesh.quads);

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


[Bf-blender-cvs] [c02e8d0610a] temp-lanpr-staging: Cleanup: spelling

2019-08-15 Thread Campbell Barton
Commit: c02e8d0610a36755cf4a882ab985b6f7fa6e3713
Author: Campbell Barton
Date:   Thu Aug 15 16:48:21 2019 +1000
Branches: temp-lanpr-staging
https://developer.blender.org/rBc02e8d0610a36755cf4a882ab985b6f7fa6e3713

Cleanup: spelling

===

M   source/blender/editors/sculpt_paint/sculpt.c

===

diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index 4b47c521ca9..e0e25ad0fb8 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -211,21 +211,21 @@ static void sculpt_vertex_tag_update(SculptSession *ss, 
int index)
 
 #  define SCULPT_VERTEX_NEIGHBOUR_FIXED_CAPACITY 256
 
-typedef struct SculptVertexNeighbourIter {
-  int *neighbours;
+typedef struct SculptVertexNeighborIter {
+  int *neighbors;
   int size;
   int capacity;
 
-  int neighbours_fixed[SCULPT_VERTEX_NEIGHBOUR_FIXED_CAPACITY];
+  int neighbors_fixed[SCULPT_VERTEX_NEIGHBOUR_FIXED_CAPACITY];
 
   int index;
   int i;
-} SculptVertexNeighbourIter;
+} SculptVertexNeighborIter;
 
-static void sculpt_vertex_neighbour_add(SculptVertexNeighbourIter *iter, int 
neighbour_index)
+static void sculpt_vertex_neighbor_add(SculptVertexNeighborIter *iter, int 
neighbor_index)
 {
   for (int i = 0; i < iter->size; i++) {
-if (iter->neighbours[i] == neighbour_index) {
+if (iter->neighbors[i] == neighbor_index) {
   return;
 }
   }
@@ -233,30 +233,30 @@ static void 
sculpt_vertex_neighbour_add(SculptVertexNeighbourIter *iter, int nei
   if (iter->size >= iter->capacity) {
 iter->capacity += SCULPT_VERTEX_NEIGHBOUR_FIXED_CAPACITY;
 
-if (iter->neighbours == iter->neighbours_fixed) {
-  iter->neighbours = MEM_mallocN(iter->capacity * sizeof(int), "neighbour 
array");
-  memcpy(iter->neighbours, iter->neighbours_fixed, sizeof(int) * 
iter->size);
+if (iter->neighbors == iter->neighbors_fixed) {
+  iter->neighbors = MEM_mallocN(iter->capacity * sizeof(int), "neighbor 
array");
+  memcpy(iter->neighbors, iter->neighbors_fixed, sizeof(int) * iter->size);
 }
 else {
-  iter->neighbours = MEM_reallocN_id(
-  iter->neighbours, iter->capacity * sizeof(int), "neighbour array");
+  iter->neighbors = MEM_reallocN_id(
+  iter->neighbors, iter->capacity * sizeof(int), "neighbor array");
 }
   }
 
-  iter->neighbours[iter->size] = neighbour_index;
+  iter->neighbors[iter->size] = neighbor_index;
   iter->size++;
 }
 
-static void sculpt_vertex_neighbours_get_bmesh(SculptSession *ss,
-   int index,
-   SculptVertexNeighbourIter *iter)
+static void sculpt_vertex_neighbors_get_bmesh(SculptSession *ss,
+  int index,
+  SculptVertexNeighborIter *iter)
 {
   BMVert *v = BM_vert_at_index(ss->bm, index);
   BMIter liter;
   BMLoop *l;
   iter->size = 0;
   iter->capacity = SCULPT_VERTEX_NEIGHBOUR_FIXED_CAPACITY;
-  iter->neighbours = iter->neighbours_fixed;
+  iter->neighbors = iter->neighbors_fixed;
 
   int i = 0;
   BM_ITER_ELEM (l, , v, BM_LOOPS_OF_VERT) {
@@ -264,21 +264,21 @@ static void 
sculpt_vertex_neighbours_get_bmesh(SculptSession *ss,
 for (i = 0; i < ARRAY_SIZE(adj_v); i++) {
   const BMVert *v_other = adj_v[i];
   if (BM_elem_index_get(v_other) != (int)index) {
-sculpt_vertex_neighbour_add(iter, BM_elem_index_get(v_other));
+sculpt_vertex_neighbor_add(iter, BM_elem_index_get(v_other));
   }
 }
   }
 }
 
-static void sculpt_vertex_neighbours_get_faces(SculptSession *ss,
-   int index,
-   SculptVertexNeighbourIter *iter)
+static void sculpt_vertex_neighbors_get_faces(SculptSession *ss,
+  int index,
+  SculptVertexNeighborIter *iter)
 {
   int i;
   MeshElemMap *vert_map = >pmap[(int)index];
   iter->size = 0;
   iter->capacity = SCULPT_VERTEX_NEIGHBOUR_FIXED_CAPACITY;
-  iter->neighbours = iter->neighbours_fixed;
+  iter->neighbors = iter->neighbors_fixed;
 
   for (i = 0; i < ss->pmap[(int)index].count; i++) {
 const MPoly *p = >mpoly[vert_map->indices[i]];
@@ -288,7 +288,7 @@ static void 
sculpt_vertex_neighbours_get_faces(SculptSession *ss,
   for (j = 0; j < ARRAY_SIZE(f_adj_v); j += 1) {
 if (vert_map->count != 2 || ss->pmap[f_adj_v[j]].count <= 2) {
   if (f_adj_v[j] != (int)index) {
-sculpt_vertex_neighbour_add(iter, f_adj_v[j]);
+sculpt_vertex_neighbor_add(iter, f_adj_v[j]);
   }
 }
   }
@@ -296,32 +296,32 @@ static void 
sculpt_vertex_neighbours_get_faces(SculptSession *ss,
   }
 }
 
-static void 

[Bf-blender-cvs] [626b4b533af] temp-lanpr-staging: Fix T68014: Add-on's override Python built-in modules

2019-08-15 Thread Campbell Barton
Commit: 626b4b533afb25e9ed415e4f9caffe17785b7eec
Author: Campbell Barton
Date:   Thu Aug 15 15:53:11 2019 +1000
Branches: temp-lanpr-staging
https://developer.blender.org/rB626b4b533afb25e9ed415e4f9caffe17785b7eec

Fix T68014: Add-on's override Python built-in modules

Append addon paths to the sys.path to avoid name
collisions with system modules.

===

M   release/scripts/modules/addon_utils.py
M   release/scripts/modules/bpy/utils/__init__.py

===

diff --git a/release/scripts/modules/addon_utils.py 
b/release/scripts/modules/addon_utils.py
index 70768a102b3..376193f73a5 100644
--- a/release/scripts/modules/addon_utils.py
+++ b/release/scripts/modules/addon_utils.py
@@ -42,7 +42,7 @@ addons_fake_modules = {}
 def _initialize():
 path_list = paths()
 for path in path_list:
-_bpy.utils._sys_path_ensure(path)
+_bpy.utils._sys_path_ensure_append(path)
 for addon in _preferences.addons:
 enable(addon.module)
 
diff --git a/release/scripts/modules/bpy/utils/__init__.py 
b/release/scripts/modules/bpy/utils/__init__.py
index b39099158c6..04aaa7bd69d 100644
--- a/release/scripts/modules/bpy/utils/__init__.py
+++ b/release/scripts/modules/bpy/utils/__init__.py
@@ -119,11 +119,17 @@ def _test_import(module_name, loaded_modules):
 return mod
 
 
-def _sys_path_ensure(path):
-if path not in _sys.path:  # reloading would add twice
+# Reloading would add twice.
+def _sys_path_ensure_prepend(path):
+if path not in _sys.path:
 _sys.path.insert(0, path)
 
 
+def _sys_path_ensure_append(path):
+if path not in _sys.path:
+_sys.path.append(path)
+
+
 def modules_from_path(path, loaded_modules):
 """
 Load all modules in a path and return them as a list.
@@ -253,7 +259,7 @@ def load_scripts(reload_scripts=False, 
refresh_scripts=False):
 for path_subdir in _script_module_dirs:
 path = _os.path.join(base_path, path_subdir)
 if _os.path.isdir(path):
-_sys_path_ensure(path)
+_sys_path_ensure_prepend(path)
 
 # Only add to 'sys.modules' unless this is 'startup'.
 if path_subdir == "startup":
@@ -385,13 +391,13 @@ def refresh_script_paths():
 for path_subdir in _script_module_dirs:
 path = _os.path.join(base_path, path_subdir)
 if _os.path.isdir(path):
-_sys_path_ensure(path)
+_sys_path_ensure_prepend(path)
 
 for path in _addon_utils.paths():
-_sys_path_ensure(path)
+_sys_path_ensure_append(path)
 path = _os.path.join(path, "modules")
 if _os.path.isdir(path):
-_sys_path_ensure(path)
+_sys_path_ensure_append(path)
 
 
 def app_template_paths(subdir=None):

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


[Bf-blender-cvs] [cf008b012ae] soc-2019-bevel-profiles: Bevel cleanup: Angle kind enum, var rename for readability

2019-08-15 Thread Hans Goudey
Commit: cf008b012ae6537987c7feea6171df722aec8bbd
Author: Hans Goudey
Date:   Thu Aug 15 19:26:06 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rBcf008b012ae6537987c7feea6171df722aec8bbd

Bevel cleanup: Angle kind enum, var rename for readability

===

M   source/blender/bmesh/tools/bmesh_bevel.c

===

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index 428aedcbadc..6beac8dcdb8 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -59,7 +59,7 @@
 #define BEVEL_MAX_AUTO_ADJUST_PCT 300.0f
 #define BEVEL_MATCH_SPEC_WEIGHT 0.2
 
-#define DEBUG_CUSTOM_PROFILE_CUTOFF
+//#define DEBUG_CUSTOM_PROFILE_CUTOFF
 
 #if defined(DEBUG_PROFILE_ORIENTATION_DRAW) || 
defined(DEBUG_CUSTOM_PROFILE_PIPE)
 static float debug_color_red[4] = {1.0f, 0.0f, 0.0f, 1.0f};
@@ -277,6 +277,16 @@ typedef enum {
   F_RECON,
 } FKind;
 
+/** Helper for keeping track of angle kind. */
+enum {
+  /** Angle less than 180 degrees */
+  ANGLE_SMALLER = -1,
+  /** 180 degree angle */
+  ANGLE_STRAIGHT = 0,
+  /** Angle greater than 180 degrees */
+  ANGLE_LARGER = 1,
+};
+
 #if 0
 static const char* fkind_names[] = {"F_NONE", "F_ORIG", "F_VERT", "F_EDGE", 
"F_RECON"}; /* DEBUG */
 #endif
@@ -940,13 +950,13 @@ static int edges_angle_kind(EdgeHalf *e1, EdgeHalf *e2, 
BMVert *v)
   }
   dot = dot_v3v3(cross, no);
   if (fabsf(dot) < BEVEL_EPSILON_BIG) {
-return 0;
+return ANGLE_STRAIGHT;
   }
   else if (dot < 0.0f) {
-return 1;
+return ANGLE_LARGER;
   }
   else {
-return -1;
+return ANGLE_SMALLER;
   }
 }
 
@@ -2599,7 +2609,7 @@ static void build_boundary(BevelParams *bp, BevVert *bv, 
bool construct)
   BoundVert *v, *v1, *v2, *v3;
   VMesh *vm;
   float co[3], r;
-  int nip, nnip, miter_outer, miter_inner;
+  int in_plane, not_in_plane, miter_outer, miter_inner;
   int ang_kind;
 
   /* Current bevel does nothing if only one edge into a vertex */
@@ -2631,7 +2641,7 @@ static void build_boundary(BevelParams *bp, BevVert *bv, 
bool construct)
   /* keep track of the first beveled edge of an outside miter (there can be at 
most 1 per bv */
   emiter = NULL;
 
-  /* Here: there is more than one beveled edge.
+  /* There is more than one beveled edge.
* We make BoundVerts to connect the sides of the beveled edges.
* Non-beveled edges in between will just join to the appropriate juncture 
point. */
   e = efirst;
@@ -2641,26 +2651,26 @@ static void build_boundary(BevelParams *bp, BevVert 
*bv, bool construct)
 /* Make the BoundVert for the right side of e; other side will be made
  * when the beveled edge to the left of e is handled.
  * Analyze edges until next beveled edge.
- * They are either "in plane" (preceding and subsequent faces are coplanar)
- * or not. The "non-in-plane" edges effect silhouette and we prefer to 
slide
- * along one of those if possible. */
-nip = nnip = 0;/* counts of in-plane / not-in-plane */
+ * They are either "in plane" (preceding and subsequent faces are 
coplanar) or not.
+ * The "non-in-plane" edges affect the silhouette and we prefer to slide 
along one of those if
+ * possible. */
+in_plane = not_in_plane = 0; /* Counts of in-plane / not-in-plane */
 enip = eip = NULL; /* representatives of each */
 for (e2 = e->next; !e2->is_bev; e2 = e2->next) {
   if (eh_on_plane(e2)) {
-nip++;
+in_plane++;
 eip = e2;
   }
   else {
-nnip++;
+not_in_plane++;
 enip = e2;
   }
 }
-if (nip == 0 && nnip == 0) {
+if (in_plane == 0 && not_in_plane == 0) {
   offset_meet(e, e2, bv->v, e->fnext, false, co);
 }
-else if (nnip > 0) {
-  if (bp->loop_slide && nnip == 1 && good_offset_on_edge_between(e, e2, 
enip, bv->v)) {
+else if (not_in_plane > 0) {
+  if (bp->loop_slide && not_in_plane == 1 && 
good_offset_on_edge_between(e, e2, enip, bv->v)) {
 if (offset_on_edge_between(e, e2, enip, bv->v, co, )) {
   eon = enip;
 }
@@ -2670,8 +2680,8 @@ static void build_boundary(BevelParams *bp, BevVert *bv, 
bool construct)
   }
 }
 else {
-  /* nip > 0 and nnip == 0 */
-  if (bp->loop_slide && nip == 1 && good_offset_on_edge_between(e, e2, 
eip, bv->v)) {
+  /* n_in_plane > 0 and n_not_in_plane == 0 */
+  if (bp->loop_slide && in_plane == 1 && good_offset_on_edge_between(e, 
e2, eip, bv->v)) {
 if (offset_on_edge_between(e, e2, eip, bv->v, co, )) {
   eon = eip;
 }
@@ -2701,16 +2711,15 @@ static void build_boundary(BevelParams *bp, BevVert 
*bv, bool construct)
* There can only be one outer reflex angle, so only one outer miter,
* and emiter will be set to the first edge of such an edge.
* A miter kind of 

[Bf-blender-cvs] [2afbf00600c] soc-2019-bevel-profiles: Profile widget sampling bug fix, cleanup in file

2019-08-15 Thread Hans Goudey
Commit: 2afbf00600c89ef7332111c89216b88e5e7a7c25
Author: Hans Goudey
Date:   Thu Aug 15 19:25:10 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rB2afbf00600c89ef7332111c89216b88e5e7a7c25

Profile widget sampling bug fix, cleanup in file

- Extra samples are now correctly assigned to most curved edges.
- The first and last control points use their neighbor's handle type.
- Final cleanup and commenting of profile_widget.c

===

M   source/blender/blenkernel/intern/profile_widget.c
M   source/blender/editors/interface/interface_templates.c

===

diff --git a/source/blender/blenkernel/intern/profile_widget.c 
b/source/blender/blenkernel/intern/profile_widget.c
index cfe0dec94a8..1077f9efe82 100644
--- a/source/blender/blenkernel/intern/profile_widget.c
+++ b/source/blender/blenkernel/intern/profile_widget.c
@@ -41,40 +41,10 @@
 #include "BKE_curve.h"
 #include "BKE_fcurve.h"
 
-#define DEBUG_PRWDGT 0
-#define DEBUG_PRWDGT_TABLE 0
-#define DEBUG_PRWDGT_EVALUATE 0
-#define DEBUG_PRWDGT_REVERSE 0
-
-void BKE_profilewidget_set_defaults(ProfileWidget *prwdgt)
-{
-#if DEBUG_PRWDGT
-  printf("PROFILEWIDGET SET DEFAULTS\n");
-#endif
-  prwdgt->flag = PROF_USE_CLIP;
-
-  BLI_rctf_init(>view_rect, 0.0f, 1.0f, 0.0f, 1.0f);
-  prwdgt->clip_rect = prwdgt->view_rect;
-
-  prwdgt->totpoint = 2;
-  prwdgt->path = MEM_callocN(2 * sizeof(ProfilePoint), "path points");
-
-  prwdgt->path[0].x = 1.0f;
-  prwdgt->path[0].y = 0.0f;
-  prwdgt->path[1].x = 1.0f;
-  prwdgt->path[1].y = 1.0f;
-
-  prwdgt->changed_timestamp = 0;
-}
+#define DEBUG_PRWDGT_EVALUATE
 
 void BKE_profilewidget_free_data(ProfileWidget *prwdgt)
 {
-#if DEBUG_PRWDGT
-  printf("PROFILEWIDGET FREE DATA\n");
-  if (!prwdgt->path) {
-printf("The prwdgt had no path... probably a second redundant free 
call\n");
-  }
-#endif
   if (prwdgt->path) {
 MEM_freeN(prwdgt->path);
 prwdgt->path = NULL;
@@ -91,9 +61,6 @@ void BKE_profilewidget_free_data(ProfileWidget *prwdgt)
 
 void BKE_profilewidget_free(ProfileWidget *prwdgt)
 {
-#if DEBUG_PRWDGT
-  printf("PROFILEWIDGET FREE\n");
-#endif
   if (prwdgt) {
 BKE_profilewidget_free_data(prwdgt);
 MEM_freeN(prwdgt);
@@ -102,9 +69,6 @@ void BKE_profilewidget_free(ProfileWidget *prwdgt)
 
 void BKE_profilewidget_copy_data(ProfileWidget *target, const ProfileWidget 
*prwdgt)
 {
-#if DEBUG_PRWDGT
-  printf("PROFILEWIDGET COPY DATA\n");
-#endif
   *target = *prwdgt;
 
   if (prwdgt->path) {
@@ -120,10 +84,6 @@ void BKE_profilewidget_copy_data(ProfileWidget *target, 
const ProfileWidget *prw
 
 ProfileWidget *BKE_profilewidget_copy(const ProfileWidget *prwdgt)
 {
-#if DEBUG_PRWDGT
-  printf("PROFILEWIDGET COPY\n");
-#endif
-
   if (prwdgt) {
 ProfileWidget *new_prdgt = MEM_dupallocN(prwdgt);
 BKE_profilewidget_copy_data(new_prdgt, prwdgt);
@@ -132,56 +92,49 @@ ProfileWidget *BKE_profilewidget_copy(const ProfileWidget 
*prwdgt)
   return NULL;
 }
 
-/** Removes a specific point from the path of control points
- * \note: Requiress profilewidget_changed call after */
+/** Removes a specific point from the path of control points.
+ * \note: Requiress profilewidget_changed call after. */
 bool BKE_profilewidget_remove_point(ProfileWidget *prwdgt, ProfilePoint *point)
 {
   ProfilePoint *pts;
-  int a, b, removed = 0;
-
-#if DEBUG_PRWDGT
-  printf("PROFILEPATH REMOVE POINT\n");
-#endif
+  int i_old, i_new, n_removed = 0;
 
-  /* must have 2 points minimum */
+  /* Must have 2 points minimum. */
   if (prwdgt->totpoint <= 2) {
 return false;
   }
 
   pts = MEM_mallocN((size_t)prwdgt->totpoint * sizeof(ProfilePoint), "path 
points");
 
-  /* Keep the two outer points */
-  for (a = 0, b = 0; a < prwdgt->totpoint; a++) {
-if (>path[a] != point) {
-  pts[b] = prwdgt->path[a];
-  b++;
+  /* Build the new list without the point when it's found. Keep the first and 
last points. */
+  for (i_old = 1, i_new = 0; i_old < prwdgt->totpoint - 1; i_old++) {
+if (>path[i_old] != point) {
+  pts[i_new] = prwdgt->path[i_old];
+  i_new++;
 }
 else {
-  removed++;
+  n_removed++;
 }
   }
 
   MEM_freeN(prwdgt->path);
   prwdgt->path = pts;
-  prwdgt->totpoint -= removed;
-  return (removed != 0);
+  prwdgt->totpoint -= n_removed;
+  return (n_removed != 0);
 }
 
 /** Removes every point in the widget with the supplied flag set, except for 
the first and last.
- * \param flag: ProfilePoint->flag
- * \note: Requiress profilewidget_changed call after */
+ * \param flag: ProfilePoint->flag.
+ * \note: Requiress profilewidget_changed call after. */
 void BKE_profilewidget_remove(ProfileWidget *prwdgt, const short flag)
 {
-#if DEBUG_PRWDGT
-  printf("PROFILEPATH REMOVE\n");
-#endif
   int i_old, i_new, n_removed = 0;
 
-  /* Copy every point without the flag into the new path */
+  /* Copy every point without the flag into the 

[Bf-blender-cvs] [d6d51674a2f] sculpt-mode-features: Sculpt: Pose brush

2019-08-15 Thread Pablo Dobarro
Commit: d6d51674a2fee3a1110d241b96d31480ce440cf1
Author: Pablo Dobarro
Date:   Fri Aug 16 00:12:43 2019 +0200
Branches: sculpt-mode-features
https://developer.blender.org/rBd6d51674a2fee3a1110d241b96d31480ce440cf1

Sculpt: Pose brush

This commit also includes the MOUSE_INBETWEEN events fix for other
brushes.

===

M   source/blender/blenkernel/intern/brush.c
M   source/blender/editors/sculpt_paint/paint_stroke.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h
M   source/blender/makesdna/DNA_brush_types.h
M   source/blender/makesrna/intern/rna_brush.c

===

diff --git a/source/blender/blenkernel/intern/brush.c 
b/source/blender/blenkernel/intern/brush.c
index 56ebfe72162..262f47655f6 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -895,6 +895,7 @@ void BKE_brush_sculpt_reset(Brush *br)
   br->add_col[2] = 0.75;
   break;
 case SCULPT_TOOL_GRAB:
+case SCULPT_TOOL_POSE:
 case SCULPT_TOOL_SNAKE_HOOK:
 case SCULPT_TOOL_THUMB:
   br->size = 75;
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c 
b/source/blender/editors/sculpt_paint/paint_stroke.c
index 5f3075b12f5..7df06d99509 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -219,6 +219,7 @@ static bool paint_tool_require_location(Brush *brush, 
ePaintMode mode)
 case PAINT_MODE_SCULPT:
   if (ELEM(brush->sculpt_tool,
SCULPT_TOOL_GRAB,
+   SCULPT_TOOL_POSE,
SCULPT_TOOL_ROTATE,
SCULPT_TOOL_SNAKE_HOOK,
SCULPT_TOOL_THUMB)) {
@@ -234,6 +235,27 @@ static bool paint_tool_require_location(Brush *brush, 
ePaintMode mode)
   return true;
 }
 
+static bool paint_tool_require_inbetween_mouse_events(Brush *brush, ePaintMode 
mode)
+{
+  switch (mode) {
+case PAINT_MODE_SCULPT:
+  if (ELEM(brush->sculpt_tool,
+   SCULPT_TOOL_GRAB,
+   SCULPT_TOOL_ROTATE,
+   SCULPT_TOOL_THUMB,
+   SCULPT_TOOL_POSE)) {
+return false;
+  }
+  else {
+return true;
+  }
+default:
+  break;
+  }
+
+  return true;
+}
+
 /* Initialize the stroke cache variants from operator properties */
 static bool paint_brush_update(bContext *C,
Brush *brush,
@@ -872,6 +894,7 @@ static bool sculpt_is_grab_tool(Brush *br)
 {
   return ELEM(br->sculpt_tool,
   SCULPT_TOOL_GRAB,
+  SCULPT_TOOL_POSE,
   SCULPT_TOOL_THUMB,
   SCULPT_TOOL_ROTATE,
   SCULPT_TOOL_SNAKE_HOOK);
@@ -1206,6 +1229,10 @@ int paint_stroke_modal(bContext *C, wmOperator *op, 
const wmEvent *event)
   bool redraw = false;
   float pressure;
 
+  if (event->type == INBETWEEN_MOUSEMOVE && 
!paint_tool_require_inbetween_mouse_events(br, mode)) {
+return OPERATOR_RUNNING_MODAL;
+  }
+
   /* see if tablet affects event. Line, anchored and drag dot strokes do not 
support pressure */
   pressure = ((br->flag & (BRUSH_LINE | BRUSH_ANCHORED | BRUSH_DRAG_DOT)) ?
   1.0f :
diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index 6803f01a26c..701ccb799d0 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -426,8 +426,12 @@ static bool sculpt_has_active_modifiers(Scene *scene, 
Object *ob)
 
 static bool sculpt_tool_needs_original(const char sculpt_tool)
 {
-  return ELEM(
-  sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE, SCULPT_TOOL_THUMB, 
SCULPT_TOOL_LAYER);
+  return ELEM(sculpt_tool,
+  SCULPT_TOOL_GRAB,
+  SCULPT_TOOL_ROTATE,
+  SCULPT_TOOL_THUMB,
+  SCULPT_TOOL_LAYER,
+  SCULPT_TOOL_POSE);
 }
 
 static bool sculpt_tool_is_proxy_used(const char sculpt_tool)
@@ -1528,6 +1532,9 @@ static float brush_strength(const Sculpt *sd,
 case SCULPT_TOOL_GRAB:
   return root_alpha * feather;
 
+case SCULPT_TOOL_POSE:
+  return root_alpha * feather;
+
 case SCULPT_TOOL_ROTATE:
   return alpha * pressure * feather;
 
@@ -3420,6 +3427,94 @@ static void do_pinch_brush(Sculpt *sd, Object *ob, 
PBVHNode **nodes, int totnode
   BLI_task_parallel_range(0, totnode, , do_pinch_brush_task_cb_ex, 
);
 }
 
+static bool check_vertex_pivot_symmetry(float vco[3], float pco[3], char symm);
+static void do_pose_brush_task_cb_ex(void *__restrict userdata,
+ const int n,
+ const ParallelRangeTLS *__restrict tls)
+{
+  SculptThreadedTaskData *data = userdata;
+  SculptSession *ss = data->ob->sculpt;
+
+  PBVHVertexIter vd;
+  float disp[3], val[3];

[Bf-blender-cvs] [2c41ffa3808] soc-2019-openxr: Fix compiling with external OpenXR SDK on Windows

2019-08-15 Thread Julian Eisel
Commit: 2c41ffa38088dc4c65ef1f69d01a8ad97eb12dee
Author: Julian Eisel
Date:   Thu Aug 15 21:48:45 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rB2c41ffa38088dc4c65ef1f69d01a8ad97eb12dee

Fix compiling with external OpenXR SDK on Windows

===

M   intern/ghost/CMakeLists.txt

===

diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index 602e921bc16..6a328a3fb76 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -362,6 +362,12 @@ if(WITH_OPENXR)
 intern/GHOST_IXrGraphicsBinding.h
 intern/GHOST_XrSession.h
   )
+  list(APPEND INC_SYS
+${OPENXR_SDK_INCLUDE_DIR}
+  )
+  list(APPEND LIB
+shlwapi
+  )
 
   include(xr_platform_defines)

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


[Bf-blender-cvs] [9dab57a9f82] master: Outliner: only activate outliner items when clicking on icon/text

2019-08-15 Thread Campbell Barton
Commit: 9dab57a9f829881dad1e659b53413ded15ec085e
Author: Campbell Barton
Date:   Fri Aug 16 07:02:22 2019 +1000
Branches: master
https://developer.blender.org/rB9dab57a9f829881dad1e659b53413ded15ec085e

Outliner: only activate outliner items when clicking on icon/text

This is 2.7x behavior, while there are plans to improve on this,
committing in case larger changes take longer.

Without this it's not easy to select object data without changing modes.

See D5493

===

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

===

diff --git a/source/blender/editors/space_outliner/outliner_select.c 
b/source/blender/editors/space_outliner/outliner_select.c
index c932766ab93..7f45c4d22fa 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -1305,8 +1305,15 @@ static int 
outliner_item_do_activate_from_cursor(bContext *C,
 TreeStoreElem *activate_tselem = TREESTORE(activate_te);
 
 outliner_item_select(soops, activate_te, extend, extend);
-do_outliner_item_activate_tree_element(
-C, scene, view_layer, soops, activate_te, activate_tselem, extend, 
recursive);
+
+/* Only change modes when clicking on the icon/text,
+ * otherwise we can't easily select without changing modes. */
+if ((te->flag & TE_ICONROW) == 0) {
+  if (view_mval[0] >= te->xs && view_mval[0] <= te->xend) {
+do_outliner_item_activate_tree_element(
+C, scene, view_layer, soops, activate_te, activate_tselem, extend, 
recursive);
+  }
+}
 changed = true;
   }

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


[Bf-blender-cvs] [8f565f5a6ff] master: WM: reuse visible region calculation

2019-08-15 Thread Campbell Barton
Commit: 8f565f5a6ffa4f6170caca2de50a733e8c72367a
Author: Campbell Barton
Date:   Fri Aug 16 05:41:43 2019 +1000
Branches: master
https://developer.blender.org/rB8f565f5a6ffa4f6170caca2de50a733e8c72367a

WM: reuse visible region calculation

Avoids calculating the visible part of a region whenever
on-screen overlays are drawn.

===

M   source/blender/draw/engines/eevee/eevee_lookdev.c
M   source/blender/draw/intern/draw_manager.c
M   source/blender/draw/intern/draw_manager_profiling.c
M   source/blender/draw/intern/draw_manager_profiling.h
M   source/blender/editors/gpencil/annotate_draw.c
M   source/blender/editors/gpencil/annotate_paint.c
M   source/blender/editors/gpencil/drawgpencil.c
M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/editors/include/ED_screen.h
M   source/blender/editors/interface/view2d_gizmo_navigate.c
M   source/blender/editors/screen/area.c
M   source/blender/editors/space_image/image_draw.c
M   source/blender/editors/space_image/space_image.c
M   source/blender/editors/space_sequencer/space_sequencer.c
M   source/blender/editors/space_view3d/view3d_draw.c
M   source/blender/editors/space_view3d/view3d_gizmo_navigate.c
M   source/blender/editors/transform/transform.c
M   source/blender/makesdna/DNA_screen_types.h

===

diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c 
b/source/blender/draw/engines/eevee/eevee_lookdev.c
index e6e699bef10..f52fcf31267 100644
--- a/source/blender/draw/engines/eevee/eevee_lookdev.c
+++ b/source/blender/draw/engines/eevee/eevee_lookdev.c
@@ -75,22 +75,21 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata,
 
   if (LOOK_DEV_OVERLAY_ENABLED(v3d)) {
 /* Viewport / Spheres size. */
-rcti rect;
-ED_region_visible_rect(draw_ctx->ar, );
+const rcti *rect = ED_region_visible_rect(draw_ctx->ar);
 
 /* Make the viewport width scale the lookdev spheres a bit.
  * Scale between 1000px and 2000px. */
 const float viewport_scale = clamp_f(
-BLI_rcti_size_x() / (2000.0f * U.dpi_fac), 0.5f, 1.0f);
+BLI_rcti_size_x(rect) / (2000.0f * U.dpi_fac), 0.5f, 1.0f);
 const int sphere_size = U.lookdev_sphere_size * U.dpi_fac * viewport_scale;
 
-if (sphere_size != effects->sphere_size || rect.xmax != effects->anchor[0] 
||
-rect.ymin != effects->anchor[1]) {
+if (sphere_size != effects->sphere_size || rect->xmax != 
effects->anchor[0] ||
+rect->ymin != effects->anchor[1]) {
   /* If sphere size or anchor point moves, reset TAA to avoid ghosting 
issue.
* This needs to happen early because we are changing 
taa_current_sample. */
   effects->sphere_size = sphere_size;
-  effects->anchor[0] = rect.xmax;
-  effects->anchor[1] = rect.ymin;
+  effects->anchor[0] = rect->xmax;
+  effects->anchor[1] = rect->ymin;
   EEVEE_temporal_sampling_reset(vedata);
 }
   }
diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index 1046e0422c1..a2bbb368caa 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1725,9 +1725,9 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph,
 
   if (G.debug_value > 20 && G.debug_value < 30) {
 GPU_depth_test(false);
-rcti rect; /* local coordinate visible rect inside region, to accommodate 
overlapping ui */
-ED_region_visible_rect(DST.draw_ctx.ar, );
-DRW_stats_draw();
+/* local coordinate visible rect inside region, to accommodate overlapping 
ui */
+const rcti *rect = ED_region_visible_rect(DST.draw_ctx.ar);
+DRW_stats_draw(rect);
 GPU_depth_test(true);
   }
 
diff --git a/source/blender/draw/intern/draw_manager_profiling.c 
b/source/blender/draw/intern/draw_manager_profiling.c
index 5e21e5e576c..bab69cf7a57 100644
--- a/source/blender/draw/intern/draw_manager_profiling.c
+++ b/source/blender/draw/intern/draw_manager_profiling.c
@@ -200,7 +200,7 @@ void DRW_stats_reset(void)
   }
 }
 
-static void draw_stat_5row(rcti *rect, int u, int v, const char *txt, const 
int size)
+static void draw_stat_5row(const rcti *rect, int u, int v, const char *txt, 
const int size)
 {
   BLF_draw_default_ascii(rect->xmin + (1 + u * 5) * U.widget_unit,
  rect->ymax - (3 + v) * U.widget_unit,
@@ -209,13 +209,13 @@ static void draw_stat_5row(rcti *rect, int u, int v, 
const char *txt, const int
  size);
 }
 
-static void draw_stat(rcti *rect, int u, int v, const char *txt, const int 
size)
+static void draw_stat(const rcti *rect, int u, int v, const char *txt, const 
int size)
 {
   BLF_draw_default_ascii(
   rect->xmin + (1 + u) * U.widget_unit, rect->ymax - (3 + v) * 
U.widget_unit, 0.0f, txt, size);
 }
 
-void DRW_stats_draw(rcti *rect)
+void 

[Bf-blender-cvs] [266e7b67fd3] master: Cleanup: use boolean

2019-08-15 Thread Campbell Barton
Commit: 266e7b67fd3e2c219d8646e37a2fb3e393df4bda
Author: Campbell Barton
Date:   Fri Aug 16 04:54:10 2019 +1000
Branches: master
https://developer.blender.org/rB266e7b67fd3e2c219d8646e37a2fb3e393df4bda

Cleanup: use boolean

===

M   source/blender/blenkernel/BKE_context.h
M   source/blender/blenkernel/intern/context.c
M   source/blender/blenkernel/intern/image.c
M   source/blender/editors/object/object_vgroup.c
M   source/blender/editors/sculpt_paint/paint_image_undo.c
M   source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
M   source/creator/creator.c

===

diff --git a/source/blender/blenkernel/BKE_context.h 
b/source/blender/blenkernel/BKE_context.h
index 53976b4c1ad..755a155653b 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -137,8 +137,8 @@ void CTX_store_free(bContextStore *store);
 void CTX_store_free_list(ListBase *contexts);
 
 /* need to store if python is initialized or not */
-int CTX_py_init_get(bContext *C);
-void CTX_py_init_set(bContext *C, int value);
+bool CTX_py_init_get(bContext *C);
+void CTX_py_init_set(bContext *C, bool value);
 
 void *CTX_py_dict_get(const bContext *C);
 void CTX_py_dict_set(bContext *C, void *value);
diff --git a/source/blender/blenkernel/intern/context.c 
b/source/blender/blenkernel/intern/context.c
index 2cb98d8d90b..f536f21c3e5 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -89,7 +89,8 @@ struct bContext {
 struct Scene *scene;
 
 int recursion;
-int py_init; /* true if python is initialized */
+/** True if python is initialized. */
+bool py_init;
 void *py_context;
   } data;
 };
@@ -212,11 +213,11 @@ void CTX_store_free_list(ListBase *contexts)
 
 /* is python initialized? */
 
-int CTX_py_init_get(bContext *C)
+bool CTX_py_init_get(bContext *C)
 {
   return C->data.py_init;
 }
-void CTX_py_init_set(bContext *C, int value)
+void CTX_py_init_set(bContext *C, bool value)
 {
   C->data.py_init = value;
 }
diff --git a/source/blender/blenkernel/intern/image.c 
b/source/blender/blenkernel/intern/image.c
index 8e04ef2d3ca..a99407b9bf9 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -2766,8 +2766,8 @@ static void do_makepicstring(char *string,
  int frame,
  const char imtype,
  const ImageFormatData *im_format,
- const short use_ext,
- const short use_frames,
+ const bool use_ext,
+ const bool use_frames,
  const char *suffix)
 {
   if (string == NULL) {
diff --git a/source/blender/editors/object/object_vgroup.c 
b/source/blender/editors/object/object_vgroup.c
index a43ac59c9b8..08fe5e818b2 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -1139,7 +1139,7 @@ static bool vgroup_normalize(Object *ob)
   int i, dvert_tot = 0;
   const int def_nr = ob->actdef - 1;
 
-  const int use_vert_sel = vertex_group_use_vert_sel(ob);
+  const bool use_vert_sel = vertex_group_use_vert_sel(ob);
 
   if (!BLI_findlink(>defbase, def_nr)) {
 return false;
@@ -1623,7 +1623,7 @@ static bool vgroup_normalize_all(Object *ob,
   int i, dvert_tot = 0;
   const int def_nr = ob->actdef - 1;
 
-  const int use_vert_sel = vertex_group_use_vert_sel(ob);
+  const bool use_vert_sel = vertex_group_use_vert_sel(ob);
 
   if (subset_count == 0) {
 BKE_report(reports, RPT_ERROR, "No vertex groups to operate on");
@@ -2047,7 +2047,7 @@ static int vgroup_limit_total_subset(Object *ob,
 {
   MDeformVert *dv, **dvert_array = NULL;
   int i, dvert_tot = 0;
-  const int use_vert_sel = vertex_group_use_vert_sel(ob);
+  const bool use_vert_sel = vertex_group_use_vert_sel(ob);
   int remove_tot = 0;
 
   ED_vgroup_parray_alloc(ob->data, _array, _tot, use_vert_sel);
diff --git a/source/blender/editors/sculpt_paint/paint_image_undo.c 
b/source/blender/editors/sculpt_paint/paint_image_undo.c
index c7ec4f3f2b9..93dcd3ad0f6 100644
--- a/source/blender/editors/sculpt_paint/paint_image_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_image_undo.c
@@ -75,7 +75,8 @@ typedef struct UndoImageTile {
* adds unnecessary overhead restoring undo steps when most tiles share the 
same image. */
   UndoRefID_Image image_ref;
 
-  short source, use_float;
+  short source;
+  bool use_float;
   char gen_type;
   bool valid;
 
@@ -172,7 +173,7 @@ void *image_undo_find_tile(ListBase *undo_tiles,
bool validate)
 {
   UndoImageTile *tile;
-  short use_float = ibuf->rect_float ? 1 : 0;
+  const bool use_float = (ibuf->rect_float != NULL);
 
   for 

[Bf-blender-cvs] [0f79c346c63] master: Fix check that validates a selection index

2019-08-15 Thread mano-wii
Commit: 0f79c346c63f21f246ab636d74eea9b7aa874a33
Author: mano-wii
Date:   Thu Aug 15 17:08:38 2019 -0300
Branches: master
https://developer.blender.org/rB0f79c346c63f21f246ab636d74eea9b7aa874a33

Fix check that validates a selection index

===

M   source/blender/draw/intern/draw_select_buffer.c

===

diff --git a/source/blender/draw/intern/draw_select_buffer.c 
b/source/blender/draw/intern/draw_select_buffer.c
index 06bfd7a0d52..974ea22ccea 100644
--- a/source/blender/draw/intern/draw_select_buffer.c
+++ b/source/blender/draw/intern/draw_select_buffer.c
@@ -468,7 +468,7 @@ bool DRW_select_buffer_elem_get(const uint sel_id,
 }
   }
 
-  if (base_index == select_ctx->objects_len) {
+  if (base_index == select_ctx->objects_drawn_len) {
 return false;
   }

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


[Bf-blender-cvs] [50ad4428ac7] master: Windows/MSI: Rework MSI installer.

2019-08-15 Thread Lazydodo
Commit: 50ad4428ac76705dc28e4cd85272a47118b6a654
Author: Lazydodo
Date:   Thu Aug 15 13:43:27 2019 -0600
Branches: master
https://developer.blender.org/rB50ad4428ac76705dc28e4cd85272a47118b6a654

Windows/MSI: Rework MSI installer.

The installer always upgraded the last version installed and did not allow for 
two versions to be installed side by side.

The reworked installer will allow side by side installs

install order:
```
2.81 -> 2.81a -> 2.82  : Allowed , will result in both 2.82 and 2.81a being 
installed
2.82 -> 2.81  -> 2.81a : Allowed , will result in both 2.82 and 2.81a being 
installed
2.82 -> 2.81a  : Allowed , will result in both 2.82 and 2.81a being 
installed
2.82 -> 2.81a -> 2.81  : Not Allowed, 2.81 will only install if you manually 
remove 2.81a first.
```

Do note though that this will not apply to any previously issued installers and 
even for 2.80a this is not something we can fix.

This patch is for landing in 2.81 *only* and should be excluded from any 
possible 2.80a release.

Second change is a change to the compression level, building the MSI takes 30 
minutes, which is crazy, perhaps worth it if the compression actually pays of.

```
MSI - none 1:35  247.0 MB (260,025,634 bytes)
MSI - mszip2:02   89.6 MB ( 94,022,946 bytes)
MSI - low  2:35   81.6 MB ( 85,646,626 bytes)
MSI - medium   4:11   77.3 MB ( 81,136,930 bytes)
MSI - high28:01   74.7 MB ( 78,384,418 bytes)

zip1:32   93.2 MB ( 97,732,293 bytes)
7Z 2:22   65.0 MB ( 68,171,614 bytes)
```

It didn't, so I lowered it to medium, seemed reasonable.

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

Reviewers: brecht, jesterking

===

M   build_files/cmake/packaging.cmake

===

diff --git a/build_files/cmake/packaging.cmake 
b/build_files/cmake/packaging.cmake
index 06a97fc9abb..5ace42646c5 100644
--- a/build_files/cmake/packaging.cmake
+++ b/build_files/cmake/packaging.cmake
@@ -80,22 +80,28 @@ if(APPLE)
 endif()
 
 if(WIN32)
-  set(CPACK_PACKAGE_INSTALL_DIRECTORY "Blender Foundation/Blender")
-  set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "Blender Foundation/Blender")
+  set(CPACK_PACKAGE_INSTALL_DIRECTORY "Blender Foundation/Blender 
${MAJOR_VERSION}.${MINOR_VERSION}")
+  set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "Blender Foundation/Blender 
${MAJOR_VERSION}.${MINOR_VERSION}")
 
   set(CPACK_NSIS_MUI_ICON 
${CMAKE_SOURCE_DIR}/release/windows/icons/winblender.ico)
   set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
 
   set(CPACK_RESOURCE_FILE_LICENSE 
${CMAKE_SOURCE_DIR}/release/text/GPL3-license.txt)
   set(CPACK_WIX_PRODUCT_ICON 
${CMAKE_SOURCE_DIR}/release/windows/icons/winblender.ico)
-  set(CPACK_WIX_UPGRADE_GUID "B767E4FD-7DE7-4094-B051-3AE62E13A17A")
+
+  set(BLENDER_NAMESPACE_GUID "507F933F-5898-404A-9A05-18282FD491A6")
+
+  string(UUID CPACK_WIX_UPGRADE_GUID
+NAMESPACE ${BLENDER_NAMESPACE_GUID}
+NAME ${CPACK_PACKAGE_INSTALL_DIRECTORY}
+TYPE SHA1 UPPER
+  )
 
   set(CPACK_WIX_TEMPLATE ${LIBDIR}/package/installer_wix/WIX.template)
   set(CPACK_WIX_UI_BANNER ${LIBDIR}/package/installer_wix/WIX_UI_BANNER.bmp)
   set(CPACK_WIX_UI_DIALOG ${LIBDIR}/package/installer_wix/WIX_UI_DIALOG.bmp)
 
-  #force lzma instead of deflate
-  set(CPACK_WIX_LIGHT_EXTRA_FLAGS -dcl:high)
+  set(CPACK_WIX_LIGHT_EXTRA_FLAGS -dcl:medium)
 endif()
 
 set(CPACK_PACKAGE_EXECUTABLES "blender" "blender")

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


[Bf-blender-cvs] [cbd1739004f] master: Fix T68705: Changing any editor to the properties crashes Blender

2019-08-15 Thread Dalai Felinto
Commit: cbd1739004f854f4970f95ea3ed512f2aecf2fe7
Author: Dalai Felinto
Date:   Thu Aug 15 16:38:31 2019 -0300
Branches: master
https://developer.blender.org/rBcbd1739004f854f4970f95ea3ed512f2aecf2fe7

Fix T68705: Changing any editor to the properties crashes Blender

Issue introduced (more like exposed) in b7f86ff72273.

===

M   source/blender/editors/space_buttons/buttons_context.c

===

diff --git a/source/blender/editors/space_buttons/buttons_context.c 
b/source/blender/editors/space_buttons/buttons_context.c
index fde8b8f85f8..bb381e0dd1e 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -785,11 +785,11 @@ int buttons_context(const bContext *C, const char 
*member, bContextDataResult *r
   SpaceProperties *sbuts = CTX_wm_space_properties(C);
   ButsContextPath *path = sbuts ? sbuts->path : NULL;
 
-  if (sbuts->mainb == BCONTEXT_TOOL) {
+  if (!path) {
 return 0;
   }
 
-  if (!path) {
+  if (sbuts->mainb == BCONTEXT_TOOL) {
 return 0;
   }

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


[Bf-blender-cvs] [b47c3b41829] newboolean: Merge from master.

2019-08-15 Thread Howard Trickey
Commit: b47c3b41829a4e5921b3509c9efc771b25c01ea4
Author: Howard Trickey
Date:   Thu Aug 15 08:30:17 2019 -0400
Branches: newboolean
https://developer.blender.org/rBb47c3b41829a4e5921b3509c9efc771b25c01ea4

Merge from master.

commit e4084f8b24197ede2546da90459cb1b5ad0fd9a8
Author: Howard Trickey 
Date:   Thu Aug 15 07:55:29 2019 -0400

Fix CDT bug causing crash with some output modes.

Forgot to properly maintain the edge for faces while
dissolving edges.

commit 48a6997e2a0657d8b238101b84b688b37bc88875
Author: Campbell Barton 
Date:   Thu Aug 15 20:55:24 2019 +1000

Fix T64888: full-screen button overlaps side-bar

commit 95a0144293b840bfbdcb6a41c1a3a26976961b9b
Author: mano-wii 
Date:   Thu Aug 15 08:29:34 2019 -0300

Fix T68684: Vertex snapping with median not working if the object is not at 
center of the world

commit 9e54e6bdc57911be2911a7537ab9f67d87e31df0
Author: Antonio Vazquez 
Date:   Thu Aug 15 13:17:28 2019 +0200

Cleanup: Minor change to previous commit

commit 143a44caeb4dc00f27b66b55d35a868127b5e4a9
Author: Antonio Vazquez 
Date:   Thu Aug 15 13:14:43 2019 +0200

GPencil: Fix unreported missing VFX in Video Editor

As the video editor mode is not Render mode the VFX was omitted.

Now, the mode is only checked for View3D.

commit ff1ea600c98ba542c3b950fcfaf350626e078899
Author: Philipp Oeser 
Date:   Thu Aug 15 11:39:45 2019 +0200

Fix T68675: particle edit mode makes blender crash

In rB9c010c44f420, DRW_mesh_batch_cache_create_requested was changed to
take a scene (instead of toolsettings directly), but
DRW_draw_depth_object is calling this with with NULL, just checking for
this seems to fix...

Reviewers: fclem

Maniphest Tasks: T68675

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

commit eac2a7ab0ecd7fe90cd58213ca96004a1e6a6d33
Author: Campbell Barton 
Date:   Thu Aug 15 19:46:29 2019 +1000

Fix full-screen button overlapping navigation gizmo

commit e6fa174fd7744a88c1ea9a986fdb9b7e908c9047
Author: Campbell Barton 
Date:   Thu Aug 15 18:18:22 2019 +1000

UI: skip drawing the full-screen when alpha is zero

commit a2a9c95845559b0bfffaf4b6b5e32e31ed3da7a1
Author: Campbell Barton 
Date:   Thu Aug 15 18:17:33 2019 +1000

Fix T68678: Invisible fullscreen button

Regression from 6148ed8cf9ca

commit c7598cd1a517fd6d0eb9c903d6727dcd1449d1a2
Author: Campbell Barton 
Date:   Thu Aug 15 19:50:52 2019 +1000

Cleanup: spelling

Missed in recent commit.

commit 5b04829d43996267f2dec8ef5a1418e71647b3c5
Author: Brecht Van Lommel 
Date:   Thu Aug 15 11:24:19 2019 +0200

Cleanup: replace commented out code by comment

commit 32395dd4e2f6c18de1678b69bbba6ac38eec674e
Author: Bastien Montagne 
Date:   Thu Aug 15 11:07:44 2019 +0200

UI: Finalize old TODO in UI float number handling.

Just enable some commented-out code from rB636289b755f6ce (disabled at
that time because we were too close of 2.79 release...).

Issue raised in D5486, thanks.

commit 63b3cc17021d92ac59ac4edc6142e2d434f23f21
Author: Campbell Barton 
Date:   Thu Aug 15 16:48:21 2019 +1000

Cleanup: spelling

commit 1ddc12ceb922241d485ac9a1842c4c6f3d4ab300
Author: Campbell Barton 
Date:   Thu Aug 15 16:39:57 2019 +1000

Cleanup: unused warnings

Reminder not to leave in unused code, or comment why it should be kept.

commit bb2394a29889157a330bd1064d248c04055b117c
Author: Campbell Barton 
Date:   Thu Aug 15 15:53:11 2019 +1000

Fix T68014: Add-on's override Python built-in modules

Append addon paths to the sys.path to avoid name
collisions with system modules.

commit 7c258a8ad1b04a91d24b015fed6c5eae020bf8cc
Author: Campbell Barton 
Date:   Thu Aug 15 05:13:20 2019 +1000

Mesh: bypass legacy tessface conversion step when remeshing

commit f4d548d384e20ef377b2573a6c54a2434c3f9134
Author: Lazydodo 
Date:   Wed Aug 14 17:57:01 2019 -0600

msvc: Enable /bigobj on all object files.

bf_intern_openvdb makes a significant number of template instantiations
causing it go over the maximum number of sections (int16) in a coff file
when doing a debug build.

This change switches the compiler to use the extended coff format which
has this field extended (int32) all linkers post msvc2005 can process
this format so there's no reason not to turn this on globally.

Clang on windows does not need this change since clang switches implicitly
to the extended format when required. [1]

[1] https://reviews.llvm.org/rL217812

commit cb7ead2e3b62b9f1df85c985801db7918204dd2a
Author: Dalai Felinto 
Date:   Wed Aug 14 15:08:25 2019 -0300

Fix T68658: Text offset makes scale to fit not to work

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

commit 5ff8fcfa7241e2b15c6ac110538f40e277db3f37
Author: Clément Foucault 
Date:   Wed Aug 14 23:43:33 2019 +0200

Eevee: Fix tangent map node not using the right UVMap

commit 6fcd071c7bcb8c9a5e0a7d0e7a6ef6363e43627e

[Bf-blender-cvs] [b365fe24611] newboolean: A coplanar intersect case works.

2019-08-15 Thread Howard Trickey
Commit: b365fe24611af59e3acc9451c8c126a3d0e7
Author: Howard Trickey
Date:   Thu Aug 15 13:05:56 2019 -0400
Branches: newboolean
https://developer.blender.org/rBb365fe24611af59e3acc9451c8c126a3d0e7

A coplanar intersect case works.

===

M   source/blender/bmesh/tools/bmesh_boolean.c

===

diff --git a/source/blender/bmesh/tools/bmesh_boolean.c 
b/source/blender/bmesh/tools/bmesh_boolean.c
index 9286184360f..203a1d10cca 100644
--- a/source/blender/bmesh/tools/bmesh_boolean.c
+++ b/source/blender/bmesh/tools/bmesh_boolean.c
@@ -33,13 +33,13 @@
 
 #include "MEM_guardedalloc.h"
 
-#include "BLI_math.h"
+#include "BLI_alloca.h"
 #include "BLI_delaunay_2d.h"
-#include "BLI_utildefines.h"
+#include "BLI_linklist.h"
+#include "BLI_math.h"
 #include "BLI_memarena.h"
-#include "BLI_alloca.h"
+#include "BLI_utildefines.h"
 
-#include "BLI_linklist.h"
 
 #include "bmesh.h"
 #include "intern/bmesh_private.h"
@@ -86,6 +86,19 @@ static void dump_cluster(Cluster *cl, const char *label);
 static void dump_clusterset(ClusterSet *clset, const char *label);
 #endif
 
+/**
+ * Make ngon from verts alone.
+ * Use facerep as example for attributes of new face.
+ * TODO: make this an similar bev_create_ngon in bmesh_bevel.c into a BMesh 
utility.
+ */
+static BMFace *bool_create_ngon(BMesh *bm, BMVert **vert_arr, const int 
vert_len, BMFace *facerep)
+{
+  BMFace *f;
+
+  f = BM_face_create_verts(bm, vert_arr, vert_len, facerep, BM_CREATE_NOP, 
true);
+  return f;
+}
+
 /* Make clusterset by empty. */
 static void init_clusterset(ClusterSet *clusterset)
 {
@@ -207,8 +220,13 @@ static void intersect_planar_geometry(BoolState *bs,
   BMVert *v;
   BMIter iter;
   float mat_2d[3][3];
-  float xy[2];
+  float mat_2d_inv[3][3];
+  float xyz[3], save_z, p[3];
   int i, faces_index, vert_coords_index, faces_table_index, v_index;
+  int j, start, len;
+  bool ok;
+  BMVert **face_v;
+  BMVert **all_v;
 
   nverts = 0;
   nfaceverts = 0;
@@ -234,11 +252,16 @@ static void intersect_planar_geometry(BoolState *bs,
   in.epsilon = bs->eps;
 
   axis_dominant_v3_to_m3(mat_2d, plane);
+  ok = invert_m3_m3(mat_2d_inv, mat_2d);
+  BLI_assert(ok);
   vert_coords_index = 0;
   for (ln = vertlist; ln; ln = ln->next) {
 v = (BMVert *)ln->link;
-mul_v2_m3v3(xy, mat_2d, v->co);
-copy_v2_v2(in.vert_coords[vert_coords_index], xy);
+mul_v3_m3v3(xyz, mat_2d, v->co);
+copy_v2_v2(in.vert_coords[vert_coords_index], xyz);
+if (vert_coords_index == 0) {
+  save_z = xyz[2];
+}
 vert_coords_index++;
   }
 
@@ -258,32 +281,53 @@ static void intersect_planar_geometry(BoolState *bs,
 faces_table_index++;
   }
 
-  printf("cdt input:\n");
-  printf("verts_len=%d, edges_len=%d, faces_len=%d\n", in.verts_len, 
in.edges_len, in.faces_len);
-  printf("vert_coord: ");
-  for (i = 0; i < in.verts_len; i++) {
-printf("(%.3f,%.3f) ", F2(in.vert_coords[i]));
-  }
-  printf("\nfaces: ");
-  for (i = 0; i < in.faces_start_table[in.faces_len - 1] + 
in.faces_len_table[in.faces_len -1]; i++) {
-printf("%d ", in.faces[i]);
-  }
-  printf("\nfaces_start_table: ");
-  for (i = 0; i < in.faces_len; i++) {
-printf("%d ", in.faces_start_table[i]);
-  }
-  printf("\nfaces_len_table: ");
-  for (i = 0; i < in.faces_len; i++) {
-printf("%d ", in.faces_len_table[i]);
+  out = BLI_delaunay_2d_cdt_calc(, CDT_CONSTRAINTS_VALID_BMESH);
+
+  /* Gather BMVerts corresponding to output vertices into all_v. */
+  all_v = BLI_array_alloca(face_v, (size_t)out->verts_len);
+  for (i = 0; i < out->verts_len; i++) {
+if (out->verts_orig_len_table[i] > 0) {
+  /* choose first input vert in orig list as representative */
+  v_index = out->verts_orig[out->verts_orig_start_table[i]];
+  ln = BLI_linklist_find(vertlist, v_index);
+  BLI_assert(ln != NULL);
+  v = (BMVert *)ln->link;
+  all_v[i] = v;
+}
+else {
+  copy_v2_v2(xyz, out->vert_coords[i]);
+  xyz[2] = save_z;
+  mul_v3_m3v3(p, mat_2d_inv, xyz);
+  /* TODO: figure out example vert to copy attributes from */
+  v = BM_vert_create(bs->bm, p, NULL, BM_CREATE_NOP);
+  all_v[i] = v;
+}
   }
-  printf("\n");
 
-  out = BLI_delaunay_2d_cdt_calc(, CDT_CONSTRAINTS_VALID_BMESH);
+  /* Make the new faces. out-verts_len is upper bound on max face length. */
+  face_v = BLI_array_alloca(face_v, (size_t)out->verts_len);
+  for (faces_index = 0; faces_index < out->faces_len; faces_index++) {
+start = out->faces_start_table[faces_index];
+len = out->faces_len_table[faces_index];
+if (len >= 3) {
+  for (j = 0; j < len; j++) {
+v_index = out->faces[start + j];
+BLI_assert(v_index >= 0 && v_index < out->verts_len);
+v = all_v[v_index];
+BLI_assert(j < out->verts_len);
+face_v[j] = v;
+  }
+  /* TODO: figure out example face for this face */
+  

[Bf-blender-cvs] [b5fe838d440] master: Fix T68689 Fix infinite recursion cause by versioning code

2019-08-15 Thread Clément Foucault
Commit: b5fe838d44089abef761cb4723aa2d795299c68f
Author: Clément Foucault
Date:   Thu Aug 15 18:46:29 2019 +0200
Branches: master
https://developer.blender.org/rBb5fe838d44089abef761cb4723aa2d795299c68f

Fix T68689 Fix infinite recursion cause by versioning code

Complex nodetrees could fire infinite recursion with previous algo.
Now using another gset we make sure we can only evaluate a tree once.

===

M   source/blender/blenloader/intern/versioning_280.c

===

diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index 462d32d40bd..8cf98761919 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -737,7 +737,8 @@ static void 
do_versions_seq_alloc_transform_and_crop(ListBase *seqbase)
 /* Return true if there is something to convert. */
 static bool do_versions_material_convert_legacy_blend_mode(bNodeTree *ntree,
char blend_method,
-   GSet 
*nodegrp_tree_set)
+   GSet 
*nodegrp_tree_set,
+   GSet 
*nooutput_tree_set)
 {
   bool need_update = false;
   bool do_conversion = false;
@@ -758,9 +759,10 @@ static bool 
do_versions_material_convert_legacy_blend_mode(bNodeTree *ntree,
 bNodeTree *group_ntree = (bNodeTree *)fromnode->id;
 if (BLI_gset_add(nodegrp_tree_set, group_ntree)) {
   /* Recursive but not convert (blend_method = -1). Conversion happens 
after. */
-  if (!do_versions_material_convert_legacy_blend_mode(group_ntree, -1, 
nodegrp_tree_set)) {
-/* There is no output to convert in the tree, remove it. */
-BLI_gset_remove(nodegrp_tree_set, group_ntree, NULL);
+  if (!do_versions_material_convert_legacy_blend_mode(
+  group_ntree, -1, nodegrp_tree_set, nooutput_tree_set)) {
+/* There is no output to convert in the tree. */
+BLI_gset_add(nooutput_tree_set, group_ntree);
   }
 }
   }
@@ -768,9 +770,10 @@ static bool 
do_versions_material_convert_legacy_blend_mode(bNodeTree *ntree,
 bNodeTree *group_ntree = (bNodeTree *)tonode->id;
 if (BLI_gset_add(nodegrp_tree_set, group_ntree)) {
   /* Recursive but not convert (blend_method = -1). Conversion happens 
after. */
-  if (!do_versions_material_convert_legacy_blend_mode(group_ntree, -1, 
nodegrp_tree_set)) {
-/* There is no output to convert in the tree, remove it. */
-BLI_gset_remove(nodegrp_tree_set, group_ntree, NULL);
+  if (!do_versions_material_convert_legacy_blend_mode(
+  group_ntree, -1, nodegrp_tree_set, nooutput_tree_set)) {
+/* There is no output to convert in the tree. */
+BLI_gset_add(nooutput_tree_set, group_ntree);
   }
 }
   }
@@ -1259,32 +1262,45 @@ void do_versions_after_linking_280(Main *bmain, 
ReportList *reports)
 GSet *ntrees_additive = BLI_gset_new(BLI_ghashutil_ptrhash, 
BLI_ghashutil_ptrcmp, __func__);
 GSet *ntrees_multiply = BLI_gset_new(BLI_ghashutil_ptrhash, 
BLI_ghashutil_ptrcmp, __func__);
 GSet *ntrees_nolegacy = BLI_gset_new(BLI_ghashutil_ptrhash, 
BLI_ghashutil_ptrcmp, __func__);
+GSet *ntrees_nooutput = BLI_gset_new(BLI_ghashutil_ptrhash, 
BLI_ghashutil_ptrcmp, __func__);
 for (Material *ma = bmain->materials.first; ma; ma = ma->id.next) {
   bNodeTree *ntree = ma->nodetree;
   if (ma->blend_method == 1 /* MA_BM_ADD */) {
 if (ma->use_nodes) {
-  do_versions_material_convert_legacy_blend_mode(ntree, 
ma->blend_method, ntrees_additive);
+  do_versions_material_convert_legacy_blend_mode(
+  ntree, ma->blend_method, ntrees_additive, ntrees_nooutput);
 }
 ma->blend_method = MA_BM_BLEND;
   }
   else if (ma->blend_method == 2 /* MA_BM_MULTIPLY */) {
 if (ma->use_nodes) {
-  do_versions_material_convert_legacy_blend_mode(ntree, 
ma->blend_method, ntrees_multiply);
+  do_versions_material_convert_legacy_blend_mode(
+  ntree, ma->blend_method, ntrees_multiply, ntrees_nooutput);
 }
 ma->blend_method = MA_BM_BLEND;
   }
   else {
 /* Still tag the group nodes as not using legacy blend modes. */
 if (ma->use_nodes) {
-  do_versions_material_convert_legacy_blend_mode(ntree, -1, 
ntrees_nolegacy);
+  do_versions_material_convert_legacy_blend_mode(
+  ntree, -1, ntrees_nolegacy, ntrees_nooutput);
 }
   }
 }
-/* Remove group nodetree that are used by material using non-legacy blend 
mode. */
 

[Bf-blender-cvs] [5d72ceb8d80] master: Fix broken text editing of integer number buttons, after recent changes

2019-08-15 Thread Brecht Van Lommel
Commit: 5d72ceb8d806cef9fc4ff12d0678c2e649b4b339
Author: Brecht Van Lommel
Date:   Thu Aug 15 18:20:33 2019 +0200
Branches: master
https://developer.blender.org/rB5d72ceb8d806cef9fc4ff12d0678c2e649b4b339

Fix broken text editing of integer number buttons, after recent changes

===

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

===

diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 8fd39b5d120..0cb0dbdc85c 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4820,6 +4820,9 @@ static int ui_do_but_NUM(
 }
 button_activate_state(C, but, BUTTON_STATE_EXIT);
   }
+  else {
+button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
+  }
 }
 else {
   /* Float Value. */

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


[Bf-blender-cvs] [f61c6a2a1fc] master: Build: enable OpenImageDenoise, now that we have libraries for all platforms

2019-08-15 Thread Brecht Van Lommel
Commit: f61c6a2a1fcae9f9175fc4ec8e61e39037f0d102
Author: Brecht Van Lommel
Date:   Thu Aug 15 18:09:58 2019 +0200
Branches: master
https://developer.blender.org/rBf61c6a2a1fcae9f9175fc4ec8e61e39037f0d102

Build: enable OpenImageDenoise, now that we have libraries for all platforms

Note that we are still missing an update for install_deps.sh to easily build 
this
on Linux. Only "make deps" has it for now.

===

M   CMakeLists.txt
M   build_files/cmake/config/blender_full.cmake
M   build_files/cmake/config/blender_release.cmake

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2a7a020c428..16ac322ebdd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -182,6 +182,8 @@ if(UNIX AND NOT APPLE)
   set(_init_SDLOFF)
   set(_init_FFTW3  OFF)
   set(_init_OPENSUBDIV OFF)
+  set(_init_OPENVDBOFF)
+  set(_init_OPENIMAGEDENOISE   OFF)
 elseif(WIN32)
   set(_init_JACK   OFF)
 elseif(APPLE)
@@ -237,12 +239,12 @@ option(WITH_OPENCOLORIO   "Enable OpenColorIO color 
management" ${_init_OPENCOLO
 
 # Compositor
 option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
-option(WITH_OPENIMAGEDENOISE   "Enable the OpenImageDenoise compositing node" 
OFF)
+option(WITH_OPENIMAGEDENOISE   "Enable the OpenImageDenoise compositing node" 
${_init_OPENIMAGEDENOISE})
 
 option(WITH_OPENSUBDIV"Enable OpenSubdiv for surface subdivision" 
${_init_OPENSUBDIV})
 
-option(WITH_OPENVDB   "Enable features relying on OpenVDB" OFF)
-option(WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enable 
if OpenVDB was built with blosc support" OFF)
+option(WITH_OPENVDB   "Enable features relying on OpenVDB" 
${_init_OPENVDB})
+option(WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enable 
if OpenVDB was built with blosc support" ${_init_OPENVDB})
 option(WITH_OPENVDB_3_ABI_COMPATIBLE "Assume OpenVDB library has been compiled 
with version 3 ABI compatibility" OFF)
 mark_as_advanced(WITH_OPENVDB_3_ABI_COMPATIBLE)
 
diff --git a/build_files/cmake/config/blender_full.cmake 
b/build_files/cmake/config/blender_full.cmake
index 38371ccb60e..75c5e0f34c1 100644
--- a/build_files/cmake/config/blender_full.cmake
+++ b/build_files/cmake/config/blender_full.cmake
@@ -40,7 +40,7 @@ set(WITH_AUDASPACE   ON  CACHE BOOL "" FORCE)
 set(WITH_OPENAL  ON  CACHE BOOL "" FORCE)
 set(WITH_OPENCOLLADA ON  CACHE BOOL "" FORCE)
 set(WITH_OPENCOLORIO ON  CACHE BOOL "" FORCE)
-set(WITH_OPENIMAGEDENOISEOFF CACHE BOOL "" FORCE)
+set(WITH_OPENIMAGEDENOISEON  CACHE BOOL "" FORCE)
 set(WITH_OPENMP  ON  CACHE BOOL "" FORCE)
 set(WITH_OPENSUBDIV  ON  CACHE BOOL "" FORCE)
 set(WITH_OPENVDB ON  CACHE BOOL "" FORCE)
diff --git a/build_files/cmake/config/blender_release.cmake 
b/build_files/cmake/config/blender_release.cmake
index 682f456dd3d..08218a5e57c 100644
--- a/build_files/cmake/config/blender_release.cmake
+++ b/build_files/cmake/config/blender_release.cmake
@@ -41,7 +41,7 @@ set(WITH_AUDASPACE   ON  CACHE BOOL "" FORCE)
 set(WITH_OPENAL  ON  CACHE BOOL "" FORCE)
 set(WITH_OPENCOLLADA ON  CACHE BOOL "" FORCE)
 set(WITH_OPENCOLORIO ON  CACHE BOOL "" FORCE)
-set(WITH_OPENIMAGEDENOISEOFF CACHE BOOL "" FORCE)
+set(WITH_OPENIMAGEDENOISEON  CACHE BOOL "" FORCE)
 set(WITH_OPENMP  ON  CACHE BOOL "" FORCE)
 set(WITH_OPENSUBDIV  ON  CACHE BOOL "" FORCE)
 set(WITH_OPENVDB ON  CACHE BOOL "" FORCE)

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


[Bf-blender-cvs] [25fa832d010] soc-2019-adaptive-cloth: Cloth: attempt at fixing extra face after collapsing edge

2019-08-15 Thread ishbosamiya
Commit: 25fa832d01010f09b3be64db1fe89b81e429ca84
Author: ishbosamiya
Date:   Thu Aug 15 12:16:39 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rB25fa832d01010f09b3be64db1fe89b81e429ca84

Cloth: attempt at fixing extra face after collapsing edge

===

M   source/blender/blenkernel/intern/cloth_remeshing.cpp

===

diff --git a/source/blender/blenkernel/intern/cloth_remeshing.cpp 
b/source/blender/blenkernel/intern/cloth_remeshing.cpp
index f434aefd7af..4d97cd06c01 100644
--- a/source/blender/blenkernel/intern/cloth_remeshing.cpp
+++ b/source/blender/blenkernel/intern/cloth_remeshing.cpp
@@ -1862,6 +1862,31 @@ static bool 
cloth_remeshing_collapse_edges(ClothModifierData *clmd,
   char file_name[100];
   sprintf(file_name, 
"/tmp/objs/collapse_edge_debug_after_collapse.obj");
   cloth_remeshing_export_obj(clmd->clothObject->bm, file_name);
+#endif
+#if 0
+  /* Fix for when collapse edges leaves behind an extra
+   * triangle */
+  BMFace *f;
+  BMIter fiter;
+  BM_ITER_ELEM (f, , temp_e, BM_FACES_OF_EDGE) {
+BMVert *vs[3];
+BM_face_as_array_vert_tri(f, vs);
+bool should_break = false;
+for (int i = 0; i < 3; i++) {
+  /* if (!BM_vert_is_manifold(vs[i])) { */
+  if (cloth_remeshing_vert_on_seam_or_boundary_test(
+  clmd->clothObject->bm, vs[i], cd_loop_uv_offset) &&
+  !BM_vert_is_manifold(vs[i])) {
+BM_vert_kill(clmd->clothObject->bm, vs[i]);
+printf("Killed vert because of non manifold vert\n");
+should_break = true;
+break;
+  }
+}
+if (should_break) {
+  break;
+}
+  }
 #endif
 }
 BLI_assert(BM_edge_face_count(temp_e) <= 2);

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


[Bf-blender-cvs] [b000354226f] soc-2019-adaptive-cloth: Cloth: silence some print statements

2019-08-15 Thread ishbosamiya
Commit: b000354226f2a21b178d9a429a95fe13bb42461d
Author: ishbosamiya
Date:   Thu Aug 15 18:47:25 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rBb000354226f2a21b178d9a429a95fe13bb42461d

Cloth: silence some print statements

===

M   source/blender/blenkernel/intern/cloth_remeshing.cpp

===

diff --git a/source/blender/blenkernel/intern/cloth_remeshing.cpp 
b/source/blender/blenkernel/intern/cloth_remeshing.cpp
index 2d0754cbb88..eeaac6a99be 100644
--- a/source/blender/blenkernel/intern/cloth_remeshing.cpp
+++ b/source/blender/blenkernel/intern/cloth_remeshing.cpp
@@ -1646,19 +1646,26 @@ static BMVert *cloth_remeshing_collapse_edge(BMesh *bm, 
BMEdge *e, int which, Cl
 #  endif
   return v2;
 #else
+#  define COLLAPSE_EDGE_DEBUG 0
+#  if COLLAPSE_EDGE_DEBUG
   printf("Started collapsing an edge\n");
+#  endif
   BMVert *n1 = cloth_remeshing_edge_vert(e, which);
   BMVert *n2 = cloth_remeshing_edge_vert(e, 1 - which);
   /* Done: Need to remove n1 */
   BMEdge *adj_e;
   BMIter eiter;
+#  if COLLAPSE_EDGE_DEBUG
   printf("adj_e count: %d\n", BM_vert_edge_count(n1));
+#  endif
   BM_ITER_ELEM (adj_e, , n1, BM_EDGES_OF_VERT) {
 /* Done: Need to remove adj_e */
 BMVert *n3 = adj_e->v1 == n1 ? adj_e->v2 : adj_e->v1;
 if (n3 != n2 && !BM_edge_exists(n2, n3)) {
-  /* Done: Need to create edge between n2 and n3 */
+/* Done: Need to create edge between n2 and n3 */
+#  if COLLAPSE_EDGE_DEBUG
   printf("Creating edge between n2 and n3\n");
+#  endif
   BM_edge_create(bm, n2, n3, adj_e, BM_CREATE_NO_DOUBLE);
 }
 /* edge_kill kills even the verts of the edge, so killing the
@@ -1676,7 +1683,9 @@ static BMVert *cloth_remeshing_collapse_edge(BMesh *bm, 
BMEdge *e, int which, Cl
 /* Done: Need to remove v1 */
 BMFace *f;
 BMIter fiter;
+#  if COLLAPSE_EDGE_DEBUG
 printf("f count: %d\n", BM_vert_face_count(v1));
+#  endif
 BM_ITER_ELEM (f, , v1, BM_FACES_OF_VERT) {
   /* Done: Need to remove f */
   if (!BM_vert_in_face(v2, f)) {
@@ -1688,8 +1697,10 @@ static BMVert *cloth_remeshing_collapse_edge(BMesh *bm, 
BMEdge *e, int which, Cl
 vs[i] = v2;
   }
 }
+#  if COLLAPSE_EDGE_DEBUG
 /* Done: Need to create face between vs[0], vs[1], vs[2] */
 printf("Creating face between vs[0] vs[1] vs[2]\n");
+#  endif
 BM_face_create_verts(bm, vs, 3, f, BM_CREATE_NO_DOUBLE, true);
   }
   /* printf("Killing face f\n"); */
@@ -1698,10 +1709,14 @@ static BMVert *cloth_remeshing_collapse_edge(BMesh *bm, 
BMEdge *e, int which, Cl
 /* printf("Killing vertex v1\n"); */
 /* BM_vert_kill(bm, v1); */
   }
+#  if COLLAPSE_EDGE_DEBUG
   printf("Killing vertex n1\n");
+#  endif
   BM_vert_kill(bm, n1);
   cloth_remeshing_remove_vertex_from_cloth(n1, cvm);
+#  if COLLAPSE_EDGE_DEBUG
   printf("Finished collapsing edge\n");
+#  endif
   return n2;
 #endif
 }

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


[Bf-blender-cvs] [09565017aeb] soc-2019-adaptive-cloth: Cloth: revert back to using previous splitting method

2019-08-15 Thread ishbosamiya
Commit: 09565017aeba564033663787fb0e5577ac50eabb
Author: ishbosamiya
Date:   Mon Aug 12 12:21:42 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rB09565017aeba564033663787fb0e5577ac50eabb

Cloth: revert back to using previous splitting method

The problem arises when a particular edge has more than 2 faces. This shouldn't 
ever happen. There must be problem with collapse edges or flip edges that 
introduces these extra number of faces for the edge.

===

M   source/blender/blenkernel/intern/cloth_remeshing.cpp

===

diff --git a/source/blender/blenkernel/intern/cloth_remeshing.cpp 
b/source/blender/blenkernel/intern/cloth_remeshing.cpp
index 0726e4f7fdd..f2e6f0c3ed7 100644
--- a/source/blender/blenkernel/intern/cloth_remeshing.cpp
+++ b/source/blender/blenkernel/intern/cloth_remeshing.cpp
@@ -604,6 +604,7 @@ static bool cloth_remeshing_flip_edges(BMesh *bm,
 BM_ITER_ELEM (f, , edge, BM_FACES_OF_EDGE) {
   remove_faces.push_back(f);
 }
+BLI_assert(BM_edge_face_count(edge) <= 2);
 /* BM_EDGEROT_CHECK_SPLICE sets it up for BM_CREATE_NO_DOUBLE */
 BMEdge *new_edge = BM_edge_rotate(bm, edge, true, BM_EDGEROT_CHECK_SPLICE);
 /* TODO(Ish): all the edges part of independent_edges should be
@@ -613,6 +614,7 @@ static bool cloth_remeshing_flip_edges(BMesh *bm,
 /* BLI_assert(new_edge != NULL); */
 /* TODO(Ish): need to check if the normals are flipped by some
  * kind of area check */
+BLI_assert(BM_edge_face_count(new_edge) <= 2);
 
 #if 0
 cloth_remeshing_update_active_faces(active_faces, bm, new_edge);
@@ -753,6 +755,28 @@ static void cloth_remeshing_find_bad_edges(BMesh *bm, 
ClothVertMap , vector<
   edge_pairs.clear();
 }
 
+static void cloth_remeshing_split_face_into_tri(BMesh *bm, BMFace *f, BMVert 
*v)
+{
+  BLI_assert(BM_vert_in_face(v, f));
+  int len = f->len;
+  if (len == 3) {
+return;
+  }
+  if (len > 4) {
+printf("face length: %d\n", len);
+  }
+  BMLoop *l_01 = BM_face_vert_share_loop(f, v);
+  BMLoop *l_iter = l_01->next;
+  vector l;
+  for (int i = 0; i < len - 3; i++) {
+l.push_back(l_iter->next);
+  }
+  for (int i = 0; i < l.size(); i++) {
+BMFace *new_face = BM_face_split(bm, f, l_01, l[i], NULL, NULL, true);
+BLI_assert(new_face != NULL);
+  }
+}
+
 static BMVert *cloth_remeshing_split_edge_keep_triangles(BMesh *bm,
  BMEdge *e,
  BMVert *v,
@@ -774,6 +798,7 @@ static BMVert 
*cloth_remeshing_split_edge_keep_triangles(BMesh *bm,
   /* split the edge */
   BMEdge *new_edge;
   BMVert *new_v = BM_edge_split(bm, e, v, _edge, fac);
+  BLI_assert(BM_vert_face_count(new_v) <= 2);
   /* if (cloth_remeshing_edge_label_test(e)) { */
   /*   BM_elem_flag_enable(new_edge, BM_ELEM_TAG); */
   /* } */
@@ -781,6 +806,7 @@ static BMVert 
*cloth_remeshing_split_edge_keep_triangles(BMesh *bm,
   /*   BM_elem_flag_disable(new_edge, BM_ELEM_TAG); */
   /* } */
 
+#if 1
   BMVert *vert;
   BMIter viter;
   /* search for vert within the face that is not part of input edge
@@ -794,9 +820,12 @@ static BMVert 
*cloth_remeshing_split_edge_keep_triangles(BMesh *bm,
 BMLoop *l_a = NULL, *l_b = NULL;
 l_a = BM_face_vert_share_loop(f1, vert);
 l_b = BM_face_vert_share_loop(f1, new_v);
-if (!BM_face_split(bm, f1, l_a, l_b, NULL, NULL, true)) {
+BMFace *new_face = BM_face_split(bm, f1, l_a, l_b, NULL, NULL, true);
+if (!new_face) {
   printf("face not split: f1\n");
 }
+BLI_assert(new_face->len == 3);
+BLI_assert(f1->len == 3);
 break;
   }
   if (f2) {
@@ -808,12 +837,70 @@ static BMVert 
*cloth_remeshing_split_edge_keep_triangles(BMesh *bm,
   BMLoop *l_a = NULL, *l_b = NULL;
   l_a = BM_face_vert_share_loop(f2, vert);
   l_b = BM_face_vert_share_loop(f2, new_v);
-  if (!BM_face_split(bm, f2, l_a, l_b, NULL, NULL, true)) {
+  BMFace *new_face = BM_face_split(bm, f2, l_a, l_b, NULL, NULL, true);
+  if (!new_face) {
 printf("face not split: f2\n");
   }
+  BLI_assert(new_face->len == 3);
+  BLI_assert(f2->len == 3);
   break;
 }
   }
+#endif
+#if 0
+  BMFace *f;
+  BMIter fiter;
+  int i = 0;
+  BM_ITER_ELEM (f, , new_v, BM_FACES_OF_VERT) {
+printf("face count: %d", i);
+i++;
+if (f->len == 3) {
+  continue;
+}
+BMVert *temp_v;
+BMIter viter;
+BM_ITER_ELEM (temp_v, , f, BM_VERTS_OF_FACE) {
+  if (temp_v == new_v || temp_v == e->v1 || temp_v == e->v2) {
+continue;
+  }
+  if (BM_edge_exists(temp_v, new_v)) {
+continue;
+  }
+  BMLoop *l_a = NULL, *l_b = NULL;
+  l_a = BM_face_vert_share_loop(f, temp_v);
+  l_b = BM_face_vert_share_loop(f, new_v);
+  BMFace *new_face = BM_face_split(bm, f, l_a, l_b, NULL, NULL, 

[Bf-blender-cvs] [4844469ebc0] soc-2019-adaptive-cloth: Cloth: new method for collapsing an edge

2019-08-15 Thread ishbosamiya
Commit: 4844469ebc07b7f01d0b34f10f8ccfe329c8fea3
Author: ishbosamiya
Date:   Thu Aug 15 17:57:41 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rB4844469ebc07b7f01d0b34f10f8ccfe329c8fea3

Cloth: new method for collapsing an edge

===

M   source/blender/blenkernel/intern/cloth_remeshing.cpp

===

diff --git a/source/blender/blenkernel/intern/cloth_remeshing.cpp 
b/source/blender/blenkernel/intern/cloth_remeshing.cpp
index 4d97cd06c01..2d0754cbb88 100644
--- a/source/blender/blenkernel/intern/cloth_remeshing.cpp
+++ b/source/blender/blenkernel/intern/cloth_remeshing.cpp
@@ -1607,8 +1607,9 @@ static bool cloth_remeshing_vert_on_seam_test(BMesh *bm, 
BMVert *v, const int cd
 
 static BMVert *cloth_remeshing_collapse_edge(BMesh *bm, BMEdge *e, int which, 
ClothVertMap )
 {
+#if 0
   BMVert *v1 = cloth_remeshing_edge_vert(e, which);
-#if 1
+#  if 1
   float uv_01[2], uv_02[2];
   cloth_remeshing_uv_of_vert_in_edge(bm, e, v1, uv_01);
   cloth_remeshing_uv_of_vert_in_edge(bm, e, cloth_remeshing_edge_vert(e, 1 - 
which), uv_02);
@@ -1619,22 +1620,22 @@ static BMVert *cloth_remeshing_collapse_edge(BMesh *bm, 
BMEdge *e, int which, Cl
   char file_name[100];
   sprintf(file_name, "/tmp/objs/collapse_edge_debug_before_collapse.obj");
   cloth_remeshing_export_obj(bm, file_name);
-#endif
+#  endif
   /* Need to store the value of vertex v1 which will be killed */
   BMVert *v = v1;
   BMVert *v2 = BM_edge_collapse(bm, e, v1, true, true);
 
   if (v2) {
 cloth_remeshing_remove_vertex_from_cloth(v, cvm);
-#if 1
+#  if 1
 BMFace *f;
 BMIter fiter;
 BM_ITER_ELEM (f, , v2, BM_FACES_OF_VERT) {
   BLI_assert(f->len == 3);
 }
-#endif
+#  endif
   }
-#if COLLAPSE_EDGES_DEBUG
+#  if COLLAPSE_EDGES_DEBUG
   printf("killed %f %f %f into %f %f %f\n",
  v.co[0],
  v.co[1],
@@ -1642,8 +1643,67 @@ static BMVert *cloth_remeshing_collapse_edge(BMesh *bm, 
BMEdge *e, int which, Cl
  v2->co[0],
  v2->co[1],
  v2->co[2]);
-#endif
+#  endif
   return v2;
+#else
+  printf("Started collapsing an edge\n");
+  BMVert *n1 = cloth_remeshing_edge_vert(e, which);
+  BMVert *n2 = cloth_remeshing_edge_vert(e, 1 - which);
+  /* Done: Need to remove n1 */
+  BMEdge *adj_e;
+  BMIter eiter;
+  printf("adj_e count: %d\n", BM_vert_edge_count(n1));
+  BM_ITER_ELEM (adj_e, , n1, BM_EDGES_OF_VERT) {
+/* Done: Need to remove adj_e */
+BMVert *n3 = adj_e->v1 == n1 ? adj_e->v2 : adj_e->v1;
+if (n3 != n2 && !BM_edge_exists(n2, n3)) {
+  /* Done: Need to create edge between n2 and n3 */
+  printf("Creating edge between n2 and n3\n");
+  BM_edge_create(bm, n2, n3, adj_e, BM_CREATE_NO_DOUBLE);
+}
+/* edge_kill kills even the verts of the edge, so killing the
+ * vertex n1 should be enough */
+/* printf("Killing edge adj_e\n"); */
+/* BM_edge_kill(bm, adj_e); */
+  }
+  for (int s = 0; s < 2; s++) {
+BMVert *v1 = cloth_remeshing_edge_vert(bm, e, s, which, NULL);
+BMVert *v2 = cloth_remeshing_edge_vert(bm, e, s, 1 - which, NULL);
+
+if (!v1 || (s == 1 && v1 == cloth_remeshing_edge_vert(bm, e, 0, 1 - which, 
NULL))) {
+  continue;
+}
+/* Done: Need to remove v1 */
+BMFace *f;
+BMIter fiter;
+printf("f count: %d\n", BM_vert_face_count(v1));
+BM_ITER_ELEM (f, , v1, BM_FACES_OF_VERT) {
+  /* Done: Need to remove f */
+  if (!BM_vert_in_face(v2, f)) {
+BMVert *vs[3];
+BM_face_as_array_vert_tri(f, vs);
+/* Replacing v1 with v2 in vs */
+for (int i = 0; i < 3; i++) {
+  if (vs[i] == v1) {
+vs[i] = v2;
+  }
+}
+/* Done: Need to create face between vs[0], vs[1], vs[2] */
+printf("Creating face between vs[0] vs[1] vs[2]\n");
+BM_face_create_verts(bm, vs, 3, f, BM_CREATE_NO_DOUBLE, true);
+  }
+  /* printf("Killing face f\n"); */
+  /* BM_face_kill(bm, f); */
+}
+/* printf("Killing vertex v1\n"); */
+/* BM_vert_kill(bm, v1); */
+  }
+  printf("Killing vertex n1\n");
+  BM_vert_kill(bm, n1);
+  cloth_remeshing_remove_vertex_from_cloth(n1, cvm);
+  printf("Finished collapsing edge\n");
+  return n2;
+#endif
 }
 
 static bool cloth_remeshing_has_labeled_edges(BMVert *v)
@@ -1851,7 +1911,7 @@ static bool 
cloth_remeshing_collapse_edges(ClothModifierData *clmd,
   BMIter temp_e_iter;
   BM_ITER_ELEM (temp_e, _e_iter, temp_vert, BM_EDGES_OF_VERT) {
 if (BM_edge_face_count(temp_e) > 2) {
-#if 1
+#if 0
   float uv_01[2], uv_02[2];
   cloth_remeshing_uv_of_vert_in_edge(clmd->clothObject->bm, temp_e, 
temp_e->v1, uv_01);
   cloth_remeshing_uv_of_vert_in_edge(clmd->clothObject->bm, temp_e, 
temp_e->v2, uv_02);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org

[Bf-blender-cvs] [0bf78faa1df] soc-2019-adaptive-cloth: Cloth: debugging statements for finding bug in collapse edges

2019-08-15 Thread ishbosamiya
Commit: 0bf78faa1df93bd08719be885a432b02847e9275
Author: ishbosamiya
Date:   Tue Aug 13 19:46:17 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rB0bf78faa1df93bd08719be885a432b02847e9275

Cloth: debugging statements for finding bug in collapse edges

There is a bug in collapse edges which leaves 3 triangles for an edge in a 
special case. This might be an issue with the bmesh api. Now that the problem 
has been isolated, it can now be worked on.

===

M   source/blender/blenkernel/intern/cloth_remeshing.cpp

===

diff --git a/source/blender/blenkernel/intern/cloth_remeshing.cpp 
b/source/blender/blenkernel/intern/cloth_remeshing.cpp
index f2e6f0c3ed7..f434aefd7af 100644
--- a/source/blender/blenkernel/intern/cloth_remeshing.cpp
+++ b/source/blender/blenkernel/intern/cloth_remeshing.cpp
@@ -1608,6 +1608,18 @@ static bool cloth_remeshing_vert_on_seam_test(BMesh *bm, 
BMVert *v, const int cd
 static BMVert *cloth_remeshing_collapse_edge(BMesh *bm, BMEdge *e, int which, 
ClothVertMap )
 {
   BMVert *v1 = cloth_remeshing_edge_vert(e, which);
+#if 1
+  float uv_01[2], uv_02[2];
+  cloth_remeshing_uv_of_vert_in_edge(bm, e, v1, uv_01);
+  cloth_remeshing_uv_of_vert_in_edge(bm, e, cloth_remeshing_edge_vert(e, 1 - 
which), uv_02);
+  printf("uv killed: ");
+  print_v2(uv_01);
+  printf("uv: ");
+  print_v2(uv_02);
+  char file_name[100];
+  sprintf(file_name, "/tmp/objs/collapse_edge_debug_before_collapse.obj");
+  cloth_remeshing_export_obj(bm, file_name);
+#endif
   /* Need to store the value of vertex v1 which will be killed */
   BMVert *v = v1;
   BMVert *v2 = BM_edge_collapse(bm, e, v1, true, true);
@@ -1838,6 +1850,20 @@ static bool 
cloth_remeshing_collapse_edges(ClothModifierData *clmd,
   BMEdge *temp_e;
   BMIter temp_e_iter;
   BM_ITER_ELEM (temp_e, _e_iter, temp_vert, BM_EDGES_OF_VERT) {
+if (BM_edge_face_count(temp_e) > 2) {
+#if 1
+  float uv_01[2], uv_02[2];
+  cloth_remeshing_uv_of_vert_in_edge(clmd->clothObject->bm, temp_e, 
temp_e->v1, uv_01);
+  cloth_remeshing_uv_of_vert_in_edge(clmd->clothObject->bm, temp_e, 
temp_e->v2, uv_02);
+  printf("uv_01: ");
+  print_v2(uv_01);
+  printf("uv_02: ");
+  print_v2(uv_02);
+  char file_name[100];
+  sprintf(file_name, 
"/tmp/objs/collapse_edge_debug_after_collapse.obj");
+  cloth_remeshing_export_obj(clmd->clothObject->bm, file_name);
+#endif
+}
 BLI_assert(BM_edge_face_count(temp_e) <= 2);
   }

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


[Bf-blender-cvs] [e3ddf0f8bc6] soc-2019-adaptive-cloth: Cloth: attempt fix for rare error when not all faces remain as triangles

2019-08-15 Thread ishbosamiya
Commit: e3ddf0f8bc67e8847b98ab39f822994abf39150b
Author: ishbosamiya
Date:   Sat Aug 10 17:55:01 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rBe3ddf0f8bc67e8847b98ab39f822994abf39150b

Cloth: attempt fix for rare error when not all faces remain as triangles

After spliting an edge, there are some instances when faces around the new_vert 
are not triangles. This attempts to fix this.

===

M   source/blender/blenkernel/intern/cloth_remeshing.cpp

===

diff --git a/source/blender/blenkernel/intern/cloth_remeshing.cpp 
b/source/blender/blenkernel/intern/cloth_remeshing.cpp
index a3dbaf6e916..0726e4f7fdd 100644
--- a/source/blender/blenkernel/intern/cloth_remeshing.cpp
+++ b/source/blender/blenkernel/intern/cloth_remeshing.cpp
@@ -39,6 +39,11 @@ extern "C" {
 #include "BLI_linklist.h"
 #include "BLI_array.h"
 #include "BLI_kdopbvh.h"
+#include "BLI_memarena.h"
+#include "BLI_heap.h"
+#include "BLI_alloca.h"
+#include "BLI_polyfill_2d.h"
+#include "BLI_polyfill_2d_beautify.h"
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_query.h"
@@ -532,6 +537,9 @@ static vector 
cloth_remeshing_find_edges_to_flip(BMesh *bm,
   for (int i = 0; i < active_faces.size(); i++) {
 BMEdge *e;
 BMIter eiter;
+/* if (active_faces[i]->head.htype != BM_FACE) { */
+/*   continue; */
+/* } */
 BM_ITER_ELEM (e, , active_faces[i], BM_EDGES_OF_FACE) {
   edges.push_back(e);
 }
@@ -615,6 +623,9 @@ static bool cloth_remeshing_flip_edges(BMesh *bm,
 vector add_faces;
 BM_ITER_ELEM (f, , new_edge, BM_FACES_OF_EDGE) {
   add_faces.push_back(f);
+#  if 1
+  BLI_assert(f->len == 3);
+#  endif
 }
 cloth_remeshing_update_active_faces(active_faces, remove_faces, add_faces);
 #endif
@@ -1081,6 +1092,57 @@ static BMEdge *cloth_remeshing_fix_sewing_verts(
 }
 #endif
 
+static bool bm_face_triangulate(BMesh *bm,
+BMFace *f_base,
+LinkNode **r_faces_double,
+int *r_edges_tri_tot,
+
+MemArena *pf_arena,
+/* use for MOD_TRIANGULATE_NGON_BEAUTY only! */
+struct Heap *pf_heap)
+{
+  const int f_base_len = f_base->len;
+  int faces_array_tot = f_base_len - 3;
+  int edges_array_tot = f_base_len - 3;
+  BMFace **faces_array = BLI_array_alloca(faces_array, faces_array_tot);
+  BMEdge **edges_array = BLI_array_alloca(edges_array, edges_array_tot);
+  const int quad_method = 0, ngon_method = 0; /* beauty */
+
+  bool has_cut = false;
+
+  const int f_index = BM_elem_index_get(f_base);
+
+  BM_face_triangulate(bm,
+  f_base,
+  faces_array,
+  _array_tot,
+  edges_array,
+  _array_tot,
+  r_faces_double,
+  quad_method,
+  ngon_method,
+  false,
+  pf_arena,
+  pf_heap);
+
+  for (int i = 0; i < edges_array_tot; i++) {
+BMLoop *l_iter, *l_first;
+l_iter = l_first = edges_array[i]->l;
+do {
+  BM_elem_index_set(l_iter, f_index); /* set_dirty */
+  has_cut = true;
+} while ((l_iter = l_iter->radial_next) != l_first);
+  }
+
+  for (int i = 0; i < faces_array_tot; i++) {
+BM_face_normal_update(faces_array[i]);
+  }
+
+  *r_edges_tri_tot += edges_array_tot;
+
+  return has_cut;
+}
+
 static bool cloth_remeshing_split_edges(ClothModifierData *clmd,
 ClothVertMap ,
 const int cd_loop_uv_offset)
@@ -1118,6 +1180,29 @@ static bool 
cloth_remeshing_split_edges(ClothModifierData *clmd,
 BMFace *af;
 BMIter afiter;
 BM_ITER_ELEM (af, , new_vert, BM_FACES_OF_VERT) {
+#if 1
+  /* BLI_assert(af->len == 3); */
+  if (af->len > 3) {
+MemArena *pf_arena;
+Heap *pf_heap;
+LinkNode *faces_double = NULL;
+pf_arena = BLI_memarena_new(BLI_POLYFILL_ARENA_SIZE, __func__);
+pf_heap = BLI_heap_new_ex(BLI_POLYFILL_ALLOC_NGON_RESERVE);
+int edges_tri_tot = 0;
+BM_face_normal_update(af);
+bm_face_triangulate(bm, af, _double, _tri_tot, pf_arena, 
pf_heap);
+while (faces_double) {
+  LinkNode *next = faces_double->next;
+  BM_face_kill(bm, (BMFace *)faces_double->link);
+  MEM_freeN(faces_double);
+  faces_double = next;
+}
+BLI_memarena_free(pf_arena);
+BLI_heap_free(pf_heap, NULL);
+BM_mesh_elem_index_ensure(bm, BM_EDGE | BM_FACE);
+continue;
+  }
+#endif
   active_faces.push_back(af);
 }
 cloth_remeshing_fix_mesh(bm, cvm, active_faces, cd_loop_uv_offset);
@@ -1440,6 +1525,13 @@ 

[Bf-blender-cvs] [c883fe25da9] master: Cleanup: clang-format, unused arg

2019-08-15 Thread Campbell Barton
Commit: c883fe25da9b325b4e32074d5492edff703ce257
Author: Campbell Barton
Date:   Fri Aug 16 01:59:13 2019 +1000
Branches: master
https://developer.blender.org/rBc883fe25da9b325b4e32074d5492edff703ce257

Cleanup: clang-format, unused arg

===

M   source/blender/blenlib/intern/delaunay_2d.c
M   source/blender/editors/space_view3d/view3d_select.c
M   tests/gtests/blenlib/BLI_delaunay_2d_test.cc

===

diff --git a/source/blender/blenlib/intern/delaunay_2d.c 
b/source/blender/blenlib/intern/delaunay_2d.c
index 632847046a7..23f560c5463 100644
--- a/source/blender/blenlib/intern/delaunay_2d.c
+++ b/source/blender/blenlib/intern/delaunay_2d.c
@@ -1961,7 +1961,7 @@ static void add_face_ids(
   }
 }
 
-/* Delete_edge but try not to mess up outer face. 
+/* Delete_edge but try not to mess up outer face.
  * Also faces have symedges now, so make sure not
  * to mess those up either. */
 static void dissolve_symedge(CDT_state *cdt, SymEdge *se)
diff --git a/source/blender/editors/space_view3d/view3d_select.c 
b/source/blender/editors/space_view3d/view3d_select.c
index 9a37c10180d..725f655c8ce 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -200,9 +200,7 @@ struct EditSelectBuf_Cache {
   BLI_bitmap *select_bitmap;
 };
 
-static void editselect_buf_cache_init(struct EditSelectBuf_Cache *esel,
-  ViewContext *vc,
-  short select_mode)
+static void editselect_buf_cache_init(ViewContext *vc, short select_mode)
 {
   if (vc->obedit) {
 uint bases_len = 0;
@@ -240,7 +238,7 @@ static void 
editselect_buf_cache_init_with_generic_userdata(wmGenericUserData *w
   wm_userdata->data = esel;
   wm_userdata->free_fn = editselect_buf_cache_free_voidp;
   wm_userdata->use_free = true;
-  editselect_buf_cache_init(esel, vc, select_mode);
+  editselect_buf_cache_init(vc, select_mode);
 }
 
 /** \} */
diff --git a/tests/gtests/blenlib/BLI_delaunay_2d_test.cc 
b/tests/gtests/blenlib/BLI_delaunay_2d_test.cc
index 5b44c6277a3..ce84baf802a 100644
--- a/tests/gtests/blenlib/BLI_delaunay_2d_test.cc
+++ b/tests/gtests/blenlib/BLI_delaunay_2d_test.cc
@@ -650,7 +650,10 @@ enum {
 };
 
 // #define DO_TIMING
-static void rand_delaunay_test(int test_kind, int max_lg_size, int 
reps_per_size, CDT_output_type otype)
+static void rand_delaunay_test(int test_kind,
+   int max_lg_size,
+   int reps_per_size,
+   CDT_output_type otype)
 {
   CDT_input in;
   CDT_result *out;

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


[Bf-blender-cvs] [8856c26fc36] master: Windows: add cycles debug logging to helper batch file.

2019-08-15 Thread Lazydodo
Commit: 8856c26fc364b4590755dacf132abe5ae7dac543
Author: Lazydodo
Date:   Thu Aug 15 09:42:00 2019 -0600
Branches: master
https://developer.blender.org/rB8856c26fc364b4590755dacf132abe5ae7dac543

Windows: add cycles debug logging to helper batch file.

===

M   release/windows/batch/blender_debug_log.cmd

===

diff --git a/release/windows/batch/blender_debug_log.cmd 
b/release/windows/batch/blender_debug_log.cmd
index ecb5803a5c9..2d708ea9104 100644
--- a/release/windows/batch/blender_debug_log.cmd
+++ b/release/windows/batch/blender_debug_log.cmd
@@ -12,5 +12,5 @@ mkdir "%temp%\blender\debug_logs" > NUL 2>&1
 echo.
 echo Starting blender and waiting for it to exit
 set PYTHONPATH=
-blender --debug --python-expr "import bpy; 
bpy.ops.wm.sysinfo(filepath=r'%temp%\blender\debug_logs\blender_system_info.txt')"
 > "%temp%\blender\debug_logs\blender_debug_output.txt" 2>&1 < %0
+blender --debug --debug-cycles --python-expr "import bpy; 
bpy.ops.wm.sysinfo(filepath=r'%temp%\blender\debug_logs\blender_system_info.txt')"
 > "%temp%\blender\debug_logs\blender_debug_output.txt" 2>&1 < %0
 explorer "%temp%\blender\debug_logs"

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


[Bf-blender-cvs] [a38506b298d] soc-2019-bevel-profiles: Bevel Modal Keymap: Added Keys, reenabled custom status text

2019-08-15 Thread Hans Goudey
Commit: a38506b298dc886c22642420d359708f02589bd4
Author: Hans Goudey
Date:   Thu Aug 15 11:39:13 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rBa38506b298dc886c22642420d359708f02589bd4

Bevel Modal Keymap: Added Keys, reenabled custom status text

Added custom profile toggle and intersection method cycle
The custom status text shows the current state of the properties making
it necessary to enable it over the automatic one.
But it's getting far too long.

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   source/blender/editors/mesh/editmesh_bevel.c

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 3f6a5f0a514..a29b50b 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -4625,6 +4625,8 @@ def km_bevel_modal_map(_params):
 ("MARK_SHARP_TOGGLE", {"type": 'K', "value": 'PRESS', "any": True}, 
None),
 ("OUTER_MITER_CHANGE", {"type": 'O', "value": 'PRESS', "any": True}, 
None),
 ("INNER_MITER_CHANGE", {"type": 'I', "value": 'PRESS', "any": True}, 
None),
+("CUSTOM_PROFILE_TOGGLE", {"type": 'Z', "value": 'PRESS', "any": 
True}, None),
+("VERTEX_MESH_CHANGE", {"type": 'N', "value": 'PRESS', "any": True}, 
None),
 ])
 
 return keymap
diff --git a/source/blender/editors/mesh/editmesh_bevel.c 
b/source/blender/editors/mesh/editmesh_bevel.c
index cdd88d838e6..32bbc6c9a35 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -120,6 +120,8 @@ enum {
   BEV_MODAL_MARK_SHARP_TOGGLE,
   BEV_MODAL_OUTER_MITER_CHANGE,
   BEV_MODAL_INNER_MITER_CHANGE,
+  BEV_MODAL_CUSTOM_PROFILE_TOGGLE,
+  BEV_MODAL_VERTEX_MESH_CHANGE,
 };
 
 static float get_bevel_offset(wmOperator *op)
@@ -135,15 +137,15 @@ static float get_bevel_offset(wmOperator *op)
   return val;
 }
 
-static void edbm_bevel_update_header(bContext *C, wmOperator *op)
+static void edbm_bevel_update_status_text(bContext *C, wmOperator *op)
 {
-  char header[UI_MAX_DRAW_STR];
+  char status_text[UI_MAX_DRAW_STR];
   char buf[UI_MAX_DRAW_STR];
   char *p = buf;
   int available_len = sizeof(buf);
   Scene *sce = CTX_data_scene(C);
   char offset_str[NUM_STR_REP_LEN];
-  const char *mode_str, *omiter_str, *imiter_str;
+  const char *mode_str, *omiter_str, *imiter_str, *vmesh_str;
   PropertyRNA *prop;
 
 #define WM_MODALKEY(_id) \
@@ -154,40 +156,40 @@ static void edbm_bevel_update_header(bContext *C, 
wmOperator *op)
 BLI_snprintf(offset_str, NUM_STR_REP_LEN, "%.1f%%", RNA_float_get(op->ptr, 
"offset_pct"));
   }
   else {
-bUnit_AsString2(offset_str,
-NUM_STR_REP_LEN,
-(double)RNA_float_get(op->ptr, "offset"),
-3,
-B_UNIT_LENGTH,
->unit,
-true);
+bUnit_AsString2(offset_str, NUM_STR_REP_LEN, 
(double)RNA_float_get(op->ptr, "offset"), 3,
+B_UNIT_LENGTH, >unit, true);
   }
 
   prop = RNA_struct_find_property(op->ptr, "offset_type");
-  RNA_property_enum_name_gettexted(
-  C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), _str);
+  RNA_property_enum_name_gettexted(C, op->ptr, prop, 
RNA_property_enum_get(op->ptr, prop),
+   _str);
   prop = RNA_struct_find_property(op->ptr, "miter_outer");
-  RNA_property_enum_name_gettexted(
-  C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), _str);
+  RNA_property_enum_name_gettexted(C, op->ptr, prop, 
RNA_property_enum_get(op->ptr, prop),
+   _str);
   prop = RNA_struct_find_property(op->ptr, "miter_inner");
-  RNA_property_enum_name_gettexted(
-  C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), _str);
-
-  BLI_snprintf(header,
-   sizeof(header),
-   TIP_("%s: confirm, "
-"%s: cancel, "
-"%s: mode (%s), "
-"%s: width (%s), "
-"%s: segments (%d), "
-"%s: profile (%.3f), "
-"%s: clamp overlap (%s), "
-"%s: vertex only (%s), "
-"%s: outer miter (%s), "
-"%s: inner miter (%s), "
-"%s: harden normals (%s), "
-"%s: mark seam (%s), "
-"%s: mark sharp (%s)"),
+  RNA_property_enum_name_gettexted(C, op->ptr, prop, 
RNA_property_enum_get(op->ptr, prop),
+   _str);
+  prop = RNA_struct_find_property(op->ptr, "vmesh_method");
+  RNA_property_enum_name_gettexted(C, op->ptr, prop, 
RNA_property_enum_get(op->ptr, 

[Bf-blender-cvs] [63ef1451483] soc-2019-bevel-profiles: Cleanup: Comments, formatting, TODOs

2019-08-15 Thread Hans Goudey
Commit: 63ef145148328c13d726bf1e54c25459c206c740
Author: Hans Goudey
Date:   Wed Aug 14 18:33:34 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rB63ef145148328c13d726bf1e54c25459c206c740

Cleanup: Comments, formatting, TODOs

===

M   source/blender/bmesh/tools/bmesh_bevel.c

===

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index 7d2bcb26231..428aedcbadc 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -59,12 +59,7 @@
 #define BEVEL_MAX_AUTO_ADJUST_PCT 300.0f
 #define BEVEL_MATCH_SPEC_WEIGHT 0.2
 
-#define DEBUG_CUSTOM_PROFILE_SAMPLE 0
-#define DEBUG_CUSTOM_PROFILE_WELD 0
-#define DEBUG_CUSTOM_PROFILE_ADJ 0
-#define DEBUG_CUSTOM_PROFILE_ORIENTATION 1
-#define DEBUG_PROFILE_ORIENTATION_DRAW
-#define DEBUG_CUSTOM_PROFILE_CUTOFF 0
+#define DEBUG_CUSTOM_PROFILE_CUTOFF
 
 #if defined(DEBUG_PROFILE_ORIENTATION_DRAW) || 
defined(DEBUG_CUSTOM_PROFILE_PIPE)
 static float debug_color_red[4] = {1.0f, 0.0f, 0.0f, 1.0f};
@@ -1810,9 +1805,6 @@ static void calculate_profile(BevelParams *bp, BoundVert 
*bndv, bool reversed, b
  * Only currently used for the pipe and cube corner special cases */
 static void snap_to_superellipsoid(float co[3], const float super_r, bool 
midline)
 {
-#if DEBUG_CUSTOM_PROFILE_ADJ
-  printf("SNAP TO SUPERELLIPSOID\n");
-#endif
   float a, b, c, x, y, z, r, rinv, dx, dy;
   r = super_r;
   if (r == PRO_CIRCLE_R) {
@@ -2037,7 +2029,7 @@ static void bevel_extend_edge_data(BevVert *bv)
   } while (bcur != start);
 }
 
-/* Mark edges as sharp if they are between a smooth recon face and a new face. 
*/
+/* Mark edges as sharp if they are between a smooth reconstructed face and a 
new face. */
 static void bevel_edges_sharp_boundary(BMesh *bm, BevelParams *bp)
 {
   BMIter fiter, liter;
@@ -2075,129 +2067,129 @@ static void bevel_edges_sharp_boundary(BMesh *bm, 
BevelParams *bp)
  */
 static void bevel_harden_normals(BevelParams *bp, BMesh *bm)
 {
-  BMIter liter, fiter;
-  BMFace *f;
-  BMLoop *l, *lnext, *lprev, *lprevprev, *lnextnext;
-  BMEdge *estep;
-  FKind fkind, fprevkind, fnextkind, fprevprevkind, fnextnextkind;
-  int cd_clnors_offset, l_index;
-  short *clnors;
-  float *pnorm, norm[3];
+  BMIter liter, fiter;
+  BMFace *f;
+  BMLoop *l, *lnext, *lprev, *lprevprev, *lnextnext;
+  BMEdge *estep;
+  FKind fkind, fprevkind, fnextkind, fprevprevkind, fnextnextkind;
+  int cd_clnors_offset, l_index;
+  short *clnors;
+  float *pnorm, norm[3];
+
+  if (bp->offset == 0.0 || !bp->harden_normals) {
+return;
+  }
 
-  if (bp->offset == 0.0 || !bp->harden_normals) {
-return;
-  }
+  /* recalculate all face and vertex normals; side effect: ensures vertex, 
edge, face indices */
+  /* I suspect this is not necessary: TODO: test that guess */
+  BM_mesh_normals_update(bm);
 
-  /* recalculate all face and vertex normals; side effect: ensures vertex, 
edge, face indices */
-  /* I suspect this is not necessary: TODO: test that guess */
-  BM_mesh_normals_update(bm);
+  cd_clnors_offset = CustomData_get_offset(>ldata, CD_CUSTOMLOOPNORMAL);
 
-  cd_clnors_offset = CustomData_get_offset(>ldata, 
CD_CUSTOMLOOPNORMAL);
+  /* If there is not already a custom split normal layer then making one (with 
BM_lnorspace_update)
+   * will not respect the autosmooth angle between smooth faces. To get that 
to happen, we have
+   * to mark the sharpen the edges that are only sharp because
+   * of the angle test -- otherwise would be smooth.
+   */
+  if (cd_clnors_offset == -1) {
+BM_edges_sharp_from_angle_set(bm, bp->smoothresh);
+bevel_edges_sharp_boundary(bm, bp);
+  }
 
-  /* If there is not already a custom split normal layer then making one 
(with BM_lnorspace_update)
-   * will not respect the autosmooth angle between smooth faces. To get 
that to happen, we have
-   * to mark the sharpen the edges that are only sharp because
-   * of the angle test -- otherwise would be smooth.
-   */
-  if (cd_clnors_offset == -1) {
-BM_edges_sharp_from_angle_set(bm, bp->smoothresh);
-bevel_edges_sharp_boundary(bm, bp);
-  }
+  /* Ensure that bm->lnor_spacearr has properly stored loop normals;
+   * side effect: ensures loop indices. */
+  BM_lnorspace_update(bm);
 
-  /* Ensure that bm->lnor_spacearr has properly stored loop normals;
-   * side effect: ensures loop indices. */
-  BM_lnorspace_update(bm);
+  if (cd_clnors_offset == -1) {
+cd_clnors_offset = CustomData_get_offset(>ldata, CD_CUSTOMLOOPNORMAL);
+  }
 
-  if (cd_clnors_offset == -1) {
-cd_clnors_offset = CustomData_get_offset(>ldata, 
CD_CUSTOMLOOPNORMAL);
+  BM_ITER_MESH (f, , bm, BM_FACES_OF_MESH) {
+fkind = get_face_kind(bp, f);
+if (fkind 

[Bf-blender-cvs] [f4faf6d8560] master: Cleanup: Remove redundant headers

2019-08-15 Thread mano-wii
Commit: f4faf6d8560d7565f77823247d2f7f7650bba975
Author: mano-wii
Date:   Thu Aug 15 12:16:43 2019 -0300
Branches: master
https://developer.blender.org/rBf4faf6d8560d7565f77823247d2f7f7650bba975

Cleanup: Remove redundant headers

===

M   source/blender/draw/engines/select/select_engine.c

===

diff --git a/source/blender/draw/engines/select/select_engine.c 
b/source/blender/draw/engines/select/select_engine.c
index f437efe0c41..4c158312e0f 100644
--- a/source/blender/draw/engines/select/select_engine.c
+++ b/source/blender/draw/engines/select/select_engine.c
@@ -24,15 +24,11 @@
 
 #include "DNA_screen_types.h"
 
-#include "GPU_shader.h"
-
 #include "UI_resources.h"
 
 #include "DRW_engine.h"
 #include "DRW_select_buffer.h"
 
-#include "DRW_select_buffer.h"
-
 #include "draw_cache_impl.h"
 #include "draw_manager.h"

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


[Bf-blender-cvs] [4aad7730615] master: Cleanup: Silence C4115 warning

2019-08-15 Thread mano-wii
Commit: 4aad773061555144e77e6094fc0247831d397041
Author: mano-wii
Date:   Thu Aug 15 12:34:31 2019 -0300
Branches: master
https://developer.blender.org/rB4aad773061555144e77e6094fc0247831d397041

Cleanup: Silence C4115 warning

`'ParticleSystem': named type definition in parentheses`
And prevent the need for struct `Object` to be defined.

===

M   source/blender/draw/intern/draw_cache.h

===

diff --git a/source/blender/draw/intern/draw_cache.h 
b/source/blender/draw/intern/draw_cache.h
index 129b180957a..5dadcdc1457 100644
--- a/source/blender/draw/intern/draw_cache.h
+++ b/source/blender/draw/intern/draw_cache.h
@@ -27,6 +27,7 @@ struct GPUBatch;
 struct GPUMaterial;
 struct ModifierData;
 struct Object;
+struct ParticleSystem;
 struct PTCacheEdit;
 
 void DRW_shape_cache_free(void);
@@ -58,7 +59,7 @@ struct GPUBatch 
**DRW_cache_object_surface_material_get(struct Object *ob,
 char 
**auto_layer_names,
 int 
**auto_layer_is_srgb,
 int *auto_layer_count);
-struct GPUBatch *DRW_cache_object_face_wireframe_get(Object *ob);
+struct GPUBatch *DRW_cache_object_face_wireframe_get(struct Object *ob);
 
 /* Empties */
 struct GPUBatch *DRW_cache_plain_axes_get(void);
@@ -152,7 +153,7 @@ struct GPUBatch **DRW_cache_curve_surface_shaded_get(struct 
Object *ob,
  uint gpumat_array_len);
 struct GPUBatch *DRW_cache_curve_loose_edges_get(struct Object *ob);
 struct GPUBatch *DRW_cache_curve_edge_wire_get(struct Object *ob);
-struct GPUBatch *DRW_cache_curve_face_wireframe_get(Object *ob);
+struct GPUBatch *DRW_cache_curve_face_wireframe_get(struct Object *ob);
 struct GPUBatch *DRW_cache_curve_edge_detection_get(struct Object *ob, bool 
*r_is_manifold);
 /* edit-mode */
 struct GPUBatch *DRW_cache_curve_edge_normal_get(struct Object *ob);
@@ -161,13 +162,13 @@ struct GPUBatch *DRW_cache_curve_vert_overlay_get(struct 
Object *ob, bool handle
 
 /* Font */
 struct GPUBatch *DRW_cache_text_surface_get(struct Object *ob);
-struct GPUBatch *DRW_cache_text_edge_detection_get(Object *ob, bool 
*r_is_manifold);
+struct GPUBatch *DRW_cache_text_edge_detection_get(struct Object *ob, bool 
*r_is_manifold);
 struct GPUBatch *DRW_cache_text_loose_edges_get(struct Object *ob);
 struct GPUBatch *DRW_cache_text_edge_wire_get(struct Object *ob);
 struct GPUBatch **DRW_cache_text_surface_shaded_get(struct Object *ob,
 struct GPUMaterial 
**gpumat_array,
 uint gpumat_array_len);
-struct GPUBatch *DRW_cache_text_face_wireframe_get(Object *ob);
+struct GPUBatch *DRW_cache_text_face_wireframe_get(struct Object *ob);
 
 /* Surface */
 struct GPUBatch *DRW_cache_surf_surface_get(struct Object *ob);
@@ -176,7 +177,7 @@ struct GPUBatch *DRW_cache_surf_loose_edges_get(struct 
Object *ob);
 struct GPUBatch **DRW_cache_surf_surface_shaded_get(struct Object *ob,
 struct GPUMaterial 
**gpumat_array,
 uint gpumat_array_len);
-struct GPUBatch *DRW_cache_surf_face_wireframe_get(Object *ob);
+struct GPUBatch *DRW_cache_surf_face_wireframe_get(struct Object *ob);
 struct GPUBatch *DRW_cache_surf_edge_detection_get(struct Object *ob, bool 
*r_is_manifold);
 
 /* Lattice */
@@ -206,7 +207,7 @@ struct GPUBatch *DRW_cache_mball_surface_get(struct Object 
*ob);
 struct GPUBatch **DRW_cache_mball_surface_shaded_get(struct Object *ob,
  struct GPUMaterial 
**gpumat_array,
  uint gpumat_array_len);
-struct GPUBatch *DRW_cache_mball_face_wireframe_get(Object *ob);
+struct GPUBatch *DRW_cache_mball_face_wireframe_get(struct Object *ob);
 struct GPUBatch *DRW_cache_mball_edge_detection_get(struct Object *ob, bool 
*r_is_manifold);
 
 #endif /* __DRAW_CACHE_H__ */

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


[Bf-blender-cvs] [9684971addf] master: Fix T56843 : fix case sensitive filenames on win10

2019-08-15 Thread Lazydodo
Commit: 9684971addf0dfa43fb7367d9102460e8093c523
Author: Lazydodo
Date:   Thu Aug 15 09:27:15 2019 -0600
Branches: master
https://developer.blender.org/rB9684971addf0dfa43fb7367d9102460e8093c523

Fix T56843 : fix case sensitive filenames on win10

When building with case sensitive folders there were some linker errors.

===

M   build_files/cmake/platform/platform_win32.cmake

===

diff --git a/build_files/cmake/platform/platform_win32.cmake 
b/build_files/cmake/platform/platform_win32.cmake
index 80097e6c84f..42ac285f88d 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -418,7 +418,7 @@ endif()
 
 if(WITH_OPENIMAGEIO)
   windows_find_package(OpenImageIO)
-  set(OPENIMAGEIO ${LIBDIR}/openimageio)
+  set(OPENIMAGEIO ${LIBDIR}/OpenImageIO)
   set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
   set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
   set(OIIO_OPTIMIZED optimized ${OPENIMAGEIO_LIBPATH}/OpenImageIO.lib 
optimized ${OPENIMAGEIO_LIBPATH}/OpenImageIO_Util.lib)
@@ -459,14 +459,14 @@ if(WITH_LLVM)
 endif()
 
 if(WITH_OPENCOLORIO)
-  set(OPENCOLORIO ${LIBDIR}/opencolorio)
+  set(OPENCOLORIO ${LIBDIR}/OpenColorIO)
   set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
-  set(OPENCOLORIO_LIBPATH ${LIBDIR}/opencolorio/lib)
+  set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
   set(OPENCOLORIO_LIBRARIES
 optimized ${OPENCOLORIO_LIBPATH}/OpenColorIO.lib
 optimized ${OPENCOLORIO_LIBPATH}/tinyxml.lib
 optimized ${OPENCOLORIO_LIBPATH}/libyaml-cpp.lib
-debug ${OPENCOLORIO_LIBPATH}/OpenColorIO_d.lib
+debug ${OPENCOLORIO_LIBPATH}/OpencolorIO_d.lib
 debug ${OPENCOLORIO_LIBPATH}/tinyxml_d.lib
 debug ${OPENCOLORIO_LIBPATH}/libyaml-cpp_d.lib
   )
@@ -477,8 +477,8 @@ if(WITH_OPENVDB)
   set(BLOSC_LIBRARIES optimized ${LIBDIR}/blosc/lib/libblosc.lib debug 
${LIBDIR}/blosc/lib/libblosc_d.lib)
   set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug 
${LIBDIR}/tbb/lib/tbb_debug.lib)
   set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include)
-  set(OPENVDB ${LIBDIR}/openvdb)
-  set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
+  set(OPENVDB ${LIBDIR}/openVDB)
+  set(OPENVDB_LIBPATH ${OPENVDB}/lib)
   set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include ${TBB_INCLUDE_DIR})
   set(OPENVDB_LIBRARIES optimized ${OPENVDB_LIBPATH}/openvdb.lib debug 
${OPENVDB_LIBPATH}/openvdb_d.lib ${TBB_LIBRARIES} ${BLOSC_LIBRARIES})
   set(OPENVDB_DEFINITIONS -DNOMINMAX)
@@ -502,7 +502,7 @@ if(WITH_ALEMBIC)
   set(ALEMBIC_INCLUDE_DIR ${ALEMBIC}/include)
   set(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
   set(ALEMBIC_LIBPATH ${ALEMBIC}/lib)
-  set(ALEMBIC_LIBRARIES optimized ${ALEMBIC}/lib/alembic.lib debug 
${ALEMBIC}/lib/alembic_d.lib)
+  set(ALEMBIC_LIBRARIES optimized ${ALEMBIC}/lib/Alembic.lib debug 
${ALEMBIC}/lib/Alembic_d.lib)
   set(ALEMBIC_FOUND 1)
 endif()

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


[Bf-blender-cvs] [cdc2768f65e] soc-2019-openxr: Cleanup: Don't cast away const in GHOST C-API

2019-08-15 Thread Julian Eisel
Commit: cdc2768f65ec2993d7366ac220aaa2531f9c6aaa
Author: Julian Eisel
Date:   Thu Aug 15 15:52:45 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rBcdc2768f65ec2993d7366ac220aaa2531f9c6aaa

Cleanup: Don't cast away const in GHOST C-API

===

M   intern/ghost/intern/GHOST_C-api.cpp

===

diff --git a/intern/ghost/intern/GHOST_C-api.cpp 
b/intern/ghost/intern/GHOST_C-api.cpp
index caa88f46ff9..a5d22f26a22 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -939,7 +939,7 @@ void GHOST_XrSessionEnd(GHOST_XrContextHandle 
xr_contexthandle)
 
 int GHOST_XrSessionIsRunning(const GHOST_XrContextHandle xr_contexthandle)
 {
-  const GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
+  const GHOST_IXrContext *xr_context = (const GHOST_IXrContext 
*)xr_contexthandle;
   GHOST_XR_CAPI_CALL_RET(xr_context->isSessionRunning(), xr_context);
   return 0;  // Only reached if exception is thrown.
 }

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


[Bf-blender-cvs] [eb477c67a15] soc-2019-openxr: Fix crash when no OpenXR runtime is found (or setup failed)

2019-08-15 Thread Julian Eisel
Commit: eb477c67a15bae88998c50be42cc08acaab41782
Author: Julian Eisel
Date:   Thu Aug 15 15:50:01 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rBeb477c67a15bae88998c50be42cc08acaab41782

Fix crash when no OpenXR runtime is found (or setup failed)

===

M   source/blender/windowmanager/intern/wm_xr.c

===

diff --git a/source/blender/windowmanager/intern/wm_xr.c 
b/source/blender/windowmanager/intern/wm_xr.c
index 0b136d81076..8c3139254d5 100644
--- a/source/blender/windowmanager/intern/wm_xr.c
+++ b/source/blender/windowmanager/intern/wm_xr.c
@@ -125,7 +125,9 @@ bool wm_xr_context_ensure(bContext *C, wmWindowManager *wm)
   create_info.context_flag |= GHOST_kXrContextDebugTime;
 }
 
-wm->xr_context = GHOST_XrContextCreate(_info);
+if (!(wm->xr_context = GHOST_XrContextCreate(_info))) {
+  return false;
+}
 
 /* Set up context callbacks */
 GHOST_XrGraphicsContextBindFuncs(wm->xr_context,
@@ -133,8 +135,9 @@ bool wm_xr_context_ensure(bContext *C, wmWindowManager *wm)
  
wm_xr_session_gpu_binding_context_destroy);
 GHOST_XrDrawViewFunc(wm->xr_context, wm_xr_draw_view);
   }
+  BLI_assert(wm->xr_context != NULL);
 
-  return wm->xr_context != NULL;
+  return true;
 }
 
 void wm_xr_context_destroy(wmWindowManager *wm)

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


[Bf-blender-cvs] [0dd3f3925b4] soc-2019-openxr: Remove bundled OpenXR-SDK sources from extern/

2019-08-15 Thread Julian Eisel
Commit: 0dd3f3925b42b4119a2f5152d0a001883590122a
Author: Julian Eisel
Date:   Thu Aug 15 15:37:03 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rB0dd3f3925b42b4119a2f5152d0a001883590122a

Remove bundled OpenXR-SDK sources from extern/

Removes the OPENXR_USE_BUNDLED_SRC option which allowed using the
OpenXR-SDK sources bundled in extern/. It would be too much hassle to
keept these updated.
Now these have to be provided on the system Blender is compiled on. I've
already added necessary bits to install_deps.sh and our Windows
maintainer is ready to provide builds with OpenXR-SDK linked.
Once this gets into master, platform maintainers will have to be
notified about the added dependency.

This also removes the JsonCpp dependency, it was only needed for the
OpenXR-SDK sources.

===

M   CMakeLists.txt
M   extern/CMakeLists.txt
D   extern/jsoncpp/CMakeLists.txt
D   extern/jsoncpp/include/json/allocator.h
D   extern/jsoncpp/include/json/assertions.h
D   extern/jsoncpp/include/json/autolink.h
D   extern/jsoncpp/include/json/config.h
D   extern/jsoncpp/include/json/features.h
D   extern/jsoncpp/include/json/forwards.h
D   extern/jsoncpp/include/json/json.h
D   extern/jsoncpp/include/json/reader.h
D   extern/jsoncpp/include/json/value.h
D   extern/jsoncpp/include/json/version.h
D   extern/jsoncpp/include/json/writer.h
D   extern/jsoncpp/src/CMakeLists.txt
D   extern/jsoncpp/src/json_reader.cpp
D   extern/jsoncpp/src/json_tool.h
D   extern/jsoncpp/src/json_value.cpp
D   extern/jsoncpp/src/json_valueiterator.inl
D   extern/jsoncpp/src/json_writer.cpp
D   extern/jsoncpp/src/sconscript
D   extern/jsoncpp/src/version.h.in
D   extern/openxr/CMakeLists.txt
D   extern/openxr/LICENSE
D   extern/openxr/include/CMakeLists.txt
D   extern/openxr/include/openxr/CMakeLists.txt
D   extern/openxr/include/openxr/openxr.h
D   extern/openxr/include/openxr/openxr_platform.h
D   extern/openxr/include/openxr/openxr_platform_defines.h
D   extern/openxr/include/openxr/openxr_reflection.h
D   extern/openxr/src/CMakeLists.txt
D   extern/openxr/src/api_layers/CMakeLists.txt
D   extern/openxr/src/api_layers/XrApiLayer_core_validation.def
D   extern/openxr/src/api_layers/XrApiLayer_core_validation.json
D   extern/openxr/src/api_layers/api_layer_platform_defines.h
D   extern/openxr/src/api_layers/core_validation.cpp
D   extern/openxr/src/api_layers/validation_utils.h
D   extern/openxr/src/api_layers/xr_generated_core_validation.cpp
D   extern/openxr/src/api_layers/xr_generated_core_validation.hpp
D   extern/openxr/src/cmake/FindVulkanHeaders.cmake
D   extern/openxr/src/cmake/cmake_uninstall.cmake.in
D   extern/openxr/src/cmake/presentation.cmake
D   extern/openxr/src/common/extra_algorithms.h
D   extern/openxr/src/common/filesystem_utils.cpp
D   extern/openxr/src/common/filesystem_utils.hpp
D   extern/openxr/src/common/hex_and_handles.cpp
D   extern/openxr/src/common/hex_and_handles.h
D   extern/openxr/src/common/loader_interfaces.h
D   extern/openxr/src/common/platform_utils.hpp
D   extern/openxr/src/common/xr_dependencies.h
D   extern/openxr/src/common/xr_linear.h
D   extern/openxr/src/common_cmake_config.h.in
D   extern/openxr/src/loader/CMakeLists.txt
D   extern/openxr/src/loader/api_layer_interface.cpp
D   extern/openxr/src/loader/api_layer_interface.hpp
D   extern/openxr/src/loader/exception_handling.hpp
D   extern/openxr/src/loader/loader.rc
D   extern/openxr/src/loader/loader_core.cpp
D   extern/openxr/src/loader/loader_instance.cpp
D   extern/openxr/src/loader/loader_instance.hpp
D   extern/openxr/src/loader/loader_logger.cpp
D   extern/openxr/src/loader/loader_logger.hpp
D   extern/openxr/src/loader/loader_logger_recorders.cpp
D   extern/openxr/src/loader/loader_logger_recorders.hpp
D   extern/openxr/src/loader/loader_platform.hpp
D   extern/openxr/src/loader/manifest_file.cpp
D   extern/openxr/src/loader/manifest_file.hpp
D   extern/openxr/src/loader/openxr.pc.in
D   extern/openxr/src/loader/runtime_interface.cpp
D   extern/openxr/src/loader/runtime_interface.hpp
D   extern/openxr/src/loader/xr_generated_loader.cpp
D   extern/openxr/src/loader/xr_generated_loader.hpp
D   extern/openxr/src/version.cmake
D   extern/openxr/src/xr_generated_dispatch_table.c
D   extern/openxr/src/xr_generated_dispatch_table.h
D   extern/openxr/src/xr_generated_utilities.c
D   extern/openxr/src/xr_generated_utilities.h
M   intern/ghost/CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0ad68f8bca8..bb6e145520f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -236,13 +236,10 @@ 

[Bf-blender-cvs] [4d320f43133] master: Edit Mesh Selection: Refactor: Redraw idmap buffer at runtime with only objects inside the rect

2019-08-15 Thread mano-wii
Commit: 4d320f43133b02a43212b017eecdb390476189f2
Author: mano-wii
Date:   Thu Aug 15 10:31:54 2019 -0300
Branches: master
https://developer.blender.org/rB4d320f43133b02a43212b017eecdb390476189f2

Edit Mesh Selection: Refactor: Redraw idmap buffer at runtime with only objects 
inside the rect

But in the future the selection code may also be used in object mode (eg for 
snapping).
So to avoid using too much VRAM resources, it is good to avoid drawing all 
objects in the viewport.

The solution was to create an array with only objects that are detected within 
the selection area.
If the selection operator is modal, objects already detected are not removed 
from the array until view3d is moved or orbited.
To detect the object, its BoundBox is tested.
Since the Select Engine does not have a dedicated depth texture, whenever a new 
object is "found" the depth of the objects in the array already drawn is 
redrawn.

Reviewers: campbellbarton, fclem

Reviewed By: fclem

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

===

M   source/blender/draw/DRW_engine.h
M   source/blender/draw/DRW_select_buffer.h
M   source/blender/draw/engines/select/select_draw_utils.c
M   source/blender/draw/engines/select/select_engine.c
M   source/blender/draw/engines/select/select_private.h
M   source/blender/draw/intern/draw_manager.c
M   source/blender/draw/intern/draw_select_buffer.c
M   source/blender/editors/mesh/editmesh_select.c
M   source/blender/editors/mesh/meshtools.c
M   source/blender/editors/sculpt_paint/paint_utils.c
M   source/blender/editors/space_view3d/view3d_draw_legacy.c
M   source/blender/editors/space_view3d/view3d_select.c

===

diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h
index 53cec599b82..6cae9ceb7d6 100644
--- a/source/blender/draw/DRW_engine.h
+++ b/source/blender/draw/DRW_engine.h
@@ -141,9 +141,7 @@ void DRW_draw_depth_object(struct ARegion *ar,
 void DRW_draw_select_id(struct Depsgraph *depsgraph,
 struct ARegion *ar,
 struct View3D *v3d,
-struct Base **bases,
-const uint bases_len,
-short select_mode);
+const struct rcti *rect);
 
 /* grease pencil render */
 bool DRW_render_check_grease_pencil(struct Depsgraph *depsgraph);
diff --git a/source/blender/draw/DRW_select_buffer.h 
b/source/blender/draw/DRW_select_buffer.h
index ff40508b1a1..4aa1c403710 100644
--- a/source/blender/draw/DRW_select_buffer.h
+++ b/source/blender/draw/DRW_select_buffer.h
@@ -33,6 +33,13 @@ struct View3D;
 struct ViewLayer;
 struct rcti;
 
+typedef struct SELECTID_ObjectData {
+  DrawData dd;
+
+  uint drawn_index;
+  bool is_drawn;
+} SELECTID_ObjectData;
+
 struct ObjectOffsets {
   /* For convenience only. */
   union {
@@ -54,43 +61,75 @@ struct SELECTID_Context {
   struct GPUFrameBuffer *framebuffer_select_id;
   struct GPUTexture *texture_u32;
 
-  struct ObjectOffsets *index_offsets;
+  /* All context objects */
+  struct Object **objects;
   uint objects_len;
-  uint last_object_drawn;
-  /** Total number of items `base_array_index_offsets[bases_len - 1].vert`. */
-  uint last_index_drawn;
+
+  /* Array with only drawn objects. When a new object is found within the rect,
+   * it is added to the end of the list.
+   * The list is reset to any viewport or context update. */
+  struct ObjectOffsets *index_offsets;
+  struct Object **objects_drawn;
+  uint objects_drawn_len;
+
+  /** Total number of element indices `index_offsets[object_drawn_len - 
1].vert`. */
+  uint index_drawn_len;
 
   short select_mode;
+
+  /* To check for updates. */
+  float persmat[4][4];
+  bool is_dirty;
+
+  /* rect is used to check which objects whose indexes need to be drawn. */
+  rcti last_rect;
 };
 
-/* select_buffer.c */
-void DRW_select_buffer_context_create(struct Base **bases,
-  const uint bases_len,
-  short select_mode);
+/* draw_select_buffer.c */
 bool DRW_select_buffer_elem_get(const uint sel_id,
 uint *r_elem,
 uint *r_base_index,
 char *r_elem_type);
-uint DRW_select_buffer_context_offset_for_object_elem(const uint base_index, 
char elem_type);
-uint *DRW_select_buffer_read(const struct rcti *rect, uint *r_buf_len);
-void DRW_draw_select_id_object(struct Depsgraph *depsgraph,
-   struct ViewLayer *view_layer,
-   struct ARegion *ar,
-   struct View3D *v3d,
-   struct Object *ob,
-   short select_mode);
-uint *DRW_select_buffer_bitmap_from_rect(const struct rcti 

[Bf-blender-cvs] [261a02fc596] master: DRW: New function DRW_culling_min_max_test

2019-08-15 Thread mano-wii
Commit: 261a02fc596db0e91667d4e3af9204b165ec4006
Author: mano-wii
Date:   Thu Aug 15 10:17:41 2019 -0300
Branches: master
https://developer.blender.org/rB261a02fc596db0e91667d4e3af9204b165ec4006

DRW: New function DRW_culling_min_max_test

For testing intersection with frustrum planes without having to transform all 
bound box vertices into global space.

===

M   source/blender/draw/intern/DRW_render.h
M   source/blender/draw/intern/draw_manager_exec.c

===

diff --git a/source/blender/draw/intern/DRW_render.h 
b/source/blender/draw/intern/DRW_render.h
index a8f67e10a4d..3379aa28d0f 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -597,6 +597,7 @@ bool DRW_view_is_persp_get(const DRWView *view);
 bool DRW_culling_sphere_test(const DRWView *view, const BoundSphere *bsphere);
 bool DRW_culling_box_test(const DRWView *view, const BoundBox *bbox);
 bool DRW_culling_plane_test(const DRWView *view, const float plane[4]);
+bool DRW_culling_min_max_test(const DRWView *view, float obmat[4][4], float 
min[3], float max[3]);
 
 void DRW_culling_frustum_corners_get(const DRWView *view, BoundBox *corners);
 void DRW_culling_frustum_planes_get(const DRWView *view, float planes[6][4]);
diff --git a/source/blender/draw/intern/draw_manager_exec.c 
b/source/blender/draw/intern/draw_manager_exec.c
index 949d3e1d38b..3bf442b4f39 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -22,6 +22,7 @@
 
 #include "draw_manager.h"
 
+#include "BLI_math.h"
 #include "BLI_math_bits.h"
 #include "BLI_memblock.h"
 
@@ -488,6 +489,26 @@ bool DRW_culling_plane_test(const DRWView *view, const 
float plane[4])
   return draw_culling_plane_test(>frustum_corners, plane);
 }
 
+/* Return True if the given box intersect the current view frustum.
+ * This function will have to be replaced when world space bb per objects is 
implemented. */
+bool DRW_culling_min_max_test(const DRWView *view, float obmat[4][4], float 
min[3], float max[3])
+{
+  view = view ? view : DST.view_default;
+  float tobmat[4][4];
+  transpose_m4_m4(tobmat, obmat);
+  for (int i = 6; i--;) {
+float frustum_plane_local[4], bb_near[3], bb_far[3];
+mul_v4_m4v4(frustum_plane_local, tobmat, view->frustum_planes[i]);
+aabb_get_near_far_from_plane(frustum_plane_local, min, max, bb_near, 
bb_far);
+
+if (plane_point_side_v3(frustum_plane_local, bb_far) < 0.0f) {
+  return false;
+}
+  }
+
+  return true;
+}
+
 void DRW_culling_frustum_corners_get(const DRWView *view, BoundBox *corners)
 {
   view = view ? view : DST.view_default;

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


[Bf-blender-cvs] [78b56fa7d97] master: Fix T65461: IntProperty does not respect its 'step' field

2019-08-15 Thread Campbell Barton
Commit: 78b56fa7d973dab8d11786115a87af57681a7dda
Author: Campbell Barton
Date:   Thu Aug 15 22:50:30 2019 +1000
Branches: master
https://developer.blender.org/rB78b56fa7d973dab8d11786115a87af57681a7dda

Fix T65461: IntProperty does not respect its 'step' field

Originally D5020 by @deadpin, refactored to make the change simpler.

===

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

===

diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 9c2eb4204e8..8fd39b5d120 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4807,7 +4807,8 @@ static int ui_do_but_NUM(
   /* Integer Value. */
   if (but->drawflag & (UI_BUT_ACTIVE_LEFT | UI_BUT_ACTIVE_RIGHT)) {
 button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
-const int value_step = 1;
+const int value_step = (int)but->a1;
+BLI_assert(value_step > 0);
 const double value_test = (but->drawflag & UI_BUT_ACTIVE_LEFT) ?
   (double)max_ii((int)softmin, 
(int)data->value - value_step) :
   (double)min_ii((int)softmax, 
(int)data->value + value_step);
@@ -4825,6 +4826,7 @@ static int ui_do_but_NUM(
   if (but->drawflag & (UI_BUT_ACTIVE_LEFT | UI_BUT_ACTIVE_RIGHT)) {
 button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 const double value_step = (double)but->a1 * UI_PRECISION_FLOAT_SCALE;
+BLI_assert(value_step > 0.0f);
 const double value_test = (but->drawflag & UI_BUT_ACTIVE_LEFT) ?
   (double)max_ff(softmin, 
(float)(data->value - value_step)) :
   (double)min_ff(softmax, 
(float)(data->value + value_step));

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


[Bf-blender-cvs] [fdef1a6712b] master: UI: make int/float button clicking logic consistent

2019-08-15 Thread Campbell Barton
Commit: fdef1a6712bc3ccf7fa41b0d7b11c725b5503288
Author: Campbell Barton
Date:   Thu Aug 15 22:36:28 2019 +1000
Branches: master
https://developer.blender.org/rBfdef1a6712bc3ccf7fa41b0d7b11c725b5503288

UI: make int/float button clicking logic consistent

- When no change is performed on a float button, cancel the action.
- Move left/right clicks into the same block.
- Replace ambiguous names: temp, tempf.

===

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

===

diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 6ae7793509d..9c2eb4204e8 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4800,64 +4800,40 @@ static int ui_do_but_NUM(
   if (click) {
 /* we can click on the side arrows to increment/decrement,
  * or click inside to edit the value directly */
-float tempf, softmin, softmax;
-int temp;
-
-softmin = but->softmin;
-softmax = but->softmax;
+const float softmin = but->softmin;
+const float softmax = but->softmax;
 
 if (!ui_but_is_float(but)) {
-  if (but->drawflag & UI_BUT_ACTIVE_LEFT) {
+  /* Integer Value. */
+  if (but->drawflag & (UI_BUT_ACTIVE_LEFT | UI_BUT_ACTIVE_RIGHT)) {
 button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
-
-temp = (int)data->value - 1;
-if (temp >= softmin && temp <= softmax) {
-  data->value = (double)temp;
-}
-else {
-  data->cancel = true;
-}
-
-button_activate_state(C, but, BUTTON_STATE_EXIT);
-  }
-  else if (but->drawflag & UI_BUT_ACTIVE_RIGHT) {
-button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
-
-temp = (int)data->value + 1;
-if (temp >= softmin && temp <= softmax) {
-  data->value = (double)temp;
+const int value_step = 1;
+const double value_test = (but->drawflag & UI_BUT_ACTIVE_LEFT) ?
+  (double)max_ii((int)softmin, 
(int)data->value - value_step) :
+  (double)min_ii((int)softmax, 
(int)data->value + value_step);
+if (value_test != data->value) {
+  data->value = (double)value_test;
 }
 else {
   data->cancel = true;
 }
-
 button_activate_state(C, but, BUTTON_STATE_EXIT);
   }
-  else {
-button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
-  }
 }
 else {
-  if (but->drawflag & UI_BUT_ACTIVE_LEFT) {
+  /* Float Value. */
+  if (but->drawflag & (UI_BUT_ACTIVE_LEFT | UI_BUT_ACTIVE_RIGHT)) {
 button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
-
-tempf = (float)data->value - (UI_PRECISION_FLOAT_SCALE * but->a1);
-if (tempf < softmin) {
-  tempf = softmin;
+const double value_step = (double)but->a1 * UI_PRECISION_FLOAT_SCALE;
+const double value_test = (but->drawflag & UI_BUT_ACTIVE_LEFT) ?
+  (double)max_ff(softmin, 
(float)(data->value - value_step)) :
+  (double)min_ff(softmax, 
(float)(data->value + value_step));
+if (value_test != data->value) {
+  data->value = value_test;
 }
-data->value = tempf;
-
-button_activate_state(C, but, BUTTON_STATE_EXIT);
-  }
-  else if (but->drawflag & UI_BUT_ACTIVE_RIGHT) {
-button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
-
-tempf = (float)data->value + (UI_PRECISION_FLOAT_SCALE * but->a1);
-if (tempf > softmax) {
-  tempf = softmax;
+else {
+  data->cancel = true;
 }
-data->value = tempf;
-
 button_activate_state(C, but, BUTTON_STATE_EXIT);
   }
   else {

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


[Bf-blender-cvs] [e4084f8b241] master: Fix CDT bug causing crash with some output modes.

2019-08-15 Thread Howard Trickey
Commit: e4084f8b24197ede2546da90459cb1b5ad0fd9a8
Author: Howard Trickey
Date:   Thu Aug 15 07:55:29 2019 -0400
Branches: master
https://developer.blender.org/rBe4084f8b24197ede2546da90459cb1b5ad0fd9a8

Fix CDT bug causing crash with some output modes.

Forgot to properly maintain the edge for faces while
dissolving edges.

===

M   source/blender/blenlib/intern/delaunay_2d.c
M   tests/gtests/blenlib/BLI_delaunay_2d_test.cc

===

diff --git a/source/blender/blenlib/intern/delaunay_2d.c 
b/source/blender/blenlib/intern/delaunay_2d.c
index 8e2687a6b2f..632847046a7 100644
--- a/source/blender/blenlib/intern/delaunay_2d.c
+++ b/source/blender/blenlib/intern/delaunay_2d.c
@@ -1961,13 +1961,17 @@ static void add_face_ids(
   }
 }
 
-/* Delete_edge but try not to mess up outer face. */
+/* Delete_edge but try not to mess up outer face. 
+ * Also faces have symedges now, so make sure not
+ * to mess those up either. */
 static void dissolve_symedge(CDT_state *cdt, SymEdge *se)
 {
-  if (sym(se)->face == cdt->outer_face) {
+  SymEdge *symse = sym(se);
+  if (symse->face == cdt->outer_face) {
 se = sym(se);
+symse = sym(se);
   }
-  if (cdt->outer_face->symedge == se || cdt->outer_face->symedge == sym(se)) {
+  if (cdt->outer_face->symedge == se || cdt->outer_face->symedge == symse) {
 /* Advancing by 2 to get past possible 'sym(se)'. */
 if (se->next->next == se) {
   cdt->outer_face->symedge = NULL;
@@ -1976,6 +1980,14 @@ static void dissolve_symedge(CDT_state *cdt, SymEdge *se)
   cdt->outer_face->symedge = se->next->next;
 }
   }
+  else {
+if (se->face->symedge == se) {
+  se->face->symedge = se->next;
+}
+if (symse->face->symedge == se) {
+  symse->face->symedge = symse->next;
+}
+  }
   delete_edge(cdt, se);
 }
 
diff --git a/tests/gtests/blenlib/BLI_delaunay_2d_test.cc 
b/tests/gtests/blenlib/BLI_delaunay_2d_test.cc
index 220c0a4100d..5b44c6277a3 100644
--- a/tests/gtests/blenlib/BLI_delaunay_2d_test.cc
+++ b/tests/gtests/blenlib/BLI_delaunay_2d_test.cc
@@ -616,6 +616,33 @@ TEST(delaunay, OverlapFaces)
   BLI_delaunay_2d_cdt_free(out);
 }
 
+TEST(delaunay, TwoSquaresOverlap)
+{
+  CDT_input in;
+  CDT_result *out;
+  float p[][2] = {
+  {1.0f, -1.0f},
+  {-1.0f, -1.0f},
+  {-1.0f, 1.0f},
+  {1.0f, 1.0f},
+  {-1.5f, 1.5f},
+  {0.5f, 1.5f},
+  {0.5f, -0.5f},
+  {-1.5f, -0.5f},
+  };
+  int f[] = {/* 0 */ 7, 6, 5, 4, /* 1 */ 3, 2, 1, 0};
+  int fstart[] = {0, 4};
+  int flen[] = {4, 4};
+
+  fill_input_verts(, p, 8);
+  add_input_faces(, f, fstart, flen, 2);
+  out = BLI_delaunay_2d_cdt_calc(, CDT_CONSTRAINTS_VALID_BMESH);
+  EXPECT_EQ(out->verts_len, 10);
+  EXPECT_EQ(out->edges_len, 12);
+  EXPECT_EQ(out->faces_len, 3);
+  BLI_delaunay_2d_cdt_free(out);
+}
+
 enum {
   RANDOM_PTS,
   RANDOM_SEGS,
@@ -623,7 +650,7 @@ enum {
 };
 
 // #define DO_TIMING
-static void rand_delaunay_test(int test_kind, int max_lg_size, int 
reps_per_size)
+static void rand_delaunay_test(int test_kind, int max_lg_size, int 
reps_per_size, CDT_output_type otype)
 {
   CDT_input in;
   CDT_result *out;
@@ -679,7 +706,7 @@ static void rand_delaunay_test(int test_kind, int 
max_lg_size, int reps_per_size
 add_input_edges(, e, size - 1 + (test_kind == RANDOM_POLY));
   }
   tstart = PIL_check_seconds_timer();
-  out = BLI_delaunay_2d_cdt_calc(, CDT_FULL);
+  out = BLI_delaunay_2d_cdt_calc(, otype);
   EXPECT_NE(out->verts_len, 0);
   BLI_delaunay_2d_cdt_free(out);
   times[lg_size] += PIL_check_seconds_timer() - tstart;
@@ -700,17 +727,32 @@ static void rand_delaunay_test(int test_kind, int 
max_lg_size, int reps_per_size
 
 TEST(delaunay, randompts)
 {
-  rand_delaunay_test(RANDOM_PTS, 7, 1);
+  rand_delaunay_test(RANDOM_PTS, 7, 1, CDT_FULL);
 }
 
 TEST(delaunay, randomsegs)
 {
-  rand_delaunay_test(RANDOM_SEGS, 7, 1);
+  rand_delaunay_test(RANDOM_SEGS, 7, 1, CDT_FULL);
 }
 
 TEST(delaunay, randompoly)
 {
-  rand_delaunay_test(RANDOM_POLY, 7, 1);
+  rand_delaunay_test(RANDOM_POLY, 7, 1, CDT_FULL);
+}
+
+TEST(delaunay, randompoly_inside)
+{
+  rand_delaunay_test(RANDOM_POLY, 7, 1, CDT_INSIDE);
+}
+
+TEST(delaunay, randompoly_constraints)
+{
+  rand_delaunay_test(RANDOM_POLY, 7, 1, CDT_CONSTRAINTS);
+}
+
+TEST(delaunay, randompoly_validbmesh)
+{
+  rand_delaunay_test(RANDOM_POLY, 7, 1, CDT_CONSTRAINTS_VALID_BMESH);
 }
 
 #if 0

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


[Bf-blender-cvs] [48a6997e2a0] master: Fix T64888: full-screen button overlaps side-bar

2019-08-15 Thread Campbell Barton
Commit: 48a6997e2a0657d8b238101b84b688b37bc88875
Author: Campbell Barton
Date:   Thu Aug 15 20:55:24 2019 +1000
Branches: master
https://developer.blender.org/rB48a6997e2a0657d8b238101b84b688b37bc88875

Fix T64888: full-screen button overlaps side-bar

===

M   source/blender/editors/screen/area.c

===

diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index 3cf39b67054..d0a3382ee50 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -874,10 +874,19 @@ static void fullscreen_azone_initialize(ScrArea *sa, 
ARegion *ar)
   az->ar = ar;
   az->alpha = 0.0f;
 
-  az->x2 = ar->winrct.xmax;
-  az->y2 = ar->winrct.ymax;
+  if (U.uiflag2 & USER_REGION_OVERLAP) {
+rcti rect_visible;
+ED_region_visible_rect(ar, _visible);
+az->x2 = ar->winrct.xmin + rect_visible.xmax;
+az->y2 = ar->winrct.ymin + rect_visible.ymax;
+  }
+  else {
+az->x2 = ar->winrct.xmax;
+az->y2 = ar->winrct.ymax;
+  }
   az->x1 = az->x2 - AZONEFADEOUT;
   az->y1 = az->y2 - AZONEFADEOUT;
+
   BLI_rcti_init(>rect, az->x1, az->x2, az->y1, az->y2);
 }

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


[Bf-blender-cvs] [95a0144293b] master: Fix T68684: Vertex snapping with median not working if the object is not at center of the world

2019-08-15 Thread mano-wii
Commit: 95a0144293b840bfbdcb6a41c1a3a26976961b9b
Author: mano-wii
Date:   Thu Aug 15 08:29:34 2019 -0300
Branches: master
https://developer.blender.org/rB95a0144293b840bfbdcb6a41c1a3a26976961b9b

Fix T68684: Vertex snapping with median not working if the object is not at 
center of the world

===

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

===

diff --git a/source/blender/editors/transform/transform_snap.c 
b/source/blender/editors/transform/transform_snap.c
index d45a0588003..dbcc6c1b04a 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1150,12 +1150,19 @@ static void TargetSnapMedian(TransInfo *t)
 add_v3_v3(v, td->center);
   }
 
+  if (i == 0) {
+/* Is this possible? */
+continue;
+  }
+
+  mul_v3_fl(v, 1.0 / i);
+
   if (tc->use_local_mat) {
 mul_m4_v3(tc->mat, v);
   }
 
   add_v3_v3(t->tsnap.snapTarget, v);
-  i_accum += i;
+  i_accum++;
 }
 
 mul_v3_fl(t->tsnap.snapTarget, 1.0 / i_accum);

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


[Bf-blender-cvs] [9e54e6bdc57] master: Cleanup: Minor change to previous commit

2019-08-15 Thread Antonio Vazquez
Commit: 9e54e6bdc57911be2911a7537ab9f67d87e31df0
Author: Antonio Vazquez
Date:   Thu Aug 15 13:17:28 2019 +0200
Branches: master
https://developer.blender.org/rB9e54e6bdc57911be2911a7537ab9f67d87e31df0

Cleanup: Minor change to previous commit

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index db216c5eb2d..efe67e1ead0 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -565,7 +565,7 @@ static void gpencil_add_draw_data(void *vedata, Object *ob)
   bGPdata *gpd = (bGPdata *)ob->data;
   const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
   const DRWContextState *draw_ctx = DRW_context_state_get();
-  View3D *v3d = draw_ctx->v3d;
+  const View3D *v3d = draw_ctx->v3d;
 
   int i = stl->g_data->gp_cache_used - 1;
   tGPencilObjectCache *cache_ob = >g_data->gp_object_cache[i];

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


[Bf-blender-cvs] [2551c5b6e64] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-08-15 Thread Antonio Vazquez
Commit: 2551c5b6e6442b6d669dd29af3e887e147bff927
Author: Antonio Vazquez
Date:   Thu Aug 15 13:16:07 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB2551c5b6e6442b6d669dd29af3e887e147bff927

Merge branch 'master' into greasepencil-object

===



===



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


[Bf-blender-cvs] [143a44caeb4] master: GPencil: Fix unreported missing VFX in Video Editor

2019-08-15 Thread Antonio Vazquez
Commit: 143a44caeb4dc00f27b66b55d35a868127b5e4a9
Author: Antonio Vazquez
Date:   Thu Aug 15 13:14:43 2019 +0200
Branches: master
https://developer.blender.org/rB143a44caeb4dc00f27b66b55d35a868127b5e4a9

GPencil: Fix unreported missing VFX in Video Editor

As the video editor mode is not Render mode the VFX was omitted.

Now, the mode is only checked for View3D.

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 16162645f3d..db216c5eb2d 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -564,6 +564,8 @@ static void gpencil_add_draw_data(void *vedata, Object *ob)
   GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
   bGPdata *gpd = (bGPdata *)ob->data;
   const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
+  const DRWContextState *draw_ctx = DRW_context_state_get();
+  View3D *v3d = draw_ctx->v3d;
 
   int i = stl->g_data->gp_cache_used - 1;
   tGPencilObjectCache *cache_ob = >g_data->gp_object_cache[i];
@@ -580,7 +582,9 @@ static void gpencil_add_draw_data(void *vedata, Object *ob)
 
   /* FX passses */
   cache_ob->has_fx = false;
-  if ((!stl->storage->simplify_fx) && (!ELEM(cache_ob->shading_type[0], 
OB_WIRE, OB_SOLID)) &&
+  if ((!stl->storage->simplify_fx) &&
+  ((!ELEM(cache_ob->shading_type[0], OB_WIRE, OB_SOLID)) ||
+   ((v3d->spacetype != SPACE_VIEW3D))) &&
   (BKE_shaderfx_has_gpencil(ob))) {
 cache_ob->has_fx = true;
 if ((!stl->storage->simplify_fx) && (!is_multiedit)) {

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


[Bf-blender-cvs] [ff1ea600c98] master: Fix T68675: particle edit mode makes blender crash

2019-08-15 Thread Philipp Oeser
Commit: ff1ea600c98ba542c3b950fcfaf350626e078899
Author: Philipp Oeser
Date:   Thu Aug 15 11:39:45 2019 +0200
Branches: master
https://developer.blender.org/rBff1ea600c98ba542c3b950fcfaf350626e078899

Fix T68675: particle edit mode makes blender crash

In rB9c010c44f420, DRW_mesh_batch_cache_create_requested was changed to
take a scene (instead of toolsettings directly), but
DRW_draw_depth_object is calling this with with NULL, just checking for
this seems to fix...

Reviewers: fclem

Maniphest Tasks: T68675

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

===

M   source/blender/draw/intern/draw_cache_impl_mesh.c

===

diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c 
b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 8c89ac4703c..12c6a715685 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -969,7 +969,10 @@ void DRW_mesh_batch_cache_free_old(Mesh *me, int ctime)
 void DRW_mesh_batch_cache_create_requested(
 Object *ob, Mesh *me, const Scene *scene, const bool is_paint_mode, const 
bool use_hide)
 {
-  const ToolSettings *ts = scene->toolsettings;
+  const ToolSettings *ts = NULL;
+  if (scene) {
+ts = scene->toolsettings;
+  }
   MeshBatchCache *cache = mesh_batch_cache_get(me);
 
   /* Early out */

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


[Bf-blender-cvs] [c7598cd1a51] master: Cleanup: spelling

2019-08-15 Thread Campbell Barton
Commit: c7598cd1a517fd6d0eb9c903d6727dcd1449d1a2
Author: Campbell Barton
Date:   Thu Aug 15 19:50:52 2019 +1000
Branches: master
https://developer.blender.org/rBc7598cd1a517fd6d0eb9c903d6727dcd1449d1a2

Cleanup: spelling

Missed in recent commit.

===

M   source/blender/editors/sculpt_paint/sculpt.c

===

diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index e0e25ad0fb8..440c4d42cae 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -209,14 +209,14 @@ static void sculpt_vertex_tag_update(SculptSession *ss, 
int index)
   }
 }
 
-#  define SCULPT_VERTEX_NEIGHBOUR_FIXED_CAPACITY 256
+#  define SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY 256
 
 typedef struct SculptVertexNeighborIter {
   int *neighbors;
   int size;
   int capacity;
 
-  int neighbors_fixed[SCULPT_VERTEX_NEIGHBOUR_FIXED_CAPACITY];
+  int neighbors_fixed[SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY];
 
   int index;
   int i;
@@ -231,7 +231,7 @@ static void 
sculpt_vertex_neighbor_add(SculptVertexNeighborIter *iter, int neigh
   }
 
   if (iter->size >= iter->capacity) {
-iter->capacity += SCULPT_VERTEX_NEIGHBOUR_FIXED_CAPACITY;
+iter->capacity += SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY;
 
 if (iter->neighbors == iter->neighbors_fixed) {
   iter->neighbors = MEM_mallocN(iter->capacity * sizeof(int), "neighbor 
array");
@@ -255,7 +255,7 @@ static void sculpt_vertex_neighbors_get_bmesh(SculptSession 
*ss,
   BMIter liter;
   BMLoop *l;
   iter->size = 0;
-  iter->capacity = SCULPT_VERTEX_NEIGHBOUR_FIXED_CAPACITY;
+  iter->capacity = SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY;
   iter->neighbors = iter->neighbors_fixed;
 
   int i = 0;
@@ -277,7 +277,7 @@ static void sculpt_vertex_neighbors_get_faces(SculptSession 
*ss,
   int i;
   MeshElemMap *vert_map = >pmap[(int)index];
   iter->size = 0;
-  iter->capacity = SCULPT_VERTEX_NEIGHBOUR_FIXED_CAPACITY;
+  iter->capacity = SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY;
   iter->neighbors = iter->neighbors_fixed;
 
   for (i = 0; i < ss->pmap[(int)index].count; i++) {

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


[Bf-blender-cvs] [e6fa174fd77] master: UI: skip drawing the full-screen when alpha is zero

2019-08-15 Thread Campbell Barton
Commit: e6fa174fd7744a88c1ea9a986fdb9b7e908c9047
Author: Campbell Barton
Date:   Thu Aug 15 18:18:22 2019 +1000
Branches: master
https://developer.blender.org/rBe6fa174fd7744a88c1ea9a986fdb9b7e908c9047

UI: skip drawing the full-screen when alpha is zero

===

M   source/blender/editors/screen/area.c

===

diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index 6f776d3115a..84ac3bfa29d 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -368,7 +368,9 @@ static void region_draw_azones(ScrArea *sa, ARegion *ar)
 }
   }
   else if (az->type == AZONE_FULLSCREEN) {
-area_draw_azone_fullscreen(az->x1, az->y1, az->x2, az->y2, az->alpha);
+if (az->alpha > 0.0f) {
+  area_draw_azone_fullscreen(az->x1, az->y1, az->x2, az->y2, 
az->alpha);
+}
   }
 }
 if (!IS_EQF(az->alpha, 0.0f) && ELEM(az->type, AZONE_FULLSCREEN, 
AZONE_REGION_SCROLL)) {

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


[Bf-blender-cvs] [a2a9c958455] master: Fix T68678: Invisible fullscreen button

2019-08-15 Thread Campbell Barton
Commit: a2a9c95845559b0bfffaf4b6b5e32e31ed3da7a1
Author: Campbell Barton
Date:   Thu Aug 15 18:17:33 2019 +1000
Branches: master
https://developer.blender.org/rBa2a9c95845559b0bfffaf4b6b5e32e31ed3da7a1

Fix T68678: Invisible fullscreen button

Regression from 6148ed8cf9ca

===

M   source/blender/editors/screen/area.c

===

diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index 5099c370a85..6f776d3115a 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -203,7 +203,7 @@ static void area_draw_azone_fullscreen(short x1, short y1, 
short x2, short y2, f
 
   alpha = min_ff(alpha, 0.75f);
 
-  UI_icon_draw_ex(x, y, ICON_FULLSCREEN_EXIT, 0.7f * U.inv_dpi_fac, 0.0f, 
alpha, NULL, false);
+  UI_icon_draw_ex(x, y, ICON_FULLSCREEN_EXIT, 0.7f * U.inv_dpi_fac, alpha, 
0.0f, NULL, false);
 
   /* debug drawing :
* The click_rect is the same as defined in fullscreen_click_rcti_init

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


[Bf-blender-cvs] [eac2a7ab0ec] master: Fix full-screen button overlapping navigation gizmo

2019-08-15 Thread Campbell Barton
Commit: eac2a7ab0ecd7fe90cd58213ca96004a1e6a6d33
Author: Campbell Barton
Date:   Thu Aug 15 19:46:29 2019 +1000
Branches: master
https://developer.blender.org/rBeac2a7ab0ecd7fe90cd58213ca96004a1e6a6d33

Fix full-screen button overlapping navigation gizmo

===

M   source/blender/editors/screen/area.c
M   source/blender/editors/screen/screen_ops.c

===

diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index 84ac3bfa29d..3cf39b67054 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -188,51 +188,17 @@ void ED_area_do_refresh(bContext *C, ScrArea *sa)
 /**
  * \brief Corner widget use for quitting fullscreen.
  */
-static void area_draw_azone_fullscreen(short x1, short y1, short x2, short y2, 
float alpha)
+static void area_draw_azone_fullscreen(
+short UNUSED(x1), short UNUSED(y1), short x2, short y2, float alpha)
 {
-  int x = x2 - ((float)x2 - x1) * 0.5f / UI_DPI_FAC;
-  int y = y2 - ((float)y2 - y1) * 0.5f / UI_DPI_FAC;
-
-  /* adjust the icon distance from the corner */
-  x += 36.0f / UI_DPI_FAC;
-  y += 36.0f / UI_DPI_FAC;
-
-  /* draws from the left bottom corner of the icon */
-  x -= UI_DPI_ICON_SIZE;
-  y -= UI_DPI_ICON_SIZE;
-
-  alpha = min_ff(alpha, 0.75f);
-
-  UI_icon_draw_ex(x, y, ICON_FULLSCREEN_EXIT, 0.7f * U.inv_dpi_fac, alpha, 
0.0f, NULL, false);
-
-  /* debug drawing :
-   * The click_rect is the same as defined in fullscreen_click_rcti_init
-   * Keep them both in sync */
-
-  if (G.debug_value == 101) {
-rcti click_rect;
-float icon_size = UI_DPI_ICON_SIZE + 7 * UI_DPI_FAC;
-
-BLI_rcti_init(_rect, x, x + icon_size, y, y + icon_size);
-
-GPUVertFormat *format = immVertexFormat();
-uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
-
-immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
-
-immUniformColor4f(1.0f, 0.0f, 0.0f, alpha);
-imm_draw_box_wire_2d(pos, click_rect.xmin, click_rect.ymin, 
click_rect.xmax, click_rect.ymax);
-
-immUniformColor4f(0.0f, 1.0f, 1.0f, alpha);
-immBegin(GPU_PRIM_LINES, 4);
-immVertex2f(pos, click_rect.xmin, click_rect.ymin);
-immVertex2f(pos, click_rect.xmax, click_rect.ymax);
-immVertex2f(pos, click_rect.xmin, click_rect.ymax);
-immVertex2f(pos, click_rect.xmax, click_rect.ymin);
-immEnd();
-
-immUnbindProgram();
-  }
+  UI_icon_draw_ex(x2 - U.widget_unit,
+  y2 - U.widget_unit,
+  ICON_FULLSCREEN_EXIT,
+  U.inv_dpi_fac,
+  min_ff(alpha, 0.75f),
+  0.0f,
+  NULL,
+  false);
 }
 
 /**
@@ -908,10 +874,10 @@ static void fullscreen_azone_initialize(ScrArea *sa, 
ARegion *ar)
   az->ar = ar;
   az->alpha = 0.0f;
 
-  az->x1 = ar->winrct.xmax - (AZONEFADEOUT - 1);
-  az->y1 = ar->winrct.ymax - (AZONEFADEOUT - 1);
   az->x2 = ar->winrct.xmax;
   az->y2 = ar->winrct.ymax;
+  az->x1 = az->x2 - AZONEFADEOUT;
+  az->y1 = az->y2 - AZONEFADEOUT;
   BLI_rcti_init(>rect, az->x1, az->x2, az->y1, az->y2);
 }
 
diff --git a/source/blender/editors/screen/screen_ops.c 
b/source/blender/editors/screen/screen_ops.c
index 4fb5e0c1af3..8377fd0e128 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -696,21 +696,9 @@ static bool actionzone_area_poll(bContext *C)
 
 /* the debug drawing of the click_rect is in area_draw_azone_fullscreen, keep 
both in sync */
 static void fullscreen_click_rcti_init(
-rcti *rect, const short x1, const short y1, const short x2, const short y2)
+rcti *rect, const short UNUSED(x1), const short UNUSED(y1), const short 
x2, const short y2)
 {
-  int x = x2 - ((float)x2 - x1) * 0.5f / UI_DPI_FAC;
-  int y = y2 - ((float)y2 - y1) * 0.5f / UI_DPI_FAC;
-  float icon_size = UI_DPI_ICON_SIZE + 7 * UI_DPI_FAC;
-
-  /* adjust the icon distance from the corner */
-  x += 36.0f / UI_DPI_FAC;
-  y += 36.0f / UI_DPI_FAC;
-
-  /* draws from the left bottom corner of the icon */
-  x -= UI_DPI_ICON_SIZE;
-  y -= UI_DPI_ICON_SIZE;
-
-  BLI_rcti_init(rect, x, x + icon_size, y, y + icon_size);
+  BLI_rcti_init(rect, x2 - U.widget_unit, x2, y2 - U.widget_unit, y2);
 }
 
 static bool azone_clipped_rect_calc(const AZone *az, rcti *r_rect_clip)

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


[Bf-blender-cvs] [5b04829d439] master: Cleanup: replace commented out code by comment

2019-08-15 Thread Brecht Van Lommel
Commit: 5b04829d43996267f2dec8ef5a1418e71647b3c5
Author: Brecht Van Lommel
Date:   Thu Aug 15 11:24:19 2019 +0200
Branches: master
https://developer.blender.org/rB5b04829d43996267f2dec8ef5a1418e71647b3c5

Cleanup: replace commented out code by comment

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_edit.c 
b/source/blender/editors/space_view3d/view3d_edit.c
index ec7c1c0b3b9..9a9fe81a13e 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -517,9 +517,6 @@ static void viewops_data_create(bContext *C,
 static void viewops_data_free(bContext *C, wmOperator *op)
 {
   ARegion *ar;
-#if 0
-  Paint *p = BKE_paint_get_active_from_context(C);
-#endif
   if (op->customdata) {
 ViewOpsData *vod = op->customdata;
 ar = vod->ar;
@@ -536,12 +533,9 @@ static void viewops_data_free(bContext *C, wmOperator *op)
 ar = CTX_wm_region(C);
   }
 
-#if 0
-  if (p && (p->flags & PAINT_FAST_NAVIGATE))
-#endif
-  {
-ED_region_tag_redraw(ar);
-  }
+  /* Need to redraw because drawing code uses RV3D_NAVIGATING to draw
+   * faster while navigation operator runs. */
+  ED_region_tag_redraw(ar);
 }
 
 /** \} */

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


[Bf-blender-cvs] [32395dd4e2f] master: UI: Finalize old TODO in UI float number handling.

2019-08-15 Thread Bastien Montagne
Commit: 32395dd4e2f6c18de1678b69bbba6ac38eec674e
Author: Bastien Montagne
Date:   Thu Aug 15 11:07:44 2019 +0200
Branches: master
https://developer.blender.org/rB32395dd4e2f6c18de1678b69bbba6ac38eec674e

UI: Finalize old TODO in UI float number handling.

Just enable some commented-out code from rB636289b755f6ce (disabled at
that time because we were too close of 2.79 release...).

Issue raised in D5486, thanks.

===

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

===

diff --git a/source/blender/editors/interface/interface.c 
b/source/blender/editors/interface/interface.c
index f9c65249918..7a123599be5 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -2553,8 +2553,8 @@ void ui_but_string_get_ex(uiBut *but,
 }
   }
   else {
+const int int_digits_num = integer_digits_f(value);
 if (use_exp_float) {
-  const int int_digits_num = integer_digits_f(value);
   if (int_digits_num < -6 || int_digits_num > 12) {
 BLI_snprintf(str, maxlen, "%.*g", prec, value);
 if (r_use_exp_float) {
@@ -2568,10 +2568,8 @@ void ui_but_string_get_ex(uiBut *but,
   }
 }
 else {
-#if 0 /* TODO, but will likely break some stuff, so better after 2.79 release. 
*/
   prec -= int_digits_num;
   CLAMP(prec, 0, UI_PRECISION_FLOAT_MAX);
-#endif
   BLI_snprintf(str, maxlen, "%.*f", prec, value);
 }
   }

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


  1   2   >