[Bf-blender-cvs] [d9db79dbe5b] master: Cleanup: Move uvedit_islands to c++

2022-09-05 Thread Chris Blackbourn
Commit: d9db79dbe5bec8ba541660940bf981de1c7c5c52
Author: Chris Blackbourn
Date:   Tue Sep 6 15:51:53 2022 +1200
Branches: master
https://developer.blender.org/rBd9db79dbe5bec8ba541660940bf981de1c7c5c52

Cleanup: Move uvedit_islands to c++

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

===

M   source/blender/editors/uvedit/CMakeLists.txt
R093source/blender/editors/uvedit/uvedit_islands.c  
source/blender/editors/uvedit/uvedit_islands.cc

===

diff --git a/source/blender/editors/uvedit/CMakeLists.txt 
b/source/blender/editors/uvedit/CMakeLists.txt
index fd3f7c49dc4..4574c745d93 100644
--- a/source/blender/editors/uvedit/CMakeLists.txt
+++ b/source/blender/editors/uvedit/CMakeLists.txt
@@ -22,7 +22,7 @@ set(INC
 set(SRC
   uvedit_buttons.c
   uvedit_draw.c
-  uvedit_islands.c
+  uvedit_islands.cc
   uvedit_ops.c
   uvedit_path.c
   uvedit_rip.c
diff --git a/source/blender/editors/uvedit/uvedit_islands.c 
b/source/blender/editors/uvedit/uvedit_islands.cc
similarity index 93%
rename from source/blender/editors/uvedit/uvedit_islands.c
rename to source/blender/editors/uvedit/uvedit_islands.cc
index 68c00b18b09..836d997f6e4 100644
--- a/source/blender/editors/uvedit/uvedit_islands.c
+++ b/source/blender/editors/uvedit/uvedit_islands.cc
@@ -46,7 +46,7 @@ static void bm_face_uv_scale_y(BMFace *f, const float 
scale_y, const int cd_loop
   BMLoop *l_first;
   l_iter = l_first = BM_FACE_FIRST_LOOP(f);
   do {
-MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset);
+MLoopUV *luv = static_cast(BM_ELEM_CD_GET_VOID_P(l_iter, 
cd_loop_uv_offset));
 luv->uv[1] *= scale_y;
   } while ((l_iter = l_iter->next) != l_first);
 }
@@ -61,7 +61,7 @@ static void 
bm_face_uv_translate_and_scale_around_pivot(BMFace *f,
   BMLoop *l_first;
   l_iter = l_first = BM_FACE_FIRST_LOOP(f);
   do {
-MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset);
+MLoopUV *luv = static_cast(BM_ELEM_CD_GET_VOID_P(l_iter, 
cd_loop_uv_offset));
 for (int i = 0; i < 2; i++) {
   luv->uv[i] = offset[i] + (((luv->uv[i] - pivot[i]) * scale[i]) + 
pivot[i]);
 }
@@ -111,7 +111,8 @@ static float (*bm_face_array_calc_unique_uv_coords(
 coords_len_alloc += f->len;
   }
 
-  float(*coords)[2] = MEM_mallocN(sizeof(*coords) * coords_len_alloc, 
__func__);
+  float(*coords)[2] = static_cast(
+  MEM_mallocN(sizeof(*coords) * coords_len_alloc, __func__));
   int coords_len = 0;
 
   for (int i = 0; i < faces_len; i++) {
@@ -125,7 +126,8 @@ static float (*bm_face_array_calc_unique_uv_coords(
   }
 
   BM_elem_flag_disable(l_iter, BM_ELEM_TAG);
-  const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset);
+  const MLoopUV *luv = static_cast(
+  BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset));
   copy_v2_v2(coords[coords_len++], luv->uv);
 
   /* Un tag all connected so we don't add them twice.
@@ -140,7 +142,8 @@ static float (*bm_face_array_calc_unique_uv_coords(
   do {
 if (l_radial->v == l_iter->v) {
   if (BM_elem_flag_test(l_radial, BM_ELEM_TAG)) {
-const MLoopUV *luv_radial = BM_ELEM_CD_GET_VOID_P(l_radial, 
cd_loop_uv_offset);
+const MLoopUV *luv_radial = static_cast(
+BM_ELEM_CD_GET_VOID_P(l_radial, cd_loop_uv_offset));
 if (equals_v2v2(luv->uv, luv_radial->uv)) {
   /* Don't add this UV when met in another face in `faces`. */
   BM_elem_flag_disable(l_iter, BM_ELEM_TAG);
@@ -152,7 +155,6 @@ static float (*bm_face_array_calc_unique_uv_coords(
   } while ((e = BM_DISK_EDGE_NEXT(e, v_pivot)) != e_first);
 } while ((l_iter = l_iter->next) != l_first);
   }
-  coords = MEM_reallocN(coords, sizeof(*coords) * coords_len);
   *r_coords_len = coords_len;
   return coords;
 }
@@ -319,7 +321,7 @@ struct SharedUVLoopData {
 
 static bool bm_loop_uv_shared_edge_check(const BMLoop *l_a, const BMLoop *l_b, 
void *user_data)
 {
-  const struct SharedUVLoopData *data = user_data;
+  const struct SharedUVLoopData *data = static_cast(user_data);
 
   if (data->use_seams) {
 if (BM_elem_flag_test(l_a->e, BM_ELEM_SEAM)) {
@@ -351,7 +353,8 @@ int bm_mesh_calc_uv_islands(const Scene *scene,
   .use_seams = use_seams,
   };
 
-  int *groups_array = MEM_mallocN(sizeof(*groups_array) * (size_t)bm->totface, 
__func__);
+  int *groups_array = static_cast(
+  MEM_mallocN(sizeof(*groups_array) * (size_t)bm->totface, __func__));
 
   int(*group_index)[2];
 
@@ -388,7 +391,7 @@ int bm_mesh_calc_uv_islands(const Scene *scene,
   for (int i = 0; i < group_len; i++) {
 const int faces_start = group_index[i][0];
 const int faces_len = group_index[i][1];
-BMFace **faces = MEM_mallocN(sizeof(*faces) * faces_len, __func__);
+BMFace **faces = static_cast(MEM_mallocN(sizeof(*faces) * 

[Bf-blender-cvs] [4c1c2c43a14] refactor-mesh-uv-map-generic: Fixes after merge, cleanup

2022-09-05 Thread Hans Goudey
Commit: 4c1c2c43a146ec2664bc118d9e4e872bff417adc
Author: Hans Goudey
Date:   Mon Sep 5 21:51:14 2022 -0500
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB4c1c2c43a146ec2664bc118d9e4e872bff417adc

Fixes after merge, cleanup

===

M   source/blender/blenkernel/BKE_mesh_legacy_convert.h
M   source/blender/blenkernel/intern/customdata.cc
M   source/blender/blenkernel/intern/mesh_legacy_convert.cc
M   source/blender/blenkernel/intern/mesh_merge_customdata.cc
M   source/blender/blenkernel/intern/pbvh_pixels.cc
M   source/blender/blenkernel/intern/subdiv_mesh.cc
M   source/blender/blenloader/intern/versioning_defaults.c
M   source/blender/bmesh/intern/bmesh_query_uv.h
M   source/blender/editors/mesh/mesh_data.cc
M   
source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
M   source/blender/makesdna/DNA_meshdata_types.h
M   source/blender/render/intern/texture_margin.cc

===

diff --git a/source/blender/blenkernel/BKE_mesh_legacy_convert.h 
b/source/blender/blenkernel/BKE_mesh_legacy_convert.h
index cf39132481d..0a47c665300 100644
--- a/source/blender/blenkernel/BKE_mesh_legacy_convert.h
+++ b/source/blender/blenkernel/BKE_mesh_legacy_convert.h
@@ -44,12 +44,6 @@ void BKE_mesh_legacy_convert_hide_layers_to_flags(struct 
Mesh *mesh);
  */
 void BKE_mesh_legacy_convert_flags_to_hide_layers(struct Mesh *mesh);
 
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /**
  * Move material indices from a generic attribute to #MPoly.
  */
@@ -60,6 +54,12 @@ void 
BKE_mesh_legacy_convert_material_indices_to_mpoly(struct Mesh *mesh);
  */
 void BKE_mesh_legacy_convert_mpoly_to_material_indices(struct Mesh *mesh);
 
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * Recreate #MFace Tessellation.
  *
diff --git a/source/blender/blenkernel/intern/customdata.cc 
b/source/blender/blenkernel/intern/customdata.cc
index 472efd52102..c7b6f718907 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -58,6 +58,7 @@
 /* only for customdata_data_transfer_interp_normal_normals */
 #include "data_transfer_intern.h"
 
+using blender::float2;
 using blender::IndexRange;
 using blender::Set;
 using blender::Span;
@@ -1517,27 +1518,25 @@ static bool layerValidate_propfloat2(void *data, const 
uint totitems, const bool
 
 static bool layerEqual_propfloat2(const void *data1, const void *data2)
 {
-  const float *luv1 = static_cast(data1);
-  const float *luv2 = static_cast(data2);
+  const float2  = *static_cast(data1);
+  const float2  = *static_cast(data2);
 
-  return len_squared_v2v2(luv1, luv2) < 0.1f;
+  return blender::math::distance_squared(a, b) < 0.1f;
 }
 
 static void layerInitMinMax_propfloat2(void *vmin, void *vmax)
 {
-  float *min = static_cast(vmin);
-  float *max = static_cast(vmax);
-
+  float2  = *static_cast(vmin);
+  float2  = *static_cast(vmax);
   INIT_MINMAX2(min, max);
 }
 
 static void layerDoMinMax_propfloat2(const void *data, void *vmin, void *vmax)
 {
-  const float *luv = static_cast(data);
-  float *min = static_cast(vmin);
-  float *max = static_cast(vmax);
-
-  minmax_v2v2_v2(min, max, luv);
+  const float2  = *static_cast(data);
+  float2  = *static_cast(vmin);
+  float2  = *static_cast(vmax);
+  blender::math::min_max(value, a, b);
 }
 
 static void layerCopyValue_propfloat2(const void *source,
@@ -1545,17 +1544,16 @@ static void layerCopyValue_propfloat2(const void 
*source,
   const int mixmode,
   const float mixfactor)
 {
-  const float *luv1 = static_cast(source);
-  float *luv2 = static_cast(dest);
+  const float2  = *static_cast(source);
+  float2  = *static_cast(dest);
 
-  /* We only support a limited subset of advanced mixing here -
+  /* We only support a limited subset of advanced mixing here-
* namely the mixfactor interpolation. */
-
   if (mixmode == CDT_MIX_NOMIX) {
-copy_v2_v2(luv2, luv1);
+b = a;
   }
   else {
-interp_v2_v2v2(luv2, luv2, luv1, mixfactor);
+b = blender::math::interpolate(b, a, mixfactor);
   }
 }
 
@@ -3515,6 +3513,7 @@ bool CustomData_set_layer_name(CustomData *data, const 
int type, const int n, co
 const char *CustomData_get_layer_name(const CustomData *data, const int type, 
const int n)
 {
   const int layer_index = CustomData_get_layer_index_n(data, type, n);
+  
   return (layer_index == -1) ? nullptr : data->layers[layer_index].name;
 }
 
diff --git a/source/blender/blenkernel/intern/mesh_legacy_convert.cc 
b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
index af3c51758b9..afd15407b1a 100644
--- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
@@ -50,15 +50,15 @@ static void 

[Bf-blender-cvs] [cfe35802aaa] refactor-mesh-uv-map-generic: Merge branch 'master' into refactor-mesh-uv-map-generic

2022-09-05 Thread Hans Goudey
Commit: cfe35802aaa22b6aaf78b840c8b7410e8bef0376
Author: Hans Goudey
Date:   Mon Sep 5 21:17:28 2022 -0500
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rBcfe35802aaa22b6aaf78b840c8b7410e8bef0376

Merge branch 'master' into refactor-mesh-uv-map-generic

===



===

diff --cc release/scripts/startup/bl_ui/properties_data_mesh.py
index 5b3c4101d59,686d455b6b4..91a3dec8ac8
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@@ -580,8 -580,9 +580,8 @@@ class DATA_PT_mesh_attributes(MeshButto
  colliding_names = []
  for collection in (
  # Built-in names.
- {"position": None, "material_index": None, "shade_smooth": 
None, "normal": None, "crease": None},
+ {"position": None, "shade_smooth": None, "normal": None, 
"crease": None},
  mesh.attributes,
 -mesh.uv_layers,
  ob.vertex_groups,
  ):
  for name in collection.keys():
diff --cc source/blender/blenkernel/BKE_mesh_legacy_convert.h
index 841d7f113aa,11ee86c62a7..cf39132481d
--- a/source/blender/blenkernel/BKE_mesh_legacy_convert.h
+++ b/source/blender/blenkernel/BKE_mesh_legacy_convert.h
@@@ -44,12 -27,16 +44,22 @@@ void BKE_mesh_legacy_convert_hide_layer
   */
  void BKE_mesh_legacy_convert_flags_to_hide_layers(struct Mesh *mesh);
  
 +#endif
 +
 +#ifdef __cplusplus
 +extern "C" {
 +#endif
 +
+ /**
+  * Move material indices from a generic attribute to #MPoly.
+  */
+ void BKE_mesh_legacy_convert_material_indices_to_mpoly(struct Mesh *mesh);
+ /**
+  * Move material indices from the #MPoly struct to a generic attributes.
+  * Only add the attribute when the indices are not all zero.
+  */
+ void BKE_mesh_legacy_convert_mpoly_to_material_indices(struct Mesh *mesh);
+ 
  /**
   * Recreate #MFace Tessellation.
   *
diff --cc source/blender/blenkernel/intern/fluid.c
index 12d7acd4e88,24c61a792eb..b982f70965a
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@@ -2081,18 -2073,13 +2073,14 @@@ static void emit_from_mesh
  Mesh *me = BKE_mesh_copy_for_eval(ffs->mesh, true);
  
  /* Duplicate vertices to modify. */
- if (me->mvert) {
-   me->mvert = MEM_dupallocN(me->mvert);
-   CustomData_set_layer(>vdata, CD_MVERT, me->mvert);
- }
+ MVert *verts = MEM_dupallocN(BKE_mesh_vertices(me));
  
- MVert *mvert = me->mvert;
- const MLoop *mloop = me->mloop;
+ const MLoop *mloop = BKE_mesh_loops(me);
  const MLoopTri *mlooptri = BKE_mesh_runtime_looptri_ensure(me);
  const int numverts = me->totvert;
- const MDeformVert *dvert = CustomData_get_layer(>vdata, 
CD_MDEFORMVERT);
+ const MDeformVert *dvert = BKE_mesh_deform_verts(me);
 -const MLoopUV *mloopuv = CustomData_get_layer_named(>ldata, 
CD_MLOOPUV, ffs->uvlayer_name);
 +const float(*mloopuv)[2] = CustomData_get_layer_named(
 +>ldata, CD_PROP_FLOAT2, ffs->uvlayer_name);
  
  if (ffs->flags & FLUID_FLOW_INITVELOCITY) {
vert_vel = MEM_callocN(sizeof(float[3]) * numverts, 
"manta_flow_velocity");
diff --cc source/blender/blenkernel/intern/mesh.cc
index 2f32e09e25b,c0379c50de4..3a7a098535a
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@@ -346,7 -344,7 +349,8 @@@ static void mesh_blend_read_data(BlendD
  
if (!BLO_read_data_is_undo(reader)) {
  BKE_mesh_legacy_convert_flags_to_hide_layers(mesh);
 +BKE_mesh_legacy_convert_uvs_to_generic(mesh);
+ BKE_mesh_legacy_convert_mpoly_to_material_indices(mesh);
}
  
/* We don't expect to load normals from files, since they are derived data. 
*/
@@@ -467,8 -465,12 +471,10 @@@ static int customdata_compare
CustomDataLayer *l1, *l2;
int layer_count1 = 0, layer_count2 = 0, j;
const uint64_t cd_mask_non_generic = CD_MASK_MVERT | CD_MASK_MEDGE | 
CD_MASK_MPOLY |
 -   CD_MASK_MLOOPUV | 
CD_MASK_PROP_BYTE_COLOR |
 -   CD_MASK_MDEFORMVERT;
 +   CD_MASK_PROP_BYTE_COLOR | 
CD_MASK_MDEFORMVERT;
const uint64_t cd_mask_all_attr = CD_MASK_PROP_ALL | cd_mask_non_generic;
+   const Span loops_1 = m1->loops();
+   const Span loops_2 = m2->loops();
  
for (int i = 0; i < c1->totlayer; i++) {
  l1 = >layers[i];
diff --cc source/blender/blenkernel/intern/mesh_convert.cc
index 6c1ae6a9c7a,e56c248e81a..5aff587deec
--- a/source/blender/blenkernel/intern/mesh_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_convert.cc
@@@ -194,8 -193,11 +193,11 @@@ static Mesh *mesh_nurbs_displist_to_mes
MEdge *medge = edges.data();
MPoly *mpoly = polys.data();
MLoop *mloop = loops.data();
+   MutableAttributeAccessor attributes = 

[Bf-blender-cvs] [b5440a0312f] refactor-mesh-selection-generic: Merge branch 'master' into refactor-mesh-selection-generic

2022-09-05 Thread Hans Goudey
Commit: b5440a0312f5d53d663b8787ce9a06f41df6b102
Author: Hans Goudey
Date:   Mon Sep 5 15:49:27 2022 -0500
Branches: refactor-mesh-selection-generic
https://developer.blender.org/rBb5440a0312f5d53d663b8787ce9a06f41df6b102

Merge branch 'master' into refactor-mesh-selection-generic

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f0a36599007] master: GPU: remove 'GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR'

2022-09-05 Thread Germano Cavalcante
Commit: f0a36599007d2c5185d040202b84775ae1343785
Author: Germano Cavalcante
Date:   Mon Sep 5 19:01:02 2022 -0300
Branches: master
https://developer.blender.org/rBf0a36599007d2c5185d040202b84775ae1343785

GPU: remove 'GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR'

The only difference between `GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR`
and `GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR` is that in the vertex
shader the 2D version uses `vec4(pos, 0.0, 1.0)` and the 3D version
uses `vec4(pos, 1.0)`.

But VBOs with 2D attributes work perfectly in shaders that use 3D
attributes. Components not specified are filled with components from
`vec4(0.0, 0.0, 0.0, 1.0)`.

So there is no real benefit to having two different shader versions.

===

M   source/blender/editors/animation/anim_markers.c
M   source/blender/editors/gpencil/annotate_paint.c
M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/editors/gpencil/gpencil_utils.c
M   source/blender/editors/interface/interface_draw.c
M   source/blender/editors/mask/mask_draw.c
M   source/blender/editors/sculpt_paint/paint_stroke.c
M   source/blender/editors/space_clip/clip_draw.c
M   source/blender/editors/space_graph/graph_draw.c
M   source/blender/editors/space_image/image_draw.c
M   source/blender/editors/space_nla/nla_draw.c
M   source/blender/editors/space_outliner/outliner_draw.cc
M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/editors/space_view3d/view3d_draw.c
M   source/blender/editors/transform/transform_draw_cursors.c
M   source/blender/editors/util/ed_draw.c
M   source/blender/editors/uvedit/uvedit_draw.c
M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/GPU_shader.h
M   source/blender/gpu/intern/gpu_shader_builtin.c
D   
source/blender/gpu/shaders/gpu_shader_2D_line_dashed_uniform_color_vert.glsl
D   
source/blender/gpu/shaders/infos/gpu_shader_3D_line_dashed_uniform_color_info.hh
M   
source/blender/gpu/shaders/infos/gpu_shader_line_dashed_uniform_color_info.hh
M   source/blender/windowmanager/intern/wm_gesture.c

===

diff --git a/source/blender/editors/animation/anim_markers.c 
b/source/blender/editors/animation/anim_markers.c
index f2655f31f3c..2e324cb3ed8 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -437,7 +437,7 @@ static void draw_marker_line(const uchar *color, int xpos, 
int ymin, int ymax)
   GPUVertFormat *format = immVertexFormat();
   uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
 
-  immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
+  immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
 
   float viewport_size[4];
   GPU_viewport_size_get_f(viewport_size);
diff --git a/source/blender/editors/gpencil/annotate_paint.c 
b/source/blender/editors/gpencil/annotate_paint.c
index 5d26bc664ca..287dce1a509 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -1725,7 +1725,7 @@ static void annotation_draw_eraser(bContext *UNUSED(C), 
int x, int y, void *p_pt
 
 immUnbindProgram();
 
-immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
+immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
 
 float viewport_size[4];
 GPU_viewport_size_get_f(viewport_size);
diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index a98c8e3bb45..8e33a029229 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2420,7 +2420,7 @@ static void gpencil_draw_eraser(bContext *UNUSED(C), int 
x, int y, void *p_ptr)
 
 immUnbindProgram();
 
-immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
+immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
 
 float viewport_size[4];
 GPU_viewport_size_get_f(viewport_size);
diff --git a/source/blender/editors/gpencil/gpencil_utils.c 
b/source/blender/editors/gpencil/gpencil_utils.c
index 938983fe586..e47f16ac466 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1693,7 +1693,7 @@ void ED_gpencil_brush_draw_eraser(Brush *brush, int x, 
int y)
 
   immUnbindProgram();
 
-  immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
+  immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
 
   float viewport_size[4];
   GPU_viewport_size_get_f(viewport_size);
diff --git a/source/blender/editors/interface/interface_draw.c 
b/source/blender/editors/interface/interface_draw.c
index fb30cfb86ff..190830568e3 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ 

[Bf-blender-cvs] [755e728a984] master: GPU: remove 'GPU_SHADER_3D_IMAGE_MODULATE_ALPHA'

2022-09-05 Thread Germano Cavalcante
Commit: 755e728a98401e2ef417368332c35e949f2233b7
Author: Germano Cavalcante
Date:   Mon Sep 5 18:11:27 2022 -0300
Branches: master
https://developer.blender.org/rB755e728a98401e2ef417368332c35e949f2233b7

GPU: remove 'GPU_SHADER_3D_IMAGE_MODULATE_ALPHA'

`GPU_SHADER_3D_IMAGE_MODULATE_ALPHA` can be seamlessly replaced by
`GPU_SHADER_3D_IMAGE_COLOR` with no real harm done.

===

M   source/blender/editors/space_clip/clip_draw.c
M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/GPU_shader.h
M   source/blender/gpu/intern/gpu_shader_builtin.c
D   source/blender/gpu/shaders/gpu_shader_image_modulate_alpha_frag.glsl
D   
source/blender/gpu/shaders/infos/gpu_shader_3D_image_modulate_alpha_info.hh
M   source/blender/windowmanager/intern/wm_draw.c

===

diff --git a/source/blender/editors/space_clip/clip_draw.c 
b/source/blender/editors/space_clip/clip_draw.c
index ecef53ba095..96d386975a0 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -1210,10 +1210,10 @@ static void draw_plane_marker_image(Scene *scene,
   imm_format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
 
   /* Use 3D image for correct display of planar tracked images. */
-  immBindBuiltinProgram(GPU_SHADER_3D_IMAGE_MODULATE_ALPHA);
+  immBindBuiltinProgram(GPU_SHADER_3D_IMAGE_COLOR);
 
   immBindTexture("image", texture);
-  immUniform1f("alpha", plane_track->image_opacity);
+  immUniformColor4f(1.0f, 1.0f, 1.0f, plane_track->image_opacity);
 
   immBegin(GPU_PRIM_TRI_FAN, 4);
 
diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index 152df8cb592..7ceebc37fb4 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -281,7 +281,6 @@ set(GLSL_SRC
   shaders/gpu_shader_image_desaturate_frag.glsl
   shaders/gpu_shader_image_overlays_merge_frag.glsl
   shaders/gpu_shader_image_overlays_stereo_merge_frag.glsl
-  shaders/gpu_shader_image_modulate_alpha_frag.glsl
   shaders/gpu_shader_image_shuffle_color_frag.glsl
   shaders/gpu_shader_image_color_frag.glsl
   shaders/gpu_shader_image_varying_color_frag.glsl
@@ -589,7 +588,6 @@ set(SRC_SHADER_CREATE_INFOS
   shaders/infos/gpu_shader_3D_depth_only_info.hh
   shaders/infos/gpu_shader_3D_flat_color_info.hh
   shaders/infos/gpu_shader_3D_image_info.hh
-  shaders/infos/gpu_shader_3D_image_modulate_alpha_info.hh
   shaders/infos/gpu_shader_3D_point_info.hh
   shaders/infos/gpu_shader_3D_polyline_info.hh
   shaders/infos/gpu_shader_3D_smooth_color_info.hh
diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h
index 0db61bedc2c..35ed0f6678e 100644
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@ -295,15 +295,6 @@ typedef enum eGPUBuiltinShader {
* \param pos: in vec3
*/
   GPU_SHADER_3D_IMAGE_COLOR,
-  /**
-   * Draw texture with alpha. Take a 3D position and a 2D texture coordinate 
for each vertex.
-   *
-   * \param alpha: uniform float
-   * \param image: uniform sampler2D
-   * \param texCoord: in vec2
-   * \param pos: in vec3
-   */
-  GPU_SHADER_3D_IMAGE_MODULATE_ALPHA,
   /* points */
   /**
* Draw round points with a constant size.
diff --git a/source/blender/gpu/intern/gpu_shader_builtin.c 
b/source/blender/gpu/intern/gpu_shader_builtin.c
index 7973c635cb8..2944905f2dd 100644
--- a/source/blender/gpu/intern/gpu_shader_builtin.c
+++ b/source/blender/gpu/intern/gpu_shader_builtin.c
@@ -141,11 +141,6 @@ static const GPUShaderStages 
builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = {
 .name = "GPU_SHADER_3D_IMAGE_COLOR",
 .create_info = "gpu_shader_3D_image_color",
 },
-[GPU_SHADER_3D_IMAGE_MODULATE_ALPHA] =
-{
-.name = "GPU_SHADER_3D_IMAGE_MODULATE_ALPHA",
-.create_info = "gpu_shader_3D_image_modulate_alpha",
-},
 [GPU_SHADER_2D_CHECKER] =
 {
 .name = "GPU_SHADER_2D_CHECKER",
diff --git 
a/source/blender/gpu/shaders/gpu_shader_image_modulate_alpha_frag.glsl 
b/source/blender/gpu/shaders/gpu_shader_image_modulate_alpha_frag.glsl
deleted file mode 100644
index 26f96a5da32..000
--- a/source/blender/gpu/shaders/gpu_shader_image_modulate_alpha_frag.glsl
+++ /dev/null
@@ -1,6 +0,0 @@
-
-void main()
-{
-  fragColor = texture(image, texCoord_interp);
-  fragColor.a *= alpha;
-}
diff --git 
a/source/blender/gpu/shaders/infos/gpu_shader_3D_image_modulate_alpha_info.hh 
b/source/blender/gpu/shaders/infos/gpu_shader_3D_image_modulate_alpha_info.hh
deleted file mode 100644
index 35ddaa5c71c..000
--- 
a/source/blender/gpu/shaders/infos/gpu_shader_3D_image_modulate_alpha_info.hh
+++ /dev/null
@@ -1,21 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
- * Copyright 2022 Blender Foundation. All rights reserved. */

[Bf-blender-cvs] [1fcc673230b] master: Cleanup: Remove unused function

2022-09-05 Thread Hans Goudey
Commit: 1fcc673230bf585b2b0239d4476b94523bd0ec21
Author: Hans Goudey
Date:   Mon Sep 5 15:48:36 2022 -0500
Branches: master
https://developer.blender.org/rB1fcc673230bf585b2b0239d4476b94523bd0ec21

Cleanup: Remove unused function

This had a specific use case relating to the `CurveEval` type
which shouldn't be necessary anymore.

===

M   source/blender/blenkernel/BKE_attribute.hh
M   source/blender/blenkernel/intern/attribute_access.cc

===

diff --git a/source/blender/blenkernel/BKE_attribute.hh 
b/source/blender/blenkernel/BKE_attribute.hh
index 6284cce9dc0..83e1a3208ae 100644
--- a/source/blender/blenkernel/BKE_attribute.hh
+++ b/source/blender/blenkernel/BKE_attribute.hh
@@ -752,11 +752,6 @@ class CustomDataAttributes {
   bool create_by_move(const AttributeIDRef _id, eCustomDataType 
data_type, void *buffer);
   bool remove(const AttributeIDRef _id);
 
-  /**
-   * Change the order of the attributes to match the order of IDs in the 
argument.
-   */
-  void reorder(Span new_order);
-
   bool foreach_attribute(const AttributeForeachCallback callback, eAttrDomain 
domain) const;
 };
 
diff --git a/source/blender/blenkernel/intern/attribute_access.cc 
b/source/blender/blenkernel/intern/attribute_access.cc
index 0187dbd6f78..e39c6d11fa9 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -784,26 +784,6 @@ bool CustomDataAttributes::foreach_attribute(const 
AttributeForeachCallback call
   return true;
 }
 
-void CustomDataAttributes::reorder(Span new_order)
-{
-  BLI_assert(new_order.size() == data.totlayer);
-
-  Map old_order;
-  old_order.reserve(data.totlayer);
-  Array old_layers(Span(data.layers, data.totlayer));
-  for (const int i : old_layers.index_range()) {
-old_order.add_new(attribute_id_from_custom_data_layer(old_layers[i]), i);
-  }
-
-  MutableSpan layers(data.layers, data.totlayer);
-  for (const int i : layers.index_range()) {
-const int old_index = old_order.lookup(new_order[i]);
-layers[i] = old_layers[old_index];
-  }
-
-  CustomData_update_typemap();
-}
-
 /*  */
 /** \name Attribute API
  * \{ */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2c4e4eb1018] refactor-mesh-selection-generic: Merge branch 'master' into refactor-mesh-selection-generic

2022-09-05 Thread Hans Goudey
Commit: 2c4e4eb10180768275b66c103eb41da442a8fb95
Author: Hans Goudey
Date:   Mon Sep 5 15:30:48 2022 -0500
Branches: refactor-mesh-selection-generic
https://developer.blender.org/rB2c4e4eb10180768275b66c103eb41da442a8fb95

Merge branch 'master' into refactor-mesh-selection-generic

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [57639186514] master: GPU: convert 'GPU_SHADER_2D_IMAGE_COLOR' to 3D

2022-09-05 Thread Germano Cavalcante
Commit: 57639186514079d3fce590006616c543628fe1d8
Author: Germano Cavalcante
Date:   Mon Sep 5 17:34:10 2022 -0300
Branches: master
https://developer.blender.org/rB57639186514079d3fce590006616c543628fe1d8

GPU: convert 'GPU_SHADER_2D_IMAGE_COLOR' to 3D

3D shaders work in both 2D and 3D viewports.

This shader is a good candidate to be exposed in Python.

===

M   source/blender/draw/intern/draw_color_management.cc
M   source/blender/editors/interface/interface_draw.c
M   source/blender/editors/interface/interface_icons.c
M   source/blender/editors/render/render_preview.cc
M   source/blender/editors/screen/glutil.c
M   source/blender/editors/sculpt_paint/paint_cursor.c
M   source/blender/editors/space_file/file_draw.c
M   source/blender/editors/space_node/node_draw.cc
M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/GPU_shader.h
M   source/blender/gpu/intern/gpu_shader_builtin.c
D   source/blender/gpu/shaders/infos/gpu_shader_2D_image_color_info.hh
M   source/blender/gpu/shaders/infos/gpu_shader_3D_image_info.hh
M   source/blender/windowmanager/intern/wm_dragdrop.cc
M   source/blender/windowmanager/intern/wm_operators.c
M   source/blender/windowmanager/intern/wm_playanim.c

===

diff --git a/source/blender/draw/intern/draw_color_management.cc 
b/source/blender/draw/intern/draw_color_management.cc
index bb11f1ab3ad..eab86226be5 100644
--- a/source/blender/draw/intern/draw_color_management.cc
+++ b/source/blender/draw/intern/draw_color_management.cc
@@ -169,7 +169,7 @@ void DRW_transform_none(GPUTexture *tex)
 
   /* Draw as texture for final render (without immediate mode). */
   GPUBatch *geom = DRW_cache_fullscreen_quad_get();
-  GPU_batch_program_set_builtin(geom, GPU_SHADER_2D_IMAGE_COLOR);
+  GPU_batch_program_set_builtin(geom, GPU_SHADER_3D_IMAGE_COLOR);
   GPU_batch_uniform_4f(geom, "color", 1.0f, 1.0f, 1.0f, 1.0f);
   GPU_batch_texture_bind(geom, "image", tex);
 
diff --git a/source/blender/editors/interface/interface_draw.c 
b/source/blender/editors/interface/interface_draw.c
index 02325920e6d..fb30cfb86ff 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -309,7 +309,7 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(region),
 rgba_uchar_to_float(col, but->col);
   }
 
-  IMMDrawPixelsTexState state = 
immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
+  IMMDrawPixelsTexState state = 
immDrawPixelsTexSetup(GPU_SHADER_3D_IMAGE_COLOR);
   immDrawPixelsTexTiled(,
 (float)rect->xmin,
 (float)rect->ymin,
@@ -2132,7 +2132,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region),
 color);
   }
 
-  IMMDrawPixelsTexState state = 
immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
+  IMMDrawPixelsTexState state = 
immDrawPixelsTexSetup(GPU_SHADER_3D_IMAGE_COLOR);
   immDrawPixelsTexTiled(,
 rect.xmin,
 rect.ymin + 1,
diff --git a/source/blender/editors/interface/interface_icons.c 
b/source/blender/editors/interface/interface_icons.c
index a3d95fa3a49..ad2c08194aa 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -1546,7 +1546,7 @@ static void icon_draw_rect(float x,
 shader = GPU_SHADER_2D_IMAGE_DESATURATE_COLOR;
   }
   else {
-shader = GPU_SHADER_2D_IMAGE_COLOR;
+shader = GPU_SHADER_3D_IMAGE_COLOR;
   }
   IMMDrawPixelsTexState state = immDrawPixelsTexSetup(shader);
 
diff --git a/source/blender/editors/render/render_preview.cc 
b/source/blender/editors/render/render_preview.cc
index cd0a05f02bc..5e23458e8bb 100644
--- a/source/blender/editors/render/render_preview.cc
+++ b/source/blender/editors/render/render_preview.cc
@@ -679,7 +679,7 @@ static bool ed_preview_draw_rect(ScrArea *area, int split, 
int first, rcti *rect
 /* material preview only needs monoscopy (view 0) */
 RE_AcquiredResultGet32(re, , (uint *)rect_byte, 0);
 
-IMMDrawPixelsTexState state = 
immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
+IMMDrawPixelsTexState state = 
immDrawPixelsTexSetup(GPU_SHADER_3D_IMAGE_COLOR);
 immDrawPixelsTexTiled(,
   fx,
   fy,
diff --git a/source/blender/editors/screen/glutil.c 
b/source/blender/editors/screen/glutil.c
index cb3510615cc..4382fd3d1c2 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -515,7 +515,7 @@ void ED_draw_imbuf_clipping(ImBuf *ibuf,
 ibuf, view_settings, display_settings, _handle);
 
 if (display_buffer) {
-  IMMDrawPixelsTexState state = 

[Bf-blender-cvs] [62b3c4630c6] refactor-mesh-selection-generic: Cleanup, fixes

2022-09-05 Thread Hans Goudey
Commit: 62b3c4630c68336ac220a773e92cc41337b36d26
Author: Hans Goudey
Date:   Mon Sep 5 15:21:17 2022 -0500
Branches: refactor-mesh-selection-generic
https://developer.blender.org/rB62b3c4630c68336ac220a773e92cc41337b36d26

Cleanup, fixes

===

M   source/blender/blenkernel/intern/mesh.cc
M   source/blender/blenkernel/intern/mesh_calc_edges.cc
M   source/blender/blenkernel/intern/mesh_legacy_convert.cc
M   source/blender/blenkernel/intern/object_deform.c
M   source/blender/editors/mesh/editface.cc
M   source/blender/editors/mesh/mesh_data.cc
M   source/blender/editors/object/object_modifier.cc
M   source/blender/editors/object/object_vgroup.cc
M   source/blender/editors/sculpt_paint/paint_vertex.cc
M   source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
M   source/blender/editors/space_view3d/view3d_select.cc
M   tests/python/modules/mesh_test.py

===

diff --git a/source/blender/blenkernel/intern/mesh.cc 
b/source/blender/blenkernel/intern/mesh.cc
index 348bf210706..94ab38573f9 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -1656,9 +1656,6 @@ void BKE_mesh_mselect_validate(Mesh *me)
   if (me->totselect == 0) {
 return;
   }
-  const Span verts = me->vertices();
-  const Span edges = me->edges();
-  const Span polys = me->polygons();
 
   mselect_src = me->mselect;
   mselect_dst = (MSelect *)MEM_malloc_arrayN(
diff --git a/source/blender/blenkernel/intern/mesh_calc_edges.cc 
b/source/blender/blenkernel/intern/mesh_calc_edges.cc
index b19f4a2cb14..2ea3bebffdc 100644
--- a/source/blender/blenkernel/intern/mesh_calc_edges.cc
+++ b/source/blender/blenkernel/intern/mesh_calc_edges.cc
@@ -149,7 +149,7 @@ static void 
serialize_and_initialize_deduplicated_edges(Mesh ,
 /* Initialize new edge. */
 new_edge.v1 = item.key.v_low;
 new_edge.v2 = item.key.v_high;
-new_edge.flag = (ME_EDGEDRAW | ME_EDGERENDER);
+new_edge.flag = ME_EDGEDRAW | ME_EDGERENDER;
   }
   item.value.index = new_edge_index;
   new_edge_index++;
diff --git a/source/blender/blenkernel/intern/mesh_legacy_convert.cc 
b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
index b0f4e7a6620..9c89e4c17f9 100644
--- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
@@ -1054,7 +1054,7 @@ void 
BKE_mesh_legacy_convert_selection_layers_to_flags(Mesh *mesh)
   using namespace blender::bke;
   const AttributeAccessor attributes = mesh_attributes(*mesh);
 
-  MutableSpan verts(mesh->mvert, mesh->totvert);
+  MutableSpan verts = mesh->vertices_for_write();
   const VArray selection_vert = attributes.lookup_or_default(
   ".selection_vert", ATTR_DOMAIN_POINT, false);
   threading::parallel_for(verts.index_range(), 4096, [&](IndexRange range) {
@@ -1063,7 +1063,7 @@ void 
BKE_mesh_legacy_convert_selection_layers_to_flags(Mesh *mesh)
 }
   });
 
-  MutableSpan edges(mesh->medge, mesh->totedge);
+  MutableSpan edges = mesh->edges_for_write();
   const VArray selection_edge = attributes.lookup_or_default(
   ".selection_edge", ATTR_DOMAIN_EDGE, false);
   threading::parallel_for(edges.index_range(), 4096, [&](IndexRange range) {
@@ -1072,7 +1072,7 @@ void 
BKE_mesh_legacy_convert_selection_layers_to_flags(Mesh *mesh)
 }
   });
 
-  MutableSpan polys(mesh->mpoly, mesh->totpoly);
+  MutableSpan polys = mesh->polygons_for_write();
   const VArray selection_poly = attributes.lookup_or_default(
   ".selection_poly", ATTR_DOMAIN_FACE, false);
   threading::parallel_for(polys.index_range(), 4096, [&](IndexRange range) {
@@ -1088,7 +1088,7 @@ void 
BKE_mesh_legacy_convert_flags_to_selection_layers(Mesh *mesh)
   using namespace blender::bke;
   MutableAttributeAccessor attributes = mesh_attributes_for_write(*mesh);
 
-  const Span verts(mesh->mvert, mesh->totvert);
+  const Span verts = mesh->vertices();
   if (std::any_of(
   verts.begin(), verts.end(), [](const MVert ) { return vert.flag 
& SELECT; })) {
 SpanAttributeWriter selection_vert = 
attributes.lookup_or_add_for_write_only_span(
@@ -1101,7 +1101,7 @@ void 
BKE_mesh_legacy_convert_flags_to_selection_layers(Mesh *mesh)
 selection_vert.finish();
   }
 
-  const Span edges(mesh->medge, mesh->totedge);
+  const Span edges = mesh->edges();
   if (std::any_of(
   edges.begin(), edges.end(), [](const MEdge ) { return edge.flag 
& SELECT; })) {
 SpanAttributeWriter selection_edge = 
attributes.lookup_or_add_for_write_only_span(
@@ -1114,7 +1114,7 @@ void 
BKE_mesh_legacy_convert_flags_to_selection_layers(Mesh *mesh)
 selection_edge.finish();
   }
 
-  const Span polys(mesh->mpoly, mesh->totpoly);
+  const Span polys = mesh->polygons();
   if (std::any_of(
   polys.begin(), polys.end(), [](const 

[Bf-blender-cvs] [c2ec9481464] refactor-mesh-selection-generic: Merge branch 'master' into refactor-mesh-selection-generic

2022-09-05 Thread Hans Goudey
Commit: c2ec9481464f0e3130a2c8a60ef0882f0852f34f
Author: Hans Goudey
Date:   Mon Sep 5 13:46:57 2022 -0500
Branches: refactor-mesh-selection-generic
https://developer.blender.org/rBc2ec9481464f0e3130a2c8a60ef0882f0852f34f

Merge branch 'master' into refactor-mesh-selection-generic

===



===

diff --cc source/blender/blenkernel/intern/mesh.cc
index caeb1da57d9,c0379c50de4..348bf210706
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@@ -253,16 -248,17 +248,22 @@@ static void mesh_blend_write(BlendWrite
else {
  Set names_to_skip;
  if (!BLO_write_is_undo(writer)) {
 -
BKE_mesh_legacy_convert_hide_layers_to_flags(mesh);
 +  BKE_mesh_legacy_convert_selection_layers_to_flags(mesh);
BKE_mesh_legacy_convert_material_indices_to_mpoly(mesh);
/* When converting to the old mesh format, don't save redundant 
attributes. */
 -  names_to_skip.add_multiple_new({".hide_vert", ".hide_edge", 
".hide_poly"});
 +  names_to_skip.add_multiple_new({".hide_vert",
 +  ".hide_edge",
 +  ".hide_poly",
 +  ".selection_vert",
 +  ".selection_edge",
 +  ".selection_poly"});
+ 
+   /* Set deprecated mesh data pointers for forward compatibility. */
+   mesh->mvert = const_cast(mesh->vertices().data());
+   mesh->medge = const_cast(mesh->edges().data());
+   mesh->mpoly = const_cast(mesh->polygons().data());
+   mesh->mloop = const_cast(mesh->loops().data());
  }
  
  CustomData_blend_write_prepare(mesh->vdata, vert_layers, names_to_skip);
diff --cc source/blender/blenkernel/intern/mesh_evaluate.cc
index 2294cb1c4af,7e52b96cc92..cbef8e1cd64
--- a/source/blender/blenkernel/intern/mesh_evaluate.cc
+++ b/source/blender/blenkernel/intern/mesh_evaluate.cc
@@@ -878,30 -907,14 +876,30 @@@ static void mesh_flush_select_from_vert
  
  void BKE_mesh_flush_select_from_verts(Mesh *me)
  {
 -  const blender::bke::AttributeAccessor attributes = 
blender::bke::mesh_attributes(*me);
 +  using namespace blender::bke;
 +  MutableAttributeAccessor attributes = mesh_attributes_for_write(*me);
 +  const VArray selection_vert = attributes.lookup_or_default(
 +  ".selection_vert", ATTR_DOMAIN_POINT, false);
 +  if (selection_vert.is_single() && !selection_vert.get_internal_single()) {
 +attributes.remove(".selection_edge");
 +attributes.remove(".selection_poly");
 +return;
 +  }
 +  SpanAttributeWriter selection_edge = 
attributes.lookup_or_add_for_write_only_span(
 +  ".selection_edge", ATTR_DOMAIN_EDGE);
 +  SpanAttributeWriter selection_poly = 
attributes.lookup_or_add_for_write_only_span(
 +  ".selection_poly", ATTR_DOMAIN_FACE);
mesh_flush_select_from_verts(
-   {me->medge, me->totedge},
-   {me->mpoly, me->totpoly},
-   {me->mloop, me->totloop},
 -  me->vertices(),
++  me->edges(),
++  me->polygons(),
+   me->loops(),
attributes.lookup_or_default(".hide_edge", ATTR_DOMAIN_EDGE, 
false),
attributes.lookup_or_default(".hide_poly", ATTR_DOMAIN_FACE, 
false),
 -  me->edges_for_write(),
 -  me->polygons_for_write());
 +  selection_vert,
 +  selection_edge.span,
 +  selection_poly.span);
 +  selection_edge.finish();
 +  selection_poly.finish();
  }
  
  /** \} */
diff --cc source/blender/blenkernel/intern/object_deform.c
index cf93c7b72fd,4c59b4a5210..99bc1fec5bd
--- a/source/blender/blenkernel/intern/object_deform.c
+++ b/source/blender/blenkernel/intern/object_deform.c
@@@ -165,15 -162,15 +162,15 @@@ bool BKE_object_defgroup_clear(Object *
}
  }
  else {
-   if (me->dvert) {
- const bool *selection_vert = (const bool *)CustomData_get_layer_named(
+   if (BKE_mesh_deform_verts(me)) {
 -const MVert *mv;
++const const bool *selection_vert = (const bool 
*)CustomData_get_layer_named(
 +>vdata, CD_PROP_BOOL, ".selection_vert");
  int i;
  
- dv = me->dvert;
 -mv = BKE_mesh_vertices(me);
+ dv = BKE_mesh_deform_verts_for_write(me);
  
 -for (i = 0; i < me->totvert; i++, mv++, dv++) {
 -  if (dv->dw && (!use_selection || (mv->flag & SELECT))) {
 +for (i = 0; i < me->totvert; i++, dv++) {
 +  if (dv->dw && (!use_selection || (selection_vert && 
selection_vert[i]))) {
  MDeformWeight *dw = BKE_defvert_find_index(dv, def_nr);
  BKE_defvert_remove_group(dv, dw); /* dw can be NULL */
  changed = true;
diff --cc source/blender/blenkernel/intern/subdiv_converter_mesh.c
index c8693123363,f908e1af4ac..aa4bfbe1517
--- a/source/blender/blenkernel/intern/subdiv_converter_mesh.c
+++ 

[Bf-blender-cvs] [4536de98d18] master: GPU: remove 'GPU_SHADER_2D_SMOOTH_COLOR'

2022-09-05 Thread Germano Cavalcante
Commit: 4536de98d18b8887edee37b03a12da015590bb45
Author: Germano Cavalcante
Date:   Thu Sep 1 12:32:28 2022 -0300
Branches: master
https://developer.blender.org/rB4536de98d18b8887edee37b03a12da015590bb45

GPU: remove 'GPU_SHADER_2D_SMOOTH_COLOR'

The only real difference between `GPU_SHADER_2D_SMOOTH_COLOR` and
`GPU_SHADER_3D_SMOOTH_COLOR` is that in the vertex shader the 2D
version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses
`vec4(pos, 1.0)`.

But VBOs with 2D attributes work perfectly in shaders that use 3D
attributes. Components not specified are filled with components from
`vec4(0.0, 0.0, 0.0, 1.0)`.

So there is no real benefit to having two different shader versions.

This will simplify porting shaders to python as it will not be
necessary to use a 3D and a 2D version of the shaders.

In python the new name for '2D_SMOOTH_COLOR' and '3D_SMOOTH_COLOR'
is 'SMOOTH_COLOR', but the old names still work for backward
compatibility.

===

M   source/blender/editors/interface/interface_draw.c
M   source/blender/editors/interface/interface_widgets.c
M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/GPU_shader.h
M   source/blender/gpu/intern/gpu_immediate.cc
M   source/blender/gpu/intern/gpu_shader_builtin.c
D   source/blender/gpu/shaders/gpu_shader_2D_smooth_color_frag.glsl
D   source/blender/gpu/shaders/gpu_shader_2D_smooth_color_vert.glsl
D   source/blender/gpu/shaders/infos/gpu_shader_2D_smooth_color_info.hh
M   source/blender/windowmanager/intern/wm_gesture.c

===

diff --git a/source/blender/editors/interface/interface_draw.c 
b/source/blender/editors/interface/interface_draw.c
index 4dae8222b14..02325920e6d 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -205,7 +205,7 @@ void ui_draw_but_TAB_outline(const rcti *rect,
 mul_v2_fl(vec[a], rad);
   }
 
-  immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
+  immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR);
   immBeginAtMost(GPU_PRIM_LINE_STRIP, 25);
 
   immAttr3ubv(col, highlight);
@@ -1242,7 +1242,7 @@ void ui_draw_but_COLORBAND(uiBut *but, const 
uiWidgetColors *UNUSED(wcol), const
   format = immVertexFormat();
   pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
   col_id = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, 
GPU_FETCH_FLOAT);
-  immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
+  immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR);
 
   /* layer: color ramp */
   GPU_blend(GPU_BLEND_ALPHA);
@@ -2288,7 +2288,7 @@ void UI_draw_box_shadow(const rctf *rect, uchar alpha)
   uint color = GPU_vertformat_attr_add(
   format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
 
-  immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
+  immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR);
 
   immBegin(GPU_PRIM_TRIS, 54);
 
diff --git a/source/blender/editors/interface/interface_widgets.c 
b/source/blender/editors/interface/interface_widgets.c
index f49863cf306..53b1967d668 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -2930,7 +2930,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, const 
uiWidgetColors *wcol, const
   uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
   const uint color = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 3, 
GPU_FETCH_FLOAT);
 
-  immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
+  immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR);
 
   immBegin(GPU_PRIM_TRI_FAN, tot + 2);
   immAttr3fv(color, rgb_center);
@@ -3061,7 +3061,7 @@ void ui_draw_gradient(const rcti *rect,
   GPUVertFormat *format = immVertexFormat();
   const uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
   const uint col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, 
GPU_FETCH_FLOAT);
-  immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
+  immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR);
 
   immBegin(GPU_PRIM_TRIS, steps * 3 * 6);
 
@@ -5155,7 +5155,7 @@ static void draw_disk_shaded(float start,
   const uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
   if (shaded) {
 col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 4, 
GPU_FETCH_INT_TO_FLOAT_UNIT);
-immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
+immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR);
   }
   else {
 immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index d1b0e227506..2eceeedf845 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -274,8 +274,6 @@ set(GLSL_SRC
   shaders/gpu_shader_2D_nodelink_vert.glsl
   

[Bf-blender-cvs] [0c3953d5454] master: GPU: remove 'GPU_SHADER_2D_IMAGE'

2022-09-05 Thread Germano Cavalcante
Commit: 0c3953d545441a8ae551c3ecb0c16c1bccc3839f
Author: Germano Cavalcante
Date:   Thu Sep 1 12:23:08 2022 -0300
Branches: master
https://developer.blender.org/rB0c3953d545441a8ae551c3ecb0c16c1bccc3839f

GPU: remove 'GPU_SHADER_2D_IMAGE'

The only real difference between `GPU_SHADER_2D_IMAGE` and
`GPU_SHADER_3D_IMAGE` is that in the vertex shader the 2D
version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses
`vec4(pos, 1.0)`.

But VBOs with 2D attributes work perfectly in shaders that use 3D
attributes. Components not specified are filled with components from
`vec4(0.0, 0.0, 0.0, 1.0)`.

So there is no real benefit to having two different shader versions.

This will simplify porting shaders to python as it will not be
necessary to use a 3D and a 2D version of the shaders.

In python the new name for '2D_IMAGE' and '3D_IMAGE'
is 'IMAGE', but the old names still work for backward
compatibility.

===

M   source/blender/gpu/GPU_shader.h
M   source/blender/gpu/intern/gpu_shader_builtin.c
M   source/blender/gpu/shaders/infos/gpu_shader_2D_image_info.hh
M   source/blender/makesrna/intern/rna_render.c
M   source/blender/windowmanager/intern/wm_stereo.c

===

diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h
index 65a628bcd76..0f3a494fc3f 100644
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@ -213,7 +213,6 @@ typedef enum eGPUBuiltinShader {
* \param pos: in vec2
*/
   GPU_SHADER_2D_SMOOTH_COLOR,
-  GPU_SHADER_2D_IMAGE,
   GPU_SHADER_2D_IMAGE_COLOR,
   GPU_SHADER_2D_IMAGE_DESATURATE_COLOR,
   GPU_SHADER_2D_IMAGE_RECT_COLOR,
diff --git a/source/blender/gpu/intern/gpu_shader_builtin.c 
b/source/blender/gpu/intern/gpu_shader_builtin.c
index 4776a8b9b12..8afe3e04dc9 100644
--- a/source/blender/gpu/intern/gpu_shader_builtin.c
+++ b/source/blender/gpu/intern/gpu_shader_builtin.c
@@ -170,11 +170,6 @@ static const GPUShaderStages 
builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = {
 .name = "GPU_SHADER_2D_IMAGE_OVERLAYS_STEREO_MERGE",
 .create_info = "gpu_shader_2D_image_overlays_stereo_merge",
 },
-[GPU_SHADER_2D_IMAGE] =
-{
-.name = "GPU_SHADER_2D_IMAGE",
-.create_info = "gpu_shader_2D_image",
-},
 [GPU_SHADER_2D_IMAGE_COLOR] =
 {
 .name = "GPU_SHADER_2D_IMAGE_COLOR",
diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_info.hh 
b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_info.hh
index 06aad15c18a..a92dca0ce90 100644
--- a/source/blender/gpu/shaders/infos/gpu_shader_2D_image_info.hh
+++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_image_info.hh
@@ -16,8 +16,3 @@ GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_common)
 .push_constant(Type::MAT4, "ModelViewProjectionMatrix")
 .sampler(0, ImageType::FLOAT_2D, "image")
 .vertex_source("gpu_shader_2D_image_vert.glsl");
-
-GPU_SHADER_CREATE_INFO(gpu_shader_2D_image)
-.additional_info("gpu_shader_2D_image_common")
-.fragment_source("gpu_shader_image_frag.glsl")
-.do_static_compilation(true);
diff --git a/source/blender/makesrna/intern/rna_render.c 
b/source/blender/makesrna/intern/rna_render.c
index 11a7be69f68..6a66445ee4c 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -118,7 +118,7 @@ static int engine_get_preview_pixel_size(RenderEngine 
*UNUSED(engine), Scene *sc
 
 static void engine_bind_display_space_shader(RenderEngine *UNUSED(engine), 
Scene *UNUSED(scene))
 {
-  GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_2D_IMAGE);
+  GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_3D_IMAGE);
   GPU_shader_bind(shader);
 
   int img_loc = GPU_shader_get_uniform(shader, "image");
diff --git a/source/blender/windowmanager/intern/wm_stereo.c 
b/source/blender/windowmanager/intern/wm_stereo.c
index f85c818cdf3..48a0d47f26a 100644
--- a/source/blender/windowmanager/intern/wm_stereo.c
+++ b/source/blender/windowmanager/intern/wm_stereo.c
@@ -47,7 +47,7 @@ void wm_stereo3d_draw_sidebyside(wmWindow *win, int view)
   uint texcoord = GPU_vertformat_attr_add(format, "texCoord", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
   uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
 
-  immBindBuiltinProgram(GPU_SHADER_2D_IMAGE);
+  immBindBuiltinProgram(GPU_SHADER_3D_IMAGE);
 
   int soffx = WM_window_pixels_x(win) * 0.5f;
   if (view == STEREO_LEFT_ID) {
@@ -95,7 +95,7 @@ void wm_stereo3d_draw_topbottom(wmWindow *win, int view)
   uint texcoord = GPU_vertformat_attr_add(format, "texCoord", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
   uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
 
-  immBindBuiltinProgram(GPU_SHADER_2D_IMAGE);
+  immBindBuiltinProgram(GPU_SHADER_3D_IMAGE);
 
   int soffy;

[Bf-blender-cvs] [223665b994d] master: GPU: remove 'GPU_SHADER_2D_UNIFORM_COLOR'

2022-09-05 Thread Germano Cavalcante
Commit: 223665b994d785672c023432ac3861d4d2c0ffb6
Author: Germano Cavalcante
Date:   Thu Sep 1 09:31:07 2022 -0300
Branches: master
https://developer.blender.org/rB223665b994d785672c023432ac3861d4d2c0ffb6

GPU: remove 'GPU_SHADER_2D_UNIFORM_COLOR'

The only real difference between `GPU_SHADER_2D_UNIFORM_COLOR` and
`GPU_SHADER_3D_UNIFORM_COLOR` is that in the vertex shader the 2D
version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses
`vec4(pos, 1.0)`.

But VBOs with 2D attributes work perfectly in shaders that use 3D
attributes. Components not specified are filled with components from
`vec4(0.0, 0.0, 0.0, 1.0)`.

So there is no real benefit to having two different shader versions.

This will simplify porting shaders to python as it will not be
necessary to use a 3D and a 2D version of the shaders.

In python the new name for '2D_UNIFORM_COLOR'' and '3D_UNIFORM_COLOR'
is 'UNIFORM_COLOR', but the old names still work for backward
compatibility.

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

===

M   source/blender/editors/animation/anim_channels_defines.c
M   source/blender/editors/animation/anim_draw.c
M   source/blender/editors/animation/anim_markers.c
M   source/blender/editors/animation/time_scrub_ui.c
M   source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
M   source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
M   source/blender/editors/gpencil/annotate_paint.c
M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/editors/gpencil/gpencil_utils.c
M   source/blender/editors/interface/interface_draw.c
M   source/blender/editors/interface/interface_icons.c
M   source/blender/editors/interface/interface_panel.cc
M   source/blender/editors/interface/interface_widgets.c
M   source/blender/editors/interface/view2d_draw.cc
M   source/blender/editors/mask/mask_draw.c
M   source/blender/editors/mesh/editmesh_knife.c
M   source/blender/editors/physics/particle_edit.c
M   source/blender/editors/screen/area.c
M   source/blender/editors/screen/screen_draw.c
M   source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
M   source/blender/editors/sculpt_paint/paint_cursor.c
M   source/blender/editors/sculpt_paint/paint_image_ops_paint.cc
M   source/blender/editors/sculpt_paint/paint_stroke.c
M   source/blender/editors/space_action/action_draw.c
M   source/blender/editors/space_clip/clip_dopesheet_draw.c
M   source/blender/editors/space_clip/clip_draw.c
M   source/blender/editors/space_clip/clip_graph_draw.c
M   source/blender/editors/space_clip/clip_utils.c
M   source/blender/editors/space_console/console_draw.c
M   source/blender/editors/space_file/file_draw.c
M   source/blender/editors/space_graph/graph_draw.c
M   source/blender/editors/space_graph/space_graph.c
M   source/blender/editors/space_image/image_draw.c
M   source/blender/editors/space_info/textview.c
M   source/blender/editors/space_nla/nla_draw.c
M   source/blender/editors/space_node/drawnode.cc
M   source/blender/editors/space_node/node_draw.cc
M   source/blender/editors/space_outliner/outliner_draw.cc
M   source/blender/editors/space_sequencer/sequencer_drag_drop.c
M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/editors/space_spreadsheet/spreadsheet_draw.cc
M   source/blender/editors/space_text/text_draw.c
M   source/blender/editors/space_view3d/view3d_draw.c
M   source/blender/editors/space_view3d/view3d_gizmo_ruler.c
M   source/blender/editors/space_view3d/view3d_navigate_fly.c
M   source/blender/editors/space_view3d/view3d_navigate_walk.c
M   source/blender/editors/transform/transform_snap.c
M   source/blender/editors/util/ed_draw.c
M   source/blender/editors/util/ed_util_imbuf.c
M   source/blender/editors/uvedit/uvedit_smart_stitch.c
M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/GPU_shader.h
M   source/blender/gpu/intern/gpu_immediate.cc
M   source/blender/gpu/intern/gpu_immediate_util.c
M   source/blender/gpu/intern/gpu_shader_builtin.c
D   source/blender/gpu/shaders/infos/gpu_shader_2D_uniform_color_info.hh
M   source/blender/windowmanager/intern/wm_draw.c
M   source/blender/windowmanager/intern/wm_gesture.c
M   source/blender/windowmanager/intern/wm_operators.c
M   source/blender/windowmanager/intern/wm_playanim.c

===

diff --git a/source/blender/editors/animation/anim_channels_defines.c 
b/source/blender/editors/animation/anim_channels_defines.c
index f665ec27b07..b7562073ee7 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -157,7 +157,7 @@ static void 

[Bf-blender-cvs] [baf2835ff74] master: GPU: remove 'GPU_SHADER_2D_FLAT_COLOR'

2022-09-05 Thread Germano Cavalcante
Commit: baf2835ff746b4ac1b8b2478be8aea9928604970
Author: Germano Cavalcante
Date:   Thu Sep 1 10:04:00 2022 -0300
Branches: master
https://developer.blender.org/rBbaf2835ff746b4ac1b8b2478be8aea9928604970

GPU: remove 'GPU_SHADER_2D_FLAT_COLOR'

The only real difference between `GPU_SHADER_2D_FLAT_COLOR` and
`GPU_SHADER_3D_FLAT_COLOR` is that in the vertex shader the 2D
version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses
`vec4(pos, 1.0)`.

But VBOs with 2D attributes work perfectly in shaders that use 3D
attributes. Components not specified are filled with components from
`vec4(0.0, 0.0, 0.0, 1.0)`.

So there is no real benefit to having two different shader versions.

This will simplify porting shaders to python as it will not be
necessary to use a 3D and a 2D version of the shaders.

In python the new name for '2D_FLAT_COLOR'' and '3D_FLAT_COLOR'
is 'FLAT_COLOR', but the old names still work for backward
compatibility.

===

M   source/blender/draw/intern/draw_view.c
M   source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
M   source/blender/editors/interface/interface_draw.c
M   source/blender/editors/interface/interface_panel.cc
M   source/blender/editors/interface/view2d.cc
M   source/blender/editors/screen/area.c
M   source/blender/editors/space_file/file_draw.c
M   source/blender/editors/space_graph/graph_draw.c
M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/editors/space_view3d/view3d_draw.c
M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/GPU_shader.h
M   source/blender/gpu/intern/gpu_immediate.cc
M   source/blender/gpu/intern/gpu_shader_builtin.c
D   source/blender/gpu/shaders/gpu_shader_2D_flat_color_vert.glsl
D   source/blender/gpu/shaders/infos/gpu_shader_2D_flat_color_info.hh

===

diff --git a/source/blender/draw/intern/draw_view.c 
b/source/blender/draw/intern/draw_view.c
index 817f97cbea4..35ff8891a0f 100644
--- a/source/blender/draw/intern/draw_view.c
+++ b/source/blender/draw/intern/draw_view.c
@@ -175,7 +175,7 @@ void DRW_draw_cursor(void)
   GPU_matrix_scale_2f(U.widget_unit, U.widget_unit);
 
   GPUBatch *cursor_batch = DRW_cache_cursor_get(is_aligned);
-  GPUShader *shader = 
GPU_shader_get_builtin_shader(GPU_SHADER_2D_FLAT_COLOR);
+  GPUShader *shader = 
GPU_shader_get_builtin_shader(GPU_SHADER_3D_FLAT_COLOR);
   GPU_batch_set_shader(cursor_batch, shader);
 
   GPU_batch_draw(cursor_batch);
@@ -241,7 +241,7 @@ void DRW_draw_cursor_2d_ex(const ARegion *region, const 
float cursor[2])
 
   GPUBatch *cursor_batch = DRW_cache_cursor_get(true);
 
-  GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_2D_FLAT_COLOR);
+  GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_3D_FLAT_COLOR);
   GPU_batch_set_shader(cursor_batch, shader);
 
   GPU_batch_draw(cursor_batch);
diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c 
b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
index 1c8985b1ad7..600abaf3737 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
@@ -388,7 +388,7 @@ static void cage2d_draw_box_interaction(const float 
color[4],
   .pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT),
   .col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 3, 
GPU_FETCH_FLOAT),
   };
-  immBindBuiltinProgram(is_solid ? GPU_SHADER_2D_FLAT_COLOR : 
GPU_SHADER_3D_POLYLINE_FLAT_COLOR);
+  immBindBuiltinProgram(is_solid ? GPU_SHADER_3D_FLAT_COLOR : 
GPU_SHADER_3D_POLYLINE_FLAT_COLOR);
 
   {
 if (is_solid) {
diff --git a/source/blender/editors/interface/interface_draw.c 
b/source/blender/editors/interface/interface_draw.c
index 7d1b6482110..4dae8222b14 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1698,7 +1698,7 @@ void ui_draw_but_CURVE(ARegion *region, uiBut *but, const 
uiWidgetColors *wcol,
   format = immVertexFormat();
   pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
   const uint col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, 
GPU_FETCH_FLOAT);
-  immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
+  immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
 
   /* Calculate vertex colors based on text theme. */
   float color_vert[4], color_vert_select[4];
@@ -1948,7 +1948,7 @@ void ui_draw_but_CURVEPROFILE(ARegion *region,
   format = immVertexFormat();
   pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
   const uint col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, 
GPU_FETCH_FLOAT);
-  immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
+  

[Bf-blender-cvs] [5eccd438c03] temp-T73411-view-layer-lazy-cache: Add scene parameter

2022-09-05 Thread Monique
Commit: 5eccd438c03afed2e173dd2994d7e1c05d4c9907
Author: Monique
Date:   Sun Sep 4 15:47:13 2022 +0200
Branches: temp-T73411-view-layer-lazy-cache
https://developer.blender.org/rB5eccd438c03afed2e173dd2994d7e1c05d4c9907

Add scene parameter

===

M   source/blender/blenkernel/BKE_collision.h
M   source/blender/blenkernel/BKE_layer.h
M   source/blender/blenkernel/BKE_object.h
M   source/blender/blenkernel/intern/layer.c
M   source/blender/blenkernel/intern/layer_utils.c
M   source/blender/blenkernel/intern/object.cc
M   source/blender/draw/engines/overlay/overlay_edit_uv.c
M   source/blender/draw/intern/draw_manager.c
M   source/blender/editors/armature/armature_add.c
M   source/blender/editors/armature/armature_edit.c
M   source/blender/editors/armature/armature_naming.c
M   source/blender/editors/armature/armature_relations.c
M   source/blender/editors/armature/armature_select.c
M   source/blender/editors/armature/pose_edit.c
M   source/blender/editors/armature/pose_select.c
M   source/blender/editors/armature/pose_slide.c
M   source/blender/editors/armature/pose_transform.c
M   source/blender/editors/armature/pose_utils.c
M   source/blender/editors/curve/editcurve.c
M   source/blender/editors/curve/editcurve_query.c
M   source/blender/editors/curve/editcurve_select.c
M   source/blender/editors/include/ED_armature.h
M   source/blender/editors/include/ED_object.h
M   source/blender/editors/lattice/editlattice_select.c
M   source/blender/editors/lattice/editlattice_tools.c
M   source/blender/editors/mesh/editmesh_bevel.c
M   source/blender/editors/mesh/editmesh_bisect.c
M   source/blender/editors/mesh/editmesh_extrude.c
M   source/blender/editors/mesh/editmesh_extrude_screw.c
M   source/blender/editors/mesh/editmesh_extrude_spin.c
M   source/blender/editors/mesh/editmesh_inset.c
M   source/blender/editors/mesh/editmesh_intersect.c
M   source/blender/editors/mesh/editmesh_knife.c
M   source/blender/editors/mesh/editmesh_knife_project.c
M   source/blender/editors/mesh/editmesh_loopcut.c
M   source/blender/editors/mesh/editmesh_path.c
M   source/blender/editors/mesh/editmesh_polybuild.c
M   source/blender/editors/mesh/editmesh_rip.c
M   source/blender/editors/mesh/editmesh_rip_edge.c
M   source/blender/editors/mesh/editmesh_select.c
M   source/blender/editors/mesh/editmesh_select_similar.c
M   source/blender/editors/mesh/editmesh_tools.c
M   source/blender/editors/mesh/editmesh_utils.c
M   source/blender/editors/mesh/mesh_intern.h
M   source/blender/editors/metaball/mball_edit.c
M   source/blender/editors/object/object_add.cc
M   source/blender/editors/object/object_edit.c
M   source/blender/editors/object/object_random.c
M   source/blender/editors/object/object_select.c
M   source/blender/editors/screen/screen_context.c
M   source/blender/editors/space_image/image_ops.c
M   source/blender/editors/space_outliner/outliner_select.cc
M   source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c
M   source/blender/editors/space_view3d/view3d_navigate.c
M   source/blender/editors/space_view3d/view3d_select.cc
M   source/blender/editors/space_view3d/view3d_snap.c
M   source/blender/editors/space_view3d/view3d_view.c
M   source/blender/editors/transform/transform_convert.c
M   source/blender/editors/transform/transform_gizmo_2d.c
M   source/blender/editors/transform/transform_gizmo_3d.c
M   source/blender/editors/transform/transform_snap.c
M   source/blender/editors/uvedit/uvedit_buttons.c
M   source/blender/editors/uvedit/uvedit_ops.c
M   source/blender/editors/uvedit/uvedit_path.c
M   source/blender/editors/uvedit/uvedit_rip.c
M   source/blender/editors/uvedit/uvedit_select.c
M   source/blender/editors/uvedit/uvedit_smart_stitch.c
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c
M   source/blender/windowmanager/intern/wm_operator_utils.c

===

diff --git a/source/blender/blenkernel/BKE_collision.h 
b/source/blender/blenkernel/BKE_collision.h
index 846609fcb10..e57679da4e6 100644
--- a/source/blender/blenkernel/BKE_collision.h
+++ b/source/blender/blenkernel/BKE_collision.h
@@ -17,6 +17,7 @@ struct Depsgraph;
 struct MVert;
 struct MVertTri;
 struct Object;
+struct Scene;
 
 
 // used for collisions in collision.c
diff --git a/source/blender/blenkernel/BKE_layer.h 
b/source/blender/blenkernel/BKE_layer.h
index 2f33fd6e63e..edeb3c3d5ee 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -359,7 +359,8 @@ void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator 
*iter);
   } \
   ((void)0)
 
-#define 

[Bf-blender-cvs] [6b7980f3b66] temp-T73411-view-layer-lazy-cache: Call ensure

2022-09-05 Thread Monique
Commit: 6b7980f3b66e4366c8e9f9e0be65830763e950ae
Author: Monique
Date:   Sun Sep 4 17:47:31 2022 +0200
Branches: temp-T73411-view-layer-lazy-cache
https://developer.blender.org/rB6b7980f3b66e4366c8e9f9e0be65830763e950ae

Call ensure

===

M   source/blender/blenkernel/intern/layer.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M   source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
M   source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M   
source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
M   source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
M   source/blender/editors/animation/anim_channels_edit.c
M   source/blender/editors/animation/anim_filter.c
M   source/blender/editors/gpencil/gpencil_armature.c
M   source/blender/editors/include/ED_object.h
M   source/blender/editors/interface/interface_ops.cc
M   source/blender/editors/object/object_edit.c
M   source/blender/editors/object/object_select.c

===

diff --git a/source/blender/blenkernel/intern/layer.c 
b/source/blender/blenkernel/intern/layer.c
index 0e1c7b8ec7a..bfa7a745268 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -2192,8 +2192,6 @@ void 
BKE_view_layer_bases_in_mode_iterator_next(BLI_Iterator *iter)
 
   if (base == data->base_active) {
 /* first step */
-// TODO: We should assure that the object_bases are valid. Adding
-// BKE_view_layer_object_bases_get here seems not correct. this should 
happen by the caller.
 base = data->view_layer->object_bases.first;
 if ((base == data->base_active) && BKE_base_is_visible(data->v3d, base)) {
   base = base->next;
@@ -2396,13 +2394,13 @@ void BKE_view_layer_blend_read_lib(BlendLibReader 
*reader, Library *lib, ViewLay
 BLO_read_id_address(reader, lib, >group);
   }
 
-  LISTBASE_FOREACH_MUTABLE (Base *, base, 
BKE_view_layer_object_bases_get(view_layer, __func__)) {
+  LISTBASE_FOREACH_MUTABLE (Base *, base, _layer->object_bases) {
 /* we only bump the use count for the collection objects */
 BLO_read_id_address(reader, lib, >object);
 
 if (base->object == NULL) {
   /* Free in case linked object got lost. */
-  BLI_freelinkN(BKE_view_layer_object_bases_get(view_layer, __func__), 
base);
+  BLI_freelinkN(_layer->object_bases, base);
   if (view_layer->basact == base) {
 view_layer->basact = NULL;
   }
diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index 5de3bebb7f6..8c722bfad9a 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -512,6 +512,7 @@ static void do_version_layers_to_collections(Main *bmain, 
Scene *scene)
   }
 }
 
+BKE_view_layer_ensure_sync(scene, view_layer);
 /* for convenience set the same active object in all the layers */
 if (scene->basact) {
   view_layer->basact = BKE_view_layer_base_find(view_layer, 
scene->basact->object);
@@ -537,6 +538,7 @@ static void do_version_layers_to_collections(Main *bmain, 
Scene *scene)
   view_layer->flag &= ~VIEW_LAYER_RENDER;
 }
 
+BKE_view_layer_ensure_sync(scene, view_layer);
 /* convert active base */
 if (scene->basact) {
   view_layer->basact = BKE_view_layer_base_find(view_layer, 
scene->basact->object);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 980c86ed082..2fedc33b7a2 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -2118,8 +2118,9 @@ void DepsgraphNodeBuilder::build_scene_audio(Scene *scene)
  });
 }
 
-void DepsgraphNodeBuilder::build_scene_speakers(Scene * /*scene*/, ViewLayer 
*view_layer)
+void DepsgraphNodeBuilder::build_scene_speakers(Scene *scene, ViewLayer 
*view_layer)
 {
+  BKE_view_layer_ensure_sync(scene, view_layer);
   LISTBASE_FOREACH (Base *, base, BKE_view_layer_object_bases_get(view_layer, 
__func__)) {
 Object *object = base->object;
 if (object->type != OB_SPEAKER || !need_pull_base_into_graph(base)) {
diff --git 
a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
index afe47210a33..4a6157e11c3 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
@@ -90,6 +90,7 @@ void DepsgraphNodeBuilder::build_view_layer(Scene *scene,
* but object is expected to be an 

[Bf-blender-cvs] [09bfa9bb63e] temp-T73411-view-layer-lazy-cache: Introducing BKE_view_layer_object_bases_get(_const).

2022-09-05 Thread Monique
Commit: 09bfa9bb63e2c93b4394af05a31ddeeae4a02fa4
Author: Monique
Date:   Thu Aug 25 22:47:02 2022 +0200
Branches: temp-T73411-view-layer-lazy-cache
https://developer.blender.org/rB09bfa9bb63e2c93b4394af05a31ddeeae4a02fa4

Introducing BKE_view_layer_object_bases_get(_const).

===

M   source/blender/blenkernel/BKE_layer.h
M   source/blender/blenkernel/intern/layer.c
M   source/blender/blenkernel/intern/layer_utils.c
M   source/blender/blenkernel/intern/mball.cc
M   source/blender/blenkernel/intern/object.cc
M   source/blender/blenkernel/intern/scene.cc
M   source/blender/blenloader/intern/readfile.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M   source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
M   source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M   
source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
M   source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
M   source/blender/editors/animation/anim_channels_edit.c
M   source/blender/editors/animation/anim_filter.c
M   source/blender/editors/gpencil/gpencil_armature.c
M   source/blender/editors/object/object_edit.c
M   source/blender/editors/object/object_select.c
M   source/blender/editors/object/object_utils.c
M   source/blender/editors/render/render_internal.cc
M   source/blender/editors/render/render_preview.cc
M   source/blender/editors/screen/screen_context.c
M   source/blender/editors/space_nla/nla_channels.c
M   source/blender/editors/space_outliner/outliner_collections.cc
M   source/blender/editors/space_outliner/outliner_tools.cc
M   source/blender/editors/space_outliner/tree/tree_display_view_layer.cc
M   source/blender/editors/space_view3d/view3d_navigate.c
M   source/blender/editors/space_view3d/view3d_select.cc
M   source/blender/editors/transform/transform_convert_object.c
M   source/blender/editors/transform/transform_gizmo_3d.c
M   source/blender/editors/transform/transform_snap_object.cc
M   source/blender/editors/undo/ed_undo.c
M   source/blender/io/alembic/exporter/abc_subdiv_disabler.cc
M   source/blender/io/collada/BlenderContext.cpp
M   source/blender/io/gpencil/intern/gpencil_io_base.cc
M   source/blender/makesrna/intern/rna_layer.c

===

diff --git a/source/blender/blenkernel/BKE_layer.h 
b/source/blender/blenkernel/BKE_layer.h
index 49dc87629d6..9b3b7f4bfc1 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -425,7 +425,8 @@ void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator 
*iter);
   { \
 Object *_instance; \
 Base *_base; \
-for (_base = (Base *)(view_layer)->object_bases.first; _base; _base = 
_base->next) { \
+for (_base = (Base *)BKE_view_layer_object_bases_get(view_layer, 
__func__)->first; _base; \
+ _base = _base->next) { \
   _instance = _base->object;
 
 #define FOREACH_OBJECT_END \
@@ -546,6 +547,11 @@ struct Object 
**BKE_view_layer_array_from_objects_in_mode_unique_data(struct Vie
 struct Object *BKE_view_layer_active_object_get(const struct ViewLayer 
*view_layer);
 struct Object *BKE_view_layer_edit_object_get(const struct ViewLayer 
*view_layer);
 
+struct ListBase *BKE_view_layer_object_bases_get(struct ViewLayer *view_layer, 
const char *name);
+// This should not exist in the final solution.
+const struct ListBase *BKE_view_layer_object_bases_get_const(const struct 
ViewLayer *view_layer,
+ const char *name);
+
 struct ViewLayerAOV *BKE_view_layer_add_aov(struct ViewLayer *view_layer);
 void BKE_view_layer_remove_aov(struct ViewLayer *view_layer, struct 
ViewLayerAOV *aov);
 void BKE_view_layer_set_active_aov(struct ViewLayer *view_layer, struct 
ViewLayerAOV *aov);
diff --git a/source/blender/blenkernel/intern/layer.c 
b/source/blender/blenkernel/intern/layer.c
index 53a9b6d469d..4f5be581c6d 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -245,7 +245,7 @@ void BKE_view_layer_free_ex(ViewLayer *view_layer, const 
bool do_id_user)
 {
   view_layer->basact = NULL;
 
-  BLI_freelistN(_layer->object_bases);
+  BLI_freelistN(BKE_view_layer_object_bases_get(view_layer, __func__));
 
   if (view_layer->object_bases_hash) {
 BLI_ghash_free(view_layer->object_bases_hash, NULL, NULL);
@@ -285,7 +285,7 @@ void BKE_view_layer_free_ex(ViewLayer *view_layer, const 
bool do_id_user)
 
 void BKE_view_layer_selected_objects_tag(ViewLayer *view_layer, const int tag)
 {
-  LISTBASE_FOREACH (Base *, base, _layer->object_bases) {
+  LISTBASE_FOREACH (Base *, base, BKE_view_layer_object_bases_get(view_layer, 
__func__)) 

[Bf-blender-cvs] [7488ee4239d] temp-T73411-view-layer-lazy-cache: Added ensure.

2022-09-05 Thread Jeroen Bakker
Commit: 7488ee4239d080bc6f48959736cc3f786ae5e2cf
Author: Jeroen Bakker
Date:   Sat Sep 3 22:58:05 2022 +0200
Branches: temp-T73411-view-layer-lazy-cache
https://developer.blender.org/rB7488ee4239d080bc6f48959736cc3f786ae5e2cf

Added ensure.

===

M   source/blender/blenkernel/BKE_collection.h
M   source/blender/blenkernel/BKE_collision.h
M   source/blender/blenkernel/BKE_effect.h
M   source/blender/blenkernel/BKE_layer.h
M   source/blender/blenkernel/BKE_object.h
M   source/blender/blenkernel/BKE_scene.h
M   source/blender/blenkernel/intern/blender_copybuffer.c
M   source/blender/blenkernel/intern/collection.c
M   source/blender/blenkernel/intern/collision.c
M   source/blender/blenkernel/intern/effect.c
M   source/blender/blenkernel/intern/fluid.c
M   source/blender/blenkernel/intern/layer.c
M   source/blender/blenkernel/intern/layer_utils.c
M   source/blender/blenkernel/intern/mball.cc
M   source/blender/blenkernel/intern/object.cc
M   source/blender/blenkernel/intern/scene.cc
M   source/blender/depsgraph/intern/depsgraph_physics.cc
M   source/blender/editors/animation/anim_filter.c
M   source/blender/editors/animation/anim_markers.c
M   source/blender/editors/armature/editarmature_undo.c
M   source/blender/editors/gpencil/gpencil_ops_versioning.c
M   source/blender/editors/object/object_add.cc
M   source/blender/editors/object/object_edit.c
M   source/blender/editors/object/object_modes.c
M   source/blender/editors/object/object_relations.c
M   source/blender/editors/screen/screen_edit.c
M   source/blender/editors/space_info/info_stats.cc
M   source/blender/editors/space_outliner/outliner_select.cc
M   source/blender/editors/space_view3d/space_view3d.c
M   source/blender/editors/space_view3d/view3d_navigate.c
M   source/blender/editors/space_view3d/view3d_view.c
M   source/blender/editors/transform/transform_convert_object.c
M   source/blender/io/alembic/intern/alembic_capi.cc
M   source/blender/io/collada/DocumentImporter.cpp
M   source/blender/io/collada/collada.cpp
M   source/blender/io/stl/importer/stl_import.cc
M   source/blender/io/usd/intern/usd_capi_import.cc
M   source/blender/io/wavefront_obj/importer/obj_importer.cc
M   source/blender/makesrna/intern/rna_layer.c
M   source/blender/makesrna/intern/rna_space.c
M   source/blender/render/intern/pipeline.cc
M   source/blender/windowmanager/intern/wm_files_link.c

===

diff --git a/source/blender/blenkernel/BKE_collection.h 
b/source/blender/blenkernel/BKE_collection.h
index 4346c2a3d23..19dbee38f36 100644
--- a/source/blender/blenkernel/BKE_collection.h
+++ b/source/blender/blenkernel/BKE_collection.h
@@ -216,7 +216,8 @@ struct ListBase BKE_collection_object_cache_get(struct 
Collection *collection);
 ListBase BKE_collection_object_cache_instanced_get(struct Collection 
*collection);
 void BKE_collection_object_cache_free(struct Collection *collection);
 
-struct Base *BKE_collection_or_layer_objects(const struct ViewLayer 
*view_layer,
+struct Base *BKE_collection_or_layer_objects(const struct Scene *scene,
+ struct ViewLayer *view_layer,
  struct Collection *collection);
 
 /* Editing. */
diff --git a/source/blender/blenkernel/BKE_collision.h 
b/source/blender/blenkernel/BKE_collision.h
index b93babaaefa..846609fcb10 100644
--- a/source/blender/blenkernel/BKE_collision.h
+++ b/source/blender/blenkernel/BKE_collision.h
@@ -128,6 +128,7 @@ typedef struct CollisionRelation {
  * lookup of colliders during evaluation.
  */
 struct ListBase *BKE_collision_relations_create(struct Depsgraph *depsgraph,
+const struct Scene *scene,
 struct Collection *collection,
 unsigned int modifier_type);
 void BKE_collision_relations_free(struct ListBase *relations);
diff --git a/source/blender/blenkernel/BKE_effect.h 
b/source/blender/blenkernel/BKE_effect.h
index 113f9ac3b4c..3226455a183 100644
--- a/source/blender/blenkernel/BKE_effect.h
+++ b/source/blender/blenkernel/BKE_effect.h
@@ -103,6 +103,7 @@ void BKE_partdeflect_free(struct PartDeflect *pd);
  * lookup of effectors during evaluation.
  */
 struct ListBase *BKE_effector_relations_create(struct Depsgraph *depsgraph,
+   const struct Scene *scene,
struct ViewLayer *view_layer,
struct Collection *collection);
 void BKE_effector_relations_free(struct ListBase *lb);
diff --git a/source/blender/blenkernel/BKE_layer.h 

[Bf-blender-cvs] [3e6395283e6] temp-T73411-view-layer-lazy-cache: Introduce BKE_view_layer_active_base_get.

2022-09-05 Thread Monique
Commit: 3e6395283e656a825929e858c6d969057af1dea0
Author: Monique
Date:   Thu Sep 1 14:34:55 2022 +0200
Branches: temp-T73411-view-layer-lazy-cache
https://developer.blender.org/rB3e6395283e656a825929e858c6d969057af1dea0

Introduce BKE_view_layer_active_base_get.

===

M   source/blender/blenkernel/BKE_layer.h
M   source/blender/blenkernel/intern/DerivedMesh.cc
M   source/blender/blenkernel/intern/layer.c
M   source/blender/blenkernel/intern/layer_utils.c
M   source/blender/blenkernel/intern/object.cc
M   source/blender/blenkernel/intern/paint.cc
M   source/blender/blenkernel/intern/particle.c
M   source/blender/draw/intern/draw_common.c
M   source/blender/editors/animation/anim_filter.c
M   source/blender/editors/armature/armature_select.c
M   source/blender/editors/curve/editcurve.c
M   source/blender/editors/curve/editcurve_select.c
M   source/blender/editors/curve/editfont.c
M   source/blender/editors/lattice/editlattice_select.c
M   source/blender/editors/mesh/editmesh_path.c
M   source/blender/editors/mesh/editmesh_polybuild.c
M   source/blender/editors/mesh/editmesh_select.c
M   source/blender/editors/metaball/mball_edit.c
M   source/blender/editors/object/object_add.cc
M   source/blender/editors/object/object_constraint.c
M   source/blender/editors/object/object_hook.c
M   source/blender/editors/object/object_relations.c
M   source/blender/editors/object/object_select.c
M   source/blender/editors/physics/particle_object.c
M   source/blender/editors/screen/screen_context.c
M   source/blender/editors/space_buttons/buttons_context.c
M   source/blender/editors/space_outliner/outliner_collections.cc
M   source/blender/editors/space_outliner/outliner_tools.cc
M   source/blender/editors/space_outliner/outliner_tree.cc
M   source/blender/editors/space_view3d/space_view3d.c
M   source/blender/editors/space_view3d/view3d_buttons.c
M   source/blender/editors/space_view3d/view3d_gizmo_armature.c
M   source/blender/editors/space_view3d/view3d_gizmo_camera.c
M   source/blender/editors/space_view3d/view3d_gizmo_empty.c
M   source/blender/editors/space_view3d/view3d_gizmo_forcefield.c
M   source/blender/editors/space_view3d/view3d_gizmo_light.c
M   source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c
M   source/blender/editors/space_view3d/view3d_select.cc
M   source/blender/editors/transform/transform_generics.c
M   source/blender/editors/transform/transform_gizmo_3d.c
M   source/blender/editors/transform/transform_snap.c
M   source/blender/editors/transform/transform_snap_object.cc
M   source/blender/editors/undo/ed_undo.c
M   source/blender/editors/util/ed_util.c
M   source/blender/makesrna/intern/rna_layer.c
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/source/blender/blenkernel/BKE_layer.h 
b/source/blender/blenkernel/BKE_layer.h
index 9b3b7f4bfc1..d21c297f5d0 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -360,7 +360,7 @@ void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator 
*iter);
 data_.object_type = _object_type; \
 data_.view_layer = _view_layer; \
 data_.v3d = _v3d; \
-data_.base_active = _view_layer->basact; \
+data_.base_active = BKE_view_layer_active_base_get(_view_layer, __func__); 
\
 ITER_BEGIN (BKE_view_layer_bases_in_mode_iterator_begin, \
 BKE_view_layer_bases_in_mode_iterator_next, \
 BKE_view_layer_bases_in_mode_iterator_end, \
@@ -548,6 +548,7 @@ struct Object *BKE_view_layer_active_object_get(const 
struct ViewLayer *view_lay
 struct Object *BKE_view_layer_edit_object_get(const struct ViewLayer 
*view_layer);
 
 struct ListBase *BKE_view_layer_object_bases_get(struct ViewLayer *view_layer, 
const char *name);
+struct Base *BKE_view_layer_active_base_get(struct ViewLayer *view_layer, 
const char *name);
 // This should not exist in the final solution.
 const struct ListBase *BKE_view_layer_object_bases_get_const(const struct 
ViewLayer *view_layer,
  const char *name);
diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc 
b/source/blender/blenkernel/intern/DerivedMesh.cc
index 46a8caafa70..faf057e5bfc 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.cc
+++ b/source/blender/blenkernel/intern/DerivedMesh.cc
@@ -1758,8 +1758,10 @@ static void object_get_datamask(const Depsgraph 
*depsgraph,
 return;
   }
 
-  Object *actob = view_layer->basact ? 
DEG_get_original_object(view_layer->basact->object) :
-   nullptr;
+  Object *actob = BKE_view_layer_active_object_get(view_layer);
+  if (actob) {
+actob = 

[Bf-blender-cvs] [fa7e6fe994a] temp-T73411-view-layer-lazy-cache: Start Blender + add object.

2022-09-05 Thread Monique
Commit: fa7e6fe994a001838151a3e7868b020c127773b9
Author: Monique
Date:   Thu Sep 1 21:17:52 2022 +0200
Branches: temp-T73411-view-layer-lazy-cache
https://developer.blender.org/rBfa7e6fe994a001838151a3e7868b020c127773b9

Start Blender + add object.

===

M   source/blender/blenkernel/BKE_layer.h
M   source/blender/blenkernel/BKE_object.h
M   source/blender/blenkernel/intern/layer.c
M   source/blender/blenkernel/intern/layer_utils.c
M   source/blender/blenkernel/intern/lib_override.cc
M   source/blender/blenkernel/intern/object.cc
M   source/blender/blenkernel/intern/scene.cc
M   source/blender/editors/curve/editfont.c
M   source/blender/editors/curves/intern/curves_ops.cc
M   source/blender/editors/include/ED_object.h
M   source/blender/editors/object/object_add.cc
M   source/blender/editors/object/object_constraint.c
M   source/blender/editors/object/object_edit.c
M   source/blender/editors/object/object_hook.c
M   source/blender/editors/object/object_modifier.cc
M   source/blender/editors/render/render_preview.cc
M   source/blender/editors/screen/area.c
M   source/blender/editors/space_outliner/outliner_collections.cc
M   source/blender/editors/space_outliner/outliner_draw.cc
M   
source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
M   source/blender/makesdna/DNA_layer_types.h
M   source/blender/makesrna/intern/rna_layer.c
M   source/blender/makesrna/intern/rna_object_api.c

===

diff --git a/source/blender/blenkernel/BKE_layer.h 
b/source/blender/blenkernel/BKE_layer.h
index db6038f8913..3ca75a2bfeb 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -552,6 +552,9 @@ struct Base *BKE_view_layer_active_base_get(struct 
ViewLayer *view_layer, const
 
 struct LayerCollection *BKE_view_layer_active_collection_get(struct ViewLayer 
*view_layer,
  const char *name);
+
+void BKE_view_layer_tag_out_of_sync(struct ViewLayer *view_layer);
+void BKE_view_layer_ensure_sync(struct Scene *scene, struct ViewLayer 
*view_layer);
 // This should not exist in the final solution.
 const struct ListBase *BKE_view_layer_object_bases_get_const(const struct 
ViewLayer *view_layer,
  const char *name);
diff --git a/source/blender/blenkernel/BKE_object.h 
b/source/blender/blenkernel/BKE_object.h
index e0fb6c5e834..17a2a81c9d3 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -175,9 +175,10 @@ struct Object *BKE_object_add_only_object(struct Main 
*bmain,
  * \note Creates minimum required data, but without vertices etc.
  */
 struct Object *BKE_object_add(struct Main *bmain,
+  struct Scene *scene,
   struct ViewLayer *view_layer,
   int type,
-  const char *name) ATTR_NONNULL(1, 2) 
ATTR_RETURNS_NONNULL;
+  const char *name) ATTR_NONNULL(1, 2, 3) 
ATTR_RETURNS_NONNULL;
 /**
  * Add a new object, using another one as a reference
  *
diff --git a/source/blender/blenkernel/intern/layer.c 
b/source/blender/blenkernel/intern/layer.c
index c9773046364..3ece877fc75 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -342,8 +342,7 @@ static void view_layer_bases_hash_create(ViewLayer 
*view_layer, const bool do_ba
 if (view_layer->object_bases_hash == NULL) {
   GHash *hash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, 
__func__);
 
-  LISTBASE_FOREACH_MUTABLE (
-  Base *, base, BKE_view_layer_object_bases_get(view_layer, __func__)) 
{
+  LISTBASE_FOREACH_MUTABLE (Base *, base, _layer->object_bases) {
 if (base->object) {
   void **val_pp;
   if (!BLI_ghash_ensure_p(hash, base->object, _pp)) {
@@ -359,7 +358,7 @@ static void view_layer_bases_hash_create(ViewLayer 
*view_layer, const bool do_ba
 if (view_layer->basact == base) {
   view_layer->basact = NULL;
 }
-BLI_freelinkN(BKE_view_layer_object_bases_get(view_layer, 
__func__), base);
+BLI_freelinkN(_layer->object_bases, base);
   }
   else {
 CLOG_FATAL(,
@@ -379,6 +378,8 @@ static void view_layer_bases_hash_create(ViewLayer 
*view_layer, const bool do_ba
 
 Base *BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
 {
+  BLI_assert_msg((view_layer->flag & VIEW_LAYER_OUT_OF_SYNC) == 0,
+ "View layer out of sync, invoke BKE_view_layer_ensure_sync.");
   if (!view_layer->object_bases_hash) {
 view_layer_bases_hash_create(view_layer, false);
   }
@@ -957,6 +958,20 @@ 

[Bf-blender-cvs] [ec8b46d9269] temp-T73411-view-layer-lazy-cache: Introduce BKE_view_layer_active_collection_get

2022-09-05 Thread Monique
Commit: ec8b46d9269ba42a14351184bcbd626816860d14
Author: Monique
Date:   Thu Sep 1 15:01:24 2022 +0200
Branches: temp-T73411-view-layer-lazy-cache
https://developer.blender.org/rBec8b46d9269ba42a14351184bcbd626816860d14

Introduce BKE_view_layer_active_collection_get

===

M   source/blender/blenkernel/BKE_layer.h
M   source/blender/blenkernel/intern/layer_utils.c
M   source/blender/editors/space_buttons/buttons_context.c
M   source/blender/editors/space_info/info_stats.cc
M   source/blender/editors/space_view3d/view3d_draw.c
M   source/blender/makesrna/intern/rna_layer.c

===

diff --git a/source/blender/blenkernel/BKE_layer.h 
b/source/blender/blenkernel/BKE_layer.h
index d21c297f5d0..db6038f8913 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -549,6 +549,9 @@ struct Object *BKE_view_layer_edit_object_get(const struct 
ViewLayer *view_layer
 
 struct ListBase *BKE_view_layer_object_bases_get(struct ViewLayer *view_layer, 
const char *name);
 struct Base *BKE_view_layer_active_base_get(struct ViewLayer *view_layer, 
const char *name);
+
+struct LayerCollection *BKE_view_layer_active_collection_get(struct ViewLayer 
*view_layer,
+ const char *name);
 // This should not exist in the final solution.
 const struct ListBase *BKE_view_layer_object_bases_get_const(const struct 
ViewLayer *view_layer,
  const char *name);
diff --git a/source/blender/blenkernel/intern/layer_utils.c 
b/source/blender/blenkernel/intern/layer_utils.c
index 6b9058bd8d1..62e928f42d1 100644
--- a/source/blender/blenkernel/intern/layer_utils.c
+++ b/source/blender/blenkernel/intern/layer_utils.c
@@ -220,6 +220,14 @@ struct Base *BKE_view_layer_active_base_get(struct 
ViewLayer *view_layer, const
   // TODO: BLI_assert_msg(view_layer->flags & ..., name);
   return view_layer->basact;
 }
+
+struct LayerCollection *BKE_view_layer_active_collection_get(struct ViewLayer 
*view_layer,
+ const char *name)
+{
+  // TODO: BLI_assert_msg(view_layer->flags & ..., name);
+  return view_layer->active_collection;
+}
+
 const struct ListBase *BKE_view_layer_object_bases_get_const(const struct 
ViewLayer *view_layer,
  const char 
*UNUSED(name))
 {
diff --git a/source/blender/editors/space_buttons/buttons_context.c 
b/source/blender/editors/space_buttons/buttons_context.c
index 17fe6edb215..bdf5cae6749 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -155,7 +155,7 @@ static bool buttons_context_path_collection(const bContext 
*C,
   /* if we have a view layer, use the view layer's active collection */
   if (buttons_context_path_view_layer(path, window)) {
 ViewLayer *view_layer = path->ptr[path->len - 1].data;
-Collection *c = view_layer->active_collection->collection;
+Collection *c = BKE_view_layer_active_collection_get(view_layer, 
__func__)->collection;
 
 /* Do not show collection tab for master collection. */
 if (c == scene->master_collection) {
diff --git a/source/blender/editors/space_info/info_stats.cc 
b/source/blender/editors/space_info/info_stats.cc
index 0f872d0a02e..9095f9d6189 100644
--- a/source/blender/editors/space_info/info_stats.cc
+++ b/source/blender/editors/space_info/info_stats.cc
@@ -495,7 +495,7 @@ static void get_stats_string(
   Object *ob = BKE_view_layer_active_object_get(view_layer);
   Object *obedit = OBEDIT_FROM_OBACT(ob);
   eObjectMode object_mode = ob ? (eObjectMode)ob->mode : OB_MODE_OBJECT;
-  LayerCollection *layer_collection = view_layer->active_collection;
+  LayerCollection *layer_collection = 
BKE_view_layer_active_collection_get(view_layer, __func__);
 
   if (object_mode == OB_MODE_OBJECT) {
 *ofs += BLI_snprintf_rlen(info + *ofs,
diff --git a/source/blender/editors/space_view3d/view3d_draw.c 
b/source/blender/editors/space_view3d/view3d_draw.c
index ab9e29b8974..24340fde308 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1306,7 +1306,7 @@ static void draw_selected_name(
   s += sprintf(s, "(%d)", cfra);
 
   if ((ob == NULL) || (ob->mode == OB_MODE_OBJECT)) {
-LayerCollection *layer_collection = view_layer->active_collection;
+LayerCollection *layer_collection = 
BKE_view_layer_active_collection_get(view_layer, __func__);
 s += sprintf(s,
  " %s%s",
  BKE_collection_ui_name_get(layer_collection->collection),
diff --git a/source/blender/makesrna/intern/rna_layer.c 
b/source/blender/makesrna/intern/rna_layer.c
index 660dc114848..1365529adbf 100644
--- 

[Bf-blender-cvs] [0e4e79c8945] temp-T73411-view-layer-lazy-cache: Remove FIRSTBASE/LASTBASE.

2022-09-05 Thread Monique
Commit: 0e4e79c8945d36368817892b58f8f80cae8728f0
Author: Monique
Date:   Sat Aug 27 20:40:56 2022 +0200
Branches: temp-T73411-view-layer-lazy-cache
https://developer.blender.org/rB0e4e79c8945d36368817892b58f8f80cae8728f0

Remove FIRSTBASE/LASTBASE.

===

M   source/blender/blenkernel/intern/collection.c
M   source/blender/blenkernel/intern/fluid.c
M   source/blender/editors/space_outliner/outliner_select.cc
M   source/blender/editors/space_view3d/view3d_navigate.c
M   source/blender/editors/space_view3d/view3d_select.cc
M   source/blender/editors/space_view3d/view3d_view.c
M   source/blender/editors/undo/ed_undo.c

===

diff --git a/source/blender/blenkernel/intern/collection.c 
b/source/blender/blenkernel/intern/collection.c
index e0448afdec6..dfe88159d80 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -851,7 +851,7 @@ Base *BKE_collection_or_layer_objects(const ViewLayer 
*view_layer, Collection *c
 return BKE_collection_object_cache_get(collection).first;
   }
 
-  return view_layer->object_bases.first;
+  return BKE_view_layer_object_bases_get(view_layer, __func__)->first;
 }
 
 /** \} */
diff --git a/source/blender/blenkernel/intern/fluid.c 
b/source/blender/blenkernel/intern/fluid.c
index 24c61a792eb..960c7425ce3 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -27,6 +27,7 @@
 #include "BKE_effect.h"
 #include "BKE_fluid.h"
 #include "BKE_global.h"
+#include "BKE_layer.h"
 #include "BKE_lib_id.h"
 #include "BKE_modifier.h"
 #include "BKE_pointcache.h"
@@ -558,7 +559,7 @@ static int get_light(ViewLayer *view_layer, float *light)
   int found_light = 0;
 
   /* Try to find a lamp, preferably local. */
-  LISTBASE_FOREACH (Base *, base_tmp, _layer->object_bases) {
+  LISTBASE_FOREACH (Base *, base_tmp, 
BKE_view_layer_object_bases_get(view_layer, __func__)) {
 if (base_tmp->object->type == OB_LAMP) {
   Light *la = base_tmp->object->data;
 
diff --git a/source/blender/editors/space_outliner/outliner_select.cc 
b/source/blender/editors/space_outliner/outliner_select.cc
index 17e78ece941..b4716ccf0ea 100644
--- a/source/blender/editors/space_outliner/outliner_select.cc
+++ b/source/blender/editors/space_outliner/outliner_select.cc
@@ -237,7 +237,7 @@ static void do_outliner_object_select_recursive(ViewLayer 
*view_layer,
 Object *ob_parent,
 bool select)
 {
-  LISTBASE_FOREACH (Base *, base, _layer->object_bases) {
+  LISTBASE_FOREACH (Base *, base, BKE_view_layer_object_bases_get(view_layer, 
__func__)) {
 Object *ob = base->object;
 if base->flag & BASE_VISIBLE_DEPSGRAPH) != 0) &&
  BKE_object_is_child_recursive(ob_parent, ob))) {
diff --git a/source/blender/editors/space_view3d/view3d_navigate.c 
b/source/blender/editors/space_view3d/view3d_navigate.c
index 6921a5112fc..2779abf6411 100644
--- a/source/blender/editors/space_view3d/view3d_navigate.c
+++ b/source/blender/editors/space_view3d/view3d_navigate.c
@@ -207,7 +207,8 @@ bool view3d_orbit_calc_center(bContext *C, float 
r_dyn_ofs[3])
 float select_center[3];
 
 zero_v3(select_center);
-LISTBASE_FOREACH (Base *, base_eval, _layer_eval->object_bases) {
+LISTBASE_FOREACH (
+Base *, base_eval, BKE_view_layer_object_bases_get(view_layer_eval, 
__func__)) {
   if (BASE_SELECTED(v3d, base_eval)) {
 /* use the boundbox if we can */
 Object *ob_eval = base_eval->object;
@@ -964,7 +965,8 @@ static int viewselected_exec(bContext *C, wmOperator *op)
 ok_dist = 0; /* don't zoom */
   }
   else {
-LISTBASE_FOREACH (Base *, base_eval, _layer_eval->object_bases) {
+LISTBASE_FOREACH (
+Base *, base_eval, BKE_view_layer_object_bases_get(view_layer_eval, 
__func__)) {
   if (BASE_SELECTED(v3d, base_eval)) {
 bool only_center = false;
 Object *ob = DEG_get_original_object(base_eval->object);
diff --git a/source/blender/editors/space_view3d/view3d_select.cc 
b/source/blender/editors/space_view3d/view3d_select.cc
index 0e5d681ca01..0dde7f15999 100644
--- a/source/blender/editors/space_view3d/view3d_select.cc
+++ b/source/blender/editors/space_view3d/view3d_select.cc
@@ -2188,7 +2188,7 @@ static Base *mouse_select_eval_buffer(ViewContext *vc,
 
   Base *basact = nullptr;
   if (found) {
-LISTBASE_FOREACH (Base *, base, _layer->object_bases) {
+LISTBASE_FOREACH (Base *, base, 
BKE_view_layer_object_bases_get(view_layer, __func__)) {
   if (has_bones ? BASE_VISIBLE(v3d, base) : BASE_SELECTABLE(v3d, base)) {
 if (base->object->runtime.select_id == select_id) {
   basact = base;
@@ -2239,7 +2239,7 @@ static Base *mouse_select_object_center(ViewContext *vc, 
Base 

[Bf-blender-cvs] [cec67176b11] master: GPencil: Use correct index for start point and refactor update

2022-09-05 Thread Antonio Vazquez
Commit: cec67176b117557d797199ab6fd13bba54dba16f
Author: Antonio Vazquez
Date:   Mon Sep 5 20:18:03 2022 +0200
Branches: master
https://developer.blender.org/rBcec67176b117557d797199ab6fd13bba54dba16f

GPencil: Use correct index for start point and refactor update

The last commit offset the start point by 1.

Also, remove the update because is better to do this in each operator that need 
it.

===

M   source/blender/blenkernel/intern/gpencil_geom.cc

===

diff --git a/source/blender/blenkernel/intern/gpencil_geom.cc 
b/source/blender/blenkernel/intern/gpencil_geom.cc
index 9f231c8f5f2..7a77bc21c66 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.cc
+++ b/source/blender/blenkernel/intern/gpencil_geom.cc
@@ -3558,14 +3558,12 @@ void BKE_gpencil_stroke_start_set(bGPdata *gpd, 
bGPDstroke *gps, int start_idx)
   }
 
   bGPDstroke *gps_b = BKE_gpencil_stroke_duplicate(gps, true, false);
-  BKE_gpencil_stroke_trim_points(gps_b, 0, start_idx);
-  BKE_gpencil_stroke_trim_points(gps, start_idx + 1, gps->totpoints - 1);
+  BKE_gpencil_stroke_trim_points(gps_b, 0, start_idx - 1);
+  BKE_gpencil_stroke_trim_points(gps, start_idx, gps->totpoints - 1);
 
   /* Join both strokes. */
   BKE_gpencil_stroke_join(gps, gps_b, false, false, false, false);
 
-  BKE_gpencil_stroke_geometry_update(gpd, gps);
-
   BKE_gpencil_free_stroke(gps_b);
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [8e4fb20c366] refactor-mesh-bevel-weight-generic: Merge branch 'master' into refactor-mesh-bevel-weight-generic

2022-09-05 Thread Hans Goudey
Commit: 8e4fb20c36635a9f9a3bf4cdfe792a6011d4f884
Author: Hans Goudey
Date:   Mon Sep 5 13:08:07 2022 -0500
Branches: refactor-mesh-bevel-weight-generic
https://developer.blender.org/rB8e4fb20c36635a9f9a3bf4cdfe792a6011d4f884

Merge branch 'master' into refactor-mesh-bevel-weight-generic

===



===

diff --cc source/blender/blenkernel/intern/mesh.cc
index af061a9daae,c0379c50de4..caa29c559c0
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@@ -253,8 -248,8 +248,9 @@@ static void mesh_blend_write(BlendWrite
else {
  Set names_to_skip;
  if (!BLO_write_is_undo(writer)) {
+ 
BKE_mesh_legacy_convert_hide_layers_to_flags(mesh);
 +  BKE_mesh_legacy_bevel_weight_from_layers(mesh);
BKE_mesh_legacy_convert_material_indices_to_mpoly(mesh);
/* When converting to the old mesh format, don't save redundant 
attributes. */
names_to_skip.add_multiple_new({".hide_vert", ".hide_edge", 
".hide_poly"});
diff --cc source/blender/blenkernel/intern/mesh_legacy_convert.cc
index e0f33fb038e,c2a4b0176c6..6e615a6c88d
--- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
@@@ -878,67 -917,6 +917,67 @@@ void BKE_mesh_add_mface_layers(CustomDa
  
  /** \} */
  
 +/*  */
 +/** \name Bevel Weight Conversion
 + * \{ */
 +
 +void BKE_mesh_legacy_bevel_weight_from_layers(Mesh *mesh)
 +{
 +  using namespace blender;
-   MutableSpan vertices(mesh->mvert, mesh->totvert);
++  MutableSpan verts = mesh->vertices_for_write();
 +  if (const float *weights = static_cast(
 +  CustomData_get_layer(>vdata, CD_BWEIGHT))) {
 +mesh->cd_flag |= ME_CDFLAG_VERT_BWEIGHT;
- for (const int i : vertices.index_range()) {
-   vertices[i].bweight = std::clamp(weights[i], 0.0f, 1.0f) * 255.0f;
++for (const int i : verts.index_range()) {
++  verts[i].bweight = std::clamp(weights[i], 0.0f, 1.0f) * 255.0f;
 +}
 +  }
 +  else {
 +mesh->cd_flag &= ~ME_CDFLAG_VERT_BWEIGHT;
- for (const int i : vertices.index_range()) {
-   vertices[i].bweight = 0;
++for (const int i : verts.index_range()) {
++  verts[i].bweight = 0;
 +}
 +  }
-   MutableSpan edges(mesh->medge, mesh->totedge);
++  MutableSpan edges = mesh->edges_for_write();
 +  if (const float *weights = static_cast(
 +  CustomData_get_layer(>edata, CD_BWEIGHT))) {
 +mesh->cd_flag |= ME_CDFLAG_EDGE_BWEIGHT;
 +for (const int i : edges.index_range()) {
 +  edges[i].bweight = std::clamp(weights[i], 0.0f, 1.0f) * 255.0f;
 +}
 +  }
 +  else {
 +mesh->cd_flag &= ~ME_CDFLAG_EDGE_BWEIGHT;
 +for (const int i : edges.index_range()) {
 +  edges[i].bweight = 0;
 +}
 +  }
 +}
 +
 +void BKE_mesh_legacy_bevel_weight_to_layers(Mesh *mesh)
 +{
 +  using namespace blender;
-   const Span vertices(mesh->mvert, mesh->totvert);
++  const Span verts = mesh->vertices();
 +  if (mesh->cd_flag & ME_CDFLAG_VERT_BWEIGHT) {
 +float *weights = static_cast(
- CustomData_add_layer(>vdata, CD_BWEIGHT, CD_CONSTRUCT, nullptr, 
vertices.size()));
- for (const int i : vertices.index_range()) {
-   weights[i] = vertices[i].bweight / 255.0f;
++CustomData_add_layer(>vdata, CD_BWEIGHT, CD_CONSTRUCT, nullptr, 
verts.size()));
++for (const int i : verts.index_range()) {
++  weights[i] = verts[i].bweight / 255.0f;
 +}
 +  }
 +
-   const Span edges(mesh->medge, mesh->totedge);
++  const Span edges = mesh->edges();
 +  if (mesh->cd_flag & ME_CDFLAG_EDGE_BWEIGHT) {
 +float *weights = static_cast(
 +CustomData_add_layer(>edata, CD_BWEIGHT, CD_CONSTRUCT, nullptr, 
edges.size()));
 +for (const int i : edges.index_range()) {
 +  weights[i] = edges[i].bweight / 255.0f;
 +}
 +  }
 +}
 +
 +/** \} */
 +
  /*  */
  /** \name Hide Attribute and Legacy Flag Conversion
   * \{ */
diff --cc source/blender/blenkernel/intern/subdiv_mesh.cc
index fef222fe31e,c222fc46800..34bd3e5b3bd
--- a/source/blender/blenkernel/intern/subdiv_mesh.cc
+++ b/source/blender/blenkernel/intern/subdiv_mesh.cc
@@@ -778,9 -776,10 +776,9 @@@ static void subdiv_copy_edge_data(Subdi
MEdge *subdiv_edge,
const MEdge *coarse_edge)
  {
-   const int subdiv_edge_index = subdiv_edge - ctx->subdiv_mesh->medge;
+   const int subdiv_edge_index = subdiv_edge - ctx->subdiv_edges;
if (coarse_edge == nullptr) {
  subdiv_edge->crease = 0;
 -subdiv_edge->bweight = 0;
  subdiv_edge->flag = 0;
  if (!ctx->settings->use_optimal_display) {
subdiv_edge->flag |= ME_EDGERENDER;
diff --cc source/blender/bmesh/intern/bmesh_mesh_convert.cc
index 

[Bf-blender-cvs] [edb873364d5] cycles_path_guiding: Guiding: Cleanup: Removed some unnecessary code/TODOs/snippets and added some comments

2022-09-05 Thread Sebastian Herholz
Commit: edb873364d5b2e93d9d6ad2e7b930b98118a9a77
Author: Sebastian Herholz
Date:   Mon Sep 5 20:14:15 2022 +0200
Branches: cycles_path_guiding
https://developer.blender.org/rBedb873364d5b2e93d9d6ad2e7b930b98118a9a77

Guiding: Cleanup: Removed some unnecessary code/TODOs/snippets and added some 
comments

===

M   intern/cycles/CMakeLists.txt
M   intern/cycles/integrator/path_trace.cpp
M   intern/cycles/integrator/path_trace.h
M   intern/cycles/integrator/path_trace_work_cpu.cpp
M   intern/cycles/kernel/closure/bsdf.h
M   intern/cycles/kernel/closure/bsdf_microfacet_multi.h
M   intern/cycles/kernel/closure/bsdf_refraction.h
M   intern/cycles/kernel/device/cpu/globals.h
M   intern/cycles/kernel/integrator/guiding.h
M   intern/cycles/kernel/integrator/shade_shadow.h
M   intern/cycles/kernel/integrator/subsurface_disk.h
M   intern/cycles/kernel/integrator/subsurface_random_walk.h
M   intern/cycles/kernel/integrator/volume_shader.h
M   intern/cycles/kernel/svm/closure.h
M   intern/cycles/kernel/types.h

===

diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index c3a3bae1007..0a32a9dde0f 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -349,10 +349,23 @@ endif()
 
 if(WITH_CYCLES_PATH_GUIDING)
   add_definitions(-DWITH_PATH_GUIDING)
-  add_definitions(-DWITH_PATH_GUIDING_DEBUG_PRINT)
+  # The level of the guiding integration. 
+  # Different levels can be selected to measure the overhead of 
+  # different stages.
+  # 1 = recording the path segments
+  # 2 = 1 + generating (not storing) sample data from the segments
+  # 3 = 2 + storing the generates sample data
+  # 4 = 3 + training the guiding fields
+  # 5 = 4 + querying the trained guiding for sampling (full path guiding)  
   add_definitions(-DPATH_GUIDING_LEVEL=5)
-  add_definitions(-DPATH_GUIDING_PHASE_FUNCTION_PRODUCT)
-  add_definitions(-DPATH_GUIDING_DEBUG_VALIDATE)
+  if(WITH_CYCLES_DEBUG)
+# Validates each generated guiding data structure 
+# (e.g., PathSegments, SampleData) during rendering. 
+# This mode comes with a computational overhead.
+add_definitions(-DPATH_GUIDING_DEBUG_VALIDATE)
+# Prints some guiding information (e.g., num. training samples per 
iteration)
+add_definitions(-DWITH_PATH_GUIDING_DEBUG_PRINT)
+  endif()
   include_directories(
 SYSTEM
 ${OPENPGL_INCLUDE_DIR}
diff --git a/intern/cycles/integrator/path_trace.cpp 
b/intern/cycles/integrator/path_trace.cpp
index f43885b6076..524bb814829 100644
--- a/intern/cycles/integrator/path_trace.cpp
+++ b/intern/cycles/integrator/path_trace.cpp
@@ -197,8 +197,7 @@ void PathTrace::render_pipeline(RenderWork render_work)
   }
 
   /* Update the guiding field using the training data/samples collected during 
the rendering
-   * iteration/progression. TODO: we also should check if the guiding 
structure should be reset
-   * due to scene changes. */
+   * iteration/progression. */
   if (use_guiding) {
 guiding_update_structures();
   }
@@ -1351,7 +1350,7 @@ void PathTrace::guiding_update_structures()
   const size_t num_samples = 1;
   guiding_field_->Update(*guiding_sample_data_storage_, num_samples);
   guiding_update_count++;
-#  ifdef WITH_PATH_GUIDING_DEBUG_PRINT
+#  ifdef WITH_PATH_GUIDING_DEBUG_PRINT && PATH_GUIDING_DEBUG_VALIDATE
   VLOG_WORK << "Field: valid = " << guiding_field_->Validate();
 #  endif
   // if(guiding_update_count<=1)
diff --git a/intern/cycles/integrator/path_trace.h 
b/intern/cycles/integrator/path_trace.h
index 2efd6ecf61f..fe823d73612 100644
--- a/intern/cycles/integrator/path_trace.h
+++ b/intern/cycles/integrator/path_trace.h
@@ -221,7 +221,8 @@ class PathTrace {
* rendering iteration */
   void guiding_update_structures();
 
-  /* Prepares the per-kernel thread related guiding structures (e.g., )*/
+  /* Prepares the per-kernel thread related guiding structures (e.g., 
PathSegmentStorage,
+   * pointers to the global Field and SegmentStorage)*/
   void guiding_prepare_structures();
 
   /* Get number of samples in the current state of the render buffers. */
diff --git a/intern/cycles/integrator/path_trace_work_cpu.cpp 
b/intern/cycles/integrator/path_trace_work_cpu.cpp
index 13eafdeeb4a..83fea8ff193 100644
--- a/intern/cycles/integrator/path_trace_work_cpu.cpp
+++ b/intern/cycles/integrator/path_trace_work_cpu.cpp
@@ -59,11 +59,11 @@ void PathTraceWorkCPU::init_execution()
 
 #if defined(WITH_PATH_GUIDING)
 /* Note: It seems that this is called before every rendering 
iteration/progression and not once per
- * rendering. May be we find a way to call it only once per renderering. */
+ * rendering. May be we find a way to call it only once per rendering. */
 void PathTraceWorkCPU::guiding_init_kernel_globals(void *guiding_field, void 
*sample_data_storage)
 {
-  

[Bf-blender-cvs] [f510d96b0a1] cycles_path_guiding: Guiding: removed bssrdf_weight from the state

2022-09-05 Thread sherholz-intel
Commit: f510d96b0a1f2247d5bb2f97f76b69c1f09805ed
Author: sherholz-intel
Date:   Fri Sep 2 12:08:41 2022 +0200
Branches: cycles_path_guiding
https://developer.blender.org/rBf510d96b0a1f2247d5bb2f97f76b69c1f09805ed

Guiding: removed bssrdf_weight from the state

===

M   intern/cycles/kernel/integrator/guiding.h
M   intern/cycles/kernel/integrator/state_template.h
M   intern/cycles/kernel/integrator/subsurface.h
M   intern/cycles/kernel/integrator/subsurface_disk.h
M   intern/cycles/kernel/integrator/subsurface_random_walk.h

===

diff --git a/intern/cycles/kernel/integrator/guiding.h 
b/intern/cycles/kernel/integrator/guiding.h
index 31e747a592a..8b83fc0754f 100644
--- a/intern/cycles/kernel/integrator/guiding.h
+++ b/intern/cycles/kernel/integrator/guiding.h
@@ -137,9 +137,29 @@ ccl_device_forceinline void 
guiding_record_bssrdf_segment(KernelGlobals kg,
 #endif
 }
 
+ccl_device_forceinline void guiding_record_bssrdf_weight(KernelGlobals kg,
+ IntegratorState state,
+ const Spectrum weight)
+{
+#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 1
+  if (!kernel_data.integrator.use_guiding) {
+return;
+  }
+
+  const float3 weight_rgb = spectrum_to_rgb(weight);
+
+  kernel_assert(state->guiding.path_segment != nullptr);
+
+  openpgl::cpp::SetTransmittanceWeight(state->guiding.path_segment, 
guiding_vec3f(zero_float3()));
+  openpgl::cpp::SetScatteringWeight(state->guiding.path_segment, 
guiding_vec3f(weight_rgb));
+  openpgl::cpp::SetIsDelta(state->guiding.path_segment, false);
+  openpgl::cpp::SetEta(state->guiding.path_segment, 1.0f);
+  openpgl::cpp::SetRoughness(state->guiding.path_segment, 1.0f);
+#endif
+}
+
 ccl_device_forceinline void guiding_record_bssrdf_bounce(KernelGlobals kg,
  IntegratorState state,
- const Spectrum weight,
  const float pdf,
  const float3 N,
  const float3 omega_in)
@@ -149,20 +169,14 @@ ccl_device_forceinline void 
guiding_record_bssrdf_bounce(KernelGlobals kg,
 return;
   }
 
-  const float3 weight_rgb = spectrum_to_rgb(weight);
   const float3 normal = clamp(N, -one_float3(), one_float3());
 
   kernel_assert(state->guiding.path_segment != nullptr);
 
-  openpgl::cpp::SetTransmittanceWeight(state->guiding.path_segment, 
guiding_vec3f(one_float3()));
   openpgl::cpp::SetVolumeScatter(state->guiding.path_segment, false);
   openpgl::cpp::SetNormal(state->guiding.path_segment, guiding_vec3f(normal));
   openpgl::cpp::SetDirectionIn(state->guiding.path_segment, 
guiding_vec3f(omega_in));
   openpgl::cpp::SetPDFDirectionIn(state->guiding.path_segment, pdf);
-  openpgl::cpp::SetScatteringWeight(state->guiding.path_segment, 
guiding_vec3f(weight_rgb));
-  openpgl::cpp::SetIsDelta(state->guiding.path_segment, false);
-  openpgl::cpp::SetEta(state->guiding.path_segment, 1.0f);
-  openpgl::cpp::SetRoughness(state->guiding.path_segment, 1.0f);
 #endif
 }
 
diff --git a/intern/cycles/kernel/integrator/state_template.h 
b/intern/cycles/kernel/integrator/state_template.h
index 4cf5f4a1e8f..20a262d493a 100644
--- a/intern/cycles/kernel/integrator/state_template.h
+++ b/intern/cycles/kernel/integrator/state_template.h
@@ -91,7 +91,6 @@ KERNEL_STRUCT_MEMBER(subsurface, PackedSpectrum, albedo, 
KERNEL_FEATURE_SUBSURFA
 KERNEL_STRUCT_MEMBER(subsurface, PackedSpectrum, radius, 
KERNEL_FEATURE_SUBSURFACE)
 KERNEL_STRUCT_MEMBER(subsurface, float, anisotropy, KERNEL_FEATURE_SUBSURFACE)
 KERNEL_STRUCT_MEMBER(subsurface, packed_float3, Ng, KERNEL_FEATURE_SUBSURFACE)
-KERNEL_STRUCT_MEMBER(subsurface, PackedSpectrum, bssrdf_weight, 
KERNEL_FEATURE_SUBSURFACE)
 KERNEL_STRUCT_END(subsurface)
 
 /** Volume Stack 
**/
diff --git a/intern/cycles/kernel/integrator/subsurface.h 
b/intern/cycles/kernel/integrator/subsurface.h
index 4b126007060..979c298e0a9 100644
--- a/intern/cycles/kernel/integrator/subsurface.h
+++ b/intern/cycles/kernel/integrator/subsurface.h
@@ -77,7 +77,10 @@ ccl_device int subsurface_bounce(KernelGlobals kg,
   INTEGRATOR_STATE_WRITE(state, subsurface, albedo) = bssrdf->albedo;
   INTEGRATOR_STATE_WRITE(state, subsurface, radius) = bssrdf->radius;
   INTEGRATOR_STATE_WRITE(state, subsurface, anisotropy) = bssrdf->anisotropy;
-  INTEGRATOR_STATE_WRITE(state, subsurface, bssrdf_weight) = weight;
+
+  if (kernel_data.integrator.use_guiding) {
+guiding_record_bssrdf_weight(kg, state, safe_divide_color(weight, 
bssrdf->albedo));
+  }
 
   return LABEL_SUBSURFACE_SCATTER;
 }
diff 

[Bf-blender-cvs] [d26a0be968e] master: UI: Corrected Scaling of AREAMINX

2022-09-05 Thread Harley Acheson
Commit: d26a0be968e09a89bc0cd49dd08aba3e08a28aad
Author: Harley Acheson
Date:   Mon Sep 5 10:37:15 2022 -0700
Branches: master
https://developer.blender.org/rBd26a0be968e09a89bc0cd49dd08aba3e08a28aad

UI: Corrected Scaling of AREAMINX

Minimum horizontal area size should be scaled by UI resolution.

See D15865 for more details.

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

Reviewed by Brecht Van Lommel

===

M   source/blender/editors/screen/screen_geometry.c
M   source/blender/editors/screen/screen_ops.c
M   source/blender/editors/space_buttons/space_buttons.c
M   source/blender/makesdna/DNA_screen_types.h

===

diff --git a/source/blender/editors/screen/screen_geometry.c 
b/source/blender/editors/screen/screen_geometry.c
index 3486ea8b466..3ad3fa7892c 100644
--- a/source/blender/editors/screen/screen_geometry.c
+++ b/source/blender/editors/screen/screen_geometry.c
@@ -284,7 +284,7 @@ short screen_geom_find_area_split_point(const ScrArea *area,
 {
   const int cur_area_width = screen_geom_area_width(area);
   const int cur_area_height = screen_geom_area_height(area);
-  const short area_min_x = AREAMINX;
+  const short area_min_x = AREAMINX * U.dpi_fac;
   const short area_min_y = ED_area_headersize();
 
   /* area big enough? */
diff --git a/source/blender/editors/screen/screen_ops.c 
b/source/blender/editors/screen/screen_ops.c
index c069b3c6292..5331747beae 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1639,7 +1639,7 @@ static void area_move_set_limits(wmWindow *win,
   }
 }
 else {
-  int areamin = AREAMINX;
+  int areamin = AREAMINX * U.dpi_fac;
 
   if (area->v1->vec.x > window_rect.xmin) {
 areamin += U.pixelsize;
@@ -2062,7 +2062,7 @@ static bool area_split_allowed(const ScrArea *area, const 
eScreenAxis dir_axis)
 return false;
   }
 
-  if ((dir_axis == SCREEN_AXIS_V && area->winx <= 2 * AREAMINX) ||
+  if ((dir_axis == SCREEN_AXIS_V && area->winx <= 2 * AREAMINX * U.dpi_fac) ||
   (dir_axis == SCREEN_AXIS_H && area->winy <= 2 * ED_area_headersize())) {
 /* Must be at least double minimum sizes to split into two. */
 return false;
diff --git a/source/blender/editors/space_buttons/space_buttons.c 
b/source/blender/editors/space_buttons/space_buttons.c
index 8026cc509b2..2bee60557b7 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -978,8 +978,7 @@ void ED_spacetype_buttons(void)
   /* regions: navigation bar */
   art = MEM_callocN(sizeof(ARegionType), "spacetype nav buttons region");
   art->regionid = RGN_TYPE_NAV_BAR;
-  art->prefsizex = AREAMINX - 3; /* XXX Works and looks best,
-  * should we update AREAMINX accordingly? */
+  art->prefsizex = AREAMINX;
   art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES | ED_KEYMAP_NAVBAR;
   art->init = buttons_navigation_bar_region_init;
   art->draw = buttons_navigation_bar_region_draw;
diff --git a/source/blender/makesdna/DNA_screen_types.h 
b/source/blender/makesdna/DNA_screen_types.h
index 856d48e395b..9b999e4426f 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -539,7 +539,7 @@ enum {
 };
 
 #define AREAGRID 4
-#define AREAMINX 32
+#define AREAMINX 29
 #define HEADER_PADDING_Y 6
 #define HEADERY (20 + HEADER_PADDING_Y)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [05952aa94d3] master: Mesh: Remove redundant custom data pointers

2022-09-05 Thread Hans Goudey
Commit: 05952aa94d33eeb504fa63618ba35c2bcc8bd19b
Author: Hans Goudey
Date:   Mon Sep 5 11:56:34 2022 -0500
Branches: master
https://developer.blender.org/rB05952aa94d33eeb504fa63618ba35c2bcc8bd19b

Mesh: Remove redundant custom data pointers

For copy-on-write, we want to share attribute arrays between meshes
where possible. Mutable pointers like `Mesh.mvert` make that difficult
by making ownership vague. They also make code more complex by adding
redundancy.

The simplest solution is just removing them and retrieving layers from
`CustomData` as needed. Similar changes have already been applied to
curves and point clouds (e9f82d3dc7ee, 410a6efb747f). Removing use of
the pointers generally makes code more obvious and more reusable.

Mesh data is now accessed with a C++ API (`Mesh::edges()` or
`Mesh::edges_for_write()`), and a C API (`BKE_mesh_edges(mesh)`).

The CoW changes this commit makes possible are described in T95845
and T95842, and started in D14139 and D14140. The change also simplifies
the ongoing mesh struct-of-array refactors from T95965.

**RNA/Python Access Performance**
Theoretically, accessing mesh elements with the RNA API may become
slower, since the layer needs to be found on every random access.
However, overhead is already high enough that this doesn't make a
noticible differenc, and performance is actually improved in some
cases. Random access can be up to 10% faster, but other situations
might be a bit slower. Generally using `foreach_get/set` are the best
way to improve performance. See the differential revision for more
discussion about Python performance.

Cycles has been updated to use raw pointers and the internal Blender
mesh types, mostly because there is no sense in having this overhead
when it's already compiled with Blender. In my tests this roughly
halves the Cycles mesh creation time (0.19s to 0.10s for a 1 million
face grid).

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

===

M   intern/cycles/blender/mesh.cpp
M   source/blender/blenkernel/BKE_cloth.h
M   source/blender/blenkernel/BKE_deform.h
M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/blenkernel/BKE_mesh_mapping.h
M   source/blender/blenkernel/BKE_mesh_remap.h
M   source/blender/blenkernel/BKE_mesh_sample.hh
M   source/blender/blenkernel/BKE_paint.h
M   source/blender/blenkernel/BKE_particle.h
M   source/blender/blenkernel/BKE_shrinkwrap.h
M   source/blender/blenkernel/intern/DerivedMesh.cc
M   source/blender/blenkernel/intern/armature_deform.c
M   source/blender/blenkernel/intern/bvhutils.cc
M   source/blender/blenkernel/intern/cloth.c
M   source/blender/blenkernel/intern/constraint.c
M   source/blender/blenkernel/intern/crazyspace.cc
M   source/blender/blenkernel/intern/curve_to_mesh_convert.cc
M   source/blender/blenkernel/intern/data_transfer.c
M   source/blender/blenkernel/intern/deform.c
M   source/blender/blenkernel/intern/dynamicpaint.c
M   source/blender/blenkernel/intern/effect.c
M   source/blender/blenkernel/intern/fluid.c
M   source/blender/blenkernel/intern/geometry_component_mesh.cc
M   source/blender/blenkernel/intern/gpencil_geom.cc
M   source/blender/blenkernel/intern/key.c
M   source/blender/blenkernel/intern/lattice_deform.c
M   source/blender/blenkernel/intern/mball_tessellate.c
M   source/blender/blenkernel/intern/mesh.cc
M   source/blender/blenkernel/intern/mesh_boolean_convert.cc
M   source/blender/blenkernel/intern/mesh_calc_edges.cc
M   source/blender/blenkernel/intern/mesh_convert.cc
M   source/blender/blenkernel/intern/mesh_evaluate.cc
M   source/blender/blenkernel/intern/mesh_fair.cc
M   source/blender/blenkernel/intern/mesh_iterators.c
M   source/blender/blenkernel/intern/mesh_legacy_convert.cc
M   source/blender/blenkernel/intern/mesh_mapping.c
M   source/blender/blenkernel/intern/mesh_merge.c
M   source/blender/blenkernel/intern/mesh_merge_customdata.cc
M   source/blender/blenkernel/intern/mesh_mirror.c
M   source/blender/blenkernel/intern/mesh_normals.cc
M   source/blender/blenkernel/intern/mesh_remap.c
M   source/blender/blenkernel/intern/mesh_remesh_voxel.cc
M   source/blender/blenkernel/intern/mesh_runtime.cc
M   source/blender/blenkernel/intern/mesh_sample.cc
M   source/blender/blenkernel/intern/mesh_tangent.c
M   source/blender/blenkernel/intern/mesh_validate.cc
M   source/blender/blenkernel/intern/mesh_wrapper.cc
M   source/blender/blenkernel/intern/multires.c
M   source/blender/blenkernel/intern/multires_reshape.h
M   source/blender/blenkernel/intern/multires_reshape_apply_base.c
M   source/blender/blenkernel/intern/multires_reshape_smooth.c
M   source/blender/blenkernel/intern/multires_reshape_subdivide.c
M   source/blender/blenkernel/intern/multires_reshape_util.c
M   

[Bf-blender-cvs] [258d3858572] master: Cleanup: Unused variable, compiler warning

2022-09-05 Thread Hans Goudey
Commit: 258d3858572b588051814363abe42044eeec3182
Author: Hans Goudey
Date:   Mon Sep 5 12:02:21 2022 -0500
Branches: master
https://developer.blender.org/rB258d3858572b588051814363abe42044eeec3182

Cleanup: Unused variable, compiler warning

===

M   source/blender/blenkernel/BKE_collection.h
M   source/blender/blenkernel/intern/collection.c

===

diff --git a/source/blender/blenkernel/BKE_collection.h 
b/source/blender/blenkernel/BKE_collection.h
index 4a729311b6a..4346c2a3d23 100644
--- a/source/blender/blenkernel/BKE_collection.h
+++ b/source/blender/blenkernel/BKE_collection.h
@@ -26,6 +26,7 @@ struct BlendExpander;
 struct BlendLibReader;
 struct BlendWriter;
 struct Collection;
+struct ID;
 struct Library;
 struct Main;
 struct Object;
diff --git a/source/blender/blenkernel/intern/collection.c 
b/source/blender/blenkernel/intern/collection.c
index 572a0caa3c7..e0448afdec6 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -186,6 +186,8 @@ static ID *collection_owner_get(Main *bmain, ID *id, ID 
*UNUSED(owner_id_hint))
 }
   }
   BLI_assert(is_owner_found);
+#else
+  UNUSED_VARS(bmain);
 #endif
 
   return master_collection->owner_id;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4380e1f9006] refactor-mesh-remove-pointers: Merge branch 'master' into refactor-mesh-remove-pointers

2022-09-05 Thread Hans Goudey
Commit: 4380e1f9006f8487e12af6601142c81633f0f476
Author: Hans Goudey
Date:   Mon Sep 5 11:31:39 2022 -0500
Branches: refactor-mesh-remove-pointers
https://developer.blender.org/rB4380e1f9006f8487e12af6601142c81633f0f476

Merge branch 'master' into refactor-mesh-remove-pointers

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [63cfc8f9f6d] master: Cleanup: Fix unused variable warnings

2022-09-05 Thread Hans Goudey
Commit: 63cfc8f9f6d623f33b50c5c07976af2b22845713
Author: Hans Goudey
Date:   Mon Sep 5 11:28:30 2022 -0500
Branches: master
https://developer.blender.org/rB63cfc8f9f6d623f33b50c5c07976af2b22845713

Cleanup: Fix unused variable warnings

===

M   source/blender/draw/intern/draw_debug.cc

===

diff --git a/source/blender/draw/intern/draw_debug.cc 
b/source/blender/draw/intern/draw_debug.cc
index 9cb79d73812..b0662a42ea0 100644
--- a/source/blender/draw/intern/draw_debug.cc
+++ b/source/blender/draw/intern/draw_debug.cc
@@ -671,6 +671,8 @@ void DRW_debug_modelmat(const float modelmat[4][4])
 return;
   }
   reinterpret_cast(DST.debug)->modelmat_set(modelmat);
+#else
+  UNUSED_VARS(modelmat);
 #endif
 }
 
@@ -718,6 +720,8 @@ void DRW_debug_bbox(const BoundBox *bbox, const float 
color[4])
 return;
   }
   reinterpret_cast(DST.debug)->draw_bbox(*bbox, 
color);
+#else
+  UNUSED_VARS(bbox, color);
 #endif
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7f70b995841] master: Fix VSE: accidentally commented out code

2022-09-05 Thread Richard Antalik
Commit: 7f70b9958410a16c9288112924703598b49a5c0c
Author: Richard Antalik
Date:   Mon Sep 5 17:39:23 2022 +0200
Branches: master
https://developer.blender.org/rB7f70b9958410a16c9288112924703598b49a5c0c

Fix VSE: accidentally commented out code

`DEG_id_tag_update` was commented out in `sequencer_meta_toggle_exec()`.
Tagging does not affect functionality now, but it should be done.

===

M   source/blender/editors/space_sequencer/sequencer_edit.c

===

diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c 
b/source/blender/editors/space_sequencer/sequencer_edit.c
index e37d254b16f..86dc9f566e5 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -1931,7 +1931,7 @@ static int sequencer_meta_toggle_exec(bContext *C, 
wmOperator *UNUSED(op))
 SEQ_select_active_set(scene, meta_parent);
   }
 
-  // DEG_id_tag_update(>id, ID_RECALC_SEQUENCER_STRIPS);
+  DEG_id_tag_update(>id, ID_RECALC_SEQUENCER_STRIPS);
   WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
   return OPERATOR_FINISHED;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [70da5a1434e] master: Cleanup: Remove unused code for VSE waveform drawing

2022-09-05 Thread Richard Antalik
Commit: 70da5a1434efb5d1639264d8a0c49b56e8fc5db6
Author: Richard Antalik
Date:   Mon Sep 5 17:47:27 2022 +0200
Branches: master
https://developer.blender.org/rB70da5a1434efb5d1639264d8a0c49b56e8fc5db6

Cleanup: Remove unused code for VSE waveform drawing

===

M   source/blender/editors/space_sequencer/sequencer_draw.c

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 0bacbde8240..bb027c99546 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -519,18 +519,6 @@ static void draw_seq_waveform_overlay(
   MEM_freeN(waveform_data);
 }
 
-#if 0
-static size_t *waveform_append(WaveVizData *waveform_data,
-   vec2f pos,
-   const float value_min,
-   const float value_max,
-   const float y_mid,
-   const float y_scale,
-   const float rms,
-   const bool is_clipping,
-   const bool is_line_strip)
-#endif
-
 static void drawmeta_contents(Scene *scene,
   Sequence *seqm,
   float x1,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [89abc14d6ce] master: Fix T81002: Images drawn with the Python gpu module no longer draw on top in the Image Editor

2022-09-05 Thread Germano Cavalcante
Commit: 89abc14d6ce92dd5fd8cd32885d379d46f017f81
Author: Germano Cavalcante
Date:   Mon Sep 5 11:48:06 2022 -0300
Branches: master
https://developer.blender.org/rB89abc14d6ce92dd5fd8cd32885d379d46f017f81

Fix T81002: Images drawn with the Python gpu module no longer draw on top in 
the Image Editor

This reverts commit 32d4a67017ecf4af75a9bfde885526550a6534ba thus fixing T81002 
again.

And in order not to break T81212 (again) a different fix was implemented.


Reviewed By: brecht

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

===

M   source/blender/draw/engines/external/external_engine.c
M   source/blender/gpu/shaders/gpu_shader_2D_image_vert.glsl

===

diff --git a/source/blender/draw/engines/external/external_engine.c 
b/source/blender/draw/engines/external/external_engine.c
index b9c09e2bc4f..3f047d8de68 100644
--- a/source/blender/draw/engines/external/external_engine.c
+++ b/source/blender/draw/engines/external/external_engine.c
@@ -236,7 +236,11 @@ static void external_draw_scene_do_v3d(void *vedata)
   RegionView3D *rv3d = draw_ctx->rv3d;
   ARegion *region = draw_ctx->region;
 
-  DRW_state_reset_ex(DRW_STATE_DEFAULT & ~DRW_STATE_DEPTH_LESS_EQUAL);
+  DRW_state_reset_ex(DRW_STATE_WRITE_COLOR);
+
+  /* The external engine can use the OpenGL rendering API directly, so make 
sure the state is
+   * already applied. */
+  GPU_apply_state();
 
   /* Create render engine. */
   if (!rv3d->render_engine) {
@@ -332,6 +336,12 @@ static void external_draw_scene_do_image(void 
*UNUSED(vedata))
   BLI_assert(re != NULL);
   BLI_assert(engine != NULL);
 
+  DRW_state_reset_ex(DRW_STATE_WRITE_COLOR);
+
+  /* The external engine can use the OpenGL rendering API directly, so make 
sure the state is
+   * already applied. */
+  GPU_apply_state();
+
   const DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
 
   /* Clear the depth buffer to the value used by the background overlay so 
that the overlay is not
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_image_vert.glsl 
b/source/blender/gpu/shaders/gpu_shader_2D_image_vert.glsl
index 0b5e3759dfb..8191fb6a8d6 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_image_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_image_vert.glsl
@@ -10,6 +10,5 @@ out vec2 texCoord_interp;
 void main()
 {
   gl_Position = ModelViewProjectionMatrix * vec4(pos.xy, 0.0f, 1.0f);
-  gl_Position.z = 1.0;
   texCoord_interp = texCoord;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [44619eaa32c] master: Cleanup: make format

2022-09-05 Thread Brecht Van Lommel
Commit: 44619eaa32ceaa796f32ad2cea2b3a6c2259461d
Author: Brecht Van Lommel
Date:   Mon Sep 5 17:24:52 2022 +0200
Branches: master
https://developer.blender.org/rB44619eaa32ceaa796f32ad2cea2b3a6c2259461d

Cleanup: make format

===

M   release/scripts/modules/bpy_extras/io_utils.py
M   source/blender/draw/intern/DRW_gpu_wrapper.hh
M   source/blender/editors/gpencil/gpencil_edit.c
M   source/blender/editors/space_node/node_ops.cc
M   source/blender/gpu/intern/gpu_codegen.cc

===

diff --git a/release/scripts/modules/bpy_extras/io_utils.py 
b/release/scripts/modules/bpy_extras/io_utils.py
index cc6aa6b9afa..35b7d564a5e 100644
--- a/release/scripts/modules/bpy_extras/io_utils.py
+++ b/release/scripts/modules/bpy_extras/io_utils.py
@@ -23,6 +23,7 @@ from bpy.props import (
 )
 from bpy.app.translations import pgettext_data as data_
 
+
 def _check_axis_conversion(op):
 if hasattr(op, "axis_forward") and hasattr(op, "axis_up"):
 return axis_conversion_ensure(
diff --git a/source/blender/draw/intern/DRW_gpu_wrapper.hh 
b/source/blender/draw/intern/DRW_gpu_wrapper.hh
index d9122657144..890cd588527 100644
--- a/source/blender/draw/intern/DRW_gpu_wrapper.hh
+++ b/source/blender/draw/intern/DRW_gpu_wrapper.hh
@@ -859,7 +859,8 @@ class TextureFromPool : public Texture, NonMovable {
  * Dummy type to bind texture as image.
  * It is just a GPUTexture in disguise.
  */
-class Image {};
+class Image {
+};
 
 static inline Image *as_image(GPUTexture *tex)
 {
diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index 106f4acd6b7..120c806c727 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -4169,7 +4169,6 @@ static int gpencil_stroke_outline_exec(bContext *C, 
wmOperator *op)
 }
   }
 
-
   if (changed) {
 /* notifiers */
 DEG_id_tag_update(>id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
diff --git a/source/blender/editors/space_node/node_ops.cc 
b/source/blender/editors/space_node/node_ops.cc
index c936f07a594..3b3189983e2 100644
--- a/source/blender/editors/space_node/node_ops.cc
+++ b/source/blender/editors/space_node/node_ops.cc
@@ -111,7 +111,7 @@ void node_operatortypes()
   WM_operatortype_append(NODE_OT_cryptomatte_layer_remove);
 }
 
-void node_keymap( wmKeyConfig *keyconf)
+void node_keymap(wmKeyConfig *keyconf)
 {
   /* Entire Editor only - */
   WM_keymap_ensure(keyconf, "Node Generic", SPACE_NODE, 0);
diff --git a/source/blender/gpu/intern/gpu_codegen.cc 
b/source/blender/gpu/intern/gpu_codegen.cc
index f774f33e03d..b81345683b4 100644
--- a/source/blender/gpu/intern/gpu_codegen.cc
+++ b/source/blender/gpu/intern/gpu_codegen.cc
@@ -199,7 +199,8 @@ static std::ostream <<(std::ostream , const 
GPUOutput *output)
 }
 
 /* Trick type to change overload and keep a somewhat nice syntax. */
-struct GPUConstant : public GPUInput {};
+struct GPUConstant : public GPUInput {
+};
 
 /* Print data constructor (i.e: vec2(1.0f, 1.0f)). */
 static std::ostream <<(std::ostream , const GPUConstant *input)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [39a3d312c18] master: GPencil: Fix bug in set start api function

2022-09-05 Thread Antonio Vazquez
Commit: 39a3d312c18b3ee7e6a41d9665d4692478d68602
Author: Antonio Vazquez
Date:   Mon Sep 5 17:10:42 2022 +0200
Branches: master
https://developer.blender.org/rB39a3d312c18b3ee7e6a41d9665d4692478d68602

GPencil: Fix bug in  set start api function

The point of the second stroke was duplicated.

===

M   source/blender/blenkernel/intern/gpencil_geom.cc

===

diff --git a/source/blender/blenkernel/intern/gpencil_geom.cc 
b/source/blender/blenkernel/intern/gpencil_geom.cc
index 16e71c7418c..0a75b0f5339 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.cc
+++ b/source/blender/blenkernel/intern/gpencil_geom.cc
@@ -3556,7 +3556,7 @@ void BKE_gpencil_stroke_start_set(bGPdata *gpd, 
bGPDstroke *gps, int start_idx)
 
   bGPDstroke *gps_b = BKE_gpencil_stroke_duplicate(gps, true, false);
   BKE_gpencil_stroke_trim_points(gps_b, 0, start_idx);
-  BKE_gpencil_stroke_trim_points(gps, start_idx, gps->totpoints - 1);
+  BKE_gpencil_stroke_trim_points(gps, start_idx + 1, gps->totpoints - 1);
 
   /* Join both strokes. */
   BKE_gpencil_stroke_join(gps, gps_b, false, false, false, false);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [191872a8367] master: GPencil: Improve previous commit error checking

2022-09-05 Thread Antonio Vazquez
Commit: 191872a836715e8f7ac4d7ecb10a2bd0555213f1
Author: Antonio Vazquez
Date:   Mon Sep 5 17:08:23 2022 +0200
Branches: master
https://developer.blender.org/rB191872a836715e8f7ac4d7ecb10a2bd0555213f1

GPencil: Improve previous commit error checking

Better check if the strokes has more points. 

A 0 or 1 point stroke never need to set start point.

===

M   source/blender/blenkernel/intern/gpencil_geom.cc

===

diff --git a/source/blender/blenkernel/intern/gpencil_geom.cc 
b/source/blender/blenkernel/intern/gpencil_geom.cc
index 935bc4a5529..16e71c7418c 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.cc
+++ b/source/blender/blenkernel/intern/gpencil_geom.cc
@@ -3545,7 +3545,7 @@ void BKE_gpencil_stroke_join(bGPDstroke *gps_a,
 
 void BKE_gpencil_stroke_start_set(bGPdata *gpd, bGPDstroke *gps, int start_idx)
 {
-  if ((start_idx < 1) || (start_idx >= gps->totpoints) || (gps->totpoints == 
0)) {
+  if ((start_idx < 1) || (start_idx >= gps->totpoints) || (gps->totpoints < 
2)) {
 return;
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ffe4840c2b9] master: Cleanup: Add parameter auto_flip documentation

2022-09-05 Thread Antonio Vazquez
Commit: ffe4840c2b98c16514421977e464191d7a1cab7a
Author: Antonio Vazquez
Date:   Mon Sep 5 17:04:23 2022 +0200
Branches: master
https://developer.blender.org/rBffe4840c2b98c16514421977e464191d7a1cab7a

Cleanup: Add parameter auto_flip documentation

===

M   source/blender/blenkernel/BKE_gpencil_geom.h

===

diff --git a/source/blender/blenkernel/BKE_gpencil_geom.h 
b/source/blender/blenkernel/BKE_gpencil_geom.h
index 88244ec9d64..cbaf118e803 100644
--- a/source/blender/blenkernel/BKE_gpencil_geom.h
+++ b/source/blender/blenkernel/BKE_gpencil_geom.h
@@ -401,6 +401,7 @@ void BKE_gpencil_stroke_set_random_color(struct bGPDstroke 
*gps);
 
 /**
  * Join two strokes using the shortest distance (reorder stroke if necessary).
+ *  \param auto_flip: Flip the stroke if the join between two strokes is not 
end->start points.
  */
 void BKE_gpencil_stroke_join(struct bGPDstroke *gps_a,
  struct bGPDstroke *gps_b,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5b2720befc2] master: GPencil: Small code cleanup

2022-09-05 Thread Antonio Vazquez
Commit: 5b2720befc24cb592abc425b02376852e486b1cd
Author: Antonio Vazquez
Date:   Mon Sep 5 17:01:14 2022 +0200
Branches: master
https://developer.blender.org/rB5b2720befc24cb592abc425b02376852e486b1cd

GPencil: Small code cleanup

===

M   source/blender/blenkernel/intern/gpencil_geom.cc

===

diff --git a/source/blender/blenkernel/intern/gpencil_geom.cc 
b/source/blender/blenkernel/intern/gpencil_geom.cc
index 2cc752dca47..935bc4a5529 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.cc
+++ b/source/blender/blenkernel/intern/gpencil_geom.cc
@@ -3545,7 +3545,7 @@ void BKE_gpencil_stroke_join(bGPDstroke *gps_a,
 
 void BKE_gpencil_stroke_start_set(bGPdata *gpd, bGPDstroke *gps, int start_idx)
 {
-  if ((start_idx < 1) || (start_idx >= gps->totpoints)) {
+  if ((start_idx < 1) || (start_idx >= gps->totpoints) || (gps->totpoints == 
0)) {
 return;
   }
 
@@ -3555,7 +3555,7 @@ void BKE_gpencil_stroke_start_set(bGPdata *gpd, 
bGPDstroke *gps, int start_idx)
   }
 
   bGPDstroke *gps_b = BKE_gpencil_stroke_duplicate(gps, true, false);
-  BKE_gpencil_stroke_trim_points(gps_b, 0, start_idx - 0);
+  BKE_gpencil_stroke_trim_points(gps_b, 0, start_idx);
   BKE_gpencil_stroke_trim_points(gps, start_idx, gps->totpoints - 1);
 
   /* Join both strokes. */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [cd49fee7411] master: IDMAnagement: Add owner ID pointer to embedded ones.

2022-09-05 Thread Bastien Montagne
Commit: cd49fee741148dc9dcc0cbefce0b70ea0f2d55c6
Author: Bastien Montagne
Date:   Mon Sep 5 15:46:00 2022 +0200
Branches: master
https://developer.blender.org/rBcd49fee741148dc9dcc0cbefce0b70ea0f2d55c6

IDMAnagement: Add owner ID pointer to embedded ones.

Add a dedicated `owner_id` pointer to ID types that can be embedded
(Collections and NodeTrees), and modify slightly come code to make
handling those more safe and consistent.

This implements first part of T69169.

Reviewed By: brecht

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

===

M   source/blender/blenkernel/BKE_collection.h
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/collection.c
M   source/blender/blenkernel/intern/linestyle.c
M   source/blender/blenkernel/intern/material.c
M   source/blender/blenkernel/intern/node.cc
M   source/blender/blenkernel/intern/scene.cc
M   source/blender/blenkernel/intern/simulation.cc
M   source/blender/blenloader/intern/readfile.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/draw/engines/eevee/eevee_shaders.c
M   source/blender/draw/engines/eevee_next/eevee_material.cc
M   source/blender/editors/space_node/node_edit.cc
M   
source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
M   source/blender/io/collada/Materials.cpp
M   source/blender/io/collada/collada_utils.cpp
M   source/blender/io/usd/intern/usd_reader_material.cc
M   source/blender/io/wavefront_obj/importer/obj_import_mtl.cc
M   source/blender/makesdna/DNA_collection_types.h
M   source/blender/makesdna/DNA_node_types.h

===

diff --git a/source/blender/blenkernel/BKE_collection.h 
b/source/blender/blenkernel/BKE_collection.h
index feb3dc7de80..4a729311b6a 100644
--- a/source/blender/blenkernel/BKE_collection.h
+++ b/source/blender/blenkernel/BKE_collection.h
@@ -94,7 +94,7 @@ struct Collection *BKE_collection_duplicate(struct Main 
*bmain,
 /* Master Collection for Scene */
 
 #define BKE_SCENE_COLLECTION_NAME "Scene Collection"
-struct Collection *BKE_collection_master_add(void);
+struct Collection *BKE_collection_master_add(struct Scene *scene);
 
 /* Collection Objects */
 
@@ -296,7 +296,9 @@ void BKE_main_collections_parent_relations_rebuild(struct 
Main *bmain);
 /* .blend file I/O */
 
 void BKE_collection_blend_write_nolib(struct BlendWriter *writer, struct 
Collection *collection);
-void BKE_collection_blend_read_data(struct BlendDataReader *reader, struct 
Collection *collection);
+void BKE_collection_blend_read_data(struct BlendDataReader *reader,
+struct Collection *collection,
+struct ID *owner_id);
 void BKE_collection_blend_read_lib(struct BlendLibReader *reader, struct 
Collection *collection);
 void BKE_collection_blend_read_expand(struct BlendExpander *expander,
   struct Collection *collection);
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index 8affbf0ca67..46303a4e19c 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -472,6 +472,11 @@ void ntreeSetTypes(const struct bContext *C, struct 
bNodeTree *ntree);
 
 struct bNodeTree *ntreeAddTree(struct Main *bmain, const char *name, const 
char *idname);
 
+struct bNodeTree *ntreeAddTreeEmbedded(struct Main *bmain,
+   struct ID *owner_id,
+   const char *name,
+   const char *idname);
+
 /* copy/free funcs, need to manage ID users */
 
 /**
@@ -540,7 +545,9 @@ void ntreeBlendWrite(struct BlendWriter *writer, struct 
bNodeTree *ntree);
 /**
  * \note `ntree` itself has been read!
  */
-void ntreeBlendReadData(struct BlendDataReader *reader, struct bNodeTree 
*ntree);
+void ntreeBlendReadData(struct BlendDataReader *reader,
+struct ID *owner_id,
+struct bNodeTree *ntree);
 void ntreeBlendReadLib(struct BlendLibReader *reader, struct bNodeTree *ntree);
 void ntreeBlendReadExpand(struct BlendExpander *expander, struct bNodeTree 
*ntree);
 
diff --git a/source/blender/blenkernel/intern/collection.c 
b/source/blender/blenkernel/intern/collection.c
index caf59a9b363..572a0caa3c7 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -143,6 +143,9 @@ static void collection_foreach_id(ID *id, 
LibraryForeachIDData *data)
 {
   Collection *collection = (Collection *)id;
 
+  BKE_LIB_FOREACHID_PROCESS_ID(
+  data, collection->owner_id, IDWALK_CB_LOOPBACK | IDWALK_CB_NEVER_SELF);
+
   LISTBASE_FOREACH (CollectionObject *, cob, >gobject) {
 BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, cob->ob, 

[Bf-blender-cvs] [19b9ea72b00] master: I18n: extract keymap preferences

2022-09-05 Thread Damien Picard
Commit: 19b9ea72b00b85200da0900b327a9d37378c83f4
Author: Damien Picard
Date:   Mon Sep 5 15:36:56 2022 +0200
Branches: master
https://developer.blender.org/rB19b9ea72b00b85200da0900b327a9d37378c83f4

I18n: extract keymap preferences

The per-keymap user preferences messages were not extracted. This goes
through the keymap preferences RNA, as well as Python files for UI.

Reviewed By: mont29

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

===

M   release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
M   release/scripts/modules/bl_i18n_utils/settings.py

===

diff --git a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py 
b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
index dea538af39b..21ca38bff20 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
@@ -258,11 +258,12 @@ def dump_rna_messages(msgs, reports, settings, 
verbose=False):
 bl_rna_base_props = set()
 if bl_rna_base:
 bl_rna_base_props |= set(bl_rna_base.properties.values())
-for cls_base in cls.__bases__:
-bl_rna_base = getattr(cls_base, "bl_rna", None)
-if not bl_rna_base:
-continue
-bl_rna_base_props |= set(bl_rna_base.properties.values())
+if hasattr(cls, "__bases__"):
+for cls_base in cls.__bases__:
+bl_rna_base = getattr(cls_base, "bl_rna", None)
+if not bl_rna_base:
+continue
+bl_rna_base_props |= set(bl_rna_base.properties.values())
 
 props = sorted(bl_rna.properties, key=lambda p: p.identifier)
 for prop in props:
@@ -450,6 +451,19 @@ def dump_rna_messages(msgs, reports, settings, 
verbose=False):
 process_msg(msgs, bpy.app.translations.contexts.operator_default, 
cat_str, "Generated operator category",
 reports, check_ctxt_rna, settings)
 
+# Parse keymap preset preferences
+for preset_filename in sorted(
+os.listdir(os.path.join(settings.PRESETS_DIR, "keyconfig"))):
+preset_path = os.path.join(settings.PRESETS_DIR, "keyconfig", 
preset_filename)
+if not (os.path.isfile(preset_path) and 
preset_filename.endswith(".py")):
+continue
+preset_name, _ = os.path.splitext(preset_filename)
+
+bpy.utils.keyconfig_set(preset_path)
+preset = bpy.data.window_managers[0].keyconfigs[preset_name]
+if preset.preferences is not None:
+walk_properties(preset.preferences)
+
 # And parse keymaps!
 from bl_keymap_utils import keymap_hierarchy
 walk_keymap_hierarchy(keymap_hierarchy.generate(), "KM_HIERARCHY")
diff --git a/release/scripts/modules/bl_i18n_utils/settings.py 
b/release/scripts/modules/bl_i18n_utils/settings.py
index 05db4df7cd2..89aaa43cd52 100644
--- a/release/scripts/modules/bl_i18n_utils/settings.py
+++ b/release/scripts/modules/bl_i18n_utils/settings.py
@@ -544,6 +544,7 @@ CUSTOM_PY_UI_FILES = [
 os.path.join("scripts", "startup", "bl_ui"),
 os.path.join("scripts", "startup", "bl_operators"),
 os.path.join("scripts", "modules", "rna_prop_ui.py"),
+os.path.join("scripts", "presets", "keyconfig"),
 ]
 
 # An optional text file listing files to force include/exclude from 
py_xgettext process.

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [dead26b5778] master: I18n: translate untitled file names

2022-09-05 Thread Damien Picard
Commit: dead26b5778b8bebd642884f11a254edd31c11bc
Author: Damien Picard
Date:   Mon Sep 5 15:25:34 2022 +0200
Branches: master
https://developer.blender.org/rBdead26b5778b8bebd642884f11a254edd31c11bc

I18n: translate untitled file names

When saving, the default file name is "untitled" regardless of
selected language. This can be translated, like many graphical
applications do.

This applies to:
- blend file
- alembic file
- collada file
- obj file
- usd file
- rendered image
- grease pencil export
- subtitles export
- other Python exports through ExportHelper

Reviewed By: mont29

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

===

M   release/scripts/modules/bpy_extras/io_utils.py
M   source/blender/blenkernel/intern/image_save.cc
M   source/blender/editors/io/io_alembic.c
M   source/blender/editors/io/io_collada.c
M   source/blender/editors/io/io_gpencil_export.c
M   source/blender/editors/io/io_obj.c
M   source/blender/editors/io/io_usd.c
M   source/blender/editors/space_sequencer/sequencer_edit.c
M   source/blender/windowmanager/intern/wm_files.c

===

diff --git a/release/scripts/modules/bpy_extras/io_utils.py 
b/release/scripts/modules/bpy_extras/io_utils.py
index 0497d69162e..cc6aa6b9afa 100644
--- a/release/scripts/modules/bpy_extras/io_utils.py
+++ b/release/scripts/modules/bpy_extras/io_utils.py
@@ -21,7 +21,7 @@ from bpy.props import (
 EnumProperty,
 StringProperty,
 )
-
+from bpy.app.translations import pgettext_data as data_
 
 def _check_axis_conversion(op):
 if hasattr(op, "axis_forward") and hasattr(op, "axis_up"):
@@ -56,7 +56,7 @@ class ExportHelper:
 if not self.filepath:
 blend_filepath = context.blend_data.filepath
 if not blend_filepath:
-blend_filepath = "untitled"
+blend_filepath = data_("untitled")
 else:
 blend_filepath = os.path.splitext(blend_filepath)[0]
 
diff --git a/source/blender/blenkernel/intern/image_save.cc 
b/source/blender/blenkernel/intern/image_save.cc
index 5ee1258c512..e65a94d5301 100644
--- a/source/blender/blenkernel/intern/image_save.cc
+++ b/source/blender/blenkernel/intern/image_save.cc
@@ -13,6 +13,8 @@
 #include "BLI_string.h"
 #include "BLI_vector.hh"
 
+#include "BLT_translation.h"
+
 #include "DNA_image_types.h"
 
 #include "MEM_guardedalloc.h"
@@ -173,7 +175,7 @@ bool BKE_image_save_options_init(ImageSaveOptions *opts,
   BLI_strncpy(opts->filepath, G.ima, sizeof(opts->filepath));
 }
 else {
-  BLI_strncpy(opts->filepath, "//untitled", sizeof(opts->filepath));
+  BLI_snprintf(opts->filepath, sizeof(opts->filepath), "//%s", 
DATA_("untitled"));
   BLI_path_abs(opts->filepath, BKE_main_blendfile_path(bmain));
 }
   }
diff --git a/source/blender/editors/io/io_alembic.c 
b/source/blender/editors/io/io_alembic.c
index a7e906b8109..dd35279e0d6 100644
--- a/source/blender/editors/io/io_alembic.c
+++ b/source/blender/editors/io/io_alembic.c
@@ -80,7 +80,7 @@ static int wm_alembic_export_invoke(bContext *C, wmOperator 
*op, const wmEvent *
 char filepath[FILE_MAX];
 
 if (BKE_main_blendfile_path(bmain)[0] == '\0') {
-  BLI_strncpy(filepath, "untitled", sizeof(filepath));
+  BLI_strncpy(filepath, DATA_("untitled"), sizeof(filepath));
 }
 else {
   BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath));
diff --git a/source/blender/editors/io/io_collada.c 
b/source/blender/editors/io/io_collada.c
index c491e7a5815..6a5547021e4 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -43,7 +43,7 @@ static int wm_collada_export_invoke(bContext *C, wmOperator 
*op, const wmEvent *
 const char *blendfile_path = BKE_main_blendfile_path(bmain);
 
 if (blendfile_path[0] == '\0') {
-  BLI_strncpy(filepath, "untitled", sizeof(filepath));
+  BLI_strncpy(filepath, DATA_("untitled"), sizeof(filepath));
 }
 else {
   BLI_strncpy(filepath, blendfile_path, sizeof(filepath));
diff --git a/source/blender/editors/io/io_gpencil_export.c 
b/source/blender/editors/io/io_gpencil_export.c
index 3f905dd7de0..7dfbf06f3c3 100644
--- a/source/blender/editors/io/io_gpencil_export.c
+++ b/source/blender/editors/io/io_gpencil_export.c
@@ -79,7 +79,7 @@ static void set_export_filepath(bContext *C, wmOperator *op, 
const char *extensi
 char filepath[FILE_MAX];
 
 if (BKE_main_blendfile_path(bmain)[0] == '\0') {
-  BLI_strncpy(filepath, "untitled", sizeof(filepath));
+  BLI_strncpy(filepath, DATA_("untitled"), sizeof(filepath));
 }
 else {
   BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath));
diff --git a/source/blender/editors/io/io_obj.c 
b/source/blender/editors/io/io_obj.c
index 

[Bf-blender-cvs] [f70cf451edf] master: Merge branch 'blender-v3.3-release'

2022-09-05 Thread Jacques Lucke
Commit: f70cf451edf23a608c09a8b4ed0cabdc3360e00c
Author: Jacques Lucke
Date:   Mon Sep 5 15:21:49 2022 +0200
Branches: master
https://developer.blender.org/rBf70cf451edf23a608c09a8b4ed0cabdc3360e00c

Merge branch 'blender-v3.3-release'

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [8000d526842] blender-v3.3-release: Fix T100796: wrong tangents on bezier splines with duplicate points and handles

2022-09-05 Thread Jacques Lucke
Commit: 8000d526842340387e137a84725a92f903555b24
Author: Jacques Lucke
Date:   Mon Sep 5 15:20:04 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB8000d526842340387e137a84725a92f903555b24

Fix T100796: wrong tangents on bezier splines with duplicate points and handles

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

===

M   source/blender/blenkernel/intern/curves_geometry.cc

===

diff --git a/source/blender/blenkernel/intern/curves_geometry.cc 
b/source/blender/blenkernel/intern/curves_geometry.cc
index af9533dc77f..940ec407d04 100644
--- a/source/blender/blenkernel/intern/curves_geometry.cc
+++ b/source/blender/blenkernel/intern/curves_geometry.cc
@@ -733,11 +733,14 @@ Span CurvesGeometry::evaluated_tangents() const
   const IndexRange points = this->points_for_curve(curve_index);
   const IndexRange evaluated_points = 
this->evaluated_points_for_curve(curve_index);
 
-  if (handles_right[points.first()] != positions[points.first()]) {
+  const float epsilon = 1e-6f;
+  if (!math::almost_equal_relative(
+  handles_right[points.first()], positions[points.first()], 
epsilon)) {
 tangents[evaluated_points.first()] = 
math::normalize(handles_right[points.first()] -
  
positions[points.first()]);
   }
-  if (handles_left[points.last()] != positions[points.last()]) {
+  if (!math::almost_equal_relative(
+  handles_left[points.last()], positions[points.last()], 
epsilon)) {
 tangents[evaluated_points.last()] = 
math::normalize(positions[points.last()] -
 
handles_left[points.last()]);
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [141d5cac3ac] master: GPencil: Move Outline operator in menu

2022-09-05 Thread Antonio Vazquez
Commit: 141d5cac3ac8c6e2adcf6d7b40390fb92c42f767
Author: Antonio Vazquez
Date:   Mon Sep 5 15:19:41 2022 +0200
Branches: master
https://developer.blender.org/rB141d5cac3ac8c6e2adcf6d7b40390fb92c42f767

GPencil: Move Outline operator in menu

Reviewed by: Matias Mendiola

===

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 bb900ff7333..23c3b0191d4 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -5153,6 +5153,7 @@ class VIEW3D_MT_edit_gpencil_stroke(Menu):
 layout.operator("gpencil.stroke_subdivide", 
text="Subdivide").only_selected = False
 layout.menu("VIEW3D_MT_gpencil_simplify")
 layout.operator("gpencil.stroke_trim", text="Trim")
+layout.operator("gpencil.stroke_outline", text="Outline")
 
 layout.separator()
 
@@ -5183,9 +5184,6 @@ class VIEW3D_MT_edit_gpencil_stroke(Menu):
 layout.separator()
 layout.operator("gpencil.reset_transform_fill", text="Reset Fill 
Transform")
 
-layout.separator()
-layout.operator("gpencil.stroke_outline", text="Outline")
-
 
 class VIEW3D_MT_edit_gpencil_point(Menu):
 bl_label = "Point"

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [a2a208d88d4] master: I18n: fix translation of status bar

2022-09-05 Thread Damien Picard
Commit: a2a208d88d426e9d94135cddbbc97d980ff88aa5
Author: Damien Picard
Date:   Mon Sep 5 15:13:57 2022 +0200
Branches: master
https://developer.blender.org/rBa2a208d88d426e9d94135cddbbc97d980ff88aa5

I18n: fix translation of status bar

- Use the proper context (Operator, since that is what the cursor
  keymap status uses)
- Add a few missing message extraction tags

Reviewed By: mont29

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

===

M   source/blender/editors/interface/interface_templates.c
M   source/blender/editors/util/select_utils.c

===

diff --git a/source/blender/editors/interface/interface_templates.c 
b/source/blender/editors/interface/interface_templates.c
index 651c28c1a59..0b72c358dc9 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -6358,8 +6358,10 @@ void uiTemplateInputStatus(uiLayout *layout, struct 
bContext *C)
 uiLayout *row = uiLayoutRow(col, true);
 uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT);
 
-const char *msg = TIP_(WM_window_cursor_keymap_status_get(win, i, 0));
-const char *msg_drag = TIP_(WM_window_cursor_keymap_status_get(win, i, 1));
+const char *msg = CTX_TIP_(BLT_I18NCONTEXT_OPERATOR_DEFAULT,
+   WM_window_cursor_keymap_status_get(win, i, 0));
+const char *msg_drag = CTX_TIP_(BLT_I18NCONTEXT_OPERATOR_DEFAULT,
+WM_window_cursor_keymap_status_get(win, i, 
1));
 
 if (msg || (msg_drag == NULL)) {
   uiItemL(row, msg ? msg : "", (ICON_MOUSE_LMB + i));
diff --git a/source/blender/editors/util/select_utils.c 
b/source/blender/editors/util/select_utils.c
index 660afa4c3d7..b29afdb5a9f 100644
--- a/source/blender/editors/util/select_utils.c
+++ b/source/blender/editors/util/select_utils.c
@@ -10,6 +10,8 @@
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 
+#include "BLT_translation.h"
+
 #include "DNA_windowmanager_types.h"
 
 #include "RNA_access.h"
@@ -161,18 +163,18 @@ const char *ED_select_pick_get_name(wmOperatorType 
*UNUSED(ot), PointerRNA *ptr)
   ED_select_pick_params_from_operator(ptr, );
   switch (params.sel_op) {
 case SEL_OP_ADD:
-  return "Select (Extend)";
+  return CTX_N_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Select (Extend)");
 case SEL_OP_SUB:
-  return "Select (Deselect)";
+  return CTX_N_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Select (Deselect)");
 case SEL_OP_XOR:
-  return "Select (Toggle)";
+  return CTX_N_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Select (Toggle)");
 case SEL_OP_AND:
   BLI_assert_unreachable();
   ATTR_FALLTHROUGH;
 case SEL_OP_SET:
   break;
   }
-  return "Select";
+  return CTX_N_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Select");
 }
 
 const char *ED_select_circle_get_name(wmOperatorType *UNUSED(ot), PointerRNA 
*ptr)
@@ -181,9 +183,9 @@ const char *ED_select_circle_get_name(wmOperatorType 
*UNUSED(ot), PointerRNA *pt
   const eSelectOp sel_op = RNA_enum_get(ptr, "mode");
   switch (sel_op) {
 case SEL_OP_ADD:
-  return "Circle Select (Extend)";
+  return CTX_N_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Circle Select 
(Extend)");
 case SEL_OP_SUB:
-  return "Circle Select (Deselect)";
+  return CTX_N_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Circle Select 
(Deselect)");
 case SEL_OP_XOR:
   ATTR_FALLTHROUGH;
 case SEL_OP_AND:
@@ -192,7 +194,7 @@ const char *ED_select_circle_get_name(wmOperatorType 
*UNUSED(ot), PointerRNA *pt
 case SEL_OP_SET:
   break;
   }
-  return "Circle Select";
+  return CTX_N_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Circle Select");
 }
 
 /** \} */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [fbf875a3da5] master: GPencil: Move Scale Thickness option in menu

2022-09-05 Thread Antonio Vazquez
Commit: fbf875a3da5af0f73e7fb20e6d2597c15e6baced
Author: Antonio Vazquez
Date:   Mon Sep 5 15:09:58 2022 +0200
Branches: master
https://developer.blender.org/rBfbf875a3da5af0f73e7fb20e6d2597c15e6baced

GPencil: Move Scale Thickness option in menu

The option is more logic in the Normalize group

Reviewed by: Matias Mendiola

===

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 b2fa8e4d64f..bb900ff7333 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -5174,11 +5174,11 @@ class VIEW3D_MT_edit_gpencil_stroke(Menu):
 layout.operator("gpencil.stroke_cyclical_set", text="Toggle 
Cyclic").type = 'TOGGLE'
 layout.operator_menu_enum("gpencil.stroke_caps_set", text="Toggle 
Caps", property="type")
 layout.operator("gpencil.stroke_flip", text="Switch Direction")
-layout.prop(settings, "use_scale_thickness", text="Scale Thickness")
 
 layout.separator()
 layout.operator("gpencil.stroke_normalize", text="Normalize 
Thickness").mode = 'THICKNESS'
 layout.operator("gpencil.stroke_normalize", text="Normalize 
Opacity").mode = 'OPACITY'
+layout.prop(settings, "use_scale_thickness", text="Scale Thickness")
 
 layout.separator()
 layout.operator("gpencil.reset_transform_fill", text="Reset Fill 
Transform")

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [404e75c1656] master: Merge branch 'blender-v3.3-release'

2022-09-05 Thread Brecht Van Lommel
Commit: 404e75c16564d473aa164812355bda1ceebbfb16
Author: Brecht Van Lommel
Date:   Mon Sep 5 15:07:47 2022 +0200
Branches: master
https://developer.blender.org/rB404e75c16564d473aa164812355bda1ceebbfb16

Merge branch 'blender-v3.3-release'

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [456177d8be9] refactor-mesh-remove-pointers: Merge branch 'master' into refactor-mesh-remove-pointers

2022-09-05 Thread Hans Goudey
Commit: 456177d8be9ea28d1c5565fbe538435095f5b503
Author: Hans Goudey
Date:   Mon Sep 5 07:46:58 2022 -0500
Branches: refactor-mesh-remove-pointers
https://developer.blender.org/rB456177d8be9ea28d1c5565fbe538435095f5b503

Merge branch 'master' into refactor-mesh-remove-pointers

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1b216fc2370] blender-v3.3-release: Fix T100814: Cycles wrong area light parametric texture coordinates

2022-09-05 Thread Brecht Van Lommel
Commit: 1b216fc237073ad9090e94b840867d35ec958eb8
Author: Brecht Van Lommel
Date:   Mon Sep 5 13:24:36 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB1b216fc237073ad9090e94b840867d35ec958eb8

Fix T100814: Cycles wrong area light parametric texture coordinates

The fix from cefd6140f322 was for light intersection, but light sampling also
needs it.

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

===

M   intern/cycles/kernel/light/light.h

===

diff --git a/intern/cycles/kernel/light/light.h 
b/intern/cycles/kernel/light/light.h
index b939489bb18..236819ac4b6 100644
--- a/intern/cycles/kernel/light/light.h
+++ b/intern/cycles/kernel/light/light.h
@@ -202,8 +202,12 @@ ccl_device_inline bool light_sample(KernelGlobals kg,
 inplane = ls->P - inplane;
   }
 
-  ls->u = dot(inplane, axisu) * (1.0f / dot(axisu, axisu)) + 0.5f;
-  ls->v = dot(inplane, axisv) * (1.0f / dot(axisv, axisv)) + 0.5f;
+  const float light_u = dot(inplane, axisu) * (1.0f / dot(axisu, axisu));
+  const float light_v = dot(inplane, axisv) * (1.0f / dot(axisv, axisv));
+
+  /* NOTE: Return barycentric coordinates in the same notation as Embree 
and OptiX. */
+  ls->u = light_v + 0.5f;
+  ls->v = -light_u - light_v;
 
   ls->Ng = Ng;
   ls->D = normalize_len(ls->P - P, >t);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [871347fd93f] blender-v3.3-release: Fix Cycles not rendering hair without radius attributes

2022-09-05 Thread Brecht Van Lommel
Commit: 871347fd93f3a7b967c5d8a07239261efd020700
Author: Brecht Van Lommel
Date:   Mon Sep 5 11:37:08 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB871347fd93f3a7b967c5d8a07239261efd020700

Fix Cycles not rendering hair without radius attributes

This was fixed in 8159e0a but accidentally reverted as part of 18b703d

===

M   intern/cycles/blender/curves.cpp

===

diff --git a/intern/cycles/blender/curves.cpp b/intern/cycles/blender/curves.cpp
index 59e630eef63..6158ed78598 100644
--- a/intern/cycles/blender/curves.cpp
+++ b/intern/cycles/blender/curves.cpp
@@ -843,7 +843,7 @@ static float4 hair_point_as_float4(BL::FloatVectorAttribute 
b_attr_position,
const int index)
 {
   float4 mP = 
float3_to_float4(get_float3(b_attr_position.data[index].vector()));
-  mP.w = b_attr_radius ? b_attr_radius->data[index].value() : 0.0f;
+  mP.w = b_attr_radius ? b_attr_radius->data[index].value() : 0.005f;
   return mP;
 }
 
@@ -910,7 +910,7 @@ static void export_hair_curves(Scene *scene,
 for (int j = 0; j < num_points; j++) {
   const int point_offset = first_point_index + j;
   const float3 co = 
get_float3(b_attr_position.data[point_offset].vector());
-  const float radius = b_attr_radius ? 
b_attr_radius->data[point_offset].value() : 0.0f;
+  const float radius = b_attr_radius ? 
b_attr_radius->data[point_offset].value() : 0.005f;
 
   curve_keys[point_offset] = co;
   curve_radius[point_offset] = radius;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [38508f51102] master: GPencil: New BKE function to set stroke start point

2022-09-05 Thread Antonio Vazquez
Commit: 38508f511023c60c6c16016f8825bb2ad9fad79f
Author: Antonio Vazquez
Date:   Mon Sep 5 11:02:39 2022 +0200
Branches: master
https://developer.blender.org/rB38508f511023c60c6c16016f8825bb2ad9fad79f

GPencil: New BKE function to set stroke start point

This function allows to set the start point for cyclic strokes.

The function is required by a new modifier and operator
that are currently under development.

===

M   source/blender/blenkernel/BKE_gpencil_geom.h
M   source/blender/blenkernel/intern/gpencil_geom.cc
M   source/blender/editors/gpencil/gpencil_edit.c
M   source/blender/editors/gpencil/gpencil_utils.c

===

diff --git a/source/blender/blenkernel/BKE_gpencil_geom.h 
b/source/blender/blenkernel/BKE_gpencil_geom.h
index 33735fddf55..88244ec9d64 100644
--- a/source/blender/blenkernel/BKE_gpencil_geom.h
+++ b/source/blender/blenkernel/BKE_gpencil_geom.h
@@ -406,7 +406,13 @@ void BKE_gpencil_stroke_join(struct bGPDstroke *gps_a,
  struct bGPDstroke *gps_b,
  bool leave_gaps,
  bool fit_thickness,
- bool smooth);
+ bool smooth,
+ bool auto_flip);
+/**
+ * Set stroke start point in the selected index. Only works for Cyclic strokes.
+ * \param start_idx: Index of the point to be the start point.
+ */
+void BKE_gpencil_stroke_start_set(struct bGPdata *gpd, struct bGPDstroke *gps, 
int start_idx);
 /**
  * Copy the stroke of the frame to all frames selected (except current).
  */
diff --git a/source/blender/blenkernel/intern/gpencil_geom.cc 
b/source/blender/blenkernel/intern/gpencil_geom.cc
index 2f104d2..2cc752dca47 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.cc
+++ b/source/blender/blenkernel/intern/gpencil_geom.cc
@@ -3415,7 +3415,8 @@ void BKE_gpencil_stroke_join(bGPDstroke *gps_a,
  bGPDstroke *gps_b,
  const bool leave_gaps,
  const bool fit_thickness,
- const bool smooth)
+ const bool smooth,
+ bool auto_flip)
 {
   bGPDspoint point;
   bGPDspoint *pt;
@@ -3432,52 +3433,54 @@ void BKE_gpencil_stroke_join(bGPDstroke *gps_a,
 return;
   }
 
-  /* define start and end points of each stroke */
-  float start_a[3], start_b[3], end_a[3], end_b[3];
-  pt = _a->points[0];
-  copy_v3_v3(start_a, >x);
+  if (auto_flip) {
+/* define start and end points of each stroke */
+float start_a[3], start_b[3], end_a[3], end_b[3];
+pt = _a->points[0];
+copy_v3_v3(start_a, >x);
 
-  pt = _a->points[gps_a->totpoints - 1];
-  copy_v3_v3(end_a, >x);
+pt = _a->points[gps_a->totpoints - 1];
+copy_v3_v3(end_a, >x);
 
-  pt = _b->points[0];
-  copy_v3_v3(start_b, >x);
+pt = _b->points[0];
+copy_v3_v3(start_b, >x);
 
-  pt = _b->points[gps_b->totpoints - 1];
-  copy_v3_v3(end_b, >x);
+pt = _b->points[gps_b->totpoints - 1];
+copy_v3_v3(end_b, >x);
 
-  /* Check if need flip strokes. */
-  float dist = len_squared_v3v3(end_a, start_b);
-  bool flip_a = false;
-  bool flip_b = false;
-  float lowest = dist;
+/* Check if need flip strokes. */
+float dist = len_squared_v3v3(end_a, start_b);
+bool flip_a = false;
+bool flip_b = false;
+float lowest = dist;
 
-  dist = len_squared_v3v3(end_a, end_b);
-  if (dist < lowest) {
-lowest = dist;
-flip_a = false;
-flip_b = true;
-  }
+dist = len_squared_v3v3(end_a, end_b);
+if (dist < lowest) {
+  lowest = dist;
+  flip_a = false;
+  flip_b = true;
+}
 
-  dist = len_squared_v3v3(start_a, start_b);
-  if (dist < lowest) {
-lowest = dist;
-flip_a = true;
-flip_b = false;
-  }
+dist = len_squared_v3v3(start_a, start_b);
+if (dist < lowest) {
+  lowest = dist;
+  flip_a = true;
+  flip_b = false;
+}
 
-  dist = len_squared_v3v3(start_a, end_b);
-  if (dist < lowest) {
-lowest = dist;
-flip_a = true;
-flip_b = true;
-  }
+dist = len_squared_v3v3(start_a, end_b);
+if (dist < lowest) {
+  lowest = dist;
+  flip_a = true;
+  flip_b = true;
+}
 
-  if (flip_a) {
-BKE_gpencil_stroke_flip(gps_a);
-  }
-  if (flip_b) {
-BKE_gpencil_stroke_flip(gps_b);
+if (flip_a) {
+  BKE_gpencil_stroke_flip(gps_a);
+}
+if (flip_b) {
+  BKE_gpencil_stroke_flip(gps_b);
+}
   }
 
   /* don't visibly link the first and last points? */
@@ -3540,6 +3543,29 @@ void BKE_gpencil_stroke_join(bGPDstroke *gps_a,
   }
 }
 
+void BKE_gpencil_stroke_start_set(bGPdata *gpd, bGPDstroke *gps, int start_idx)
+{
+  if ((start_idx < 1) || (start_idx >= gps->totpoints)) {
+return;
+  }
+
+  /* Only cyclic strokes. */
+  if ((gps->flag & 

[Bf-blender-cvs] [91b1ca5b7b5] master: Fix T100820: Crash renaming modifier with visibility driver

2022-09-05 Thread Sergey Sharybin
Commit: 91b1ca5b7b55cde3d344b03a1eba57df139e0f7c
Author: Sergey Sharybin
Date:   Mon Sep 5 10:26:51 2022 +0200
Branches: master
https://developer.blender.org/rB91b1ca5b7b55cde3d344b03a1eba57df139e0f7c

Fix T100820: Crash renaming modifier with visibility driver

===

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 0e420f7556f..c5da15003e1 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -725,6 +725,11 @@ static void rna_Modifier_name_set(PointerRNA *ptr, const 
char *value)
   BKE_animdata_fix_paths_rename_all(NULL, "modifiers", oldname, md->name);
 }
 
+static void rna_Modifier_name_update(Main *bmain, Scene *UNUSED(scene), 
PointerRNA *UNUSED(ptr))
+{
+  DEG_relations_tag_update(bmain);
+}
+
 static char *rna_Modifier_path(const PointerRNA *ptr)
 {
   const ModifierData *md = ptr->data;
@@ -7249,7 +7254,7 @@ void RNA_def_modifier(BlenderRNA *brna)
   prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
   RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Modifier_name_set");
   RNA_def_property_ui_text(prop, "Name", "Modifier name");
-  RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER | NA_RENAME, NULL);
+  RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER | NA_RENAME, 
"rna_Modifier_name_update");
   RNA_def_struct_name_property(srna, prop);
 
   /* enums */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs