[Bf-blender-cvs] [4bb41ed4395] cycles_path_guiding: Fix Metal build errors

2022-09-23 Thread Brecht Van Lommel
Commit: 4bb41ed43954d09163a71c6cff4fc22fa491cdf3
Author: Brecht Van Lommel
Date:   Sat Sep 24 04:24:53 2022 +0200
Branches: cycles_path_guiding
https://developer.blender.org/rB4bb41ed43954d09163a71c6cff4fc22fa491cdf3

Fix Metal build errors

===

M   intern/cycles/kernel/closure/bsdf.h
M   intern/cycles/kernel/integrator/guiding.h
M   intern/cycles/kernel/integrator/state_template.h
M   intern/cycles/kernel/integrator/surface_shader.h

===

diff --git a/intern/cycles/kernel/closure/bsdf.h 
b/intern/cycles/kernel/closure/bsdf.h
index 89ca3e14674..71af68aa80e 100644
--- a/intern/cycles/kernel/closure/bsdf.h
+++ b/intern/cycles/kernel/closure/bsdf.h
@@ -293,11 +293,10 @@ ccl_device_inline int bsdf_sample(KernelGlobals kg,
 }
 
 ccl_device_inline void bsdf_roughness_eta(const KernelGlobals kg,
-  const ShaderClosure *sc,
-  float2 *roughness,
-  float *eta)
+  ccl_private const ShaderClosure *sc,
+  ccl_private float2 *roughness,
+  ccl_private float *eta)
 {
-  const MicrofacetBsdf *bsdf;
   bool refractive = false;
   float alpha = 1.0f;
   switch (sc->type) {
@@ -325,17 +324,19 @@ ccl_device_inline void bsdf_roughness_eta(const 
KernelGlobals kg,
   *roughness = one_float2();
   *eta = 1.0f;
   break;
-case CLOSURE_BSDF_REFLECTION_ID:
-  bsdf = (ccl_private const MicrofacetBsdf *)sc;
+case CLOSURE_BSDF_REFLECTION_ID: {
+  ccl_private const MicrofacetBsdf *bsdf = (ccl_private const 
MicrofacetBsdf *)sc;
   *roughness = zero_float2();
   *eta = bsdf->ior;
   break;
-case CLOSURE_BSDF_REFRACTION_ID:
-  bsdf = (ccl_private const MicrofacetBsdf *)sc;
+}
+case CLOSURE_BSDF_REFRACTION_ID: {
+  ccl_private const MicrofacetBsdf *bsdf = (ccl_private const 
MicrofacetBsdf *)sc;
   *roughness = zero_float2();
   // do we need to inverse eta??
   *eta = bsdf->ior;
   break;
+}
 case CLOSURE_BSDF_TRANSPARENT_ID:
   *roughness = zero_float2();
   *eta = 1.0f;
@@ -343,36 +344,40 @@ ccl_device_inline void bsdf_roughness_eta(const 
KernelGlobals kg,
 case CLOSURE_BSDF_MICROFACET_GGX_ID:
 case CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID:
 case CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID:
-case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
-  bsdf = (ccl_private const MicrofacetBsdf *)sc;
+case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID: {
+  ccl_private const MicrofacetBsdf *bsdf = (ccl_private const 
MicrofacetBsdf *)sc;
   *roughness = make_float2(bsdf->alpha_x, bsdf->alpha_y);
   refractive = bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
   *eta = refractive ? 1.0f / bsdf->ior : bsdf->ior;
   break;
+}
 case CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID:
-case CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID:
-  bsdf = (ccl_private const MicrofacetBsdf *)sc;
+case CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID: {
+  ccl_private const MicrofacetBsdf *bsdf = (ccl_private const 
MicrofacetBsdf *)sc;
   *roughness = make_float2(bsdf->alpha_x, bsdf->alpha_y);
   *eta = bsdf->ior;
   break;
+}
 case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID:
-case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID:
-  bsdf = (ccl_private const MicrofacetBsdf *)sc;
+case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID: {
+  ccl_private const MicrofacetBsdf *bsdf = (ccl_private const 
MicrofacetBsdf *)sc;
   *roughness = make_float2(bsdf->alpha_x, bsdf->alpha_y);
   *eta = bsdf->ior;
   break;
+}
 case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
-case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
-  bsdf = (ccl_private const MicrofacetBsdf *)sc;
+case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID: {
+  ccl_private const MicrofacetBsdf *bsdf = (ccl_private const 
MicrofacetBsdf *)sc;
   *roughness = make_float2(bsdf->alpha_x, bsdf->alpha_y);
   refractive = bsdf->type == 
CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
   *eta = refractive ? 1.0f / bsdf->ior : bsdf->ior;
-  break;
-case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID:
-  bsdf = (ccl_private const MicrofacetBsdf *)sc;
+} break;
+case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID: {
+  ccl_private const MicrofacetBsdf *bsdf = (ccl_private const 
MicrofacetBsdf *)sc;
   *roughness = make_float2(bsdf->alpha_x, bsdf->alpha_y);
   *eta = 1.0f;
   break;
+}
 case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
   *roughness = one_float2();
   *eta = 1.0f;
@@ -418,13 +423,12 @@ ccl_device_inline void bsdf_roughness_eta(const 
KernelGlobals kg,
 }
 
 ccl_device_inline int bsdf_l

[Bf-blender-cvs] [4eda3139423] cycles_path_guiding: Merge branch 'master' into cycles_path_guiding

2022-09-23 Thread Brecht Van Lommel
Commit: 4eda3139423d7ea4953305e2d483f6dd31a5c80c
Author: Brecht Van Lommel
Date:   Sat Sep 24 03:58:20 2022 +0200
Branches: cycles_path_guiding
https://developer.blender.org/rB4eda3139423d7ea4953305e2d483f6dd31a5c80c

Merge branch 'master' into cycles_path_guiding

===



===



___
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] [cd1631b17dd] master: BLF: Refactor of DPI

2022-09-23 Thread Harley Acheson
Commit: cd1631b17dd0e25a8a398fb00a982ca5f0633558
Author: Harley Acheson
Date:   Fri Sep 23 17:36:49 2022 -0700
Branches: master
https://developer.blender.org/rBcd1631b17dd0e25a8a398fb00a982ca5f0633558

BLF: Refactor of DPI

Correction of U.dpi to hold actual monitor DPI. Simplify font sizing by
omitting DPI as API argument, always using 72 internally.

See D15961 for more details.

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

Reviewed by Campbell Barton

===

M   source/blender/blenfont/BLF_api.h
M   source/blender/blenfont/intern/blf.c
M   source/blender/blenfont/intern/blf_default.c
M   source/blender/blenfont/intern/blf_font.c
M   source/blender/blenfont/intern/blf_glyph.c
M   source/blender/blenfont/intern/blf_internal.h
M   source/blender/blenfont/intern/blf_internal_types.h
M   source/blender/blenfont/intern/blf_thumbs.c
M   source/blender/blenkernel/intern/image.cc
M   source/blender/blenkernel/intern/image_gen.c
M   source/blender/draw/intern/draw_manager_text.c
M   source/blender/editors/interface/interface_icons_event.c
M   source/blender/editors/interface/interface_panel.cc
M   source/blender/editors/interface/interface_region_tooltip.cc
M   source/blender/editors/interface/interface_style.cc
M   source/blender/editors/mesh/editmesh_bevel.c
M   source/blender/editors/mesh/editmesh_knife.c
M   source/blender/editors/object/object_remesh.cc
M   source/blender/editors/screen/area.c
M   source/blender/editors/space_clip/clip_dopesheet_draw.c
M   source/blender/editors/space_clip/clip_draw.c
M   source/blender/editors/space_image/image_draw.c
M   source/blender/editors/space_info/textview.c
M   source/blender/editors/space_node/node_draw.cc
M   source/blender/editors/space_spreadsheet/space_spreadsheet.cc
M   source/blender/editors/space_text/text_draw.c
M   source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c
M   source/blender/editors/space_view3d/view3d_gizmo_ruler.c
M   source/blender/editors/util/ed_draw.c
M   source/blender/python/generic/blf_py_api.c
M   source/blender/sequencer/intern/effects.c
M   source/blender/windowmanager/intern/wm_operators.c
M   source/blender/windowmanager/intern/wm_playanim.c
M   source/blender/windowmanager/intern/wm_window.c

===

diff --git a/source/blender/blenfont/BLF_api.h 
b/source/blender/blenfont/BLF_api.h
index d3226a8f609..992107a30e9 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -69,7 +69,7 @@ void BLF_metrics_attach(int fontid, unsigned char *mem, int 
mem_size);
 
 void BLF_aspect(int fontid, float x, float y, float z);
 void BLF_position(int fontid, float x, float y, float z);
-void BLF_size(int fontid, float size, int dpi);
+void BLF_size(int fontid, float size);
 
 /* Goal: small but useful color API. */
 
@@ -303,7 +303,6 @@ void BLF_thumb_preview(const char *filepath,
 
 /* blf_default.c */
 
-void BLF_default_dpi(int dpi);
 void BLF_default_size(float size);
 void BLF_default_set(int fontid);
 /**
diff --git a/source/blender/blenfont/intern/blf.c 
b/source/blender/blenfont/intern/blf.c
index 9d9cc51ebcc..4e904768f79 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -63,8 +63,6 @@ int BLF_init(void)
 global_font[i] = NULL;
   }
 
-  BLF_default_dpi(72);
-
   return blf_font_init();
 }
 
@@ -361,12 +359,12 @@ void BLF_position(int fontid, float x, float y, float z)
   }
 }
 
-void BLF_size(int fontid, float size, int dpi)
+void BLF_size(int fontid, float size)
 {
   FontBLF *font = blf_get(fontid);
 
   if (font) {
-blf_font_size(font, size, dpi);
+blf_font_size(font, size);
   }
 }
 
@@ -912,7 +910,6 @@ void BLF_state_print(int fontid)
 printf("fontid %d %p\n", fontid, (void *)font);
 printf("  name:'%s'\n", font->name);
 printf("  size: %f\n", font->size);
-printf("  dpi:  %u\n", font->dpi);
 printf("  pos:  %d %d %d\n", UNPACK3(font->pos));
 printf("  aspect:   (%d) %.6f %.6f %.6f\n",
(font->flags & BLF_ROTATION) != 0,
diff --git a/source/blender/blenfont/intern/blf_default.c 
b/source/blender/blenfont/intern/blf_default.c
index a1f1b84636f..a521d65fe30 100644
--- a/source/blender/blenfont/intern/blf_default.c
+++ b/source/blender/blenfont/intern/blf_default.c
@@ -20,15 +20,9 @@
 
 /* Default size and dpi, for BLF_draw_default. */
 static int global_font_default = -1;
-static int global_font_dpi = 72;
 /* Keep in sync with `UI_DEFAULT_TEXT_POINTS` */
 static float global_font_size = 11.0f;
 
-void BLF_default_dpi(int dpi)
-{
-  global_font_dpi = dpi;
-}
-
 void BLF_default_size(float size)
 {
   global_font_size = size;
@@ -51,7 +45,7 @@ int BLF_set_default(void)
 {
   ASSERT_DEFAULT_SET;
 
-  BLF_size(global

[Bf-blender-cvs] [88a602bc64f] master: Fix build error in blenloader on macOS after recent changes

2022-09-23 Thread Brecht Van Lommel
Commit: 88a602bc64fc2a86411d67881439a04486f95030
Author: Brecht Van Lommel
Date:   Sat Sep 24 01:16:38 2022 +0200
Branches: master
https://developer.blender.org/rB88a602bc64fc2a86411d67881439a04486f95030

Fix build error in blenloader on macOS after recent changes

===

M   source/blender/blenloader/intern/readfile.h

===

diff --git a/source/blender/blenloader/intern/readfile.h 
b/source/blender/blenloader/intern/readfile.h
index 2171d513d69..a0f19512753 100644
--- a/source/blender/blenloader/intern/readfile.h
+++ b/source/blender/blenloader/intern/readfile.h
@@ -8,6 +8,8 @@
 
 #pragma once
 
+#include  /* Include header using off_t before poisoning it below. */
+
 #ifdef WIN32
 #  include "BLI_winstuff.h"
 #endif

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


[Bf-blender-cvs] [7dd1a5a32f1] temp-sculpt-cavity-mask: temp-sculpt-cavity-mask: Replace float[3] with float3

2022-09-23 Thread Joseph Eagar
Commit: 7dd1a5a32f1fa6a6c3f3edfe3094ee56e1360276
Author: Joseph Eagar
Date:   Fri Sep 23 15:40:57 2022 -0700
Branches: temp-sculpt-cavity-mask
https://developer.blender.org/rB7dd1a5a32f1fa6a6c3f3edfe3094ee56e1360276

temp-sculpt-cavity-mask: Replace float[3] with float3

===

M   source/blender/editors/sculpt_paint/sculpt_automasking.cc

===

diff --git a/source/blender/editors/sculpt_paint/sculpt_automasking.cc 
b/source/blender/editors/sculpt_paint/sculpt_automasking.cc
index fdc29bb6ca6..29ca2d4a10c 100644
--- a/source/blender/editors/sculpt_paint/sculpt_automasking.cc
+++ b/source/blender/editors/sculpt_paint/sculpt_automasking.cc
@@ -12,6 +12,7 @@
 #include "BLI_hash.h"
 #include "BLI_index_range.hh"
 #include "BLI_math.h"
+#include "BLI_math_vec_types.hh"
 #include "BLI_set.hh"
 #include "BLI_task.h"
 #include "BLI_vector.hh"
@@ -51,6 +52,7 @@
 #include 
 #include 
 
+using blender::float3;
 using blender::IndexRange;
 using blender::Set;
 using blender::Vector;
@@ -143,19 +145,17 @@ float SCULPT_calc_cavity(SculptSession *ss, const 
PBVHVertRef vertex)
 {
   SculptVertexNeighborIter ni;
   const float *co = SCULPT_vertex_co_get(ss, vertex);
-  float avg[3];
+  float3 avg(0.0f);
   float length_sum = 0.0f;
   int valence = 0;
 
-  zero_v3(avg);
-
   SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vertex, ni) {
 const float *co2 = SCULPT_vertex_co_get(ss, ni.vertex);
 
 length_sum += len_v3v3(co, co2);
 valence++;
 
-add_v3_v3(avg, co2);
+avg += co2;
   }
   SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
 
@@ -163,14 +163,13 @@ float SCULPT_calc_cavity(SculptSession *ss, const 
PBVHVertRef vertex)
 return 0.0f;
   }
 
-  mul_v3_fl(avg, 1.0f / (float)valence);
+  avg /= (float)valence;
   length_sum /= (float)valence;
 
-  float no[3];
-
+  float3 no;
   SCULPT_vertex_normal_get(ss, vertex, no);
 
-  sub_v3_v3(avg, co);
+  avg -= co;
 
   /* Use distance to plane. */
   float factor = dot_v3v3(avg, no) / length_sum;
@@ -220,10 +219,10 @@ static void sculpt_calc_blurred_cavity(SculptSession *ss,
int steps,
PBVHVertRef vertex)
 {
-  float sno1[3];
-  float sno2[3];
-  float sco1[3];
-  float sco2[3];
+  float3 sno1(0.0f);
+  float3 sno2(0.0f);
+  float3 sco1(0.0f);
+  float3 sco2(0.0f);
   float len1_sum = 0.0f, len2_sum = 0.0f;
   int sco1_len = 0, sco2_len = 0;
 
@@ -232,11 +231,6 @@ static void sculpt_calc_blurred_cavity(SculptSession *ss,
*/
   steps++;
 
-  zero_v3(sno1);
-  zero_v3(sno2);
-  zero_v3(sco1);
-  zero_v3(sco2);
-
   Vector queue;
   Set visit;
 
@@ -257,21 +251,21 @@ static void sculpt_calc_blurred_cavity(SculptSession *ss,
 PBVHVertRef v = blurvert.vertex;
 start = (start + 1) % queue.size();
 
-float no[3];
+float3 no;
 
 const float *co = SCULPT_vertex_co_get(ss, v);
 SCULPT_vertex_normal_get(ss, v, no);
 
 float centdist = len_v3v3(co, co1);
 
-add_v3_v3(sco1, co);
-add_v3_v3(sno1, no);
+sco1 += co;
+sno1 += no;
 len1_sum += centdist;
 sco1_len++;
 
 if (blurvert.depth < steps) {
-  add_v3_v3(sco2, co);
-  add_v3_v3(sno2, no);
+  sco2 += co;
+  sno2 += no;
   len2_sum += centdist;
   sco2_len++;
 }
@@ -317,23 +311,21 @@ static void sculpt_calc_blurred_cavity(SculptSession *ss,
 SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
   }
 
-  if (sco1_len == sco2_len) {
-printf("error! %d %d\n", sco1_len, sco2_len);
-  }
+  BLI_assert(sco1_len != sco2_len);
 
   if (!sco1_len) {
-copy_v3_v3(sco1, SCULPT_vertex_co_get(ss, vertex));
+sco1 = SCULPT_vertex_co_get(ss, vertex);
   }
   else {
-mul_v3_fl(sco1, 1.0f / (float)sco1_len);
+sco1 /= (float)sco1_len;
 len1_sum /= sco1_len;
   }
 
   if (!sco2_len) {
-copy_v3_v3(sco2, SCULPT_vertex_co_get(ss, vertex));
+sco2 = SCULPT_vertex_co_get(ss, vertex);
   }
   else {
-mul_v3_fl(sco2, 1.0f / (float)sco2_len);
+sco2 /= (float)sco2_len;
 len2_sum /= sco2_len;
   }
 
@@ -347,8 +339,7 @@ static void sculpt_calc_blurred_cavity(SculptSession *ss,
 SCULPT_vertex_normal_get(ss, vertex, sno2);
   }
 
-  float vec[3];
-  sub_v3_v3v3(vec, sco1, sco2);
+  float3 vec = sco1 - sco2;
   float factor_sum = dot_v3v3(vec, sno2) / len1_sum;
 
   factor_sum = sculpt_cavity_calc_factor(ss, automasking, factor_sum);

___
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] [b11f312629f] temp-sculpt-cavity-mask: temp-sculpt-cavity-mask: Add versioning code

2022-09-23 Thread Joseph Eagar
Commit: b11f312629ff9d4c26ee72d3e38b18c88edc6616
Author: Joseph Eagar
Date:   Fri Sep 23 15:10:32 2022 -0700
Branches: temp-sculpt-cavity-mask
https://developer.blender.org/rBb11f312629ff9d4c26ee72d3e38b18c88edc6616

temp-sculpt-cavity-mask: Add versioning code

===

M   source/blender/blenkernel/BKE_blender_version.h
M   source/blender/blenloader/intern/versioning_300.cc

===

diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index 46d6c97e1ff..2909cac7a41 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -19,7 +19,7 @@ extern "C" {
 /* Blender major and minor version. */
 #define BLENDER_VERSION 304
 /* Blender patch version for bugfix releases. */
-#define BLENDER_VERSION_PATCH 0
+#define BLENDER_VERSION_PATCH 1
 /** Blender release cycle stage: alpha/beta/rc/release. */
 #define BLENDER_VERSION_CYCLE alpha
 
diff --git a/source/blender/blenloader/intern/versioning_300.cc 
b/source/blender/blenloader/intern/versioning_300.cc
index e687958c4a2..bc8721b2c40 100644
--- a/source/blender/blenloader/intern/versioning_300.cc
+++ b/source/blender/blenloader/intern/versioning_300.cc
@@ -3528,6 +3528,17 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 BKE_main_namemap_validate_and_fix(bmain);
   }
 
+  if (!MAIN_VERSION_ATLEAST(bmain, 304, 1)) {
+/* Initialize brush curves sculpt settings. */
+LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
+  if (brush->ob_mode != OB_MODE_SCULPT) {
+continue;
+  }
+
+  brush->automasking_cavity_factor = 0.5f;
+}
+  }
+
   /**
* Versioning code until next subversion bump goes here.
*

___
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] [200e3c8d559] temp-sculpt-cavity-mask: temp-sculpt-cavity-mask: Make requested changes

2022-09-23 Thread Joseph Eagar
Commit: 200e3c8d559b6dded6229db62c43cdb7e28f01cd
Author: Joseph Eagar
Date:   Fri Sep 23 15:01:15 2022 -0700
Branches: temp-sculpt-cavity-mask
https://developer.blender.org/rB200e3c8d559b6dded6229db62c43cdb7e28f01cd

temp-sculpt-cavity-mask: Make requested changes

===

M   release/scripts/addons
M   release/scripts/startup/bl_ui/space_view3d.py
M   release/scripts/startup/bl_ui/space_view3d_toolbar.py
M   source/blender/blenkernel/BKE_paint.h
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_automasking.cc
M   source/blender/editors/sculpt_paint/sculpt_expand.c
M   source/blender/editors/sculpt_paint/sculpt_filter_color.c
M   source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h
M   source/blender/editors/sculpt_paint/sculpt_ops.c
M   source/blender/makesrna/intern/rna_brush.c
M   source/blender/makesrna/intern/rna_sculpt_paint.c

===

diff --git a/release/scripts/addons b/release/scripts/addons
index 3908254f093..67f1fbca148 16
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 3908254f0938a3c4c29189a455c8e356771e6ce1
+Subproject commit 67f1fbca1482d9d9362a4001332e785c3fd5d230
diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 2311532535c..6a09dc11aa5 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -5490,22 +5490,12 @@ class VIEW3D_MT_sculpt_automasking_pie(Menu):
 tool_settings = context.tool_settings
 sculpt = tool_settings.sculpt
 
-def doprop(key, text):
-if sculpt.brush and getattr(sculpt.brush, key):
-pie.prop(sculpt, key, text=text + "(overridden by brush)")
-else:
-pie.prop(sculpt, key, text=text)
-
-doprop("use_automasking_topology", "Topology")
-doprop("use_automasking_topology", "Topology")
-doprop("use_automasking_face_sets", "Face Sets")
-doprop("use_automasking_boundary_edges", "Mesh Boundary")
-doprop("use_automasking_boundary_face_sets", "Face Sets Boundary")
-
-if sculpt.brush and (sculpt.brush.use_automasking_cavity or 
sculpt.brush.use_automasking_cavity_inverted):
-pie.prop(sculpt, "use_automasking_cavity", text="Cavity 
(overridden by brush)")
-else:
-pie.prop(sculpt, "use_automasking_cavity", text="Cavity")
+pie.prop(sculpt, "use_automasking_topology", text="Topology")
+pie.prop(sculpt, "use_automasking_face_sets", text="Face Sets")
+pie.prop(sculpt, "use_automasking_boundary_edges", text="Mesh 
Boundary")
+pie.prop(sculpt, "use_automasking_boundary_face_sets", text="Face Sets 
Boundary")
+pie.prop(sculpt, "use_automasking_cavity", text="Cavity")
+pie.prop(sculpt, "use_automasking_cavity_inverted", text="Cavity 
(Inverted)")
 
 
 class VIEW3D_MT_sculpt_face_sets_edit_pie(Menu):
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 59dbbd80ef5..94cf23a03f3 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -967,33 +967,22 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
 
 col = layout.column(heading="Auto-Masking", align=True)
 
-def doprop(key, text):
-col2 = col.column()
-col2.enabled = not sculpt.brush or not getattr(sculpt.brush, key)
-
-if not col2.enabled:
-text += " - overridden by brush"
-col2.prop(sculpt, key, text=text)
-
-doprop("use_automasking_topology", "Topology")
-doprop("use_automasking_face_sets", "Face Sets")
-doprop("use_automasking_boundary_edges", "Mesh Boundary")
-doprop("use_automasking_boundary_face_sets", "Face Sets Boundary")
-doprop("use_automasking_cavity", "Cavity")
-doprop("use_automasking_cavity_inverted", "Cavity (Inverted)")
+col.prop(sculpt, "use_automasking_topology", text="Topology")
+col.prop(sculpt, "use_automasking_face_sets", text="Face Sets")
+col.prop(sculpt, "use_automasking_boundary_edges", text="Mesh 
Boundary")
+col.prop(sculpt, "use_automasking_boundary_face_sets", text="Face Sets 
Boundary")
+col.prop(sculpt, "use_automasking_cavity", text="Cavity")
+col.prop(sculpt, "use_automasking_cavity_inverted", text="Cavity 
(Inverted)")
 
 col.separator()
 
 if sculpt.use_automasking_cavity or 
sculpt.use_automasking_cavity_inverted:
-props = col.operator("sculpt.mask_from_cavity", text="Mask From 
Cavity")
+col2 = co

[Bf-blender-cvs] [f7d698b244a] temp-sculpt-cavity-mask: Merge branch 'master' into temp-sculpt-cavity-mask

2022-09-23 Thread Joseph Eagar
Commit: f7d698b244a0e27a6bec42caa929819781f7ea8e
Author: Joseph Eagar
Date:   Fri Sep 23 14:17:43 2022 -0700
Branches: temp-sculpt-cavity-mask
https://developer.blender.org/rBf7d698b244a0e27a6bec42caa929819781f7ea8e

Merge branch 'master' into temp-sculpt-cavity-mask

===



===



___
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] [ff27b68f41c] master: Fix T101295: Allow Large Windows Thumbnails

2022-09-23 Thread Harley Acheson
Commit: ff27b68f41ce511e162d6e561103c522d9507a5f
Author: Harley Acheson
Date:   Fri Sep 23 14:49:36 2022 -0700
Branches: master
https://developer.blender.org/rBff27b68f41ce511e162d6e561103c522d9507a5f

Fix T101295: Allow Large Windows Thumbnails

Allow our Windows Thumbnail Handler to supply thumbnails up to the
maximum 256x256 size.

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

Reviewed by Ray Molenkamp

===

M   source/blender/blendthumb/src/blendthumb_win32.cc

===

diff --git a/source/blender/blendthumb/src/blendthumb_win32.cc 
b/source/blender/blendthumb/src/blendthumb_win32.cc
index 287710934e2..2acc8f20a12 100644
--- a/source/blender/blendthumb/src/blendthumb_win32.cc
+++ b/source/blender/blendthumb/src/blendthumb_win32.cc
@@ -171,8 +171,8 @@ IFACEMETHODIMP CBlendThumb::GetThumbnail(UINT cx, HBITMAP 
*phbmp, WTS_ALPHATYPE
   }
   *pdwAlpha = WTSAT_ARGB;
 
-  /* Scale down the thumbnail if required. */
-  if ((unsigned)thumb.width > cx || (unsigned)thumb.height > cx) {
+  /* Scale up the thumbnail if required. */
+  if ((unsigned)thumb.width < cx && (unsigned)thumb.height < cx) {
 float scale = 1.0f / (std::max(thumb.width, thumb.height) / (float)cx);
 LONG NewWidth = (LONG)(thumb.width * scale);
 LONG NewHeight = (LONG)(thumb.height * scale);

___
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] [ce63fea080c] master: Cleanup: Remove unused data transfer function

2022-09-23 Thread Hans Goudey
Commit: ce63fea080ce3e171375d4c788a503ddca6ab668
Author: Hans Goudey
Date:   Fri Sep 23 16:30:12 2022 -0500
Branches: master
https://developer.blender.org/rBce63fea080ce3e171375d4c788a503ddca6ab668

Cleanup: Remove unused data transfer function

===

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

===

diff --git a/source/blender/blenkernel/intern/data_transfer.c 
b/source/blender/blenkernel/intern/data_transfer.c
index f2732cea91a..36f038e68ab 100644
--- a/source/blender/blenkernel/intern/data_transfer.c
+++ b/source/blender/blenkernel/intern/data_transfer.c
@@ -403,31 +403,6 @@ float data_transfer_interp_float_do(const int mix_mode,
   return interpf(val_ret, val_dst, mix_factor);
 }
 
-static void data_transfer_interp_char(const CustomDataTransferLayerMap *laymap,
-  void *dest,
-  const void **sources,
-  const float *weights,
-  const int count,
-  const float mix_factor)
-{
-  const char **data_src = (const char **)sources;
-  char *data_dst = (char *)dest;
-
-  const int mix_mode = laymap->mix_mode;
-  float val_src = 0.0f;
-  const float val_dst = (float)(*data_dst) / 255.0f;
-
-  for (int i = count; i--;) {
-val_src += ((float)(*data_src[i]) / 255.0f) * weights[i];
-  }
-
-  val_src = data_transfer_interp_float_do(mix_mode, val_dst, val_src, 
mix_factor);
-
-  CLAMP(val_src, 0.0f, 1.0f);
-
-  *data_dst = (char)(val_src * 255.0f);
-}
-
 /* Helpers to match sources and destinations data layers
  * (also handles 'conversions' in CD_FAKE cases). */

___
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] [c2a21dfb771] master: Sculpt: fix memory corruption in new attribute api

2022-09-23 Thread Joseph Eagar
Commit: c2a21dfb7714bf25431291f6598f43109af46446
Author: Joseph Eagar
Date:   Fri Sep 23 14:08:17 2022 -0700
Branches: master
https://developer.blender.org/rBc2a21dfb7714bf25431291f6598f43109af46446

Sculpt: fix memory corruption in new attribute api

===

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

===

diff --git a/source/blender/blenkernel/intern/paint.cc 
b/source/blender/blenkernel/intern/paint.cc
index 7475d2b5144..298ca8fff8c 100644
--- a/source/blender/blenkernel/intern/paint.cc
+++ b/source/blender/blenkernel/intern/paint.cc
@@ -2640,7 +2640,10 @@ SculptAttribute *BKE_sculpt_attribute_get(struct Object 
*ob,
   SculptAttribute *attr = sculpt_get_cached_layer(ss, domain, proptype, name);
 
   if (attr) {
-sculpt_attr_update(ob, attr);
+if (sculpt_attr_update(ob, attr)) {
+  sculpt_attribute_update_refs(ob);
+}
+
 return attr;
   }

___
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] [b2ad97ba97f] tmp-usd-alab-v2-T100452: Merge branch 'master' into tmp-usd-alab-v2-T100452

2022-09-23 Thread Michael Kowalski
Commit: b2ad97ba97f3e55d1dd463e29ca0b2ec6fe761e1
Author: Michael Kowalski
Date:   Fri Sep 23 16:56:14 2022 -0400
Branches: tmp-usd-alab-v2-T100452
https://developer.blender.org/rBb2ad97ba97f3e55d1dd463e29ca0b2ec6fe761e1

Merge branch 'master' into tmp-usd-alab-v2-T100452

===



===

diff --cc source/blender/editors/io/io_usd.c
index fd8caf6836e,eb80cabcd7f..1496eac0027
--- a/source/blender/editors/io/io_usd.c
+++ b/source/blender/editors/io/io_usd.c
@@@ -451,9 -427,10 +451,11 @@@ static int wm_usd_import_exec(bContext 
 .import_usd_preview = import_usd_preview,
 .set_material_blend = set_material_blend,
 .light_intensity_scale = 
light_intensity_scale,
 -   .mtl_name_collision_mode = 
mtl_name_collision_mode};
 +   .mtl_name_collision_mode = 
mtl_name_collision_mode,
 +   .mtl_purpose = mtl_purpose};
  
+   STRNCPY(params.prim_path_mask, prim_path_mask);
+ 
const bool ok = USD_import(C, filename, ¶ms, as_background_job);
  
return as_background_job || ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;

___
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] [bc2275ebda6] cycles_path_guiding: Merge branch 'master' into cycles_path_guiding

2022-09-23 Thread Brecht Van Lommel
Commit: bc2275ebda6c16bf7ca9b365af860ddc86c3574d
Author: Brecht Van Lommel
Date:   Fri Sep 23 21:35:30 2022 +0200
Branches: cycles_path_guiding
https://developer.blender.org/rBbc2275ebda6c16bf7ca9b365af860ddc86c3574d

Merge branch 'master' into cycles_path_guiding

===



===



___
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] [5bf003db059] cycles_path_guiding: Fix principled hair test failure

2022-09-23 Thread Brecht Van Lommel
Commit: 5bf003db059a2cda71363aa452a98b666b9e3b95
Author: Brecht Van Lommel
Date:   Fri Sep 23 21:24:46 2022 +0200
Branches: cycles_path_guiding
https://developer.blender.org/rB5bf003db059a2cda71363aa452a98b666b9e3b95

Fix principled hair test failure

===

M   intern/cycles/kernel/closure/bsdf_hair_principled.h

===

diff --git a/intern/cycles/kernel/closure/bsdf_hair_principled.h 
b/intern/cycles/kernel/closure/bsdf_hair_principled.h
index dbef7a5cb5a..857b3fbf3a6 100644
--- a/intern/cycles/kernel/closure/bsdf_hair_principled.h
+++ b/intern/cycles/kernel/closure/bsdf_hair_principled.h
@@ -56,7 +56,7 @@ ccl_device_inline float delta_phi(int p, float gamma_o, float 
gamma_t)
 /* Remaps the given angle to [-pi, pi]. */
 ccl_device_inline float wrap_angle(float a)
 {
-  return fmodf(a + M_PI_F, M_2PI_F) - M_PI_F;
+  return (a + M_PI_F) - M_2PI_F * floorf((a + M_PI_F) / M_2PI_F) - M_PI_F;
 }
 
 /* Logistic distribution function. */

___
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] [7e980f2b8cb] master: Fix T101249: Node groups don't show in node search

2022-09-23 Thread Hans Goudey
Commit: 7e980f2b8cb96aa6d04dc72899d08473367eeeb9
Author: Hans Goudey
Date:   Fri Sep 23 14:25:25 2022 -0500
Branches: master
https://developer.blender.org/rB7e980f2b8cb96aa6d04dc72899d08473367eeeb9

Fix T101249: Node groups don't show in node search

bdb57541475f20ccc neglected to add search items for node groups.
Luckily adding them is quite simple. However, if the node group is also
an asset, it will show up duplicated in the list. To resolve this we
avoid adding node groups to the list if they have already been
added as assets.

===

M   source/blender/editors/space_node/add_node_search.cc

===

diff --git a/source/blender/editors/space_node/add_node_search.cc 
b/source/blender/editors/space_node/add_node_search.cc
index 101517b8cfb..cdf20f7b76e 100644
--- a/source/blender/editors/space_node/add_node_search.cc
+++ b/source/blender/editors/space_node/add_node_search.cc
@@ -13,6 +13,7 @@
 #include "BKE_context.h"
 #include "BKE_idprop.h"
 #include "BKE_lib_id.h"
+#include "BKE_main.h"
 #include "BKE_node_tree_update.h"
 #include "BKE_screen.h"
 
@@ -95,7 +96,7 @@ static void search_items_for_asset_metadata(const bNodeTree 
&node_tree,
 static void gather_search_items_for_asset_library(const bContext &C,
   const bNodeTree &node_tree,
   const AssetLibraryReference 
&library_ref,
-  const bool skip_local,
+  Set 
&r_added_assets,
   Vector 
&search_items)
 {
   AssetFilterSettings filter_settings{};
@@ -107,7 +108,8 @@ static void gather_search_items_for_asset_library(const 
bContext &C,
 if (!ED_asset_filter_matches_asset(&filter_settings, &asset)) {
   return true;
 }
-if (skip_local && ED_asset_handle_get_local_id(&asset) != nullptr) {
+if (!r_added_assets.add(ED_asset_handle_get_name(&asset))) {
+  /* If an asset with the same name has already been added, skip this. */
   return true;
 }
 search_items_for_asset_metadata(node_tree, library_ref, asset, 
search_items);
@@ -117,6 +119,7 @@ static void gather_search_items_for_asset_library(const 
bContext &C,
 
 static void gather_search_items_for_all_assets(const bContext &C,
const bNodeTree &node_tree,
+   Set 
&r_added_assets,
Vector 
&search_items)
 {
   int i;
@@ -125,13 +128,45 @@ static void gather_search_items_for_all_assets(const 
bContext &C,
 library_ref.custom_library_index = i;
 library_ref.type = ASSET_LIBRARY_CUSTOM;
 /* Skip local assets to avoid duplicates when the asset is part of the 
local file library. */
-gather_search_items_for_asset_library(C, node_tree, library_ref, true, 
search_items);
+gather_search_items_for_asset_library(C, node_tree, library_ref, 
r_added_assets, search_items);
   }
 
   AssetLibraryReference library_ref{};
   library_ref.custom_library_index = -1;
   library_ref.type = ASSET_LIBRARY_LOCAL;
-  gather_search_items_for_asset_library(C, node_tree, library_ref, false, 
search_items);
+  gather_search_items_for_asset_library(C, node_tree, library_ref, 
r_added_assets, search_items);
+}
+
+static void gather_search_items_for_node_groups(const bContext &C,
+const bNodeTree &node_tree,
+const Set 
&local_assets,
+Vector 
&search_items)
+{
+  const StringRef group_node_id = node_tree.typeinfo->group_idname;
+
+  Main &bmain = *CTX_data_main(&C);
+  LISTBASE_FOREACH (bNodeTree *, node_group, &bmain.nodetrees) {
+if (node_group->typeinfo->group_idname != group_node_id) {
+  continue;
+}
+if (local_assets.contains(node_group->id.name)) {
+  continue;
+}
+if (!nodeGroupPoll(&node_tree, node_group, nullptr)) {
+  continue;
+}
+AddNodeItem item{};
+item.ui_name = node_group->id.name + 2;
+item.identifier = node_tree.typeinfo->group_idname;
+item.after_add_fn = [node_group](const bContext &C, bNodeTree &node_tree, 
bNode &node) {
+  Main &bmain = *CTX_data_main(&C);
+  node.id = &node_group->id;
+  id_us_plus(node.id);
+  BKE_ntree_update_tag_node_property(&node_tree, &node);
+  DEG_relations_tag_update(&bmain);
+};
+search_items.append(std::move(item));
+  }
 }
 
 static void gather_add_node_operations(const bContext &C,
@@ -152,7 +187,12 @@ static void gather_add_node_operations(const bContext &C,
   }
   NODE_TYPES_END;
 
-  gather_search_items_for_all_assets(C, node_tree, r_search_items);
+  /* Use a set to avoid adding items for node groups tha

[Bf-blender-cvs] [1aeb742c85c] cycles_path_guiding: Disable guiding tests until new deterministic OpenPGL version.

2022-09-23 Thread Brecht Van Lommel
Commit: 1aeb742c85c828b94c97d6c6f73fecfd81a8e34f
Author: Brecht Van Lommel
Date:   Fri Sep 23 21:07:09 2022 +0200
Branches: cycles_path_guiding
https://developer.blender.org/rB1aeb742c85c828b94c97d6c6f73fecfd81a8e34f

Disable guiding tests until new deterministic OpenPGL version.

===

M   tests/python/CMakeLists.txt

===

diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt
index 181a09b81ef..1aafdac30d8 100644
--- a/tests/python/CMakeLists.txt
+++ b/tests/python/CMakeLists.txt
@@ -677,9 +677,10 @@ if(WITH_CYCLES OR WITH_OPENGL_RENDER_TESTS)
   list(APPEND render_tests denoise)
 endif()
 
-if(WITH_CYCLES_PATH_GUIDING)
-  list(APPEND render_tests guiding)
-endif()
+# Disabled until new OpenGL version with deterministic results.
+#if(WITH_CYCLES_PATH_GUIDING)
+#  list(APPEND render_tests guiding)
+#endif()
 
 if(WITH_OPENGL_RENDER_TESTS)
   list(APPEND render_tests grease_pencil)

___
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] [a6396b143d1] cycles_path_guiding: Workaround HIP compiler bug

2022-09-23 Thread Brecht Van Lommel
Commit: a6396b143d1ab5808eb43113a68daa472d5d94a8
Author: Brecht Van Lommel
Date:   Fri Sep 23 21:06:23 2022 +0200
Branches: cycles_path_guiding
https://developer.blender.org/rBa6396b143d1ab5808eb43113a68daa472d5d94a8

Workaround HIP compiler bug

Cause is unclear, just changing around code enough to sidestep it.

===

M   intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
M   intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h
M   intern/cycles/kernel/closure/bsdf_hair_principled.h

===

diff --git a/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h 
b/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
index 679b5061fff..14a4094d485 100644
--- a/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
+++ b/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
@@ -52,56 +52,55 @@ ccl_device_forceinline Spectrum 
bsdf_ashikhmin_shirley_eval(ccl_private const Sh
 
   float out = 0.0f;
 
-  if (fmaxf(bsdf->alpha_x, bsdf->alpha_y) <= 1e-4f) {
+  if (fmaxf(bsdf->alpha_x, bsdf->alpha_y) <= 1e-4f || !(NdotI > 0.0f && NdotO 
> 0.0f)) {
 *pdf = 0.0f;
 return zero_spectrum();
   }
-  if (NdotI > 0.0f && NdotO > 0.0f) {
-NdotI = fmaxf(NdotI, 1e-6f);
-NdotO = fmaxf(NdotO, 1e-6f);
-float3 H = normalize(omega_in + I);
-float HdotI = fmaxf(fabsf(dot(H, I)), 1e-6f);
-float HdotN = fmaxf(dot(H, N), 1e-6f);
-
-/* pump from original paper
- * (first derivative disc., but cancels the HdotI in the pdf nicely) */
-float pump = 1.0f / fmaxf(1e-6f, (HdotI * fmaxf(NdotO, NdotI)));
-/* pump from d-brdf paper */
-/*float pump = 1.0f / fmaxf(1e-4f, ((NdotO + NdotI) * (NdotO*NdotI))); */
-
-float n_x = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_x);
-float n_y = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_y);
-
-if (n_x == n_y) {
-  /* isotropic */
-  float e = n_x;
-  float lobe = powf(HdotN, e);
-  float norm = (n_x + 1.0f) / (8.0f * M_PI_F);
-
-  out = NdotO * norm * lobe * pump;
-  /* this is p_h / 4(H.I)  (conversion from 'wh measure' to 'wi measure', 
eq. 8 in paper). */
-  *pdf = norm * lobe / HdotI;
+
+  NdotI = fmaxf(NdotI, 1e-6f);
+  NdotO = fmaxf(NdotO, 1e-6f);
+  float3 H = normalize(omega_in + I);
+  float HdotI = fmaxf(fabsf(dot(H, I)), 1e-6f);
+  float HdotN = fmaxf(dot(H, N), 1e-6f);
+
+  /* pump from original paper
+   * (first derivative disc., but cancels the HdotI in the pdf nicely) */
+  float pump = 1.0f / fmaxf(1e-6f, (HdotI * fmaxf(NdotO, NdotI)));
+  /* pump from d-brdf paper */
+  /*float pump = 1.0f / fmaxf(1e-4f, ((NdotO + NdotI) * (NdotO*NdotI))); */
+
+  float n_x = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_x);
+  float n_y = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_y);
+
+  if (n_x == n_y) {
+/* isotropic */
+float e = n_x;
+float lobe = powf(HdotN, e);
+float norm = (n_x + 1.0f) / (8.0f * M_PI_F);
+
+out = NdotO * norm * lobe * pump;
+/* this is p_h / 4(H.I)  (conversion from 'wh measure' to 'wi measure', 
eq. 8 in paper). */
+*pdf = norm * lobe / HdotI;
+  }
+  else {
+/* anisotropic */
+float3 X, Y;
+make_orthonormals_tangent(N, bsdf->T, &X, &Y);
+
+float HdotX = dot(H, X);
+float HdotY = dot(H, Y);
+float lobe;
+if (HdotN < 1.0f) {
+  float e = (n_x * HdotX * HdotX + n_y * HdotY * HdotY) / (1.0f - HdotN * 
HdotN);
+  lobe = powf(HdotN, e);
 }
 else {
-  /* anisotropic */
-  float3 X, Y;
-  make_orthonormals_tangent(N, bsdf->T, &X, &Y);
-
-  float HdotX = dot(H, X);
-  float HdotY = dot(H, Y);
-  float lobe;
-  if (HdotN < 1.0f) {
-float e = (n_x * HdotX * HdotX + n_y * HdotY * HdotY) / (1.0f - HdotN 
* HdotN);
-lobe = powf(HdotN, e);
-  }
-  else {
-lobe = 1.0f;
-  }
-  float norm = sqrtf((n_x + 1.0f) * (n_y + 1.0f)) / (8.0f * M_PI_F);
-
-  out = NdotO * norm * lobe * pump;
-  *pdf = norm * lobe / HdotI;
+  lobe = 1.0f;
 }
+float norm = sqrtf((n_x + 1.0f) * (n_y + 1.0f)) / (8.0f * M_PI_F);
+
+out = NdotO * norm * lobe * pump;
+*pdf = norm * lobe / HdotI;
   }
 
   return make_spectrum(out);
@@ -136,81 +135,84 @@ ccl_device int bsdf_ashikhmin_shirley_sample(ccl_private 
const ShaderClosure *sc
   int label = LABEL_REFLECT | LABEL_GLOSSY;
 
   float NdotI = dot(N, I);
-  if (NdotI > 0.0f) {
+  if (!(NdotI > 0.0f)) {
+*pdf = 0.0f;
+*eval = zero_spectrum();
+return LABEL_NONE;
+  }
 
-float n_x = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_x);
-float n_y = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_y);
+  float n_x = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_x);
+  float n_y = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_y);
 
-/* get x,y basis on the surface for anisotropy *

[Bf-blender-cvs] [5f10d9990a0] cycles_path_guiding: Fix CUDA build error

2022-09-23 Thread Brecht Van Lommel
Commit: 5f10d9990a0a84fee4e533dcc69949745803f18f
Author: Brecht Van Lommel
Date:   Fri Sep 23 21:06:15 2022 +0200
Branches: cycles_path_guiding
https://developer.blender.org/rB5f10d9990a0a84fee4e533dcc69949745803f18f

Fix CUDA build error

===

M   intern/cycles/kernel/integrator/guiding.h

===

diff --git a/intern/cycles/kernel/integrator/guiding.h 
b/intern/cycles/kernel/integrator/guiding.h
index cff5478f427..a2b7d285413 100644
--- a/intern/cycles/kernel/integrator/guiding.h
+++ b/intern/cycles/kernel/integrator/guiding.h
@@ -9,8 +9,6 @@
 #  include "kernel/film/write.h"
 #endif
 
-#include 
-
 CCL_NAMESPACE_BEGIN
 
 /* Utilities. */

___
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] [dedc679ecab] master: Geometry Nodes: Split transfer attribute node

2022-09-23 Thread Hans Goudey
Commit: dedc679ecabb43e79b0160a7c64bbd616adfa829
Author: Hans Goudey
Date:   Fri Sep 23 13:56:35 2022 -0500
Branches: master
https://developer.blender.org/rBdedc679ecabb43e79b0160a7c64bbd616adfa829

Geometry Nodes: Split transfer attribute node

This patch replaces the existing transfer attribute node with three
nodes, "Sample Nearest Surface", "Sample Index", and "Sample Nearest".
This follows the design in T100010, allowing for new nodes like UV
sampling in the future. There is versioning so the new nodes replace
the old ones and are relinked as necessary.

The "Sample Nearest Surface" node is meant for the more complex
sampling algorithms that only work on meshes and interpolate
values inside of faces.

The new "Sample Index" just retrieves attributes from a geometry at
specific indices. It doesn't have implicit behavior like the old
transfer mode, which should make it more predictable. In order to not
change the behavior from existing files, the node has a has a "Clamp",
which is off by default for consistency with the "Field at Index" node.

The "Sample Nearest" node returns the index of the nearest element
on a geometry. It can be combined with the "Sample Index" node for
the same functionality as the old transfer node. This node can support
curves in the future.

Backwards compatibility is handled by versioning, but old versions can
not understand these nodes. The warning from 680fa8a523e0 should make
this explicit in 3.3 and earlier.

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

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.cc
M   source/blender/blenloader/intern/versioning_300.cc
M   source/blender/blenloader/intern/versioning_common.cc
M   source/blender/blenloader/intern/versioning_common.h
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/RNA_enum_items.h
M   source/blender/makesrna/intern/rna_attribute.c
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/NOD_geometry.h
M   source/blender/nodes/NOD_static_types.h
M   source/blender/nodes/geometry/CMakeLists.txt
M   source/blender/nodes/geometry/node_geometry_util.hh
M   source/blender/nodes/geometry/nodes/node_geo_field_at_index.cc
A   source/blender/nodes/geometry/nodes/node_geo_sample_index.cc
A   source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc
A   source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc
D   source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index d2188515e16..95bb9fd7e40 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -117,6 +117,7 @@ def mesh_node_items(context):
 yield NodeItem("GeometryNodeMeshToCurve")
 yield NodeItem("GeometryNodeMeshToPoints")
 yield NodeItem("GeometryNodeMeshToVolume")
+yield NodeItem("GeometryNodeSampleNearestSurface")
 yield NodeItem("GeometryNodeScaleElements")
 yield NodeItem("GeometryNodeSplitEdges")
 yield NodeItem("GeometryNodeSubdivideMesh")
@@ -154,6 +155,8 @@ def geometry_node_items(context):
 yield NodeItem("GeometryNodeJoinGeometry")
 yield NodeItem("GeometryNodeMergeByDistance")
 yield NodeItem("GeometryNodeRaycast")
+yield NodeItem("GeometryNodeSampleIndex")
+yield NodeItem("GeometryNodeSampleNearest")
 yield NodeItem("GeometryNodeSeparateComponents")
 yield NodeItem("GeometryNodeSeparateGeometry")
 yield NodeItem("GeometryNodeTransform")
@@ -650,7 +653,6 @@ geometry_node_categories = [
 NodeItem("GeometryNodeCaptureAttribute"),
 NodeItem("GeometryNodeAttributeDomainSize"),
 NodeItem("GeometryNodeAttributeStatistic"),
-NodeItem("GeometryNodeAttributeTransfer"),
 NodeItem("GeometryNodeRemoveAttribute"),
 NodeItem("GeometryNodeStoreNamedAttribute"),
 ]),
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index f3e49536473..14cf8164b79 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1480,7 +1480,7 @@ struct TexResult;
 #define GEO_NODE_ROTATE_INSTANCES 1122
 #define GEO_NODE_SPLIT_EDGES 1123
 #define GEO_NODE_MESH_TO_CURVE 1124
-#define GEO_NODE_TRANSFER_ATTRIBUTE 1125
+#define GEO_NODE_TRANSFER_ATTRIBUTE_DEPRECATED 1125
 #define GEO_NODE_SUBDIVISION_SURFACE 1126
 #define GEO_NODE_CURVE_ENDPOINT_SELECTION 1127
 #define GEO_NODE_RAYCAST 1128
@@ -1528,6 +1528,9 @@ struct TexResult;
 #define GEO_NODE_MESH_FACE_SET_BOUNDARIES 1171
 #define GEO_NODE_DISTRIBUTE_POINTS_IN_VOLUME 1172
 #define GEO_NODE_SELF_OBJECT 1173
+#define G

[Bf-blender-cvs] [0f36ad24b50] refactor-mesh-position-generic: Slight cleanup

2022-09-23 Thread Hans Goudey
Commit: 0f36ad24b5031f78664a935a3c483751e173e308
Author: Hans Goudey
Date:   Fri Sep 23 13:27:27 2022 -0500
Branches: refactor-mesh-position-generic
https://developer.blender.org/rB0f36ad24b5031f78664a935a3c483751e173e308

Slight cleanup

===

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

===

diff --git a/source/blender/blenkernel/intern/subdiv_mesh.cc 
b/source/blender/blenkernel/intern/subdiv_mesh.cc
index 815670e8179..fd565a6e479 100644
--- a/source/blender/blenkernel/intern/subdiv_mesh.cc
+++ b/source/blender/blenkernel/intern/subdiv_mesh.cc
@@ -39,7 +39,6 @@ struct SubdivMeshContext {
   const SubdivToMeshSettings *settings;
   const Mesh *coarse_mesh;
   const float (*coarse_positions)[3];
-
   const MEdge *coarse_edges;
   const MPoly *coarse_polys;
   const MLoop *coarse_loops;

___
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] [b59f40972be] refactor-mesh-position-generic: Merge branch 'refactor-mesh-selection-generic' into refactor-mesh-position-generic

2022-09-23 Thread Hans Goudey
Commit: b59f40972be45b4009ee1069e3e9d8c216a3e00c
Author: Hans Goudey
Date:   Fri Sep 23 11:10:21 2022 -0500
Branches: refactor-mesh-position-generic
https://developer.blender.org/rBb59f40972be45b4009ee1069e3e9d8c216a3e00c

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

===



===

diff --cc source/blender/blenkernel/intern/customdata.cc
index 7033d82efbb,51c3b405ebc..6a3f254a436
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@@ -2125,13 -2120,13 +2123,13 @@@ const CustomData_MeshMasks CD_MASK_BARE
  /* lmask */ CD_MASK_MLOOP,
  };
  const CustomData_MeshMasks CD_MASK_MESH = {
- /* vmask */ (CD_MASK_PROP_FLOAT3 | CD_MASK_MDEFORMVERT | 
CD_MASK_MVERT_SKIN |
-  CD_MASK_PAINT_MASK | CD_MASK_PROP_ALL | CD_MASK_CREASE | 
CD_MASK_BWEIGHT),
- /* emask */ (CD_MASK_MEDGE | CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL | 
CD_MASK_BWEIGHT),
 -/* vmask */ (CD_MASK_MVERT | CD_MASK_MDEFORMVERT | CD_MASK_MVERT_SKIN | 
CD_MASK_PAINT_MASK |
++/* vmask */ (CD_MASK_PROP_FLOAT3 | CD_MASK_MDEFORMVERT | 
CD_MASK_MVERT_SKIN | CD_MASK_PAINT_MASK |
+  CD_MASK_PROP_ALL | CD_MASK_CREASE | CD_MASK_BWEIGHT),
+ /* emask */
+ (CD_MASK_MEDGE | CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL | 
CD_MASK_BWEIGHT | CD_MASK_CREASE),
  /* fmask */ 0,
  /* pmask */
- (CD_MASK_MPOLY | CD_MASK_FACEMAP | CD_MASK_FREESTYLE_FACE | 
CD_MASK_PROP_ALL |
-  CD_MASK_SCULPT_FACE_SETS),
+ (CD_MASK_MPOLY | CD_MASK_FACEMAP | CD_MASK_FREESTYLE_FACE | 
CD_MASK_PROP_ALL),
  /* lmask */
  (CD_MASK_MLOOP | CD_MASK_MDISPS | CD_MASK_MLOOPUV | 
CD_MASK_CUSTOMLOOPNORMAL |
   CD_MASK_GRID_PAINT_MASK | CD_MASK_PROP_ALL),
diff --cc source/blender/blenkernel/intern/mesh.cc
index 90b54e8a8a2,6df6cd31cf4..2d27d185cd9
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@@ -259,18 -259,12 +257,20 @@@ static void mesh_blend_write(BlendWrite
".hide_edge",
".hide_poly",
"material_index",
-   ".selection_vert",
-   ".selection_edge",
-   ".selection_poly"});
+   ".select_vert",
+   ".select_edge",
+   ".select_poly"});
  
 +  mesh->mvert = BKE_mesh_legacy_convert_positions_to_verts(
 +  mesh, temp_arrays_for_legacy_format, vert_layers);
 +  BKE_mesh_legacy_convert_hide_layers_to_flags(mesh);
 +  BKE_mesh_legacy_convert_selection_layers_to_flags(mesh);
 +  BKE_mesh_legacy_convert_material_indices_to_mpoly(mesh);
 +  BKE_mesh_legacy_bevel_weight_from_layers(mesh);
++  BKE_mesh_legacy_face_set_from_generic(mesh);
++  BKE_mesh_legacy_edge_crease_from_layers(mesh);
 +
/* Set deprecated mesh data pointers for forward compatibility. */
 -  mesh->mvert = const_cast(mesh->verts().data());
mesh->medge = const_cast(mesh->edges().data());
mesh->mpoly = const_cast(mesh->polys().data());
mesh->mloop = const_cast(mesh->loops().data());
diff --cc source/blender/blenkernel/intern/mesh_legacy_convert.cc
index 3b44a2050eb,60014545f49..795dc693738
--- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
@@@ -1028,9 -1088,10 +1093,10 @@@ void BKE_mesh_legacy_convert_flags_to_h
using namespace blender::bke;
MutableAttributeAccessor attributes = mesh->attributes_for_write();
  
 -  const Span verts = mesh->verts();
 +  const Span verts(mesh->mvert, mesh->totvert);
-   if (std::any_of(
-   verts.begin(), verts.end(), [](const MVert &vert) { return 
vert.flag & ME_HIDE; })) {
+   if (std::any_of(verts.begin(), verts.end(), [](const MVert &vert) {
+ return vert.flag_legacy & ME_HIDE;
+   })) {
  SpanAttributeWriter hide_vert = 
attributes.lookup_or_add_for_write_only_span(
  ".hide_vert", ATTR_DOMAIN_POINT);
  threading::parallel_for(verts.index_range(), 4096, [&](IndexRange range) {
@@@ -1120,12 -1181,12 +1186,12 @@@ void BKE_mesh_legacy_convert_selection_
using namespace blender::bke;
const AttributeAccessor attributes = mesh->attributes();
  
 -  MutableSpan verts = mesh->verts_for_write();
 +  MutableSpan verts(mesh->mvert, mesh->totvert);
-   const VArray selection_vert = attributes.lookup_or_default(
-   ".selection_vert", ATTR_DOMAIN_POINT, false);
+   const VArray select_vert = attributes.lookup_or_default(
+   ".select_vert", ATTR_DOMAIN_POINT, false);
threading::parallel_for(verts.index_range(), 4096, [&](IndexRange range)

[Bf-blender-cvs] [e72254e56f6] refactor-mesh-position-generic: Add missing DNA rename

2022-09-23 Thread Hans Goudey
Commit: e72254e56f60ef0aa132f2be7d0320a5b6bfaaa6
Author: Hans Goudey
Date:   Fri Sep 23 12:33:03 2022 -0500
Branches: refactor-mesh-position-generic
https://developer.blender.org/rBe72254e56f60ef0aa132f2be7d0320a5b6bfaaa6

Add missing DNA rename

===

M   source/blender/makesdna/intern/dna_rename_defs.h

===

diff --git a/source/blender/makesdna/intern/dna_rename_defs.h 
b/source/blender/makesdna/intern/dna_rename_defs.h
index ec624bcb64e..4afef30494b 100644
--- a/source/blender/makesdna/intern/dna_rename_defs.h
+++ b/source/blender/makesdna/intern/dna_rename_defs.h
@@ -100,6 +100,7 @@ DNA_STRUCT_RENAME_ELEM(Object_Runtime, 
crazyspace_num_verts, crazyspace_verts_nu
 DNA_STRUCT_RENAME_ELEM(MEdge, bweight, bweight_legacy)
 DNA_STRUCT_RENAME_ELEM(MEdge, crease, crease_legacy)
 DNA_STRUCT_RENAME_ELEM(MPoly, mat_nr, mat_nr_legacy)
+DNA_STRUCT_RENAME_ELEM(MVert, co, co_legacy)
 DNA_STRUCT_RENAME_ELEM(MVert, bweight, bweight_legacy)
 DNA_STRUCT_RENAME_ELEM(MVert, flag, flag_legacy)
 DNA_STRUCT_RENAME_ELEM(ParticleSettings, child_nbr, child_percent)

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

2022-09-23 Thread Hans Goudey
Commit: a58670813f2124ead4e109efcc58175200797aa1
Author: Hans Goudey
Date:   Fri Sep 23 11:18:22 2022 -0500
Branches: refactor-mesh-position-generic
https://developer.blender.org/rBa58670813f2124ead4e109efcc58175200797aa1

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

===



===

diff --cc source/blender/blenkernel/intern/mesh_legacy_convert.cc
index 795dc693738,506501ead2a..b2a288cf365
--- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
@@@ -1262,53 -1257,3 +1262,53 @@@ void BKE_mesh_legacy_convert_flags_to_s
  }
  
  /** \} */
 +
 +/*  */
 +/** \name Vertex and Position Conversion
 + * \{ */
 +
 +MVert *BKE_mesh_legacy_convert_positions_to_verts(
 +Mesh *mesh,
 +blender::ResourceScope &temp_arrays_for_convert,
 +blender::Vector &vert_layers_to_write)
 +{
 +  using namespace blender;
 +
 +  const Span positions = mesh->positions();
 +
 +  CustomDataLayer mvert_layer{};
 +  mvert_layer.type = CD_MVERT;
 +  MutableSpan verts = 
temp_arrays_for_convert.construct>(mesh->totvert);
 +  mvert_layer.data = verts.data();
 +
 +  threading::parallel_for(verts.index_range(), 2048, [&](IndexRange range) {
 +for (const int i : range) {
-   copy_v3_v3(verts[i].co, positions[i]);
++  copy_v3_v3(verts[i].co_legacy, positions[i]);
 +}
 +  });
 +
 +  vert_layers_to_write.append(mvert_layer);
 +  return verts.data();
 +}
 +
 +void BKE_mesh_legacy_convert_verts_to_positions(Mesh *mesh)
 +{
 +  using namespace blender;
 +  using namespace blender::bke;
 +
 +  const Span verts(static_cast(CustomData_get_layer(&mesh->vdata, CD_MVERT)),
 +  mesh->totvert);
 +  MutableSpan positions(
 +  static_cast(CustomData_add_layer_named(
 +  &mesh->vdata, CD_PROP_FLOAT3, CD_CONSTRUCT, nullptr, mesh->totvert, 
"position")),
 +  mesh->totvert);
 +  threading::parallel_for(verts.index_range(), 2048, [&](IndexRange range) {
 +for (const int i : range) {
-   positions[i] = verts[i].co;
++  positions[i] = verts[i].co_legacy;
 +}
 +  });
 +
 +  CustomData_free_layers(&mesh->vdata, CD_MVERT, mesh->totvert);
 +}
 +
 +/** \} */
diff --cc source/blender/blenkernel/intern/mesh_runtime.cc
index bf841ccd336,782657428f5..e8076cb9947
--- a/source/blender/blenkernel/intern/mesh_runtime.cc
+++ b/source/blender/blenkernel/intern/mesh_runtime.cc
@@@ -155,10 -154,10 +155,10 @@@ void BKE_mesh_runtime_looptri_recalc(Me
const Span polys = mesh->polys();
const Span loops = mesh->loops();
  
-   if (BKE_mesh_poly_normals_are_dirty(mesh)) {
+   if (!BKE_mesh_poly_normals_are_dirty(mesh)) {
  BKE_mesh_recalc_looptri_with_normals(loops.data(),
   polys.data(),
 - verts.data(),
 + reinterpret_cast(positions.data()),
   mesh->totloop,
   mesh->totpoly,
   mesh->runtime.looptris.array_wip,
diff --cc source/blender/blenloader/intern/versioning_250.c
index 5a342ef3a0d,9e5ef41892a..2ebb7563ab3
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@@ -996,9 -996,9 +996,9 @@@ void blo_do_versions_250(FileData *fd, 
if ((key = blo_do_versions_newlibadr(fd, lib, me->key)) && key->refkey) 
{
  data = key->refkey->data;
  tot = MIN2(me->totvert, key->refkey->totelem);
 -MVert *verts = BKE_mesh_verts_for_write(me);
 +MVert *verts = (MVert *)CustomData_get_layer(&me->vdata, CD_MVERT);
  for (a = 0; a < tot; a++, data += 3) {
--  copy_v3_v3(verts[a].co, data);
++  copy_v3_v3(verts[a].co_legacy, data);
  }
}
  }
diff --cc source/blender/editors/object/object_vgroup.cc
index e10cb88b4ad,44fea0b32f0..9a209cf9722
--- a/source/blender/editors/object/object_vgroup.cc
+++ b/source/blender/editors/object/object_vgroup.cc
@@@ -1531,15 -1531,15 +1531,14 @@@ static void vgroup_fix
int i;
  
Mesh *me = static_cast(ob->data);
-   float3 *positions = me->positions_for_write().data();
 -  MVert *mvert = me->verts_for_write().data();
if (!(me->editflag & ME_EDIT_PAINT_VERT_SEL)) {
  return;
}
const bke::AttributeAccessor attributes = me->attributes();
-   const VArray selection_vert = attributes.lookup_or_default(
-   ".selection_vert", ATTR_DOMAIN_POINT, false);
+   const VArray select_vert = attributes.lookup_or_default(
+   ".select_vert", ATTR_DOMAIN_POINT, false);
 -  for (i = 0; i < me->totvert && mvert; i++, mvert++) {
 +  for (i = 0; i < me->totvert; i++) {
- if (selection_vert[i]) {
+ if (select_vert[i]) {

[Bf-blender-cvs] [2ada25e5870] refactor-mesh-position-generic: Renamings

2022-09-23 Thread Hans Goudey
Commit: 2ada25e58706c64e10a690f062a65029b8f62ce8
Author: Hans Goudey
Date:   Fri Sep 23 09:35:10 2022 -0500
Branches: refactor-mesh-position-generic
https://developer.blender.org/rB2ada25e58706c64e10a690f062a65029b8f62ce8

Renamings

===

M   source/blender/blenkernel/BKE_mesh_mapping.h
M   source/blender/blenkernel/intern/attribute_access.cc
M   source/blender/blenkernel/intern/customdata.cc
M   source/blender/blenkernel/intern/mesh.cc
M   source/blender/blenkernel/intern/mesh_calc_edges.cc
M   source/blender/blenkernel/intern/mesh_evaluate.cc
M   source/blender/blenkernel/intern/mesh_legacy_convert.cc
M   source/blender/blenkernel/intern/mesh_mapping.cc
M   source/blender/blenkernel/intern/object_deform.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/draw/intern/draw_cache_impl_subdivision.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh.hh
M   source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc
M   
source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_lnor.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
M   source/blender/editors/armature/armature_skinning.c
M   source/blender/editors/armature/meshlaplacian.c
M   source/blender/editors/mesh/editface.cc
M   source/blender/editors/mesh/mesh_data.cc
M   source/blender/editors/object/object_modifier.cc
M   source/blender/editors/object/object_vgroup.cc
M   source/blender/editors/sculpt_paint/paint_image_proj.c
M   source/blender/editors/sculpt_paint/paint_vertex.cc
M   source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc
M   source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
M   source/blender/editors/space_view3d/view3d_select.cc
M   source/blender/makesdna/DNA_meshdata_types.h
M   source/blender/makesrna/intern/rna_mesh.c
M   tests/python/modules/mesh_test.py

===

diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h 
b/source/blender/blenkernel/BKE_mesh_mapping.h
index 60ef4825f88..2ee50fbaaee 100644
--- a/source/blender/blenkernel/BKE_mesh_mapping.h
+++ b/source/blender/blenkernel/BKE_mesh_mapping.h
@@ -93,7 +93,7 @@ typedef struct MeshElemMap {
 /* mapping */
 UvVertMap *BKE_mesh_uv_vert_map_create(const struct MPoly *mpoly,
const bool *hide_poly,
-   const bool *selection_poly,
+   const bool *select_poly,
const struct MLoop *mloop,
const struct MLoopUV *mloopuv,
unsigned int totpoly,
diff --git a/source/blender/blenkernel/intern/attribute_access.cc 
b/source/blender/blenkernel/intern/attribute_access.cc
index df7787986db..b86353bdb74 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -58,7 +58,7 @@ const char *no_procedural_access_message =
 
 bool allow_procedural_attribute_access(StringRef attribute_name)
 {
-  return !attribute_name.startswith(".sculpt") && 
!attribute_name.startswith(".selection") &&
+  return !attribute_name.startswith(".sculpt") && 
!attribute_name.startswith(".select") &&
  !attribute_name.startswith(".hide");
 }
 
diff --git a/source/blender/blenkernel/intern/customdata.cc 
b/source/blender/blenkernel/intern/customdata.cc
index 55d3797cd5d..51c3b405ebc 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -2376,9 +2376,9 @@ static bool attribute_stored_in_bmesh_flag(const 
StringRef name)
   ".hide_vert",
   ".hide_edge",
   ".hide_poly",
-  ".selection_vert",
-  ".selection_edge",
-  ".selection_poly",
+  ".select_vert",
+  ".select_edge",
+  ".select_poly",
   "material_index");
 }
 
diff --git a/source/blender/blenkernel/intern/mesh.cc 
b/source/blender/blenkernel/intern/mesh.cc
index 336c41c8e10..6df6cd31cf4 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -259,9 +259,9 @@ static void mesh_blend_write(BlendWriter *writer, ID *id, 
const void *id_address
   ".hide_edge",
   ".hide_poly",
   "material_index",
-  ".selection_vert",
-   

[Bf-blender-cvs] [b0c79dec001] refactor-mesh-position-generic: Merge branch 'master' into refactor-mesh-position-generic

2022-09-23 Thread Hans Goudey
Commit: b0c79dec0011d87d07fc47537af24d938880153e
Author: Hans Goudey
Date:   Fri Sep 23 12:32:45 2022 -0500
Branches: refactor-mesh-position-generic
https://developer.blender.org/rBb0c79dec0011d87d07fc47537af24d938880153e

Merge branch 'master' into refactor-mesh-position-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] [1c43caa51b4] refactor-mesh-position-generic: Merge branch 'master' into refactor-mesh-selection-generic

2022-09-23 Thread Hans Goudey
Commit: 1c43caa51b4160eaf51d13e8fc2d52beb0c3937b
Author: Hans Goudey
Date:   Fri Sep 23 09:06:20 2022 -0500
Branches: refactor-mesh-position-generic
https://developer.blender.org/rB1c43caa51b4160eaf51d13e8fc2d52beb0c3937b

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

===



===

diff --cc source/blender/blenkernel/intern/mesh.cc
index 9a6770af200,34cebeaa5d4..336c41c8e10
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@@ -251,17 -248,12 +249,19 @@@ static void mesh_blend_write(BlendWrite
  Set names_to_skip;
  if (!BLO_write_is_undo(writer)) {
BKE_mesh_legacy_convert_hide_layers_to_flags(mesh);
 +  BKE_mesh_legacy_convert_selection_layers_to_flags(mesh);
BKE_mesh_legacy_convert_material_indices_to_mpoly(mesh);
BKE_mesh_legacy_bevel_weight_from_layers(mesh);
+   BKE_mesh_legacy_face_set_from_generic(mesh);
+   BKE_mesh_legacy_edge_crease_from_layers(mesh);
/* When converting to the old mesh format, don't save redundant 
attributes. */
 -  names_to_skip.add_multiple_new({".hide_vert", ".hide_edge", 
".hide_poly", "material_index"});
 +  names_to_skip.add_multiple_new({".hide_vert",
 +  ".hide_edge",
 +  ".hide_poly",
 +  "material_index",
 +  ".selection_vert",
 +  ".selection_edge",
 +  ".selection_poly"});
  
/* Set deprecated mesh data pointers for forward compatibility. */
mesh->mvert = const_cast(mesh->verts().data());
diff --cc source/blender/bmesh/intern/bmesh_mesh_convert.cc
index 689bdcf68ec,a52f95c1e9d..baea51a689d
--- a/source/blender/bmesh/intern/bmesh_mesh_convert.cc
+++ b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
@@@ -889,17 -832,24 +830,17 @@@ static void write_fn_to_attribute(blend
const GetFn &get_fn)
  {
using namespace blender;
 -  if (do_write) {
 -bke::SpanAttributeWriter attribute = 
attributes.lookup_or_add_for_write_only_span(
 -attribute_name, domain);
 -threading::parallel_for(attribute.span.index_range(), 4096, 
[&](IndexRange range) {
 -  for (const int i : range) {
 -attribute.span[i] = get_fn(i);
 -  }
 -});
 -attribute.finish();
 -  }
 -  else {
 -/* To avoid overhead, remove the hide attribute if possible. */
 -attributes.remove(attribute_name);
 -  }
 +  bke::SpanAttributeWriter attribute = 
attributes.lookup_or_add_for_write_only_span(
 +  attribute_name, domain);
 +  threading::parallel_for(attribute.span.index_range(), 4096, [&](IndexRange 
range) {
 +for (const int i : range) {
 +  attribute.span[i] = get_fn(i);
 +}
 +  });
 +  attribute.finish();
  }
  
- static void assert_bmesh_has_no_mesh_only_attributes(BMesh &bm)
+ static void assert_bmesh_has_no_mesh_only_attributes(const BMesh &bm)
  {
(void)bm; /* Unused in the release builds. */
  
@@@ -1440,9 -1302,4 +1368,7 @@@ void BM_mesh_bm_to_me_for_eval(BMesh *b
hide_vert_attribute.finish();
hide_edge_attribute.finish();
hide_poly_attribute.finish();
 +  selection_vert_attribute.finish();
 +  selection_edge_attribute.finish();
 +  selection_poly_attribute.finish();
- 
-   me->cd_flag = BM_mesh_cd_flag_from_bmesh(bm);
  }

___
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] [d5554cdc7c9] master: Fix T100741: Update FFMPEG Dimensions

2022-09-23 Thread Harley Acheson
Commit: d5554cdc7c900880571c4265c9f3f7a7cfec6071
Author: Harley Acheson
Date:   Fri Sep 23 10:49:01 2022 -0700
Branches: master
https://developer.blender.org/rBd5554cdc7c900880571c4265c9f3f7a7cfec6071

Fix T100741: Update FFMPEG Dimensions

Update the animation's dimensions within ffmpeg_fetchibuf in case it
has changed because of dynamic resolution (possible with WebM).

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

Reviewed by Richard Antalik

===

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

===

diff --git a/source/blender/imbuf/intern/anim_movie.c 
b/source/blender/imbuf/intern/anim_movie.c
index 4e6a52f8464..36ebe2b7cff 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -1406,6 +1406,10 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int 
position, IMB_Timecode_Typ
 
   ffmpeg_decode_video_frame_scan(anim, pts_to_search);
 
+  /* Update resolution as it can change per-frame with WebM. See T100741 & 
T100081. */
+  anim->x = anim->pCodecCtx->width;
+  anim->y = anim->pCodecCtx->height;
+
   IMB_freeImBuf(anim->cur_frame_final);
 
   /* Certain versions of FFmpeg have a bug in libswscale which ends up in crash

___
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] [4636750b060] asset-lite-greasepencil: Merge branch 'master' into asset-lite-greasepencil

2022-09-23 Thread Antonio Vazquez
Commit: 4636750b0609f35b2e50c5bd1d57d8aa43fcc03e
Author: Antonio Vazquez
Date:   Fri Sep 23 19:38:13 2022 +0200
Branches: asset-lite-greasepencil
https://developer.blender.org/rB4636750b0609f35b2e50c5bd1d57d8aa43fcc03e

Merge branch 'master' into asset-lite-greasepencil

 Conflicts:
source/blender/editors/space_view3d/space_view3d.cc

===



===



___
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] [d12f0d3f703] master: Fix: Crash with empty vertex group in mask modifier

2022-09-23 Thread Hans Goudey
Commit: d12f0d3f70322ef01eef6e8ec72f7fbaf5a191ba
Author: Hans Goudey
Date:   Fri Sep 23 12:31:55 2022 -0500
Branches: master
https://developer.blender.org/rBd12f0d3f70322ef01eef6e8ec72f7fbaf5a191ba

Fix: Crash with empty vertex group in mask modifier

The C++ vertex group data accessor returned a span with null data that
wasn't empty. Instead of adding a null check as well as the size check,
just return an empty span when there is no vertex group data.

===

M   source/blender/blenkernel/BKE_mesh.h

===

diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index c1f4d9733aa..de89abf9cf6 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -1139,7 +1139,11 @@ inline blender::MutableSpan 
Mesh::loops_for_write()
 
 inline blender::Span Mesh::deform_verts() const
 {
-  return {BKE_mesh_deform_verts(this), this->totvert};
+  const MDeformVert *dverts = BKE_mesh_deform_verts(this);
+  if (!dverts) {
+return {};
+  }
+  return {dverts, this->totvert};
 }
 inline blender::MutableSpan Mesh::deform_verts_for_write()
 {

___
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] [392855ce502] master: GPencil: Improve Fill Tool Extend lines

2022-09-23 Thread Antonio Vazquez
Commit: 392855ce5022ccfeaa52efc04b13a7208ed0dc3f
Author: Antonio Vazquez
Date:   Fri Sep 23 18:49:54 2022 +0200
Branches: master
https://developer.blender.org/rB392855ce5022ccfeaa52efc04b13a7208ed0dc3f

GPencil: Improve Fill Tool Extend lines

* Improve how the extend lines collision is calculated.
* Added `S` key to switch between modes.
*  Now extend factor does not disable visual aids (thi sis done with checkbox).
* Reduce the use of linked list and now memory array is used.
* Refactor Radius functions.
* Fixed bug of Radius mode when object is rotated.
* Cleanup code.

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

===

M   release/scripts/startup/bl_ui/space_view3d_toolbar.py
M   source/blender/editors/gpencil/gpencil_fill.c
M   source/blender/makesdna/DNA_brush_enums.h
M   source/blender/makesrna/intern/rna_brush.c

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index ecc72e1bbb8..95185c2a2f5 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1889,10 +1889,8 @@ class 
VIEW3D_PT_tools_grease_pencil_brush_gap_closure(View3DPanel, Panel):
 
 col.prop(gp_settings, "extend_stroke_factor", text="Size")
 row = col.row(align=True)
-row.enabled = gp_settings.extend_stroke_factor > 0
 row.prop(gp_settings, "fill_extend_mode", text="Mode")
 row = col.row(align=True)
-row.enabled = gp_settings.extend_stroke_factor > 0
 row.prop(gp_settings, "show_fill_extend", text="Visual Aids")
 
 
diff --git a/source/blender/editors/gpencil/gpencil_fill.c 
b/source/blender/editors/gpencil/gpencil_fill.c
index 775c17e1c98..c173a30a736 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -79,6 +79,20 @@ enum {
   GP_DRAWFILLS_ONLY3D = (1 << 1),   /* only draw 3d-strokes */
 };
 
+/* Temporary stroke data including stroke extensions. */
+typedef struct tStroke {
+  /* Referenced layer. */
+  bGPDlayer *gpl;
+  /** Referenced frame. */
+  bGPDframe *gpf;
+  /** Referenced stroke. */
+  bGPDstroke *gps;
+  /** Extreme Stroke A. */
+  bGPDstroke *gps_ext_a;
+  /** Extreme Stroke B. */
+  bGPDstroke *gps_ext_b;
+} tStroke;
+
 /* Temporary fill operation data `op->customdata`. */
 typedef struct tGPDfill {
   bContext *C;
@@ -115,7 +129,7 @@ typedef struct tGPDfill {
   /** For operations that require occlusion testing. */
   struct ViewDepths *depths;
   /** flags */
-  short flag;
+  int flag;
   /** avoid too fast events */
   short oldkey;
   /** send to back stroke */
@@ -160,7 +174,7 @@ typedef struct tGPDfill {
   Image *ima;
   /** temp points data */
   BLI_Stack *stack;
-  /** handle for drawing strokes while operator is running 3d stuff */
+  /** handle for drawing strokes while operator is running 3d stuff. */
   void *draw_handle_3d;
 
   /* Temporary size x. */
@@ -177,12 +191,28 @@ typedef struct tGPDfill {
 
   /** Factor of extension. */
   float fill_extend_fac;
-
+  /** Size of stroke_array. */
+  int stroke_array_num;
+  /** Temp strokes array to handle strokes and stroke extensions. */
+  tStroke **stroke_array;
 } tGPDfill;
 
 bool skip_layer_check(short fill_layer_mode, int gpl_active_index, int 
gpl_index);
 static void gpencil_draw_boundary_lines(const struct bContext *UNUSED(C), 
struct tGPDfill *tgpf);
 
+/* Free temp stroke array. */
+static void stroke_array_free(tGPDfill *tgpf)
+{
+  if (tgpf->stroke_array) {
+for (int i = 0; i < tgpf->stroke_array_num; i++) {
+  tStroke *stroke = tgpf->stroke_array[i];
+  MEM_freeN(stroke);
+}
+MEM_SAFE_FREE(tgpf->stroke_array);
+  }
+  tgpf->stroke_array_num = 0;
+}
+
 /* Delete any temporary stroke. */
 static void gpencil_delete_temp_stroke_extension(tGPDfill *tgpf, const bool 
all_frames)
 {
@@ -243,7 +273,8 @@ static void add_stroke_extension(bGPDframe *gpf, bGPDstroke 
*gps, float p1[3], f
   pt->pressure = 1.0f;
 }
 
-static void add_endpoint_radius_help(bGPDframe *gpf,
+static void add_endpoint_radius_help(tGPDfill *tgpf,
+ bGPDframe *gpf,
  bGPDstroke *gps,
  const float endpoint[3],
  const float radius,
@@ -268,6 +299,11 @@ static void add_endpoint_radius_help(bGPDframe *gpf,
 pt->z = endpoint[2] + radius * sinf(angle);
 pt->strength = 1.0f;
 pt->pressure = 1.0f;
+
+/* Rotate to object rotation. */
+sub_v3_v3(&pt->x, endpoint);
+mul_mat3_m4_v3(tgpf->ob->obmat, &pt->x);
+add_v3_v3(&pt->x, endpoint);
   }
 }
 
@@ -283,13 +319,20 @@ static void extrapolate_points_by_length(bGPDspoint *a,
   add_v3_v3v3(r_point, &b->x, ab);
 }
 
-/* Cut the exten

[Bf-blender-cvs] [2d8eadacf9f] master: Fix: Missing DNA rename for recent mesh refactor

2022-09-23 Thread Hans Goudey
Commit: 2d8eadacf9fd2d0eca0f9a53b08d6bb90df54b80
Author: Hans Goudey
Date:   Fri Sep 23 12:13:09 2022 -0500
Branches: master
https://developer.blender.org/rB2d8eadacf9fd2d0eca0f9a53b08d6bb90df54b80

Fix: Missing DNA rename for recent mesh refactor

12becbf0dffe06b6f28c4 changed to `flag_legacy` but didn't use a rename.

===

M   source/blender/makesdna/intern/dna_rename_defs.h

===

diff --git a/source/blender/makesdna/intern/dna_rename_defs.h 
b/source/blender/makesdna/intern/dna_rename_defs.h
index bcda2a330de..ec624bcb64e 100644
--- a/source/blender/makesdna/intern/dna_rename_defs.h
+++ b/source/blender/makesdna/intern/dna_rename_defs.h
@@ -101,6 +101,7 @@ DNA_STRUCT_RENAME_ELEM(MEdge, bweight, bweight_legacy)
 DNA_STRUCT_RENAME_ELEM(MEdge, crease, crease_legacy)
 DNA_STRUCT_RENAME_ELEM(MPoly, mat_nr, mat_nr_legacy)
 DNA_STRUCT_RENAME_ELEM(MVert, bweight, bweight_legacy)
+DNA_STRUCT_RENAME_ELEM(MVert, flag, flag_legacy)
 DNA_STRUCT_RENAME_ELEM(ParticleSettings, child_nbr, child_percent)
 DNA_STRUCT_RENAME_ELEM(ParticleSettings, dup_group, instance_collection)
 DNA_STRUCT_RENAME_ELEM(ParticleSettings, dup_ob, instance_object)

___
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] [67308d73a4f] master: Node Editor: Adjust node link curving

2022-09-23 Thread Leon Schittek
Commit: 67308d73a4f9ec34ef42ad22d48dad5840a8a5fd
Author: Leon Schittek
Date:   Fri Sep 23 17:54:27 2022 +0200
Branches: master
https://developer.blender.org/rB67308d73a4f9ec34ef42ad22d48dad5840a8a5fd

Node Editor: Adjust node link curving

Clamp node link curving when the link is close to horizontal to prevent
overshooting at the ends.

Reviewed By: Pablo Vazquez, Hans Goudey

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

===

M   source/blender/editors/space_node/drawnode.cc

===

diff --git a/source/blender/editors/space_node/drawnode.cc 
b/source/blender/editors/space_node/drawnode.cc
index fbbdd40e92e..b2510df9105 100644
--- a/source/blender/editors/space_node/drawnode.cc
+++ b/source/blender/editors/space_node/drawnode.cc
@@ -1604,12 +1604,19 @@ static void 
calculate_inner_link_bezier_points(std::array &points)
 points[2] = math::interpolate(points[0], points[3], 2.0f / 3.0f);
   }
   else {
-const float dist = curving * 0.1f * math::distance(points[0].x, 
points[3].x);
+const float dist_x = math::distance(points[0].x, points[3].x);
+const float dist_y = math::distance(points[0].y, points[3].y);
 
-points[1].x = points[0].x + dist;
+/* Reduce the handle offset when the link endpoints are close to 
horizontal. */
+const float slope = safe_divide(dist_y, dist_x);
+const float clamp_factor = math::min(1.0f, slope * (4.5f - 0.25f * 
float(curving)));
+
+const float handle_offset = curving * 0.1f * dist_x * clamp_factor;
+
+points[1].x = points[0].x + handle_offset;
 points[1].y = points[0].y;
 
-points[2].x = points[3].x - dist;
+points[2].x = points[3].x - handle_offset;
 points[2].y = points[3].y;
   }
 }

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


[Bf-blender-cvs] [58e78c1ffe4] blender-v3.3-release: Fix T101298: Blender 3.3.1 crash on macOS due to merge error

2022-09-23 Thread Brecht Van Lommel
Commit: 58e78c1ffe4beec21a2a0df3e15ff9588aafc08d
Author: Brecht Van Lommel
Date:   Fri Sep 23 17:54:18 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB58e78c1ffe4beec21a2a0df3e15ff9588aafc08d

Fix T101298: Blender 3.3.1 crash on macOS due to merge error

Blender 3.3 is still using GLEW and needs this initialization.

===

M   intern/ghost/intern/GHOST_ContextCGL.mm

===

diff --git a/intern/ghost/intern/GHOST_ContextCGL.mm 
b/intern/ghost/intern/GHOST_ContextCGL.mm
index 763bb6b86fa..d0fe12881b7 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.mm
+++ b/intern/ghost/intern/GHOST_ContextCGL.mm
@@ -335,6 +335,8 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
 }
 #endif
 
+initContextGLEW();
+
 if (m_metalView) {
   if (m_defaultFramebuffer == 0) {
 /* Create a virtual frame-buffer. */

___
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] [12becbf0dff] master: Mesh: Move selection flags to generic attributes

2022-09-23 Thread Hans Goudey
Commit: 12becbf0dffe06b6f28c4cc444fe0312cf9249b9
Author: Hans Goudey
Date:   Fri Sep 23 09:38:37 2022 -0500
Branches: master
https://developer.blender.org/rB12becbf0dffe06b6f28c4cc444fe0312cf9249b9

Mesh: Move selection flags to generic attributes

Using the attribute name semantics from T97452, this patch moves the
selection status of mesh elements from the `SELECT` of vertices, and
edges, and the `ME_FACE_SEL` of faces to generic boolean attribute
Storing this data as generic attributes can significantly simplify and
improve code, as described in T95965.

The attributes are called `.select_vert`, `.select_edge`, and
`.select_poly`. The `.` prefix means they are "UI attributes",so they
still contain original data edited by users, but they aren't meant to
be accessed procedurally by the user in arbitrary situations. They are
also be hidden in the spreadsheet and the attribute list.

Until 4.0, the attributes are still written to and read from the mesh
in the old way, so neither forward nor backward compatibility are
affected. This means memory requirements will be increased by one byte
per element when selection is used. When the flags are removed
completely, requirements will decrease.

Further notes:
* The `MVert` flag is empty at runtime now, so it can be ignored.
* `BMesh` is unchanged, otherwise the change would be much larger.
* Many tests have slightly different results, since the selection
  attribute uses more generic propagation. Previously you couldn't
  really rely on edit mode selections being propagated procedurally.
  Now it mostly works as expected.

Similar to 2480b55f216c
Ref T95965

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

===

M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/blenkernel/BKE_mesh_legacy_convert.h
M   source/blender/blenkernel/BKE_mesh_mapping.h
M   source/blender/blenkernel/intern/attribute_access.cc
M   source/blender/blenkernel/intern/customdata.cc
M   source/blender/blenkernel/intern/mball_tessellate.c
M   source/blender/blenkernel/intern/mesh.cc
M   source/blender/blenkernel/intern/mesh_boolean_convert.cc
M   source/blender/blenkernel/intern/mesh_calc_edges.cc
M   source/blender/blenkernel/intern/mesh_evaluate.cc
M   source/blender/blenkernel/intern/mesh_legacy_convert.cc
M   source/blender/blenkernel/intern/mesh_mapping.cc
M   source/blender/blenkernel/intern/object_deform.c
M   source/blender/blenkernel/intern/subdiv_converter_mesh.c
M   source/blender/blenkernel/intern/subdiv_mesh.cc
M   source/blender/blenkernel/intern/subsurf_ccg.c
M   source/blender/blenloader/intern/versioning_400.cc
M   source/blender/bmesh/intern/bmesh_construct.c
M   source/blender/bmesh/intern/bmesh_construct.h
M   source/blender/bmesh/intern/bmesh_mesh_convert.cc
M   source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc
M   source/blender/draw/intern/draw_cache_impl_subdivision.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh.hh
M   source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc
M   
source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_lnor.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
M   source/blender/editors/armature/armature_skinning.c
M   source/blender/editors/armature/meshlaplacian.c
M   source/blender/editors/mesh/editface.cc
M   source/blender/editors/mesh/mesh_data.cc
M   source/blender/editors/object/object_modifier.cc
M   source/blender/editors/object/object_vgroup.cc
M   source/blender/editors/sculpt_paint/paint_image_proj.c
M   source/blender/editors/sculpt_paint/paint_vertex.cc
M   source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc
M   source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
M   source/blender/editors/space_view3d/view3d_select.cc
M   source/blender/geometry/intern/mesh_merge_by_distance.cc
M   source/blender/io/collada/MeshImporter.cpp
M   source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
M   source/blender/makesdna/DNA_meshdata_types.h
M   source/blender/makesrna/intern/rna_mesh.c
M   source/blender/modifiers/intern/MOD_array.c
M   source/blender/modifiers/intern/MOD_explode.c
M   source/blender/modifiers/intern/MOD_solidify_nonmanifold.c
M   source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc

===

diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index ef57c9a2e0e..c1f4d9733aa 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -870,16 +870,7 @@ void BKE_mesh_merge_customdata_for_apply_modifier(struct 
Mesh *me);
  */
 void BKE

[Bf-blender-cvs] [2438f76d6f2] master: Fix: Assert calculating mesh triangulation

2022-09-23 Thread Hans Goudey
Commit: 2438f76d6f289b237aac582405a0adeb10009ea1
Author: Hans Goudey
Date:   Fri Sep 23 10:44:55 2022 -0500
Branches: master
https://developer.blender.org/rB2438f76d6f289b237aac582405a0adeb10009ea1

Fix: Assert calculating mesh triangulation

The condition from 0d7d8c73cf5c5c5f05c was reversed.

===

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

===

diff --git a/source/blender/blenkernel/intern/mesh_runtime.cc 
b/source/blender/blenkernel/intern/mesh_runtime.cc
index d7a0b73298e..782657428f5 100644
--- a/source/blender/blenkernel/intern/mesh_runtime.cc
+++ b/source/blender/blenkernel/intern/mesh_runtime.cc
@@ -154,7 +154,7 @@ void BKE_mesh_runtime_looptri_recalc(Mesh *mesh)
   const Span polys = mesh->polys();
   const Span loops = mesh->loops();
 
-  if (BKE_mesh_poly_normals_are_dirty(mesh)) {
+  if (!BKE_mesh_poly_normals_are_dirty(mesh)) {
 BKE_mesh_recalc_looptri_with_normals(loops.data(),
  polys.data(),
  verts.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] [e345686cb7f] master: View3d: move space_view3d.c to c++

2022-09-23 Thread Jacques Lucke
Commit: e345686cb7f4a8ccdc10e85d4f05cded45850cf7
Author: Jacques Lucke
Date:   Fri Sep 23 16:51:29 2022 +0200
Branches: master
https://developer.blender.org/rBe345686cb7f4a8ccdc10e85d4f05cded45850cf7

View3d: move space_view3d.c to c++

===

M   source/blender/editors/include/ED_view3d.h
M   source/blender/editors/space_view3d/CMakeLists.txt
R091source/blender/editors/space_view3d/space_view3d.c  
source/blender/editors/space_view3d/space_view3d.cc
M   source/blender/editors/space_view3d/view3d_intern.h
M   source/blender/editors/space_view3d/view3d_navigate.h

===

diff --git a/source/blender/editors/include/ED_view3d.h 
b/source/blender/editors/include/ED_view3d.h
index c72f3121217..a4857c2b92f 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -1319,7 +1319,7 @@ void ED_view3d_gizmo_mesh_preselect_get_active(struct 
bContext *C,
struct BMElem **r_ele);
 void ED_view3d_gizmo_mesh_preselect_clear(struct wmGizmo *gz);
 
-/* space_view3d.c */
+/* space_view3d.cc */
 
 void ED_view3d_buttons_region_layout_ex(const struct bContext *C,
 struct ARegion *region,
diff --git a/source/blender/editors/space_view3d/CMakeLists.txt 
b/source/blender/editors/space_view3d/CMakeLists.txt
index 27a0cd8e55a..d465460682d 100644
--- a/source/blender/editors/space_view3d/CMakeLists.txt
+++ b/source/blender/editors/space_view3d/CMakeLists.txt
@@ -27,7 +27,7 @@ set(INC
 
 set(SRC
   drawobject.c
-  space_view3d.c
+  space_view3d.cc
   view3d_buttons.c
   view3d_camera_control.c
   view3d_cursor_snap.c
diff --git a/source/blender/editors/space_view3d/space_view3d.c 
b/source/blender/editors/space_view3d/space_view3d.cc
similarity index 91%
rename from source/blender/editors/space_view3d/space_view3d.c
rename to source/blender/editors/space_view3d/space_view3d.cc
index 723a5f859a6..1b168ca1dda 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.cc
@@ -83,12 +83,12 @@ RegionView3D *ED_view3d_context_rv3d(bContext *C)
 {
   RegionView3D *rv3d = CTX_wm_region_view3d(C);
 
-  if (rv3d == NULL) {
+  if (rv3d == nullptr) {
 ScrArea *area = CTX_wm_area(C);
 if (area && area->spacetype == SPACE_VIEW3D) {
   ARegion *region = BKE_area_find_region_active_win(area);
   if (region) {
-rv3d = region->regiondata;
+rv3d = static_cast(region->regiondata);
   }
 }
   }
@@ -99,8 +99,8 @@ bool ED_view3d_context_user_region(bContext *C, View3D 
**r_v3d, ARegion **r_regi
 {
   ScrArea *area = CTX_wm_area(C);
 
-  *r_v3d = NULL;
-  *r_region = NULL;
+  *r_v3d = nullptr;
+  *r_region = nullptr;
 
   if (area && area->spacetype == SPACE_VIEW3D) {
 ARegion *region = CTX_wm_region(C);
@@ -108,7 +108,8 @@ bool ED_view3d_context_user_region(bContext *C, View3D 
**r_v3d, ARegion **r_regi
 
 if (region) {
   RegionView3D *rv3d;
-  if ((region->regiontype == RGN_TYPE_WINDOW) && (rv3d = 
region->regiondata) &&
+  if ((region->regiontype == RGN_TYPE_WINDOW) &&
+  (rv3d = static_cast(region->regiondata)) &&
   (rv3d->viewlock & RV3D_LOCK_ROTATION) == 0) {
 *r_v3d = v3d;
 *r_region = region;
@@ -127,9 +128,9 @@ bool ED_view3d_context_user_region(bContext *C, View3D 
**r_v3d, ARegion **r_regi
 
 bool ED_view3d_area_user_region(const ScrArea *area, const View3D *v3d, 
ARegion **r_region)
 {
-  RegionView3D *rv3d = NULL;
-  ARegion *region_unlock_user = NULL;
-  ARegion *region_unlock = NULL;
+  RegionView3D *rv3d = nullptr;
+  ARegion *region_unlock_user = nullptr;
+  ARegion *region_unlock = nullptr;
   const ListBase *region_list = (v3d == area->spacedata.first) ? 
&area->regionbase :
  
&v3d->regionbase;
 
@@ -138,7 +139,7 @@ bool ED_view3d_area_user_region(const ScrArea *area, const 
View3D *v3d, ARegion
   LISTBASE_FOREACH (ARegion *, region, region_list) {
 /* find the first unlocked rv3d */
 if (region->regiondata && region->regiontype == RGN_TYPE_WINDOW) {
-  rv3d = region->regiondata;
+  rv3d = static_cast(region->regiondata);
   if ((rv3d->viewlock & RV3D_LOCK_ROTATION) == 0) {
 region_unlock = region;
 if (ELEM(rv3d->persp, RV3D_PERSP, RV3D_CAMOB)) {
@@ -199,7 +200,7 @@ void ED_view3d_check_mats_rv3d(struct RegionView3D *rv3d)
 
 void ED_view3d_stop_render_preview(wmWindowManager *wm, ARegion *region)
 {
-  RegionView3D *rv3d = region->regiondata;
+  RegionView3D *rv3d = static_cast(region->regiondata);
 
   if (rv3d->render_engine) {
 #ifdef WITH_PYTHON
@@ -213,7 +214,7 @@ void ED_view3d_stop_render_preview(wmWindowManager *wm, 
ARegion *region)
 #endif
 
 RE_engine_free(rv3d->render_engine);
-rv3d->re

[Bf-blender-cvs] [63bdd89108f] master: Cleanup: use depsgraph iterator settings in rna

2022-09-23 Thread Jacques Lucke
Commit: 63bdd89108fe6557901be627b6d6ca4910648f40
Author: Jacques Lucke
Date:   Fri Sep 23 16:12:47 2022 +0200
Branches: master
https://developer.blender.org/rB63bdd89108fe6557901be627b6d6ca4910648f40

Cleanup: use depsgraph iterator settings in rna

Somehow missed this as part of rBb197cd5821f1dfaa5168d31984dd8014f5252456.

===

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

===

diff --git a/source/blender/makesrna/intern/rna_depsgraph.c 
b/source/blender/makesrna/intern/rna_depsgraph.c
index 239452c0572..eb39492c7dc 100644
--- a/source/blender/makesrna/intern/rna_depsgraph.c
+++ b/source/blender/makesrna/intern/rna_depsgraph.c
@@ -355,11 +355,16 @@ static void 
rna_Depsgraph_object_instances_begin(CollectionPropertyIterator *ite
 {
   RNA_Depsgraph_Instances_Iterator *di_it = iter->internal.custom = 
MEM_callocN(sizeof(*di_it),

 __func__);
+  DEGObjectIterSettings *deg_iter_settings = 
MEM_callocN(sizeof(DEGObjectIterSettings), __func__);
+  deg_iter_settings->depsgraph = (Depsgraph *)ptr->data;
+  deg_iter_settings->flags = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
+ DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET | 
DEG_ITER_OBJECT_FLAG_VISIBLE |
+ DEG_ITER_OBJECT_FLAG_DUPLI;
 
   DEGObjectIterData *data = &di_it->deg_data[0];
-  data->graph = (Depsgraph *)ptr->data;
-  data->flag = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | 
DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET |
-   DEG_ITER_OBJECT_FLAG_VISIBLE | DEG_ITER_OBJECT_FLAG_DUPLI;
+  data->settings = deg_iter_settings;
+  data->graph = deg_iter_settings->depsgraph;
+  data->flag = deg_iter_settings->flags;
 
   di_it->iterators[0].iter.valid = true;
   DEG_iterator_objects_begin(&di_it->iterators[0].iter, data);
@@ -398,6 +403,11 @@ static void 
rna_Depsgraph_object_instances_end(CollectionPropertyIterator *iter)
 iter->internal.custom;
   for (int i = 0; i < ARRAY_SIZE(di_it->iterators); i++) {
 RNA_DepsgraphIterator *di = &di_it->iterators[i];
+DEGObjectIterData *data = &di_it->deg_data[i];
+if (i == 0) {
+  /* Is shared between both iterators. */
+  MEM_freeN(data->settings);
+}
 DEG_iterator_objects_end(&di->iter);
 
 #  ifdef WITH_PYTHON

___
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] [8482dbf7b07] cycles_path_guiding: Fix build error for Metal

2022-09-23 Thread Brecht Van Lommel
Commit: 8482dbf7b075b77fea1e9b97e7051f3f417487ae
Author: Brecht Van Lommel
Date:   Fri Sep 23 16:06:23 2022 +0200
Branches: cycles_path_guiding
https://developer.blender.org/rB8482dbf7b075b77fea1e9b97e7051f3f417487ae

Fix build error for Metal

===

M   intern/cycles/kernel/integrator/shadow_state_template.h
M   intern/cycles/kernel/integrator/state_template.h

===

diff --git a/intern/cycles/kernel/integrator/shadow_state_template.h 
b/intern/cycles/kernel/integrator/shadow_state_template.h
index f28430d99b7..d731d1df339 100644
--- a/intern/cycles/kernel/integrator/shadow_state_template.h
+++ b/intern/cycles/kernel/integrator/shadow_state_template.h
@@ -48,7 +48,7 @@ KERNEL_STRUCT_MEMBER(shadow_path,
  path_segment,
  KERNEL_FEATURE_PATH_GUIDING)
 #else
-KERNEL_STRUCT_MEMBER(shadow_path, void *, path_segment, 
KERNEL_FEATURE_PATH_GUIDING)
+KERNEL_STRUCT_MEMBER(shadow_path, uint64_t, path_segment, 
KERNEL_FEATURE_PATH_GUIDING)
 #endif
 KERNEL_STRUCT_END(shadow_path)
 
diff --git a/intern/cycles/kernel/integrator/state_template.h 
b/intern/cycles/kernel/integrator/state_template.h
index d04292ec080..bf7bd89baaa 100644
--- a/intern/cycles/kernel/integrator/state_template.h
+++ b/intern/cycles/kernel/integrator/state_template.h
@@ -130,11 +130,11 @@ KERNEL_STRUCT_END(guiding)
 #else
 KERNEL_STRUCT_BEGIN(guiding)
 /* Current path segment of the random walk/path. */
-KERNEL_STRUCT_MEMBER(guiding, void *, path_segment, 
KERNEL_FEATURE_PATH_GUIDING)
+KERNEL_STRUCT_MEMBER(guiding, uint64_t, path_segment, 
KERNEL_FEATURE_PATH_GUIDING)
 /* Guided sampling distribution for sampling new directions at a position on a 
surface. */
-KERNEL_STRUCT_MEMBER(guiding, void *, surface_sampling_distribution, 
KERNEL_FEATURE_PATH_GUIDING)
+KERNEL_STRUCT_MEMBER(guiding, uint64_t, surface_sampling_distribution, 
KERNEL_FEATURE_PATH_GUIDING)
 /* Guided sampling distribution for sampling new directions at position inside 
a volume. */
-KERNEL_STRUCT_MEMBER(guiding, void *, volume_sampling_distribution, 
KERNEL_FEATURE_PATH_GUIDING)
+KERNEL_STRUCT_MEMBER(guiding, uint64_t, volume_sampling_distribution, 
KERNEL_FEATURE_PATH_GUIDING)
 /* If surface guiding is enabled */
 KERNEL_STRUCT_MEMBER(guiding, bool, use_surface_guiding, 
KERNEL_FEATURE_PATH_GUIDING)
 /* Random number used for additional guiding decisions (e.g., cache query, 
selection to use guiding

___
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] [a8a454287a2] master: Mesh: Move edge crease out of MEdge

2022-09-23 Thread Hans Goudey
Commit: a8a454287a27d408668f8adc6fe1b3aa988de1ac
Author: Hans Goudey
Date:   Fri Sep 23 09:02:05 2022 -0500
Branches: master
https://developer.blender.org/rBa8a454287a27d408668f8adc6fe1b3aa988de1ac

Mesh: Move edge crease out of MEdge

This is very similar to D14077. There are two differences though.
First is that vertex creases are already stored in a separate layer,
and second is that we can now completely remove use of `Mesh.cd_flag`,
since that information is now inherent to whether the layers exist.

There are two functional differences here:
 * Operators are used to add and remove layers instead of a property.
 * The "crease" attribute can be created and removed by geometry nodes.

The second change should make various geometry nodes slightly faster,
since the "crease" attribute was always processed before. Creases are
now interpolated generically in the CustomData API too, which should
help maintain the values across edits better.

Meshes get an `edge_creases` RNA property like the existing vertex
property, to provide more efficient access to the data in Cycles.

One test failure is expected, where different rounding between float
the old char storage means that 5 additional points are scattered in
a geometry nodes test.

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

===

M   intern/cycles/blender/mesh.cpp
M   release/scripts/startup/bl_ui/properties_data_mesh.py
M   source/blender/blenkernel/BKE_DerivedMesh.h
M   source/blender/blenkernel/BKE_customdata.h
M   source/blender/blenkernel/BKE_mesh_legacy_convert.h
M   source/blender/blenkernel/BKE_subdiv.h
M   source/blender/blenkernel/intern/DerivedMesh.cc
M   source/blender/blenkernel/intern/cdderivedmesh.c
M   source/blender/blenkernel/intern/customdata.cc
M   source/blender/blenkernel/intern/data_transfer.c
M   source/blender/blenkernel/intern/geometry_component_mesh.cc
M   source/blender/blenkernel/intern/mesh.cc
M   source/blender/blenkernel/intern/mesh_boolean_convert.cc
M   source/blender/blenkernel/intern/mesh_convert.cc
M   source/blender/blenkernel/intern/mesh_debug.cc
M   source/blender/blenkernel/intern/mesh_legacy_convert.cc
M   source/blender/blenkernel/intern/multires_reshape.h
M   source/blender/blenkernel/intern/multires_reshape_smooth.c
M   source/blender/blenkernel/intern/multires_reshape_util.c
M   source/blender/blenkernel/intern/subdiv_converter_mesh.c
M   source/blender/blenkernel/intern/subdiv_mesh.cc
M   source/blender/blenkernel/intern/subsurf_ccg.c
M   source/blender/blenloader/intern/versioning_400.cc
M   source/blender/bmesh/intern/bmesh_construct.c
M   source/blender/bmesh/intern/bmesh_mesh_convert.cc
M   source/blender/bmesh/intern/bmesh_mesh_convert.h
M   source/blender/editors/mesh/editmesh_path.c
M   source/blender/editors/mesh/mesh_data.cc
M   source/blender/editors/mesh/mesh_intern.h
M   source/blender/editors/mesh/mesh_ops.c
M   source/blender/editors/mesh/meshtools.cc
M   source/blender/editors/sculpt_paint/sculpt_face_set.cc
M   source/blender/editors/space_view3d/view3d_buttons.c
M   source/blender/editors/transform/transform_convert_mesh_edge.c
M   source/blender/editors/transform/transform_convert_mesh_vert_cdata.c
M   source/blender/geometry/intern/mesh_merge_by_distance.cc
M   source/blender/geometry/intern/realize_instances.cc
M   source/blender/io/alembic/exporter/abc_writer_mesh.cc
M   source/blender/io/alembic/intern/abc_reader_mesh.cc
M   source/blender/io/collada/MeshImporter.cpp
M   source/blender/io/usd/intern/usd_writer_mesh.cc
M   source/blender/makesdna/DNA_customdata_types.h
M   source/blender/makesdna/DNA_mesh_types.h
M   source/blender/makesdna/DNA_meshdata_types.h
M   source/blender/makesdna/intern/dna_rename_defs.h
M   source/blender/makesrna/intern/rna_mesh.c
M   source/blender/modifiers/intern/MOD_screw.c
M   source/blender/modifiers/intern/MOD_solidify_extrude.c
M   source/blender/modifiers/intern/MOD_solidify_nonmanifold.c
M   source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc

===

diff --git a/intern/cycles/blender/mesh.cpp b/intern/cycles/blender/mesh.cpp
index 1d1eadebc39..fbc470cada4 100644
--- a/intern/cycles/blender/mesh.cpp
+++ b/intern/cycles/blender/mesh.cpp
@@ -1084,23 +1084,23 @@ static void create_subd_mesh(Scene *scene,
 
   const int edges_num = b_mesh.edges.length();
 
-  if (edges_num != 0) {
+  if (edges_num != 0 && b_mesh.edge_creases.length() > 0) {
 size_t num_creases = 0;
-const MEdge *edges = static_cast(b_mesh.edges[0].ptr.data);
+const float *creases = static_cast(b_mesh.edge_creases[0].ptr.data);
 
 for (int i = 0; i < edges_num; i++) {
-  const MEdge &b_edge = edges[i];
-  if (b_edge.crease !

[Bf-blender-cvs] [148c4d4289b] cycles_path_guiding: Cycles: BSDF eval refactor to remove separate reflection/refraction methods

2022-09-23 Thread Brecht Van Lommel
Commit: 148c4d4289b27e91b894b20a391eea4535cd88ed
Author: Brecht Van Lommel
Date:   Thu Sep 22 20:47:27 2022 +0200
Branches: cycles_path_guiding
https://developer.blender.org/rB148c4d4289b27e91b894b20a391eea4535cd88ed

Cycles: BSDF eval refactor to remove separate reflection/refraction methods

Simplifies code overall to do it inside the eval function, most of the BSDFs
already compute the dot product.

===

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_microfacet.h
M   intern/cycles/kernel/closure/bsdf_microfacet_multi.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/integrator/mnee.h
M   intern/cycles/kernel/integrator/shade_surface.h
M   intern/cycles/kernel/integrator/surface_shader.h

===

diff --git a/intern/cycles/kernel/closure/bsdf.h 
b/intern/cycles/kernel/closure/bsdf.h
index f60caa86ee0..89ca3e14674 100644
--- a/intern/cycles/kernel/closure/bsdf.h
+++ b/intern/cycles/kernel/closure/bsdf.h
@@ -69,7 +69,11 @@ ccl_device_inline float 
bsdf_get_roughness_squared(ccl_private const ShaderClosu
  * Yining Karl Li and Brent Burley. */
 ccl_device_inline float bump_shadowing_term(float3 Ng, float3 N, float3 I)
 {
-  float g = safe_divide(dot(Ng, I), dot(N, I) * dot(Ng, N));
+  const float cosNI = dot(N, I);
+  if (cosNI < 0.0f) {
+Ng = -Ng;
+  }
+  float g = safe_divide(dot(Ng, I), cosNI * dot(Ng, N));
 
   /* If the incoming light is on the unshadowed side, return full brightness. 
*/
   if (g >= 1.0f) {
@@ -98,6 +102,12 @@ ccl_device_inline float shift_cos_in(float cos_in, const 
float frequency_multipl
   return val;
 }
 
+ccl_device_inline bool bsdf_is_transmission(ccl_private const ShaderClosure 
*sc,
+const float3 omega_in)
+{
+  return dot(sc->N, omega_in) < 0.0f;
+}
+
 ccl_device_inline int bsdf_sample(KernelGlobals kg,
   ccl_private ShaderData *sd,
   ccl_private const ShaderClosure *sc,
@@ -264,11 +274,12 @@ ccl_device_inline int bsdf_sample(KernelGlobals kg,
 const float frequency_multiplier =
 kernel_data_fetch(objects, 
sd->object).shadow_terminator_shading_offset;
 if (frequency_multiplier > 1.0f) {
-  *eval *= shift_cos_in(dot(*omega_in, sc->N), frequency_multiplier);
+  const float cosNI = dot(*omega_in, sc->N);
+  *eval *= shift_cos_in(cosNI, frequency_multiplier);
 }
 if (label & LABEL_DIFFUSE) {
   if (!isequal(sc->N, sd->N)) {
-*eval *= bump_shadowing_term((label & LABEL_TRANSMIT) ? -sd->N : 
sd->N, sc->N, *omega_in);
+*eval *= bump_shadowing_term(sd->N, sc->N, *omega_in);
   }
 }
   }
@@ -408,7 +419,7 @@ ccl_device_inline void bsdf_roughness_eta(const 
KernelGlobals kg,
 
 ccl_device_inline int bsdf_label(const KernelGlobals kg,
  const ShaderClosure *sc,
- const bool is_transmission)
+ const float3 omega_in)
 {
   /* For curves use the smooth normal, particularly for ribbons the geometric
* normal gives too much darkening otherwise. */
@@ -471,7 +482,7 @@ ccl_device_inline int bsdf_label(const KernelGlobals kg,
   break;
 case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID:
 case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID:
-  if (is_transmission)
+  if (bsdf_is_transmission(sc, omega_in))
 label = LABEL_TRANSMIT | LABEL_GLOSSY;
   else
 label = LABEL_REFLECT | LABEL_GLOSSY;
@@ -509,7 +520,7 @@ ccl_device_inline int bsdf_label(const KernelGlobals kg,
   label = LABEL_TRANSMIT | LABEL_GLOSSY;
   break;
 case CLOSURE_BSDF_HAIR_PRINCIPLED_ID:
-  if (is_transmission)
+  if (bsdf_is_transmission(sc, omega_in))
 label = LABEL_TRANSMIT | LABEL_GLOSSY;
   else
 label = LABEL_REFLECT | LABEL_GLOSSY;
@@ -549,179 +560,104 @@ ccl_device_inline
   ccl_private ShaderData *sd,
   ccl_private const ShaderClosure *sc,
   const float3 omega_in,
-  const bool is_transmission,
   ccl_private float *pdf)
 {
   Spectr

[Bf-blender-cvs] [7b5c506088b] cycles_path_guiding: Merge branch 'master' into cycles_path_guiding

2022-09-23 Thread Brecht Van Lommel
Commit: 7b5c506088b71e9dd270de13c9424e0d7c6482fd
Author: Brecht Van Lommel
Date:   Thu Sep 22 20:53:48 2022 +0200
Branches: cycles_path_guiding
https://developer.blender.org/rB7b5c506088b71e9dd270de13c9424e0d7c6482fd

Merge branch 'master' into cycles_path_guiding

===



===



___
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] [b197cd5821f] master: Cleanup: use depsgraph iterator settings in rna

2022-09-23 Thread Jacques Lucke
Commit: b197cd5821f1dfaa5168d31984dd8014f5252456
Author: Jacques Lucke
Date:   Fri Sep 23 15:49:04 2022 +0200
Branches: master
https://developer.blender.org/rBb197cd5821f1dfaa5168d31984dd8014f5252456

Cleanup: use depsgraph iterator settings in rna

This was missing in rBe5d4afd5bac71e29ba71ecf091feaa0d70b70260.

===

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

===

diff --git a/source/blender/makesrna/intern/rna_depsgraph.c 
b/source/blender/makesrna/intern/rna_depsgraph.c
index d277f2f7bd7..239452c0572 100644
--- a/source/blender/makesrna/intern/rna_depsgraph.c
+++ b/source/blender/makesrna/intern/rna_depsgraph.c
@@ -300,10 +300,14 @@ static void 
rna_Depsgraph_objects_begin(CollectionPropertyIterator *iter, Pointe
 {
   iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__);
   DEGObjectIterData *data = MEM_callocN(sizeof(DEGObjectIterData), __func__);
+  DEGObjectIterSettings *deg_iter_settings = 
MEM_callocN(sizeof(DEGObjectIterSettings), __func__);
+  deg_iter_settings->depsgraph = (Depsgraph *)ptr->data;
+  deg_iter_settings->flags = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | 
DEG_ITER_OBJECT_FLAG_VISIBLE |
+ DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET;
 
-  data->graph = (Depsgraph *)ptr->data;
-  data->flag = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | 
DEG_ITER_OBJECT_FLAG_VISIBLE |
-   DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET;
+  data->settings = deg_iter_settings;
+  data->graph = deg_iter_settings->depsgraph;
+  data->flag = deg_iter_settings->flags;
 
   ((BLI_Iterator *)iter->internal.custom)->valid = true;
   DEG_iterator_objects_begin(iter->internal.custom, data);
@@ -318,7 +322,9 @@ static void 
rna_Depsgraph_objects_next(CollectionPropertyIterator *iter)
 
 static void rna_Depsgraph_objects_end(CollectionPropertyIterator *iter)
 {
+  DEGObjectIterData *data = (DEGObjectIterData *)((BLI_Iterator 
*)iter->internal.custom)->data;
   DEG_iterator_objects_end(iter->internal.custom);
+  MEM_freeN(data->settings);
   MEM_freeN(((BLI_Iterator *)iter->internal.custom)->data);
   MEM_freeN(iter->internal.custom);
 }

___
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] [0d7d8c73cf5] master: Mesh: Use cached looptris in draw cache extraction

2022-09-23 Thread Hans Goudey
Commit: 0d7d8c73cf5c5c5f05c6a56951e4e5cd24871c12
Author: Hans Goudey
Date:   Fri Sep 23 08:23:35 2022 -0500
Branches: master
https://developer.blender.org/rB0d7d8c73cf5c5c5f05c6a56951e4e5cd24871c12

Mesh: Use cached looptris in draw cache extraction

The mesh's triangulation cache is often created for other operations
besides the drawing code, but during the mesh draw cache extraction
it is recalculated on every single time. It is simpler and faster to use
the existing MLoopTri array. It can also save memory if the cache
already exists by avoiding allocating a duplicate array. For a 4 million
face quad mesh, that is already 128 MB.

Also use face normals for mesh triangulation if they aren't dirty,
which should provide a general speedup when they're both necessary.

Recently 54182e4925de made this more reliable, since the triangulation
cache is invalidated properly when the mesh is deformed.

Fixes T98073

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

===

M   source/blender/blenkernel/intern/mesh_runtime.cc
M   source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh.hh

===

diff --git a/source/blender/blenkernel/intern/mesh_runtime.cc 
b/source/blender/blenkernel/intern/mesh_runtime.cc
index 4b6433edd5a..d7a0b73298e 100644
--- a/source/blender/blenkernel/intern/mesh_runtime.cc
+++ b/source/blender/blenkernel/intern/mesh_runtime.cc
@@ -154,12 +154,23 @@ void BKE_mesh_runtime_looptri_recalc(Mesh *mesh)
   const Span polys = mesh->polys();
   const Span loops = mesh->loops();
 
-  BKE_mesh_recalc_looptri(loops.data(),
-  polys.data(),
-  verts.data(),
-  mesh->totloop,
-  mesh->totpoly,
-  mesh->runtime.looptris.array_wip);
+  if (BKE_mesh_poly_normals_are_dirty(mesh)) {
+BKE_mesh_recalc_looptri_with_normals(loops.data(),
+ polys.data(),
+ verts.data(),
+ mesh->totloop,
+ mesh->totpoly,
+ mesh->runtime.looptris.array_wip,
+ BKE_mesh_poly_normals_ensure(mesh));
+  }
+  else {
+BKE_mesh_recalc_looptri(loops.data(),
+polys.data(),
+verts.data(),
+mesh->totloop,
+mesh->totpoly,
+mesh->runtime.looptris.array_wip);
+  }
 
   BLI_assert(mesh->runtime.looptris.array == nullptr);
   atomic_cas_ptr((void **)&mesh->runtime.looptris.array,
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc 
b/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc
index eea19cbebf3..2fc54da774d 100644
--- a/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc
+++ b/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc
@@ -18,6 +18,7 @@
 #include "BKE_editmesh.h"
 #include "BKE_editmesh_cache.h"
 #include "BKE_mesh.h"
+#include "BKE_mesh_runtime.h"
 
 #include "GPU_batch.h"
 
@@ -329,28 +330,10 @@ void mesh_render_data_update_looptris(MeshRenderData *mr,
   const eMRIterType iter_type,
   const eMRDataType data_flag)
 {
-  Mesh *me = mr->me;
   if (mr->extract_type != MR_EXTRACT_BMESH) {
 /* Mesh */
 if ((iter_type & MR_ITER_LOOPTRI) || (data_flag & MR_DATA_LOOPTRI)) {
-  /* NOTE(@campbellbarton): It's possible to skip allocating tessellation,
-   * the tessellation can be calculated as part of the iterator, see: 
P2188.
-   * The overall advantage is small (around 1%), so keep this as-is. */
-  mr->mlooptri = static_cast(
-  MEM_mallocN(sizeof(*mr->mlooptri) * mr->tri_len, 
"MR_DATATYPE_LOOPTRI"));
-  if (mr->poly_normals != nullptr) {
-BKE_mesh_recalc_looptri_with_normals(mr->mloop,
- mr->mpoly,
- mr->mvert,
- me->totloop,
- me->totpoly,
- mr->mlooptri,
- mr->poly_normals);
-  }
-  else {
-BKE_mesh_recalc_looptri(
-mr->mloop, mr->mpoly, mr->mvert, me->totloop, me->totpoly, 
mr->mlooptri);
-  }
+  mr->mlooptri = BKE_mesh_runtime_looptri_ensure(mr->me);
 }
   }
   else {
@@ -605,7 +588,6 @@ MeshRenderData *mesh_render_data_create(Object *object,
 
 void mesh_render_data_free(MeshRenderData *mr)
 {
-  MEM_SAFE_FREE(mr->mlooptri);
   MEM_SAFE_FRE

[Bf-blender-cvs] [060a5341419] master: Mesh: Move sculpt face sets to a generic attribute

2022-09-23 Thread Hans Goudey
Commit: 060a5341419412fd7996cf99a56db1f581a4c30c
Author: Hans Goudey
Date:   Fri Sep 23 08:19:40 2022 -0500
Branches: master
https://developer.blender.org/rB060a5341419412fd7996cf99a56db1f581a4c30c

Mesh: Move sculpt face sets to a generic attribute

Similar to the other refactors from T95965, this commit moves sculpt
face sets to use a generic integer attribute named `".sculpt_face_set"`.
This makes face sets accessible in the Python API.

The attribute is not visible in the attributes list or the spreadsheet
because it is meant for internal use, though that could be an option
in the future along with other similar attributes. Currently the change
is small, but in the future this could simplify code by allowing use
of more generic attribute APIs.

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

===

M   source/blender/blenkernel/BKE_mesh_legacy_convert.h
M   source/blender/blenkernel/intern/customdata.cc
M   source/blender/blenkernel/intern/mesh.cc
M   source/blender/blenkernel/intern/mesh_legacy_convert.cc
M   source/blender/blenkernel/intern/mesh_remesh_voxel.cc
M   source/blender/blenkernel/intern/paint.cc
M   source/blender/blenkernel/intern/pbvh.c
M   source/blender/blenloader/intern/versioning_400.cc
M   source/blender/bmesh/intern/bmesh_log.c
M   
source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_sculpt_data.cc
M   source/blender/editors/mesh/editmesh_mask_extract.c
M   source/blender/editors/mesh/meshtools.cc
M   source/blender/editors/sculpt_paint/paint_mask.c
M   source/blender/editors/sculpt_paint/sculpt_dyntopo.c
M   source/blender/editors/sculpt_paint/sculpt_face_set.cc
M   source/blender/editors/sculpt_paint/sculpt_undo.c
M   source/blender/editors/space_view3d/view3d_draw.c
M   source/blender/makesdna/DNA_customdata_types.h

===

diff --git a/source/blender/blenkernel/BKE_mesh_legacy_convert.h 
b/source/blender/blenkernel/BKE_mesh_legacy_convert.h
index e67aec0b9ce..b0bc5fe8efe 100644
--- a/source/blender/blenkernel/BKE_mesh_legacy_convert.h
+++ b/source/blender/blenkernel/BKE_mesh_legacy_convert.h
@@ -17,6 +17,15 @@ struct CustomData;
 struct Mesh;
 struct MFace;
 
+/**
+ * Move face sets to the legacy type from a generic type.
+ */
+void BKE_mesh_legacy_face_set_from_generic(struct Mesh *mesh);
+/**
+ * Copy face sets to the generic data type from the legacy type.
+ */
+void BKE_mesh_legacy_face_set_to_generic(struct Mesh *mesh);
+
 /**
  * Copy bevel weights from separate layers into vertices and edges.
  */
diff --git a/source/blender/blenkernel/intern/customdata.cc 
b/source/blender/blenkernel/intern/customdata.cc
index 0589e1ef8c7..892b1599bce 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -1967,7 +1967,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
 {sizeof(short[4][3]), "", 0, nullptr, nullptr, nullptr, nullptr, 
layerSwap_flnor, nullptr},
 /* 41: CD_CUSTOMLOOPNORMAL */
 {sizeof(short[2]), "vec2s", 1, nullptr, nullptr, nullptr, nullptr, 
nullptr, nullptr},
-/* 42: CD_SCULPT_FACE_SETS */
+/* 42: CD_SCULPT_FACE_SETS */ /* DEPRECATED */
 {sizeof(int), "", 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr},
 /* 43: CD_LOCATION */
 {sizeof(float[3]), "vec3f", 1, nullptr, nullptr, nullptr, nullptr, 
nullptr, nullptr},
@@ -2127,8 +2127,7 @@ const CustomData_MeshMasks CD_MASK_MESH = {
 /* emask */ (CD_MASK_MEDGE | CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL | 
CD_MASK_BWEIGHT),
 /* fmask */ 0,
 /* pmask */
-(CD_MASK_MPOLY | CD_MASK_FACEMAP | CD_MASK_FREESTYLE_FACE | 
CD_MASK_PROP_ALL |
- CD_MASK_SCULPT_FACE_SETS),
+(CD_MASK_MPOLY | CD_MASK_FACEMAP | CD_MASK_FREESTYLE_FACE | 
CD_MASK_PROP_ALL),
 /* lmask */
 (CD_MASK_MLOOP | CD_MASK_MDISPS | CD_MASK_MLOOPUV | 
CD_MASK_CUSTOMLOOPNORMAL |
  CD_MASK_GRID_PAINT_MASK | CD_MASK_PROP_ALL),
@@ -2140,8 +2139,7 @@ const CustomData_MeshMasks CD_MASK_DERIVEDMESH = {
 /* emask */ (CD_MASK_ORIGINDEX | CD_MASK_FREESTYLE_EDGE | CD_MASK_BWEIGHT 
| CD_MASK_PROP_ALL),
 /* fmask */ (CD_MASK_ORIGINDEX | CD_MASK_ORIGSPACE | CD_MASK_PREVIEW_MCOL 
| CD_MASK_TANGENT),
 /* pmask */
-(CD_MASK_ORIGINDEX | CD_MASK_FREESTYLE_FACE | CD_MASK_FACEMAP | 
CD_MASK_PROP_ALL |
- CD_MASK_SCULPT_FACE_SETS),
+(CD_MASK_ORIGINDEX | CD_MASK_FREESTYLE_FACE | CD_MASK_FACEMAP | 
CD_MASK_PROP_ALL),
 /* lmask */
 (CD_MASK_MLOOPUV | CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_PREVIEW_MLOOPCOL |
  CD_MASK_ORIGSPACE_MLOOP | CD_MASK_PROP_ALL), /* XXX MISSING 
CD_MASK_MLOOPTANGENT ? */
@@ -2152,7 +2150,7 @@ const CustomData_MeshMasks CD_MASK_BMESH = {
 /* emask */ (CD_MASK_BWEIGHT | CD_MASK_CREASE | CD_MASK_FREESTYLE_EDGE | 
CD_MASK_PROP_ALL),
 /* fmask */ 0,
 /* pmask */
-(CD_MA

[Bf-blender-cvs] [35375380d73] master: Cleanup: Grammar fix in lazy function

2022-09-23 Thread Hans Goudey
Commit: 35375380d73b93999b879164fd59266ee044472c
Author: Hans Goudey
Date:   Thu Sep 22 23:59:36 2022 -0500
Branches: master
https://developer.blender.org/rB35375380d73b93999b879164fd59266ee044472c

Cleanup: Grammar fix in lazy function

===

M   source/blender/nodes/intern/geometry_nodes_lazy_function.cc

===

diff --git a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc 
b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
index 4ffeb815e34..cb296cdd93f 100644
--- a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
+++ b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
@@ -142,7 +142,7 @@ class LazyFunctionForGeometryNode : public LazyFunction {
 };
 
 /**
- * Used to gather all inputs of a multi-input socket. A separate node is 
necessary, because
+ * Used to gather all inputs of a multi-input socket. A separate node is 
necessary because
  * multi-inputs are not supported in lazy-function graphs.
  */
 class LazyFunctionForMultiInput : public LazyFunction {
@@ -173,7 +173,7 @@ class LazyFunctionForMultiInput : public LazyFunction {
 base_type_->to_static_type_tag>([&](auto type_tag) {
   using T = typename decltype(type_tag)::type;
   if constexpr (std::is_void_v) {
-/* This type is not support in this node for now. */
+/* This type is not supported in this node for now. */
 BLI_assert_unreachable();
   }
   else {

___
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] [998fc4f8f60] master: Cleanup: fix compiler errors

2022-09-23 Thread Jacques Lucke
Commit: 998fc4f8f60e58acd439037f68b545c714cc1ec2
Author: Jacques Lucke
Date:   Fri Sep 23 14:45:25 2022 +0200
Branches: master
https://developer.blender.org/rB998fc4f8f60e58acd439037f68b545c714cc1ec2

Cleanup: fix compiler errors

===

M   source/blender/blenkernel/intern/sound.c
M   source/blender/draw/engines/eevee/eevee_lightcache.c
M   source/blender/draw/intern/draw_manager.c
M   source/blender/editors/sculpt_paint/sculpt_cloth.c
M   source/blender/editors/space_info/info_stats.cc
M   source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c

===

diff --git a/source/blender/blenkernel/intern/sound.c 
b/source/blender/blenkernel/intern/sound.c
index 96cd33628ca..6e23ca0e89f 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -1155,7 +1155,7 @@ void BKE_sound_update_scene(Depsgraph *depsgraph, Scene 
*scene)
 
   /* cheap test to skip looping over all objects (no speakers is a common 
case) */
   if (DEG_id_type_any_exists(depsgraph, ID_SPK)) {
-DEGObjectIterSettings deg_iter_settings = {};
+DEGObjectIterSettings deg_iter_settings = {0};
 deg_iter_settings.depsgraph = depsgraph;
 deg_iter_settings.flags = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
   DEG_ITER_OBJECT_FLAG_LINKED_INDIRECTLY |
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c 
b/source/blender/draw/engines/eevee/eevee_lightcache.c
index 2bf1942ad88..9bf0cce2af2 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -639,7 +639,7 @@ static void eevee_lightbake_count_probes(EEVEE_LightBake 
*lbake)
   /* At least one of each for the world */
   lbake->grid_len = lbake->cube_len = lbake->total_irr_samples = 1;
 
-  DEGObjectIterSettings deg_iter_settings = {};
+  DEGObjectIterSettings deg_iter_settings = {0};
   deg_iter_settings.depsgraph = depsgraph;
   deg_iter_settings.flags = DEG_OBJECT_ITER_FOR_RENDER_ENGINE_FLAGS;
   DEG_OBJECT_ITER_BEGIN (°_iter_settings, ob) {
@@ -1285,7 +1285,7 @@ static void eevee_lightbake_gather_probes(EEVEE_LightBake 
*lbake)
 
   /* Convert all lightprobes to tight UBO data from all lightprobes in the 
scene.
* This allows a large number of probe to be precomputed (even dupli ones). 
*/
-  DEGObjectIterSettings deg_iter_settings = {};
+  DEGObjectIterSettings deg_iter_settings = {0};
   deg_iter_settings.depsgraph = depsgraph;
   deg_iter_settings.flags = DEG_OBJECT_ITER_FOR_RENDER_ENGINE_FLAGS;
   DEG_OBJECT_ITER_BEGIN (°_iter_settings, ob) {
diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index d9d7528f642..51762e29506 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -969,7 +969,7 @@ void DRW_cache_free_old_batches(Main *bmain)
 
   /* TODO(fclem): This is not optimal since it iter over all dupli 
instances.
* In this case only the source object should be tagged. */
-  DEGObjectIterSettings deg_iter_settings = {};
+  DEGObjectIterSettings deg_iter_settings = {0};
   deg_iter_settings.depsgraph = depsgraph;
   deg_iter_settings.flags = DEG_OBJECT_ITER_FOR_RENDER_ENGINE_FLAGS;
   DEG_OBJECT_ITER_BEGIN (°_iter_settings, ob) {
@@ -1692,7 +1692,7 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph,
 if (do_populate_loop) {
   DST.dupli_origin = NULL;
   DST.dupli_origin_data = NULL;
-  DEGObjectIterSettings deg_iter_settings = {};
+  DEGObjectIterSettings deg_iter_settings = {0};
   deg_iter_settings.depsgraph = depsgraph;
   deg_iter_settings.flags = DEG_OBJECT_ITER_FOR_RENDER_ENGINE_FLAGS;
   DEG_OBJECT_ITER_BEGIN (°_iter_settings, ob) {
@@ -1847,7 +1847,7 @@ bool DRW_render_check_grease_pencil(Depsgraph *depsgraph)
 return false;
   }
 
-  DEGObjectIterSettings deg_iter_settings = {};
+  DEGObjectIterSettings deg_iter_settings = {0};
   deg_iter_settings.depsgraph = depsgraph;
   deg_iter_settings.flags = DEG_OBJECT_ITER_FOR_RENDER_ENGINE_FLAGS;
   DEG_OBJECT_ITER_BEGIN (°_iter_settings, ob) {
@@ -2060,7 +2060,7 @@ void DRW_render_object_iter(
0;
   DST.dupli_origin = NULL;
   DST.dupli_origin_data = NULL;
-  DEGObjectIterSettings deg_iter_settings = {};
+  DEGObjectIterSettings deg_iter_settings = {0};
   deg_iter_settings.depsgraph = depsgraph;
   deg_iter_settings.flags = DEG_OBJECT_ITER_FOR_RENDER_ENGINE_FLAGS;
   DEG_OBJECT_ITER_BEGIN (°_iter_settings, ob) {
@@ -2207,7 +2207,7 @@ void DRW_draw_render_loop_2d_ex(struct Depsgraph 
*depsgraph,
 
 /* Only iterate over objects when overlay uses object data. */
 if (do_populate_loop) {
-  DEGObjectIterSettings deg_iter_settings = {};
+  DEGObjectIterSettings deg_iter_settings = {0};

[Bf-blender-cvs] [f2b5fd0a0e8] master: Cleanup: give anonymous enum a name

2022-09-23 Thread Jacques Lucke
Commit: f2b5fd0a0e83b691361d6da1a4504fe61f4e8bbf
Author: Jacques Lucke
Date:   Fri Sep 23 12:48:22 2022 +0200
Branches: master
https://developer.blender.org/rBf2b5fd0a0e83b691361d6da1a4504fe61f4e8bbf

Cleanup: give anonymous enum a name

===

M   source/blender/depsgraph/DEG_depsgraph_query.h

===

diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h 
b/source/blender/depsgraph/DEG_depsgraph_query.h
index ea85f4920e8..81c264d70a3 100644
--- a/source/blender/depsgraph/DEG_depsgraph_query.h
+++ b/source/blender/depsgraph/DEG_depsgraph_query.h
@@ -10,6 +10,7 @@
 #pragma once
 
 #include "BLI_iterator.h"
+#include "BLI_utildefines.h"
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_build.h"
@@ -132,17 +133,20 @@ bool DEG_is_fully_evaluated(const struct Depsgraph 
*depsgraph);
 /** \name DEG object iterators
  * \{ */
 
-enum {
+typedef enum DegIterFlag {
   DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY = (1 << 0),
   DEG_ITER_OBJECT_FLAG_LINKED_INDIRECTLY = (1 << 1),
   DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET = (1 << 2),
   DEG_ITER_OBJECT_FLAG_VISIBLE = (1 << 3),
   DEG_ITER_OBJECT_FLAG_DUPLI = (1 << 4),
-};
+} DegIterFlag;
+ENUM_OPERATORS(DegIterFlag, DEG_ITER_OBJECT_FLAG_DUPLI)
 
 typedef struct DEGObjectIterSettings {
   struct Depsgraph *depsgraph;
   /**
+   * Bitfield of the #DegIterFlag.
+   *
* NOTE: Be careful with DEG_ITER_OBJECT_FLAG_LINKED_INDIRECTLY objects.
* Although they are available they have no overrides (collection_properties)
* and will crash if you try to access it.

___
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] [e5d4afd5bac] master: Depsgraph: generalize passing parameters to depsgraph object iterator

2022-09-23 Thread Jacques Lucke
Commit: e5d4afd5bac71e29ba71ecf091feaa0d70b70260
Author: Jacques Lucke
Date:   Fri Sep 23 12:39:56 2022 +0200
Branches: master
https://developer.blender.org/rBe5d4afd5bac71e29ba71ecf091feaa0d70b70260

Depsgraph: generalize passing parameters to depsgraph object iterator

This makes it easier to pass more parameters to the iterator in the future.

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

===

M   source/blender/blenkernel/intern/object.cc
M   source/blender/blenkernel/intern/object_dupli.cc
M   source/blender/blenkernel/intern/sound.c
M   source/blender/depsgraph/DEG_depsgraph_query.h
M   source/blender/draw/engines/eevee/eevee_lightcache.c
M   source/blender/draw/intern/draw_manager.c
M   source/blender/editors/sculpt_paint/sculpt_cloth.c
M   source/blender/editors/space_info/info_stats.cc
M   source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
M   source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
M   source/blender/io/common/intern/abstract_hierarchy_iterator.cc
M   source/blender/io/wavefront_obj/exporter/obj_exporter.cc
M   source/blender/io/wavefront_obj/tests/obj_importer_tests.cc

===

diff --git a/source/blender/blenkernel/intern/object.cc 
b/source/blender/blenkernel/intern/object.cc
index 167c6db05e2..7ea6a4c597e 100644
--- a/source/blender/blenkernel/intern/object.cc
+++ b/source/blender/blenkernel/intern/object.cc
@@ -4187,10 +4187,11 @@ void BKE_scene_foreach_display_point(Depsgraph 
*depsgraph,
  void (*func_cb)(const float[3], void *),
  void *user_data)
 {
-  DEG_OBJECT_ITER_BEGIN (depsgraph,
- ob,
- DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | 
DEG_ITER_OBJECT_FLAG_VISIBLE |
- DEG_ITER_OBJECT_FLAG_DUPLI) {
+  DEGObjectIterSettings deg_iter_settings{};
+  deg_iter_settings.depsgraph = depsgraph;
+  deg_iter_settings.flags = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | 
DEG_ITER_OBJECT_FLAG_VISIBLE |
+DEG_ITER_OBJECT_FLAG_DUPLI;
+  DEG_OBJECT_ITER_BEGIN (°_iter_settings, ob) {
 if ((ob->base_flag & BASE_SELECTED) != 0) {
   BKE_object_foreach_display_point(ob, ob->obmat, func_cb, user_data);
 }
diff --git a/source/blender/blenkernel/intern/object_dupli.cc 
b/source/blender/blenkernel/intern/object_dupli.cc
index 6db1c864918..dde3130a5b0 100644
--- a/source/blender/blenkernel/intern/object_dupli.cc
+++ b/source/blender/blenkernel/intern/object_dupli.cc
@@ -311,12 +311,13 @@ static void make_child_duplis(const DupliContext *ctx,
 /* FIXME: using a mere counter to generate a 'persistent' dupli id is very 
weak. One possible
  * better solution could be to use `session_uuid` of ID's instead? */
 int persistent_dupli_id = 0;
+DEGObjectIterSettings deg_iter_settings{};
+deg_iter_settings.depsgraph = ctx->depsgraph;
 /* NOTE: this set of flags ensure we only iterate over objects that have a 
base in either the
  * current scene, or the set (background) scene. */
-int deg_objects_visibility_flags = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
-   DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET;
-
-DEG_OBJECT_ITER_BEGIN (ctx->depsgraph, ob, deg_objects_visibility_flags) {
+deg_iter_settings.flags = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
+  DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET;
+DEG_OBJECT_ITER_BEGIN (°_iter_settings, ob) {
   if ((ob != ctx->obedit) && is_child(ob, parent)) {
 DupliContext pctx;
 if (copy_dupli_context(&pctx, ctx, ctx->object, nullptr, 
persistent_dupli_id)) {
diff --git a/source/blender/blenkernel/intern/sound.c 
b/source/blender/blenkernel/intern/sound.c
index de1d0d3c30e..96cd33628ca 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -1155,11 +1155,12 @@ void BKE_sound_update_scene(Depsgraph *depsgraph, Scene 
*scene)
 
   /* cheap test to skip looping over all objects (no speakers is a common 
case) */
   if (DEG_id_type_any_exists(depsgraph, ID_SPK)) {
-DEG_OBJECT_ITER_BEGIN (depsgraph,
-   object,
-   (DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
-DEG_ITER_OBJECT_FLAG_LINKED_INDIRECTLY |
-DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET)) {
+DEGObjectIterSettings deg_iter_settings = {};
+deg_iter_settings.depsgraph = depsgraph;
+deg_iter_settings.flags = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
+  DEG_ITER_OBJECT_FLAG_LINKED_INDIRECTLY |
+  DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET;
+DEG_OBJECT_ITER_BEGIN (°_iter_settings, object) {
   sound_update_base(scene, objec

[Bf-blender-cvs] [eb54502d9d2] master: Fix T101109: Animation on nodes problems when dealing with Node Groups

2022-09-23 Thread Philipp Oeser
Commit: eb54502d9d29b18cbeda22125a601f3ce0bc423e
Author: Philipp Oeser
Date:   Fri Sep 16 13:04:54 2022 +0200
Branches: master
https://developer.blender.org/rBeb54502d9d29b18cbeda22125a601f3ce0bc423e

Fix T101109: Animation on nodes problems when dealing with Node Groups

Whenever animation on nodes was transfered to/from nodegroups (grouping/
ungrouping/separating) via BKE_animdata_transfer_by_basepath, it was
possible to create new nodes with the same name (in the formerly same
path -- see report for an example of this) and animation from the
original node was still performed on them. Issue went away after save/
reload.

In order to fully update the action, a depsgraph is now performed on the
action (similar to what is done when renaming for example).

Maniphest Tasks: T101109

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

===

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

===

diff --git a/source/blender/blenkernel/intern/anim_data.c 
b/source/blender/blenkernel/intern/anim_data.c
index 65ce3e3b523..9b68c19c6e2 100644
--- a/source/blender/blenkernel/intern/anim_data.c
+++ b/source/blender/blenkernel/intern/anim_data.c
@@ -659,6 +659,8 @@ void BKE_animdata_transfer_by_basepath(Main *bmain, ID 
*srcID, ID *dstID, ListBa
   srcAdt, dstAdt, basepath_change->src_basepath, 
basepath_change->dst_basepath);
 }
   }
+  /* Tag source action because list of fcurves changed. */
+  DEG_id_tag_update(&srcAdt->action->id, ID_RECALC_COPY_ON_WRITE);
 }
 
 /* Path Validation  */

___
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] [c350d97a2f6] master: Fix T101046: missing DEG update changing bone layers in editmode

2022-09-23 Thread Philipp Oeser
Commit: c350d97a2f69593569cd4deae73973c66355fa18
Author: Philipp Oeser
Date:   Wed Sep 14 13:16:03 2022 +0200
Branches: master
https://developer.blender.org/rBc350d97a2f69593569cd4deae73973c66355fa18

Fix T101046: missing DEG update changing bone layers in editmode

Following {T54811} (and {rBbb92edd1c802}), DEG updates have been added
to the various operators. This has also been done for the layers
operators (see {rBf998bad211ae}, `ARMATURE_OT_bone_layers` has been
marked done in T54811). However, instead of `ARMATURE_OT_bone_layers`,
the update tagging actually happened for `POSE_OT_bone_layers`.

Now do this for `ARMATURE_OT_bone_layers` as well (keep it for
`POSE_OT_bone_layers`, dont think this is wrong there either).

Maniphest Tasks: T101046

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

===

M   source/blender/editors/armature/pose_edit.c

===

diff --git a/source/blender/editors/armature/pose_edit.c 
b/source/blender/editors/armature/pose_edit.c
index 6a64c70493a..98861dc2b63 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -954,6 +954,7 @@ static int armature_bone_layers_exec(bContext *C, 
wmOperator *op)
 
   /* NOTE: notifier might evolve. */
   WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
+  DEG_id_tag_update((ID *)ob->data, ID_RECALC_PARAMETERS);
 
   return OPERATOR_FINISHED;
 }

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


[Bf-blender-cvs] [e429ae2f1e8] gpencil-new-data-proposal: Merge branch 'master' into gpencil-new-data-proposal

2022-09-23 Thread Antonio Vazquez
Commit: e429ae2f1e846cd5d5ca2b7461eb6136e1ea7bed
Author: Antonio Vazquez
Date:   Fri Sep 23 09:16:32 2022 +0200
Branches: gpencil-new-data-proposal
https://developer.blender.org/rBe429ae2f1e846cd5d5ca2b7461eb6136e1ea7bed

Merge branch 'master' into gpencil-new-data-proposal

===



===



___
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