[Bf-blender-cvs] [39f706a76c1] master: Cleanup: fix attr_nonnull error found by asan

2022-08-09 Thread Chris Blackbourn
Commit: 39f706a76c1db12e4d6e9f89bc9ed0a522ec2562
Author: Chris Blackbourn
Date:   Wed Aug 10 16:55:43 2022 +1200
Branches: master
https://developer.blender.org/rB39f706a76c1db12e4d6e9f89bc9ed0a522ec2562

Cleanup: fix attr_nonnull error found by asan

===

M   source/blender/geometry/intern/uv_parametrizer.cc

===

diff --git a/source/blender/geometry/intern/uv_parametrizer.cc 
b/source/blender/geometry/intern/uv_parametrizer.cc
index ae2794bf9bc..26de4679768 100644
--- a/source/blender/geometry/intern/uv_parametrizer.cc
+++ b/source/blender/geometry/intern/uv_parametrizer.cc
@@ -3733,8 +3733,10 @@ void GEO_uv_parametrizer_delete(ParamHandle *phandle)
   BLI_memarena_free(phandle->polyfill_arena);
   BLI_heap_free(phandle->polyfill_heap, NULL);
 
-  BLI_rng_free(phandle->rng);
-  phandle->rng = NULL;
+  if (phandle->rng) {
+BLI_rng_free(phandle->rng);
+phandle->rng = NULL;
+  }
 
   MEM_freeN(phandle);
 }

___
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] [96f1e44119c] refactor-mesh-hide-generic: Remove hide layers from files

2022-08-09 Thread Hans Goudey
Commit: 96f1e44119ceff2d4f8a00e998910eed479eab03
Author: Hans Goudey
Date:   Tue Aug 9 23:30:39 2022 -0500
Branches: refactor-mesh-hide-generic
https://developer.blender.org/rB96f1e44119ceff2d4f8a00e998910eed479eab03

Remove hide layers from files

===

M   source/blender/blenkernel/BKE_customdata.h
M   source/blender/blenkernel/intern/customdata.cc
M   source/blender/blenkernel/intern/mesh.cc

===

diff --git a/source/blender/blenkernel/BKE_customdata.h 
b/source/blender/blenkernel/BKE_customdata.h
index 38686a32505..8bad89a9211 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -11,7 +11,9 @@
 #include "BLI_sys_types.h"
 #include "BLI_utildefines.h"
 #ifdef __cplusplus
+#  include "BLI_set.hh"
 #  include "BLI_span.hh"
+#  include "BLI_string_ref.hh"
 #  include "BLI_vector.hh"
 #endif
 
@@ -715,7 +717,8 @@ void CustomData_data_transfer(const struct MeshPairRemap 
*me_remap,
  * the struct.
  */
 void CustomData_blend_write_prepare(CustomData ,
-blender::Vector 
_to_write);
+blender::Vector 
_to_write,
+const blender::Set 
_names = {});
 
 /**
  * \param layers_to_write: Layers created by #CustomData_blend_write_prepare.
diff --git a/source/blender/blenkernel/intern/customdata.cc 
b/source/blender/blenkernel/intern/customdata.cc
index 117d2958147..69825031795 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -26,6 +26,7 @@
 #include "BLI_math_vector.hh"
 #include "BLI_mempool.h"
 #include "BLI_path_util.h"
+#include "BLI_set.hh"
 #include "BLI_span.hh"
 #include "BLI_string.h"
 #include "BLI_string_ref.hh"
@@ -58,6 +59,7 @@
 #include "data_transfer_intern.h"
 
 using blender::IndexRange;
+using blender::Set;
 using blender::Span;
 using blender::StringRef;
 using blender::Vector;
@@ -4351,7 +4353,9 @@ void CustomData_file_write_info(int type, const char 
**r_struct_name, int *r_str
   *r_struct_num = typeInfo->structnum;
 }
 
-void CustomData_blend_write_prepare(CustomData , Vector _to_write)
+void CustomData_blend_write_prepare(CustomData ,
+Vector 
_to_write,
+const Set _names)
 {
   for (const CustomDataLayer  : Span(data.layers, data.totlayer)) {
 if (layer.flag & CD_FLAG_NOCOPY) {
@@ -4360,6 +4364,9 @@ void CustomData_blend_write_prepare(CustomData , 
Vectorpdata, 0, sizeof(mesh->pdata));
   }
   else {
-CustomData_blend_write_prepare(mesh->vdata, vert_layers);
-CustomData_blend_write_prepare(mesh->edata, edge_layers);
-CustomData_blend_write_prepare(mesh->ldata, loop_layers);
-CustomData_blend_write_prepare(mesh->pdata, poly_layers);
-  }
+if (!BLO_write_is_undo(writer)) {
+  BKE_mesh_legacy_convert_hide_layers_to_flags(mesh);
+}
 
-  if (!BLO_write_is_undo(writer)) {
-BKE_mesh_legacy_convert_hide_layers_to_flags(mesh);
+CustomData_blend_write_prepare(mesh->vdata, vert_layers, {".hide_vert"});
+CustomData_blend_write_prepare(mesh->edata, edge_layers, {".hide_edge"});
+CustomData_blend_write_prepare(mesh->ldata, loop_layers);
+CustomData_blend_write_prepare(mesh->pdata, poly_layers, {".hide_poly"});
   }
 
   BLO_write_id_struct(writer, Mesh, id_address, >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] [f874bf7fc1f] refactor-mesh-hide-generic: Parallelize layer copying, fix names and todo

2022-08-09 Thread Hans Goudey
Commit: f874bf7fc1ff2ca636f5c70abdd15900e8b38feb
Author: Hans Goudey
Date:   Tue Aug 9 23:07:44 2022 -0500
Branches: refactor-mesh-hide-generic
https://developer.blender.org/rBf874bf7fc1ff2ca636f5c70abdd15900e8b38feb

Parallelize layer copying, fix names and todo

===

M   source/blender/bmesh/intern/bmesh_mesh_convert.cc

===

diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.cc 
b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
index d7decc28fb6..8148a50f106 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_convert.cc
+++ b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
@@ -84,6 +84,7 @@
 #include "BLI_math_vector.h"
 #include "BLI_span.hh"
 #include "BLI_string_ref.hh"
+#include "BLI_task.hh"
 
 #include "BKE_attribute.hh"
 #include "BKE_customdata.h"
@@ -933,9 +934,11 @@ static void 
write_elem_flag_to_attribute(blender::bke::MutableAttributeAccessor
   if (do_write) {
 bke::SpanAttributeWriter attribute = 
attributes.lookup_or_add_for_write_only_span(
 attribute_name, domain);
-for (const int i : attribute.span.index_range()) {
-  attribute.span[i] = get_fn(i);
-}
+threading::parallel_for(attribute.span.index_range(), 4096, [&](IndexRange 
range) {
+  for (const int i : range) {
+attribute.span[i] = get_fn(i);
+  }
+});
 attribute.finish();
   }
   else {
@@ -953,8 +956,8 @@ static void 
convert_bmesh_hide_flags_to_mesh_attributes(BMesh ,
   using namespace blender;
   /* The "hide" attributes are stored as flags on #BMesh. */
   BLI_assert(CustomData_get_layer_named(, CD_PROP_BOOL, ".hide_vert") 
== nullptr);
-  BLI_assert(CustomData_get_layer_named(, CD_PROP_BOOL, ".edge_vert") 
== nullptr);
-  BLI_assert(CustomData_get_layer_named(, CD_PROP_BOOL, ".face_vert") 
== nullptr);
+  BLI_assert(CustomData_get_layer_named(, CD_PROP_BOOL, ".hide_edge") 
== nullptr);
+  BLI_assert(CustomData_get_layer_named(, CD_PROP_BOOL, ".hide_poly") 
== nullptr);
 
   if (!(need_hide_vert || need_hide_edge || need_hide_face)) {
 return;
@@ -1011,14 +1014,12 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, 
const struct BMeshToMesh
   me->act_face = -1;
 
   {
-/* TODO: Somehow deal with BMesh storage of hide layers (currently it's 
still stored as a
- * generic attribute there too). */
 CustomData_MeshMasks mask = CD_MASK_MESH;
 CustomData_MeshMasks_update(, >cd_mask_extra);
-CustomData_copy(>vdata, >vdata, mask.vmask, CD_CALLOC, 
me->totvert);
-CustomData_copy(>edata, >edata, mask.emask, CD_CALLOC, 
me->totedge);
-CustomData_copy(>ldata, >ldata, mask.lmask, CD_CALLOC, 
me->totloop);
-CustomData_copy(>pdata, >pdata, mask.pmask, CD_CALLOC, 
me->totpoly);
+CustomData_copy_mesh_to_bmesh(>vdata, >vdata, mask.vmask, 
CD_CALLOC, me->totvert);
+CustomData_copy_mesh_to_bmesh(>edata, >edata, mask.emask, 
CD_CALLOC, me->totedge);
+CustomData_copy_mesh_to_bmesh(>ldata, >ldata, mask.lmask, 
CD_CALLOC, me->totloop);
+CustomData_copy_mesh_to_bmesh(>pdata, >pdata, mask.pmask, 
CD_CALLOC, me->totpoly);
   }
 
   MVert *mvert = bm->totvert ? (MVert *)MEM_callocN(sizeof(MVert) * 
bm->totvert, "bm_to_me.vert") :

___
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] [cd90c54d910] refactor-mesh-hide-generic: Rename `.hide_face` to `.hide_poly`

2022-08-09 Thread Hans Goudey
Commit: cd90c54d910b940fb41dc7d846101e37cdf7f917
Author: Hans Goudey
Date:   Tue Aug 9 22:57:05 2022 -0500
Branches: refactor-mesh-hide-generic
https://developer.blender.org/rBcd90c54d910b940fb41dc7d846101e37cdf7f917

Rename `.hide_face` to `.hide_poly`

===

M   source/blender/blenkernel/intern/bvhutils.cc
M   source/blender/blenkernel/intern/customdata.cc
M   source/blender/blenkernel/intern/mesh_evaluate.cc
M   source/blender/blenkernel/intern/mesh_legacy_convert.cc
M   source/blender/blenkernel/intern/paint.c
M   source/blender/blenkernel/intern/subdiv_converter_mesh.c
M   source/blender/bmesh/intern/bmesh_mesh_convert.cc
M   source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc
M   source/blender/editors/mesh/editface.cc
M   source/blender/editors/space_view3d/view3d_select.c
M   source/blender/makesrna/intern/rna_mesh.c

===

diff --git a/source/blender/blenkernel/intern/bvhutils.cc 
b/source/blender/blenkernel/intern/bvhutils.cc
index 38b33bcc43a..ce3a483bfc2 100644
--- a/source/blender/blenkernel/intern/bvhutils.cc
+++ b/source/blender/blenkernel/intern/bvhutils.cc
@@ -1285,7 +1285,7 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh 
*data,
   blender::bke::AttributeAccessor attributes = 
blender::bke::mesh_attributes(*mesh);
   mask = looptri_no_hidden_map_get(
   mesh->mpoly,
-  attributes.lookup_or_default(".hide_face", ATTR_DOMAIN_FACE, false),
+  attributes.lookup_or_default(".hide_poly", ATTR_DOMAIN_FACE, false),
   looptri_len,
   _bits_act_len);
   ATTR_FALLTHROUGH;
diff --git a/source/blender/blenkernel/intern/customdata.cc 
b/source/blender/blenkernel/intern/customdata.cc
index 969b9903a39..117d2958147 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -2344,7 +2344,7 @@ bool CustomData_merge(const CustomData *source,
 
 static bool attribute_stored_in_bmesh_flag(const StringRef name)
 {
-  return ELEM(name, ".hide_vert", ".hide_edge", ".hide_face");
+  return ELEM(name, ".hide_vert", ".hide_edge", ".hide_poly");
 }
 
 static CustomData shallow_copy_remove_non_bmesh_attributes(const CustomData 
)
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.cc 
b/source/blender/blenkernel/intern/mesh_evaluate.cc
index 315c3ef51ab..135edba95db 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.cc
+++ b/source/blender/blenkernel/intern/mesh_evaluate.cc
@@ -744,7 +744,7 @@ void BKE_mesh_flush_hidden_from_verts(Mesh *me)
   ".hide_vert", ATTR_DOMAIN_POINT, false);
   if (hide_vert.is_single() && !hide_vert.get_internal_single()) {
 attributes.remove(".hide_edge");
-attributes.remove(".hide_face");
+attributes.remove(".hide_poly");
 return;
   }
   const VArraySpan hide_vert_span{hide_vert};
@@ -763,7 +763,7 @@ void BKE_mesh_flush_hidden_from_verts(Mesh *me)
 
   /* Hide faces when any of their vertices are hidden. */
   SpanAttributeWriter hide_face = 
attributes.lookup_or_add_for_write_only_span(
-  ".hide_face", ATTR_DOMAIN_FACE);
+  ".hide_poly", ATTR_DOMAIN_FACE);
   for (const int i : polys.index_range()) {
 const MPoly  = polys[i];
 const Span loops = loops.slice(poly.loopstart, poly.totloop);
@@ -780,7 +780,7 @@ void BKE_mesh_flush_hidden_from_polys(Mesh *me)
   MutableAttributeAccessor attributes = mesh_attributes_for_write(*me);
 
   const VArray hide_face = attributes.lookup_or_default(
-  ".hide_face", ATTR_DOMAIN_FACE, false);
+  ".hide_poly", ATTR_DOMAIN_FACE, false);
   if (hide_face.is_single() && !hide_face.get_internal_single()) {
 attributes.remove(".hide_vert");
 attributes.remove(".hide_edge");
@@ -908,7 +908,7 @@ void BKE_mesh_flush_select_from_verts(Mesh *me)
   {me->mvert, me->totvert},
   {me->mloop, me->totloop},
   attributes.lookup_or_default(".hide_edge", ATTR_DOMAIN_EDGE, 
false),
-  attributes.lookup_or_default(".hide_face", ATTR_DOMAIN_FACE, 
false),
+  attributes.lookup_or_default(".hide_poly", ATTR_DOMAIN_FACE, 
false),
   {me->medge, me->totedge},
   {me->mpoly, me->totpoly});
 }
diff --git a/source/blender/blenkernel/intern/mesh_legacy_convert.cc 
b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
index 601c2675b2b..04c1850f4ae 100644
--- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
@@ -907,7 +907,7 @@ void BKE_mesh_legacy_convert_hide_layers_to_flags(Mesh 
*mesh)
 
   MutableSpan polygons(mesh->mpoly, mesh->totpoly);
   const VArray hide_face = attributes.lookup_or_default(
-  ".hide_face", ATTR_DOMAIN_FACE, false);
+  ".hide_poly", ATTR_DOMAIN_FACE, false);
   threading::parallel_for(polygons.index_range(), 4096, [&](IndexRange range) {
 for (const int i : range) {
   

[Bf-blender-cvs] [81d6dcf0b37] refactor-mesh-hide-generic: Disallow procedural access

2022-08-09 Thread Hans Goudey
Commit: 81d6dcf0b370fb9d9832bc9afa010b1be89a7e85
Author: Hans Goudey
Date:   Tue Aug 9 22:57:40 2022 -0500
Branches: refactor-mesh-hide-generic
https://developer.blender.org/rB81d6dcf0b370fb9d9832bc9afa010b1be89a7e85

Disallow procedural access

===

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

===

diff --git a/source/blender/blenkernel/intern/attribute_access.cc 
b/source/blender/blenkernel/intern/attribute_access.cc
index 1af3cde1821..b9995796a21 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -56,7 +56,7 @@ const char *no_procedural_access_message =
 
 bool allow_procedural_attribute_access(StringRef attribute_name)
 {
-  return !attribute_name.startswith(".selection");
+  return !attribute_name.startswith(".selection") && 
!attribute_name.startswith(".hide");
 }
 
 static int attribute_data_type_complexity(const eCustomDataType data_type)

___
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] [3eef1def750] refactor-mesh-hide-generic: Merge branch 'master' into refactor-mesh-hide-generic

2022-08-09 Thread Hans Goudey
Commit: 3eef1def7509d2fb91deb4e804dfc8394d4e9951
Author: Hans Goudey
Date:   Tue Aug 9 22:52:29 2022 -0500
Branches: refactor-mesh-hide-generic
https://developer.blender.org/rB3eef1def7509d2fb91deb4e804dfc8394d4e9951

Merge branch 'master' into refactor-mesh-hide-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] [1150dcf93ee] master: make_update: quiet warning when SVN lib/ contains hidden files

2022-08-09 Thread Campbell Barton
Commit: 1150dcf93ee743fa1d7d1da72cc0f5f07cfd96bf
Author: Campbell Barton
Date:   Wed Aug 10 10:19:26 2022 +1000
Branches: master
https://developer.blender.org/rB1150dcf93ee743fa1d7d1da72cc0f5f07cfd96bf

make_update: quiet warning when SVN lib/ contains hidden files

make_update attempted to update hidden local files, skip them instead.

===

M   build_files/utils/make_update.py

===

diff --git a/build_files/utils/make_update.py b/build_files/utils/make_update.py
index bf140812ebb..254cccda301 100755
--- a/build_files/utils/make_update.py
+++ b/build_files/utils/make_update.py
@@ -110,6 +110,9 @@ def svn_update(args, release_version):
 if not make_utils.command_missing(args.svn_command):
 call(svn_non_interactive + ["cleanup", lib_dirpath])
 continue
+elif dirname.startswith("."):
+# Temporary paths such as ".mypy_cache" will report a warning, 
skip hidden directories.
+continue
 
 svn_dirpath = os.path.join(dirpath, ".svn")
 svn_root_dirpath = os.path.join(lib_dirpath, ".svn")

___
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] [9ef0f25a80e] master: Merge branch 'blender-v3.3-release'

2022-08-09 Thread Aaron Carlisle
Commit: 9ef0f25a80e6de25e64ab00b4c50733b2ebddeb1
Author: Aaron Carlisle
Date:   Tue Aug 9 21:27:14 2022 -0400
Branches: master
https://developer.blender.org/rB9ef0f25a80e6de25e64ab00b4c50733b2ebddeb1

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] [07ac26f0a57] blender-v3.3-release: Update RNA to User manual mappings

2022-08-09 Thread Aaron Carlisle
Commit: 07ac26f0a57668e72bb615eeefa3ff990152c246
Author: Aaron Carlisle
Date:   Tue Aug 9 21:26:48 2022 -0400
Branches: blender-v3.3-release
https://developer.blender.org/rB07ac26f0a57668e72bb615eeefa3ff990152c246

Update RNA to User manual mappings

===

M   release/scripts/modules/rna_manual_reference.py

===

diff --git a/release/scripts/modules/rna_manual_reference.py 
b/release/scripts/modules/rna_manual_reference.py
index 0d75b190d3f..b40a575d1c1 100644
--- a/release/scripts/modules/rna_manual_reference.py
+++ b/release/scripts/modules/rna_manual_reference.py
@@ -357,6 +357,7 @@ url_manual_mapping = (
 ("bpy.types.freestylelineset.select_by_edge_types*", 
"render/freestyle/view_layer/line_set.html#bpy-types-freestylelineset-select-by-edge-types"),
 ("bpy.types.freestylelineset.select_by_face_marks*", 
"render/freestyle/view_layer/line_set.html#bpy-types-freestylelineset-select-by-face-marks"),
 ("bpy.types.geometrynodeinputcurvehandlepositions*", 
"modeling/geometry_nodes/curve/curve_handle_position.html#bpy-types-geometrynodeinputcurvehandlepositions"),
+("bpy.types.geometrynodeinputedgepathstoselection*", 
"modeling/geometry_nodes/mesh/edge_paths_to_selection.html#bpy-types-geometrynodeinputedgepathstoselection"),
 ("bpy.types.linestyle*modifier_distancefromcamera*", 
"render/freestyle/view_layer/line_style/modifiers/color/distance_from_camera.html#bpy-types-linestyle-modifier-distancefromcamera"),
 ("bpy.types.linestyle*modifier_distancefromobject*", 
"render/freestyle/view_layer/line_style/modifiers/color/distance_from_object.html#bpy-types-linestyle-modifier-distancefromobject"),
 ("bpy.types.linestylegeometrymodifier_2dtransform*", 
"render/freestyle/view_layer/line_style/modifiers/geometry/2d_transform.html#bpy-types-linestylegeometrymodifier-2dtransform"),
@@ -514,8 +515,10 @@ url_manual_mapping = (
 ("bpy.types.freestylelinestyle.use_same_object*", 
"render/freestyle/view_layer/line_style/strokes.html#bpy-types-freestylelinestyle-use-same-object"),
 ("bpy.types.functionnodeinputspecialcharacters*", 
"modeling/geometry_nodes/text/special_characters.html#bpy-types-functionnodeinputspecialcharacters"),
 ("bpy.types.geometrynodecurveendpointselection*", 
"modeling/geometry_nodes/curve/endpoint_selection.html#bpy-types-geometrynodecurveendpointselection"),
+("bpy.types.geometrynodeinputedgepathstocurves*", 
"modeling/geometry_nodes/mesh/edge_paths_to_curves.html#bpy-types-geometrynodeinputedgepathstocurves"),
 ("bpy.types.geometrynodeinputmeshedgeneighbors*", 
"modeling/geometry_nodes/mesh/edge_neighbors.html#bpy-types-geometrynodeinputmeshedgeneighbors"),
 ("bpy.types.geometrynodeinputmeshfaceneighbors*", 
"modeling/geometry_nodes/mesh/face_neighbors.html#bpy-types-geometrynodeinputmeshfaceneighbors"),
+("bpy.types.geometrynodeinputshortestedgepaths*", 
"modeling/geometry_nodes/mesh/shortest_edge_paths.html#bpy-types-geometrynodeinputshortestedgepaths"),
 ("bpy.types.gpencilsculptguide.reference_point*", 
"grease_pencil/modes/draw/guides.html#bpy-types-gpencilsculptguide-reference-point"),
 ("bpy.types.greasepencil.edit_curve_resolution*", 
"grease_pencil/modes/edit/curve_editing.html#bpy-types-greasepencil-edit-curve-resolution"),
 ("bpy.types.linestylegeometrymodifier_2doffset*", 
"render/freestyle/view_layer/line_style/modifiers/geometry/2d_offset.html#bpy-types-linestylegeometrymodifier-2doffset"),
@@ -559,6 +562,8 @@ url_manual_mapping = (
 ("bpy.types.freestylelineset.select_edge_mark*", 
"render/freestyle/view_layer/line_set.html#bpy-types-freestylelineset-select-edge-mark"),
 ("bpy.types.freestylelinestyle.use_length_max*", 
"render/freestyle/view_layer/line_style/strokes.html#bpy-types-freestylelinestyle-use-length-max"),
 ("bpy.types.freestylelinestyle.use_length_min*", 
"render/freestyle/view_layer/line_style/strokes.html#bpy-types-freestylelinestyle-use-length-min"),
+("bpy.types.geometrynodedeformcurvesonsurface*", 
"modeling/geometry_nodes/curve/deform_curves_on_surface.html#bpy-types-geometrynodedeformcurvesonsurface"),
+("bpy.types.geometrynodeinputinstancerotation*", 
"modeling/geometry_nodes/instances/instance_rotation.html#bpy-types-geometrynodeinputinstancerotation"),
 ("bpy.types.geometrynodeinputmeshedgevertices*", 
"modeling/geometry_nodes/mesh/edge_vertices.html#bpy-types-geometrynodeinputmeshedgevertices"),
 ("bpy.types.geometrynodeinputmeshfaceisplanar*", 
"modeling/geometry_nodes/mesh/face_is_planar.html#bpy-types-geometrynodeinputmeshfaceisplanar"),
 ("bpy.types.geometrynodeinputsplineresolution*", 
"modeling/geometry_nodes/curve/spline_resolution.html#bpy-types-geometrynodeinputsplineresolution"),
@@ -774,6 +779,7 @@ url_manual_mapping = (
 ("bpy.types.geometrynodeattributestatistic*", 

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

2022-08-09 Thread Hans Goudey
Commit: 68e2084b0751c7681409844f1c359441c313331e
Author: Hans Goudey
Date:   Tue Aug 9 19:10:13 2022 -0500
Branches: master
https://developer.blender.org/rB68e2084b0751c7681409844f1c359441c313331e

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] [bdb85bdd981] blender-v3.3-release: Fix T100308: Removing scene time node does not update relations

2022-08-09 Thread Hans Goudey
Commit: bdb85bdd9813d0162de775b9f265795da0a3fc67
Author: Hans Goudey
Date:   Tue Aug 9 19:09:43 2022 -0500
Branches: blender-v3.3-release
https://developer.blender.org/rBbdb85bdd9813d0162de775b9f265795da0a3fc67

Fix T100308: Removing scene time node does not update relations

Similar to the fix in 734c6a4405f21078270e71.

===

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

===

diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index ba473b29474..86c05d6d085 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -3047,7 +3047,9 @@ void nodeRemoveNode(Main *bmain, bNodeTree *ntree, bNode 
*node, bool do_id_user)
 }
   }
 
-  if (node_has_id) {
+  /* Also update relations for the scene time node, which causes a dependency
+   * on time that users expect to be removed when the node is removed. */
+  if (node_has_id || node->type == GEO_NODE_INPUT_SCENE_TIME) {
 if (bmain != nullptr) {
   DEG_relations_tag_update(bmain);
 }

___
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] [31e06a8c73b] blender-v3.3-release: Fix T99661: Use after free converting edit mode curve object to mesh

2022-08-09 Thread Hans Goudey
Commit: 31e06a8c73b3c43d339e60ccbbc7f7d14c8d5221
Author: Hans Goudey
Date:   Tue Aug 9 17:49:41 2022 -0500
Branches: blender-v3.3-release
https://developer.blender.org/rB31e06a8c73b3c43d339e60ccbbc7f7d14c8d5221

Fix T99661: Use after free converting edit mode curve object to mesh

The fix from c0fdf16561034f85aadae8a was missing in one place. We don't
want to free the edit mode pointers, those are just copied because the
edit mode changes aren't present in the actual original data-block.

===

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

===

diff --git a/source/blender/blenkernel/intern/mesh_convert.cc 
b/source/blender/blenkernel/intern/mesh_convert.cc
index 923d2703960..81bab9f796f 100644
--- a/source/blender/blenkernel/intern/mesh_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_convert.cc
@@ -985,6 +985,12 @@ static Mesh *mesh_new_from_curve_type_object(const Object 
*object)
 
   /* If evaluating the curve replaced object data with different data, free 
the original data. */
   if (temp_data != temp_object->data) {
+if (GS(temp_data->name) == ID_CU_LEGACY) {
+  /* Clear edit mode pointers that were explicitly copied to the temporary 
curve. */
+  Curve *curve = reinterpret_cast(temp_data);
+  curve->editfont = nullptr;
+  curve->editnurb = nullptr;
+}
 BKE_id_free(nullptr, temp_data);
   }

___
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] [1ef3c59beb8] temp-sculpt-brush-channel: tmep-sculpt-brush-channel: Fix unified size

2022-08-09 Thread Joseph Eagar
Commit: 1ef3c59beb86cc1f1957d97be416f3740314d752
Author: Joseph Eagar
Date:   Tue Aug 9 16:18:59 2022 -0700
Branches: temp-sculpt-brush-channel
https://developer.blender.org/rB1ef3c59beb86cc1f1957d97be416f3740314d752

tmep-sculpt-brush-channel: Fix unified size

===

M   source/blender/blenkernel/BKE_brush_channel.h
M   source/blender/blenkernel/intern/brush.cc
M   source/blender/blenkernel/intern/brush_channel.cc
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/makesrna/intern/rna_brush.c
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/source/blender/blenkernel/BKE_brush_channel.h 
b/source/blender/blenkernel/BKE_brush_channel.h
index d102fa3bcfc..5eaede4c6e3 100644
--- a/source/blender/blenkernel/BKE_brush_channel.h
+++ b/source/blender/blenkernel/BKE_brush_channel.h
@@ -154,19 +154,24 @@ bool _BKE_brush_channelset_has(BrushChannelSet *chset, 
const char *idname);
reevaluate values from RNA */
 void BKE_brush_channelset_begin(BrushChannelSet *chset, BrushChannelType 
*type);
 
-float _BKE_brush_channelset_eval_float(struct Brush *br,
-   struct Scene *scene,
-   BrushChannelSet *chset,
+float _BKE_brush_channelset_eval_float(const struct Brush *br,
+   const struct Scene *scene,
const char *idname,
BrushMappingData *mapping);
-#define BKE_brush_channelset_eval_float(br, scene, chset, channel, mapdata) \
-  _BKE_brush_channelset_eval_float(br, scene, chset, 
make_builtin_ch_name(channel), mapdata)
-
+int _BKE_brush_channelset_eval_int(const struct Brush *br,
+   const struct Scene *scene,
+   const char *idname,
+   BrushMappingData *mapping);
 float _BKE_brush_channelset_float_get(BrushChannelSet *chset, const char 
*idname);
 void _BKE_brush_channelset_float_set(BrushChannelSet *chset, const char 
*idname, float f);
 int _BKE_brush_channelset_int_get(BrushChannelSet *chset, const char *idname);
 void _BKE_brush_channelset_int_set(BrushChannelSet *chset, const char *idname, 
int i);
 
+#define BKE_brush_channelset_eval_float(br, scene, channel, mapdata) \
+  _BKE_brush_channelset_eval_float(br, scene, make_builtin_ch_name(channel), 
mapdata)
+#define BKE_brush_channelset_eval_int(br, scene, channel, mapdata) \
+  _BKE_brush_channelset_eval_int(br, scene, make_builtin_ch_name(channel), 
mapdata)
+
 #define BKE_brush_channelset_float_get(chset, idname) \
   _BKE_brush_channelset_float_get(chset, make_builtin_ch_name(idname))
 #define BKE_brush_channelset_float_set(chset, idname, f) \
@@ -180,8 +185,8 @@ BrushChannelSet *BKE_brush_channelset_copy(BrushChannelSet 
*chset);
 
 /* Create a (copied) final brush channel set with all inheritance and unified 
flags
and input mappings taken into account. */
-BrushChannelSet *BKE_brush_channelset_create_final(struct Brush *brush,
-   struct Scene *scene,
+BrushChannelSet *BKE_brush_channelset_create_final(const struct Brush *brush,
+   const struct Scene *scene,
BrushMappingData *mapdata);
 
 BLI_INLINE const char *BKE_brush_mapping_type_to_typename(eBrushMappingType 
type)
@@ -208,17 +213,21 @@ BLI_INLINE const char 
*BKE_brush_mapping_type_to_typename(eBrushMappingType type
 
 const char *BKE_brush_channel_category_get(BrushChannel *ch);
 const void BKE_brush_channel_category_set(BrushChannel *ch, const char 
*category);
-bool BKE_brush_channel_inherits(struct Brush *brush,
-struct ToolSettings *tool_settings,
+bool BKE_brush_channel_inherits(const struct Brush *brush,
+const struct ToolSettings *tool_settings,
 BrushChannel *ch);
-BrushChannelSet *BKE_brush_channelset_get_final(struct Brush *brush,
-struct ToolSettings 
*tool_settings);
+BrushChannelSet *BKE_brush_channelset_get_final(const struct Brush *brush,
+const struct ToolSettings 
*tool_settings);
 
 void BKE_brush_channelset_toolsettings_init(struct ToolSettings *ts);
 
 /* Get rna path for brush channel. Calling code should call MEM_SAFE_FREE on 
result. */
 char *BKE_brush_channel_rna_path(ID *owner, BrushChannel *ch);
 
+void _BKE_brush_channelset_mark_update(BrushChannelSet *chset, const char 
*idname);
+#define BKE_brush_channelset_mark_update(chset, idname) \
+  _BKE_brush_channelset_mark_update(chset, make_builtin_ch_name(idname))
+
 /* Disable optimization for a function (for debugging use 

[Bf-blender-cvs] [90b7c3d05e5] master: Fix T99661: Use after free converting edit mode curve object to mesh

2022-08-09 Thread Hans Goudey
Commit: 90b7c3d05e58543650c4831bbc1f3765b526673b
Author: Hans Goudey
Date:   Tue Aug 9 17:49:41 2022 -0500
Branches: master
https://developer.blender.org/rB90b7c3d05e58543650c4831bbc1f3765b526673b

Fix T99661: Use after free converting edit mode curve object to mesh

The fix from c0fdf16561034f85aadae8a was missing in one place. We don't
want to free the edit mode pointers, those are just copied because the
edit mode changes aren't present in the actual original data-block.

===

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

===

diff --git a/source/blender/blenkernel/intern/mesh_convert.cc 
b/source/blender/blenkernel/intern/mesh_convert.cc
index 923d2703960..81bab9f796f 100644
--- a/source/blender/blenkernel/intern/mesh_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_convert.cc
@@ -985,6 +985,12 @@ static Mesh *mesh_new_from_curve_type_object(const Object 
*object)
 
   /* If evaluating the curve replaced object data with different data, free 
the original data. */
   if (temp_data != temp_object->data) {
+if (GS(temp_data->name) == ID_CU_LEGACY) {
+  /* Clear edit mode pointers that were explicitly copied to the temporary 
curve. */
+  Curve *curve = reinterpret_cast(temp_data);
+  curve->editfont = nullptr;
+  curve->editnurb = nullptr;
+}
 BKE_id_free(nullptr, temp_data);
   }

___
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] [f913f0cb42f] temp-sculpt-brush-channel: temp-sculpt-brush-channel: Improve implementation

2022-08-09 Thread Joseph Eagar
Commit: f913f0cb42f385a659e154451950de59846c
Author: Joseph Eagar
Date:   Tue Aug 9 15:44:53 2022 -0700
Branches: temp-sculpt-brush-channel
https://developer.blender.org/rBf913f0cb42f385a659e154451950de59846c

temp-sculpt-brush-channel: Improve implementation

* StrokeCache now has a BrushChannelSet with final
  channel values after taking input mappings and
  unified/inheritance flags into account.

===

M   release/scripts/startup/bl_ui/properties_paint_common.py
M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/blenkernel/BKE_brush_channel.h
M   source/blender/blenkernel/intern/brush_channel.cc
M   source/blender/draw/intern/draw_debug.cc
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h
M   source/blender/makesrna/intern/rna_brush_channels.c
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py 
b/release/scripts/startup/bl_ui/properties_paint_common.py
index 8d188444f8d..3512b053fd9 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -132,8 +132,13 @@ class UnifiedPaintPanel:
 if context.mode != "SCULPT":
 return UnifiedPaintPanel.prop_unified(layout, context, brush, 
prop_name, icon=icon, text=text, slider=slider, header=header, expand=expand)
 
+sculpt = context.tool_settings.sculpt
 ch = brush.channels[prop_name]
 
+inherit = ch.inherit
+if context.tool_settings.unified_channels[ch.idname].unified:
+inherit = True
+
 # dynamically switch to unprojected radius if necassary
 if prop_name == "size":
 size_mode = brush.use_locked_size == "SCENE"
@@ -150,8 +155,10 @@ class UnifiedPaintPanel:
 layout = layout.column(align=True)
 
 row = layout.row(align=True)
-row.use_property_split = True
-row.use_property_decorate = False
+
+if not header:
+row.use_property_split = True
+row.use_property_decorate = False
 
 if pressure is None:
 pressure = ch.type not in ["VEC3", "VEC4", "BITMASK", "ENUM", 
"BOOL"]
@@ -161,31 +168,27 @@ class UnifiedPaintPanel:
 
 path = ""
 proppath = ""
+final_prop_name = prop_name
 
 pressurech = ch
 
-if not brush_only and (ch.inherit or toolsettings_only):
-sd = context.tool_settings.sculpt
-# ensure channel exists in tool settings channel set
-sd.channels.ensure(ch)
-
-finalch = sd.channels[prop_name]
+if not brush_only and (inherit or toolsettings_only):
+finalch = context.tool_settings.unified_channels[prop_name]
 
 path = "tool_settings.unified_channels[\"%s\"]" % ch.idname
 proppath = "tool_settings.unified_properties"
+final_prop_name = '["%s"]' % (prop_name)
 else:
 path = "tool_settings.sculpt.brush.channels[\"%s\"]" % ch.idname
 proppath = "tool_settings.sculpt.brush"
 
 finalowner = context.path_resolve(proppath)
 
-if not (ch.inherit and ch.mappings["PRESSURE"].inherit_mode == 
"NEVER"):
+if not (inherit and ch.mappings["PRESSURE"].inherit_mode == "NEVER"):
 pressurech = finalch
 
 if pressurech == ch and ch.mappings["PRESSURE"].inherit_mode == 
"ALWAYS":
-sd = context.tool_settings.sculpt
-sd.channels.ensure(ch)
-pressurech = sd.channels[ch.idname]
+pressurech = context.tool_settings.unified_channels[ch.idname]
 
 if show_reorder:
 props = row.operator("brush.change_channel_order", text="", 
icon="TRIA_UP")
@@ -217,7 +220,7 @@ class UnifiedPaintPanel:
 elif ch.type == "BITMASK":
 if header or not expand:
 row.label(text=text)
-row.prop_menu_enum(finalowner, prop_name, text=text)
+row.prop_menu_enum(finalowner, final_prop_name, text=text)
 else:
 # why is it so hard to make bitflag checkboxes? - joeedh
 
@@ -232,7 +235,7 @@ class UnifiedPaintPanel:
 itemicon = "CHECKBOX_HLT"
 else:
 itemicon = "CHECKBOX_DEHLT"
-col.prop_enum(finalowner, prop_name, item.identifier, 
icon=itemicon)
+col.prop_enum(finalowner, final_prop_name, 
item.identifier, icon=itemicon)
 
 elif header and ch.idname == "direction":
 row2 = row.row(align=True)
@@ -241,12 +244,12 @@ class UnifiedPaintPanel:
 
 # replicate pre-existing functionality of direction showing up as
 # +/- 

[Bf-blender-cvs] [aa2a2e18c46] temp-sculpt-brush-channel: Merge branch 'master' into temp-sculpt-brush-channel

2022-08-09 Thread Joseph Eagar
Commit: aa2a2e18c46628991f475d5b632dae9c639a3992
Author: Joseph Eagar
Date:   Tue Aug 9 13:08:40 2022 -0700
Branches: temp-sculpt-brush-channel
https://developer.blender.org/rBaa2a2e18c46628991f475d5b632dae9c639a3992

Merge branch 'master' into temp-sculpt-brush-channel

===



===



___
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] [11bdc321a27] master: Sculpt: Register sculpt brush op so it clears last operator panel

2022-08-09 Thread Joseph Eagar
Commit: 11bdc321a274712e5c5ae83ff2c199690f66ecf7
Author: Joseph Eagar
Date:   Tue Aug 9 12:33:24 2022 -0700
Branches: master
https://developer.blender.org/rB11bdc321a274712e5c5ae83ff2c199690f66ecf7

Sculpt: Register sculpt brush op so it clears last operator panel

Needed to prevent changing values in the last operator panel
from destructively undoing brush steps.

===

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

===

diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index 8df5b093560..02d21941a25 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -5656,7 +5656,7 @@ void SCULPT_OT_brush_stroke(wmOperatorType *ot)
   ot->cancel = sculpt_brush_stroke_cancel;
 
   /* Flags (sculpt does own undo? (ton)). */
-  ot->flag = OPTYPE_BLOCKING;
+  ot->flag = OPTYPE_BLOCKING | OPTYPE_REGISTER | OPTYPE_UNDO;
 
   /* Properties. */

___
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] [1d68318e975] master: Cleanup: Add function for creating object dupli with separate data

2022-08-09 Thread Hans Goudey
Commit: 1d68318e975abc2a6b3fc05f011db181a11e0ca5
Author: Hans Goudey
Date:   Tue Aug 9 14:44:47 2022 -0500
Branches: master
https://developer.blender.org/rB1d68318e975abc2a6b3fc05f011db181a11e0ca5

Cleanup: Add function for creating object dupli with separate data

===

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

===

diff --git a/source/blender/blenkernel/intern/object_dupli.cc 
b/source/blender/blenkernel/intern/object_dupli.cc
index 407a2c8955c..cc3a8b5bb0e 100644
--- a/source/blender/blenkernel/intern/object_dupli.cc
+++ b/source/blender/blenkernel/intern/object_dupli.cc
@@ -29,6 +29,7 @@
 #include "DNA_pointcloud_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_vfont_types.h"
+#include "DNA_volume_types.h"
 
 #include "BKE_collection.h"
 #include "BKE_duplilist.h"
@@ -164,10 +165,8 @@ static bool copy_dupli_context(
  *
  * \param mat: is transform of the object relative to current context 
(including #Object.obmat).
  */
-static DupliObject *make_dupli(const DupliContext *ctx,
-   Object *ob,
-   const float mat[4][4],
-   int index)
+static DupliObject *make_dupli(
+const DupliContext *ctx, Object *ob, const ID *object_data, const float 
mat[4][4], int index)
 {
   DupliObject *dob;
   int i;
@@ -182,7 +181,7 @@ static DupliObject *make_dupli(const DupliContext *ctx,
   }
 
   dob->ob = ob;
-  dob->ob_data = (ID *)ob->data;
+  dob->ob_data = const_cast(object_data);
   mul_m4_m4m4(dob->mat, (float(*)[4])ctx->space_mat, mat);
   dob->type = ctx->gen->type;
 
@@ -226,6 +225,14 @@ static DupliObject *make_dupli(const DupliContext *ctx,
   return dob;
 }
 
+static DupliObject *make_dupli(const DupliContext *ctx,
+   Object *ob,
+   const float mat[4][4],
+   int index)
+{
+  return make_dupli(ctx, ob, static_cast(ob->data), mat, index);
+}
+
 /**
  * Recursive dupli-objects.
  *
@@ -777,28 +784,24 @@ static void make_duplis_geometry_set_impl(const 
DupliContext *ctx,
   int component_index = 0;
   if (ctx->object->type != OB_MESH || geometry_set_is_instance) {
 if (const Mesh *mesh = geometry_set.get_mesh_for_read()) {
-  DupliObject *dupli = make_dupli(ctx, ctx->object, parent_transform, 
component_index++);
-  dupli->ob_data = (ID *)mesh;
+  make_dupli(ctx, ctx->object, >id, parent_transform, 
component_index++);
 }
   }
   if (ctx->object->type != OB_VOLUME || geometry_set_is_instance) {
 if (const Volume *volume = geometry_set.get_volume_for_read()) {
-  DupliObject *dupli = make_dupli(ctx, ctx->object, parent_transform, 
component_index++);
-  dupli->ob_data = (ID *)volume;
+  make_dupli(ctx, ctx->object, >id, parent_transform, 
component_index++);
 }
   }
   if (!ELEM(ctx->object->type, OB_CURVES_LEGACY, OB_FONT, OB_CURVES) || 
geometry_set_is_instance) {
 if (const CurveComponent *component = 
geometry_set.get_component_for_read()) {
   if (const Curve *curve = component->get_curve_for_render()) {
-DupliObject *dupli = make_dupli(ctx, ctx->object, parent_transform, 
component_index++);
-dupli->ob_data = (ID *)curve;
+make_dupli(ctx, ctx->object, >id, parent_transform, 
component_index++);
   }
 }
   }
   if (ctx->object->type != OB_POINTCLOUD || geometry_set_is_instance) {
 if (const PointCloud *pointcloud = geometry_set.get_pointcloud_for_read()) 
{
-  DupliObject *dupli = make_dupli(ctx, ctx->object, parent_transform, 
component_index++);
-  dupli->ob_data = (ID *)pointcloud;
+  make_dupli(ctx, ctx->object, >id, parent_transform, 
component_index++);
 }
   }
   const bool creates_duplis_for_components = component_index >= 1;

___
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] [0caf6c598ca] temp-sculpt-cavity-mask: temp-sculpt-cavity-mask: Bake Cavity panel changes

2022-08-09 Thread Joseph Eagar
Commit: 0caf6c598ca01d1ce689c7f27cd4320e6b63f8ac
Author: Joseph Eagar
Date:   Tue Aug 9 12:28:22 2022 -0700
Branches: temp-sculpt-cavity-mask
https://developer.blender.org/rB0caf6c598ca01d1ce689c7f27cd4320e6b63f8ac

temp-sculpt-cavity-mask: Bake Cavity panel changes

* Bake cavity panel now emulates its operator UI.
 - So if use_automasking is on the operator last
   properties are shown, otherwise automasking
   properties are.
* Renamed panel to "Mask from cavity"

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index caa91fe5315..154ad6f47dc 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1012,7 +1012,7 @@ class VIEW3D_PT_sculpt_options_gravity(Panel, 
View3DPaintPanel):
 
 class VIEW3D_PT_sculpt_cavity_bake(Panel, View3DPaintPanel):
 bl_context = ".sculpt_mode"  # dot on purpose (access from topbar)
-bl_label = "Bake Cavity Mask"
+bl_label = "Mask From Cavity"
 bl_options = {'DEFAULT_CLOSED'}
 bl_ui_units_x = 12
 bl_parent_id = "VIEW3D_PT_sculpt_options"
@@ -1029,10 +1029,33 @@ class VIEW3D_PT_sculpt_cavity_bake(Panel, 
View3DPaintPanel):
 tool_settings = context.tool_settings
 sculpt = tool_settings.sculpt
 
-
layout.prop(WindowManager.operator_properties_last("sculpt.mask_from_cavity"), 
"mix_mode")
-
layout.prop(WindowManager.operator_properties_last("sculpt.mask_from_cavity"), 
"factor")
-props = layout.operator("sculpt.mask_from_cavity")
-props.use_automask_settings = True
+col = layout.column()
+
+last = 
WindowManager.operator_properties_last("sculpt.mask_from_cavity")
+
+col.prop(last, "mix_mode")
+col.prop(last, "mix_factor")
+col.prop(last, "use_automask_settings")
+
+if not last.use_automask_settings:
+col.prop(last, "factor", text="Factor")
+col.prop(last, "blur_steps", text="Blur")
+col.prop(last, "invert", text="Invert")
+col.prop(last, "use_curve", text="Use Curve")
+
+if last.use_curve:
+col.template_curve_mapping(sculpt, 
"automasking_cavity_curve_op")
+else:
+col.prop(sculpt, "automasking_cavity_factor", text="Factor")
+col.prop(sculpt, "automasking_cavity_blur_steps", text="Blur")
+col.prop(sculpt, "use_automasking_cavity_inverted", text="Invert")
+
+col.prop(sculpt, "use_automasking_custom_cavity_curve", text="Use 
Curve")
+
+if sculpt.use_automasking_custom_cavity_curve:
+col.template_curve_mapping(sculpt, "automasking_cavity_curve")
+
+layout.operator("sculpt.mask_from_cavity")
 
 # TODO, move to space_view3d.py
 class VIEW3D_PT_sculpt_symmetry(Panel, View3DPaintPanel):

___
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] [4b2c92f8e07] temp-sculpt-cavity-mask: temp-sculpt-cavity-mask: Cleanup UI

2022-08-09 Thread Joseph Eagar
Commit: 4b2c92f8e07fe23182dc1f4e775c1305dff6f260
Author: Joseph Eagar
Date:   Tue Aug 9 12:15:59 2022 -0700
Branches: temp-sculpt-cavity-mask
https://developer.blender.org/rB4b2c92f8e07fe23182dc1f4e775c1305dff6f260

temp-sculpt-cavity-mask: Cleanup UI

* Rename "Bake Cavity" to "Mask From Cavity"
* Mask from cavity operator's redo panel now
  edits automasking properties if "Use Automasking Settings"
  is on.

===

M   release/scripts/startup/bl_ui/space_view3d.py
M   release/scripts/startup/bl_ui/space_view3d_toolbar.py
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_automasking.cc
M   source/blender/editors/sculpt_paint/sculpt_ops.c
M   tests/python/bl_run_operators.py

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 1c34c3b38fe..0e4bc81cbc7 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -3280,7 +3280,7 @@ class VIEW3D_MT_mask(Menu):
 
 layout.separator()
 
-props = layout.operator("sculpt.bake_cavity", text="Mask From Cavity")
+props = layout.operator("sculpt.mask_from_cavity", text="Mask From 
Cavity")
 props.use_automask_settings = False
 
 layout.separator()
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index ea674d3c99a..caa91fe5315 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1029,9 +1029,9 @@ class VIEW3D_PT_sculpt_cavity_bake(Panel, 
View3DPaintPanel):
 tool_settings = context.tool_settings
 sculpt = tool_settings.sculpt
 
-
layout.prop(WindowManager.operator_properties_last("sculpt.bake_cavity"), 
"mix_mode")
-
layout.prop(WindowManager.operator_properties_last("sculpt.bake_cavity"), 
"factor")
-props = layout.operator("sculpt.bake_cavity")
+
layout.prop(WindowManager.operator_properties_last("sculpt.mask_from_cavity"), 
"mix_mode")
+
layout.prop(WindowManager.operator_properties_last("sculpt.mask_from_cavity"), 
"factor")
+props = layout.operator("sculpt.mask_from_cavity")
 props.use_automask_settings = True
 
 # TODO, move to space_view3d.py
diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index 11f4f72916c..7caf13285b9 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -5649,6 +5649,10 @@ static int sculpt_brush_stroke_modal(bContext *C, 
wmOperator *op, const wmEvent
   return paint_stroke_modal(C, op, event, (struct PaintStroke 
**)>customdata);
 }
 
+static void empty_operator_ui(bContext *C, wmOperator *op)
+{
+}
+
 void SCULPT_OT_brush_stroke(wmOperatorType *ot)
 {
   /* Identifiers. */
@@ -5662,9 +5666,10 @@ void SCULPT_OT_brush_stroke(wmOperatorType *ot)
   ot->exec = sculpt_brush_stroke_exec;
   ot->poll = SCULPT_poll;
   ot->cancel = sculpt_brush_stroke_cancel;
+  ot->ui = empty_operator_ui;
 
   /* Flags (sculpt does own undo? (ton)). */
-  ot->flag = OPTYPE_BLOCKING;
+  ot->flag = OPTYPE_BLOCKING | OPTYPE_UNDO | OPTYPE_REGISTER;
 
   /* Properties. */
 
diff --git a/source/blender/editors/sculpt_paint/sculpt_automasking.cc 
b/source/blender/editors/sculpt_paint/sculpt_automasking.cc
index 1d788aea846..a30fe7c29b4 100644
--- a/source/blender/editors/sculpt_paint/sculpt_automasking.cc
+++ b/source/blender/editors/sculpt_paint/sculpt_automasking.cc
@@ -211,16 +211,6 @@ static void sculpt_calc_blurred_cavity(SculptSession *ss,
int steps,
PBVHVertRef vertex)
 {
-  if (steps == 0) {
-int index = BKE_pbvh_vertex_to_index(ss->pbvh, vertex);
-
-ss->cavity[index].factor = sculpt_cavity_calc_factor(
-ss, automasking, SCULPT_calc_cavity(ss, vertex));
-ss->cavity[index].stroke_id = ss->stroke_id;
-
-return;
-  }
-
   float sno1[3];
   float sno2[3];
   float sco1[3];
@@ -228,6 +218,11 @@ static void sculpt_calc_blurred_cavity(SculptSession *ss,
   float len1_sum = 0.0f, len2_sum = 0.0f;
   int sco1_len = 0, sco2_len = 0;
 
+  /* Steps starts at 1, but API and user interface
+   * are zero-based.
+   */
+  steps++;
+
   zero_v3(sno1);
   zero_v3(sno2);
   zero_v3(sco1);
@@ -640,7 +635,7 @@ static void 
SCULPT_automasking_cache_settings_update(AutomaskingCache *automaski
   automasking->settings.flags = sculpt_automasking_mode_effective_bits(sd, 
brush);
   automasking->settings.initial_face_set = SCULPT_active_face_set_get(ss);
   automasking->settings.cavity_factor = sd->automasking_cavity_factor;
-  automasking->settings.cavity_blur_steps = 

[Bf-blender-cvs] [edd6d301c75] master: Cleanup: Move mball.c to C++

2022-08-09 Thread Hans Goudey
Commit: edd6d301c75569637a54748cb4663bb9a920db78
Author: Hans Goudey
Date:   Tue Aug 9 13:49:09 2022 -0500
Branches: master
https://developer.blender.org/rBedd6d301c75569637a54748cb4663bb9a920db78

Cleanup: Move mball.c to C++

Facilitates changes in D14593

===

M   source/blender/blenkernel/CMakeLists.txt
R085source/blender/blenkernel/intern/mball.c
source/blender/blenkernel/intern/mball.cc

===

diff --git a/source/blender/blenkernel/CMakeLists.txt 
b/source/blender/blenkernel/CMakeLists.txt
index f76f7f5a968..e3f00d03a3b 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -191,7 +191,7 @@ set(SRC
   intern/mask_evaluate.c
   intern/mask_rasterize.c
   intern/material.c
-  intern/mball.c
+  intern/mball.cc
   intern/mball_tessellate.c
   intern/mesh.cc
   intern/mesh_boolean_convert.cc
diff --git a/source/blender/blenkernel/intern/mball.c 
b/source/blender/blenkernel/intern/mball.cc
similarity index 85%
rename from source/blender/blenkernel/intern/mball.c
rename to source/blender/blenkernel/intern/mball.cc
index 6f4b05e04f7..084fea6abbd 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.cc
@@ -11,12 +11,12 @@
  * texture coordinates are patched within the displist
  */
 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #include "MEM_guardedalloc.h"
 
@@ -72,11 +72,11 @@ static void metaball_copy_data(Main *UNUSED(bmain),
 
   BLI_duplicatelist(_dst->elems, _src->elems);
 
-  metaball_dst->mat = MEM_dupallocN(metaball_src->mat);
+  metaball_dst->mat = static_cast(MEM_dupallocN(metaball_src->mat));
 
-  metaball_dst->editelems = NULL;
-  metaball_dst->lastelem = NULL;
-  metaball_dst->batch_cache = NULL;
+  metaball_dst->editelems = nullptr;
+  metaball_dst->lastelem = nullptr;
+  metaball_dst->batch_cache = nullptr;
 }
 
 static void metaball_free_data(ID *id)
@@ -107,11 +107,11 @@ static void metaball_blend_write(BlendWriter *writer, ID 
*id, const void *id_add
 
   /* Clean up, important in undo case to reduce false detection of changed 
datablocks. */
   BLI_listbase_clear(>disp);
-  mb->editelems = NULL;
+  mb->editelems = nullptr;
   /* Must always be cleared (meta's don't have their own edit-data). */
   mb->needs_flush_to_id = 0;
-  mb->lastelem = NULL;
-  mb->batch_cache = NULL;
+  mb->lastelem = nullptr;
+  mb->batch_cache = nullptr;
 
   /* write LibData */
   BLO_write_id_struct(writer, MetaBall, id_address, >id);
@@ -139,12 +139,12 @@ static void metaball_blend_read_data(BlendDataReader 
*reader, ID *id)
   BLO_read_list(reader, &(mb->elems));
 
   BLI_listbase_clear(>disp);
-  mb->editelems = NULL;
+  mb->editelems = nullptr;
   /* Must always be cleared (meta's don't have their own edit-data). */
   mb->needs_flush_to_id = 0;
-  // mb->edit_elems.first = mb->edit_elems.last = NULL;
-  mb->lastelem = NULL;
-  mb->batch_cache = NULL;
+  // mb->edit_elems.first = mb->edit_elems.last = nullptr;
+  mb->lastelem = nullptr;
+  mb->batch_cache = nullptr;
 }
 
 static void metaball_blend_read_lib(BlendLibReader *reader, ID *id)
@@ -166,49 +166,46 @@ static void metaball_blend_read_expand(BlendExpander 
*expander, ID *id)
 }
 
 IDTypeInfo IDType_ID_MB = {
-.id_code = ID_MB,
-.id_filter = FILTER_ID_MB,
-.main_listbase_index = INDEX_ID_MB,
-.struct_size = sizeof(MetaBall),
-.name = "Metaball",
-.name_plural = "metaballs",
-.translation_context = BLT_I18NCONTEXT_ID_METABALL,
-.flags = IDTYPE_FLAGS_APPEND_IS_REUSABLE,
-.asset_type_info = NULL,
-
-.init_data = metaball_init_data,
-.copy_data = metaball_copy_data,
-.free_data = metaball_free_data,
-.make_local = NULL,
-.foreach_id = metaball_foreach_id,
-.foreach_cache = NULL,
-.foreach_path = NULL,
-.owner_get = NULL,
-
-.blend_write = metaball_blend_write,
-.blend_read_data = metaball_blend_read_data,
-.blend_read_lib = metaball_blend_read_lib,
-.blend_read_expand = metaball_blend_read_expand,
-
-.blend_read_undo_preserve = NULL,
-
-.lib_override_apply_post = NULL,
+/* id_code */ ID_MB,
+/* id_filter */ FILTER_ID_MB,
+/* main_listbase_index */ INDEX_ID_MB,
+/* struct_size */ sizeof(MetaBall),
+/* name */ "Metaball",
+/* name_plural */ "metaballs",
+/* translation_context */ BLT_I18NCONTEXT_ID_METABALL,
+/* flags */ IDTYPE_FLAGS_APPEND_IS_REUSABLE,
+/* asset_type_info */ nullptr,
+
+/* init_data */ metaball_init_data,
+/* copy_data */ metaball_copy_data,
+/* free_data */ metaball_free_data,
+/* make_local */ nullptr,
+/* foreach_id */ metaball_foreach_id,
+/* foreach_cache */ nullptr,
+/* foreach_path */ nullptr,
+/* owner_get */ nullptr,
+
+/* blend_write */ 

[Bf-blender-cvs] [fb017506dab] refactor-mesh-remove-pointers: Fix build error

2022-08-09 Thread Hans Goudey
Commit: fb017506dabc17490aa2251c2b3802a975959240
Author: Hans Goudey
Date:   Tue Aug 9 13:36:42 2022 -0500
Branches: refactor-mesh-remove-pointers
https://developer.blender.org/rBfb017506dabc17490aa2251c2b3802a975959240

Fix build error

===

M   
source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp

===

diff --git 
a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp 
b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
index 3e819719d51..a96701f2cc5 100644
--- 
a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
+++ 
b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
@@ -588,13 +588,13 @@ void 
BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex)
 
   if (hasTex) {
 // First UV layer
-loopsuv[0] = CustomData_add_layer_named(
->ldata, CD_MLOOPUV, CD_CALLOC, nullptr, mesh->totloop, 
uvNames[0]);
+loopsuv[0] = static_cast(CustomData_add_layer_named(
+>ldata, CD_MLOOPUV, CD_CALLOC, nullptr, mesh->totloop, 
uvNames[0]));
 CustomData_set_layer_active(>ldata, CD_MLOOPUV, 0);
 
 // Second UV layer
-loopsuv[1] = CustomData_add_layer_named(
->ldata, CD_MLOOPUV, CD_CALLOC, nullptr, mesh->totloop, 
uvNames[1]);
+loopsuv[1] = static_cast(CustomData_add_layer_named(
+>ldata, CD_MLOOPUV, CD_CALLOC, nullptr, mesh->totloop, 
uvNames[1]));
 CustomData_set_layer_active(>ldata, CD_MLOOPUV, 1);
   }

___
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] [99dd1d1f792] refactor-mesh-remove-pointers: Merge branch 'refactor-mesh-hide-generic' into refactor-mesh-remove-pointers

2022-08-09 Thread Hans Goudey
Commit: 99dd1d1f7923552a2684961dbbc024183ce28785
Author: Hans Goudey
Date:   Tue Aug 9 13:35:37 2022 -0500
Branches: refactor-mesh-remove-pointers
https://developer.blender.org/rB99dd1d1f7923552a2684961dbbc024183ce28785

Merge branch 'refactor-mesh-hide-generic' 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] [5d102f9d37c] refactor-mesh-remove-pointers: Merge branch 'master' into refactor-mesh-hide-generic

2022-08-09 Thread Hans Goudey
Commit: 5d102f9d37c510173ec9e7d1d3e7876bc1d09111
Author: Hans Goudey
Date:   Tue Aug 9 13:35:25 2022 -0500
Branches: refactor-mesh-remove-pointers
https://developer.blender.org/rB5d102f9d37c510173ec9e7d1d3e7876bc1d09111

Merge branch 'master' into refactor-mesh-hide-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] [fd2c9668b50] refactor-mesh-remove-pointers: Fix, cleanups, build errors

2022-08-09 Thread Hans Goudey
Commit: fd2c9668b504958651e89b7783a7fcae8e76cda6
Author: Hans Goudey
Date:   Tue Aug 9 13:34:48 2022 -0500
Branches: refactor-mesh-remove-pointers
https://developer.blender.org/rBfd2c9668b504958651e89b7783a7fcae8e76cda6

Fix, cleanups, build errors

===

M   source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
M   source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
M   source/blender/io/usd/intern/usd_reader_mesh.cc

===

diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c 
b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
index 296fc839a8a..3daf6b3b7a4 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
@@ -348,7 +348,7 @@ static const EnumPropertyItem 
*weight_paint_sample_enum_itemf(bContext *C,
 uint fidx = mp->totloop - 1;
 
 do {
-  const MDeformVert *dvert = [loops[mp->loopstart + fidx].v];
+  const MDeformVert *dvert = [loops[mp->loopstart + 
fidx].v];
   found |= weight_paint_sample_enum_itemf__helper(dvert, 
defbase_tot, groups);
 } while (fidx--);
   }
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c 
b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 015874a9cd7..ab7ff79a5f3 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -1712,16 +1712,16 @@ static void 
lineart_identify_mlooptri_feature_edges(void *__restrict userdata,
 typedef struct LooseEdgeData {
   int loose_count;
   int loose_max;
-  const MEdge **loose_array;
+  MEdge const **loose_array;
   Mesh *me;
 } LooseEdgeData;
 
 static void lineart_loose_data_reallocate(LooseEdgeData *loose_data, int count)
 {
-  const MEdge **new_arr = MEM_callocN(sizeof(MEdge *) * count, "loose edge 
array");
+  MEdge **new_arr = MEM_callocN(sizeof(MEdge *) * count, "loose edge array");
   if (loose_data->loose_array) {
 memcpy(new_arr, loose_data->loose_array, sizeof(MEdge *) * 
loose_data->loose_max);
-MEM_freeN(loose_data->loose_array);
+MEM_SAFE_FREE(loose_data->loose_array);
   }
   loose_data->loose_max = count;
   loose_data->loose_array = new_arr;
@@ -2286,7 +2286,7 @@ static void 
lineart_geometry_object_load(LineartObjectInfo *ob_info,
   la_edge++;
   la_seg++;
 }
-MEM_freeN(loose_data.loose_array);
+MEM_SAFE_FREE(loose_data.loose_array);
   }
 
   MEM_freeN(edge_feat_data.edge_nabr);
diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc 
b/source/blender/io/usd/intern/usd_reader_mesh.cc
index f663fc23a86..28ed259e696 100644
--- a/source/blender/io/usd/intern/usd_reader_mesh.cc
+++ b/source/blender/io/usd/intern/usd_reader_mesh.cc
@@ -907,7 +907,7 @@ Mesh *USDMeshReader::read_mesh(Mesh *existing_mesh,
  * the material slots that were created when the object was loaded from
  * USD are still valid now. */
 MutableSpan polygons = bke::mesh_polygons_for_write(*active_mesh);
-if (!polygons.is_empty() > 0 && import_params_.import_materials) {
+if (!polygons.is_empty() && import_params_.import_materials) {
   std::map mat_map;
   assign_facesets_to_mpoly(motionSampleTime, polygons, _map);
 }

___
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] [571544ee96e] refactor-mesh-remove-pointers: Merge branch 'master' into refactor-mesh-remove-pointers

2022-08-09 Thread Hans Goudey
Commit: 571544ee96e35bd31ff2b26b64b479a17e1dd09b
Author: Hans Goudey
Date:   Tue Aug 9 13:25:56 2022 -0500
Branches: refactor-mesh-remove-pointers
https://developer.blender.org/rB571544ee96e35bd31ff2b26b64b479a17e1dd09b

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

===



===

diff --cc source/blender/blenkernel/intern/mesh_tangent.c
index fc0e6f16c1d,1772419e1f3..018ea9a3fb0
--- a/source/blender/blenkernel/intern/mesh_tangent.c
+++ b/source/blender/blenkernel/intern/mesh_tangent.c
@@@ -716,12 -716,12 +716,12 @@@ void BKE_mesh_calc_loop_tangents(Mesh *
  {
BKE_mesh_runtime_looptri_ensure(me_eval);
  
-   /* TODO(campbell): store in Mesh.runtime to avoid recalculation. */
+   /* TODO(@campbellbarton): store in Mesh.runtime to avoid recalculation. */
short tangent_mask = 0;
 -  BKE_mesh_calc_loop_tangent_ex(me_eval->mvert,
 -me_eval->mpoly,
 +  BKE_mesh_calc_loop_tangent_ex(BKE_mesh_vertices(me_eval),
 +BKE_mesh_polygons(me_eval),
  (uint)me_eval->totpoly,
 -me_eval->mloop,
 +BKE_mesh_loops(me_eval),
  me_eval->runtime.looptris.array,
  (uint)me_eval->runtime.looptris.len,
  _eval->ldata,

___
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] [f8b1483566c] master: Cleanup: Remove unused object batch cache API function

2022-08-09 Thread Hans Goudey
Commit: f8b1483566ccc096f54c32c93955b003ee77e32a
Author: Hans Goudey
Date:   Tue Aug 9 13:03:35 2022 -0500
Branches: master
https://developer.blender.org/rBf8b1483566ccc096f54c32c93955b003ee77e32a

Cleanup: Remove unused object batch cache API function

Remove the "tag batch cache dirty" function specifically  for object data,
since it isn't used. Ref D14593

===

M   source/blender/blenkernel/BKE_object.h
M   source/blender/blenkernel/intern/object_update.c

===

diff --git a/source/blender/blenkernel/BKE_object.h 
b/source/blender/blenkernel/BKE_object.h
index f0eb16a819d..8f3b488c7db 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -586,7 +586,6 @@ void BKE_object_runtime_reset_on_copy(struct Object 
*object, int flag);
 void BKE_object_runtime_free_data(struct Object *object);
 
 void BKE_object_batch_cache_dirty_tag(struct Object *ob);
-void BKE_object_data_batch_cache_dirty_tag(struct ID *object_data);
 
 /* this function returns a superset of the scenes selection based on 
relationships */
 
diff --git a/source/blender/blenkernel/intern/object_update.c 
b/source/blender/blenkernel/intern/object_update.c
index 1f7df2773dc..99c4d92d284 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -281,45 +281,39 @@ void BKE_object_eval_uber_transform(Depsgraph 
*UNUSED(depsgraph), Object *UNUSED
 {
 }
 
-void BKE_object_data_batch_cache_dirty_tag(ID *object_data)
+void BKE_object_batch_cache_dirty_tag(Object *ob)
 {
-  switch (GS(object_data->name)) {
-case ID_ME:
-  BKE_mesh_batch_cache_dirty_tag((struct Mesh *)object_data, 
BKE_MESH_BATCH_DIRTY_ALL);
+  switch (ob->type) {
+case OB_MESH:
+  BKE_mesh_batch_cache_dirty_tag((struct Mesh *)ob->data, 
BKE_MESH_BATCH_DIRTY_ALL);
   break;
-case ID_LT:
-  BKE_lattice_batch_cache_dirty_tag((struct Lattice *)object_data,
-BKE_LATTICE_BATCH_DIRTY_ALL);
+case OB_LATTICE:
+  BKE_lattice_batch_cache_dirty_tag((struct Lattice *)ob->data, 
BKE_LATTICE_BATCH_DIRTY_ALL);
   break;
-case ID_CU_LEGACY:
-  BKE_curve_batch_cache_dirty_tag((struct Curve *)object_data, 
BKE_CURVE_BATCH_DIRTY_ALL);
+case OB_CURVES_LEGACY:
+  BKE_curve_batch_cache_dirty_tag((struct Curve *)ob->data, 
BKE_CURVE_BATCH_DIRTY_ALL);
   break;
-case ID_MB:
-  BKE_mball_batch_cache_dirty_tag((struct MetaBall *)object_data, 
BKE_MBALL_BATCH_DIRTY_ALL);
+case OB_MBALL:
+  BKE_mball_batch_cache_dirty_tag((struct MetaBall *)ob->data, 
BKE_MBALL_BATCH_DIRTY_ALL);
   break;
-case ID_GD:
-  BKE_gpencil_batch_cache_dirty_tag((struct bGPdata *)object_data);
+case OB_GPENCIL:
+  BKE_gpencil_batch_cache_dirty_tag((struct bGPdata *)ob->data);
   break;
-case ID_CV:
-  BKE_curves_batch_cache_dirty_tag((struct Curves *)object_data, 
BKE_CURVES_BATCH_DIRTY_ALL);
+case OB_CURVES:
+  BKE_curves_batch_cache_dirty_tag((struct Curves *)ob->data, 
BKE_CURVES_BATCH_DIRTY_ALL);
   break;
-case ID_PT:
-  BKE_pointcloud_batch_cache_dirty_tag((struct PointCloud *)object_data,
+case OB_POINTCLOUD:
+  BKE_pointcloud_batch_cache_dirty_tag((struct PointCloud *)ob->data,
BKE_POINTCLOUD_BATCH_DIRTY_ALL);
   break;
-case ID_VO:
-  BKE_volume_batch_cache_dirty_tag((struct Volume *)object_data, 
BKE_VOLUME_BATCH_DIRTY_ALL);
+case OB_VOLUME:
+  BKE_volume_batch_cache_dirty_tag((struct Volume *)ob->data, 
BKE_VOLUME_BATCH_DIRTY_ALL);
   break;
 default:
   break;
   }
 }
 
-void BKE_object_batch_cache_dirty_tag(Object *ob)
-{
-  BKE_object_data_batch_cache_dirty_tag(ob->data);
-}
-
 void BKE_object_eval_uber_data(Depsgraph *depsgraph, Scene *scene, Object *ob)
 {
   DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob);

___
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] [c15a63d21ea] master: Cleanup: MIscellaneous improvements to pointcloud draw cache

2022-08-09 Thread Hans Goudey
Commit: c15a63d21eae49ffdce379efef729edbc952db1f
Author: Hans Goudey
Date:   Tue Aug 9 12:33:46 2022 -0500
Branches: master
https://developer.blender.org/rBc15a63d21eae49ffdce379efef729edbc952db1f

Cleanup: MIscellaneous improvements to pointcloud draw cache

- Use references
- Reorder functions to remove unnecessary prototype
- Use the attribute API
- Use const where possible
- Split no-radius extraction a bit more, add multithreading

===

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

===

diff --git a/source/blender/draw/intern/draw_cache_impl_pointcloud.cc 
b/source/blender/draw/intern/draw_cache_impl_pointcloud.cc
index 42fa7988181..d99af0c77e4 100644
--- a/source/blender/draw/intern/draw_cache_impl_pointcloud.cc
+++ b/source/blender/draw/intern/draw_cache_impl_pointcloud.cc
@@ -13,20 +13,19 @@
 
 #include "BLI_math_base.h"
 #include "BLI_math_vector.h"
+#include "BLI_task.hh"
 #include "BLI_utildefines.h"
 
 #include "DNA_object_types.h"
 #include "DNA_pointcloud_types.h"
 
-#include "BKE_customdata.h"
+#include "BKE_attribute.hh"
 #include "BKE_pointcloud.h"
 
 #include "GPU_batch.h"
 
 #include "draw_cache_impl.h" /* own include */
 
-static void pointcloud_batch_cache_clear(PointCloud *pointcloud);
-
 /* -- */
 /* PointCloud GPUBatch Cache */
 
@@ -47,54 +46,46 @@ struct PointCloudBatchCache {
 
 /* GPUBatch cache management. */
 
-static PointCloudBatchCache *pointcloud_batch_cache_get(PointCloud *pointcloud)
+static PointCloudBatchCache *pointcloud_batch_cache_get(PointCloud )
 {
-  return static_cast(pointcloud->batch_cache);
+  return static_cast(pointcloud.batch_cache);
 }
 
-static bool pointcloud_batch_cache_valid(PointCloud *pointcloud)
+static bool pointcloud_batch_cache_valid(PointCloud )
 {
   PointCloudBatchCache *cache = pointcloud_batch_cache_get(pointcloud);
 
   if (cache == NULL) {
 return false;
   }
-  if (cache->mat_len != DRW_pointcloud_material_count_get(pointcloud)) {
+  if (cache->mat_len != DRW_pointcloud_material_count_get()) {
 return false;
   }
   return cache->is_dirty == false;
 }
 
-static void pointcloud_batch_cache_init(PointCloud *pointcloud)
+static void pointcloud_batch_cache_init(PointCloud )
 {
   PointCloudBatchCache *cache = pointcloud_batch_cache_get(pointcloud);
 
   if (!cache) {
 cache = MEM_cnew(__func__);
-pointcloud->batch_cache = cache;
+pointcloud.batch_cache = cache;
   }
   else {
 memset(cache, 0, sizeof(*cache));
   }
 
-  cache->mat_len = DRW_pointcloud_material_count_get(pointcloud);
+  cache->mat_len = DRW_pointcloud_material_count_get();
   cache->surface_per_mat = static_cast(
   MEM_callocN(sizeof(GPUBatch *) * cache->mat_len, __func__));
 
   cache->is_dirty = false;
 }
 
-void DRW_pointcloud_batch_cache_validate(PointCloud *pointcloud)
-{
-  if (!pointcloud_batch_cache_valid(pointcloud)) {
-pointcloud_batch_cache_clear(pointcloud);
-pointcloud_batch_cache_init(pointcloud);
-  }
-}
-
 void DRW_pointcloud_batch_cache_dirty_tag(PointCloud *pointcloud, int mode)
 {
-  PointCloudBatchCache *cache = pointcloud_batch_cache_get(pointcloud);
+  PointCloudBatchCache *cache = pointcloud_batch_cache_get(*pointcloud);
   if (cache == NULL) {
 return;
   }
@@ -107,7 +98,7 @@ void DRW_pointcloud_batch_cache_dirty_tag(PointCloud 
*pointcloud, int mode)
   }
 }
 
-static void pointcloud_batch_cache_clear(PointCloud *pointcloud)
+static void pointcloud_batch_cache_clear(PointCloud )
 {
   PointCloudBatchCache *cache = pointcloud_batch_cache_get(pointcloud);
   if (!cache) {
@@ -128,54 +119,65 @@ static void pointcloud_batch_cache_clear(PointCloud 
*pointcloud)
   MEM_SAFE_FREE(cache->surface_per_mat);
 }
 
+void DRW_pointcloud_batch_cache_validate(PointCloud *pointcloud)
+{
+  if (!pointcloud_batch_cache_valid(*pointcloud)) {
+pointcloud_batch_cache_clear(*pointcloud);
+pointcloud_batch_cache_init(*pointcloud);
+  }
+}
+
 void DRW_pointcloud_batch_cache_free(PointCloud *pointcloud)
 {
-  pointcloud_batch_cache_clear(pointcloud);
+  pointcloud_batch_cache_clear(*pointcloud);
   MEM_SAFE_FREE(pointcloud->batch_cache);
 }
 
-static void pointcloud_batch_cache_ensure_pos(Object *ob, PointCloudBatchCache 
*cache)
+static void pointcloud_batch_cache_ensure_pos(const PointCloud ,
+  PointCloudBatchCache )
 {
-  if (cache->pos != NULL) {
+  using namespace blender;
+  if (cache.pos != NULL) {
 return;
   }
 
-  PointCloud *pointcloud = static_cast(ob->data);
-  const float(*positions)[3] = (float(*)[3])CustomData_get_layer_named(
-  >pdata, CD_PROP_FLOAT3, "position");
-  const float *radii = (float *)CustomData_get_layer_named(
-  >pdata, CD_PROP_FLOAT, "radius");
-  const bool has_radius = radii != NULL;
-
-  static GPUVertFormat format = {0};
- 

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

2022-08-09 Thread Brecht Van Lommel
Commit: 752fb5dd081233f4f6ec389503cc4e7bec15e772
Author: Brecht Van Lommel
Date:   Tue Aug 9 19:19:54 2022 +0200
Branches: master
https://developer.blender.org/rB752fb5dd081233f4f6ec389503cc4e7bec15e772

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] [79f1cc601cd] blender-v3.3-release: Cycles: improve ray tracing precision near triangle edges

2022-08-09 Thread Brecht Van Lommel
Commit: 79f1cc601cdbcf142e1bf4c1966f64dcf93b030f
Author: Brecht Van Lommel
Date:   Mon Jul 18 21:07:06 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB79f1cc601cdbcf142e1bf4c1966f64dcf93b030f

Cycles: improve ray tracing precision near triangle edges

Detect cases where a ray-intersection would miss the current triangle, which if
the intersection is strictly watertight, implies that a neighboring triangle 
would
incorrectly be hit instead.

When that is detected, apply a ray-offset. The idea being that we only want to
introduce potential error from ray offsets if we really need to.

This work for BVH2 and Embree, as we are able to match the ray-interesction
bit-for-bit, though doing so for Embree requires ugly hacks. Tiny differences
like fused-multiply-add or dot product intrinstics in matrix inversion and ray
intersection needed to be matched exactly, so this is fragile.

Unfortunately we're not able to do the same for OptiX or MetalRT, since those
implementations are unknown (and possibly impossible to match as hardware
instructions). Still artifacts are much reduced, though not eliminated.

Ref T97259

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

===

M   intern/cycles/kernel/bvh/util.h
M   intern/cycles/kernel/integrator/shade_surface.h
M   intern/cycles/util/math_intersect.h

===

diff --git a/intern/cycles/kernel/bvh/util.h b/intern/cycles/kernel/bvh/util.h
index b67c9394bea..a57703a8b8c 100644
--- a/intern/cycles/kernel/bvh/util.h
+++ b/intern/cycles/kernel/bvh/util.h
@@ -33,6 +33,30 @@ ccl_device_forceinline float intersection_t_offset(const 
float t)
   return __uint_as_float(bits);
 }
 
+/* Ray offset to avoid self intersection.
+ *
+ * This function can be used to compute a modified ray start position for rays
+ * leaving from a surface. This is from:
+ * "A Fast and Robust Method for Avoiding Self-Intersection"
+ * Ray Tracing Gems, chapter 6.
+ */
+ccl_device_inline float3 ray_offset(const float3 P, const float3 Ng)
+{
+  const float int_scale = 256.0f;
+  const int3 of_i = make_int3(
+  (int)(int_scale * Ng.x), (int)(int_scale * Ng.y), (int)(int_scale * 
Ng.z));
+
+  const float3 p_i = make_float3(
+  __int_as_float(__float_as_int(P.x) + ((P.x < 0) ? -of_i.x : of_i.x)),
+  __int_as_float(__float_as_int(P.y) + ((P.y < 0) ? -of_i.y : of_i.y)),
+  __int_as_float(__float_as_int(P.z) + ((P.z < 0) ? -of_i.z : of_i.z)));
+  const float origin = 1.0f / 32.0f;
+  const float float_scale = 1.0f / 65536.0f;
+  return make_float3(fabsf(P.x) < origin ? P.x + float_scale * Ng.x : p_i.x,
+ fabsf(P.y) < origin ? P.y + float_scale * Ng.y : p_i.y,
+ fabsf(P.z) < origin ? P.z + float_scale * Ng.z : p_i.z);
+}
+
 #ifndef __KERNEL_GPU__
 ccl_device int intersections_compare(const void *a, const void *b)
 {
diff --git a/intern/cycles/kernel/integrator/shade_surface.h 
b/intern/cycles/kernel/integrator/shade_surface.h
index 70b20a93b6a..19b8946e865 100644
--- a/intern/cycles/kernel/integrator/shade_surface.h
+++ b/intern/cycles/kernel/integrator/shade_surface.h
@@ -31,6 +31,52 @@ ccl_device_forceinline void 
integrate_surface_shader_setup(KernelGlobals kg,
   shader_setup_from_ray(kg, sd, , );
 }
 
+ccl_device_forceinline float3 integrate_surface_ray_offset(KernelGlobals kg,
+   const ccl_private 
ShaderData *sd,
+   const float3 ray_P,
+   const float3 ray_D)
+{
+  /* No ray offset needed for other primitive types. */
+  if (!(sd->type & PRIMITIVE_TRIANGLE)) {
+return ray_P;
+  }
+
+  /* Self intersection tests already account for the case where a ray hits the
+   * same primitive. However precision issues can still cause neighboring
+   * triangles to be hit. Here we test if the ray-triangle intersection with
+   * the same primitive would miss, implying that a neighbouring triangle would
+   * be hit instead.
+   *
+   * This relies on triangle intersection to be watertight, and the object 
inverse
+   * object transform to match the one used by ray intersection exactly.
+   *
+   * Potential improvements:
+   * - It appears this happens when either barycentric coordinates are small,
+   *   or dot(sd->Ng, ray_D)  is small. Detect such cases and skip test?
+   * - Instead of ray offset, can we tweak P to lie within the triangle?
+   */
+  const uint tri_vindex = kernel_data_fetch(tri_vindex, sd->prim).w;
+  const packed_float3 tri_a = kernel_data_fetch(tri_verts, tri_vindex + 0),
+  tri_b = kernel_data_fetch(tri_verts, tri_vindex + 1),
+  tri_c = kernel_data_fetch(tri_verts, tri_vindex + 2);
+
+  float3 local_ray_P = ray_P;
+  float3 local_ray_D = ray_D;
+
+  if 

[Bf-blender-cvs] [230f9ade648] blender-v3.3-release: Cycles: make transform inverse match Embree exactly

2022-08-09 Thread Brecht Van Lommel
Commit: 230f9ade64844a50ea02461cfa005f364de09aa9
Author: Brecht Van Lommel
Date:   Tue Aug 9 14:28:19 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB230f9ade64844a50ea02461cfa005f364de09aa9

Cycles: make transform inverse match Embree exactly

Helps improve ray-tracing precision. This is a bit complicated as it requires
different implementation depending on the CPU architecture.

===

M   intern/cycles/kernel/CMakeLists.txt
M   intern/cycles/util/CMakeLists.txt
M   intern/cycles/util/transform.cpp
M   intern/cycles/util/transform.h
A   intern/cycles/util/transform_avx2.cpp
A   intern/cycles/util/transform_inverse.h
A   intern/cycles/util/transform_sse41.cpp

===

diff --git a/intern/cycles/kernel/CMakeLists.txt 
b/intern/cycles/kernel/CMakeLists.txt
index 96b5842b77d..b00515eb037 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -326,6 +326,7 @@ set(SRC_UTIL_HEADERS
   ../util/rect.h
   ../util/static_assert.h
   ../util/transform.h
+  ../util/transform_inverse.h
   ../util/texture.h
   ../util/types.h
   ../util/types_float2.h
diff --git a/intern/cycles/util/CMakeLists.txt 
b/intern/cycles/util/CMakeLists.txt
index 9bc9f00e142..f3fc7739f66 100644
--- a/intern/cycles/util/CMakeLists.txt
+++ b/intern/cycles/util/CMakeLists.txt
@@ -26,6 +26,8 @@ set(SRC
   thread.cpp
   time.cpp
   transform.cpp
+  transform_avx2.cpp
+  transform_sse41.cpp
   windows.cpp
 )
 
@@ -138,6 +140,13 @@ set(SRC_HEADERS
   xml.h
 )
 
+if(CXX_HAS_SSE)
+  set_source_files_properties(transform_sse41.cpp PROPERTIES COMPILE_FLAGS 
"${CYCLES_SSE41_KERNEL_FLAGS}")
+endif()
+if(CXX_HAS_AVX2)
+  set_source_files_properties(transform_avx2.cpp PROPERTIES COMPILE_FLAGS 
"${CYCLES_AVX2_KERNEL_FLAGS}")
+endif()
+
 include_directories(${INC})
 include_directories(SYSTEM ${INC_SYS})
 
diff --git a/intern/cycles/util/transform.cpp b/intern/cycles/util/transform.cpp
index 0b87e88871d..cb985c65dd8 100644
--- a/intern/cycles/util/transform.cpp
+++ b/intern/cycles/util/transform.cpp
@@ -11,7 +11,7 @@ CCL_NAMESPACE_BEGIN
 
 /* Transform Inverse */
 
-static bool transform_matrix4_gj_inverse(float R[][4], float M[][4])
+static bool projection_matrix4_inverse(float R[][4], float M[][4])
 {
   /* SPDX-License-Identifier: BSD-3-Clause
* Adapted from code:
@@ -98,7 +98,7 @@ ProjectionTransform projection_inverse(const 
ProjectionTransform )
   memcpy(R, , sizeof(R));
   memcpy(M, , sizeof(M));
 
-  if (UNLIKELY(!transform_matrix4_gj_inverse(R, M))) {
+  if (UNLIKELY(!projection_matrix4_inverse(R, M))) {
 return projection_identity();
   }
 
diff --git a/intern/cycles/util/transform.h b/intern/cycles/util/transform.h
index 71164efbac1..24184dc7074 100644
--- a/intern/cycles/util/transform.h
+++ b/intern/cycles/util/transform.h
@@ -11,6 +11,10 @@
 #include "util/math.h"
 #include "util/types.h"
 
+#ifndef __KERNEL_GPU__
+#  include "util/system.h"
+#endif
+
 CCL_NAMESPACE_BEGIN
 
 /* Affine transformation, stored as 4x3 matrix. */
@@ -38,6 +42,12 @@ typedef struct DecomposedTransform {
   float4 x, y, z, w;
 } DecomposedTransform;
 
+CCL_NAMESPACE_END
+
+#include "util/transform_inverse.h"
+
+CCL_NAMESPACE_BEGIN
+
 /* Functions */
 
 #ifdef __KERNEL_METAL__
@@ -391,47 +401,28 @@ ccl_device_inline float4 quat_interpolate(float4 q1, 
float4 q2, float t)
 #endif /* defined(__KERNEL_GPU_RAYTRACING__) */
 }
 
+#ifndef __KERNEL_GPU__
+void transform_inverse_cpu_sse41(const Transform , Transform );
+void transform_inverse_cpu_avx2(const Transform , Transform );
+#endif
+
 ccl_device_inline Transform transform_inverse(const Transform tfm)
 {
-  /* This implementation matches the one in Embree exactly, to ensure 
consistent
-   * results with the ray intersection of instances. */
-  float3 x = make_float3(tfm.x.x, tfm.y.x, tfm.z.x);
-  float3 y = make_float3(tfm.x.y, tfm.y.y, tfm.z.y);
-  float3 z = make_float3(tfm.x.z, tfm.y.z, tfm.z.z);
-  float3 w = make_float3(tfm.x.w, tfm.y.w, tfm.z.w);
-
-  /* Compute determinant. */
-  float det = dot(x, cross(y, z));
-
-  if (det == 0.0f) {
-/* Matrix is degenerate (e.g. 0 scale on some axis), ideally we should
- * never be in this situation, but try to invert it anyway with tweak.
- *
- * This logic does not match Embree which would just give an invalid
- * matrix. A better solution would be to remove this and ensure any object
- * matrix is valid. */
-x.x += 1e-8f;
-y.y += 1e-8f;
-z.z += 1e-8f;
-
-det = dot(x, cross(y, z));
-if (det == 0.0f) {
-  det = FLT_MAX;
-}
+  /* Optimized transform implementations. */
+#ifndef __KERNEL_GPU__
+  if (system_cpu_support_avx2()) {
+Transform itfm;
+transform_inverse_cpu_avx2(tfm, itfm);
+return itfm;
   }
+  else if (system_cpu_support_sse41()) {
+Transform itfm;
+

[Bf-blender-cvs] [286e535071c] blender-v3.3-release: Cleanup: simplify CPU instruction checking

2022-08-09 Thread Brecht Van Lommel
Commit: 286e535071c8f9a906c6c36b8dac0eda6384c79a
Author: Brecht Van Lommel
Date:   Mon Aug 8 17:45:37 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB286e535071c8f9a906c6c36b8dac0eda6384c79a

Cleanup: simplify CPU instruction checking

The performance of this will be slightly more important for upcoming changes.
Also removed an unused function and changed includes so these system.h can
be included in more places.

===

M   intern/cycles/util/system.cpp
M   intern/cycles/util/system.h
M   intern/cycles/util/vector.h

===

diff --git a/intern/cycles/util/system.cpp b/intern/cycles/util/system.cpp
index a13ad95b9fe..3183ac06f26 100644
--- a/intern/cycles/util/system.cpp
+++ b/intern/cycles/util/system.cpp
@@ -128,53 +128,42 @@ int system_cpu_bits()
 #if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || 
defined(_M_IX86)
 
 struct CPUCapabilities {
-  bool x64;
-  bool mmx;
-  bool sse;
   bool sse2;
   bool sse3;
-  bool ssse3;
   bool sse41;
-  bool sse42;
-  bool sse4a;
   bool avx;
-  bool f16c;
   bool avx2;
-  bool xop;
-  bool fma3;
-  bool fma4;
-  bool bmi1;
-  bool bmi2;
 };
 
 static CPUCapabilities _cpu_capabilities()
 {
-  static CPUCapabilities caps;
+  static CPUCapabilities caps = {};
   static bool caps_init = false;
 
   if (!caps_init) {
 int result[4], num;
 
-memset(, 0, sizeof(caps));
-
 __cpuid(result, 0);
 num = result[0];
 
 if (num >= 1) {
   __cpuid(result, 0x0001);
-  caps.mmx = (result[3] & ((int)1 << 23)) != 0;
-  caps.sse = (result[3] & ((int)1 << 25)) != 0;
-  caps.sse2 = (result[3] & ((int)1 << 26)) != 0;
-  caps.sse3 = (result[2] & ((int)1 << 0)) != 0;
+  const bool sse = (result[3] & ((int)1 << 25)) != 0;
+  const bool sse2 = (result[3] & ((int)1 << 26)) != 0;
+  const bool sse3 = (result[2] & ((int)1 << 0)) != 0;
+
+  const bool ssse3 = (result[2] & ((int)1 << 9)) != 0;
+  const bool sse41 = (result[2] & ((int)1 << 19)) != 0;
+  /* const bool sse42 = (result[2] & ((int)1 << 20)) != 0; */
 
-  caps.ssse3 = (result[2] & ((int)1 << 9)) != 0;
-  caps.sse41 = (result[2] & ((int)1 << 19)) != 0;
-  caps.sse42 = (result[2] & ((int)1 << 20)) != 0;
+  const bool fma3 = (result[2] & ((int)1 << 12)) != 0;
+  const bool os_uses_xsave_xrestore = (result[2] & ((int)1 << 27)) != 0;
+  const bool cpu_avx_support = (result[2] & ((int)1 << 28)) != 0;
 
-  caps.fma3 = (result[2] & ((int)1 << 12)) != 0;
-  caps.avx = false;
-  bool os_uses_xsave_xrestore = (result[2] & ((int)1 << 27)) != 0;
-  bool cpu_avx_support = (result[2] & ((int)1 << 28)) != 0;
+  /* Simplify to combined capabilities for which we specialize kernels. */
+  caps.sse2 = sse && sse2;
+  caps.sse3 = sse && sse2 && sse3 && ssse3;
+  caps.sse41 = sse && sse2 && sse3 && ssse3 && sse41;
 
   if (os_uses_xsave_xrestore && cpu_avx_support) {
 // Check if the OS will save the YMM registers
@@ -189,15 +178,18 @@ static CPUCapabilities _cpu_capabilities()
 #  else
 xcr_feature_mask = 0;
 #  endif
-caps.avx = (xcr_feature_mask & 0x6) == 0x6;
-  }
+const bool avx = (xcr_feature_mask & 0x6) == 0x6;
+const bool f16c = (result[2] & ((int)1 << 29)) != 0;
 
-  caps.f16c = (result[2] & ((int)1 << 29)) != 0;
+__cpuid(result, 0x0007);
+bool bmi1 = (result[1] & ((int)1 << 3)) != 0;
+bool bmi2 = (result[1] & ((int)1 << 8)) != 0;
+bool avx2 = (result[1] & ((int)1 << 5)) != 0;
 
-  __cpuid(result, 0x0007);
-  caps.bmi1 = (result[1] & ((int)1 << 3)) != 0;
-  caps.bmi2 = (result[1] & ((int)1 << 8)) != 0;
-  caps.avx2 = (result[1] & ((int)1 << 5)) != 0;
+caps.avx = sse && sse2 && sse3 && ssse3 && sse41 && avx;
+caps.avx2 = sse && sse2 && sse3 && ssse3 && sse41 && avx && f16c && 
avx2 && fma3 && bmi1 &&
+bmi2;
+  }
 }
 
 caps_init = true;
@@ -209,32 +201,31 @@ static CPUCapabilities _cpu_capabilities()
 bool system_cpu_support_sse2()
 {
   CPUCapabilities  = system_cpu_capabilities();
-  return caps.sse && caps.sse2;
+  return caps.sse2;
 }
 
 bool system_cpu_support_sse3()
 {
   CPUCapabilities  = system_cpu_capabilities();
-  return caps.sse && caps.sse2 && caps.sse3 && caps.ssse3;
+  return caps.sse3;
 }
 
 bool system_cpu_support_sse41()
 {
   CPUCapabilities  = system_cpu_capabilities();
-  return caps.sse && caps.sse2 && caps.sse3 && caps.ssse3 && caps.sse41;
+  return caps.sse41;
 }
 
 bool system_cpu_support_avx()
 {
   CPUCapabilities  = system_cpu_capabilities();
-  return caps.sse && caps.sse2 && caps.sse3 && caps.ssse3 && caps.sse41 && 
caps.avx;
+  return caps.avx;
 }
 
 bool system_cpu_support_avx2()
 {
   CPUCapabilities  = system_cpu_capabilities();
-  return caps.sse && caps.sse2 && 

[Bf-blender-cvs] [1e8e70a90cd] master: Cleanup: Remove file mistakenly kept in C++ conversion

2022-08-09 Thread Hans Goudey
Commit: 1e8e70a90cdafa94746dd8aaee886a5747ff9d9e
Author: Hans Goudey
Date:   Tue Aug 9 11:15:59 2022 -0500
Branches: master
https://developer.blender.org/rB1e8e70a90cdafa94746dd8aaee886a5747ff9d9e

Cleanup: Remove file mistakenly kept in C++ conversion

===

D   source/blender/draw/intern/draw_cache_impl_pointcloud.c

===

diff --git a/source/blender/draw/intern/draw_cache_impl_pointcloud.c 
b/source/blender/draw/intern/draw_cache_impl_pointcloud.c
deleted file mode 100644
index 55d0eee00e5..000
--- a/source/blender/draw/intern/draw_cache_impl_pointcloud.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
- * Copyright 2017 Blender Foundation. All rights reserved. */
-
-/** \file
- * \ingroup draw
- *
- * \brief PointCloud API for render engines
- */
-
-#include 
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_math_base.h"
-#include "BLI_math_vector.h"
-#include "BLI_utildefines.h"
-
-#include "DNA_object_types.h"
-#include "DNA_pointcloud_types.h"
-
-#include "BKE_customdata.h"
-#include "BKE_pointcloud.h"
-
-#include "GPU_batch.h"
-
-#include "draw_cache_impl.h" /* own include */
-
-static void pointcloud_batch_cache_clear(PointCloud *pointcloud);
-
-/* -- */
-/* PointCloud GPUBatch Cache */
-
-typedef struct PointCloudBatchCache {
-  GPUVertBuf *pos;  /* Position and radius. */
-  GPUVertBuf *geom; /* Instanced geometry for each point in the cloud (small 
sphere). */
-  GPUIndexBuf *geom_indices;
-
-  GPUBatch *dots;
-  GPUBatch *surface;
-  GPUBatch **surface_per_mat;
-
-  /* settings to determine if cache is invalid */
-  bool is_dirty;
-
-  int mat_len;
-} PointCloudBatchCache;
-
-/* GPUBatch cache management. */
-
-static bool pointcloud_batch_cache_valid(PointCloud *pointcloud)
-{
-  PointCloudBatchCache *cache = pointcloud->batch_cache;
-
-  if (cache == NULL) {
-return false;
-  }
-  if (cache->mat_len != DRW_pointcloud_material_count_get(pointcloud)) {
-return false;
-  }
-  return cache->is_dirty == false;
-}
-
-static void pointcloud_batch_cache_init(PointCloud *pointcloud)
-{
-  PointCloudBatchCache *cache = pointcloud->batch_cache;
-
-  if (!cache) {
-cache = pointcloud->batch_cache = MEM_callocN(sizeof(*cache), __func__);
-  }
-  else {
-memset(cache, 0, sizeof(*cache));
-  }
-
-  cache->mat_len = DRW_pointcloud_material_count_get(pointcloud);
-  cache->surface_per_mat = MEM_callocN(sizeof(GPUBatch *) * cache->mat_len,
-   "pointcloud suface_per_mat");
-
-  cache->is_dirty = false;
-}
-
-void DRW_pointcloud_batch_cache_validate(PointCloud *pointcloud)
-{
-  if (!pointcloud_batch_cache_valid(pointcloud)) {
-pointcloud_batch_cache_clear(pointcloud);
-pointcloud_batch_cache_init(pointcloud);
-  }
-}
-
-static PointCloudBatchCache *pointcloud_batch_cache_get(PointCloud *pointcloud)
-{
-  return pointcloud->batch_cache;
-}
-
-void DRW_pointcloud_batch_cache_dirty_tag(PointCloud *pointcloud, int mode)
-{
-  PointCloudBatchCache *cache = pointcloud->batch_cache;
-  if (cache == NULL) {
-return;
-  }
-  switch (mode) {
-case BKE_POINTCLOUD_BATCH_DIRTY_ALL:
-  cache->is_dirty = true;
-  break;
-default:
-  BLI_assert(0);
-  }
-}
-
-static void pointcloud_batch_cache_clear(PointCloud *pointcloud)
-{
-  PointCloudBatchCache *cache = pointcloud->batch_cache;
-  if (!cache) {
-return;
-  }
-
-  GPU_BATCH_DISCARD_SAFE(cache->dots);
-  GPU_BATCH_DISCARD_SAFE(cache->surface);
-  GPU_VERTBUF_DISCARD_SAFE(cache->pos);
-  GPU_VERTBUF_DISCARD_SAFE(cache->geom);
-  GPU_INDEXBUF_DISCARD_SAFE(cache->geom_indices);
-
-  if (cache->surface_per_mat) {
-for (int i = 0; i < cache->mat_len; i++) {
-  GPU_BATCH_DISCARD_SAFE(cache->surface_per_mat[i]);
-}
-  }
-  MEM_SAFE_FREE(cache->surface_per_mat);
-}
-
-void DRW_pointcloud_batch_cache_free(PointCloud *pointcloud)
-{
-  pointcloud_batch_cache_clear(pointcloud);
-  MEM_SAFE_FREE(pointcloud->batch_cache);
-}
-
-static void pointcloud_batch_cache_ensure_pos(Object *ob, PointCloudBatchCache 
*cache)
-{
-  if (cache->pos != NULL) {
-return;
-  }
-
-  PointCloud *pointcloud = ob->data;
-  const float(*positions)[3] = (float(*)[3])CustomData_get_layer_named(
-  >pdata, CD_PROP_FLOAT3, "position");
-  const float *radii = (float *)CustomData_get_layer_named(
-  >pdata, CD_PROP_FLOAT, "radius");
-  const bool has_radius = radii != NULL;
-
-  static GPUVertFormat format = {0};
-  static GPUVertFormat format_no_radius = {0};
-  static uint pos;
-  if (format.attr_len == 0) {
-/* initialize vertex format */
-/* From the opengl wiki:
- * Note that size does not have to exactly match the size used by the 
vertex shader. If the
- * vertex shader has fewer components than the attribute provides, then 
the extras are 

[Bf-blender-cvs] [4ab6baefb17] master: Cleanup: Move draw_cache_impl_pointcloud.c to C++

2022-08-09 Thread Hans Goudey
Commit: 4ab6baefb175e7bf564a26ad9787dfb6fae1b82c
Author: Hans Goudey
Date:   Tue Aug 9 11:10:44 2022 -0500
Branches: master
https://developer.blender.org/rB4ab6baefb175e7bf564a26ad9787dfb6fae1b82c

Cleanup: Move draw_cache_impl_pointcloud.c to C++

===

M   source/blender/draw/CMakeLists.txt
A   source/blender/draw/intern/draw_cache_impl_pointcloud.cc
M   source/blender/gpu/GPU_batch.h

===

diff --git a/source/blender/draw/CMakeLists.txt 
b/source/blender/draw/CMakeLists.txt
index 9ecd157bd02..ec57c302b31 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -77,7 +77,7 @@ set(SRC
   intern/draw_cache_impl_mesh.cc
   intern/draw_cache_impl_metaball.c
   intern/draw_cache_impl_particles.c
-  intern/draw_cache_impl_pointcloud.c
+  intern/draw_cache_impl_pointcloud.cc
   intern/draw_cache_impl_subdivision.cc
   intern/draw_cache_impl_volume.c
   intern/draw_color_management.cc
diff --git a/source/blender/draw/intern/draw_cache_impl_pointcloud.cc 
b/source/blender/draw/intern/draw_cache_impl_pointcloud.cc
new file mode 100644
index 000..42fa7988181
--- /dev/null
+++ b/source/blender/draw/intern/draw_cache_impl_pointcloud.cc
@@ -0,0 +1,281 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2017 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup draw
+ *
+ * \brief PointCloud API for render engines
+ */
+
+#include 
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_math_base.h"
+#include "BLI_math_vector.h"
+#include "BLI_utildefines.h"
+
+#include "DNA_object_types.h"
+#include "DNA_pointcloud_types.h"
+
+#include "BKE_customdata.h"
+#include "BKE_pointcloud.h"
+
+#include "GPU_batch.h"
+
+#include "draw_cache_impl.h" /* own include */
+
+static void pointcloud_batch_cache_clear(PointCloud *pointcloud);
+
+/* -- */
+/* PointCloud GPUBatch Cache */
+
+struct PointCloudBatchCache {
+  GPUVertBuf *pos;  /* Position and radius. */
+  GPUVertBuf *geom; /* Instanced geometry for each point in the cloud (small 
sphere). */
+  GPUIndexBuf *geom_indices;
+
+  GPUBatch *dots;
+  GPUBatch *surface;
+  GPUBatch **surface_per_mat;
+
+  /* settings to determine if cache is invalid */
+  bool is_dirty;
+
+  int mat_len;
+};
+
+/* GPUBatch cache management. */
+
+static PointCloudBatchCache *pointcloud_batch_cache_get(PointCloud *pointcloud)
+{
+  return static_cast(pointcloud->batch_cache);
+}
+
+static bool pointcloud_batch_cache_valid(PointCloud *pointcloud)
+{
+  PointCloudBatchCache *cache = pointcloud_batch_cache_get(pointcloud);
+
+  if (cache == NULL) {
+return false;
+  }
+  if (cache->mat_len != DRW_pointcloud_material_count_get(pointcloud)) {
+return false;
+  }
+  return cache->is_dirty == false;
+}
+
+static void pointcloud_batch_cache_init(PointCloud *pointcloud)
+{
+  PointCloudBatchCache *cache = pointcloud_batch_cache_get(pointcloud);
+
+  if (!cache) {
+cache = MEM_cnew(__func__);
+pointcloud->batch_cache = cache;
+  }
+  else {
+memset(cache, 0, sizeof(*cache));
+  }
+
+  cache->mat_len = DRW_pointcloud_material_count_get(pointcloud);
+  cache->surface_per_mat = static_cast(
+  MEM_callocN(sizeof(GPUBatch *) * cache->mat_len, __func__));
+
+  cache->is_dirty = false;
+}
+
+void DRW_pointcloud_batch_cache_validate(PointCloud *pointcloud)
+{
+  if (!pointcloud_batch_cache_valid(pointcloud)) {
+pointcloud_batch_cache_clear(pointcloud);
+pointcloud_batch_cache_init(pointcloud);
+  }
+}
+
+void DRW_pointcloud_batch_cache_dirty_tag(PointCloud *pointcloud, int mode)
+{
+  PointCloudBatchCache *cache = pointcloud_batch_cache_get(pointcloud);
+  if (cache == NULL) {
+return;
+  }
+  switch (mode) {
+case BKE_POINTCLOUD_BATCH_DIRTY_ALL:
+  cache->is_dirty = true;
+  break;
+default:
+  BLI_assert(0);
+  }
+}
+
+static void pointcloud_batch_cache_clear(PointCloud *pointcloud)
+{
+  PointCloudBatchCache *cache = pointcloud_batch_cache_get(pointcloud);
+  if (!cache) {
+return;
+  }
+
+  GPU_BATCH_DISCARD_SAFE(cache->dots);
+  GPU_BATCH_DISCARD_SAFE(cache->surface);
+  GPU_VERTBUF_DISCARD_SAFE(cache->pos);
+  GPU_VERTBUF_DISCARD_SAFE(cache->geom);
+  GPU_INDEXBUF_DISCARD_SAFE(cache->geom_indices);
+
+  if (cache->surface_per_mat) {
+for (int i = 0; i < cache->mat_len; i++) {
+  GPU_BATCH_DISCARD_SAFE(cache->surface_per_mat[i]);
+}
+  }
+  MEM_SAFE_FREE(cache->surface_per_mat);
+}
+
+void DRW_pointcloud_batch_cache_free(PointCloud *pointcloud)
+{
+  pointcloud_batch_cache_clear(pointcloud);
+  MEM_SAFE_FREE(pointcloud->batch_cache);
+}
+
+static void pointcloud_batch_cache_ensure_pos(Object *ob, PointCloudBatchCache 
*cache)
+{
+  if (cache->pos != NULL) {
+return;
+  }
+
+  PointCloud *pointcloud = static_cast(ob->data);
+  const float(*positions)[3] = 

[Bf-blender-cvs] [d832d993c5b] master: Cycles: add new Spectrum and PackedSpectrum types

2022-08-09 Thread Andrii Symkin
Commit: d832d993c5b47b0de7ca24914ad9c064607830c7
Author: Andrii Symkin
Date:   Fri Jul 29 13:41:37 2022 +0200
Branches: master
https://developer.blender.org/rBd832d993c5b47b0de7ca24914ad9c064607830c7

Cycles: add new Spectrum and PackedSpectrum types

These replace float3 and packed_float3 in various places in the kernel where a
spectral color representation will be used in the future. That representation
will require more than 3 channels and conversion to from/RGB. The kernel code
was refactored to remove the assumption that Spectrum and RGB colors are the
same thing.

There are no functional changes, Spectrum is still a float3 and the conversion
functions are no-ops.

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

===

M   .clang-format
M   intern/cycles/kernel/CMakeLists.txt
M   intern/cycles/kernel/bake/bake.h
M   intern/cycles/kernel/closure/alloc.h
M   intern/cycles/kernel/closure/bsdf.h
M   intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
M   intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h
M   intern/cycles/kernel/closure/bsdf_diffuse.h
M   intern/cycles/kernel/closure/bsdf_diffuse_ramp.h
M   intern/cycles/kernel/closure/bsdf_hair.h
M   intern/cycles/kernel/closure/bsdf_hair_principled.h
M   intern/cycles/kernel/closure/bsdf_microfacet.h
M   intern/cycles/kernel/closure/bsdf_microfacet_multi.h
M   intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h
M   intern/cycles/kernel/closure/bsdf_oren_nayar.h
M   intern/cycles/kernel/closure/bsdf_phong_ramp.h
M   intern/cycles/kernel/closure/bsdf_principled_diffuse.h
M   intern/cycles/kernel/closure/bsdf_principled_sheen.h
M   intern/cycles/kernel/closure/bsdf_reflection.h
M   intern/cycles/kernel/closure/bsdf_refraction.h
M   intern/cycles/kernel/closure/bsdf_toon.h
M   intern/cycles/kernel/closure/bsdf_transparent.h
M   intern/cycles/kernel/closure/bsdf_util.h
M   intern/cycles/kernel/closure/bssrdf.h
M   intern/cycles/kernel/closure/emissive.h
M   intern/cycles/kernel/closure/volume.h
M   intern/cycles/kernel/film/accumulate.h
M   intern/cycles/kernel/film/passes.h
M   intern/cycles/kernel/film/write_passes.h
M   intern/cycles/kernel/integrator/mnee.h
M   intern/cycles/kernel/integrator/path_state.h
M   intern/cycles/kernel/integrator/shade_background.h
M   intern/cycles/kernel/integrator/shade_light.h
M   intern/cycles/kernel/integrator/shade_shadow.h
M   intern/cycles/kernel/integrator/shade_surface.h
M   intern/cycles/kernel/integrator/shade_volume.h
M   intern/cycles/kernel/integrator/shader_eval.h
M   intern/cycles/kernel/integrator/shadow_catcher.h
M   intern/cycles/kernel/integrator/shadow_state_template.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
M   intern/cycles/kernel/light/sample.h
M   intern/cycles/kernel/osl/background.cpp
M   intern/cycles/kernel/osl/bsdf_diffuse_ramp.cpp
M   intern/cycles/kernel/osl/bsdf_phong_ramp.cpp
M   intern/cycles/kernel/osl/bssrdf.cpp
M   intern/cycles/kernel/osl/closures.cpp
M   intern/cycles/kernel/osl/closures.h
M   intern/cycles/kernel/osl/emissive.cpp
M   intern/cycles/kernel/svm/closure.h
M   intern/cycles/kernel/types.h
M   intern/cycles/kernel/util/color.h
M   intern/cycles/util/CMakeLists.txt
M   intern/cycles/util/defines.h
M   intern/cycles/util/math.h
M   intern/cycles/util/types.h
A   intern/cycles/util/types_spectrum.h

===

diff --git a/.clang-format b/.clang-format
index 7b8e0ef8eba..7e88e6d1cb1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -266,6 +266,7 @@ ForEachMacros:
   - MAP_SLOT_PROBING_BEGIN
   - VECTOR_SET_SLOT_PROBING_BEGIN
   - WL_ARRAY_FOR_EACH
+  - FOREACH_SPECTRUM_CHANNEL
 
 StatementMacros:
   - PyObject_HEAD
diff --git a/intern/cycles/kernel/CMakeLists.txt 
b/intern/cycles/kernel/CMakeLists.txt
index 3f857be0dfa..8b8ad1758ca 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -342,6 +342,7 @@ set(SRC_UTIL_HEADERS
   ../util/types_int3_impl.h
   ../util/types_int4.h
   ../util/types_int4_impl.h
+  ../util/types_spectrum.h
   ../util/types_uchar2.h
   ../util/types_uchar2_impl.h
   ../util/types_uchar3.h
diff --git a/intern/cycles/kernel/bake/bake.h b/intern/cycles/kernel/bake/bake.h
index ec87990b699..9d53d71b431 100644
--- a/intern/cycles/kernel/bake/bake.h
+++ b/intern/cycles/kernel/bake/bake.h
@@ -8,6 +8,8 @@
 
 #include "kernel/geom/geom.h"
 
+#include "kernel/util/color.h"
+
 CCL_NAMESPACE_BEGIN
 
 ccl_device void kernel_displace_evaluate(KernelGlobals kg,
@@ -65,7 +67,7 @@ 

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

2022-08-09 Thread Sergey Sharybin
Commit: 7921faa6519b9eb9062269b5d9c003c64ead2b8b
Author: Sergey Sharybin
Date:   Tue Aug 9 16:45:28 2022 +0200
Branches: master
https://developer.blender.org/rB7921faa6519b9eb9062269b5d9c003c64ead2b8b

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] [96447402309] blender-v3.3-release: Fix T99949: Crash when last input from File Output node is deleted

2022-08-09 Thread Sergey Sharybin
Commit: 96447402309ae79bdca92a0c40c49a4861596081
Author: Sergey Sharybin
Date:   Tue Aug 9 16:44:36 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB96447402309ae79bdca92a0c40c49a4861596081

Fix T99949: Crash when last input from File Output node is deleted

Regression since e4278b72bb1a.

Need to check inputs exist prior to requesting first input as it
might not exist.

===

M   source/blender/compositor/nodes/COM_OutputFileNode.cc

===

diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.cc 
b/source/blender/compositor/nodes/COM_OutputFileNode.cc
index f69511d88e6..a62d21bb657 100644
--- a/source/blender/compositor/nodes/COM_OutputFileNode.cc
+++ b/source/blender/compositor/nodes/COM_OutputFileNode.cc
@@ -37,6 +37,10 @@ void OutputFileNode::map_input_sockets(NodeConverter 
,
 
 void OutputFileNode::add_preview_to_first_linked_input(NodeConverter 
) const
 {
+  if (get_input_sockets().is_empty()) {
+return;
+  }
+
   NodeInput *first_socket = this->get_input_socket(0);
   if (first_socket->is_linked()) {
 converter.add_node_input_preview(first_socket);

___
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] [1988665c3c3] master: Cleanup: make vector types make/print functions consistent between CPU and GPU

2022-08-09 Thread Brecht Van Lommel
Commit: 1988665c3c310cbfb66b4e499408fa48c522545c
Author: Brecht Van Lommel
Date:   Fri Jul 29 14:40:50 2022 +0200
Branches: master
https://developer.blender.org/rB1988665c3c310cbfb66b4e499408fa48c522545c

Cleanup: make vector types make/print functions consistent between CPU and GPU

Now all the same ones are available on CPU and GPU, which was previously not
possible due to lack of operator overloadng in OpenCL. Print functions are
no-ops on some GPUs.

Ref D15535

===

M   intern/cycles/kernel/device/metal/compat.h
M   intern/cycles/util/types.h
M   intern/cycles/util/types_float2.h
M   intern/cycles/util/types_float2_impl.h
M   intern/cycles/util/types_float3.h
M   intern/cycles/util/types_float3_impl.h
M   intern/cycles/util/types_float4.h
M   intern/cycles/util/types_float4_impl.h
M   intern/cycles/util/types_int3.h
M   intern/cycles/util/types_int3_impl.h
M   intern/cycles/util/types_int4.h
M   intern/cycles/util/types_int4_impl.h

===

diff --git a/intern/cycles/kernel/device/metal/compat.h 
b/intern/cycles/kernel/device/metal/compat.h
index 80ee8ef5b57..b20cfca9a9c 100644
--- a/intern/cycles/kernel/device/metal/compat.h
+++ b/intern/cycles/kernel/device/metal/compat.h
@@ -189,35 +189,46 @@ void kernel_gpu_##name::run(thread MetalKernelContext& 
context, \
   } volume_write_lambda_pass{kg, this, state};
 
 /* make_type definitions with Metal style element initializers */
-#ifdef make_float2
-#  undef make_float2
-#endif
-#ifdef make_float3
-#  undef make_float3
-#endif
-#ifdef make_float4
-#  undef make_float4
-#endif
-#ifdef make_int2
-#  undef make_int2
-#endif
-#ifdef make_int3
-#  undef make_int3
-#endif
-#ifdef make_int4
-#  undef make_int4
-#endif
-#ifdef make_uchar4
-#  undef make_uchar4
-#endif
-
-#define make_float2(x, y) float2(x, y)
-#define make_float3(x, y, z) float3(x, y, z)
-#define make_float4(x, y, z, w) float4(x, y, z, w)
-#define make_int2(x, y) int2(x, y)
-#define make_int3(x, y, z) int3(x, y, z)
-#define make_int4(x, y, z, w) int4(x, y, z, w)
-#define make_uchar4(x, y, z, w) uchar4(x, y, z, w)
+ccl_device_forceinline float2 make_float2(const float x, const float y)
+{
+  return float2(x, y);
+}
+
+ccl_device_forceinline float3 make_float3(const float x, const float y, const 
float z)
+{
+  return float3(x, y, z);
+}
+
+ccl_device_forceinline float4 make_float4(const float x,
+  const float y,
+  const float z,
+  const float w)
+{
+  return float4(x, y, z, w);
+}
+
+ccl_device_forceinline int2 make_int2(const int x, const int y)
+{
+  return int2(x, y);
+}
+
+ccl_device_forceinline int3 make_int3(const int x, const int y, const int z)
+{
+  return int3(x, y, z);
+}
+
+ccl_device_forceinline int4 make_int4(const int x, const int y, const int z, 
const int w)
+{
+  return int4(x, y, z, w);
+}
+
+ccl_device_forceinline uchar4 make_uchar4(const uchar x,
+  const uchar y,
+  const uchar z,
+  const uchar w)
+{
+  return uchar4(x, y, z, w);
+}
 
 /* Math functions */
 
diff --git a/intern/cycles/util/types.h b/intern/cycles/util/types.h
index 26031d9e0fd..d0d8c2941d7 100644
--- a/intern/cycles/util/types.h
+++ b/intern/cycles/util/types.h
@@ -71,6 +71,18 @@ ccl_device_inline bool is_power_of_two(size_t x)
 
 CCL_NAMESPACE_END
 
+/* Device side printf only tested on CUDA, may work on more GPU devices. */
+#if !defined(__KERNEL_GPU__) || defined(__KERNEL_CUDA__)
+#  define __KERNEL_PRINTF__
+#endif
+
+ccl_device_inline void print_float(ccl_private const char *label, const float 
a)
+{
+#ifdef __KERNEL_PRINTF__
+  printf("%s: %.8f\n", label, (double)a);
+#endif
+}
+
 /* Most GPU APIs matching native vector types, so we only need to implement 
them for
  * CPU and oneAPI. */
 #if defined(__KERNEL_GPU__) && !defined(__KERNEL_ONEAPI__)
diff --git a/intern/cycles/util/types_float2.h 
b/intern/cycles/util/types_float2.h
index f37aa1b4ad2..ea510ef832c 100644
--- a/intern/cycles/util/types_float2.h
+++ b/intern/cycles/util/types_float2.h
@@ -20,7 +20,8 @@ struct float2 {
 };
 
 ccl_device_inline float2 make_float2(float x, float y);
-ccl_device_inline void print_float2(const char *label, const float2 );
 #endif /* __KERNEL_NATIVE_VECTOR_TYPES__ */
 
+ccl_device_inline void print_float2(ccl_private const char *label, const 
float2 a);
+
 CCL_NAMESPACE_END
diff --git a/intern/cycles/util/types_float2_impl.h 
b/intern/cycles/util/types_float2_impl.h
index 9d1820fe17d..7ba7dee2e3a 100644
--- a/intern/cycles/util/types_float2_impl.h
+++ b/intern/cycles/util/types_float2_impl.h
@@ -31,11 +31,13 @@ ccl_device_inline float2 make_float2(float x, float y)
   float2 a = {x, y};
   return a;
 }

[Bf-blender-cvs] [9990792e872] master: Compositor: Rename compositor build option

2022-08-09 Thread Omar Emara
Commit: 9990792e87238386375c97f431f648c1334bd587
Author: Omar Emara
Date:   Tue Aug 9 15:59:56 2022 +0200
Branches: master
https://developer.blender.org/rB9990792e87238386375c97f431f648c1334bd587

Compositor: Rename compositor build option

Currently, the compositor can be disabled using the WITH_COMPOSITOR
build option. Since, we intent to always build the realtime compositor,
we need to make the distinction between both compositors clear.

So this patch renames the option to WITH_COMPOSITOR_CPU. Additionally,
the check for the option was moved inside the compositor modules' own
CMake file in preparation for the realtime compositor code.

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

Reviewed By: Jeroen Bakker, Ray Molenkamp

===

M   CMakeLists.txt
M   build_files/cmake/config/blender_full.cmake
M   build_files/cmake/config/blender_lite.cmake
M   build_files/cmake/config/blender_release.cmake
M   extern/CMakeLists.txt
M   source/blender/CMakeLists.txt
M   source/blender/compositor/CMakeLists.txt
M   source/blender/editors/space_node/CMakeLists.txt
M   source/blender/nodes/composite/CMakeLists.txt
M   source/blender/nodes/composite/node_composite_tree.cc
M   source/blender/python/intern/CMakeLists.txt
M   source/blender/python/intern/bpy_app_build_options.c
M   source/blender/windowmanager/CMakeLists.txt
M   source/blender/windowmanager/intern/wm_init_exit.c
M   tests/python/CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6abb430d523..9ac3e379f5e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -196,7 +196,7 @@ endif()
 option(WITH_GMP "Enable features depending on GMP (Exact Boolean)" ON)
 
 # Compositor
-option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
+option(WITH_COMPOSITOR_CPU "Enable the tile based CPU nodal compositor" ON)
 option(WITH_OPENIMAGEDENOISE   "Enable the OpenImageDenoise compositing node" 
ON)
 
 option(WITH_OPENSUBDIV"Enable OpenSubdiv for surface subdivision" ON)
diff --git a/build_files/cmake/config/blender_full.cmake 
b/build_files/cmake/config/blender_full.cmake
index e09577ac802..27577a9fbf7 100644
--- a/build_files/cmake/config/blender_full.cmake
+++ b/build_files/cmake/config/blender_full.cmake
@@ -13,7 +13,7 @@ set(WITH_BULLET  ON  CACHE BOOL "" FORCE)
 set(WITH_CODEC_AVI   ON  CACHE BOOL "" FORCE)
 set(WITH_CODEC_FFMPEGON  CACHE BOOL "" FORCE)
 set(WITH_CODEC_SNDFILE   ON  CACHE BOOL "" FORCE)
-set(WITH_COMPOSITOR  ON  CACHE BOOL "" FORCE)
+set(WITH_COMPOSITOR_CPU  ON  CACHE BOOL "" FORCE)
 set(WITH_CYCLES  ON  CACHE BOOL "" FORCE)
 set(WITH_CYCLES_EMBREE   ON  CACHE BOOL "" FORCE)
 set(WITH_CYCLES_OSL  ON  CACHE BOOL "" FORCE)
diff --git a/build_files/cmake/config/blender_lite.cmake 
b/build_files/cmake/config/blender_lite.cmake
index 5ce344d39e8..c98dfe27285 100644
--- a/build_files/cmake/config/blender_lite.cmake
+++ b/build_files/cmake/config/blender_lite.cmake
@@ -18,7 +18,7 @@ set(WITH_BULLET  OFF CACHE BOOL "" FORCE)
 set(WITH_CODEC_AVI   OFF CACHE BOOL "" FORCE)
 set(WITH_CODEC_FFMPEGOFF CACHE BOOL "" FORCE)
 set(WITH_CODEC_SNDFILE   OFF CACHE BOOL "" FORCE)
-set(WITH_COMPOSITOR  OFF CACHE BOOL "" FORCE)
+set(WITH_COMPOSITOR_CPU  OFF CACHE BOOL "" FORCE)
 set(WITH_COREAUDIO   OFF CACHE BOOL "" FORCE)
 set(WITH_CYCLES  OFF CACHE BOOL "" FORCE)
 set(WITH_DRACO   OFF CACHE BOOL "" FORCE)
diff --git a/build_files/cmake/config/blender_release.cmake 
b/build_files/cmake/config/blender_release.cmake
index 2567e0b444a..3661b1de805 100644
--- a/build_files/cmake/config/blender_release.cmake
+++ b/build_files/cmake/config/blender_release.cmake
@@ -14,7 +14,7 @@ set(WITH_BULLET  ON  CACHE BOOL "" FORCE)
 set(WITH_CODEC_AVI   ON  CACHE BOOL "" FORCE)
 set(WITH_CODEC_FFMPEGON  CACHE BOOL "" FORCE)
 set(WITH_CODEC_SNDFILE   ON  CACHE BOOL "" FORCE)
-set(WITH_COMPOSITOR  ON  CACHE BOOL "" FORCE)
+set(WITH_COMPOSITOR_CPU  ON  CACHE BOOL "" FORCE)
 set(WITH_CYCLES  ON  CACHE BOOL "" FORCE)
 set(WITH_CYCLES_EMBREE   ON  CACHE BOOL "" FORCE)
 set(WITH_CYCLES_OSL  ON  CACHE BOOL "" FORCE)
diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt
index 35da67d05a4..4da9631d395 100644
--- a/extern/CMakeLists.txt
+++ b/extern/CMakeLists.txt
@@ -48,7 +48,7 @@ if(WITH_LZMA)
   add_subdirectory(lzma)
 endif()
 
-if(WITH_CYCLES OR WITH_COMPOSITOR OR WITH_OPENSUBDIV)
+if(WITH_CYCLES OR WITH_COMPOSITOR_CPU OR WITH_OPENSUBDIV)
   add_subdirectory(clew)
   if((WITH_CYCLES_DEVICE_CUDA OR WITH_CYCLES_DEVICE_OPTIX) AND 
WITH_CUDA_DYNLOAD)
 add_subdirectory(cuew)
@@ -96,6 +96,6 @@ if(WITH_MOD_FLUID)
   add_subdirectory(mantaflow)

[Bf-blender-cvs] [cefd6140f32] blender-v3.3-release: Fix T100119: Cycles light object's parametric vector distorted

2022-08-09 Thread Sergey Sharybin
Commit: cefd6140f322250d630f4d845fe5bdb013c00ddc
Author: Sergey Sharybin
Date:   Mon Aug 1 16:07:10 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rBcefd6140f322250d630f4d845fe5bdb013c00ddc

Fix T100119: Cycles light object's parametric vector distorted

Caused by 38af5b050100.

Adjust barycentric coordinates used for intersection result in the
ray-to-rectangle intersection check.

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

===

M   intern/cycles/util/math_intersect.h

===

diff --git a/intern/cycles/util/math_intersect.h 
b/intern/cycles/util/math_intersect.h
index 37bdc5f1ccf..cc07cbe7745 100644
--- a/intern/cycles/util/math_intersect.h
+++ b/intern/cycles/util/math_intersect.h
@@ -209,10 +209,13 @@ ccl_device bool ray_quad_intersect(float3 ray_P,
 *isect_P = hit;
   if (isect_t != NULL)
 *isect_t = t;
+
+  /* NOTE: Return barycentric coordinates in the same notation as Embree and 
OptiX. */
   if (isect_u != NULL)
-*isect_u = u + 0.5f;
+*isect_u = v + 0.5f;
   if (isect_v != NULL)
-*isect_v = v + 0.5f;
+*isect_v = -u - v;
+
   return true;
 }

___
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] [f1ce79c7333] temp-eevee-next-cryptomatte: Eevee: Cryptomatte sync meshes.

2022-08-09 Thread Jeroen Bakker
Commit: f1ce79c7333cec9bb97c4afb3414c72739f915a9
Author: Jeroen Bakker
Date:   Tue Aug 9 00:50:51 2022 +0200
Branches: temp-eevee-next-cryptomatte
https://developer.blender.org/rBf1ce79c7333cec9bb97c4afb3414c72739f915a9

Eevee: Cryptomatte sync meshes.

===

M   source/blender/draw/engines/eevee_next/eevee_cryptomatte.cc
M   source/blender/draw/engines/eevee_next/eevee_cryptomatte.hh
M   source/blender/draw/engines/eevee_next/eevee_sync.cc

===

diff --git a/source/blender/draw/engines/eevee_next/eevee_cryptomatte.cc 
b/source/blender/draw/engines/eevee_next/eevee_cryptomatte.cc
index a611a9f57e5..5207d588d44 100644
--- a/source/blender/draw/engines/eevee_next/eevee_cryptomatte.cc
+++ b/source/blender/draw/engines/eevee_next/eevee_cryptomatte.cc
@@ -1,3 +1,7 @@
+#include "BKE_cryptomatte.h"
+
+#include "GPU_material.h"
+
 #include "eevee_cryptomatte.hh"
 #include "eevee_instance.hh"
 #include "eevee_renderbuffers.hh"
@@ -29,6 +33,91 @@ void Cryptomatte::sync()
   hair_grp_ = DRW_shgroup_create(sh_curves, cryptomatte_ps_);
 }
 
+static float hash_id(const ID *id)
+{
+  const char *name = >name[2];
+  const int name_len = BLI_strnlen(name, MAX_NAME - 2);
+  uint32_t cryptomatte_hash = BKE_cryptomatte_hash(name, name_len);
+  return BKE_cryptomatte_hash_to_float(cryptomatte_hash);
+}
+
+void Cryptomatte::add_hash(const Object *object, float4 _hash) const
+{
+  if (object_offset_ != -1) {
+r_hash[object_offset_] = hash_id(>id);
+  }
+
+  if (asset_offset_ != -1) {
+const Object *asset_object = object;
+while (asset_object->parent != nullptr) {
+  asset_object = asset_object->parent;
+}
+r_hash[asset_offset_] = hash_id(_object->id);
+  }
+}
+
+void Cryptomatte::add_hash(const ::Material *mat, float4 _hash) const
+{
+  if (material_offset_ != -1) {
+r_hash[material_offset_] = mat ? hash_id(>id) : 0.0f;
+  }
+}
+
+void Cryptomatte::sync_mesh(Object *ob)
+{
+  if (layer_len_ == 0) {
+return;
+  }
+
+  float4 hash(0.0f, 0.0f, 0.0f, 0.0f);
+  add_hash(ob, hash);
+
+  // TODO(jbakker): decide based on availability of surface geom if we should 
have an optimzied
+  // path, or that it has more overhead (memory)
+  if (material_offset_ == -1) {
+GPUBatch *geom = DRW_cache_object_surface_get(ob);
+if (geom) {
+  DRWShadingGroup *grp = DRW_shgroup_create_sub(mesh_grp_);
+  DRW_shgroup_uniform_vec4_copy(grp, "cryptomatte_hash", hash);
+  DRW_shgroup_call(grp, geom, ob);
+}
+  }
+  else {
+bool has_motion = false;
+// TODO:  inst_.velocity.step_object_sync(ob, ob_handle.object_key,
+// ob_handle.recalc);
+
+MaterialArray _array = inst_.materials.material_array_get(ob, 
has_motion);
+
+GPUBatch **mat_geom = DRW_cache_object_surface_material_get(
+ob, material_array.gpu_materials.data(), 
material_array.gpu_materials.size());
+
+if (mat_geom == nullptr) {
+  return;
+}
+
+for (auto i : material_array.gpu_materials.index_range()) {
+  GPUBatch *geom = mat_geom[i];
+  if (geom == nullptr) {
+continue;
+  }
+  const ::Material *material = 
GPU_material_get_material(material_array.gpu_materials[i]);
+  add_hash(material, hash);
+  DRWShadingGroup *grp = DRW_shgroup_create_sub(mesh_grp_);
+  DRW_shgroup_uniform_vec4_copy(grp, "cryptomatte_hash", hash);
+  DRW_shgroup_call(grp, geom, ob);
+}
+  }
+}
+
+void Cryptomatte::sync_curves(Object *ob, ModifierData *modifier_data)
+{
+  if (layer_len_ == 0) {
+return;
+  }
+  BLI_assert_msg(false, "Not implemented yet");
+}
+
 void Cryptomatte::render()
 {
   if (layer_len_ == 0) {
diff --git a/source/blender/draw/engines/eevee_next/eevee_cryptomatte.hh 
b/source/blender/draw/engines/eevee_next/eevee_cryptomatte.hh
index 578eea77fe8..ea533c51cff 100644
--- a/source/blender/draw/engines/eevee_next/eevee_cryptomatte.hh
+++ b/source/blender/draw/engines/eevee_next/eevee_cryptomatte.hh
@@ -17,6 +17,10 @@
 
 #include "eevee_shader_shared.hh"
 
+extern "C" {
+struct Material;
+}
+
 namespace blender::eevee {
 
 class Instance;
@@ -52,8 +56,14 @@ class Cryptomatte {
   void init();
 
   void sync();
-  void object_sync(Object *ob);
+  void sync_mesh(Object *ob);
+  void sync_curves(Object *object, ModifierData *modifier_data);
+  void sync_gpencil();  // TODO
   void render();
+
+ private:
+  void add_hash(const Object *object, float4 _hash) const;
+  void add_hash(const Material *material, float4 _hash) const;
 };
 
 /** \} */
diff --git a/source/blender/draw/engines/eevee_next/eevee_sync.cc 
b/source/blender/draw/engines/eevee_next/eevee_sync.cc
index e2d4b0ac1c2..2abc4bcda95 100644
--- a/source/blender/draw/engines/eevee_next/eevee_sync.cc
+++ b/source/blender/draw/engines/eevee_next/eevee_sync.cc
@@ -131,6 +131,7 @@ void SyncModule::sync_mesh(Object *ob, ObjectHandle 
_handle)
 is_alpha_blend = 

[Bf-blender-cvs] [f4371a6b89a] temp-eevee-next-cryptomatte: Eevee-next: Cryptomatte WIP shader.

2022-08-09 Thread Jeroen Bakker
Commit: f4371a6b89ae3bcdc6624c4040b5c6bc59424c5c
Author: Jeroen Bakker
Date:   Tue Aug 9 14:35:58 2022 +0200
Branches: temp-eevee-next-cryptomatte
https://developer.blender.org/rBf4371a6b89ae3bcdc6624c4040b5c6bc59424c5c

Eevee-next: Cryptomatte WIP shader.

===

M   source/blender/draw/CMakeLists.txt
A   
source/blender/draw/engines/eevee_next/shaders/eevee_cryptomatte_lib.glsl
M   source/blender/draw/engines/eevee_next/shaders/eevee_film_lib.glsl

===

diff --git a/source/blender/draw/CMakeLists.txt 
b/source/blender/draw/CMakeLists.txt
index 81dfb5b8f91..27809c1c4d1 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -366,6 +366,7 @@ set(GLSL_SRC
   engines/eevee_next/shaders/eevee_camera_lib.glsl
   engines/eevee_next/shaders/eevee_colorspace_lib.glsl
   engines/eevee_next/shaders/eevee_cryptomatte_frag.glsl
+  engines/eevee_next/shaders/eevee_cryptomatte_lib.glsl
   engines/eevee_next/shaders/eevee_depth_of_field_accumulator_lib.glsl
   engines/eevee_next/shaders/eevee_depth_of_field_bokeh_lut_comp.glsl
   engines/eevee_next/shaders/eevee_depth_of_field_downsample_comp.glsl
diff --git 
a/source/blender/draw/engines/eevee_next/shaders/eevee_cryptomatte_lib.glsl 
b/source/blender/draw/engines/eevee_next/shaders/eevee_cryptomatte_lib.glsl
new file mode 100644
index 000..2f2a9b2ee74
--- /dev/null
+++ b/source/blender/draw/engines/eevee_next/shaders/eevee_cryptomatte_lib.glsl
@@ -0,0 +1,14 @@
+/** Storing/merging and sorting cryptomatte samples. */
+
+void film_store_cryptomatte_sample(FilmSample dst, int cryptomatte_layer_id, 
float hash){
+float weight = dst.weight;
+/*
+first need to detect the operation.
+- when hash exists it should be updated and can optionally be moved to 
a new position.
+- when hash doesn't exist we should find an insertion point. only 
samples to a null sample (hash 0, weight 0) should be moved. When no null 
sample exist it will remove the lowest weight.
+  
+*/
+int operation = 0;
+
+
+}
diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_film_lib.glsl 
b/source/blender/draw/engines/eevee_next/shaders/eevee_film_lib.glsl
index bf6293d5561..bd802eb62ab 100644
--- a/source/blender/draw/engines/eevee_next/shaders/eevee_film_lib.glsl
+++ b/source/blender/draw/engines/eevee_next/shaders/eevee_film_lib.glsl
@@ -8,6 +8,7 @@
 #pragma BLENDER_REQUIRE(eevee_camera_lib.glsl)
 #pragma BLENDER_REQUIRE(eevee_velocity_lib.glsl)
 #pragma BLENDER_REQUIRE(eevee_colorspace_lib.glsl)
+#pragma BLENDER_REQUIRE(eevee_cryptomatte_lib.glsl)
 
 /* Return scene linear Z depth from the camera or radial depth for panoramic 
cameras. */
 float film_depth_convert_to_scene(float depth)
@@ -687,4 +688,23 @@ void film_process_data(ivec2 texel_film, out vec4 
out_color, out float out_depth
 }
 film_store_value(dst, film_buf.aov_value_id + aov, aov_accum, out_color);
   }
+
+  if (film_buf.cryptomatte_samples_len != 0) {
+vec4 hashes = texelFetch(cryptomatte_tx, dst.texel, 0);
+if (film_buf.cryptomatte_object_id != -1) {
+  float hash = hashes.x;
+  hashes = hashes.yzww;
+  film_store_cryptomatte_sample(dst, film_buf.cryptomatte_object_id, hash);
+} 
+if (film_buf.cryptomatte_asset_id != -1) {
+  float hash = hashes.x;
+  hashes = hashes.yzww;
+  film_store_cryptomatte_sample(dst, film_buf.cryptomatte_asset_id, hash);
+} 
+if (film_buf.cryptomatte_material_id != -1) {
+  float hash = hashes.x;
+  hashes = hashes.yzww;
+  film_store_cryptomatte_sample(dst, film_buf.cryptomatte_material_id, 
hash);
+} 
+  }
 }

___
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] [af59e32c132] master: I18n: make more parts of the UI translatable

2022-08-09 Thread Damien Picard
Commit: af59e32c1320b02fe29806ebfecbbdf1a9bf71b7
Author: Damien Picard
Date:   Tue Aug 9 12:42:16 2022 +0200
Branches: master
https://developer.blender.org/rBaf59e32c1320b02fe29806ebfecbbdf1a9bf71b7

I18n: make more parts of the UI translatable

- "Name collisions" label in mesh properties
- "Threshold" labels in Vertex Weight Edit modifier
- "Particle System" label in Particle Instance modifier
- Slot number in the Shader Editor

- Status bar keymap items during modal operations:
  add TIP_() macro to status bar interface template

- On dumping messages, sort preset files so their messages are stable
  between runs

Ref. T43295

Reviewed By: mont29

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

===

M   release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
M   release/scripts/startup/bl_ui/properties_data_mesh.py
M   release/scripts/startup/bl_ui/space_node.py
M   source/blender/editors/interface/interface_templates.c
M   source/blender/modifiers/intern/MOD_particleinstance.c
M   source/blender/modifiers/intern/MOD_weightvgedit.c

===

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 a44b3ac132b..9f22b2417ed 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
@@ -876,7 +876,7 @@ def dump_preset_messages(msgs, reports, settings):
 except ValueError:
 rel_path = path
 files.append(rel_path)
-for rel_path in files:
+for rel_path in sorted(files):
 msgsrc, msgid = os.path.split(rel_path)
 msgsrc = "Preset from " + msgsrc
 msgid = bpy.path.display_name(msgid, title_case=False)
diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py 
b/release/scripts/startup/bl_ui/properties_data_mesh.py
index 80b9b773d9b..8f2141ba6fc 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -3,6 +3,8 @@ import bpy
 from bpy.types import Menu, Panel, UIList
 from rna_prop_ui import PropertyPanel
 
+from bpy.app.translations import pgettext_tip as tip_
+
 
 class MESH_MT_vertex_group_context_menu(Menu):
 bl_label = "Vertex Group Specials"
@@ -592,7 +594,7 @@ class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel):
 if not colliding_names:
 return
 
-layout.label(text="Name collisions: " + ", 
".join(set(colliding_names)), icon='ERROR')
+layout.label(text=tip_("Name collisions: ") + ", 
".join(set(colliding_names)), icon='ERROR')
 
 
 class ColorAttributesListBase():
diff --git a/release/scripts/startup/bl_ui/space_node.py 
b/release/scripts/startup/bl_ui/space_node.py
index 427d0696c20..dab06cc4993 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -375,8 +375,8 @@ class NODE_PT_material_slots(Panel):
 def draw_header(self, context):
 ob = context.object
 self.bl_label = (
-"Slot " + str(ob.active_material_index + 1) if ob.material_slots 
else
-"Slot"
+iface_("Slot %d") % (ob.active_material_index + 1) if 
ob.material_slots else
+iface_("Slot")
 )
 
 # Duplicate part of 'EEVEE_MATERIAL_PT_context_material'.
diff --git a/source/blender/editors/interface/interface_templates.c 
b/source/blender/editors/interface/interface_templates.c
index f566299960a..cb3d0923348 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -6458,13 +6458,13 @@ bool uiTemplateEventFromKeymapItem(struct uiLayout 
*layout,
 for (int j = 0; j < ARRAY_SIZE(icon_mod) && icon_mod[j]; j++) {
   uiItemL(layout, "", icon_mod[j]);
 }
-uiItemL(layout, text, icon);
+uiItemL(layout, TIP_(text), icon);
 ok = true;
   }
   else if (text_fallback) {
 const char *event_text = WM_key_event_string(kmi->type, true);
 uiItemL(layout, event_text, ICON_NONE);
-uiItemL(layout, text, ICON_NONE);
+uiItemL(layout, TIP_(text), ICON_NONE);
 ok = true;
   }
   return ok;
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c 
b/source/blender/modifiers/intern/MOD_particleinstance.c
index 5018b2d1030..d6435c55211 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -553,7 +553,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel 
*panel)
"particle_system",
_obj_ptr,
"particle_systems",
-   "Particle System",
+   IFACE_("Particle System"),
ICON_NONE);
   }
   else {
diff --git 

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

2022-08-09 Thread Campbell Barton
Commit: be50d526ebc2d67c3888e18d10fcbf218537cd5b
Author: Campbell Barton
Date:   Tue Aug 9 21:07:50 2022 +1000
Branches: master
https://developer.blender.org/rBbe50d526ebc2d67c3888e18d10fcbf218537cd5b

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] [541f9dbfd21] master: Merge branch 'blender-v3.3-release'

2022-08-09 Thread Campbell Barton
Commit: 541f9dbfd21c55dcfacc2e729af01884c71f98f4
Author: Campbell Barton
Date:   Tue Aug 9 21:07:38 2022 +1000
Branches: master
https://developer.blender.org/rB541f9dbfd21c55dcfacc2e729af01884c71f98f4

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] [34c7f42c080] master: Merge branch 'blender-v3.3-release'

2022-08-09 Thread Campbell Barton
Commit: 34c7f42c080d9adcac3cd23b4f4813302305a81c
Author: Campbell Barton
Date:   Tue Aug 9 21:07:47 2022 +1000
Branches: master
https://developer.blender.org/rB34c7f42c080d9adcac3cd23b4f4813302305a81c

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] [8aa98d1043c] master: Merge branch 'blender-v3.3-release'

2022-08-09 Thread Campbell Barton
Commit: 8aa98d1043c1fc92ae77a89f0a3e6c1fe9d45579
Author: Campbell Barton
Date:   Tue Aug 9 21:07:41 2022 +1000
Branches: master
https://developer.blender.org/rB8aa98d1043c1fc92ae77a89f0a3e6c1fe9d45579

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] [a2bdd6a71aa] master: I18n: remove Window class from message extraction blacklist

2022-08-09 Thread Damien Picard
Commit: a2bdd6a71aafe565c0a7f5df5aa396d02f37aa62
Author: Damien Picard
Date:   Tue Aug 9 11:41:05 2022 +0200
Branches: master
https://developer.blender.org/rBa2bdd6a71aafe565c0a7f5df5aa396d02f37aa62

I18n: remove Window class from message extraction blacklist

Messages from the bpy.types.Window class were blacklisted in the
message extraction script.

This change allows a few new messages to be translated, including at
least two which show up in the UI. There are only 12 new messages in
the .po files, so even if some never need to be translated, that's not
too many.

Ref. T43295

Reviewed By: mont29

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

===

M   release/scripts/modules/bl_i18n_utils/bl_extract_messages.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 d7755532614..e4845215ff3 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
@@ -206,8 +206,6 @@ def dump_rna_messages(msgs, reports, settings, 
verbose=False):
 "Context", "Event", "Function", "UILayout", "UnknownType", 
"Property", "Struct",
 # registerable classes
 "Panel", "Menu", "Header", "RenderEngine", "Operator", 
"OperatorMacro", "Macro", "KeyingSetInfo",
-# window classes
-"Window",
 )
 }

___
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] [19b74f81209] master: Merge branch 'blender-v3.3-release'

2022-08-09 Thread Campbell Barton
Commit: 19b74f81209e8e9792b5e4e9dd7a3faa3545aeb7
Author: Campbell Barton
Date:   Tue Aug 9 21:07:44 2022 +1000
Branches: master
https://developer.blender.org/rB19b74f81209e8e9792b5e4e9dd7a3faa3545aeb7

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] [efc1d4bb9aa] master: WM Modal Keymaps: Add accessors to modal event values.

2022-08-09 Thread Bastien Montagne
Commit: efc1d4bb9aa3c2b55867d624670a125b9163cad8
Author: Bastien Montagne
Date:   Tue Aug 9 12:22:13 2022 +0200
Branches: master
https://developer.blender.org/rBefc1d4bb9aa3c2b55867d624670a125b9163cad8

WM Modal Keymaps: Add accessors to modal event values.

It is currently impossible to access modal keymaps' event values (from
`propvalue` enum) from python code (for API introspection).

This is needed for i18n messages extraction (see D15607).

Reviewed By: campbellbarton

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

===

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

===

diff --git a/source/blender/makesrna/intern/rna_wm.c 
b/source/blender/makesrna/intern/rna_wm.c
index 2009f51e1f2..ac1803b0a11 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -864,6 +864,21 @@ static void rna_Window_view_layer_set(PointerRNA *ptr,
   WM_window_set_active_view_layer(win, view_layer);
 }
 
+static void 
rna_KeyMap_modal_event_values_items_begin(CollectionPropertyIterator *iter,
+  PointerRNA *ptr)
+{
+  wmKeyMap *km = ptr->data;
+
+  const EnumPropertyItem *items = rna_enum_keymap_propvalue_items;
+  if ((km->flag & KEYMAP_MODAL) != 0 && km->modal_items != NULL) {
+items = km->modal_items;
+  }
+
+  const int totitem = RNA_enum_items_count(items);
+
+  rna_iterator_array_begin(iter, (void *)items, sizeof(EnumPropertyItem), 
totitem, false, NULL);
+}
+
 static PointerRNA rna_KeyMapItem_properties_get(PointerRNA *ptr)
 {
   wmKeyMapItem *kmi = ptr->data;
@@ -2617,6 +2632,23 @@ static void rna_def_keyconfig(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Children Expanded", "Children expanded in 
the user interface");
   RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
 
+  prop = RNA_def_property(srna, "modal_event_values", PROP_COLLECTION, 
PROP_NONE);
+  RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+  RNA_def_property_struct_type(prop, "EnumPropertyItem");
+  RNA_def_property_collection_funcs(prop,
+
"rna_KeyMap_modal_event_values_items_begin",
+"rna_iterator_array_next",
+"rna_iterator_array_end",
+"rna_iterator_array_get",
+NULL,
+NULL,
+NULL,
+NULL);
+  RNA_def_property_ui_text(prop,
+   "Modal Events",
+   "Give access to the possible event values of this 
modal keymap's items "
+   "(#KeyMapItem.propvalue), for API introspection");
+
   RNA_api_keymap(srna);
 
   /* KeyMapItem */

___
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] [2de1b062870] master: I18n: add extraction of modal event names.

2022-08-09 Thread Bastien Montagne
Commit: 2de1b06287023000850cfd969584fe0927327c5b
Author: Bastien Montagne
Date:   Tue Aug 9 12:22:30 2022 +0200
Branches: master
https://developer.blender.org/rB2de1b06287023000850cfd969584fe0927327c5b

I18n: add extraction of modal event names.

Alternative fix to the one proposed in D15607.

Reviewed By: campbellbarton

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

===

M   release/scripts/modules/bl_i18n_utils/bl_extract_messages.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 e4845215ff3..a44b3ac132b 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
@@ -359,12 +359,25 @@ def dump_rna_messages(msgs, reports, settings, 
verbose=False):
 
 walk_properties(cls)
 
+def walk_keymap_modal_events(keyconfigs, keymap_name, msgsrc_prev, 
km_i18n_context):
+for keyconfig in keyconfigs:
+keymap = keyconfig.keymaps.get(keymap_name, None)
+if keymap and keymap.is_modal:
+for modal_event in keymap.modal_event_values:
+msgsrc = msgsrc_prev + 
":'{}'".format(modal_event.identifier)
+if modal_event.name:
+process_msg(msgs, km_i18n_context, modal_event.name, 
msgsrc, reports, None, settings)
+if modal_event.description:
+process_msg(msgs, default_context, 
modal_event.description, msgsrc, reports, None, settings)
+
 def walk_keymap_hierarchy(hier, msgsrc_prev):
 km_i18n_context = bpy.app.translations.contexts.id_windowmanager
 for lvl in hier:
 msgsrc = msgsrc_prev + "." + lvl[1]
 if isinstance(lvl[0], str):  # Can be a function too, now, with 
tool system...
-process_msg(msgs, km_i18n_context, lvl[0], msgsrc, reports, 
None, settings)
+keymap_name = lvl[0]
+process_msg(msgs, km_i18n_context, keymap_name, msgsrc, 
reports, None, settings)
+
walk_keymap_modal_events(bpy.data.window_managers[0].keyconfigs, keymap_name, 
msgsrc, km_i18n_context)
 if lvl[3]:
 walk_keymap_hierarchy(lvl[3], msgsrc)

___
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] [7b0bc1573b0] blender-v3.3-release: Fix memory leak exporting to collada

2022-08-09 Thread Campbell Barton
Commit: 7b0bc1573b02198ec71f808fa1f6d1a2c6b79524
Author: Campbell Barton
Date:   Tue Aug 9 21:03:45 2022 +1000
Branches: blender-v3.3-release
https://developer.blender.org/rB7b0bc1573b02198ec71f808fa1f6d1a2c6b79524

Fix memory leak exporting to collada

===

M   source/blender/io/collada/EffectExporter.cpp

===

diff --git a/source/blender/io/collada/EffectExporter.cpp 
b/source/blender/io/collada/EffectExporter.cpp
index 71a54e3a7c9..40ce20617fc 100644
--- a/source/blender/io/collada/EffectExporter.cpp
+++ b/source/blender/io/collada/EffectExporter.cpp
@@ -46,6 +46,7 @@ EffectsExporter::EffectsExporter(COLLADASW::StreamWriter *sw,
 
 bool EffectsExporter::hasEffects(Scene *sce)
 {
+  bool result = false;
   FOREACH_SCENE_OBJECT_BEGIN (sce, ob) {
 int a;
 for (a = 0; a < ob->totcol; a++) {
@@ -56,11 +57,12 @@ bool EffectsExporter::hasEffects(Scene *sce)
 continue;
   }
 
-  return true;
+  result = true;
+  break;
 }
   }
   FOREACH_SCENE_OBJECT_END;
-  return false;
+  return result;
 }
 
 void EffectsExporter::exportEffects(bContext *C, Scene *sce)

___
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] [e1974ae30e4] blender-v3.3-release: I18n: make more parts of the UI translatable

2022-08-09 Thread Damien Picard
Commit: e1974ae30e468c678c496907f0234b835bdb6123
Author: Damien Picard
Date:   Tue Aug 9 12:42:16 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rBe1974ae30e468c678c496907f0234b835bdb6123

I18n: make more parts of the UI translatable

- "Name collisions" label in mesh properties
- "Threshold" labels in Vertex Weight Edit modifier
- "Particle System" label in Particle Instance modifier
- Slot number in the Shader Editor

- Status bar keymap items during modal operations:
  add TIP_() macro to status bar interface template

- On dumping messages, sort preset files so their messages are stable
  between runs

Ref. T43295

Reviewed By: mont29

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

===

M   release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
M   release/scripts/startup/bl_ui/properties_data_mesh.py
M   release/scripts/startup/bl_ui/space_node.py
M   source/blender/editors/interface/interface_templates.c
M   source/blender/modifiers/intern/MOD_particleinstance.c
M   source/blender/modifiers/intern/MOD_weightvgedit.c

===

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 a44b3ac132b..9f22b2417ed 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
@@ -876,7 +876,7 @@ def dump_preset_messages(msgs, reports, settings):
 except ValueError:
 rel_path = path
 files.append(rel_path)
-for rel_path in files:
+for rel_path in sorted(files):
 msgsrc, msgid = os.path.split(rel_path)
 msgsrc = "Preset from " + msgsrc
 msgid = bpy.path.display_name(msgid, title_case=False)
diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py 
b/release/scripts/startup/bl_ui/properties_data_mesh.py
index 80b9b773d9b..8f2141ba6fc 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -3,6 +3,8 @@ import bpy
 from bpy.types import Menu, Panel, UIList
 from rna_prop_ui import PropertyPanel
 
+from bpy.app.translations import pgettext_tip as tip_
+
 
 class MESH_MT_vertex_group_context_menu(Menu):
 bl_label = "Vertex Group Specials"
@@ -592,7 +594,7 @@ class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel):
 if not colliding_names:
 return
 
-layout.label(text="Name collisions: " + ", 
".join(set(colliding_names)), icon='ERROR')
+layout.label(text=tip_("Name collisions: ") + ", 
".join(set(colliding_names)), icon='ERROR')
 
 
 class ColorAttributesListBase():
diff --git a/release/scripts/startup/bl_ui/space_node.py 
b/release/scripts/startup/bl_ui/space_node.py
index 427d0696c20..dab06cc4993 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -375,8 +375,8 @@ class NODE_PT_material_slots(Panel):
 def draw_header(self, context):
 ob = context.object
 self.bl_label = (
-"Slot " + str(ob.active_material_index + 1) if ob.material_slots 
else
-"Slot"
+iface_("Slot %d") % (ob.active_material_index + 1) if 
ob.material_slots else
+iface_("Slot")
 )
 
 # Duplicate part of 'EEVEE_MATERIAL_PT_context_material'.
diff --git a/source/blender/editors/interface/interface_templates.c 
b/source/blender/editors/interface/interface_templates.c
index fa3c12e158d..ac6dcbea052 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -6458,13 +6458,13 @@ bool uiTemplateEventFromKeymapItem(struct uiLayout 
*layout,
 for (int j = 0; j < ARRAY_SIZE(icon_mod) && icon_mod[j]; j++) {
   uiItemL(layout, "", icon_mod[j]);
 }
-uiItemL(layout, text, icon);
+uiItemL(layout, TIP_(text), icon);
 ok = true;
   }
   else if (text_fallback) {
 const char *event_text = WM_key_event_string(kmi->type, true);
 uiItemL(layout, event_text, ICON_NONE);
-uiItemL(layout, text, ICON_NONE);
+uiItemL(layout, TIP_(text), ICON_NONE);
 ok = true;
   }
   return ok;
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c 
b/source/blender/modifiers/intern/MOD_particleinstance.c
index 5018b2d1030..d6435c55211 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -553,7 +553,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel 
*panel)
"particle_system",
_obj_ptr,
"particle_systems",
-   "Particle System",
+   IFACE_("Particle System"),
ICON_NONE);
   }
   else {

[Bf-blender-cvs] [219b4dbc3c8] blender-v3.3-release: I18n: remove Window class from message extraction blacklist

2022-08-09 Thread Damien Picard
Commit: 219b4dbc3c8c23aa8ffb182790be3fd24d6745c2
Author: Damien Picard
Date:   Tue Aug 9 11:41:05 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB219b4dbc3c8c23aa8ffb182790be3fd24d6745c2

I18n: remove Window class from message extraction blacklist

Messages from the bpy.types.Window class were blacklisted in the
message extraction script.

This change allows a few new messages to be translated, including at
least two which show up in the UI. There are only 12 new messages in
the .po files, so even if some never need to be translated, that's not
too many.

Ref. T43295

Reviewed By: mont29

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

===

M   release/scripts/modules/bl_i18n_utils/bl_extract_messages.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 d7755532614..e4845215ff3 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
@@ -206,8 +206,6 @@ def dump_rna_messages(msgs, reports, settings, 
verbose=False):
 "Context", "Event", "Function", "UILayout", "UnknownType", 
"Property", "Struct",
 # registerable classes
 "Panel", "Menu", "Header", "RenderEngine", "Operator", 
"OperatorMacro", "Macro", "KeyingSetInfo",
-# window classes
-"Window",
 )
 }

___
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] [630b961f234] blender-v3.3-release: I18n: add extraction of modal event names.

2022-08-09 Thread Bastien Montagne
Commit: 630b961f234e4b1b9839a7d427d68d3f028e528f
Author: Bastien Montagne
Date:   Tue Aug 9 12:22:30 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB630b961f234e4b1b9839a7d427d68d3f028e528f

I18n: add extraction of modal event names.

Alternative fix to the one proposed in D15607.

Reviewed By: campbellbarton

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

===

M   release/scripts/modules/bl_i18n_utils/bl_extract_messages.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 e4845215ff3..a44b3ac132b 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
@@ -359,12 +359,25 @@ def dump_rna_messages(msgs, reports, settings, 
verbose=False):
 
 walk_properties(cls)
 
+def walk_keymap_modal_events(keyconfigs, keymap_name, msgsrc_prev, 
km_i18n_context):
+for keyconfig in keyconfigs:
+keymap = keyconfig.keymaps.get(keymap_name, None)
+if keymap and keymap.is_modal:
+for modal_event in keymap.modal_event_values:
+msgsrc = msgsrc_prev + 
":'{}'".format(modal_event.identifier)
+if modal_event.name:
+process_msg(msgs, km_i18n_context, modal_event.name, 
msgsrc, reports, None, settings)
+if modal_event.description:
+process_msg(msgs, default_context, 
modal_event.description, msgsrc, reports, None, settings)
+
 def walk_keymap_hierarchy(hier, msgsrc_prev):
 km_i18n_context = bpy.app.translations.contexts.id_windowmanager
 for lvl in hier:
 msgsrc = msgsrc_prev + "." + lvl[1]
 if isinstance(lvl[0], str):  # Can be a function too, now, with 
tool system...
-process_msg(msgs, km_i18n_context, lvl[0], msgsrc, reports, 
None, settings)
+keymap_name = lvl[0]
+process_msg(msgs, km_i18n_context, keymap_name, msgsrc, 
reports, None, settings)
+
walk_keymap_modal_events(bpy.data.window_managers[0].keyconfigs, keymap_name, 
msgsrc, km_i18n_context)
 if lvl[3]:
 walk_keymap_hierarchy(lvl[3], msgsrc)

___
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] [2682a59efe5] blender-v3.3-release: WM Modal Keymaps: Add accessors to modal event values.

2022-08-09 Thread Bastien Montagne
Commit: 2682a59efe53a719266da4175633789ef195c8d4
Author: Bastien Montagne
Date:   Tue Aug 9 12:22:13 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB2682a59efe53a719266da4175633789ef195c8d4

WM Modal Keymaps: Add accessors to modal event values.

It is currently impossible to access modal keymaps' event values (from
`propvalue` enum) from python code (for API introspection).

This is needed for i18n messages extraction (see D15607).

Reviewed By: campbellbarton

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

===

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

===

diff --git a/source/blender/makesrna/intern/rna_wm.c 
b/source/blender/makesrna/intern/rna_wm.c
index 2009f51e1f2..ac1803b0a11 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -864,6 +864,21 @@ static void rna_Window_view_layer_set(PointerRNA *ptr,
   WM_window_set_active_view_layer(win, view_layer);
 }
 
+static void 
rna_KeyMap_modal_event_values_items_begin(CollectionPropertyIterator *iter,
+  PointerRNA *ptr)
+{
+  wmKeyMap *km = ptr->data;
+
+  const EnumPropertyItem *items = rna_enum_keymap_propvalue_items;
+  if ((km->flag & KEYMAP_MODAL) != 0 && km->modal_items != NULL) {
+items = km->modal_items;
+  }
+
+  const int totitem = RNA_enum_items_count(items);
+
+  rna_iterator_array_begin(iter, (void *)items, sizeof(EnumPropertyItem), 
totitem, false, NULL);
+}
+
 static PointerRNA rna_KeyMapItem_properties_get(PointerRNA *ptr)
 {
   wmKeyMapItem *kmi = ptr->data;
@@ -2617,6 +2632,23 @@ static void rna_def_keyconfig(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Children Expanded", "Children expanded in 
the user interface");
   RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
 
+  prop = RNA_def_property(srna, "modal_event_values", PROP_COLLECTION, 
PROP_NONE);
+  RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+  RNA_def_property_struct_type(prop, "EnumPropertyItem");
+  RNA_def_property_collection_funcs(prop,
+
"rna_KeyMap_modal_event_values_items_begin",
+"rna_iterator_array_next",
+"rna_iterator_array_end",
+"rna_iterator_array_get",
+NULL,
+NULL,
+NULL,
+NULL);
+  RNA_def_property_ui_text(prop,
+   "Modal Events",
+   "Give access to the possible event values of this 
modal keymap's items "
+   "(#KeyMapItem.propvalue), for API introspection");
+
   RNA_api_keymap(srna);
 
   /* KeyMapItem */

___
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