[Bf-blender-cvs] [efc2edc47f7] master: Fix T81190: Merge by Distance marks edges sharp

2020-10-19 Thread Campbell Barton
Commit: efc2edc47f7a6f0f81aba0ed326db17630255b98
Author: Campbell Barton
Date:   Tue Oct 20 14:39:15 2020 +1100
Branches: master
https://developer.blender.org/rBefc2edc47f7a6f0f81aba0ed326db17630255b98

Fix T81190: Merge by Distance marks edges sharp

Make calculating edges sharp optional since it marks nearly all edges
sharp when the normals have been manually rotated.

===

M   source/blender/editors/mesh/editmesh_tools.c

===

diff --git a/source/blender/editors/mesh/editmesh_tools.c 
b/source/blender/editors/mesh/editmesh_tools.c
index b9eac26eaa8..1ceeb3d1fed 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -3349,6 +3349,8 @@ static int edbm_remove_doubles_exec(bContext *C, 
wmOperator *op)
 {
   const float threshold = RNA_float_get(op->ptr, "threshold");
   const bool use_unselected = RNA_boolean_get(op->ptr, "use_unselected");
+  const bool use_sharp_edge_from_normals = RNA_boolean_get(op->ptr, 
"use_sharp_edge_from_normals");
+
   int count_multi = 0;
 
   ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -3409,7 +3411,7 @@ static int edbm_remove_doubles_exec(bContext *C, 
wmOperator *op)
 BM_mesh_elem_hflag_enable_test(em->bm, htype_select, BM_ELEM_SELECT, true, 
true, BM_ELEM_TAG);
 EDBM_selectmode_flush(em);
 
-BM_custom_loop_normals_from_vector_layer(em->bm, true);
+BM_custom_loop_normals_from_vector_layer(em->bm, 
use_sharp_edge_from_normals);
 
 if (count) {
   count_multi += count;
@@ -3451,6 +3453,12 @@ void MESH_OT_remove_doubles(wmOperatorType *ot)
   false,
   "Unselected",
   "Merge selected to other unselected vertices");
+
+  RNA_def_boolean(ot->srna,
+  "use_sharp_edge_from_normals",
+  false,
+  "Sharp Edges",
+  "Calculate sharp edges using custom normal data (when 
available)");
 }
 
 /** \} */

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


[Bf-blender-cvs] [c4668b72e07] master: Cleanup: use BLI_listbase_is_single instead of counting

2020-10-19 Thread Campbell Barton
Commit: c4668b72e073a66ac09aa02622b7d25f1339fcdb
Author: Campbell Barton
Date:   Tue Oct 20 14:16:47 2020 +1100
Branches: master
https://developer.blender.org/rBc4668b72e073a66ac09aa02622b7d25f1339fcdb

Cleanup: use BLI_listbase_is_single instead of counting

===

M   source/blender/editors/gpencil/gpencil_edit.c
M   source/blender/editors/interface/interface_panel.c

===

diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index fa7fe27635a..d54bdf552eb 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -4284,7 +4284,7 @@ static int gpencil_stroke_separate_exec(bContext *C, 
wmOperator *op)
 return OPERATOR_CANCELLED;
   }
 
-  if ((mode == GP_SEPARATE_LAYER) && (BLI_listbase_count(_src->layers) == 
1)) {
+  if ((mode == GP_SEPARATE_LAYER) && 
(BLI_listbase_is_single(_src->layers))) {
 BKE_report(op->reports, RPT_ERROR, "Cannot separate an object with one 
layer only");
 return OPERATOR_CANCELLED;
   }
diff --git a/source/blender/editors/interface/interface_panel.c 
b/source/blender/editors/interface/interface_panel.c
index 991531b4f0d..2a95a34e5e7 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -780,7 +780,7 @@ void UI_panel_header_buttons_end(Panel *panel)
   /* Repurpose the first "header" button group if it is empty, in case the 
first button added to
* the panel doesn't add a new group (if the button is created directly 
rather than through an
* interface layout call). */
-  if (BLI_listbase_count(>button_groups) == 1 &&
+  if (BLI_listbase_is_single(>button_groups) &&
   BLI_listbase_is_empty(_group->buttons)) {
 button_group->flag &= ~UI_BUTTON_GROUP_PANEL_HEADER;
   }

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


[Bf-blender-cvs] [74d1fba1de6] master: Fix Boundary brush not working when the whole mesh is inside the brush radius

2020-10-19 Thread Pablo Dobarro
Commit: 74d1fba1de66362a9365c907ce75881ee2cb2fca
Author: Pablo Dobarro
Date:   Sun Oct 18 19:28:00 2020 +0200
Branches: master
https://developer.blender.org/rB74d1fba1de66362a9365c907ce75881ee2cb2fca

Fix Boundary brush not working when the whole mesh is inside the brush radius

When creating the boundary edit data, the loop can stop because a new
vertex was found further from the boundary than the brush radius or
because all vertices of the mesh were already processed. In this second
case, the max_propagation_step was not set, so the code that laters
calculates the falloff was not working, preventing the mesh from
deforming.

Reviewed By: sergey

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

===

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

===

diff --git a/source/blender/editors/sculpt_paint/sculpt_boundary.c 
b/source/blender/editors/sculpt_paint/sculpt_boundary.c
index 84f2721c31a..5dcaf7d9468 100644
--- a/source/blender/editors/sculpt_paint/sculpt_boundary.c
+++ b/source/blender/editors/sculpt_paint/sculpt_boundary.c
@@ -346,9 +346,9 @@ static void sculpt_boundary_edit_data_init(SculptSession 
*ss,
   float accum_distance = 0.0f;
 
   while (true) {
-/* This steps is further away from the boundary than the brush radius, so 
stop adding more
- * steps. */
-if (accum_distance > radius) {
+/* Stop adding steps to edit info. This happens when a steps is further 
away from the boundary
+ * than the brush radius or when the entire mesh was already processed. */
+if (accum_distance > radius || BLI_gsqueue_is_empty(current_iteration)) {
   boundary->max_propagation_steps = num_propagation_steps;
   break;
 }
@@ -416,12 +416,6 @@ static void sculpt_boundary_edit_data_init(SculptSession 
*ss,
   BLI_gsqueue_push(current_iteration, _v);
 }
 
-/* Stop if no vertices were added in this iteration. At this point, all 
the mesh should have
- * been initialized with the edit data. */
-if (BLI_gsqueue_is_empty(current_iteration)) {
-  break;
-}
-
 num_propagation_steps++;
   }

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


[Bf-blender-cvs] [2b2f3da721b] master: Sculpt: Smooth deform type for Boundary Brush

2020-10-19 Thread Pablo Dobarro
Commit: 2b2f3da721bf3dc4a62c6132e8120c50503e3c15
Author: Pablo Dobarro
Date:   Sun Oct 18 00:16:54 2020 +0200
Branches: master
https://developer.blender.org/rB2b2f3da721bf3dc4a62c6132e8120c50503e3c15

Sculpt: Smooth deform type for Boundary Brush

This adds a smooth deformation type to the boundary brush, which smooths
the boundary and has a regular falloff towards the inside of the mesh.
For smoothing, only vertices parallel to the boundary are taken into
account, creating this effect.

Reviewed By: sergey

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

===

M   source/blender/editors/sculpt_paint/sculpt_boundary.c
M   source/blender/makesdna/DNA_brush_types.h
M   source/blender/makesrna/intern/rna_brush.c

===

diff --git a/source/blender/editors/sculpt_paint/sculpt_boundary.c 
b/source/blender/editors/sculpt_paint/sculpt_boundary.c
index ce8b63ce4f8..84f2721c31a 100644
--- a/source/blender/editors/sculpt_paint/sculpt_boundary.c
+++ b/source/blender/editors/sculpt_paint/sculpt_boundary.c
@@ -868,6 +868,66 @@ static void do_boundary_brush_twist_task_cb_ex(void 
*__restrict userdata,
   BKE_pbvh_vertex_iter_end;
 }
 
+static void do_boundary_brush_smooth_task_cb_ex(void *__restrict userdata,
+const int n,
+const TaskParallelTLS 
*__restrict UNUSED(tls))
+{
+  SculptThreadedTaskData *data = userdata;
+  SculptSession *ss = data->ob->sculpt;
+  const int symmetry_pass = ss->cache->mirror_symmetry_pass;
+  const SculptBoundary *boundary = ss->cache->boundaries[symmetry_pass];
+  const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(data->ob);
+  const Brush *brush = data->brush;
+
+  const float strength = ss->cache->bstrength;
+
+  PBVHVertexIter vd;
+  SculptOrigVertData orig_data;
+  SCULPT_orig_vert_data_init(_data, data->ob, data->nodes[n]);
+
+  BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
+  {
+if (boundary->edit_info[vd.index].num_propagation_steps == -1) {
+  continue;
+}
+
+SCULPT_orig_vert_data_update(_data, );
+if (!SCULPT_check_vertex_pivot_symmetry(
+orig_data.co, boundary->initial_vertex_position, symm)) {
+  continue;
+}
+
+float coord_accum[3] = {0.0f, 0.0f, 0.0f};
+int total_neighbors = 0;
+const int current_propagation_steps = 
boundary->edit_info[vd.index].num_propagation_steps;
+SculptVertexNeighborIter ni;
+SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vd.index, ni) {
+  if (current_propagation_steps == 
boundary->edit_info[ni.index].num_propagation_steps) {
+add_v3_v3(coord_accum, SCULPT_vertex_co_get(ss, ni.index));
+total_neighbors++;
+  }
+}
+SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
+
+if (total_neighbors == 0) {
+  continue;
+}
+float disp[3];
+float avg[3];
+const float mask = vd.mask ? 1.0f - *vd.mask : 1.0f;
+mul_v3_v3fl(avg, coord_accum, 1.0f / total_neighbors);
+sub_v3_v3v3(disp, avg, vd.co);
+float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, 
brush->deform_target, );
+madd_v3_v3v3fl(
+target_co, vd.co, disp, boundary->edit_info[vd.index].strength_factor 
* mask * strength);
+
+if (vd.mvert) {
+  vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+}
+  }
+  BKE_pbvh_vertex_iter_end;
+}
+
 /* Main Brush Function. */
 void SCULPT_do_boundary_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int 
totnode)
 {
@@ -945,6 +1005,9 @@ void SCULPT_do_boundary_brush(Sculpt *sd, Object *ob, 
PBVHNode **nodes, int totn
 case BRUSH_BOUNDARY_DEFORM_TWIST:
   BLI_task_parallel_range(0, totnode, , 
do_boundary_brush_twist_task_cb_ex, );
   break;
+case BRUSH_BOUNDARY_DEFORM_SMOOTH:
+  BLI_task_parallel_range(0, totnode, , 
do_boundary_brush_smooth_task_cb_ex, );
+  break;
   }
 }
 
diff --git a/source/blender/makesdna/DNA_brush_types.h 
b/source/blender/makesdna/DNA_brush_types.h
index 8437d782e98..37b7947dbea 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -388,6 +388,7 @@ typedef enum eBrushBoundaryDeformType {
   BRUSH_BOUNDARY_DEFORM_INFLATE = 2,
   BRUSH_BOUNDARY_DEFORM_GRAB = 3,
   BRUSH_BOUNDARY_DEFORM_TWIST = 4,
+  BRUSH_BOUNDARY_DEFORM_SMOOTH = 5,
 } eBrushBushBoundaryDeformType;
 
 typedef enum eBrushBoundaryFalloffType {
diff --git a/source/blender/makesrna/intern/rna_brush.c 
b/source/blender/makesrna/intern/rna_brush.c
index ac876eac7db..d119be66916 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -2181,6 +2181,7 @@ static void rna_def_brush(BlenderRNA *brna)
   {BRUSH_BOUNDARY_DEFORM_INFLATE, "INFLATE", 0, "Inflate", ""},
   {BRUSH_BOUNDARY_DEFORM_GRAB, "GRAB", 0, "Grab", ""},
   

[Bf-blender-cvs] [013c963b7c2] usd-importer-T81257: USD importer: cleaned up USD API calls.

2020-10-19 Thread Michael A. Kowalski
Commit: 013c963b7c2959b633f5ae6acfd2fa5819e8147c
Author: Michael A. Kowalski
Date:   Mon Oct 19 19:39:22 2020 -0400
Branches: usd-importer-T81257
https://developer.blender.org/rB013c963b7c2959b633f5ae6acfd2fa5819e8147c

USD importer:  cleaned up USD API calls.

===

M   source/blender/io/usd/import/usd_import_util.cc

===

diff --git a/source/blender/io/usd/import/usd_import_util.cc 
b/source/blender/io/usd/import/usd_import_util.cc
index 6389fec0e28..cac7a5e271d 100644
--- a/source/blender/io/usd/import/usd_import_util.cc
+++ b/source/blender/io/usd/import/usd_import_util.cc
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -92,10 +93,10 @@ static UsdObjectReader *get_reader(const pxr::UsdPrim 
, const USDImporterCo
 {
   UsdObjectReader *result = nullptr;
 
-  if (prim.GetTypeName() == usdtokens::mesh_type) {
+  if (prim.IsA()) {
 result = new UsdMeshReader(prim, context);
   }
-  else if (prim.GetTypeName() == usdtokens::xform_type) {
+  else if (prim.IsA()) {
 result = new UsdTransformReader(prim, context);
   }
 
@@ -347,7 +348,7 @@ void create_readers(const pxr::UsdPrim ,
 return;
   }
 
-  bool is_root = prim.GetTypeName().IsEmpty();
+  bool is_root = prim.IsPseudoRoot();
 
   std::vector child_readers;
 
@@ -367,9 +368,7 @@ void create_readers(const pxr::UsdPrim ,
   /* We prune away empty transform or scope hierarchies (we can add an import 
flag to make this
* behavior optional).  Therefore, we skip this prim if it's an Xform or 
Scope and if
* it has no corresponding child readers. */
-  if ((prim.GetTypeName() == usdtokens::xform_type ||
-   prim.GetTypeName() == usdtokens::scope_type) &&
-  child_readers.empty()) {
+  if ((prim.IsA() || prim.IsA()) && 
child_readers.empty()) {
 return;
   }
 
@@ -379,9 +378,9 @@ void create_readers(const pxr::UsdPrim ,
* can be merged will be expanded as we support more reader types
* (e.g., for lights, curves, etc.). */
 
-  if (prim.GetTypeName() == usdtokens::xform_type && child_readers.size() == 1 
&&
+  if (prim.IsA() && child_readers.size() == 1 &&
   !child_readers.front()->merged_with_parent() &&
-  child_readers.front()->prim().GetTypeName() == usdtokens::mesh_type) {
+  child_readers.front()->prim().IsA()) {
 child_readers.front()->set_merged_with_parent(true);
 /* Don't create a reader for the Xform but, instead, return the grandchild
  * that we merged. */

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


[Bf-blender-cvs] [f780bfafcfa] master: Fix missing Sculpt Overlays updates when using modifiers

2020-10-19 Thread Pablo Dobarro
Commit: f780bfafcfa988d1415f5758ceebbe1b4aee9ba7
Author: Pablo Dobarro
Date:   Wed Oct 14 01:54:46 2020 +0200
Branches: master
https://developer.blender.org/rBf780bfafcfa988d1415f5758ceebbe1b4aee9ba7

Fix missing Sculpt Overlays updates when using modifiers

Now that sculpt mask and face sets can also be drawn without using the
PBVH, these operators need these extra updates when the data changes.

Reviewed By: sergey

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

===

M   source/blender/editors/sculpt_paint/paint_mask.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_face_set.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h

===

diff --git a/source/blender/editors/sculpt_paint/paint_mask.c 
b/source/blender/editors/sculpt_paint/paint_mask.c
index 8c912290997..4eef43d0d03 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -150,7 +150,6 @@ static void mask_flood_fill_task_cb(void *__restrict 
userdata,
 
 static int mask_flood_fill_exec(bContext *C, wmOperator *op)
 {
-  ARegion *region = CTX_wm_region(C);
   Object *ob = CTX_data_active_object(C);
   Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
   PaintMaskFloodMode mode;
@@ -196,9 +195,7 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op)
 MEM_freeN(nodes);
   }
 
-  ED_region_tag_redraw(region);
-
-  WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+  SCULPT_tag_update_overlays(C);
 
   return OPERATOR_FINISHED;
 }
diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index 5ef0b49adf7..3ded57d938f 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1047,6 +1047,21 @@ bool SCULPT_is_vertex_inside_brush_radius_symm(const 
float vertex[3],
   return false;
 }
 
+void SCULPT_tag_update_overlays(bContext *C)
+{
+  ARegion *region = CTX_wm_region(C);
+  ED_region_tag_redraw(region);
+
+  Object *ob = CTX_data_active_object(C);
+  WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+
+  DEG_id_tag_update(>id, ID_RECALC_SHADING);
+  View3D *v3d = CTX_wm_view3d(C);
+  if (!BKE_sculptsession_use_pbvh_draw(ob, v3d)) {
+DEG_id_tag_update(>id, ID_RECALC_GEOMETRY);
+  }
+}
+
 /* Sculpt Flood Fill API
  *
  * Iterate over connected vertices, starting from one or more initial 
vertices. */
diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c 
b/source/blender/editors/sculpt_paint/sculpt_face_set.c
index 152d23dfa5b..af6a06caf69 100644
--- a/source/blender/editors/sculpt_paint/sculpt_face_set.c
+++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c
@@ -303,7 +303,6 @@ static int sculpt_face_set_create_exec(bContext *C, 
wmOperator *op)
 {
   Object *ob = CTX_data_active_object(C);
   SculptSession *ss = ob->sculpt;
-  ARegion *region = CTX_wm_region(C);
   Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
 
   const int mode = RNA_enum_get(op->ptr, "mode");
@@ -406,8 +405,7 @@ static int sculpt_face_set_create_exec(bContext *C, 
wmOperator *op)
 
   SCULPT_undo_push_end();
 
-  ED_region_tag_redraw(region);
-  WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+  SCULPT_tag_update_overlays(C);
 
   return OPERATOR_FINISHED;
 }
@@ -664,7 +662,6 @@ static int sculpt_face_set_init_exec(bContext *C, 
wmOperator *op)
 {
   Object *ob = CTX_data_active_object(C);
   SculptSession *ss = ob->sculpt;
-  ARegion *region = CTX_wm_region(C);
   Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
 
   const int mode = RNA_enum_get(op->ptr, "mode");
@@ -734,13 +731,7 @@ static int sculpt_face_set_init_exec(bContext *C, 
wmOperator *op)
 BKE_mesh_flush_hidden_from_verts(ob->data);
   }
 
-  ED_region_tag_redraw(region);
-  DEG_id_tag_update(>id, ID_RECALC_SHADING);
-
-  View3D *v3d = CTX_wm_view3d(C);
-  if (!BKE_sculptsession_use_pbvh_draw(ob, v3d)) {
-DEG_id_tag_update(>id, ID_RECALC_GEOMETRY);
-  }
+  SCULPT_tag_update_overlays(C);
 
   return OPERATOR_FINISHED;
 }
@@ -823,7 +814,6 @@ static int sculpt_face_sets_change_visibility_exec(bContext 
*C, wmOperator *op)
 {
   Object *ob = CTX_data_active_object(C);
   SculptSession *ss = ob->sculpt;
-  ARegion *region = CTX_wm_region(C);
   Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
 
   /* Dyntopo not supported. */
@@ -924,13 +914,12 @@ static int 
sculpt_face_sets_change_visibility_exec(bContext *C, wmOperator *op)
 
   MEM_SAFE_FREE(nodes);
 
-  ED_region_tag_redraw(region);
-  DEG_id_tag_update(>id, ID_RECALC_SHADING);
-
-  View3D *v3d = CTX_wm_view3d(C);
-  if (!BKE_sculptsession_use_pbvh_draw(ob, v3d)) {
-DEG_id_tag_update(>id, ID_RECALC_GEOMETRY);
+  if (BKE_pbvh_type(pbvh) == PBVH_FACES) {
+BKE_mesh_flush_hidden_from_verts(ob->data);
   }
+
+  

[Bf-blender-cvs] [48fd10a77dd] master: Sculpt: Reduce the displacement step in the cloth solver

2020-10-19 Thread Pablo Dobarro
Commit: 48fd10a77dd8e53eb0ef063ce11bf4086fdb9f17
Author: Pablo Dobarro
Date:   Sun Oct 18 01:10:19 2020 +0200
Branches: master
https://developer.blender.org/rB48fd10a77dd8e53eb0ef063ce11bf4086fdb9f17

Sculpt: Reduce the displacement step in the cloth solver

Previously the base displacement for solving the constraints was always
using 0.5, which may introduce artifacts when multiple constraints of
different types are computed for the same vertex. This introduces a
factor that reduces the base displacement of the solver, reducing the
artifacts.

Reviewed By: sergey

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

===

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

===

diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c 
b/source/blender/editors/sculpt_paint/sculpt_cloth.c
index 591168fd3a2..1a1200bb6c2 100644
--- a/source/blender/editors/sculpt_paint/sculpt_cloth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c
@@ -153,6 +153,8 @@ static float cloth_brush_simulation_falloff_get(const Brush 
*brush,
 
 #define CLOTH_LENGTH_CONSTRAINTS_BLOCK 10
 #define CLOTH_SIMULATION_ITERATIONS 5
+
+#define CLOTH_SOLVER_DISPLACEMENT_FACTOR 0.6f
 #define CLOTH_MAX_CONSTRAINTS_PER_VERTEX 1024
 #define CLOTH_SIMULATION_TIME_STEP 0.01f
 #define CLOTH_DEFORMATION_SNAKEHOOK_STRENGTH 0.35f
@@ -805,10 +807,13 @@ static void cloth_brush_satisfy_constraints(SculptSession 
*ss,
 
(cloth_sim->length_constraint_tweak[v2] * 0.5f);
 
   if (current_distance > 0.0f) {
-mul_v3_v3fl(correction_vector, v1_to_v2, 1.0f - (constraint_distance / 
current_distance));
+mul_v3_v3fl(correction_vector,
+v1_to_v2,
+CLOTH_SOLVER_DISPLACEMENT_FACTOR *
+(1.0f - (constraint_distance / current_distance)));
   }
   else {
-copy_v3_v3(correction_vector, v1_to_v2);
+mul_v3_v3fl(correction_vector, v1_to_v2, 
CLOTH_SOLVER_DISPLACEMENT_FACTOR);
   }
 
   mul_v3_v3fl(correction_vector_half, correction_vector, 0.5f);

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


[Bf-blender-cvs] [ea4d28aea03] master: UI: In-line layout for Empty Image Transparency

2020-10-19 Thread Pablo Vazquez
Commit: ea4d28aea0343afbd9b1cddc9fc20679f234945e
Author: Pablo Vazquez
Date:   Tue Oct 20 00:48:11 2020 +0200
Branches: master
https://developer.blender.org/rBea4d28aea0343afbd9b1cddc9fc20679f234945e

UI: In-line layout for Empty Image Transparency

No need for a sub-panel with a single property (same as mesh
normals auto-smooth, camera passepartout, etc).

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_data_empty.py 
b/release/scripts/startup/bl_ui/properties_data_empty.py
index 1523f69536f..c8a1d9e238c 100644
--- a/release/scripts/startup/bl_ui/properties_data_empty.py
+++ b/release/scripts/startup/bl_ui/properties_data_empty.py
@@ -59,29 +59,15 @@ class DATA_PT_empty(DataButtonsPanel, Panel):
 col.prop(ob, "show_empty_image_perspective", text="Perspective")
 col.prop(ob, "show_empty_image_only_axis_aligned", text="Only Axis 
Aligned")
 
-
-class DATA_PT_empty_alpha(DataButtonsPanel, Panel):
-bl_label = "Transparency"
-bl_parent_id = "DATA_PT_empty"
-
-@classmethod
-def poll(cls, context):
-ob = context.object
-return (ob and ob.type == 'EMPTY' and ob.empty_display_type == 'IMAGE')
-
-def draw_header(self, context):
-ob = context.object
-
-self.layout.prop(ob, "use_empty_image_alpha", text="")
-
-def draw(self, context):
-layout = self.layout
-layout.use_property_split = True
-
-ob = context.object
-
-layout.active = ob.use_empty_image_alpha
-layout.prop(ob, "color", text="Opacity", index=3, slider=True)
+col = layout.column(align=False, heading="Transparency")
+col.use_property_decorate = False
+row = col.row(align=True)
+sub = row.row(align=True)
+sub.prop(ob, "use_empty_image_alpha", text="")
+sub = sub.row(align=True)
+sub.active = ob.use_empty_image_alpha
+sub.prop(ob, "color", text="", index=3, slider=True)
+row.prop_decorator(ob, "color", index=3)
 
 
 class DATA_PT_empty_image(DataButtonsPanel, Panel):
@@ -102,7 +88,6 @@ class DATA_PT_empty_image(DataButtonsPanel, Panel):
 
 classes = (
 DATA_PT_empty,
-DATA_PT_empty_alpha,
 DATA_PT_empty_image,
 )

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


[Bf-blender-cvs] [31108f93597] master: UI: Sort "Volume to Mesh" and "Mesh to Volume" in alphabetical order

2020-10-19 Thread Pablo Vazquez
Commit: 31108f93597adc3a01058cbd7154b274b2402fdd
Author: Pablo Vazquez
Date:   Tue Oct 20 00:12:45 2020 +0200
Branches: master
https://developer.blender.org/rB31108f93597adc3a01058cbd7154b274b2402fdd

UI: Sort "Volume to Mesh" and "Mesh to Volume" in alphabetical order

===

M   source/blender/makesrna/intern/rna_modifier.c

===

diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index 066bf309caa..9e0597f000b 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -151,6 +151,11 @@ const EnumPropertyItem 
rna_enum_object_modifier_type_items[] = {
  ICON_MOD_MIRROR,
  "Mirror",
  "Mirror along the local X, Y and/or Z axes, over the object origin"},
+{eModifierType_MeshToVolume,
+ "MESH_TO_VOLUME",
+ ICON_VOLUME_DATA,
+ "Mesh to Volume",
+ ""}, /* TODO: Use correct icon. */
 {eModifierType_Multires,
  "MULTIRES",
  ICON_MOD_MULTIRES,
@@ -183,6 +188,11 @@ const EnumPropertyItem 
rna_enum_object_modifier_type_items[] = {
  ICON_MOD_TRIANGULATE,
  "Triangulate",
  "Convert all polygons to triangles"},
+{eModifierType_VolumeToMesh,
+ "VOLUME_TO_MESH",
+ ICON_VOLUME_DATA,
+ "Volume to Mesh",
+ ""}, /* TODO: Use correct icon. */
 {eModifierType_Weld,
  "WELD",
  ICON_AUTOMERGE_OFF,
@@ -193,16 +203,6 @@ const EnumPropertyItem 
rna_enum_object_modifier_type_items[] = {
  ICON_MOD_WIREFRAME,
  "Wireframe",
  "Convert faces into thickened edges"},
-{eModifierType_MeshToVolume,
- "MESH_TO_VOLUME",
- ICON_VOLUME_DATA,
- "Mesh to Volume",
- ""}, /* TODO: Use correct icon. */
-{eModifierType_VolumeToMesh,
- "VOLUME_TO_MESH",
- ICON_VOLUME_DATA,
- "Volume to Mesh",
- ""}, /* TODO: Use correct icon. */
 {0, "", 0, N_("Deform"), ""},
 {eModifierType_Armature,
  "ARMATURE",

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


[Bf-blender-cvs] [c6c49257710] master: Fluid: Added domain check for new OpenVDB precision 'Mini' type

2020-10-19 Thread Sebastián Barschkis
Commit: c6c49257710c4c7976601de54bcddc45eb9ee206
Author: Sebastián Barschkis
Date:   Mon Oct 19 21:40:04 2020 +0200
Branches: master
https://developer.blender.org/rBc6c49257710c4c7976601de54bcddc45eb9ee206

Fluid: Added domain check for new OpenVDB precision 'Mini' type

Precision 'Mini' should only be available for liquids domains.

===

M   source/blender/blenkernel/BKE_fluid.h
M   source/blender/blenkernel/intern/fluid.c
M   source/blender/makesrna/intern/rna_fluid.c

===

diff --git a/source/blender/blenkernel/BKE_fluid.h 
b/source/blender/blenkernel/BKE_fluid.h
index 87e1c7a57ed..33ff6943514 100644
--- a/source/blender/blenkernel/BKE_fluid.h
+++ b/source/blender/blenkernel/BKE_fluid.h
@@ -93,7 +93,7 @@ void BKE_fluid_flow_type_set(struct Object *object, struct 
FluidFlowSettings *se
 void BKE_fluid_effector_type_set(struct Object *object,
  struct FluidEffectorSettings *settings,
  int type);
-void BKE_fluid_coba_field_sanitize(struct FluidDomainSettings *settings);
+void BKE_fluid_fields_sanitize(struct FluidDomainSettings *settings);
 void BKE_fluid_flow_behavior_set(struct Object *object,
  struct FluidFlowSettings *settings,
  int behavior);
diff --git a/source/blender/blenkernel/intern/fluid.c 
b/source/blender/blenkernel/intern/fluid.c
index 7392c9161b8..f66ba428611 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -4683,24 +4683,31 @@ void BKE_fluid_effector_type_set(Object 
*UNUSED(object), FluidEffectorSettings *
   settings->type = type;
 }
 
-void BKE_fluid_coba_field_sanitize(FluidDomainSettings *settings)
+void BKE_fluid_fields_sanitize(FluidDomainSettings *settings)
 {
-  /* Based on the domain type, the coba field is defaulted accordingly if the 
selected field
+  /* Based on the domain type, certain fields are defaulted accordingly if the 
selected field
* is unsupported. */
-  const char field = settings->coba_field;
+  const char coba_field = settings->coba_field;
+  const char data_depth = settings->openvdb_data_depth;
 
   if (settings->type == FLUID_DOMAIN_TYPE_GAS) {
-if (field == FLUID_DOMAIN_FIELD_PHI || field == FLUID_DOMAIN_FIELD_PHI_IN 
||
-field == FLUID_DOMAIN_FIELD_PHI_OUT || field == 
FLUID_DOMAIN_FIELD_PHI_OBSTACLE) {
+if (coba_field == FLUID_DOMAIN_FIELD_PHI || coba_field == 
FLUID_DOMAIN_FIELD_PHI_IN ||
+coba_field == FLUID_DOMAIN_FIELD_PHI_OUT ||
+coba_field == FLUID_DOMAIN_FIELD_PHI_OBSTACLE) {
   /* Defaulted to density for gas domain. */
   settings->coba_field = FLUID_DOMAIN_FIELD_DENSITY;
 }
+
+/* Gas domains do not support vdb mini precision. */
+if (data_depth == VDB_PRECISION_MINI_FLOAT) {
+  settings->openvdb_data_depth = VDB_PRECISION_HALF_FLOAT;
+}
   }
   else if (settings->type == FLUID_DOMAIN_TYPE_LIQUID) {
-if (field == FLUID_DOMAIN_FIELD_COLOR_R || field == 
FLUID_DOMAIN_FIELD_COLOR_G ||
-field == FLUID_DOMAIN_FIELD_COLOR_B || field == 
FLUID_DOMAIN_FIELD_DENSITY ||
-field == FLUID_DOMAIN_FIELD_FLAME || field == FLUID_DOMAIN_FIELD_FUEL 
||
-field == FLUID_DOMAIN_FIELD_HEAT) {
+if (coba_field == FLUID_DOMAIN_FIELD_COLOR_R || coba_field == 
FLUID_DOMAIN_FIELD_COLOR_G ||
+coba_field == FLUID_DOMAIN_FIELD_COLOR_B || coba_field == 
FLUID_DOMAIN_FIELD_DENSITY ||
+coba_field == FLUID_DOMAIN_FIELD_FLAME || coba_field == 
FLUID_DOMAIN_FIELD_FUEL ||
+coba_field == FLUID_DOMAIN_FIELD_HEAT) {
   /* Defaulted to phi for liquid domain. */
   settings->coba_field = FLUID_DOMAIN_FIELD_PHI;
 }
diff --git a/source/blender/makesrna/intern/rna_fluid.c 
b/source/blender/makesrna/intern/rna_fluid.c
index ad117933764..84187786c46 100644
--- a/source/blender/makesrna/intern/rna_fluid.c
+++ b/source/blender/makesrna/intern/rna_fluid.c
@@ -665,12 +665,205 @@ static void rna_Fluid_cache_directory_set(struct 
PointerRNA *ptr, const char *va
   // settings->cache_flag = 0;
 }
 
+static const EnumPropertyItem *rna_Fluid_cobafield_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA 
*UNUSED(prop),
+ bool *r_free)
+{
+  FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
+
+  EnumPropertyItem *item = NULL;
+  EnumPropertyItem tmp = {0, "", 0, "", ""};
+  int totitem = 0;
+
+  tmp.value = FLUID_DOMAIN_FIELD_FLAGS;
+  tmp.identifier = "FLAGS";
+  tmp.icon = 0;
+  tmp.name = "Flags";
+  tmp.description = "Flag grid of the fluid domain";
+  RNA_enum_item_add(, , );
+
+  tmp.value = FLUID_DOMAIN_FIELD_PRESSURE;
+  tmp.identifier = "PRESSURE";
+  tmp.icon 

[Bf-blender-cvs] [aa244a7a68d] master: UI: Simplified Categorized Menus

2020-10-19 Thread Harley Acheson
Commit: aa244a7a68db75111b4afc12b39c8d8c4297e528
Author: Harley Acheson
Date:   Mon Oct 19 11:28:38 2020 -0700
Branches: master
https://developer.blender.org/rBaa244a7a68db75111b4afc12b39c8d8c4297e528

UI: Simplified Categorized Menus

Menus with categories gain a dividing line and omit the title.

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

Reviewed by Brecht Van Lommel

===

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

===

diff --git a/source/blender/editors/interface/interface.c 
b/source/blender/editors/interface/interface.c
index afc9d9884f3..b3ed6ac09b3 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -4148,12 +4148,14 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), 
uiLayout *layout, void *bu
   UI_block_layout_set_current(block, layout);
 
   int totitems = 0;
+  int categories = 0;
   int nbr_entries_nosepr = 0;
   for (const EnumPropertyItem *item = item_array; item->identifier; item++, 
totitems++) {
 if (!item->identifier[0]) {
   /* inconsistent, but menus with categories do not look good flipped */
   if (item->name) {
 block->flag |= UI_BLOCK_NO_FLIP;
+categories++;
 nbr_entries_nosepr++;
   }
   /* We do not want simple separators in nbr_entries_nosepr count */
@@ -4179,22 +4181,12 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), 
uiLayout *layout, void *bu
 rows++;
   }
 
-  if (block->flag & UI_BLOCK_NO_FLIP) {
+  const char *title = RNA_property_ui_name(but->rnaprop);
+
+  if (title[0] && (categories == 0) && (block->flag & UI_BLOCK_NO_FLIP)) {
 /* Title at the top for menus with categories. */
-uiDefBut(block,
- UI_BTYPE_LABEL,
- 0,
- RNA_property_ui_name(but->rnaprop),
- 0,
- 0,
- UI_UNIT_X * 5,
- UI_UNIT_Y,
- NULL,
- 0.0,
- 0.0,
- 0,
- 0,
- "");
+uiDefBut(
+block, UI_BTYPE_LABEL, 0, title, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 
0.0, 0.0, 0, 0, "");
 uiItemS(layout);
   }
 
@@ -4203,10 +4195,13 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), 
uiLayout *layout, void *bu
   /* create items */
   uiLayout *split = uiLayoutSplit(layout, 0.0f, false);
 
+  bool new_column;
+
   int column_end = 0;
   uiLayout *column = NULL;
   for (int a = 0; a < totitems; a++) {
-if (a == column_end) {
+new_column = (a == column_end);
+if (new_column) {
   /* start new column, and find out where it ends in advance, so we
* can flip the order of items properly per column */
   column_end = totitems;
@@ -4226,6 +4221,11 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), 
uiLayout *layout, void *bu
 
 const EnumPropertyItem *item = _array[a];
 
+if (new_column && (categories > 0) && item->identifier[0]) {
+  uiItemL(column, "", ICON_NONE);
+  uiItemS(column);
+}
+
 if (!item->identifier[0]) {
   if (item->name) {
 if (item->icon) {
@@ -4249,8 +4249,6 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), 
uiLayout *layout, void *bu
0,
"");
 }
-  }
-  else {
 uiItemS(column);
   }
 }
@@ -4291,23 +4289,11 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), 
uiLayout *layout, void *bu
 }
   }
 
-  if (!(block->flag & UI_BLOCK_NO_FLIP)) {
+  if (title[0] && (categories == 0) && !(block->flag & UI_BLOCK_NO_FLIP)) {
 /* Title at the bottom for menus without categories. */
 uiItemS(layout);
-uiDefBut(block,
- UI_BTYPE_LABEL,
- 0,
- RNA_property_ui_name(but->rnaprop),
- 0,
- 0,
- UI_UNIT_X * 5,
- UI_UNIT_Y,
- NULL,
- 0.0,
- 0.0,
- 0,
- 0,
- "");
+uiDefBut(
+block, UI_BTYPE_LABEL, 0, title, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 
0.0, 0.0, 0, 0, "");
   }
 
   UI_block_layout_set_current(block, layout);
diff --git a/source/blender/editors/interface/interface_layout.c 
b/source/blender/editors/interface/interface_layout.c
index 3e276a69277..ad260274e78 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1542,6 +1542,7 @@ void uiItemsFullEnumO_items(uiLayout *layout,
  0,
  0,
  "");
+  uiItemS(target);
 }
 ui_but_tip_from_enum_item(but, item);
   }

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

[Bf-blender-cvs] [1e3742749eb] master: UI: 3DView Popover Adjustments

2020-10-19 Thread Harley Acheson
Commit: 1e3742749ebaf231a0c0c43a373cad6c740a0b91
Author: Harley Acheson
Date:   Mon Oct 19 10:55:05 2020 -0700
Branches: master
https://developer.blender.org/rB1e3742749ebaf231a0c0c43a373cad6c740a0b91

UI: 3DView Popover Adjustments

Slight adjustments to widths, and adds gaps below titles, of 'Viewport Gizmos' 
and 'Object Types Visibility' popovers.

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

Reviewed by Pablo Vazquez

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 41f555f380f..38f2c67f501 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -5549,7 +5549,7 @@ class VIEW3D_PT_object_type_visibility(Panel):
 bl_space_type = 'VIEW_3D'
 bl_region_type = 'HEADER'
 bl_label = "View Object Types"
-bl_ui_units_x = 6
+bl_ui_units_x = 7
 
 def draw(self, context):
 layout = self.layout
@@ -5559,6 +5559,7 @@ class VIEW3D_PT_object_type_visibility(Panel):
 view = context.space_data
 
 layout.label(text="Object Types Visibility")
+layout.separator()
 col = layout.column()
 
 attr_object_types = (
@@ -5933,6 +5934,7 @@ class VIEW3D_PT_gizmo_display(Panel):
 bl_space_type = 'VIEW_3D'
 bl_region_type = 'HEADER'
 bl_label = "Gizmo"
+bl_ui_units_x = 8
 
 def draw(self, context):
 layout = self.layout
@@ -5942,6 +5944,7 @@ class VIEW3D_PT_gizmo_display(Panel):
 
 col = layout.column()
 col.label(text="Viewport Gizmos")
+col.separator()
 
 col.active = view.show_gizmo
 colsub = col.column()

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


[Bf-blender-cvs] [3d26cd01b9b] master: Spelling: Apart Versus A Part

2020-10-19 Thread Harley Acheson
Commit: 3d26cd01b9ba6381eb165e11536345ae652dfb41
Author: Harley Acheson
Date:   Mon Oct 19 09:40:02 2020 -0700
Branches: master
https://developer.blender.org/rB3d26cd01b9ba6381eb165e11536345ae652dfb41

Spelling: Apart Versus A Part

Corrects incorrect usages of the fragment 'apart of' when 'a part of' was 
required.

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

Reviewed by Campbell Barton

===

M   source/blender/blenkernel/intern/object.c
M   source/blender/bmesh/bmesh.h
M   source/blender/bmesh/intern/bmesh_core.c
M   source/blender/bmesh/intern/bmesh_marking.c
M   source/blender/bmesh/intern/bmesh_opdefines.c
M   source/blender/bmesh/intern/bmesh_polygon_edgenet.c
M   source/blender/bmesh/intern/bmesh_walkers_impl.c
M   source/blender/bmesh/tools/bmesh_beautify.c
M   source/blender/editors/mesh/editmesh_select.c
M   source/blender/editors/transform/transform_orientations.c

===

diff --git a/source/blender/blenkernel/intern/object.c 
b/source/blender/blenkernel/intern/object.c
index f4c4ccbc1d0..398860b6796 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -4375,7 +4375,7 @@ LinkNode *BKE_object_relational_superset(struct ViewLayer 
*view_layer,
 }
 
 /**
- * return all groups this object is apart of, caller must free.
+ * return all groups this object is a part of, caller must free.
  */
 struct LinkNode *BKE_object_groups(Main *bmain, Scene *scene, Object *ob)
 {
diff --git a/source/blender/bmesh/bmesh.h b/source/blender/bmesh/bmesh.h
index 5d2f739651b..4441ccc0c88 100644
--- a/source/blender/bmesh/bmesh.h
+++ b/source/blender/bmesh/bmesh.h
@@ -164,7 +164,7 @@
  *
  * - ``bmesh_kernel_*()`` - Low level API, for primitive functions that others 
are built ontop of.
  * - ``bmesh_***()`` - Low level API function.
- * - ``bm_***()`` - 'static' functions, not apart of the API at all,
+ * - ``bm_***()`` - 'static' functions, not a part of the API at all,
  *   but use prefix since they operate on BMesh data.
  * - ``BM_***()`` - High level BMesh API function for use anywhere.
  * - ``BMO_***()`` -High level operator API function for use anywhere.
diff --git a/source/blender/bmesh/intern/bmesh_core.c 
b/source/blender/bmesh/intern/bmesh_core.c
index 32ca90f5c13..d5ebc73dc1e 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -2913,7 +2913,7 @@ static void bmesh_edge_vert_swap__recursive(BMEdge *e, 
BMVert *v_dst, BMVert *v_
 }
 
 /**
- * This function assumes l_sep is apart of a larger fan which has already been
+ * This function assumes l_sep is a part of a larger fan which has already been
  * isolated by calling #bmesh_kernel_edge_separate to segregate it radially.
  */
 BMVert *bmesh_kernel_unglue_region_make_vert_multi_isolated(BMesh *bm, BMLoop 
*l_sep)
diff --git a/source/blender/bmesh/intern/bmesh_marking.c 
b/source/blender/bmesh/intern/bmesh_marking.c
index 61df8cf0c25..a5d02cdc4e5 100644
--- a/source/blender/bmesh/intern/bmesh_marking.c
+++ b/source/blender/bmesh/intern/bmesh_marking.c
@@ -163,7 +163,7 @@ static bool bm_edge_is_face_visible_any(const BMEdge *e)
  * Remove isolated selected elements when in a mode doesn't support them.
  * eg: in edge-mode a selected vertex must be connected to a selected edge.
  *
- * \note this could be made apart of #BM_mesh_select_mode_flush_ex
+ * \note this could be made a part of #BM_mesh_select_mode_flush_ex
  */
 void BM_mesh_select_mode_clean_ex(BMesh *bm, const short selectmode)
 {
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c 
b/source/blender/bmesh/intern/bmesh_opdefines.c
index ea64c9415b9..05b84ba21e2 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -567,7 +567,7 @@ static BMOpDefine bmo_contextual_create_def = {
   },
   /* slots_out */
   {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* newly-made face(s) */
-  /* note, this is for stand-alone edges only, not edges which are apart of 
newly created faces */
+  /* note, this is for stand-alone edges only, not edges which are a part of 
newly created faces */
{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* newly-made edge(s) */
{{'\0'}},
   },
diff --git a/source/blender/bmesh/intern/bmesh_polygon_edgenet.c 
b/source/blender/bmesh/intern/bmesh_polygon_edgenet.c
index ad153f01cd4..09c0f48c2f6 100644
--- a/source/blender/bmesh/intern/bmesh_polygon_edgenet.c
+++ b/source/blender/bmesh/intern/bmesh_polygon_edgenet.c
@@ -51,9 +51,9 @@
 
 /* Note: All these flags _must_ be cleared on exit */
 
-/* face is apart of the edge-net (including the original face we're splitting) 
*/
+/* face is a part of the edge-net (including the original face we're 
splitting) */
 #define FACE_NET _FLAG_WALK
-/* edge is apart of 

[Bf-blender-cvs] [4fb67ae8094] master: CMake/macOS: use system OpenAL for the time being.

2020-10-19 Thread Ankit Meel
Commit: 4fb67ae8094c62064b46f33a3ac04d34e9b81e93
Author: Ankit Meel
Date:   Mon Oct 19 21:38:35 2020 +0530
Branches: master
https://developer.blender.org/rB4fb67ae8094c62064b46f33a3ac04d34e9b81e93

CMake/macOS: use system OpenAL for the time being.

Revert part of {rB83124856d05ee4da605ab247e6}

===

M   build_files/cmake/platform/platform_apple.cmake

===

diff --git a/build_files/cmake/platform/platform_apple.cmake 
b/build_files/cmake/platform/platform_apple.cmake
index 0413b89f6bd..4697e6bc766 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -53,6 +53,13 @@ find_package(ZLIB REQUIRED)
 find_package(BZip2 REQUIRED)
 list(APPEND ZLIB_LIBRARIES ${BZIP2_LIBRARIES})
 
+if(WITH_OPENAL)
+  find_package(OpenAL)
+  if(NOT OPENAL_FOUND)
+set(WITH_OPENAL OFF)
+  endif()
+endif()
+
 if(NOT DEFINED LIBDIR)
   set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin)
   # Prefer lib directory paths
@@ -72,15 +79,6 @@ if(EXISTS ${LIBDIR})
   without_system_libs_begin()
 endif()
 
-if(WITH_OPENAL)
-  # Hardcoding this is better than CMake searching in `~/Library/Frameworks`
-  # or `/Library/Frameworks` or Xcode SDK's frameworks.
-  set(OPENAL_INCLUDE_DIR "${LIBDIR}/openal/include/AL")
-  set(OPENAL_LIBRARY)
-  set(OPENAL_FOUND TRUE)
-  print_found_status("OpenAL" "${OPENAL_INCLUDE_DIR}")
-endif()
-
 if(WITH_ALEMBIC)
   find_package(Alembic)
 endif()

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


[Bf-blender-cvs] [c0a6bc19794] master: Spelling: Loose Versus Lose

2020-10-19 Thread Harley Acheson
Commit: c0a6bc19794c69843c38451c762e91bc10136e0f
Author: Harley Acheson
Date:   Mon Oct 19 09:15:34 2020 -0700
Branches: master
https://developer.blender.org/rBc0a6bc19794c69843c38451c762e91bc10136e0f

Spelling: Loose Versus Lose

Corrects incorrect usages of the word 'loose' when 'lose' was required.

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

Reviewed by Campbell Barton

===

M   source/blender/blenkernel/intern/lib_id.c
M   source/blender/blenkernel/intern/mesh_evaluate.c
M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/blenloader/intern/versioning_290.c
M   source/blender/bmesh/operators/bmo_extrude.c
M   source/blender/draw/engines/eevee/shaders/surface_frag.glsl
M   source/blender/draw/intern/draw_instance_data.c
M   source/blender/draw/intern/draw_manager.h
M   source/blender/editors/animation/anim_motion_paths.c
M   source/blender/editors/mesh/editmesh_knife.c
M   source/blender/editors/object/object_add.c
M   source/blender/editors/object/object_data_transform.c
M   source/blender/editors/render/render_update.c
M   source/blender/editors/space_view3d/view3d_view.c
M   source/blender/editors/transform/transform_convert_object.c
M   source/blender/imbuf/intern/thumbs.c
M   source/blender/io/collada/MeshImporter.cpp
M   source/blender/makesrna/intern/rna_scene_api.c
M   source/blender/python/intern/bpy_interface.c
M   source/blender/python/intern/bpy_operator.c
M   source/blender/sequencer/intern/sequencer.c
M   source/blender/windowmanager/intern/wm_keymap.c

===

diff --git a/source/blender/blenkernel/intern/lib_id.c 
b/source/blender/blenkernel/intern/lib_id.c
index cfe81531204..27422440cd5 100644
--- a/source/blender/blenkernel/intern/lib_id.c
+++ b/source/blender/blenkernel/intern/lib_id.c
@@ -2050,7 +2050,7 @@ void BKE_library_make_local(Main *bmain,
   /* Proxies only work when the proxified object is linked-in from a 
library. */
   if (ob->proxy->id.lib == NULL) {
 CLOG_WARN(,
-  "proxy object %s will loose its link to %s, because the "
+  "proxy object %s will lose its link to %s, because the "
   "proxified object is local.",
   id->newid->name,
   ob->proxy->id.name);
@@ -2064,7 +2064,7 @@ void BKE_library_make_local(Main *bmain,
* was not used locally would be a nasty bug! */
   if (is_local || is_lib) {
 CLOG_WARN(,
-  "made-local proxy object %s will loose its link to %s, "
+  "made-local proxy object %s will lose its link to %s, "
   "because the linked-in proxy is referenced (is_local=%i, 
is_lib=%i).",
   id->newid->name,
   ob->proxy->id.name,
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c 
b/source/blender/blenkernel/intern/mesh_evaluate.c
index 0aa8f7ca260..6b3a85cc364 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -1663,7 +1663,7 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
* Note that currently we only have two values for second loop of sharp 
edges.
* However, if needed, we can store the negated value of loop index instead 
of INDEX_INVALID
* to retrieve the real value later in code).
-   * Note also that lose edges always have both values set to 0! */
+   * Note also that loose edges always have both values set to 0! */
   int(*edge_to_loops)[2] = MEM_calloc_arrayN((size_t)numEdges, 
sizeof(*edge_to_loops), __func__);
 
   /* Simple mapping from a loop to its polygon index. */
diff --git a/source/blender/blenkernel/intern/scene.c 
b/source/blender/blenkernel/intern/scene.c
index 5e5f325d7d8..d0e731fec1b 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1595,7 +1595,7 @@ void BKE_scene_graph_update_for_newframe(Depsgraph 
*depsgraph)
  *
  * NOTE: Only update for new frame on first iteration. Second iteration is 
for ensuring user
  * edits from callback are properly taken into account. Doing a time 
update on those would
- * loose any possible unkeyed changes made by the handler. */
+ * lose any possible unkeyed changes made by the handler. */
 if (pass == 0) {
   const float ctime = BKE_scene_frame_get(scene);
   DEG_evaluate_on_framechange(depsgraph, ctime);
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 24bbb50968a..c49808c3718 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3308,7 +3308,7 @@ static void lib_link_object(BlendLibReader *reader, 
Object *ob)
* the 

[Bf-blender-cvs] [84ef3b80de4] master: Spelling: Miscellaneous

2020-10-19 Thread Harley Acheson
Commit: 84ef3b80de4915a24a9fd2fd214d0fa44e59b854
Author: Harley Acheson
Date:   Mon Oct 19 08:51:50 2020 -0700
Branches: master
https://developer.blender.org/rB84ef3b80de4915a24a9fd2fd214d0fa44e59b854

Spelling: Miscellaneous

Corrects 34 miscellaneous misspelled words.

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

Reviewed by Campbell Barton

===

M   intern/ghost/intern/GHOST_CallbackEventConsumer.h
M   intern/itasc/kdl/utilities/error.h
M   intern/itasc/kdl/utilities/error_stack.h
M   intern/itasc/kdl/utilities/utility.cpp
M   intern/itasc/kdl/utilities/utility.h
M   intern/libmv/libmv/autotrack/autotrack.cc
M   source/blender/blenkernel/BKE_subdiv_ccg.h
M   source/blender/blenkernel/intern/displist.c
M   source/blender/blenlib/intern/delaunay_2d.cc
M   source/blender/blenlib/intern/math_geom.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
M   source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M   source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
M   source/blender/draw/engines/gpencil/gpencil_shader_fx.c
M   
source/blender/draw/engines/overlay/shaders/armature_shape_outline_vert.glsl
M   source/blender/draw/engines/overlay/shaders/outline_detect_frag.glsl
M   source/blender/draw/intern/shaders/common_view_lib.glsl
M   source/blender/editors/interface/interface_handlers.c
M   source/blender/editors/space_file/file_ops.c
M   source/blender/editors/space_view3d/view3d_select.c
M   source/blender/gpu/intern/gpu_select.c
M   source/blender/io/alembic/intern/abc_reader_mesh.cc
M   source/blender/makesdna/DNA_key_types.h
M   source/blender/makesdna/DNA_pointcache_types.h
M   source/blender/makesdna/intern/makesdna.c
M   source/blender/makesrna/RNA_types.h
M   source/blender/sequencer/intern/sequencer.c

===

diff --git a/intern/ghost/intern/GHOST_CallbackEventConsumer.h 
b/intern/ghost/intern/GHOST_CallbackEventConsumer.h
index a1664e77717..9a76f4b031f 100644
--- a/intern/ghost/intern/GHOST_CallbackEventConsumer.h
+++ b/intern/ghost/intern/GHOST_CallbackEventConsumer.h
@@ -36,7 +36,7 @@ class GHOST_CallbackEventConsumer : public 
GHOST_IEventConsumer {
   /**
* Constructor.
* \param   eventCallback   The call-back routine invoked.
-   * \param   userDataThe data passed back though the call-back 
routine.
+   * \param   userDataThe data passed back through the call-back 
routine.
*/
   GHOST_CallbackEventConsumer(GHOST_EventCallbackProcPtr eventCallback,
   GHOST_TUserDataPtr userData);
@@ -58,7 +58,7 @@ class GHOST_CallbackEventConsumer : public 
GHOST_IEventConsumer {
  protected:
   /** The call-back routine invoked. */
   GHOST_EventCallbackProcPtr m_eventCallback;
-  /** The data passed back though the call-back routine. */
+  /** The data passed back through the call-back routine. */
   GHOST_TUserDataPtr m_userData;
 
 #ifdef WITH_CXX_GUARDEDALLOC
diff --git a/intern/itasc/kdl/utilities/error.h 
b/intern/itasc/kdl/utilities/error.h
index 4a0af60e8af..f2377702b9b 100644
--- a/intern/itasc/kdl/utilities/error.h
+++ b/intern/itasc/kdl/utilities/error.h
@@ -54,7 +54,7 @@ namespace KDL {
 class Error {
 public:
 /** Returns a description string describing the error.
- *  the returned pointer only garanteed to exists as long as 
+ *  the returned pointer only guaranteed to exists as long as
  * the Error object exists.
  */
virtual ~Error() {}
diff --git a/intern/itasc/kdl/utilities/error_stack.h 
b/intern/itasc/kdl/utilities/error_stack.h
index 2ed20ea2245..95ccc2d83eb 100644
--- a/intern/itasc/kdl/utilities/error_stack.h
+++ b/intern/itasc/kdl/utilities/error_stack.h
@@ -32,7 +32,7 @@
  *  ORO_Geometry V0.2
  *   
  * \par history
- *   - changed layout of the comments to accomodate doxygen
+ *   - changed layout of the comments to accommodate doxygen
  */
 #ifndef ERROR_STACK_H
 #define ERROR_STACK_H
diff --git a/intern/itasc/kdl/utilities/utility.cpp 
b/intern/itasc/kdl/utilities/utility.cpp
index 031d69c8d2a..5fc8403bdb7 100644
--- a/intern/itasc/kdl/utilities/utility.cpp
+++ b/intern/itasc/kdl/utilities/utility.cpp
@@ -7,7 +7,7 @@
  *  ORO_Geometry V0.2
  *   
  *  @par history
- *   - changed layout of the comments to accomodate doxygen
+ *   - changed layout of the comments to accommodate doxygen
  */
  
 #include "utility.h"
diff --git a/intern/itasc/kdl/utilities/utility.h 
b/intern/itasc/kdl/utilities/utility.h
index 6d0ec7a6eb7..d0e66bade20 100644
--- a/intern/itasc/kdl/utilities/utility.h
+++ b/intern/itasc/kdl/utilities/utility.h
@@ -14,7 +14,7 @@
  *functions and macro definitions.
  *  
  * 

[Bf-blender-cvs] [db1cdcdafe6] xr-actions-D9124: Merge branch 'master' into xr-actions-D9124

2020-10-19 Thread Peter Kim
Commit: db1cdcdafe688258372924055f96ae44172f49e1
Author: Peter Kim
Date:   Tue Oct 20 00:59:21 2020 +0900
Branches: xr-actions-D9124
https://developer.blender.org/rBdb1cdcdafe688258372924055f96ae44172f49e1

Merge branch 'master' into xr-actions-D9124

===



===



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


[Bf-blender-cvs] [297decbe1f5] xr-actions-D9124: XR: Add input threshold for float actions

2020-10-19 Thread Peter Kim
Commit: 297decbe1f5c605182ca57d1dccec2c90c3af431
Author: Peter Kim
Date:   Tue Oct 20 00:52:49 2020 +0900
Branches: xr-actions-D9124
https://developer.blender.org/rB297decbe1f5c605182ca57d1dccec2c90c3af431

XR: Add input threshold for float actions

Fixes button release events not being sent due to non-zero state.

===

M   intern/ghost/GHOST_Types.h
M   source/blender/makesrna/intern/rna_xr.c
M   source/blender/windowmanager/xr/intern/wm_xr_actions.c
M   source/blender/windowmanager/xr/intern/wm_xr_intern.h
M   source/blender/windowmanager/xr/intern/wm_xr_session.c

===

diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index 822da627e74..8c3efa33b03 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -712,6 +712,9 @@ typedef struct GHOST_XrActionInfo {
   /* Previous states, stored to determine XR events. */
   void *states_prev;
 
+  /* Input threshold for float actions. */
+  float threshold;
+
   /* wmOperatorType and wmXrOpFlag, only used by wm. */
   void *ot;
   char op_flag;
diff --git a/source/blender/makesrna/intern/rna_xr.c 
b/source/blender/makesrna/intern/rna_xr.c
index 56b7c7f3031..857d95901e6 100644
--- a/source/blender/makesrna/intern/rna_xr.c
+++ b/source/blender/makesrna/intern/rna_xr.c
@@ -82,6 +82,7 @@ static bool rna_XrSessionState_action_create(bContext *C,
  int type,
  const char *user_path0,
  const char *user_path1,
+ float threshold,
  const char *op,
  int op_flag)
 {
@@ -91,6 +92,7 @@ static bool rna_XrSessionState_action_create(bContext *C,
   .name = name,
   .type = type,
   .count_subaction_paths = 0,
+  .threshold = threshold,
   .ot = NULL,
   .op_flag = 0,
   };
@@ -651,6 +653,16 @@ static void rna_def_xr_session_state(BlenderRNA *brna)
   RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
   parm = RNA_def_string(func, "user_path1", NULL, 64, "User Path 1", "User 
path 1");
   RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+  parm = RNA_def_float(func,
+   "threshold",
+   0.3f,
+   0.0f,
+   1.0f,
+   "Threshold",
+   "Input threshold for button actions",
+   0.0f,
+   1.0f);
+  RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
   parm = RNA_def_string(func, "op", NULL, OP_MAX_TYPENAME, "Operator", 
"Operator to execute");
   RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
   parm = RNA_def_enum(func,
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_actions.c 
b/source/blender/windowmanager/xr/intern/wm_xr_actions.c
index c7dafcf19ab..5d0ccaa7526 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_actions.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_actions.c
@@ -115,6 +115,9 @@ static wmXrAction *action_create(const GHOST_XrActionInfo 
*info)
   action->states = MEM_calloc_arrayN(count, size, __func__);
   action->states_prev = MEM_calloc_arrayN(count, size, __func__);
 
+  action->threshold = info->threshold;
+  CLAMP(action->threshold, 0.0f, 1.0f);
+
   action->ot = info->ot;
   action->op_flag = info->op_flag;
 
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_intern.h 
b/source/blender/windowmanager/xr/intern/wm_xr_intern.h
index 31ad0bf3a03..c00b8f30424 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_intern.h
+++ b/source/blender/windowmanager/xr/intern/wm_xr_intern.h
@@ -131,6 +131,9 @@ typedef struct wmXrAction {
   /** Previous states, stored to determine XR events. */
   void *states_prev;
 
+  /** Input threshold for float actions. */
+  float threshold;
+
   /** Operator to be called on XR events. */
   struct wmOperatorType *ot;
   char op_flag; /* wmXrOpFlag */
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_session.c 
b/source/blender/windowmanager/xr/intern/wm_xr_session.c
index 180c0513910..412502ca972 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_session.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_session.c
@@ -587,8 +587,8 @@ static void wm_xr_session_events_dispatch(const 
XrSessionSettings *settings,
   case GHOST_kXrActionTypeFloatInput: {
 const float *state = &((float *)action->states)[i];
 float *state_prev = &((float *)action->states_prev)[i];
-if (*state) {
-  if (!*state_prev) {
+if (*state > action->threshold) {
+  if (*state_prev <= action->threshold) {
 if (modal || action->op_flag == XR_OP_PRESS) {

[Bf-blender-cvs] [8af91a18e0d] xr-actions-D9124: XR: Support basic transform operators

2020-10-19 Thread Peter Kim
Commit: 8af91a18e0d5a0380ef45866b719bdfe39294d93
Author: Peter Kim
Date:   Tue Oct 20 00:48:29 2020 +0900
Branches: xr-actions-D9124
https://developer.blender.org/rB8af91a18e0d5a0380ef45866b719bdfe39294d93

XR: Support basic transform operators

Uses same invoke_3d / modal_3d approach as select operators.

===

M   source/blender/editors/transform/transform_ops.c
M   source/blender/windowmanager/intern/wm_gesture_ops.c

===

diff --git a/source/blender/editors/transform/transform_ops.c 
b/source/blender/editors/transform/transform_ops.c
index b164d0d443f..6e565f402fd 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -472,6 +472,85 @@ static int transform_modal(bContext *C, wmOperator *op, 
const wmEvent *event)
   return exit_code;
 }
 
+/* Use viewmat from when transform was invoked to project controller 
coordinates.
+ * Otherwise, any headset movement will cause unwanted shifts in the 
transformation.
+ * TODO_XR: Store this in customdata. */
+static float viewmat_invoke[4][4];
+
+static int transform_modal_3d(bContext *C, wmOperator *op, const wmEvent 
*event)
+{
+  BLI_assert(event->type == EVT_XR_ACTION);
+  BLI_assert(event->custom == EVT_DATA_XR);
+  BLI_assert(event->customdata);
+
+  Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
+  Scene *scene = CTX_data_scene(C);
+  View3D *v3d = CTX_wm_view3d(C);
+  ARegion *region = CTX_wm_region(C);
+  RegionView3D *rv3d = region->regiondata;
+  wmWindowManager *wm = CTX_wm_manager(C);
+  wmXrData *xr = >xr;
+  wmXrActionData *customdata = event->customdata;
+  short winx_prev, winy_prev;
+  rcti winrct_prev;
+  float lens_prev;
+  float clip_start_prev, clip_end_prev;
+  float viewmat_prev[4][4];
+  int retval;
+
+  wmEvent event_mut;
+  memcpy(_mut, event, sizeof(wmEvent));
+
+  /* Replace window view parameters with XR surface counterparts. */
+  winx_prev = region->winx;
+  winy_prev = region->winy;
+  winrct_prev = region->winrct;
+  lens_prev = v3d->lens;
+  clip_start_prev = v3d->clip_start;
+  clip_end_prev = v3d->clip_end;
+  copy_m4_m4(viewmat_prev, rv3d->viewmat);
+
+  region->winrct.xmin = 0;
+  region->winrct.ymin = 0;
+  region->winrct.xmax = region->winx = customdata->eye_width;
+  region->winrct.ymax = region->winy = customdata->eye_height;
+  v3d->lens = customdata->eye_lens;
+  v3d->clip_start = xr->session_settings.clip_start;
+  v3d->clip_end = xr->session_settings.clip_end;
+  ED_view3d_update_viewmat(depsgraph, scene, v3d, region, viewmat_invoke, 
NULL, NULL, false);
+
+  map_to_pixel(event_mut.mval,
+   customdata->controller_loc,
+   viewmat_invoke,
+   rv3d->winmat,
+   customdata->eye_width,
+   customdata->eye_height);
+
+  if (event->val == KM_PRESS) {
+event_mut.type = MOUSEMOVE;
+  }
+  else if (event->val == KM_RELEASE) {
+event_mut.type = LEFTMOUSE;
+  }
+  else {
+/* XR events currently only support press and release. */
+BLI_assert(false);
+  }
+
+  retval = transform_modal(C, op, _mut);
+
+  /* Restore window view. */
+  region->winx = winx_prev;
+  region->winy = winy_prev;
+  region->winrct = winrct_prev;
+  v3d->lens = lens_prev;
+  v3d->clip_start = clip_start_prev;
+  v3d->clip_end = clip_end_prev;
+  ED_view3d_update_viewmat(depsgraph, scene, v3d, region, viewmat_prev, NULL, 
NULL, false);
+
+  return retval;
+}
+
 static void transform_cancel(bContext *C, wmOperator *op)
 {
   TransInfo *t = op->customdata;
@@ -531,6 +610,79 @@ static int transform_invoke(bContext *C, wmOperator *op, 
const wmEvent *event)
   return OPERATOR_RUNNING_MODAL;
 }
 
+static int transform_invoke_3d(bContext *C, wmOperator *op, const wmEvent 
*event)
+{
+  BLI_assert(event->type == EVT_XR_ACTION);
+  BLI_assert(event->custom == EVT_DATA_XR);
+  BLI_assert(event->customdata);
+
+  Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
+  Scene *scene = CTX_data_scene(C);
+  View3D *v3d = CTX_wm_view3d(C);
+  ARegion *region = CTX_wm_region(C);
+  RegionView3D *rv3d = region->regiondata;
+  wmWindowManager *wm = CTX_wm_manager(C);
+  wmXrData *xr = >xr;
+  wmXrActionData *customdata = event->customdata;
+  short winx_prev, winy_prev;
+  rcti winrct_prev;
+  float lens_prev;
+  float clip_start_prev, clip_end_prev;
+  float viewmat_prev[4][4];
+  int retval;
+
+  wmEvent event_mut;
+  memcpy(_mut, event, sizeof(wmEvent));
+  event_mut.type = LEFTMOUSE;
+
+  /* Replace window view parameters with XR surface counterparts. */
+  winx_prev = region->winx;
+  winy_prev = region->winy;
+  winrct_prev = region->winrct;
+  lens_prev = v3d->lens;
+  clip_start_prev = v3d->clip_start;
+  clip_end_prev = v3d->clip_end;
+  copy_m4_m4(viewmat_prev, rv3d->viewmat);
+
+  region->winrct.xmin = 0;
+  region->winrct.ymin = 0;
+  region->winrct.xmax = 

[Bf-blender-cvs] [a9f2641cb64] master: Fix build error with WITH_CYCLES_NATIVE_ONLY and AVX tests on macOS

2020-10-19 Thread Brecht Van Lommel
Commit: a9f2641cb64c6e3bfd2d9b162f4ede4efc988244
Author: Brecht Van Lommel
Date:   Mon Oct 19 17:42:17 2020 +0200
Branches: master
https://developer.blender.org/rBa9f2641cb64c6e3bfd2d9b162f4ede4efc988244

Fix build error with WITH_CYCLES_NATIVE_ONLY and AVX tests on macOS

Only build avx/avx2 unit tests if supported by the compiler and
WITH_CYCLES_NATIVE_ONLY is off, otherwise the appropriate compiler flags
are not available.

===

M   intern/cycles/test/CMakeLists.txt

===

diff --git a/intern/cycles/test/CMakeLists.txt 
b/intern/cycles/test/CMakeLists.txt
index 7d8f5916fef..cf8ebc2a1d9 100644
--- a/intern/cycles/test/CMakeLists.txt
+++ b/intern/cycles/test/CMakeLists.txt
@@ -51,13 +51,17 @@ set(SRC
   util_string_test.cpp
   util_task_test.cpp
   util_time_test.cpp
-  util_avxf_avx_test.cpp
-  util_avxf_avx2_test.cpp
   util_transform_test.cpp
 )
 
-set_source_files_properties(util_avxf_avx_test.cpp PROPERTIES COMPILE_FLAGS 
"${CYCLES_AVX_KERNEL_FLAGS}")
-set_source_files_properties(util_avxf_avx2_test.cpp PROPERTIES COMPILE_FLAGS 
"${CYCLES_AVX2_KERNEL_FLAGS}")
+if(CXX_HAS_AVX)
+  list(APPEND SRC util_avxf_avx_test.cpp)
+  set_source_files_properties(util_avxf_avx_test.cpp PROPERTIES COMPILE_FLAGS 
"${CYCLES_AVX_KERNEL_FLAGS}")
+endif()
+if(CXX_HAS_AVX2)
+  list(APPEND SRC util_avxf_avx2_test.cpp)
+  set_source_files_properties(util_avxf_avx2_test.cpp PROPERTIES COMPILE_FLAGS 
"${CYCLES_AVX2_KERNEL_FLAGS}")
+endif()
 
 if(WITH_GTESTS)
   BLENDER_SRC_GTEST(cycles "${SRC}" "${ALL_CYCLES_LIBRARIES}")

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


[Bf-blender-cvs] [d1eefc42154] master: Spelling: Then Versus Than

2020-10-19 Thread Harley Acheson
Commit: d1eefc421544e2ea632fb35cb6bcaade4c39ce6b
Author: Harley Acheson
Date:   Mon Oct 19 08:43:08 2020 -0700
Branches: master
https://developer.blender.org/rBd1eefc421544e2ea632fb35cb6bcaade4c39ce6b

Spelling: Then Versus Than

Corrects incorrect usages of the words 'then' and 'than'.

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

Reviewed by Campbell Barton

===

M   intern/dualcon/intern/octree.cpp
M   intern/ghost/intern/GHOST_System.cpp
M   source/blender/blenkernel/intern/armature.c
M   source/blender/blenkernel/intern/customdata.c
M   source/blender/blenkernel/intern/image_gen.c
M   source/blender/blenkernel/intern/lattice.c
M   source/blender/blenkernel/intern/mball.c
M   source/blender/blenkernel/intern/mesh.c
M   source/blender/blenkernel/intern/mesh_evaluate.c
M   source/blender/blenkernel/intern/modifier.c
M   source/blender/blenkernel/intern/paint.c
M   source/blender/blenkernel/intern/pointcache.c
M   source/blender/blenlib/BLI_scanfill.h
M   source/blender/blenlib/intern/array_store.c
M   source/blender/blenlib/intern/polyfill_2d.c
M   source/blender/blenlib/intern/smallhash.c
M   source/blender/blenlib/intern/storage.c
M   source/blender/blenlib/intern/winstuff_dir.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/blenloader/intern/versioning_legacy.c
M   source/blender/bmesh/intern/bmesh_delete.c
M   source/blender/bmesh/intern/bmesh_error.h
M   source/blender/bmesh/intern/bmesh_inline.h
M   source/blender/bmesh/intern/bmesh_mesh.c
M   source/blender/bmesh/intern/bmesh_mesh_convert.c
M   source/blender/bmesh/intern/bmesh_mods.c
M   source/blender/bmesh/intern/bmesh_opdefines.c
M   source/blender/bmesh/intern/bmesh_polygon_edgenet.c
M   source/blender/bmesh/intern/bmesh_query.c
M   source/blender/bmesh/intern/bmesh_walkers.c
M   source/blender/bmesh/intern/bmesh_walkers_impl.c
M   source/blender/bmesh/operators/bmo_connect_pair.c
M   source/blender/bmesh/operators/bmo_create.c
M   source/blender/bmesh/operators/bmo_fill_grid.c
M   source/blender/bmesh/tools/bmesh_decimate_collapse.c
M   source/blender/draw/intern/draw_cache_extract_mesh.c
M   source/blender/draw/intern/shaders/common_fxaa_lib.glsl
M   source/blender/editors/interface/interface.c
M   source/blender/editors/interface/interface_intern.h
M   source/blender/editors/interface/interface_region_color_picker.c
M   source/blender/editors/mask/mask_add.c
M   source/blender/editors/mesh/editmesh_inset.c
M   source/blender/editors/mesh/editmesh_knife.c
M   source/blender/editors/mesh/editmesh_rip.c
M   source/blender/editors/mesh/editmesh_tools.c
M   source/blender/editors/physics/particle_edit.c
M   source/blender/editors/sculpt_paint/paint_image_proj.c
M   source/blender/editors/sculpt_paint/paint_stroke.c
M   source/blender/editors/space_file/filesel.c
M   source/blender/editors/space_image/image_ops.c
M   source/blender/editors/space_info/textview.c
M   source/blender/editors/space_node/node_view.c
M   source/blender/editors/space_sequencer/sequencer_scopes.c
M   source/blender/editors/space_view3d/view3d_gizmo_ruler.c
M   source/blender/editors/space_view3d/view3d_view.c
M   source/blender/editors/transform/transform_convert_mesh.c
M   source/blender/editors/transform/transform_input.c
M   source/blender/imbuf/IMB_thumbs.h
M   source/blender/imbuf/intern/jp2.c
M   source/blender/makesdna/DNA_key_types.h
M   source/blender/makesrna/intern/makesrna.c
M   source/blender/makesrna/intern/rna_access.c
M   source/blender/makesrna/intern/rna_armature.c
M   source/blender/makesrna/intern/rna_modifier.c
M   source/blender/makesrna/intern/rna_pose.c
M   source/blender/modifiers/intern/MOD_screw.c
M   source/blender/python/intern/bpy_rna.c

===

diff --git a/intern/dualcon/intern/octree.cpp b/intern/dualcon/intern/octree.cpp
index c9d5639cb5d..94ab3085b5c 100644
--- a/intern/dualcon/intern/octree.cpp
+++ b/intern/dualcon/intern/octree.cpp
@@ -1996,7 +1996,7 @@ int Octree::floodFill(LeafNode *leaf, int st[3], int len, 
int /*height*/, int th
 delete queue;
 continue;
   }
-  dc_printf("Less then %d, removing...\n", threshold);
+  dc_printf("Less than %d, removing...\n", threshold);
 
   // We have to remove this noise
 
diff --git a/intern/ghost/intern/GHOST_System.cpp 
b/intern/ghost/intern/GHOST_System.cpp
index b0d2adff4bc..46c50045b80 100644
--- a/intern/ghost/intern/GHOST_System.cpp
+++ b/intern/ghost/intern/GHOST_System.cpp
@@ -360,7 +360,7 @@ GHOST_TSuccess 
GHOST_System::createFullScreenWindow(GHOST_Window **window,
 glSettings.flags |= GHOST_glAlphaBackground;
 
   /* note: 

[Bf-blender-cvs] [3a7fd309fce] master: Spelling: It's Versus Its

2020-10-19 Thread Harley Acheson
Commit: 3a7fd309fce89213b0224b3c6807adb2d1fe7ca8
Author: Harley Acheson
Date:   Mon Oct 19 08:12:33 2020 -0700
Branches: master
https://developer.blender.org/rB3a7fd309fce89213b0224b3c6807adb2d1fe7ca8

Spelling: It's Versus Its

Corrects incorrect usage of contraction for 'it is', when possessive 'its' was 
required.

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

Reviewed by Campbell Barton

===

M   intern/atomic/atomic_ops.h
M   intern/cycles/bvh/bvh_split.h
M   intern/cycles/kernel/kernel_volume.h
M   intern/cycles/kernel/svm/svm.h
M   intern/cycles/render/tile.h
M   intern/cycles/util/util_half.h
M   intern/ghost/GHOST_ISystem.h
M   intern/iksolver/intern/IK_QJacobian.h
M   intern/libmv/libmv/simple_pipeline/bundle.cc
M   intern/libmv/libmv/simple_pipeline/modal_solver.cc
M   intern/mikktspace/mikktspace.c
M   intern/opencolorio/ocio_impl_glsl.cc
M   intern/opensubdiv/internal/topology/topology_refiner_factory.cc
M   intern/opensubdiv/opensubdiv_converter_capi.h
M   source/blender/blenkernel/BKE_DerivedMesh.h
M   source/blender/blenkernel/BKE_animsys.h
M   source/blender/blenkernel/BKE_editmesh.h
M   source/blender/blenkernel/BKE_main.h
M   source/blender/blenkernel/intern/action.c
M   source/blender/blenkernel/intern/anim_sys.c
M   source/blender/blenkernel/intern/anim_visualization.c
M   source/blender/blenkernel/intern/armature.c
M   source/blender/blenkernel/intern/curve.c
M   source/blender/blenkernel/intern/dynamicpaint.c
M   source/blender/blenkernel/intern/idprop.c
M   source/blender/blenkernel/intern/image.c
M   source/blender/blenkernel/intern/main_idmap.c
M   source/blender/blenkernel/intern/object.c
M   source/blender/blenkernel/intern/pbvh.c
M   source/blender/blenkernel/intern/sound.c
M   source/blender/blenkernel/intern/tracking.c
M   source/blender/blenlib/intern/BLI_ghash.c
M   source/blender/blenlib/intern/BLI_ghash_utils.c
M   source/blender/blenlib/intern/BLI_heap.c
M   source/blender/blenlib/intern/BLI_heap_simple.c
M   source/blender/blenlib/intern/kdtree_impl.h
M   source/blender/blenlib/intern/listbase.c
M   source/blender/blenlib/intern/math_geom.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/blenloader/intern/versioning_defaults.c
M   source/blender/bmesh/bmesh.h
M   source/blender/bmesh/intern/bmesh_construct.c
M   source/blender/bmesh/intern/bmesh_log.c
M   source/blender/bmesh/intern/bmesh_operators.c
M   source/blender/bmesh/intern/bmesh_polygon.c
M   source/blender/bmesh/intern/bmesh_polygon_edgenet.c
M   source/blender/bmesh/intern/bmesh_walkers.c
M   source/blender/bmesh/operators/bmo_edgenet.c
M   source/blender/bmesh/operators/bmo_rotate_edges.c
M   source/blender/bmesh/tools/bmesh_decimate_collapse.c
M   source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
M   source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
M   source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M   source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
M   source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
M   source/blender/depsgraph/intern/node/deg_node.cc
M   source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl
M   source/blender/draw/engines/eevee/shaders/volumetric_geom.glsl
M   source/blender/draw/engines/overlay/overlay_armature.c
M   source/blender/draw/engines/workbench/workbench_effect_cavity.c
M   source/blender/draw/intern/draw_common.c
M   source/blender/draw/intern/draw_instance_data.c
M   source/blender/editors/animation/anim_filter.c
M   source/blender/editors/armature/armature_add.c
M   source/blender/editors/armature/armature_select.c
M   source/blender/editors/armature/pose_transform.c
M   source/blender/editors/include/ED_keyframing.h
M   source/blender/editors/interface/interface.c
M   source/blender/editors/interface/interface_panel.c
M   source/blender/editors/interface/interface_region_tooltip.c
M   source/blender/editors/interface/interface_template_search_menu.c
M   source/blender/editors/interface/interface_templates.c
M   source/blender/editors/interface/interface_widgets.c
M   source/blender/editors/mask/mask_ops.c
M   source/blender/editors/mesh/editmesh_select.c
M   source/blender/editors/sculpt_paint/paint_vertex.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_detail.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h
M   source/blender/editors/sculpt_paint/sculpt_undo.c
M   source/blender/editors/space_clip/clip_editor.c
M   source/blender/editors/space_clip/tracking_ops.c
M   

[Bf-blender-cvs] [d2bf71b4122] master: Fix use of uninitialized variable

2020-10-19 Thread Hans Goudey
Commit: d2bf71b412233160a52775f29799a2c1331c92f4
Author: Hans Goudey
Date:   Mon Oct 19 09:19:13 2020 -0500
Branches: master
https://developer.blender.org/rBd2bf71b412233160a52775f29799a2c1331c92f4

Fix use of uninitialized variable

===

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

===

diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index af6ed8ac54e..9dbdb37ef27 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -3030,7 +3030,7 @@ void ED_region_panels_draw(const bContext *C, ARegion 
*region)
   }
 
   /* scrollers */
-  bool use_mask;
+  bool use_mask = false;
   rcti mask;
   if (region->runtime.category &&
   (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_RIGHT)) {

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


[Bf-blender-cvs] [7ef3a634808] master: Cleanup: Use BLI string functions

2020-10-19 Thread Hans Goudey
Commit: 7ef3a634808c1b3c9284d8f8253ca1b4c1d34eb3
Author: Hans Goudey
Date:   Mon Oct 19 09:17:41 2020 -0500
Branches: master
https://developer.blender.org/rB7ef3a634808c1b3c9284d8f8253ca1b4c1d34eb3

Cleanup: Use BLI string functions

It's better not to assume that strings passed as arguments
will have the proper size.

===

M   source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.c
M   source/blender/modifiers/intern/MOD_ui_common.c
M   source/blender/shader_fx/intern/FX_ui_common.c

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.c
index be71f4882f6..1985ec5caf5 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.c
@@ -17,9 +17,8 @@
  * \ingroup modifiers
  */
 
-#include 
-
 #include "BLI_listbase.h"
+#include "BLI_string.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -373,10 +372,10 @@ PanelType *gpencil_modifier_panel_register(ARegionType 
*region_type,
 
   PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname);
 
-  strcpy(panel_type->idname, panel_idname);
-  strcpy(panel_type->label, "");
-  strcpy(panel_type->context, "modifier");
-  strcpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+  BLI_strncpy(panel_type->idname, panel_idname, BKE_ST_MAXNAME);
+  BLI_strncpy(panel_type->label, "", BKE_ST_MAXNAME);
+  BLI_strncpy(panel_type->context, "modifier", BKE_ST_MAXNAME);
+  BLI_strncpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA, 
BKE_ST_MAXNAME);
 
   panel_type->draw_header = gpencil_modifier_panel_header;
   panel_type->draw = draw;
@@ -409,16 +408,14 @@ PanelType *gpencil_modifier_subpanel_register(ARegionType 
*region_type,
 {
   /* Create the subpanel's ID name. */
   char panel_idname[BKE_ST_MAXNAME];
-  strcpy(panel_idname, parent->idname);
-  strcat(panel_idname, "_");
-  strcat(panel_idname, name);
+  BLI_snprintf(panel_idname, BKE_ST_MAXNAME, "%s_%s", parent->idname, name);
 
   PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname);
 
-  strcpy(panel_type->idname, panel_idname);
-  strcpy(panel_type->label, label);
-  strcpy(panel_type->context, "modifier");
-  strcpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+  BLI_strncpy(panel_type->idname, panel_idname, BKE_ST_MAXNAME);
+  BLI_strncpy(panel_type->label, label, BKE_ST_MAXNAME);
+  BLI_strncpy(panel_type->context, "modifier", BKE_ST_MAXNAME);
+  BLI_strncpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA, 
BKE_ST_MAXNAME);
 
   panel_type->draw_header = draw_header;
   panel_type->draw = draw;
@@ -426,7 +423,7 @@ PanelType *gpencil_modifier_subpanel_register(ARegionType 
*region_type,
   panel_type->flag = (PNL_DEFAULT_CLOSED | PNL_DRAW_BOX);
 
   BLI_assert(parent != NULL);
-  strcpy(panel_type->parent_id, parent->idname);
+  BLI_strncpy(panel_type->parent_id, parent->idname, BKE_ST_MAXNAME);
   panel_type->parent = parent;
   BLI_addtail(>children, BLI_genericNodeN(panel_type));
   BLI_addtail(_type->paneltypes, panel_type);
diff --git a/source/blender/modifiers/intern/MOD_ui_common.c 
b/source/blender/modifiers/intern/MOD_ui_common.c
index a79e270af93..bad76a0b559 100644
--- a/source/blender/modifiers/intern/MOD_ui_common.c
+++ b/source/blender/modifiers/intern/MOD_ui_common.c
@@ -17,9 +17,8 @@
  * \ingroup modifiers
  */
 
-#include 
-
 #include "BLI_listbase.h"
+#include "BLI_string.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -406,10 +405,10 @@ PanelType *modifier_panel_register(ARegionType 
*region_type, ModifierType type,
 
   PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname);
 
-  strcpy(panel_type->idname, panel_idname);
-  strcpy(panel_type->label, "");
-  strcpy(panel_type->context, "modifier");
-  strcpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+  BLI_strncpy(panel_type->idname, panel_idname, BKE_ST_MAXNAME);
+  BLI_strncpy(panel_type->label, "", BKE_ST_MAXNAME);
+  BLI_strncpy(panel_type->context, "modifier", BKE_ST_MAXNAME);
+  BLI_strncpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA, 
BKE_ST_MAXNAME);
 
   panel_type->draw_header = modifier_panel_header;
   panel_type->draw = draw;
@@ -442,16 +441,14 @@ PanelType *modifier_subpanel_register(ARegionType 
*region_type,
 {
   /* Create the subpanel's ID name. */
   char panel_idname[BKE_ST_MAXNAME];
-  strcpy(panel_idname, parent->idname);
-  strcat(panel_idname, "_");
-  strcat(panel_idname, name);
+  BLI_snprintf(panel_idname, BKE_ST_MAXNAME, "%s_%s", parent->idname, name);
 
   PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname);
 
-  strcpy(panel_type->idname, panel_idname);
-  strcpy(panel_type->label, label);
-  strcpy(panel_type->context, "modifier");
-  

[Bf-blender-cvs] [6cb358aa2b4] greasepencil-object: Merge branch 'master' into greasepencil-object

2020-10-19 Thread Antonio Vazquez
Commit: 6cb358aa2b4bafe330790a2ceaad25885ca51038
Author: Antonio Vazquez
Date:   Mon Oct 19 15:53:34 2020 +0200
Branches: greasepencil-object
https://developer.blender.org/rB6cb358aa2b4bafe330790a2ceaad25885ca51038

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] [42c6ebfae85] greasepencil-edit-curve: Merge branch 'master' into greasepencil-edit-curve

2020-10-19 Thread Antonio Vazquez
Commit: 42c6ebfae85888f77d24736ccb32830136bed8ef
Author: Antonio Vazquez
Date:   Mon Oct 19 15:53:08 2020 +0200
Branches: greasepencil-edit-curve
https://developer.blender.org/rB42c6ebfae85888f77d24736ccb32830136bed8ef

Merge branch 'master' into greasepencil-edit-curve

 Conflicts:
source/blender/blenloader/intern/versioning_290.c

===



===

diff --cc source/blender/blenloader/intern/versioning_290.c
index 6a516a1f312,58dcce72823..f27c0739a47
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@@ -854,20 -855,14 +855,28 @@@ void blo_do_versions_290(FileData *fd, 
  }
}
  }
+ 
+ /* Ensure that particle systems generated by fluid modifier have correct 
phystype. */
+ LISTBASE_FOREACH (ParticleSettings *, part, >particles) {
+   if (ELEM(
+   part->type, PART_FLUID_FLIP, PART_FLUID_SPRAY, 
PART_FLUID_BUBBLE, PART_FLUID_FOAM)) {
+ part->phystype = PART_PHYS_NO;
+   }
+ }
 +/* Init grease pencil default curve resolution. */
 +if (!DNA_struct_elem_find(fd->filesdna, "bGPdata", "int", 
"curve_edit_resolution")) {
 +  LISTBASE_FOREACH (bGPdata *, gpd, >gpencils) {
 +gpd->curve_edit_resolution = GP_DEFAULT_CURVE_RESOLUTION;
 +gpd->flag |= GP_DATA_CURVE_ADAPTIVE_RESOLUTION;
 +  }
 +}
 +/* Init grease pencil curve editing error threshold. */
 +if (!DNA_struct_elem_find(fd->filesdna, "bGPdata", "float", 
"curve_edit_threshold")) {
 +  LISTBASE_FOREACH (bGPdata *, gpd, >gpencils) {
 +gpd->curve_edit_threshold = GP_DEFAULT_CURVE_ERROR;
 +gpd->curve_edit_corner_angle = GP_DEFAULT_CURVE_EDIT_CORNER_ANGLE;
 +  }
 +}
}
  
/**

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


[Bf-blender-cvs] [9bf1bf599b4] master: Cleanup: Missing parentheses around macro in versioning

2020-10-19 Thread Julian Eisel
Commit: 9bf1bf599b46fe020cf1ae660a2fe4946146ecbd
Author: Julian Eisel
Date:   Mon Oct 19 15:33:09 2020 +0200
Branches: master
https://developer.blender.org/rB9bf1bf599b46fe020cf1ae660a2fe4946146ecbd

Cleanup: Missing parentheses around macro in versioning

Although the `ELEM` macro wraps logic into parentheses, it's not intended to be
used that way. Unexpanded macros should still follow regular coding style for
readability and for tools parsing the code (it confused clang-format for
example).

===

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

===

diff --git a/source/blender/blenloader/intern/versioning_290.c 
b/source/blender/blenloader/intern/versioning_290.c
index 5e6fdad8509..58dcce72823 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -858,7 +858,8 @@ void blo_do_versions_290(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 
 /* Ensure that particle systems generated by fluid modifier have correct 
phystype. */
 LISTBASE_FOREACH (ParticleSettings *, part, >particles) {
-  if ELEM (part->type, PART_FLUID_FLIP, PART_FLUID_SPRAY, 
PART_FLUID_BUBBLE, PART_FLUID_FOAM) {
+  if (ELEM(
+  part->type, PART_FLUID_FLIP, PART_FLUID_SPRAY, 
PART_FLUID_BUBBLE, PART_FLUID_FOAM)) {
 part->phystype = PART_PHYS_NO;
   }
 }
@@ -876,4 +877,4 @@ void blo_do_versions_290(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
   {
 /* Keep this block, even when empty. */
   }
-}
\ No newline at end of file
+}

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


[Bf-blender-cvs] [83124856d05] master: Cmake/macOS: strictly disallow searching in frameworks

2020-10-19 Thread Ankit Meel
Commit: 83124856d05ee4da605ab247e6286755690e54dd
Author: Ankit Meel
Date:   Mon Oct 19 18:45:44 2020 +0530
Branches: master
https://developer.blender.org/rB83124856d05ee4da605ab247e6286755690e54dd

Cmake/macOS: strictly disallow searching in frameworks

This is a stricter version of the change made in
{rBbb872b25f219d1a9bc2446228b6dc}

Cmake must never look into Frameworks when the system
library guards (`without_system_libs_begin`/`without_system_libs_end`)
are present.

OpenAL didn't follow this and OpenAL.framework in Xcode would be used.
The Cmake's `FindOpenAL.cmake` looks for both library (in this case,
the .framework file), and include dir.
Precompiled libraries don't contain the former. So `find_package`
cannot be used, or it becomes the hack that {rBb2c707747da9} removed.
So hardcode the include dir path, and other variables.

Reviewed By: brecht

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

===

M   build_files/cmake/macros.cmake
M   build_files/cmake/platform/platform_apple.cmake

===

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index e75505e9885..8498c68c21c 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -1243,7 +1243,7 @@ macro(without_system_libs_begin)
   set(CMAKE_IGNORE_PATH 
"${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES};${CMAKE_SYSTEM_INCLUDE_PATH};${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES};${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}")
   if(APPLE)
 # Avoid searching for headers in frameworks (like Mono), and libraries in 
LIBDIR.
-set(CMAKE_FIND_FRAMEWORK LAST)
+set(CMAKE_FIND_FRAMEWORK NEVER)
   endif()
 endmacro()
 
diff --git a/build_files/cmake/platform/platform_apple.cmake 
b/build_files/cmake/platform/platform_apple.cmake
index 36e6d71bfb2..0413b89f6bd 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -73,12 +73,12 @@ if(EXISTS ${LIBDIR})
 endif()
 
 if(WITH_OPENAL)
-  find_package(OpenAL)
-  if(OPENAL_FOUND)
-set(WITH_OPENAL ON)
-  else()
-set(WITH_OPENAL OFF)
-  endif()
+  # Hardcoding this is better than CMake searching in `~/Library/Frameworks`
+  # or `/Library/Frameworks` or Xcode SDK's frameworks.
+  set(OPENAL_INCLUDE_DIR "${LIBDIR}/openal/include/AL")
+  set(OPENAL_LIBRARY)
+  set(OPENAL_FOUND TRUE)
+  print_found_status("OpenAL" "${OPENAL_INCLUDE_DIR}")
 endif()
 
 if(WITH_ALEMBIC)

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


[Bf-blender-cvs] [4d9f357bf6b] master: Fix T81806: Cycles error when GPU device_type is NONE

2020-10-19 Thread Campbell Barton
Commit: 4d9f357bf6b5cdd54d3d0406ef9ac79b387a21b5
Author: Campbell Barton
Date:   Mon Oct 19 23:58:28 2020 +1100
Branches: master
https://developer.blender.org/rB4d9f357bf6b5cdd54d3d0406ef9ac79b387a21b5

Fix T81806: Cycles error when GPU device_type is NONE

Own regression in 4bea4702d5d5a

===

M   intern/cycles/blender/blender_python.cpp

===

diff --git a/intern/cycles/blender/blender_python.cpp 
b/intern/cycles/blender/blender_python.cpp
index 021985bd2ba..525525e1047 100644
--- a/intern/cycles/blender/blender_python.cpp
+++ b/intern/cycles/blender/blender_python.cpp
@@ -410,7 +410,8 @@ static PyObject *available_devices_func(PyObject * 
/*self*/, PyObject *args)
   }
 
   DeviceType type = Device::type_from_string(type_name);
-  if ((type == DEVICE_NONE) && (type_name[0] != '\0')) {
+  /* "NONE" is defined by the add-on, see: 
`CyclesPreferences.get_device_types`. */
+  if ((type == DEVICE_NONE) && (strcmp(type_name, "NONE") != 0)) {
 PyErr_Format(PyExc_ValueError, "Device \"%s\" not known.", type_name);
 return NULL;
   }

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


[Bf-blender-cvs] [29dbe007198] master: Fix T81484: Weight/Vertex paint with mirror and viewport clipping does not update stroke on initial side

2020-10-19 Thread Philipp Oeser
Commit: 29dbe00719812925ab88030ce68509bf113520c5
Author: Philipp Oeser
Date:   Tue Oct 13 09:45:37 2020 +0200
Branches: master
https://developer.blender.org/rB29dbe00719812925ab88030ce68509bf113520c5

Fix T81484: Weight/Vertex paint with mirror and viewport clipping does not 
update stroke on initial side

Issue introduced in rB4f616c93f7cb.

Issue here is that the the `StrokeCache` `mirror_symmetry_pass` is still
in its previous state when entering
`wpaint_do_symmetrical_brush_actions`.
For the initial stroke this means that the (wrong) cache
`mirror_symmetry_pass` ends up in SculptBrushTest `mirror_symmetry_pass`
as well and thus the clipping test in `sculpt_brush_test_clipping` will
fail.
[ This one flips the coords to test against clipping according to (now
wrong) `mirror_symmetry_pass` ]

Solution seems simple: just ensure we start of with a
`mirror_symmetry_pass` of zero in `wpaint_do_symmetrical_brush_actions`
for the initial stroke.
Same thing is done for vertex paint as well.

Maniphest Tasks: T81484

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

===

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

===

diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c 
b/source/blender/editors/sculpt_paint/paint_vertex.c
index 6472da48f40..2876670a8d2 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -2296,6 +2296,7 @@ static void wpaint_do_symmetrical_brush_actions(
   int i = 0;
 
   /* initial stroke */
+  cache->mirror_symmetry_pass = 0;
   wpaint_do_paint(C, ob, wp, sd, wpd, wpi, me, brush, 0, 'X', 0, 0);
   wpaint_do_radial_symmetry(C, ob, wp, sd, wpd, wpi, me, brush, 0, 'X');
   wpaint_do_radial_symmetry(C, ob, wp, sd, wpd, wpi, me, brush, 0, 'Y');
@@ -3316,6 +3317,7 @@ static void vpaint_do_symmetrical_brush_actions(
   int i = 0;
 
   /* initial stroke */
+  cache->mirror_symmetry_pass = 0;
   vpaint_do_paint(C, sd, vp, vpd, ob, me, brush, i, 'X', 0, 0);
   vpaint_do_radial_symmetry(C, sd, vp, vpd, ob, me, brush, i, 'X');
   vpaint_do_radial_symmetry(C, sd, vp, vpd, ob, me, brush, i, 'Y');

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


[Bf-blender-cvs] [50578422f4e] lanpr-under-gp: Merge remote-tracking branch 'origin/master' into lanpr-under-gp

2020-10-19 Thread YimingWu
Commit: 50578422f4ee07717d5df147b23ce3e8ffe5f946
Author: YimingWu
Date:   Mon Oct 19 20:39:03 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB50578422f4ee07717d5df147b23ce3e8ffe5f946

Merge remote-tracking branch 'origin/master' into lanpr-under-gp

===



===



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


[Bf-blender-cvs] [6c54cdaab53] lanpr-under-gp: LineArt: Limit near-by bounding area look up to only one level.

2020-10-19 Thread YimingWu
Commit: 6c54cdaab53044293cff3bd42d738c25c5c34dc3
Author: YimingWu
Date:   Mon Oct 19 20:38:27 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB6c54cdaab53044293cff3bd42d738c25c5c34dc3

LineArt: Limit near-by bounding area look up to only one level.

===

M   source/blender/editors/lineart/lineart_chain.c

===

diff --git a/source/blender/editors/lineart/lineart_chain.c 
b/source/blender/editors/lineart/lineart_chain.c
index b2ca98e9a0b..289b2cc0b10 100644
--- a/source/blender/editors/lineart/lineart_chain.c
+++ b/source/blender/editors/lineart/lineart_chain.c
@@ -716,7 +716,8 @@ static LineartChainRegisterEntry 
*lineart_chain_get_closest_cre(LineartRenderBuf
 unsigned char 
transparency_mask,
 float dist,
 int 
do_geometry_space,
-float 
*result_new_len)
+float 
*result_new_len,
+
LineartBoundingArea *caller_ba)
 {
 
   LineartChainRegisterEntry *cre, *next_cre, *closest_cre = NULL;
@@ -776,14 +777,15 @@ static LineartChainRegisterEntry 
*lineart_chain_get_closest_cre(LineartRenderBuf
 #define LRT_TEST_ADJACENT_AREAS(dist_to, list)\
   if(dist_to0){\
 LISTBASE_FOREACH(LinkData* ,ld,list){\
-  adjacent_closest = 
lineart_chain_get_closest_cre(rb,(LineartBoundingArea*)ld->data,rlc,rlci,occlusion,transparency_mask,dist,do_geometry_space,_new_len);\
+  LineartBoundingArea* sba = (LineartBoundingArea*)ld->data;\
+  adjacent_closest = 
lineart_chain_get_closest_cre(rb,sba,rlc,rlci,occlusion,transparency_mask,dist,do_geometry_space,_new_len,
 ba);\
   if(adjacent_new_len < dist){\
 dist=  adjacent_new_len;\
 closest_cre = adjacent_closest;\
   }\
 }\
   }
-  if(!do_geometry_space){
+  if(!do_geometry_space && !caller_ba){
 LRT_TEST_ADJACENT_AREAS(rlci->pos[0] - ba->l, >lp);
 LRT_TEST_ADJACENT_AREAS(ba->r - rlci->pos[0], >rp);
 LRT_TEST_ADJACENT_AREAS(ba->u - rlci->pos[1], >up);
@@ -834,9 +836,9 @@ void ED_lineart_chain_connect(LineartRenderBuffer *rb, 
const int do_geometry_spa
 while ((ba_l = lineart_bounding_area_get_end_point(rb, rlci_l)) &&
(ba_r = lineart_bounding_area_get_end_point(rb, rlci_r))) {
   closest_cre_l = lineart_chain_get_closest_cre(
-  rb, ba_l, rlc, rlci_l, occlusion, transparency_mask, dist, 
do_geometry_space, _l);
+  rb, ba_l, rlc, rlci_l, occlusion, transparency_mask, dist, 
do_geometry_space, _l, NULL);
   closest_cre_r = lineart_chain_get_closest_cre(
-  rb, ba_r, rlc, rlci_r, occlusion, transparency_mask, dist, 
do_geometry_space, _r);
+  rb, ba_r, rlc, rlci_r, occlusion, transparency_mask, dist, 
do_geometry_space, _r, NULL);
   if (closest_cre_l && closest_cre_r) {
 if (dist_l < dist_r) {
   closest_cre = closest_cre_l;

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


[Bf-blender-cvs] [d142b5605e9] lanpr-under-gp: LineArt: Chaning lookup in near by bounding areas.

2020-10-19 Thread YimingWu
Commit: d142b5605e9518255fb4fe104c3cb0e30a866c7e
Author: YimingWu
Date:   Mon Oct 19 20:25:40 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rBd142b5605e9518255fb4fe104c3cb0e30a866c7e

LineArt: Chaning lookup in near by bounding areas.

===

M   source/blender/editors/lineart/lineart_chain.c

===

diff --git a/source/blender/editors/lineart/lineart_chain.c 
b/source/blender/editors/lineart/lineart_chain.c
index f4e0434b292..b2ca98e9a0b 100644
--- a/source/blender/editors/lineart/lineart_chain.c
+++ b/source/blender/editors/lineart/lineart_chain.c
@@ -770,6 +770,28 @@ static LineartChainRegisterEntry 
*lineart_chain_get_closest_cre(LineartRenderBuf
   }
 }
   }
+  float adjacent_new_len=dist; /* We want a closer point anyway. So using 
modified dist is fine. */
+  LineartChainRegisterEntry* adjacent_closest;
+
+#define LRT_TEST_ADJACENT_AREAS(dist_to, list)\
+  if(dist_to0){\
+LISTBASE_FOREACH(LinkData* ,ld,list){\
+  adjacent_closest = 
lineart_chain_get_closest_cre(rb,(LineartBoundingArea*)ld->data,rlc,rlci,occlusion,transparency_mask,dist,do_geometry_space,_new_len);\
+  if(adjacent_new_len < dist){\
+dist=  adjacent_new_len;\
+closest_cre = adjacent_closest;\
+  }\
+}\
+  }
+  if(!do_geometry_space){
+LRT_TEST_ADJACENT_AREAS(rlci->pos[0] - ba->l, >lp);
+LRT_TEST_ADJACENT_AREAS(ba->r - rlci->pos[0], >rp);
+LRT_TEST_ADJACENT_AREAS(ba->u - rlci->pos[1], >up);
+LRT_TEST_ADJACENT_AREAS(rlci->pos[1] - ba->b, >bp);
+  }
+  if (result_new_len) {
+(*result_new_len) = dist;
+  }
   return closest_cre;
 }

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


[Bf-blender-cvs] [624bb6c9e24] lanpr-under-gp: LineArt: Fuzzy logic fix.

2020-10-19 Thread YimingWu
Commit: 624bb6c9e24b1405c5993d216293ea3730294dd4
Author: YimingWu
Date:   Mon Oct 19 20:22:44 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB624bb6c9e24b1405c5993d216293ea3730294dd4

LineArt: Fuzzy logic fix.

===

M   source/blender/editors/lineart/lineart_chain.c

===

diff --git a/source/blender/editors/lineart/lineart_chain.c 
b/source/blender/editors/lineart/lineart_chain.c
index e1041691fc2..f4e0434b292 100644
--- a/source/blender/editors/lineart/lineart_chain.c
+++ b/source/blender/editors/lineart/lineart_chain.c
@@ -726,16 +726,17 @@ static LineartChainRegisterEntry 
*lineart_chain_get_closest_cre(LineartRenderBuf
   for (cre = ba->linked_chains.first; cre; cre = next_cre) {
 next_cre = cre->next;
 if (cre->rlc->object_ref != rlc->object_ref) {
-  if (rb->fuzzy_everything || rb->fuzzy_intersections) {
-/* If none of those are intersection lines... */
-if ((!(cre->rlc->type & LRT_EDGE_FLAG_INTERSECTION)) &&
-(!(rlc->object_ref->type & LRT_EDGE_FLAG_INTERSECTION))) {
-  continue; /* We don't want to chain along different objects at the 
moment. */
+  if (!rb->fuzzy_everything) {
+if(rb->fuzzy_intersections){
+  /* If none of those are intersection lines... */
+  if ((!(cre->rlc->type & LRT_EDGE_FLAG_INTERSECTION)) &&
+  (!(rlc->type & LRT_EDGE_FLAG_INTERSECTION))) {
+continue; /* We don't want to chain along different objects at the 
moment. */
+  }
+}else {
+  continue;
 }
   }
-  else {
-continue;
-  }
 }
 if (cre->rlc->picked || cre->picked) {
   // BLI_remlink(>linked_chains, cre);

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


[Bf-blender-cvs] [477d983c2e8] master: Animation: Improve labels on Snap menu in graph editor

2020-10-19 Thread Sybren A. Stüvel
Commit: 477d983c2e8ab298cbf638d5aadd77fad9c2f677
Author: Sybren A. Stüvel
Date:   Mon Oct 19 14:01:51 2020 +0200
Branches: master
https://developer.blender.org/rB477d983c2e8ab298cbf638d5aadd77fad9c2f677

Animation: Improve labels on Snap menu in graph editor

Add "Selection to" as prefix for those menu items that move the selected
keyframes to something, for both the Key → Snap menu and the Shift+S pie
menu.

No functional changes.

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_graph.py 
b/release/scripts/startup/bl_ui/space_graph.py
index 212a3d5ea2b..1bf7465e54c 100644
--- a/release/scripts/startup/bl_ui/space_graph.py
+++ b/release/scripts/startup/bl_ui/space_graph.py
@@ -324,11 +324,11 @@ class GRAPH_MT_key_snap(Menu):
 def draw(self, _context):
 layout = self.layout
 
-layout.operator("graph.snap", text="Current Frame").type = 'CFRA'
-layout.operator("graph.snap", text="Cursor Value").type = 'VALUE'
-layout.operator("graph.snap", text="Nearest Frame").type = 
'NEAREST_FRAME'
-layout.operator("graph.snap", text="Nearest Second").type = 
'NEAREST_SECOND'
-layout.operator("graph.snap", text="Nearest Marker").type = 
'NEAREST_MARKER'
+layout.operator("graph.snap", text="Selection to Current Frame").type 
= 'CFRA'
+layout.operator("graph.snap", text="Selection to Cursor Value").type = 
'VALUE'
+layout.operator("graph.snap", text="Selection to Nearest Frame").type 
= 'NEAREST_FRAME'
+layout.operator("graph.snap", text="Selection to Nearest Second").type 
= 'NEAREST_SECOND'
+layout.operator("graph.snap", text="Selection to Nearest Marker").type 
= 'NEAREST_MARKER'
 layout.operator("graph.snap", text="Flatten Handles").type = 
'HORIZONTAL'
 layout.separator()
 layout.operator("graph.frame_jump", text="Cursor to Selection")
@@ -399,11 +399,11 @@ class GRAPH_MT_snap_pie(Menu):
 layout = self.layout
 pie = layout.menu_pie()
 
-pie.operator("graph.snap", text="Current Frame").type = 'CFRA'
-pie.operator("graph.snap", text="Cursor Value").type = 'VALUE'
-pie.operator("graph.snap", text="Nearest Frame").type = 'NEAREST_FRAME'
-pie.operator("graph.snap", text="Nearest Second").type = 
'NEAREST_SECOND'
-pie.operator("graph.snap", text="Nearest Marker").type = 
'NEAREST_MARKER'
+pie.operator("graph.snap", text="Selection to Current Frame").type = 
'CFRA'
+pie.operator("graph.snap", text="Selection to Cursor Value").type = 
'VALUE'
+pie.operator("graph.snap", text="Selection to Nearest Frame").type = 
'NEAREST_FRAME'
+pie.operator("graph.snap", text="Selection to Nearest Second").type = 
'NEAREST_SECOND'
+pie.operator("graph.snap", text="Selection to Nearest Marker").type = 
'NEAREST_MARKER'
 pie.operator("graph.snap", text="Flatten Handles").type = 'HORIZONTAL'
 pie.operator("graph.frame_jump", text="Cursor to Selection")
 pie.operator("graph.snap_cursor_value", text="Cursor Value to 
Selection")

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


[Bf-blender-cvs] [f68493f5bee] temp-trimesh-sculpt: Little design study for new API to replace various pbvh/sculpt iterators (uncomment PROXY_ADVANCED in BKE_pbvh to enable): + Same idea as existing p

2020-10-19 Thread Joseph Eagar
Commit: f68493f5bee352d4a7feb90c2488a264607c84ac
Author: Joseph Eagar
Date:   Mon Oct 19 04:10:34 2020 -0700
Branches: temp-trimesh-sculpt
https://developer.blender.org/rBf68493f5bee352d4a7feb90c2488a264607c84ac

Little design study for new API to replace various pbvh/sculpt
iterators (uncomment PROXY_ADVANCED in BKE_pbvh to enable):
 + Same idea as existing pbvh proxies.
 + Based on "struct of arrays" approach.
 + New ProxyVeryArray structure holds all the coordinates,
   normals, indices, neighbor references, color, mask, etc
   data--basically everything in PBVHVertIter and SculptNeightborIter.
 + Only the desired data is stored.  Client code can pass a mask
   stating which data layers it wants; e.g. normals, coordiantes, etc.

There's a lot of advantages to this approach: simpler and more
maintainable code, possibility of SSE/opencl/cuda vectorization down
the line, etc.

More importantly for this branch, it should be a great profiling tool.
No more trying to figure out which bit of API cruft is causing the CPU
cache to go haywire.  I can eliminate a lot of performance bugs and
concentrate on the ones related to DynTopo.

===

M   source/blender/blenkernel/BKE_pbvh.h
M   source/blender/blenkernel/intern/pbvh.c
M   source/blender/blenkernel/intern/pbvh_intern.h
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h
M   source/blender/editors/sculpt_paint/sculpt_smooth.c

===

diff --git a/source/blender/blenkernel/BKE_pbvh.h 
b/source/blender/blenkernel/BKE_pbvh.h
index 73718ba33bf..3cdbad8885e 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -58,6 +58,77 @@ struct TaskParallelTLS;
 typedef struct PBVH PBVH;
 typedef struct PBVHNode PBVHNode;
 
+#define PROXY_ADVANCED
+
+// experimental performance test of "data-based programming" approach
+#ifdef PROXY_ADVANCED
+typedef struct ProxyKey {
+  int node;
+  int pindex;
+} ProxyKey;
+
+#  define MAX_PROXY_NEIGHBORS 12
+
+typedef struct ProxyVertArray {
+  float **ownerco;
+  short **ownerno;
+  float (*co)[3];
+  float (*fno)[3];
+  short (*no)[3];
+  float *mask, **ownermask;
+  int *index;
+  float **ownercolor, (*color)[4];
+
+  ProxyKey (*neighbors)[MAX_PROXY_NEIGHBORS];
+
+  int size;
+  int datamask;
+
+  GHash *indexmap;
+} ProxyVertArray;
+
+typedef enum {
+  PV_OWNERCO = 1,
+  PV_OWNERNO = 2,
+  PV_CO = 4,
+  PV_NO = 8,
+  PV_MASK = 16,
+  PV_OWNERMASK = 32,
+  PV_INDEX = 64,
+  PV_OWNERCOLOR = 128,
+  PV_COLOR = 256,
+  PV_NEIGHBORS = 512
+} ProxyVertField;
+
+typedef struct ProxyVertUpdateRec {
+  float *co, *no, *mask, *color;
+  int index, newindex;
+} ProxyVertUpdateRec;
+
+#  define PBVH_PROXY_DEFAULT CO | INDEX | MASK
+
+struct SculptSession;
+
+void BKE_pbvh_ensure_proxyarrays(struct SculptSession *ss, PBVH *pbvh, int 
mask);
+void BKE_pbvh_load_proxyarrays(PBVH *pbvh, PBVHNode **nodes, int totnode, int 
mask);
+
+void BKE_pbvh_ensure_proxyarray(
+struct SculptSession *ss,
+struct PBVH *pbvh,
+struct PBVHNode *node,
+int mask,
+struct GHash
+*vert_node_map,  // vert_node_map maps vertex SculptIdxs to PBVHNode 
indices; optional
+bool check_indexmap,
+bool force_update);
+void BKE_pbvh_gather_proxyarray(PBVH *pbvh, PBVHNode **nodes, int totnode);
+
+void BKE_pbvh_free_proxyarray(struct PBVH *pbvh, struct PBVHNode *node);
+void BKE_pbvh_update_proxyvert(struct PBVH *pbvh, struct PBVHNode *node, 
ProxyVertUpdateRec *rec);
+ProxyVertArray *BKE_pbvh_get_proxyarrays(struct PBVH *pbvh, struct PBVHNode 
*node);
+
+#endif
+
 typedef struct {
   float (*co)[3];
 } PBVHProxyNode;
@@ -107,12 +178,16 @@ void TMElemSet_remove(TMElemSet *ts, void *elem, bool 
ignoreExist);
 bool TMElemSet_has(TMElemSet *ts, void *elem);
 
 #define TMS_ITER(v, ts) \
-{int _i1; for (_i1=0; _i1cur; _i1++) {\
-  if (!ts->elems[_i1])\
-continue;\
-  v = ts->elems[_i1];
-
-#define TMS_ITER_END }}
+  { \
+int _i1; \
+for (_i1 = 0; _i1 < ts->cur; _i1++) { \
+  if (!ts->elems[_i1]) \
+continue; \
+  v = ts->elems[_i1];
+
+#define TMS_ITER_END \
+  } \
+  }
 
 void BKE_pbvh_set_frustum_planes(PBVH *pbvh, PBVHFrustumPlanes *planes);
 void BKE_pbvh_get_frustum_planes(PBVH *pbvh, PBVHFrustumPlanes *planes);
@@ -155,14 +230,14 @@ void BKE_pbvh_build_bmesh(PBVH *pbvh,
   const int cd_vert_node_offset,
   const int cd_face_node_offset);
 void BKE_pbvh_build_trimesh(PBVH *bvh,
-  struct TM_TriMesh *bm,
-  bool smooth_shading,
-  struct TriMeshLog *log,
-  const int cd_vert_node_offset,
-  const int cd_face_node_offset);
+struct TM_TriMesh *bm,
+bool smooth_shading,
+struct TriMeshLog *log,
+const int cd_vert_node_offset,
+ 

[Bf-blender-cvs] [e3c76f79372] master: Fix libmv eigen alignment issues when compiling with AVX support

2020-10-19 Thread Sebastian Parborg
Commit: e3c76f793724cd7e0ade4dc610b104fb9996901c
Author: Sebastian Parborg
Date:   Mon Oct 19 13:03:06 2020 +0200
Branches: master
https://developer.blender.org/rBe3c76f793724cd7e0ade4dc610b104fb9996901c

Fix libmv eigen alignment issues when compiling with AVX support

There would be eigen alignment issues with the custom libmv vector
class when compiling with AVX optimizations. This would lead to
segfaults.

Simply use the std::vector base class as suggested by the old TODO in
the class header.

Reviewed By: Sergey

Differential Revision: http://developer.blender.org/D8968

===

M   intern/libmv/libmv/base/vector.h
M   intern/libmv/libmv/base/vector_test.cc

===

diff --git a/intern/libmv/libmv/base/vector.h b/intern/libmv/libmv/base/vector.h
index bdc4392155c..300291c5679 100644
--- a/intern/libmv/libmv/base/vector.h
+++ b/intern/libmv/libmv/base/vector.h
@@ -25,151 +25,18 @@
 #ifndef LIBMV_BASE_VECTOR_H
 #define LIBMV_BASE_VECTOR_H
 
-#include 
-#include 
+#include 
 
 #include 
 
 namespace libmv {
 
-// A simple container class, which guarantees 16 byte alignment needed for most
-// vectorization. Don't use this container for classes that cannot be copied
-// via memcpy.
-// FIXME: this class has some issues:
-// - doesn't support iterators.
-// - impede compatibility with code using STL.
-// - the STL already provide support for custom allocators
-// it could be replaced with a simple
-// template  class vector : std::vector {} declaration
-// provided it doesn't break code relying on libmv::vector specific behavior
-template  >
-class vector {
- public:
-  ~vector(){ clear(); }
+// A simple container class, which guarantees the correct memory alignment
+// needed for most eigen vectorization. Don't use this container for classes
+// that cannot be copied via memcpy.
 
-  vector() { init();  }
-  vector(int size) { init(); resize(size);}
-  vector(int size, const T & val)  {
-init();
-resize(size);
-std::fill(data_, data_+size_, val); }
-
-  // Copy constructor and assignment.
-  vector(const vector ) {
-init();
-copy(rhs);
-  }
-  vector =(const vector ) {
-if ( != this) {
-  copy(rhs);
-}
-return *this;
-  }
-
-  /// Swaps the contents of two vectors in constant time.
-  void swap(vector ) {
-std::swap(allocator_, other.allocator_);
-std::swap(size_, other.size_);
-std::swap(capacity_, other.capacity_);
-std::swap(data_, other.data_);
-  }
-
-T *data()const { return data_;}
-  int  size()const { return size_;}
-  int  capacity()const { return capacity_;}
-  const T& back()const { return data_[size_ - 1]; }
-T& back()  { return data_[size_ - 1]; }
-  const T& front()   const { return data_[0]; }
-T& front() { return data_[0]; }
-  const T& operator[](int n) const { return data_[n]; }
-T& operator[](int n)   { return data_[n]; }
-  const T& at(int n) const { return data_[n]; }
-T& at(int n)   { return data_[n]; }
-  const T * begin()  const { return data_;}
-  const T * end()const { return data_+size_;  }
-T * begin(){ return data_;}
-T * end()  { return data_+size_;  }
-
-  void resize(size_t size) {
-reserve(size);
-if (size > size_) {
-  construct(size_, size);
-} else if (size < size_) {
-  destruct(size, size_);
-}
-size_ = size;
-  }
-
-  void push_back(const T ) {
-if (size_ == capacity_) {
-  reserve(size_ ? 2 * size_ : 1);
-}
-new (_[size_++]) T(value);
-  }
-
-  void pop_back() {
-resize(size_ - 1);
-  }
-
-  void clear() {
-destruct(0, size_);
-deallocate();
-init();
-  }
-
-  void reserve(unsigned int size) {
-if (size > size_) {
-  T *data = static_cast(allocate(size));
-  memcpy(static_cast(data), data_, sizeof(*data)*size_);
-  allocator_.deallocate(data_, capacity_);
-  data_ = data;
-  capacity_ = size;
-}
-  }
-
-  bool empty() {
-return size_ == 0;
-  }
-
- private:
-  void construct(int start, int end) {
-for (int i = start; i < end; ++i) {
-  new (_[i]) T;
-}
-  }
-  void destruct(int start, int end) {
-for (int i = start; i < end; ++i) {
-  data_[i].~T();
-}
-  }
-  void init() {
-size_ = 0;
-data_ = 0;
-capacity_ = 0;
-  }
-
-  void *allocate(int size) {
-return size ? allocator_.allocate(size) : 0;
-  }
-
-  void deallocate() {
-allocator_.deallocate(data_, size_);
-data_ = 0;
-  }
-
-  void copy(const vector ) {
-

[Bf-blender-cvs] [b17ad27adcc] master: Silence an unused variable warning in bmesh_bevel.c.

2020-10-19 Thread Howard Trickey
Commit: b17ad27adcc016f75329c73849468a4585804fcf
Author: Howard Trickey
Date:   Mon Oct 19 06:53:52 2020 -0400
Branches: master
https://developer.blender.org/rBb17ad27adcc016f75329c73849468a4585804fcf

Silence an unused variable warning in bmesh_bevel.c.

===

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 3b32298426a..f54db513d0f 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -1178,6 +1178,7 @@ static bool edge_edge_angle_less_than_180(const BMEdge 
*e1, const BMEdge *e2, co
   }
   else {
 BLI_assert(false);
+return false;
   }
   sub_v3_v3v3(dir1, v1->co, v->co);
   sub_v3_v3v3(dir2, v2->co, v->co);

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


[Bf-blender-cvs] [e49ee5a8084] master: Fix (unreported) crash when unlinking a brush from a tool.

2020-10-19 Thread Bastien Montagne
Commit: e49ee5a8084c619905947486c071ddd44c9e42d1
Author: Bastien Montagne
Date:   Mon Oct 19 12:48:38 2020 +0200
Branches: master
https://developer.blender.org/rBe49ee5a8084c619905947486c071ddd44c9e42d1

Fix (unreported) crash when unlinking a brush from a tool.

Cursor drawing code was not checking for potential NULL pointers.

===

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

===

diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c 
b/source/blender/editors/sculpt_paint/paint_cursor.c
index 2e24c2533c5..f0285c8faf3 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -1265,7 +1265,13 @@ static bool paint_cursor_context_init(bContext *C,
   pcontext->scene = CTX_data_scene(C);
   pcontext->ups = >scene->toolsettings->unified_paint_settings;
   pcontext->paint = BKE_paint_get_active_from_context(C);
+  if (pcontext->paint == NULL) {
+return false;
+  }
   pcontext->brush = BKE_paint_brush(pcontext->paint);
+  if (pcontext->brush == NULL) {
+return false;
+  }
   pcontext->mode = BKE_paintmode_get_active_from_context(C);
 
   ED_view3d_viewcontext_init(C, >vc, pcontext->depsgraph);

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


[Bf-blender-cvs] [93887d10961] master: Fix: skip drawing input sockets that do not have a draw method

2020-10-19 Thread Jacques Lucke
Commit: 93887d10961a65843f8e70d7d4f5a1b64aba46b5
Author: Jacques Lucke
Date:   Mon Oct 19 12:28:44 2020 +0200
Branches: master
https://developer.blender.org/rB93887d10961a65843f8e70d7d4f5a1b64aba46b5

Fix: skip drawing input sockets that do not have a draw method

Contributed by @povmaniaco with minor changes by me.

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

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_node.py 
b/release/scripts/startup/bl_ui/space_node.py
index 4662de8b4ac..c0c38c02c63 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -537,7 +537,7 @@ class NODE_PT_active_node_properties(Panel):
 
 # XXX this could be filtered further to exclude socket types
 # which don't have meaningful input values (e.g. cycles shader)
-value_inputs = [socket for socket in node.inputs if socket.enabled and 
not socket.is_linked]
+value_inputs = [socket for socket in node.inputs if 
self.show_socket_input(socket)]
 if value_inputs:
 layout.separator()
 layout.label(text="Inputs:")
@@ -550,6 +550,9 @@ class NODE_PT_active_node_properties(Panel):
 iface_(socket.label if socket.label else socket.name, 
socket.bl_rna.translation_context),
 )
 
+def show_socket_input(self, socket):
+return hasattr(socket, 'draw') and socket.enabled and not 
socket.is_linked
+
 
 class NODE_PT_texture_mapping(Panel):
 bl_space_type = 'NODE_EDITOR'

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


[Bf-blender-cvs] [f7832b1583c] master: Volumes: new Volume to Mesh modifier

2020-10-19 Thread Jacques Lucke
Commit: f7832b1583cd13bde182192bce358db3062a0547
Author: Jacques Lucke
Date:   Mon Oct 19 12:11:38 2020 +0200
Branches: master
https://developer.blender.org/rBf7832b1583cd13bde182192bce358db3062a0547

Volumes: new Volume to Mesh modifier

This modifier is the opposite of the recently added Mesh to Volume modifier.
It converts the "surface" of a volume into a mesh. The "surface" is defined
by a threshold value. All voxels with a density higher than the threshold
are considered to be inside the volume, while all others will be outside.

By default, the resolution of the generated mesh depends on the voxel
size of the volume grid. The resolution can be customized. It should be
noted that a lower resolution might not make this modifier faster. This
is because we have to downsample the openvdb grid, which isn't a cheap
operation.

Converting a mesh to a volume and then back to a mesh is possible,
but it does require two separate mesh objects for now.

Reviewers: brecht

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

===

M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/makesdna/DNA_modifier_types.h
M   source/blender/makesrna/RNA_access.h
M   source/blender/makesrna/intern/rna_modifier.c
M   source/blender/modifiers/CMakeLists.txt
M   source/blender/modifiers/MOD_modifiertypes.h
M   source/blender/modifiers/intern/MOD_util.c
A   source/blender/modifiers/intern/MOD_volume_to_mesh.cc

===

diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index fdea26ce730..0275f4dd587 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -22,9 +22,8 @@
  * \ingroup bke
  */
 
-/* defines BLI_INLINE */
 #include "BKE_mesh_types.h"
-#include "BLI_compiler_compat.h"
+#include "BLI_utildefines.h"
 
 struct BLI_Stack;
 struct BMEditMesh;
diff --git a/source/blender/makesdna/DNA_modifier_types.h 
b/source/blender/makesdna/DNA_modifier_types.h
index 7a13b9f4852..34d2c80dc5d 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -97,6 +97,7 @@ typedef enum ModifierType {
   eModifierType_Simulation = 57,
   eModifierType_MeshToVolume = 58,
   eModifierType_VolumeDisplace = 59,
+  eModifierType_VolumeToMesh = 60,
   NUM_MODIFIER_TYPES,
 } ModifierType;
 
@@ -2275,6 +2276,39 @@ enum {
   MOD_VOLUME_DISPLACE_MAP_OBJECT = 2,
 };
 
+typedef struct VolumeToMeshModifierData {
+  ModifierData modifier;
+
+  /** This is the volume object that is supposed to be converted to a mesh. */
+  struct Object *object;
+
+  float threshold;
+  float adaptivity;
+
+  /** VolumeToMeshFlag */
+  uint32_t flag;
+
+  /** VolumeToMeshResolutionMode */
+  int resolution_mode;
+  float voxel_size;
+  int voxel_amount;
+
+  /** MAX_NAME */
+  char grid_name[64];
+} VolumeToMeshModifierData;
+
+/** VolumeToMeshModifierData->resolution_mode */
+typedef enum VolumeToMeshResolutionMode {
+  VOLUME_TO_MESH_RESOLUTION_MODE_GRID = 0,
+  VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_AMOUNT = 1,
+  VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_SIZE = 2,
+} VolumeToMeshResolutionMode;
+
+/** VolumeToMeshModifierData->flag */
+typedef enum VolumeToMeshFlag {
+  VOLUME_TO_MESH_USE_SMOOTH_SHADE = 1 << 0,
+} VolumeToMeshFlag;
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/makesrna/RNA_access.h 
b/source/blender/makesrna/RNA_access.h
index 0b882742839..8096c6d7d10 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -710,6 +710,7 @@ extern StructRNA RNA_ViewLayer;
 extern StructRNA RNA_ViewLayerEEVEE;
 extern StructRNA RNA_Volume;
 extern StructRNA RNA_VolumeDisplaceModifier;
+extern StructRNA RNA_VolumeToMeshModifier;
 extern StructRNA RNA_VoronoiTexture;
 extern StructRNA RNA_WalkNavigation;
 extern StructRNA RNA_WarpModifier;
diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index 0010e473924..48ea894aba1 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -198,6 +198,11 @@ const EnumPropertyItem 
rna_enum_object_modifier_type_items[] = {
  ICON_VOLUME_DATA,
  "Mesh to Volume",
  ""}, /* TODO: Use correct icon. */
+{eModifierType_VolumeToMesh,
+ "VOLUME_TO_MESH",
+ ICON_VOLUME_DATA,
+ "Volume to Mesh",
+ ""}, /* TODO: Use correct icon. */
 {0, "", 0, N_("Deform"), ""},
 {eModifierType_Armature,
  "ARMATURE",
@@ -7133,6 +7138,89 @@ static void rna_def_modifier_volume_displace(BlenderRNA 
*brna)
   RNA_define_lib_overridable(false);
 }
 
+static void rna_def_modifier_volume_to_mesh(BlenderRNA *brna)
+{
+  StructRNA *srna;
+  PropertyRNA *prop;
+
+  static EnumPropertyItem resolution_mode_items[] = {
+  {VOLUME_TO_MESH_RESOLUTION_MODE_GRID,
+   "GRID",
+ 

[Bf-blender-cvs] [bd15efefd2f] master: Cleanup: clang tidy

2020-10-19 Thread Jacques Lucke
Commit: bd15efefd2f2d3554364303a09b67198e39d7bcd
Author: Jacques Lucke
Date:   Mon Oct 19 11:34:26 2020 +0200
Branches: master
https://developer.blender.org/rBbd15efefd2f2d3554364303a09b67198e39d7bcd

Cleanup: clang tidy

===

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 f45457085dc..3b32298426a 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -7196,11 +7196,9 @@ static float geometry_collide_offset(BevelParams *bp, 
EdgeHalf *eb)
   if (bp->offset_type == BEVEL_AMT_PERCENT) {
 return bp->offset > 50.0f ? 50.0f : 100.f;
   }
-  else {
-/* This is only right sometimes. The exact answer is very hard to 
calculate. */
-float blen = BM_edge_calc_length(eb->e);
-return bp->offset > blen / 2.0f ? blen / 2.0f : blen;
-  }
+  /* This is only right sometimes. The exact answer is very hard to 
calculate. */
+  float blen = BM_edge_calc_length(eb->e);
+  return bp->offset > blen / 2.0f ? blen / 2.0f : blen;
 }
 return no_collide_offset;
   }

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


[Bf-blender-cvs] [850944e6cda] master: Image: Export emissive colors in 3 channel PNG images

2020-10-19 Thread Jeroen Bakker
Commit: 850944e6cda763f099652bf97d52d22f1deb5daa
Author: Jeroen Bakker
Date:   Mon Oct 19 11:29:47 2020 +0200
Branches: master
https://developer.blender.org/rB850944e6cda763f099652bf97d52d22f1deb5daa

Image: Export emissive colors in 3 channel PNG images

Related to T81199. When saving a rendered image with transparency (RGBA)
to a 3 channel PNG image the emissive colors were not exported. This
change adds the emissive colors to the written file.

NOTE: this does not fix the limitation of writing emissive colors to a 4
channel PNG file as the file format does not support this.

===

M   source/blender/imbuf/intern/imageprocess.c

===

diff --git a/source/blender/imbuf/intern/imageprocess.c 
b/source/blender/imbuf/intern/imageprocess.c
index 6ad69e72b4f..f8029c08bad 100644
--- a/source/blender/imbuf/intern/imageprocess.c
+++ b/source/blender/imbuf/intern/imageprocess.c
@@ -458,17 +458,8 @@ void IMB_alpha_under_color_float(float *rect_float, int x, 
int y, float backcol[
   float *fp = rect_float;
 
   while (a--) {
-if (fp[3] == 0.0f) {
-  copy_v3_v3(fp, backcol);
-}
-else {
-  float mul = 1.0f - fp[3];
-
-  fp[0] += mul * backcol[0];
-  fp[1] += mul * backcol[1];
-  fp[2] += mul * backcol[2];
-}
-
+const float mul = 1.0f - fp[3];
+madd_v3_v3fl(fp, backcol, mul);
 fp[3] = 1.0f;
 
 fp += 4;

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


[Bf-blender-cvs] [77030d813e5] lanpr-under-gp: LineArt: Use "Show Clipping Boundaries" for clarity

2020-10-19 Thread YimingWu
Commit: 77030d813e5ffb98adac7e928390baf512a62e5f
Author: YimingWu
Date:   Mon Oct 19 17:33:11 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB77030d813e5ffb98adac7e928390baf512a62e5f

LineArt: Use "Show Clipping Boundaries" for clarity

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_render.py 
b/release/scripts/startup/bl_ui/properties_render.py
index d15091ae659..9466e5ff4c7 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -759,7 +759,8 @@ class RENDER_PT_lineart_line_types(RenderButtonsPanel, 
Panel):
 layout.label(text="Extras:")
 layout.prop(lineart, "allow_duplication", text="Allow Instances")
 layout.prop(lineart, "allow_overlapping_edges")
-layout.prop(lineart, "allow_clipping_boundaries")
+layout.prop(lineart, "allow_clipping_boundaries",
+text="Show Clipping Boundaries")
 layout.prop(lineart, "remove_doubles")

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


[Bf-blender-cvs] [0691c3d6407] temp-gpencil-fading-modifier: GPencil: Better fading effect arguments.

2020-10-19 Thread YimingWu
Commit: 0691c3d6407d944147178ebad13f012e1bb7c1ed
Author: YimingWu
Date:   Mon Oct 19 17:05:56 2020 +0800
Branches: temp-gpencil-fading-modifier
https://developer.blender.org/rB0691c3d6407d944147178ebad13f012e1bb7c1ed

GPencil: Better fading effect arguments.

===

M   release/datafiles/locale
M   release/scripts/addons
M   release/scripts/addons_contrib
M   source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
M   source/blender/makesdna/DNA_gpencil_modifier_types.h
M   source/blender/makesrna/intern/rna_gpencil_modifier.c
M   source/tools

===

diff --git a/release/datafiles/locale b/release/datafiles/locale
index 8f5a0e027f1..8a05b618f03 16
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 8f5a0e027f131104974763d30db36b1a9ffae16a
+Subproject commit 8a05b618f031582c006c6f62b9e60619ab3eef8b
diff --git a/release/scripts/addons b/release/scripts/addons
index 8ad9de7c1e1..67f1fbca148 16
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 8ad9de7c1e1022dee907ddce78f4c357111fc09e
+Subproject commit 67f1fbca1482d9d9362a4001332e785c3fd5d230
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index 26a8b2eadc7..ef6ef414d22 16
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit 26a8b2eadc7abb2a30fac50eb5505aa24daf5785
+Subproject commit ef6ef414d22c2578fad99327743b925ab640a99c
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
index 561d3495d92..6b41bfba87b 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
@@ -87,6 +87,37 @@ static void copyData(const GpencilModifierData *md, 
GpencilModifierData *target)
   tgmd->curve_intensity = BKE_curvemapping_copy(gmd->curve_intensity);
 }
 
+static float give_opacity_fading_factor(OpacityGpencilModifierData *mmd,
+Object *ob_this,
+float *pos,
+bool apply_obmat)
+{
+  float factor_depth = 1;
+  if (mmd->flag & GP_OPACITY_FADING) {
+if (mmd->object) {
+  float gvert[3];
+  if (apply_obmat) {
+mul_v3_m4v3(gvert, ob_this->obmat, pos);
+  }
+  float dist = len_v3v3(mmd->object->obmat[3], gvert);
+  float fading_max = MAX2(mmd->fading_start, mmd->fading_end);
+  float fading_min = MIN2(mmd->fading_start, mmd->fading_end);
+
+  /* Better with ratiof() function from line art. */
+  if (dist > fading_max) {
+factor_depth = 0;
+  }
+  else if (dist <= fading_max && dist > fading_min) {
+factor_depth = (fading_max - dist) / (fading_max - fading_min);
+  }
+  else {
+factor_depth = 1;
+  }
+}
+  }
+  return factor_depth;
+}
+
 /* opacity strokes */
 static void deformStroke(GpencilModifierData *md,
  Depsgraph *UNUSED(depsgraph),
@@ -140,29 +171,8 @@ static void deformStroke(GpencilModifierData *md,
 factor_curve *= BKE_curvemapping_evaluateF(mmd->curve_intensity, 0, 
value);
   }
 
-  float factor_depth = 1;
-  if (mmd->flag & GP_OPACITY_FADING) {
-if (mmd->object) {
-  float gvert[3];
-  mul_v3_m4v3(gvert, ob->obmat, >x);
-  float dist = len_v3v3(mmd->object->obmat[3], gvert);
-  float fading_max = MAX2(mmd->fading_start, mmd->fading_end);
-  float fading_min = MIN2(mmd->fading_start, mmd->fading_end);
-
-  /* Better with ratiof() function from line art. */
-  if (dist > fading_max) {
-factor_depth = 0;
-  }
-  else if (dist <= fading_max && dist > fading_min) {
-factor_depth = (fading_max - dist) / (fading_max - fading_min);
-  }
-  else {
-factor_depth = 1;
-  }
-}
-  }
-
-  factor_curve *= factor_depth;
+  float factor_depth = give_opacity_fading_factor(mmd, ob, >x, true);
+  factor_curve = interpf(mmd->factor, mmd->fading_end_factor, 
factor_depth);
 
   if (def_nr < 0) {
 if (mmd->flag & GP_OPACITY_NORMALIZE) {
@@ -195,28 +205,8 @@ static void deformStroke(GpencilModifierData *md,
 
 gps->fill_opacity_fac = mmd->factor;
 
-float factor_depth = 1;
-if (mmd->flag & GP_OPACITY_FADING) {
-  if (mmd->object) {
-
-float dist = len_v3v3(mmd->object->obmat[3], ob->obmat[3]);
-float fading_max = MAX2(mmd->fading_start, mmd->fading_end);
-float fading_min = MIN2(mmd->fading_start, mmd->fading_end);
-
-/* Better with ratiof() function from line art. 

[Bf-blender-cvs] [f52f51aef21] master: Cleanup: spelling in comments

2020-10-19 Thread Alistair Sealy
Commit: f52f51aef2126e599e6d0bd5f234ec912e5fb394
Author: Alistair Sealy
Date:   Mon Oct 19 09:26:01 2020 +0200
Branches: master
https://developer.blender.org/rBf52f51aef2126e599e6d0bd5f234ec912e5fb394

Cleanup: spelling in comments

Fixed a couple of typos in comments in CMakeLists.txt and GNUmakefile

Reviewed By: #platforms_builds_tests, mont29

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

===

M   CMakeLists.txt
M   GNUmakefile

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9fe108c2ba2..eb04da749ab 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,8 +43,8 @@ endif()
 
 cmake_minimum_required(VERSION 3.10)
 
-# Prever LEGACY OpenGL to eb compatible with all the existing releases and
-# platforms which don't hare GLVND yet. Only do it if preference was not set
+# Prefer LEGACY OpenGL to be compatible with all the existing releases and
+# platforms which don't have GLVND yet. Only do it if preference was not set
 # externally.
 if(NOT DEFINED OpenGL_GL_PREFERENCE)
   set(OpenGL_GL_PREFERENCE "LEGACY")
diff --git a/GNUmakefile b/GNUmakefile
index 660493b5945..1a462b7a351 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -89,7 +89,7 @@ Spell Checkers
* check_spelling_osl:Check for spelling errors (OSL only).
* check_spelling_py: Check for spelling errors (Python only).
 
-   Note that spell checkers can tak a 'CHECK_SPELLING_CACHE' filepath argument,
+   Note that spell checkers can take a 'CHECK_SPELLING_CACHE' filepath 
argument,
so re-running does not need to re-check unchanged files.
 
Example:

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


[Bf-blender-cvs] [70867ff74ea] lanpr-under-gp: LineArt: Vertex group input will select all when filter is empty

2020-10-19 Thread YimingWu
Commit: 70867ff74ead6167844b51304c429493f11c0078
Author: YimingWu
Date:   Mon Oct 19 15:12:20 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB70867ff74ead6167844b51304c429493f11c0078

LineArt: Vertex group input will select all when filter is empty

===

M   source/blender/editors/lineart/lineart_cpu.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
M   source/blender/makesrna/intern/rna_gpencil_modifier.c

===

diff --git a/source/blender/editors/lineart/lineart_cpu.c 
b/source/blender/editors/lineart/lineart_cpu.c
index 727795a13c3..4223cd45d34 100644
--- a/source/blender/editors/lineart/lineart_cpu.c
+++ b/source/blender/editors/lineart/lineart_cpu.c
@@ -4195,7 +4195,7 @@ void ED_lineart_gpencil_generate_from_chain(Depsgraph 
*depsgraph,
   continue;
 }
 LISTBASE_FOREACH (bDeformGroup *, db, _ob->defbase) {
-  if (strstr(db->name, source_vgname) == db->name) {
+  if ((!source_vgname) || strstr(db->name, source_vgname) == db->name) 
{
 if (match_output) {
   gpdg = BKE_object_defgroup_name_index(gpencil_object, db->name);
   if (gpdg < 0) {
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index b79b444ab15..50840cc5501 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -433,10 +433,7 @@ static void vgroup_panel_draw(const bContext *C, Panel 
*panel)
 
   uiLayoutSetPropSep(layout, true);
 
-  uiItemR(layout, ptr, "soft_selection", 0, NULL, ICON_NONE);
-
   row = uiLayoutRow(layout, true);
-  uiItemR(row, ptr, "source_vertex_group", 0, "Source", ICON_GROUP_VERTEX);
   uiItemR(row, ptr, "invert_source_vertex_group", UI_ITEM_R_TOGGLE, "", 
ICON_ARROW_LEFTRIGHT);
 
   uiItemR(layout, ptr, "match_output_vertex_group", 0, NULL, ICON_NONE);
@@ -445,6 +442,9 @@ static void vgroup_panel_draw(const bContext *C, Panel 
*panel)
   if (!match_output) {
 uiItemPointerR(layout, ptr, "vertex_group", _ptr, "vertex_groups", 
"Target", ICON_NONE);
   }
+
+  uiItemR(layout, ptr, "soft_selection", 0, NULL, ICON_NONE);
+  uiItemR(row, ptr, "source_vertex_group", 0, "Filter source", 
ICON_GROUP_VERTEX);
 }
 
 static void panelRegister(ARegionType *region_type)
@@ -455,7 +455,7 @@ static void panelRegister(ARegionType *region_type)
   gpencil_modifier_subpanel_register(
   region_type, "occlusion", "Occlusion", NULL, occlusion_panel_draw, 
panel_type);
   gpencil_modifier_subpanel_register(
-  region_type, "vgroup", "Vertex Group", NULL, vgroup_panel_draw, 
panel_type);
+  region_type, "vgroup", "Vertex Weight Transfer", NULL, 
vgroup_panel_draw, panel_type);
 }
 
 GpencilModifierTypeInfo modifierType_Gpencil_Lineart = {
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c 
b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index b1cccac147c..75c6a688ba9 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -2385,9 +2385,10 @@ static void rna_def_modifier_gpencillineart(BlenderRNA 
*brna)
   RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
 
   prop = RNA_def_property(srna, "source_vertex_group", PROP_STRING, PROP_NONE);
-  RNA_def_property_ui_text(prop,
-   "Source Vertex Group",
-   "Matches the beginning of names of vertex groups 
from mesh objects");
+  RNA_def_property_ui_text(
+  prop,
+  "Source Vertex Group",
+  "Matches the beginning of vertex group names from mesh objects, match 
all when left empty");
   RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
 
   prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);

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


[Bf-blender-cvs] [3a00152fe71] lanpr-under-gp: LineArt: Option for remove doubles when loading mesh.

2020-10-19 Thread YimingWu
Commit: 3a00152fe711665bcb911a318dc856c582cc09ad
Author: YimingWu
Date:   Mon Oct 19 14:34:17 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB3a00152fe711665bcb911a318dc856c582cc09ad

LineArt: Option for remove doubles when loading mesh.

===

M   release/scripts/startup/bl_ui/properties_render.py
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/blenloader/intern/versioning_290.c
M   source/blender/editors/include/ED_lineart.h
M   source/blender/editors/lineart/lineart_cpu.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/release/scripts/startup/bl_ui/properties_render.py 
b/release/scripts/startup/bl_ui/properties_render.py
index 36c2f2ed23c..d15091ae659 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -760,6 +760,7 @@ class RENDER_PT_lineart_line_types(RenderButtonsPanel, 
Panel):
 layout.prop(lineart, "allow_duplication", text="Allow Instances")
 layout.prop(lineart, "allow_overlapping_edges")
 layout.prop(lineart, "allow_clipping_boundaries")
+layout.prop(lineart, "remove_doubles")
 
 
 class RENDER_PT_lineart_baking(RenderButtonsPanel, Panel):
diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index b7617e85ce3..c44e9b5efff 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -5115,16 +5115,6 @@ void blo_do_versions_280(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
   }
 }
 
-for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-  if (!DNA_struct_find(fd->filesdna, "SceneLineart")) {
-for (Scene *scene = bmain->scenes.first; scene; scene = 
scene->id.next) {
-  scene->lineart.crease_threshold = 145.0f; /* in degrees. */
-  scene->lineart.line_types |= LRT_EDGE_FLAG_ALL_TYPE;
-  scene->lineart.flags |= LRT_ALLOW_DUPLI_OBJECTS;
-}
-  }
-}
-
 for (wmWindowManager *wm = bmain->wm.first; wm; wm = wm->id.next) {
   /* Don't rotate light with the viewer by default, make it fixed. Shading 
settings can't be
* edited and this flag should always be set. So we can always execute 
this. */
diff --git a/source/blender/blenloader/intern/versioning_290.c 
b/source/blender/blenloader/intern/versioning_290.c
index 5e6fdad8509..6d4244e789c 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -862,6 +862,16 @@ void blo_do_versions_290(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 part->phystype = PART_PHYS_NO;
   }
 }
+
+for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+  if (!DNA_struct_find(fd->filesdna, "SceneLineart")) {
+for (Scene *scene = bmain->scenes.first; scene; scene = 
scene->id.next) {
+  scene->lineart.crease_threshold = 145.0f; /* in degrees. */
+  scene->lineart.line_types |= LRT_EDGE_FLAG_ALL_TYPE;
+  scene->lineart.flags |= (LRT_ALLOW_DUPLI_OBJECTS | 
LRT_REMOVE_DOUBLES);
+}
+  }
+}
   }
 
   /**
diff --git a/source/blender/editors/include/ED_lineart.h 
b/source/blender/editors/include/ED_lineart.h
index 524ec7ba2b0..57054c4ee8e 100644
--- a/source/blender/editors/include/ED_lineart.h
+++ b/source/blender/editors/include/ED_lineart.h
@@ -259,6 +259,7 @@ typedef struct LineartRenderBuffer {
   char fuzzy_intersections;
   char fuzzy_everything;
   char allow_boundaries;
+  char remove_doubles;
 
   /** Keep an copy of these data so the scene can be freed when lineart is 
runnning. */
   char cam_is_persp;
diff --git a/source/blender/editors/lineart/lineart_cpu.c 
b/source/blender/editors/lineart/lineart_cpu.c
index d5b4b58c7e7..727795a13c3 100644
--- a/source/blender/editors/lineart/lineart_cpu.c
+++ b/source/blender/editors/lineart/lineart_cpu.c
@@ -37,6 +37,7 @@
 #include "BKE_curve.h"
 #include "BKE_customdata.h"
 #include "BKE_deform.h"
+#include "BKE_editmesh.h"
 #include "BKE_global.h"
 #include "BKE_gpencil.h"
 #include "BKE_gpencil_geom.h"
@@ -1592,6 +1593,30 @@ static void lineart_geometry_object_load(Depsgraph *dg,
&((struct BMeshFromMeshParams){
.calc_face_normal = true,
}));
+
+if (rb->remove_doubles) {
+  BMEditMesh *em = BKE_editmesh_create(bm, false);
+  BMOperator findop, weldop;
+  BMO_op_initf(bm,
+   ,
+   BMO_FLAG_DEFAULTS,
+   "find_doubles verts=%av keep_verts=%Hv dist=%f",
+   BM_ELEM_SELECT,
+   0.0001);
+
+  BMO_op_exec(bm, );
+
+  /* 

[Bf-blender-cvs] [1ceb91d1b39] master: Fix T81167: Texture Painting with Paint mask enabled, (de)selecting faces causes a mess with texture slots

2020-10-19 Thread Jeroen Bakker
Commit: 1ceb91d1b3947fda67a70a2eff785a964e625ca2
Author: Jeroen Bakker
Date:   Mon Oct 19 08:08:49 2020 +0200
Branches: master
https://developer.blender.org/rB1ceb91d1b3947fda67a70a2eff785a964e625ca2

Fix T81167: Texture Painting with Paint mask enabled, (de)selecting faces 
causes a mess with texture slots

Issue caused by {9582797d4b50} in b2.90. The surface per material used
an index buffer owned by the batch. These index buffers are created at
the same time the surface tris index buffer was created. When a material
per batch buffer was invalidated it used the surface tris index buffer
rendering all materials on all surfaces making the last draw command
render succeed.

This patch stores the surface tris per material in the cache so they can
be reused. There is also no need to use the `saved_elem_ranges` anymore as they 
are
now part of the cache.

The ugly bit of the implementation is that in `extract_tris_finish` the
MeshBufferCache is retrieved. But as this part was already documented as
a hack and it is something that is only used for final meshes. Other
solutions would impact performance or made the fix not condensed
(passing parameters that shouldn't be used).

Reviewed By: Clément Foucault

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

===

M   source/blender/draw/intern/draw_cache_extract.h
M   source/blender/draw/intern/draw_cache_extract_mesh.c
M   source/blender/draw/intern/draw_cache_impl_mesh.c

===

diff --git a/source/blender/draw/intern/draw_cache_extract.h 
b/source/blender/draw/intern/draw_cache_extract.h
index 2094da0328b..a0679ba6442 100644
--- a/source/blender/draw/intern/draw_cache_extract.h
+++ b/source/blender/draw/intern/draw_cache_extract.h
@@ -142,6 +142,8 @@ typedef struct MeshBufferCache {
 GPUIndexBuf *edituv_points;
 GPUIndexBuf *edituv_fdots;
   } ibo;
+  /* Index buffer per material. These are subranges of `ibo.tris` */
+  GPUIndexBuf **tris_per_mat;
 } MeshBufferCache;
 
 typedef enum DRWBatchFlag {
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.c 
b/source/blender/draw/intern/draw_cache_extract_mesh.c
index 0d0fadee1a4..c1f1c8b77e3 100644
--- a/source/blender/draw/intern/draw_cache_extract_mesh.c
+++ b/source/blender/draw/intern/draw_cache_extract_mesh.c
@@ -901,19 +901,19 @@ static void extract_tris_finish(const MeshRenderData *mr,
 {
   MeshExtract_Tri_Data *data = _data;
   GPU_indexbuf_build_in_place(>elb, ibo);
+
   /* HACK: Create ibo sub-ranges and assign them to each #GPUBatch. */
   /* The `surface_per_mat` tests are there when object shading type is set to 
Wire or Bounds. In
* these cases there isn't a surface per material. */
   if (mr->use_final_mesh && cache->surface_per_mat && 
cache->surface_per_mat[0]) {
+MeshBufferCache *mbc = >final;
 for (int i = 0; i < mr->mat_len; i++) {
   /* Multiply by 3 because these are triangle indices. */
   const int mat_start = data->tri_mat_start[i];
   const int mat_end = data->tri_mat_end[i];
   const int start = mat_start * 3;
   const int len = (mat_end - mat_start) * 3;
-  GPUIndexBuf *sub_ibo = GPU_indexbuf_create_subrange(ibo, start, len);
-  /* WARNING: We modify the #GPUBatch here! */
-  GPU_batch_elembuf_set(cache->surface_per_mat[i], sub_ibo, true);
+  GPU_indexbuf_create_subrange_in_place(mbc->tris_per_mat[i], ibo, start, 
len);
 }
   }
   MEM_freeN(data->tri_mat_start);
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c 
b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 64879f438e3..0da132a8cab 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -496,6 +496,10 @@ static void mesh_batch_cache_init(Mesh *me)
 
   cache->mat_len = mesh_render_mat_len_get(me);
   cache->surface_per_mat = MEM_callocN(sizeof(*cache->surface_per_mat) * 
cache->mat_len, __func__);
+  FOREACH_MESH_BUFFER_CACHE (cache, mbufcache) {
+mbufcache->tris_per_mat = MEM_callocN(sizeof(*mbufcache->tris_per_mat) * 
cache->mat_len,
+  __func__);
+  }
 
   cache->is_dirty = false;
   cache->batch_ready = 0;
@@ -703,6 +707,15 @@ static void mesh_batch_cache_clear(Mesh *me)
 for (int i = 0; i < sizeof(mbufcache->ibo) / sizeof(void *); i++) {
   GPU_INDEXBUF_DISCARD_SAFE(ibos[i]);
 }
+
+BLI_assert((mbufcache->tris_per_mat != NULL) || (cache->mat_len == 0));
+BLI_assert((mbufcache->tris_per_mat != NULL) && (cache->mat_len > 0));
+if (mbufcache->tris_per_mat) {
+  for (int i = 0; i < cache->mat_len; i++) {
+GPU_INDEXBUF_DISCARD_SAFE(mbufcache->tris_per_mat[i]);
+  }
+  MEM_SAFE_FREE(mbufcache->tris_per_mat);
+}
   }
   for (int i = 0; i < sizeof(cache->batch) / sizeof(void *); i++) {
 GPUBatch **batch = (GPUBatch **)>batch;
@@ -1168,7