[Bf-blender-cvs] [79a34758f52] master: Fix T103253: Infinite drag of number buttons is broken on WIN32

2022-12-15 Thread Campbell Barton
Commit: 79a34758f52ad2dce1d0545ee23ff85b6d15e119
Author: Campbell Barton
Date:   Fri Dec 16 18:37:44 2022 +1100
Branches: master
https://developer.blender.org/rB79a34758f52ad2dce1d0545ee23ff85b6d15e119

Fix T103253: Infinite drag of number buttons is broken on WIN32

Recent reverting of changes to cursor grabbing intended to match
Blender 3.3 release. This is the case for 3.4x branch, however there is
an additional change to grabbing on WIN32 by Germano [0] which is a
significant improvement on old grabbing logic for Windows.
So instead of matching 3.3x behavior, restore logic that keeps
the cursor centered while grabbing & hidden.

This re-introduces T102792 issue displaying the paint-brush while
dragging buttons, this will have to be solved separately.

Re-apply [1] & [2], revert [3] & [4].

[4]: a3a9459050a96e75138b3441c069898f211f179c
[0]: 9fd6dae7939a65b67045749a0eadeb6864ded183
[1]: 4cac8025f00798938813f52dcb117be83db97f22
[2]: 230744d6fd96dcf5afe66a8f9b9f6f8bbe1f41bb
[3]: 0240b895994aa58258db6897ae0d6478da7fce5f

===

M   intern/ghost/intern/GHOST_SystemWin32.cpp
M   intern/ghost/intern/GHOST_SystemX11.cpp
M   source/blender/editors/space_view3d/view3d_navigate_walk.c
M   source/tools

===

diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp 
b/intern/ghost/intern/GHOST_SystemWin32.cpp
index d005eec3036..8cb007a756a 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -1075,16 +1075,45 @@ GHOST_EventCursor 
*GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind
 int32_t x_new = x_screen;
 int32_t y_new = y_screen;
 int32_t x_accum, y_accum;
-GHOST_Rect bounds;
 
-/* Fallback to window bounds. */
-if (window->getCursorGrabBounds(bounds) == GHOST_kFailure) {
-  window->getClientBounds(bounds);
-}
+/* Warp within bounds. */
+{
+  GHOST_Rect bounds;
+  int32_t bounds_margin = 0;
+  GHOST_TAxisFlag bounds_axis = GHOST_kAxisNone;
+
+  if (window->getCursorGrabMode() == GHOST_kGrabHide) {
+window->getClientBounds(bounds);
+
+/* WARNING(@campbellbarton): The current warping logic fails to warp 
on every event,
+ * so the box needs to small enough not to let the cursor escape the 
window but large
+ * enough that the cursor isn't being warped every time.
+ * If this was not the case it would be less trouble to simply warp 
the cursor to the
+ * center of the screen on every motion, see: D16558 (alternative fix 
for T102346). */
+const int32_t subregion_div = 4; /* One quarter of the region. */
+const int32_t size[2] = {bounds.getWidth(), bounds.getHeight()};
+const int32_t center[2] = {(bounds.m_l + bounds.m_r) / 2, (bounds.m_t 
+ bounds.m_b) / 2};
+/* Shrink the box to prevent the cursor escaping. */
+bounds.m_l = center[0] - (size[0] / (subregion_div * 2));
+bounds.m_r = center[0] + (size[0] / (subregion_div * 2));
+bounds.m_t = center[1] - (size[1] / (subregion_div * 2));
+bounds.m_b = center[1] + (size[1] / (subregion_div * 2));
+bounds_margin = 0;
+bounds_axis = GHOST_TAxisFlag(GHOST_kAxisX | GHOST_kAxisY);
+  }
+  else {
+/* Fallback to window bounds. */
+if (window->getCursorGrabBounds(bounds) == GHOST_kFailure) {
+  window->getClientBounds(bounds);
+}
+bounds_margin = 2;
+bounds_axis = window->getCursorGrabAxis();
+  }
 
-/* Could also clamp to screen bounds wrap with a window outside the view 
will
- * fail at the moment. Use inset in case the window is at screen bounds. */
-bounds.wrapPoint(x_new, y_new, 2, window->getCursorGrabAxis());
+  /* Could also clamp to screen bounds wrap with a window outside the view 
will
+   * fail at the moment. Use inset in case the window is at screen bounds. 
*/
+  bounds.wrapPoint(x_new, y_new, bounds_margin, bounds_axis);
+}
 
 window->getCursorGrabAccum(x_accum, y_accum);
 if (x_new != x_screen || y_new != y_screen) {
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp 
b/intern/ghost/intern/GHOST_SystemX11.cpp
index 72f34dac52e..3122a7ce562 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -917,16 +917,47 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
 int32_t x_new = xme.x_root;
 int32_t y_new = xme.y_root;
 int32_t x_accum, y_accum;
-GHOST_Rect bounds;
 
-/* fallback to window bounds */
-if (window->getCursorGrabBounds(bounds) == GHOST_kFailure) {
-  window->getClientBounds(bounds);
-}
+/* Warp within bounds. */
+{
+  GHOST_Rect bounds;
+  int32_t bounds_margin = 0;
+  GHOST_TAxisFlag bounds_axis = GHOST_kAxisNone;
+
+ 

[Bf-blender-cvs] [ba89f640fe6] master: Fix T102792: Sculpt cursor jumps to random place

2022-12-15 Thread Campbell Barton
Commit: ba89f640fe6566437f8aaf4974dcda473671c7f4
Author: Campbell Barton
Date:   Fri Dec 16 18:37:47 2022 +1100
Branches: master
https://developer.blender.org/rBba89f640fe6566437f8aaf4974dcda473671c7f4

Fix T102792: Sculpt cursor jumps to random place

Restrict the condition under which paint cursors read use the cursor
location from the the operating-system.

This caused a glitch when dragging UI elements in painting context
popup. Since the paint cursor would display using mouse motion
which was clamped to the window center - an internal detail of hidden
cursor grabbing.

Now only read the cursor coordinates when clamped to a region which
is used for the transform cursor to stay visible even when the cursor
wraps around.

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_draw.c 
b/source/blender/windowmanager/intern/wm_draw.c
index cbbd0eb3a4f..15826af32fa 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -63,6 +63,31 @@
 #  include "BKE_subsurf.h"
 #endif
 
+/*  */
+/** \name Internal Utilities
+ * \{ */
+
+/**
+ * Return true when the cursor is grabbed and wrapped within a region.
+ */
+static bool wm_window_grab_warp_region_is_set(const wmWindow *win)
+{
+  if (ELEM(win->grabcursor, GHOST_kGrabWrap, GHOST_kGrabHide)) {
+GHOST_TGrabCursorMode mode_dummy;
+GHOST_TAxisFlag wrap_axis_dummy;
+int bounds[4] = {0};
+bool use_software_cursor_dummy = false;
+GHOST_GetCursorGrabState(
+win->ghostwin, &mode_dummy, &wrap_axis_dummy, bounds, 
&use_software_cursor_dummy);
+if ((bounds[0] != bounds[2]) || (bounds[1] != bounds[3])) {
+  return true;
+}
+  }
+  return false;
+}
+
+/** \} */
+
 /*  */
 /** \name Draw Paint Cursor
  * \{ */
@@ -102,8 +127,14 @@ static void wm_paintcursor_draw(bContext *C, ScrArea 
*area, ARegion *region)
   region->winrct.ymin,
   BLI_rcti_size_x(®ion->winrct) + 1,
   BLI_rcti_size_y(®ion->winrct) + 1);
-
-  if (ELEM(win->grabcursor, GHOST_kGrabWrap, GHOST_kGrabHide)) {
+  /* Reading the cursor location from the operating-system while the 
cursor is grabbed
+   * conflicts with grabbing logic that hides the cursor, then keeps it 
centered to accumulate
+   * deltas without it escaping from the window. In this case we never 
want to show the actual
+   * cursor coordinates so limit reading the cursor location to when the 
cursor is grabbed and
+   * wrapping in a region since this is the case when it would otherwise 
attempt to draw the
+   * cursor outside the view/window. See: T102792. */
+  if ((WM_capabilities_flag() & WM_CAPABILITY_CURSOR_WARP) &&
+  wm_window_grab_warp_region_is_set(win)) {
 int x = 0, y = 0;
 wm_cursor_position_get(win, &x, &y);
 pc->draw(C, x, y, pc->customdata);

___
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] [f2945f38959] master: UI: don't change mouse cursor while it's grabbed

2022-12-15 Thread Campbell Barton
Commit: f2945f38959afb544a52a1d0d57be106c5dadf47
Author: Campbell Barton
Date:   Fri Dec 16 17:22:09 2022 +1100
Branches: master
https://developer.blender.org/rBf2945f38959afb544a52a1d0d57be106c5dadf47

UI: don't change mouse cursor while it's grabbed

The paint cursor was continuously set which meant hiding the cursor
while interacting with buttons would immediately show it again.

This exposed cursor warping.

===

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

===

diff --git a/source/blender/editors/sculpt_paint/paint_cursor.cc 
b/source/blender/editors/sculpt_paint/paint_cursor.cc
index 15e45b8ac21..deb1fff946b 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.cc
+++ b/source/blender/editors/sculpt_paint/paint_cursor.cc
@@ -1400,6 +1400,11 @@ static void 
paint_cursor_sculpt_session_update_and_init(PaintCursorContext *pcon
 
 static void paint_update_mouse_cursor(PaintCursorContext *pcontext)
 {
+  if (pcontext->win->grabcursor != 0) {
+/* Don't set the cursor while it's grabbed, since this will show the 
cursor when interacting
+ * with the UI (dragging a number button for e.g.), see: T102792. */
+return;
+  }
   WM_cursor_set(pcontext->win, WM_CURSOR_PAINT);
 }

___
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] [ba7afbe3a12] master: Build: remove opus workaround for sndfile

2022-12-15 Thread Campbell Barton
Commit: ba7afbe3a124c170580f12a9222ab18faf38770c
Author: Campbell Barton
Date:   Fri Dec 16 15:33:15 2022 +1100
Branches: master
https://developer.blender.org/rBba7afbe3a124c170580f12a9222ab18faf38770c

Build: remove opus workaround for sndfile

For some reason SNDFILE now builds without this workaround,
which broke building FFMPEG.

===

M   build_files/build_environment/cmake/sndfile.cmake

===

diff --git a/build_files/build_environment/cmake/sndfile.cmake 
b/build_files/build_environment/cmake/sndfile.cmake
index 3ea4c776e56..8fc614c06c3 100644
--- a/build_files/build_environment/cmake/sndfile.cmake
+++ b/build_files/build_environment/cmake/sndfile.cmake
@@ -17,19 +17,6 @@ else()
   set(SNDFILE_OPTIONS --enable-static --disable-shared )
 endif()
 
-if(UNIX AND NOT APPLE)
-  # NOTE(@campbellbarton): For some reason OPUS is alone in referencing the 
sub-directory,
-  # manipulate the package-config file to prevent this from happening.
-  # There is no problem with applying this change multiple times.
-  #
-  # Replace: Cflags: -I${includedir}/opus
-  # With:Cflags: -I${includedir}
-  set(SNDFILE_ENV
-sed -i s/{includedir}\\/opus/{includedir}/g 
${LIBDIR}/opus/lib/pkgconfig/opus.pc &&
-${SNDFILE_ENV}
-  )
-endif()
-
 ExternalProject_Add(external_sndfile
   URL file://${PACKAGE_DIR}/${SNDFILE_FILE}
   DOWNLOAD_DIR ${DOWNLOAD_DIR}

___
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] [8b2afe93b47] master: Build: correct extension type for SNDFILE

2022-12-15 Thread Campbell Barton
Commit: 8b2afe93b4730e15e30cdc76a95628a3ca22c3d7
Author: Campbell Barton
Date:   Fri Dec 16 15:35:20 2022 +1100
Branches: master
https://developer.blender.org/rB8b2afe93b4730e15e30cdc76a95628a3ca22c3d7

Build: correct extension type for SNDFILE

===

M   build_files/build_environment/cmake/versions.cmake

===

diff --git a/build_files/build_environment/cmake/versions.cmake 
b/build_files/build_environment/cmake/versions.cmake
index 6b56df4ee99..a4fc7dcc569 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -359,7 +359,7 @@ set(SNDFILE_VERSION 1.1.0)
 set(SNDFILE_URI 
https://github.com/libsndfile/libsndfile/releases/download/1.1.0/libsndfile-${SNDFILE_VERSION}.tar.xz)
 set(SNDFILE_HASH e63dead2b4f0aaf323687619d007ee6a)
 set(SNDFILE_HASH_TYPE MD5)
-set(SNDFILE_FILE libsndfile-${SNDFILE_VERSION}.tar.gz)
+set(SNDFILE_FILE libsndfile-${SNDFILE_VERSION}.tar.xz)
 set(SNDFILE_CPE 
"cpe:2.3:a:libsndfile_project:libsndfile:${SNDFILE_VERSION}:*:*:*:*:*:*:*")
 
 set(WEBP_VERSION 1.2.2)

___
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] [0079460dc79] master: Fix T102923: replace zero check with epsilons with uv constrain to bounds

2022-12-15 Thread Chris Blackbourn
Commit: 0079460dc79a6c4798ec41e86550d8f0882ed313
Author: Chris Blackbourn
Date:   Fri Dec 16 17:22:41 2022 +1300
Branches: master
https://developer.blender.org/rB0079460dc79a6c4798ec41e86550d8f0882ed313

Fix T102923: replace zero check with epsilons with uv constrain to bounds

Small roundoff errors during UV editing can sometimes occur, most likely
due to so-called "catastrophic cancellation".

Here we set a tolerance around zero when using Constrain-To-Bounds and UV 
Scaling.

The tolerance is set at one quarter of a texel, on a 65536 x 65536 texture.

TODO: If this fix holds, we should formalize the tolerance into the UV editing
subsystem, perhaps as a helper function, and investigate where else it needs
to be applied.

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

===

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

===

diff --git a/source/blender/editors/transform/transform_mode_resize.c 
b/source/blender/editors/transform/transform_mode_resize.c
index 70599c3577c..4e671768721 100644
--- a/source/blender/editors/transform/transform_mode_resize.c
+++ b/source/blender/editors/transform/transform_mode_resize.c
@@ -95,9 +95,14 @@ static void constrain_scale_to_boundary(const float 
numerator,
 const float denominator,
 float *scale)
 {
-  if (denominator == 0.0f) {
-/* The origin of the scale is on the edge of the boundary. */
-if (numerator < 0.0f) {
+  /* It's possible the numerator or denominator can be very close to zero due 
to so-called
+   * "catastrophic cancellation". See T102923 for an example. We use epsilon 
tests here to
+   * distinguish between genuine negative coordinates versus coordinates that 
should be rounded off
+   * to zero. */
+  const float epsilon = 0.25f / 65536.0f; /* i.e. Quarter of a texel on a 
65536 x 65536 texture. */
+  if (fabsf(denominator) < epsilon) {
+/* The origin of the scale is very near the edge of the boundary. */
+if (numerator < -epsilon) {
   /* Negative scale will wrap around and put us outside the boundary. */
   *scale = 0.0f; /* Hold at the boundary instead. */
 }

___
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] [a6c30e1a0c6] master: Fix T103237: Prevent UV Unwrap from packing hidden UV islands

2022-12-15 Thread Chris Blackbourn
Commit: a6c30e1a0c62041c02f03270a15334d6de22db5e
Author: Chris Blackbourn
Date:   Fri Dec 16 16:20:11 2022 +1300
Branches: master
https://developer.blender.org/rBa6c30e1a0c62041c02f03270a15334d6de22db5e

Fix T103237: Prevent UV Unwrap from packing hidden UV islands

When migrating to the new packing API, pin_unselected was not
implemented correctly.

Regression from rB143e74c0b8eb, rBe3075f3cf7ce, rB0ce18561bc82.

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

Reviewed By: Campbell Barton

Duplicated in blender-v3.4-release as rB3dcd9992676a

===

M   source/blender/editors/uvedit/uvedit_islands.cc

===

diff --git a/source/blender/editors/uvedit/uvedit_islands.cc 
b/source/blender/editors/uvedit/uvedit_islands.cc
index efba43b7ffd..893fd22a405 100644
--- a/source/blender/editors/uvedit/uvedit_islands.cc
+++ b/source/blender/editors/uvedit/uvedit_islands.cc
@@ -618,13 +618,21 @@ static BoxPack *pack_islands_params(const 
blender::Vector &island_
   return box_array;
 }
 
-static bool island_has_pins(const Scene *scene, FaceIsland *island, const bool 
pin_unselected)
+static bool island_has_pins(const Scene *scene,
+FaceIsland *island,
+const UVPackIsland_Params *params)
 {
+  const bool pin_unselected = params->pin_unselected;
+  const bool only_selected_faces = params->only_selected_faces;
   BMLoop *l;
   BMIter iter;
   const int cd_loop_uv_offset = island->cd_loop_uv_offset;
   for (int i = 0; i < island->faces_len; i++) {
-BM_ITER_ELEM (l, &iter, island->faces[i], BM_LOOPS_OF_FACE) {
+BMFace *efa = island->faces[i];
+if (pin_unselected && only_selected_faces && !BM_elem_flag_test(efa, 
BM_ELEM_SELECT)) {
+  return true;
+}
+BM_ITER_ELEM (l, &iter, efa, BM_LOOPS_OF_FACE) {
   MLoopUV *luv = static_cast(BM_ELEM_CD_GET_VOID_P(l, 
cd_loop_uv_offset));
   if (luv->flag & MLOOPUV_PINNED) {
 return true;
@@ -697,7 +705,7 @@ void ED_uvedit_pack_islands_multi(const Scene *scene,
 /* Remove from linked list and append to blender::Vector. */
 LISTBASE_FOREACH_MUTABLE (struct FaceIsland *, island, &island_list) {
   BLI_remlink(&island_list, island);
-  if (params->ignore_pinned && island_has_pins(scene, island, 
params->pin_unselected)) {
+  if (params->ignore_pinned && island_has_pins(scene, island, params)) {
 MEM_freeN(island->faces);
 MEM_freeN(island);
 continue;

___
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] [75c2e811039] master: Cleanup: format

2022-12-15 Thread Chris Blackbourn
Commit: 75c2e8110395e0082fec365d80337ffe2fcef64e
Author: Chris Blackbourn
Date:   Fri Dec 16 16:55:16 2022 +1300
Branches: master
https://developer.blender.org/rB75c2e8110395e0082fec365d80337ffe2fcef64e

Cleanup: format

===

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

===

diff --git a/source/blender/blenkernel/intern/mesh_convert.cc 
b/source/blender/blenkernel/intern/mesh_convert.cc
index db4d6396c92..8354de20e20 100644
--- a/source/blender/blenkernel/intern/mesh_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_convert.cc
@@ -1104,7 +1104,6 @@ Mesh *BKE_mesh_new_from_object_to_bmain(Main *bmain,
   return mesh_in_bmain;
 }
 
-
 static KeyBlock *keyblock_ensure_from_uid(Key &key, const int uid, const 
StringRefNull name)
 {
   if (KeyBlock *kb = BKE_keyblock_find_uid(&key, uid)) {

___
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] [3dcd9992676] blender-v3.4-release: Fix T103237: Prevent UV Unwrap from packing hidden UV islands

2022-12-15 Thread Chris Blackbourn
Commit: 3dcd9992676aba2ff7d15872a9f355fdfb626566
Author: Chris Blackbourn
Date:   Fri Dec 16 16:20:11 2022 +1300
Branches: blender-v3.4-release
https://developer.blender.org/rB3dcd9992676aba2ff7d15872a9f355fdfb626566

Fix T103237: Prevent UV Unwrap from packing hidden UV islands

When migrating to the new packing API, pin_unselected was not
implemented correctly.

Regression from rB143e74c0b8eb, rBe3075f3cf7ce, rB0ce18561bc82.

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

Reviewed By: Campbell Barton

===

M   source/blender/editors/uvedit/uvedit_islands.cc

===

diff --git a/source/blender/editors/uvedit/uvedit_islands.cc 
b/source/blender/editors/uvedit/uvedit_islands.cc
index 27a951779c0..457e70eef67 100644
--- a/source/blender/editors/uvedit/uvedit_islands.cc
+++ b/source/blender/editors/uvedit/uvedit_islands.cc
@@ -600,13 +600,21 @@ static BoxPack *pack_islands_params(const 
blender::Vector &island_
   return box_array;
 }
 
-static bool island_has_pins(const Scene *scene, FaceIsland *island, const bool 
pin_unselected)
+static bool island_has_pins(const Scene *scene,
+FaceIsland *island,
+const UVPackIsland_Params *params)
 {
+  const bool pin_unselected = params->pin_unselected;
+  const bool only_selected_faces = params->only_selected_faces;
   BMLoop *l;
   BMIter iter;
   const int cd_loop_uv_offset = island->cd_loop_uv_offset;
   for (int i = 0; i < island->faces_len; i++) {
-BM_ITER_ELEM (l, &iter, island->faces[i], BM_LOOPS_OF_FACE) {
+BMFace *efa = island->faces[i];
+if (pin_unselected && only_selected_faces && !BM_elem_flag_test(efa, 
BM_ELEM_SELECT)) {
+  return true;
+}
+BM_ITER_ELEM (l, &iter, efa, BM_LOOPS_OF_FACE) {
   MLoopUV *luv = static_cast(BM_ELEM_CD_GET_VOID_P(l, 
cd_loop_uv_offset));
   if (luv->flag & MLOOPUV_PINNED) {
 return true;
@@ -679,7 +687,7 @@ void ED_uvedit_pack_islands_multi(const Scene *scene,
 /* Remove from linked list and append to blender::Vector. */
 LISTBASE_FOREACH_MUTABLE (struct FaceIsland *, island, &island_list) {
   BLI_remlink(&island_list, island);
-  if (params->ignore_pinned && island_has_pins(scene, island, 
params->pin_unselected)) {
+  if (params->ignore_pinned && island_has_pins(scene, island, params)) {
 MEM_freeN(island->faces);
 MEM_freeN(island);
 continue;

___
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] [ce56101897d] temp-sculpt-roll-mapping: Merge branch 'master' into temp-sculpt-roll-mapping

2022-12-15 Thread Joseph Eagar
Commit: ce56101897d55d453096ed545e14e29ce4c74506
Author: Joseph Eagar
Date:   Thu Dec 15 17:56:57 2022 -0800
Branches: temp-sculpt-roll-mapping
https://developer.blender.org/rBce56101897d55d453096ed545e14e29ce4c74506

Merge branch 'master' into temp-sculpt-roll-mapping

===



===

diff --cc source/blender/editors/sculpt_paint/CMakeLists.txt
index 94a067845d9,d1a80e3e068..633abe8f5c2
--- a/source/blender/editors/sculpt_paint/CMakeLists.txt
+++ b/source/blender/editors/sculpt_paint/CMakeLists.txt
@@@ -50,10 -50,10 +50,10 @@@ set(SR
paint_image_2d.c
paint_image_2d_curve_mask.cc
paint_image_ops_paint.cc
-   paint_image_proj.c
+   paint_image_proj.cc
paint_mask.c
paint_ops.c
 -  paint_stroke.c
 +  paint_stroke.cc
paint_utils.c
paint_vertex.cc
paint_vertex_color_ops.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] [841020dba25] master: Fix active/default color names not being editable

2022-12-15 Thread Campbell Barton
Commit: 841020dba2563fbae2cb757ee3c9de9826871b4d
Author: Campbell Barton
Date:   Fri Dec 16 12:30:56 2022 +1100
Branches: master
https://developer.blender.org/rB841020dba2563fbae2cb757ee3c9de9826871b4d

Fix active/default color names not being editable

Revert [0] and enable the editable flag as the intent for [1] was that
these values would be editable.

[0]: e58f5422c37762ab5b4302e7481a9ffed023913a
[1]: 6514bb05ea5a138d897151db02cb0bad9fe01968

===

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

===

diff --git a/source/blender/makesrna/intern/rna_attribute.c 
b/source/blender/makesrna/intern/rna_attribute.c
index efa87523204..98b3fa8553e 100644
--- a/source/blender/makesrna/intern/rna_attribute.c
+++ b/source/blender/makesrna/intern/rna_attribute.c
@@ -677,6 +677,18 @@ static int 
rna_AttributeGroup_default_color_name_length(PointerRNA *ptr)
   return name ? strlen(name) : 0;
 }
 
+static void rna_AttributeGroup_default_color_name_set(PointerRNA *ptr, const 
char *value)
+{
+  ID *id = ptr->owner_id;
+  if (GS(id->name) == ID_ME) {
+Mesh *mesh = (Mesh *)id;
+MEM_SAFE_FREE(mesh->default_color_attribute);
+if (value[0]) {
+  mesh->default_color_attribute = BLI_strdup(value);
+}
+  }
+}
+
 static void rna_AttributeGroup_active_color_name_get(PointerRNA *ptr, char 
*value)
 {
   const ID *id = ptr->owner_id;
@@ -695,6 +707,18 @@ static int 
rna_AttributeGroup_active_color_name_length(PointerRNA *ptr)
   return name ? strlen(name) : 0;
 }
 
+static void rna_AttributeGroup_active_color_name_set(PointerRNA *ptr, const 
char *value)
+{
+  ID *id = ptr->owner_id;
+  if (GS(id->name) == ID_ME) {
+Mesh *mesh = (Mesh *)id;
+MEM_SAFE_FREE(mesh->default_color_attribute);
+if (value[0]) {
+  mesh->default_color_attribute = BLI_strdup(value);
+}
+  }
+}
+
 #else
 
 static void rna_def_attribute_float(BlenderRNA *brna)
@@ -1156,24 +1180,22 @@ static void rna_def_attribute_group(BlenderRNA *brna)
   RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active_color");
 
   prop = RNA_def_property(srna, "default_color_name", PROP_STRING, PROP_NONE);
-  RNA_def_property_clear_flag(prop, PROP_EDITABLE);
   RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME);
   RNA_def_property_string_funcs(prop,
 "rna_AttributeGroup_default_color_name_get",
 "rna_AttributeGroup_default_color_name_length",
-NULL);
+"rna_AttributeGroup_default_color_name_set");
   RNA_def_property_ui_text(
   prop,
   "Default Color Attribute",
   "The name of the default color attribute used as a fallback for 
rendering");
 
   prop = RNA_def_property(srna, "active_color_name", PROP_STRING, PROP_NONE);
-  RNA_def_property_clear_flag(prop, PROP_EDITABLE);
   RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME);
   RNA_def_property_string_funcs(prop,
 "rna_AttributeGroup_active_color_name_get",
 "rna_AttributeGroup_active_color_name_length",
-NULL);
+"rna_AttributeGroup_active_color_name_set");
   RNA_def_property_ui_text(prop,
"Active Color Attribute",
"The name of the active color attribute for display 
and editing");

___
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] [edfef62371d] master: Fix T103183: UV map name of mesh converted from curve is untranslated

2022-12-15 Thread Damien Picard
Commit: edfef62371d5b111c7ae4bc4f6f3da2253decdc9
Author: Damien Picard
Date:   Fri Dec 16 09:47:21 2022 +0900
Branches: master
https://developer.blender.org/rBedfef62371d5b111c7ae4bc4f6f3da2253decdc9

Fix T103183: UV map name of mesh converted from curve is untranslated

Upon conversion, the newly-created UV map with default name "UVMap"
should be translated.

Reviewed By: mont29

Maniphest Tasks: T103183

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

===

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

===

diff --git a/source/blender/blenkernel/intern/mesh_convert.cc 
b/source/blender/blenkernel/intern/mesh_convert.cc
index 7a4c3c0834b..db4d6396c92 100644
--- a/source/blender/blenkernel/intern/mesh_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_convert.cc
@@ -26,6 +26,8 @@
 #include "BLI_string.h"
 #include "BLI_utildefines.h"
 
+#include "BLT_translation.h"
+
 #include "BKE_DerivedMesh.h"
 #include "BKE_curves.hh"
 #include "BKE_deform.h"
@@ -199,7 +201,7 @@ static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, 
const ListBase *dispba
   SpanAttributeWriter material_indices = 
attributes.lookup_or_add_for_write_only_span(
   "material_index", ATTR_DOMAIN_FACE);
   MLoopUV *mloopuv = static_cast(CustomData_add_layer_named(
-  &mesh->ldata, CD_MLOOPUV, CD_SET_DEFAULT, nullptr, mesh->totloop, 
"UVMap"));
+  &mesh->ldata, CD_MLOOPUV, CD_SET_DEFAULT, nullptr, mesh->totloop, 
DATA_("UVMap")));
 
   /* verts and faces */
   vertcount = 0;

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

2022-12-15 Thread Hans Goudey
Commit: fd395c9a0a2b5cc874e38c6d1236e9ba7e982d30
Author: Hans Goudey
Date:   Thu Dec 15 17:47:51 2022 -0600
Branches: refactor-mesh-position-generic
https://developer.blender.org/rBfd395c9a0a2b5cc874e38c6d1236e9ba7e982d30

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

===



===

diff --cc source/blender/blenkernel/BKE_mesh_legacy_convert.h
index 97234ccd139,65804e9ac24..a561cf9e8fd
--- a/source/blender/blenkernel/BKE_mesh_legacy_convert.h
+++ b/source/blender/blenkernel/BKE_mesh_legacy_convert.h
@@@ -89,13 -85,9 +87,16 @@@ void BKE_mesh_legacy_convert_mpoly_to_m
  /** Convert from runtime loose edge cache to legacy edge flag. */
  void BKE_mesh_legacy_convert_loose_edges_to_flag(struct Mesh *mesh);
  
+ void BKE_mesh_legacy_attribute_flags_to_strings(struct Mesh *mesh);
+ void BKE_mesh_legacy_attribute_strings_to_flags(struct Mesh *mesh);
+ 
 +struct MVert *BKE_mesh_legacy_convert_positions_to_verts(
 +Mesh *mesh,
 +blender::ResourceScope &temp_arrays_for_convert,
 +blender::Vector &vert_layers_to_write);
 +
 +void BKE_mesh_legacy_convert_verts_to_positions(Mesh *mesh);
 +
  #endif
  
  /**
diff --cc source/blender/blenkernel/intern/mesh.cc
index 7672223bd83,6ec171c4bcc..4e783ad428c
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@@ -268,9 -257,21 +272,12 @@@ static void mesh_blend_write(BlendWrite
BKE_mesh_legacy_bevel_weight_from_layers(mesh);
BKE_mesh_legacy_face_set_from_generic(mesh, poly_layers);
BKE_mesh_legacy_edge_crease_from_layers(mesh);
+   BKE_mesh_legacy_attribute_strings_to_flags(mesh);
+   mesh->active_color_attribute = nullptr;
+   mesh->default_color_attribute = nullptr;
BKE_mesh_legacy_convert_loose_edges_to_flag(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",
 -  ".select_vert",
 -  ".select_edge",
 -  ".select_poly"});
  
/* 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_convert.cc
index f66d7c2b69b,7a4c3c0834b..f0442d4b8bf
--- a/source/blender/blenkernel/intern/mesh_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_convert.cc
@@@ -1080,143 -1102,7 +1080,6 @@@ Mesh *BKE_mesh_new_from_object_to_bmain
return mesh_in_bmain;
  }
  
- static void add_shapekey_layers(Mesh *mesh_dest, Mesh *mesh_src)
- {
-   KeyBlock *kb;
-   Key *key = mesh_src->key;
-   int i;
- 
-   if (!mesh_src->key) {
- return;
-   }
- 
-   /* ensure we can use mesh vertex count for derived mesh custom data */
-   if (mesh_src->totvert != mesh_dest->totvert) {
- CLOG_ERROR(&LOG,
-"vertex size mismatch (mesh/dm) '%s' (%d != %d)",
-mesh_src->id.name + 2,
-mesh_src->totvert,
-mesh_dest->totvert);
- return;
-   }
- 
-   for (i = 0, kb = (KeyBlock *)key->block.first; kb; kb = kb->next, i++) {
- int ci;
- float *array;
- 
- if (mesh_src->totvert != kb->totelem) {
-   CLOG_ERROR(&LOG,
-  "vertex size mismatch (Mesh '%s':%d != KeyBlock '%s':%d)",
-  mesh_src->id.name + 2,
-  mesh_src->totvert,
-  kb->name,
-  kb->totelem);
-   array = (float *)MEM_calloc_arrayN(size_t(mesh_src->totvert), 
sizeof(float[3]), __func__);
- }
- else {
-   array = (float *)MEM_malloc_arrayN(size_t(mesh_src->totvert), 
sizeof(float[3]), __func__);
-   memcpy(array, kb->data, sizeof(float[3]) * size_t(mesh_src->totvert));
- }
- 
- CustomData_add_layer_named(
- &mesh_dest->vdata, CD_SHAPEKEY, CD_ASSIGN, array, mesh_dest->totvert, 
kb->name);
- ci = CustomData_get_layer_index_n(&mesh_dest->vdata, CD_SHAPEKEY, i);
- 
- mesh_dest->vdata.layers[ci].uid = kb->uid;
-   }
- }
- 
- Mesh *BKE_mesh_create_derived_for_modifier(struct Depsgraph *depsgraph,
-Scene *scene,
-Object *ob_eval,
-ModifierData *md_eval,
-const bool use_virtual_modifiers,
-const bool build_shapekey_layers)
- {
-   Mesh *me = ob_eval->runtime.data_orig ? (

[Bf-blender-cvs] [e58f5422c37] master: Cleanup: remove unused active name set callback functions

2022-12-15 Thread Campbell Barton
Commit: e58f5422c37762ab5b4302e7481a9ffed023913a
Author: Campbell Barton
Date:   Fri Dec 16 10:50:18 2022 +1100
Branches: master
https://developer.blender.org/rBe58f5422c37762ab5b4302e7481a9ffed023913a

Cleanup: remove unused active name set callback functions

===

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

===

diff --git a/source/blender/makesrna/intern/rna_attribute.c 
b/source/blender/makesrna/intern/rna_attribute.c
index 1fd7ce85125..efa87523204 100644
--- a/source/blender/makesrna/intern/rna_attribute.c
+++ b/source/blender/makesrna/intern/rna_attribute.c
@@ -677,18 +677,6 @@ static int 
rna_AttributeGroup_default_color_name_length(PointerRNA *ptr)
   return name ? strlen(name) : 0;
 }
 
-static void rna_AttributeGroup_default_color_name_set(PointerRNA *ptr, const 
char *value)
-{
-  ID *id = ptr->owner_id;
-  if (GS(id->name) == ID_ME) {
-Mesh *mesh = (Mesh *)id;
-MEM_SAFE_FREE(mesh->default_color_attribute);
-if (value[0]) {
-  mesh->default_color_attribute = BLI_strdup(value);
-}
-  }
-}
-
 static void rna_AttributeGroup_active_color_name_get(PointerRNA *ptr, char 
*value)
 {
   const ID *id = ptr->owner_id;
@@ -707,18 +695,6 @@ static int 
rna_AttributeGroup_active_color_name_length(PointerRNA *ptr)
   return name ? strlen(name) : 0;
 }
 
-static void rna_AttributeGroup_active_color_name_set(PointerRNA *ptr, const 
char *value)
-{
-  ID *id = ptr->owner_id;
-  if (GS(id->name) == ID_ME) {
-Mesh *mesh = (Mesh *)id;
-MEM_SAFE_FREE(mesh->default_color_attribute);
-if (value[0]) {
-  mesh->default_color_attribute = BLI_strdup(value);
-}
-  }
-}
-
 #else
 
 static void rna_def_attribute_float(BlenderRNA *brna)
@@ -1185,7 +1161,7 @@ static void rna_def_attribute_group(BlenderRNA *brna)
   RNA_def_property_string_funcs(prop,
 "rna_AttributeGroup_default_color_name_get",
 "rna_AttributeGroup_default_color_name_length",
-"rna_AttributeGroup_default_color_name_set");
+NULL);
   RNA_def_property_ui_text(
   prop,
   "Default Color Attribute",
@@ -1197,7 +1173,7 @@ static void rna_def_attribute_group(BlenderRNA *brna)
   RNA_def_property_string_funcs(prop,
 "rna_AttributeGroup_active_color_name_get",
 "rna_AttributeGroup_active_color_name_length",
-"rna_AttributeGroup_active_color_name_set");
+NULL);
   RNA_def_property_ui_text(prop,
"Active Color Attribute",
"The name of the active color attribute for display 
and editing");

___
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] [2c22795dfdc] master: Build: upgrade pre-built libraries for Linux

2022-12-15 Thread Campbell Barton
Commit: 2c22795dfdceed35b2c9d95da3f92f4ce9129025
Author: Campbell Barton
Date:   Thu Dec 15 18:09:40 2022 +1100
Branches: master
https://developer.blender.org/rB2c22795dfdceed35b2c9d95da3f92f4ce9129025

Build: upgrade pre-built libraries for Linux

Replace ../lib/linux_centos7_x86_64 with ../lib/linux_x86_64_glibc_228,
built with Rocky8 Linux, compatible with the VFX platform CY2023,
see: T99618.

- Update build-bot configuration.
- Remove unnecessary check for Blosc, this is part of OpenVDB lib now.
- Remove WITH_CXX11_ABI, always use new C++11 ABI now
- Replace centos7 by glibc_228 everywhere

Note that existing builds with cached paths pointing to
"../lib/linux_centos7_x86_64" will need to be updated.

Includes contributions by Brecht.

===

M   CMakeLists.txt
M   GNUmakefile
M   build_files/buildbot/config/blender_linux.cmake
M   build_files/cmake/platform/platform_unix.cmake
M   build_files/config/pipeline_config.yaml
M   build_files/utils/make_update.py
M   intern/cycles/kernel/CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4de2454cfd8..74bfb23a3a4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -749,11 +749,6 @@ if("${CMAKE_GENERATOR}" MATCHES "Ninja")
   mark_as_advanced(WITH_NINJA_POOL_JOBS)
 endif()
 
-if(UNIX AND NOT APPLE)
-  option(WITH_CXX11_ABI "Use native C++11 ABI of compiler" ON)
-  mark_as_advanced(WITH_CXX11_ABI)
-endif()
-
 # Installation process.
 set(POSTINSTALL_SCRIPT "" CACHE FILEPATH "Run given CMake script after 
installation process")
 mark_as_advanced(POSTINSTALL_SCRIPT)
@@ -1721,12 +1716,6 @@ if(
   string(APPEND CMAKE_C_FLAGS " -std=gnu11")
 endif()
 
-if(UNIX AND NOT APPLE)
-  if(NOT WITH_CXX11_ABI)
-string(APPEND PLATFORM_CFLAGS " -D_GLIBCXX_USE_CXX11_ABI=0")
-  endif()
-endif()
-
 if(WITH_COMPILER_SHORT_FILE_MACRO)
   # Use '-fmacro-prefix-map' for Clang and GCC (MSVC doesn't support this).
   add_check_c_compiler_flag(C_PREFIX_MAP_FLAGS C_MACRO_PREFIX_MAP 
-fmacro-prefix-map=foo=bar)
diff --git a/GNUmakefile b/GNUmakefile
index 439b435f5f4..ba9ee978817 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -211,7 +211,7 @@ endif
 # Set the LIBDIR, an empty string when not found.
 LIBDIR:=$(wildcard ../lib/${OS_NCASE}_${CPU})
 ifeq (, $(LIBDIR))
-   LIBDIR:=$(wildcard ../lib/${OS_NCASE}_centos7_${CPU})
+   LIBDIR:=$(wildcard ../lib/${OS_NCASE}_${CPU}_glibc_228)
 endif
 ifeq (, $(LIBDIR))
LIBDIR:=$(wildcard ../lib/${OS_NCASE})
diff --git a/build_files/buildbot/config/blender_linux.cmake 
b/build_files/buildbot/config/blender_linux.cmake
index 3f3695ed481..ae7849002f7 100644
--- a/build_files/buildbot/config/blender_linux.cmake
+++ b/build_files/buildbot/config/blender_linux.cmake
@@ -4,10 +4,9 @@
 
 include("${CMAKE_CURRENT_LIST_DIR}/../../cmake/config/blender_release.cmake")
 
-message(STATUS "Building in CentOS 7 64bit environment")
+message(STATUS "Building in Rocky 8 Linux 64bit environment")
 
-set(LIBDIR_NAME "linux_centos7_x86_64")
-set(WITH_CXX11_ABI   OFF CACHE BOOL "" FORCE)
+set(LIBDIR_NAME "linux_x86_64_glibc_228")
 
 #  Linux-specific build options 
 # Options which are specific to Linux-only platforms
diff --git a/build_files/cmake/platform/platform_unix.cmake 
b/build_files/cmake/platform/platform_unix.cmake
index bcc90cef7c2..cfb3ecc564b 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -10,16 +10,15 @@ if(NOT DEFINED LIBDIR)
   string(TOLOWER ${LIBDIR_NAME} LIBDIR_NAME)
   set(LIBDIR_NATIVE_ABI ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_NAME})
 
-  # Path to precompiled libraries with known CentOS 7 ABI.
-  set(LIBDIR_CENTOS7_ABI ${CMAKE_SOURCE_DIR}/../lib/linux_centos7_x86_64)
+  # Path to precompiled libraries with known glibc 2.28 ABI.
+  set(LIBDIR_GLIBC228_ABI ${CMAKE_SOURCE_DIR}/../lib/linux_x86_64_glibc_228)
 
   # Choose the best suitable libraries.
   if(EXISTS ${LIBDIR_NATIVE_ABI})
 set(LIBDIR ${LIBDIR_NATIVE_ABI})
 set(WITH_LIBC_MALLOC_HOOK_WORKAROUND True)
-  elseif(EXISTS ${LIBDIR_CENTOS7_ABI})
-set(LIBDIR ${LIBDIR_CENTOS7_ABI})
-set(WITH_CXX11_ABI OFF)
+  elseif(EXISTS ${LIBDIR_GLIBC228_ABI})
+set(LIBDIR ${LIBDIR_GLIBC228_ABI})
 if(WITH_MEM_JEMALLOC)
   # jemalloc provides malloc hooks.
   set(WITH_LIBC_MALLOC_HOOK_WORKAROUND False)
@@ -30,7 +29,7 @@ if(NOT DEFINED LIBDIR)
 
   # Avoid namespace pollustion.
   unset(LIBDIR_NATIVE_ABI)
-  unset(LIBDIR_CENTOS7_ABI)
+  unset(LIBDIR_GLIBC228_ABI)
 endif()
 
 # Support restoring this value once pre-compiled libraries have been handled.
@@ -330,10 +329,8 @@ if(WITH_OPENVDB)
   find_package(OpenVDB)
   set_and_warn_library_found("OpenVDB" OPENVDB_FOUND WITH_OPENVDB)
 
-  if(OPENVDB_FOUND)
-  add_bundled_libraries(openvdb/lib)
-  find_package_wrapper(Blosc)
-set_and_warn_library_found("Blosc"

[Bf-blender-cvs] [660e240acf6] temp-nodes-group-declarations: Basic startup works

2022-12-15 Thread Hans Goudey
Commit: 660e240acf6af8756b086effc3913bc2b65e3e79
Author: Hans Goudey
Date:   Thu Dec 15 17:43:08 2022 -0600
Branches: temp-nodes-group-declarations
https://developer.blender.org/rB660e240acf6af8756b086effc3913bc2b65e3e79

Basic startup works

===

M   source/blender/blenkernel/BKE_node_runtime.hh
M   source/blender/blenkernel/intern/node_tree_field_inferencing.cc
M   source/blender/blenkernel/intern/node_tree_update.cc
M   source/blender/nodes/NOD_node_declaration.hh
M   source/blender/nodes/geometry/nodes/node_geo_common.cc

===

diff --git a/source/blender/blenkernel/BKE_node_runtime.hh 
b/source/blender/blenkernel/BKE_node_runtime.hh
index 7f0e7f66936..a5ec387158a 100644
--- a/source/blender/blenkernel/BKE_node_runtime.hh
+++ b/source/blender/blenkernel/BKE_node_runtime.hh
@@ -324,6 +324,9 @@ inline bool topology_cache_is_available(const bNodeSocket 
&socket)
 
 namespace node_field_inferencing {
 bool update_field_inferencing(const bNodeTree &tree);
+void calculate_field_interface(const bNodeTree &tree,
+   nodes::FieldInferencingInterface &r_interface);
+
 }  // namespace node_field_inferencing
 
 }  // namespace blender::bke
diff --git a/source/blender/blenkernel/intern/node_tree_field_inferencing.cc 
b/source/blender/blenkernel/intern/node_tree_field_inferencing.cc
index b828586ba0a..2ca30286cd5 100644
--- a/source/blender/blenkernel/intern/node_tree_field_inferencing.cc
+++ b/source/blender/blenkernel/intern/node_tree_field_inferencing.cc
@@ -486,33 +486,30 @@ static void update_socket_shapes(const bNodeTree &tree,
   }
 }
 
-FieldInferencingInterface calculate_field_inferencing(const bNodeTree &tree)
+void calculate_field_interface(const bNodeTree &tree, 
FieldInferencingInterface &r_interface)
 {
-  FieldInferencingInterface interface;
-
   tree.ensure_topology_cache();
 
-  interface.inputs.resize(BLI_listbase_count(&tree.inputs), 
InputSocketFieldType::IsSupported);
-  interface.outputs.resize(BLI_listbase_count(&tree.outputs),
-   OutputFieldDependency::ForDataSource());
+  r_interface.inputs.resize(BLI_listbase_count(&tree.inputs), 
InputSocketFieldType::IsSupported);
+  r_interface.outputs.resize(BLI_listbase_count(&tree.outputs),
+ OutputFieldDependency::ForDataSource());
 
   /* Keep track of the state of all sockets. The index into this array is 
#SocketRef::id(). */
   Array field_state_by_socket_id(tree.all_sockets().size());
 
   propagate_data_requirements_from_right_to_left(tree, 
field_state_by_socket_id);
-  determine_group_input_states(tree, interface, field_state_by_socket_id);
+  determine_group_input_states(tree, r_interface, field_state_by_socket_id);
   propagate_field_status_from_left_to_right(tree, field_state_by_socket_id);
-  determine_group_output_states(tree, interface, field_state_by_socket_id);
+  determine_group_output_states(tree, r_interface, field_state_by_socket_id);
   update_socket_shapes(tree, field_state_by_socket_id);
-
-  return interface;
 }
 
 bool update_field_inferencing(const bNodeTree &tree)
 {
   /* Create new inferencing interface for this node group. */
   std::unique_ptr new_inferencing_interface =
-  
std::make_unique(calculate_field_inferencing(tree));
+  std::make_unique();
+  calculate_field_interface(tree, *new_inferencing_interface);
 
   /* Update the previous group interface. */
   const bool group_interface_changed = 
!tree.runtime->field_inferencing_interface ||
diff --git a/source/blender/blenkernel/intern/node_tree_update.cc 
b/source/blender/blenkernel/intern/node_tree_update.cc
index c818259c086..b1cae45ba45 100644
--- a/source/blender/blenkernel/intern/node_tree_update.cc
+++ b/source/blender/blenkernel/intern/node_tree_update.cc
@@ -546,12 +546,12 @@ class NodeTreeMainUpdater {
 if (ntype.updatefunc) {
   ntype.updatefunc(&ntree, node);
 }
-if (ntype.declare_dynamic) {
-  if (!node->runtime->declaration) {
-node->runtime->declaration = new blender::nodes::NodeDeclaration();
-  }
-  build_node_declaration_dynamic(ntree, *node, 
*node->runtime->declaration);
-}
+// if (ntype.declare_dynamic) {
+//   if (!node->runtime->declaration) {
+// node->runtime->declaration = new 
blender::nodes::NodeDeclaration();
+//   }
+//   build_node_declaration_dynamic(ntree, *node, 
*node->runtime->declaration);
+// }
   }
   if (ELEM(node->type, NODE_GROUP_INPUT, NODE_GROUP_OUTPUT)) {
 group_inout_nodes.append(node);
@@ -563,7 +563,12 @@ class NodeTreeMainUpdater {
  * supposed to create the new interface socket. */
 if (ntree.runtime->changed_flag & NTREE_CHANGED_INTERFACE) {
   for (bNode *node : group_inout_nodes) {
-node->typeinfo->updatefunc(&ntree, node

[Bf-blender-cvs] [f509bd37b16] temp-nodes-group-declarations: Fix build errors

2022-12-15 Thread Hans Goudey
Commit: f509bd37b166d7f46e542eb7b188927a2625a454
Author: Hans Goudey
Date:   Thu Dec 15 17:18:34 2022 -0600
Branches: temp-nodes-group-declarations
https://developer.blender.org/rBf509bd37b166d7f46e542eb7b188927a2625a454

Fix build errors

===

M   source/blender/nodes/NOD_common.h
M   source/blender/nodes/composite/nodes/node_composite_common.cc
M   source/blender/nodes/geometry/nodes/node_geo_common.cc
M   source/blender/nodes/intern/node_common.cc
M   source/blender/nodes/intern/node_socket_declarations.cc
M   source/blender/nodes/shader/nodes/node_shader_common.cc
M   source/blender/nodes/texture/nodes/node_texture_common.cc

===

diff --git a/source/blender/nodes/NOD_common.h 
b/source/blender/nodes/NOD_common.h
index c1091bf87ce..d860e60864c 100644
--- a/source/blender/nodes/NOD_common.h
+++ b/source/blender/nodes/NOD_common.h
@@ -31,7 +31,7 @@ void node_internal_links_create(struct bNodeTree *ntree, 
struct bNode *node);
 
 namespace blender::nodes {
 
-bool node_group_declare_dynamic_fn(const bNodeTree &node_tree,
+bool node_group_declare_dynamic(const bNodeTree &node_tree,
const bNode &node,
NodeDeclaration &r_declaration);
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_common.cc 
b/source/blender/nodes/composite/nodes/node_composite_common.cc
index 9088a244e49..5c3a2c87b9f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_common.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_common.cc
@@ -32,7 +32,7 @@ void register_node_type_cmp_group()
 
   node_type_size(&ntype, 140, 60, 400);
   ntype.labelfunc = node_group_label;
-  ntype.declare_dynamic = blender::nodes::node_group_declare_dynamic_fn;
+  ntype.declare_dynamic = blender::nodes::node_group_declare_dynamic;
 
   nodeRegisterType(&ntype);
 }
diff --git a/source/blender/nodes/geometry/nodes/node_geo_common.cc 
b/source/blender/nodes/geometry/nodes/node_geo_common.cc
index 4f490d3d1e1..2c819172efe 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_common.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_common.cc
@@ -3,6 +3,7 @@
 #include "BKE_node.h"
 
 #include "NOD_geometry.h"
+#include "NOD_node_declaration.hh"
 
 #include "NOD_common.h"
 #include "node_common.h"
@@ -10,16 +11,25 @@
 
 namespace blender::nodes {
 
-static void node_declare(const bNodeTree &node_tree,
+static bool node_declare(const bNodeTree &node_tree,
  const bNode &node,
  NodeDeclaration &r_declaration)
 {
-  if (!node.id) {
-return;
+  if (!node_group_declare_dynamic(node_tree, node, r_declaration)) {
+return false;
   }
 
-  blender::nodes::node_group_declare_dynamic_fn(node_tree, node, 
r_declaration);
-  FieldInferencingInterface field_interface = calculate_field_inferencing()
+  const bNodeTree &group = reinterpret_cast(*node.id);
+  const FieldInferencingInterface field_interface = 
field_inferencing::calculate_field_inferencing(
+  group);
+  for (const int i : r_declaration.inputs_.index_range()) {
+r_declaration.inputs_[i]->input_field_type_ = field_interface.inputs[i];
+  }
+  for (const int i : r_declaration.outputs_.index_range()) {
+r_declaration.outputs_[i]->output_field_dependency_ = 
field_interface.outputs[i];
+  }
+
+  return true;
 }
 
 }  // namespace blender::nodes
diff --git a/source/blender/nodes/intern/node_common.cc 
b/source/blender/nodes/intern/node_common.cc
index 8d36ca6c0b0..e1164515634 100644
--- a/source/blender/nodes/intern/node_common.cc
+++ b/source/blender/nodes/intern/node_common.cc
@@ -204,31 +204,30 @@ static SocketDeclarationPtr 
declataion_for_interface_socket(const bNodeSocket &i
   dst->identifier_ = io_socket.identifier;
   dst->in_out_ = eNodeSocketInOut(io_socket.in_out);
   dst->description_ = io_socket.description;
+  dst->hide_value_ = io_socket.flag & SOCK_HIDE_VALUE;
+  return dst;
 }
 
-bool node_group_declare_dynamic_fn(const bNodeTree & /*node_tree*/,
-   const bNode &node,
-   NodeDeclaration &r_declaration)
+bool node_group_declare_dynamic(const bNodeTree & /*node_tree*/,
+const bNode &node,
+NodeDeclaration &r_declaration)
 {
-  if (!node.id) {
+  const bNodeTree *group = reinterpret_cast(node.id);
+  if (!group) {
 return false;
   }
-  else if (ID_IS_LINKED(node.id) && (node.id->tag & LIB_TAG_MISSING)) {
+  if (ID_IS_LINKED(&group->id) && (group->id.tag & LIB_TAG_MISSING)) {
 /* TODO: Restore the behavior that keeps the sockets until the ID is 
found. */
 return false;
   }
-  const bNodeTree &group = *reinterpret_cast(node.id);
-
-  Vector inputs;
-  Vector outputs;
 
   /* TODO: Specialize for geometry nodes and fields. */
  

[Bf-blender-cvs] [542bff5e940] temp-nodes-group-declarations: Declarations for group input and output nodes

2022-12-15 Thread Hans Goudey
Commit: 542bff5e9409330747fa69f4da8b0bbffef8b470
Author: Hans Goudey
Date:   Thu Dec 15 16:44:08 2022 -0600
Branches: temp-nodes-group-declarations
https://developer.blender.org/rB542bff5e9409330747fa69f4da8b0bbffef8b470

Declarations for group input and output nodes

===

M   source/blender/blenkernel/intern/node_tree_update.cc
M   source/blender/nodes/NOD_node_declaration.hh
M   source/blender/nodes/intern/node_common.cc

===

diff --git a/source/blender/blenkernel/intern/node_tree_update.cc 
b/source/blender/blenkernel/intern/node_tree_update.cc
index 3cec5e4a5fe..c818259c086 100644
--- a/source/blender/blenkernel/intern/node_tree_update.cc
+++ b/source/blender/blenkernel/intern/node_tree_update.cc
@@ -540,6 +540,9 @@ class NodeTreeMainUpdater {
   nodeDeclarationEnsure(&ntree, node);
   if (this->should_update_individual_node(ntree, *node)) {
 bNodeType &ntype = *node->typeinfo;
+if (ntype.group_update_func) {
+  ntype.group_update_func(&ntree, node);
+}
 if (ntype.updatefunc) {
   ntype.updatefunc(&ntree, node);
 }
@@ -549,9 +552,6 @@ class NodeTreeMainUpdater {
   }
   build_node_declaration_dynamic(ntree, *node, 
*node->runtime->declaration);
 }
-if (ntype.group_update_func) {
-  ntype.group_update_func(&ntree, node);
-}
   }
   if (ELEM(node->type, NODE_GROUP_INPUT, NODE_GROUP_OUTPUT)) {
 group_inout_nodes.append(node);
diff --git a/source/blender/nodes/NOD_node_declaration.hh 
b/source/blender/nodes/NOD_node_declaration.hh
index 4b7f09f8ed5..9c0f9c5bab2 100644
--- a/source/blender/nodes/NOD_node_declaration.hh
+++ b/source/blender/nodes/NOD_node_declaration.hh
@@ -308,7 +308,7 @@ class SocketDeclarationBuilder : public 
BaseSocketDeclarationBuilder {
 using SocketDeclarationPtr = std::unique_ptr;
 
 class NodeDeclaration {
- private:
+ public:
   Vector inputs_;
   Vector outputs_;
 
diff --git a/source/blender/nodes/intern/node_common.cc 
b/source/blender/nodes/intern/node_common.cc
index 6484aa28a24..8d36ca6c0b0 100644
--- a/source/blender/nodes/intern/node_common.cc
+++ b/source/blender/nodes/intern/node_common.cc
@@ -231,13 +231,6 @@ bool node_group_declare_dynamic_fn(const bNodeTree & 
/*node_tree*/,
 outputs.append(declataion_for_interface_socket(*output));
   }
 
-  if (!ID_IS_LINKED(node.id)) {
-/* TODO: The if statement is a fun possibility, but maybe not worth it 
right now? */
-std::make_unique();
-b.add_input("__extend__");
-b.add_output("__extend__");
-  }
-
   return true;
 }
 
@@ -434,6 +427,45 @@ bNodeSocket *node_group_input_find_socket(bNode *node, 
const char *identifier)
   return nullptr;
 }
 
+namespace blender::nodes {
+
+static SocketDeclarationPtr extend_declaration(const eNodeSocketInOut in_out)
+{
+  std::unique_ptr decl = std::make_unique();
+  decl->name_ = "";
+  decl->identifier_ = "__extend__";
+  decl->in_out_ = in_out;
+  return decl;
+}
+
+static bool group_input_declare_dynamic_fn(const bNodeTree &node_tree,
+   const bNode &node,
+   NodeDeclaration &r_declaration)
+{
+  LISTBASE_FOREACH (const bNodeSocket *, input, &node_tree.inputs) {
+r_declaration.outputs_.append(declataion_for_interface_socket(*input));
+r_declaration.outputs_.last()->in_out_ = SOCK_OUT;
+  }
+  if (!ID_IS_LINKED(&node_tree.id)) {
+r_declaration.outputs_.append(extend_declaration(SOCK_OUT));
+  }
+}
+
+static bool group_output_declare_dynamic_fn(const bNodeTree &node_tree,
+const bNode &node,
+NodeDeclaration &r_declaration)
+{
+  LISTBASE_FOREACH (const bNodeSocket *, input, &node_tree.inputs) {
+r_declaration.inputs_.append(declataion_for_interface_socket(*input));
+r_declaration.inputs_.last()->in_out_ = SOCK_OUT;
+  }
+  if (!ID_IS_LINKED(&node_tree.id)) {
+r_declaration.inputs_.append(extend_declaration(SOCK_OUT));
+  }
+}
+
+}  // namespace blender::nodes
+
 void register_node_type_group_input()
 {
   /* used for all tree types, needs dynamic allocation */
@@ -443,7 +475,7 @@ void register_node_type_group_input()
   node_type_base(ntype, NODE_GROUP_INPUT, "Group Input", NODE_CLASS_INTERFACE);
   node_type_size(ntype, 140, 80, 400);
   /* TODO: Update declaration when linking to the extension sockets. */
-  // ntype->declare_dynamic =
+  ntype->declare_dynamic = blender::nodes::group_input_declare_dynamic_fn;
 
   nodeRegisterType(ntype);
 }

___
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] [d82166833a0] temp-nodes-group-declarations: Merge branch 'master' into temp-nodes-group-declarations

2022-12-15 Thread Hans Goudey
Commit: d82166833a0afaf570653271f0d3fa54df737f7a
Author: Hans Goudey
Date:   Thu Dec 15 16:22:26 2022 -0600
Branches: temp-nodes-group-declarations
https://developer.blender.org/rBd82166833a0afaf570653271f0d3fa54df737f7a

Merge branch 'master' into temp-nodes-group-declarations

===



===



___
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] [64297ec8add] temp-nodes-group-declarations: Cleanup

2022-12-15 Thread Hans Goudey
Commit: 64297ec8add4cf821649e373dd943265b47062e2
Author: Hans Goudey
Date:   Thu Dec 15 16:17:16 2022 -0600
Branches: temp-nodes-group-declarations
https://developer.blender.org/rB64297ec8add4cf821649e373dd943265b47062e2

Cleanup

===

M   source/blender/nodes/NOD_node_declaration.hh
M   source/blender/nodes/NOD_socket_declarations.hh
M   source/blender/nodes/intern/node_common.cc

===

diff --git a/source/blender/nodes/NOD_node_declaration.hh 
b/source/blender/nodes/NOD_node_declaration.hh
index 6c34506e661..4b7f09f8ed5 100644
--- a/source/blender/nodes/NOD_node_declaration.hh
+++ b/source/blender/nodes/NOD_node_declaration.hh
@@ -72,10 +72,11 @@ using ImplicitInputValueFn = std::function {
 class VectorBuilder;
 
 class Vector : public SocketDeclaration {
+ public:
   float3 default_value_ = {0, 0, 0};
   float soft_min_value_ = -FLT_MAX;
   float soft_max_value_ = FLT_MAX;
@@ -101,6 +102,7 @@ class VectorBuilder : public 
SocketDeclarationBuilder {
 class BoolBuilder;
 
 class Bool : public SocketDeclaration {
+ public:
   bool default_value_ = false;
 
  private:
@@ -122,6 +124,7 @@ class BoolBuilder : public SocketDeclarationBuilder {
 class ColorBuilder;
 
 class Color : public SocketDeclaration {
+ public:
   ColorGeometry4f default_value_;
 
  private:
@@ -143,6 +146,7 @@ class ColorBuilder : public SocketDeclarationBuilder 
{
 class StringBuilder;
 
 class String : public SocketDeclaration {
+ public:
   std::string default_value_;
 
  private:
diff --git a/source/blender/nodes/intern/node_common.cc 
b/source/blender/nodes/intern/node_common.cc
index 6dcdbcfe1eb..6484aa28a24 100644
--- a/source/blender/nodes/intern/node_common.cc
+++ b/source/blender/nodes/intern/node_common.cc
@@ -123,17 +123,98 @@ bool nodeGroupPoll(const bNodeTree *nodetree,
 
 namespace blender::nodes {
 
+static SocketDeclarationPtr declataion_for_interface_socket(const bNodeSocket 
&io_socket)
+{
+  SocketDeclarationPtr dst;
+  switch (io_socket.type) {
+case SOCK_FLOAT: {
+  const auto &value = 
*io_socket.default_value_typed();
+  std::unique_ptr decl = std::make_unique();
+  decl->default_value_ = value.value;
+  decl->soft_min_value_ = value.min;
+  decl->soft_max_value_ = value.max;
+  dst = std::move(decl);
+  break;
+}
+case SOCK_VECTOR: {
+  const auto &value = 
*io_socket.default_value_typed();
+  std::unique_ptr decl = std::make_unique();
+  decl->default_value_ = value.value;
+  decl->soft_min_value_ = value.min;
+  decl->soft_max_value_ = value.max;
+  dst = std::move(decl);
+  break;
+}
+case SOCK_RGBA: {
+  const auto &value = 
*io_socket.default_value_typed();
+  std::unique_ptr decl = std::make_unique();
+  decl->default_value_ = value.value;
+  dst = std::move(decl);
+  break;
+}
+case SOCK_SHADER: {
+  std::unique_ptr decl = std::make_unique();
+  dst = std::move(decl);
+  break;
+}
+case SOCK_BOOLEAN: {
+  const auto &value = 
*io_socket.default_value_typed();
+  std::unique_ptr decl = std::make_unique();
+  decl->default_value_ = value.value;
+  dst = std::move(decl);
+  break;
+}
+case SOCK_INT: {
+  const auto &value = 
*io_socket.default_value_typed();
+  std::unique_ptr decl = std::make_unique();
+  decl->default_value_ = value.value;
+  decl->soft_min_value_ = value.min;
+  decl->soft_max_value_ = value.max;
+  dst = std::move(decl);
+  break;
+}
+case SOCK_STRING: {
+  const auto &value = 
*io_socket.default_value_typed();
+  std::unique_ptr decl = std::make_unique();
+  decl->default_value_ = value.value;
+  dst = std::move(decl);
+  break;
+}
+case SOCK_OBJECT:
+  /* TODO: What happens to default values of data-block sockets? */
+  dst = std::make_unique();
+  break;
+case SOCK_IMAGE:
+  dst = std::make_unique();
+  break;
+case SOCK_GEOMETRY:
+  dst = std::make_unique();
+  break;
+case SOCK_COLLECTION:
+  dst = std::make_unique();
+  break;
+case SOCK_TEXTURE:
+  dst = std::make_unique();
+  break;
+case SOCK_MATERIAL:
+  dst = std::make_unique();
+  break;
+  }
+  dst->name_ = io_socket.name;
+  dst->identifier_ = io_socket.identifier;
+  dst->in_out_ = eNodeSocketInOut(io_socket.in_out);
+  dst->description_ = io_socket.description;
+}
+
 bool node_group_declare_dynamic_fn(const bNodeTree & /*node_tree*/,
const bNode &node,
NodeDeclaration &r_declaration)
 {
-  /* TODO: Restore this behavior somehow:
-   * Missing data-block, leave sockets unchanged so that when it comes back
-   * the links remain valid. */
   if (!node.id) {
 return false;
   }
   else if (ID_IS_LINKED(node.id) && (node.id->tag & 

[Bf-blender-cvs] [510155ed5c1] temp-nodes-group-declarations: Merge branch 'master' into temp-nodes-group-declarations

2022-12-15 Thread Hans Goudey
Commit: 510155ed5c1a3e3fddf4a3bd91a9352a3cf9d2ca
Author: Hans Goudey
Date:   Thu Dec 15 15:06:34 2022 -0600
Branches: temp-nodes-group-declarations
https://developer.blender.org/rB510155ed5c1a3e3fddf4a3bd91a9352a3cf9d2ca

Merge branch 'master' into temp-nodes-group-declarations

===



===



___
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] [2a09cc6d5e9] refactor-mesh-uv-map-generic: Don't shift with a value larger than the type.

2022-12-15 Thread Baardaap
Commit: 2a09cc6d5e9de746efd5783b8ebf1002a2792e04
Author: Baardaap
Date:   Thu Dec 15 23:02:47 2022 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB2a09cc6d5e9de746efd5783b8ebf1002a2792e04

Don't shift with a value larger than the type.

When comparing customdata layers a flag was created from the type
by leftshifting a 1 by the type value. Because there are more than
32 types this needs to be a 64 bit value.

This fix was already in master, but mistakenly not merged.

===

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

===

diff --git a/source/blender/blenkernel/intern/mesh.cc 
b/source/blender/blenkernel/intern/mesh.cc
index ea8e896b118..dd324b6fa48 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -750,7 +750,7 @@ static int customdata_compare(
   }
 }
 if (!found_corresponding_layer) {
-  if ((1 << l1->type) & CD_MASK_PROP_ALL) {
+  if ((uint64_t(1) << l1->type) & CD_MASK_PROP_ALL) {
 return MESHCMP_CDLAYERS_MISMATCH;
   }
 }

___
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] [a773967bc78] refactor-mesh-uv-map-generic: Skip the UVMap bool sublayers in customdata comparisons

2022-12-15 Thread Baardaap
Commit: a773967bc785141d10da2581a899ec3f7fd45c48
Author: Baardaap
Date:   Thu Dec 15 23:00:50 2022 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rBa773967bc785141d10da2581a899ec3f7fd45c48

Skip the UVMap bool sublayers in customdata comparisons

===

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

===

diff --git a/source/blender/blenkernel/intern/mesh.cc 
b/source/blender/blenkernel/intern/mesh.cc
index 20c6f3e4586..ea8e896b118 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -467,6 +467,33 @@ static const char *cmpcode_to_str(int code)
   }
 }
 
+static bool is_sublayer_name(char const *sublayer_name, char const *name)
+{
+  BLI_assert(strlen(sublayer_name) == 2);
+  if (name[1] != sublayer_name[0]) {
+return false;
+  }
+  if (name[2] != sublayer_name[1]) {
+return false;
+  }
+  if (name[3] != '.') {
+return false;
+  }
+  return true;
+}
+
+static bool is_uv_bool_sublayer(CustomDataLayer const *l)
+{
+  char const *name = l->name;
+
+  if (name[0] != '.') {
+return false;
+  }
+
+  return is_sublayer_name(UV_VERTSEL_NAME, name) || 
is_sublayer_name(UV_EDGESEL_NAME, name) ||
+ is_sublayer_name(UV_PINNED_NAME, name);
+}
+
 /** Thresh is threshold for comparing vertices, UV's, vertex colors, weights, 
etc. */
 static int customdata_compare(
 CustomData *c1, CustomData *c2, const int total_length, Mesh *m1, Mesh 
*m2, const float thresh)
@@ -479,25 +506,23 @@ static int customdata_compare(
   const Span loops_1 = m1->loops();
   const Span loops_2 = m2->loops();
 
+  /* TODO(@Baardaap) the uv selection / pin layers are ignored in the 
comparisons because
+   * the original flags they replace were ignored as well. For completeness it 
would be
+   * better to compare them as well, but some test files would need to be 
updated. */
+
   for (int i = 0; i < c1->totlayer; i++) {
 l1 = &c1->layers[i];
-if ((CD_TYPE_AS_MASK(l1->type) & cd_mask_all_attr) && l1->anonymous_id == 
nullptr) {
-  /* TODO(@Baardaap): This if statement is only added to be able to use 
the old test files
-   * in the tests. It should be removed once the test file is updated. */
-  if (l1->name[0] != '.') {
-layer_count1++;
-  }
+if ((CD_TYPE_AS_MASK(l1->type) & cd_mask_all_attr) && l1->anonymous_id == 
nullptr &&
+!is_uv_bool_sublayer(l1)) {
+  layer_count1++;
 }
   }
 
   for (int i = 0; i < c2->totlayer; i++) {
 l2 = &c2->layers[i];
-if ((CD_TYPE_AS_MASK(l2->type) & cd_mask_all_attr) && l2->anonymous_id == 
nullptr) {
-  /* TODO(@Baardaap): This if statement is only added to be able to use 
the old test files
-   * in the tests. It should be removed once the test file is updated. */
-  if (l2->name[0] != '.') {
-layer_count2++;
-  }
+if ((CD_TYPE_AS_MASK(l2->type) & cd_mask_all_attr) && l2->anonymous_id == 
nullptr &&
+!is_uv_bool_sublayer(l2)) {
+  layer_count2++;
 }
   }
 
@@ -512,7 +537,7 @@ static int customdata_compare(
 
   for (int i1 = 0; i1 < c1->totlayer; i1++) {
 l1 = c1->layers + i1;
-if (l1->anonymous_id != nullptr) {
+if (l1->anonymous_id != nullptr || is_uv_bool_sublayer(l1)) {
   continue;
 }
 bool found_corresponding_layer = false;

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


[Bf-blender-cvs] [b32b4eb6031] refactor-mesh-uv-map-generic: Fix: make format

2022-12-15 Thread Baardaap
Commit: b32b4eb60319711460fcdc2873d5391f71e3058b
Author: Baardaap
Date:   Thu Dec 15 23:06:09 2022 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rBb32b4eb60319711460fcdc2873d5391f71e3058b

Fix: make format

===

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

===

diff --git a/source/blender/blenkernel/intern/mesh_convert.cc 
b/source/blender/blenkernel/intern/mesh_convert.cc
index ee5300e9007..fdd2ecc5d5a 100644
--- a/source/blender/blenkernel/intern/mesh_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_convert.cc
@@ -1102,7 +1102,6 @@ Mesh *BKE_mesh_new_from_object_to_bmain(Main *bmain,
   return mesh_in_bmain;
 }
 
-
 static KeyBlock *keyblock_ensure_from_uid(Key &key, const int uid, const 
StringRefNull name)
 {
   if (KeyBlock *kb = BKE_keyblock_find_uid(&key, uid)) {

___
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] [14a455fa9dd] refactor-mesh-uv-map-generic: Fix mistake in assert.

2022-12-15 Thread Baardaap
Commit: 14a455fa9dd1d527986198c7512abe72304bc727
Author: Baardaap
Date:   Thu Dec 15 22:59:44 2022 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB14a455fa9dd1d527986198c7512abe72304bc727

Fix mistake in assert.

===

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

===

diff --git a/source/blender/blenkernel/intern/attribute.cc 
b/source/blender/blenkernel/intern/attribute.cc
index 3fc93f981d7..966a3b82385 100644
--- a/source/blender/blenkernel/intern/attribute.cc
+++ b/source/blender/blenkernel/intern/attribute.cc
@@ -825,7 +825,7 @@ char const *BKE_get_uv_map_vert_selection_name(char const 
*uv_map_name, char *bu
 
 char const *BKE_get_uv_map_edge_selection_name(char const *uv_map_name, char 
*buffer)
 {
-  BLI_assert(strlen(UV_VERTSEL_NAME) == 2);
+  BLI_assert(strlen(UV_EDGESEL_NAME) == 2);
   BLI_assert(strlen(uv_map_name) < MAX_CUSTOMDATA_LAYER_NAME - 5);
   BLI_snprintf(buffer, MAX_CUSTOMDATA_LAYER_NAME, ".%s.%s", UV_EDGESEL_NAME, 
uv_map_name);
   return buffer;
@@ -833,7 +833,7 @@ char const *BKE_get_uv_map_edge_selection_name(char const 
*uv_map_name, char *bu
 
 char const *BKE_get_uv_map_pin_name(char const *uv_map_name, char *buffer)
 {
-  BLI_assert(strlen(UV_VERTSEL_NAME) == 2);
+  BLI_assert(strlen(UV_PINNED_NAME) == 2);
   BLI_assert(strlen(uv_map_name) < MAX_CUSTOMDATA_LAYER_NAME - 5);
   BLI_snprintf(buffer, MAX_CUSTOMDATA_LAYER_NAME, ".%s.%s", UV_PINNED_NAME, 
uv_map_name);
   return 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] [fd3943dbd5d] blender-v3.4-release: Fix T103049: Cycles specular light leak regression

2022-12-15 Thread Brecht Van Lommel
Commit: fd3943dbd5d95ec5d5dda24acf7646796280997f
Author: Brecht Van Lommel
Date:   Thu Dec 15 21:29:56 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rBfd3943dbd5d95ec5d5dda24acf7646796280997f

Fix T103049: Cycles specular light leak regression

The logic here is not ideal but was unintentionally changed in refactoring
for path guiding, now restore it back to 3.3 behavior again.

===

M   intern/cycles/kernel/closure/bsdf.h
M   intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
M   intern/cycles/kernel/closure/bsdf_microfacet.h
M   intern/cycles/kernel/closure/bsdf_microfacet_multi.h

===

diff --git a/intern/cycles/kernel/closure/bsdf.h 
b/intern/cycles/kernel/closure/bsdf.h
index 71af68aa80e..10948d56b4b 100644
--- a/intern/cycles/kernel/closure/bsdf.h
+++ b/intern/cycles/kernel/closure/bsdf.h
@@ -578,11 +578,11 @@ ccl_device_inline
 case CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID:
 case CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID:
 case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
-  eval = bsdf_microfacet_ggx_eval(sc, sd->I, omega_in, pdf);
+  eval = bsdf_microfacet_ggx_eval(sc, sd->N, sd->I, omega_in, pdf);
   break;
 case CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID:
 case CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID:
-  eval = bsdf_microfacet_multi_ggx_eval(sc, sd->I, omega_in, pdf, 
&sd->lcg_state);
+  eval = bsdf_microfacet_multi_ggx_eval(sc, sd->N, sd->I, omega_in, pdf, 
&sd->lcg_state);
   break;
 case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID:
 case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID:
@@ -590,10 +590,10 @@ ccl_device_inline
   break;
 case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
 case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
-  eval = bsdf_microfacet_beckmann_eval(sc, sd->I, omega_in, pdf);
+  eval = bsdf_microfacet_beckmann_eval(sc, sd->N, sd->I, omega_in, pdf);
   break;
 case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID:
-  eval = bsdf_ashikhmin_shirley_eval(sc, sd->I, omega_in, pdf);
+  eval = bsdf_ashikhmin_shirley_eval(sc, sd->N, sd->I, omega_in, pdf);
   break;
 case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
   eval = bsdf_ashikhmin_velvet_eval(sc, sd->I, omega_in, pdf);
diff --git a/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h 
b/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
index 14a4094d485..db02dad3909 100644
--- a/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
+++ b/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
@@ -40,11 +40,13 @@ ccl_device_inline float 
bsdf_ashikhmin_shirley_roughness_to_exponent(float rough
 }
 
 ccl_device_forceinline Spectrum bsdf_ashikhmin_shirley_eval(ccl_private const 
ShaderClosure *sc,
+const float3 Ng,
 const float3 I,
 const float3 
omega_in,
 ccl_private float 
*pdf)
 {
   ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf 
*)sc;
+  const float cosNgI = dot(Ng, omega_in);
   float3 N = bsdf->N;
 
   float NdotI = dot(N, I);/* in Cycles/OSL convention I is omega_out */
@@ -52,7 +54,8 @@ 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 || !(NdotI > 0.0f && NdotO 
> 0.0f)) {
+  if ((cosNgI < 0.0f) || fmaxf(bsdf->alpha_x, bsdf->alpha_y) <= 1e-4f ||
+  !(NdotI > 0.0f && NdotO > 0.0f)) {
 *pdf = 0.0f;
 return zero_spectrum();
   }
@@ -210,7 +213,7 @@ ccl_device int bsdf_ashikhmin_shirley_sample(ccl_private 
const ShaderClosure *sc
   }
   else {
 /* leave the rest to eval */
-*eval = bsdf_ashikhmin_shirley_eval(sc, I, *omega_in, pdf);
+*eval = bsdf_ashikhmin_shirley_eval(sc, N, I, *omega_in, pdf);
   }
 
   return label;
diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h 
b/intern/cycles/kernel/closure/bsdf_microfacet.h
index 4eb7cd5df22..c4a49182c35 100644
--- a/intern/cycles/kernel/closure/bsdf_microfacet.h
+++ b/intern/cycles/kernel/closure/bsdf_microfacet.h
@@ -517,27 +517,30 @@ ccl_device Spectrum 
bsdf_microfacet_ggx_eval_transmit(ccl_private const Microfac
 }
 
 ccl_device Spectrum bsdf_microfacet_ggx_eval(ccl_private const ShaderClosure 
*sc,
+ const float3 Ng,
  const float3 I,
  const float3 omega_in,
  ccl_private float *pdf)
 {
   ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf 
*)sc;
+  const bool m_refractive = bsdf->type == 
CLOSURE_BSDF_MICROFACET_GGX_R

[Bf-blender-cvs] [3d29bbcc387] master: Fix T103049: Cycles specular light leak regression

2022-12-15 Thread Brecht Van Lommel
Commit: 3d29bbcc387feea063b48ce747668d1143f312f7
Author: Brecht Van Lommel
Date:   Thu Dec 15 21:29:56 2022 +0100
Branches: master
https://developer.blender.org/rB3d29bbcc387feea063b48ce747668d1143f312f7

Fix T103049: Cycles specular light leak regression

The logic here is not ideal but was unintentionally changed in refactoring
for path guiding, now restore it back to 3.3 behavior again.

===

M   intern/cycles/kernel/closure/bsdf.h
M   intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
M   intern/cycles/kernel/closure/bsdf_microfacet.h
M   intern/cycles/kernel/closure/bsdf_microfacet_multi.h

===

diff --git a/intern/cycles/kernel/closure/bsdf.h 
b/intern/cycles/kernel/closure/bsdf.h
index 2f5c5d7bd0c..6de645cd1fe 100644
--- a/intern/cycles/kernel/closure/bsdf.h
+++ b/intern/cycles/kernel/closure/bsdf.h
@@ -580,11 +580,11 @@ ccl_device_inline
 case CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID:
 case CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID:
 case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
-  eval = bsdf_microfacet_ggx_eval(sc, sd->I, omega_in, pdf);
+  eval = bsdf_microfacet_ggx_eval(sc, sd->N, sd->I, omega_in, pdf);
   break;
 case CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID:
 case CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID:
-  eval = bsdf_microfacet_multi_ggx_eval(sc, sd->I, omega_in, pdf, 
&sd->lcg_state);
+  eval = bsdf_microfacet_multi_ggx_eval(sc, sd->N, sd->I, omega_in, pdf, 
&sd->lcg_state);
   break;
 case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID:
 case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID:
@@ -592,10 +592,10 @@ ccl_device_inline
   break;
 case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
 case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
-  eval = bsdf_microfacet_beckmann_eval(sc, sd->I, omega_in, pdf);
+  eval = bsdf_microfacet_beckmann_eval(sc, sd->N, sd->I, omega_in, pdf);
   break;
 case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID:
-  eval = bsdf_ashikhmin_shirley_eval(sc, sd->I, omega_in, pdf);
+  eval = bsdf_ashikhmin_shirley_eval(sc, sd->N, sd->I, omega_in, pdf);
   break;
 case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
   eval = bsdf_ashikhmin_velvet_eval(sc, sd->I, omega_in, pdf);
diff --git a/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h 
b/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
index 14a4094d485..db02dad3909 100644
--- a/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
+++ b/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
@@ -40,11 +40,13 @@ ccl_device_inline float 
bsdf_ashikhmin_shirley_roughness_to_exponent(float rough
 }
 
 ccl_device_forceinline Spectrum bsdf_ashikhmin_shirley_eval(ccl_private const 
ShaderClosure *sc,
+const float3 Ng,
 const float3 I,
 const float3 
omega_in,
 ccl_private float 
*pdf)
 {
   ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf 
*)sc;
+  const float cosNgI = dot(Ng, omega_in);
   float3 N = bsdf->N;
 
   float NdotI = dot(N, I);/* in Cycles/OSL convention I is omega_out */
@@ -52,7 +54,8 @@ 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 || !(NdotI > 0.0f && NdotO 
> 0.0f)) {
+  if ((cosNgI < 0.0f) || fmaxf(bsdf->alpha_x, bsdf->alpha_y) <= 1e-4f ||
+  !(NdotI > 0.0f && NdotO > 0.0f)) {
 *pdf = 0.0f;
 return zero_spectrum();
   }
@@ -210,7 +213,7 @@ ccl_device int bsdf_ashikhmin_shirley_sample(ccl_private 
const ShaderClosure *sc
   }
   else {
 /* leave the rest to eval */
-*eval = bsdf_ashikhmin_shirley_eval(sc, I, *omega_in, pdf);
+*eval = bsdf_ashikhmin_shirley_eval(sc, N, I, *omega_in, pdf);
   }
 
   return label;
diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h 
b/intern/cycles/kernel/closure/bsdf_microfacet.h
index 39d0fb8f5f5..dcd55dc9bd7 100644
--- a/intern/cycles/kernel/closure/bsdf_microfacet.h
+++ b/intern/cycles/kernel/closure/bsdf_microfacet.h
@@ -517,27 +517,30 @@ ccl_device Spectrum 
bsdf_microfacet_ggx_eval_transmit(ccl_private const Microfac
 }
 
 ccl_device Spectrum bsdf_microfacet_ggx_eval(ccl_private const ShaderClosure 
*sc,
+ const float3 Ng,
  const float3 I,
  const float3 omega_in,
  ccl_private float *pdf)
 {
   ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf 
*)sc;
+  const bool m_refractive = bsdf->type == 
CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;

[Bf-blender-cvs] [6514bb05ea5] master: Mesh: Store active & default color attributes with strings

2022-12-15 Thread Hans Goudey
Commit: 6514bb05ea5a138d897151db02cb0bad9fe01968
Author: Hans Goudey
Date:   Thu Dec 15 14:18:57 2022 -0600
Branches: master
https://developer.blender.org/rB6514bb05ea5a138d897151db02cb0bad9fe01968

Mesh: Store active & default color attributes with strings

Attributes are unifying around a name-based API, and we would like to
be able to move away from CustomData in the future. This patch moves
the identification of active and fallback (render) color attributes
to strings on the mesh from flags on CustomDataLayer. This also
removes some ugliness used to retrieve these attributes and maintain
the active status.

The design is described more here: T98366

The patch keeps forward compatibility working until 4.0 with
the same method as the mesh struct of array refactors (T95965).

The strings are allowed to not correspond to an attribute, to allow
setting the active/default attribute independently of actually filling
its data. When applying a modifier, if the strings don't match an
attribute, they will be removed.

The realize instances / join node and join operator take the names from
the first / active input mesh. While other heuristics may be helpful
(and could be a future improvement), just using the first is simple
and predictable.

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

===

M   source/blender/blenkernel/BKE_attribute.h
M   source/blender/blenkernel/BKE_mesh_legacy_convert.h
M   source/blender/blenkernel/intern/attribute.cc
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_300.cc
M   source/blender/blenloader/intern/versioning_400.cc
M   source/blender/draw/DRW_pbvh.h
M   source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc
M   source/blender/draw/intern/draw_cache_impl_mesh.cc
M   source/blender/draw/intern/draw_cache_impl_particles.c
M   source/blender/draw/intern/draw_manager_data.cc
M   source/blender/draw/intern/draw_pbvh.cc
M   source/blender/editors/geometry/geometry_attributes.cc
M   source/blender/editors/mesh/mesh_data.cc
M   source/blender/editors/object/object_bake_api.c
M   source/blender/editors/object/object_modifier.cc
M   source/blender/editors/sculpt_paint/paint_image_proj.cc
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/sculpt.cc
M   source/blender/editors/sculpt_paint/sculpt_undo.c
M   
source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
M   source/blender/geometry/intern/realize_instances.cc
M   source/blender/gpu/intern/gpu_shader_builder_stubs.cc
M   source/blender/io/collada/MeshImporter.cpp
M   source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
M   source/blender/io/wavefront_obj/importer/obj_import_mesh.cc
M   source/blender/makesdna/DNA_customdata_types.h
M   source/blender/makesdna/DNA_mesh_types.h
M   source/blender/makesrna/intern/rna_attribute.c
M   source/blender/makesrna/intern/rna_material.c
M   source/blender/makesrna/intern/rna_mesh.c

===

diff --git a/source/blender/blenkernel/BKE_attribute.h 
b/source/blender/blenkernel/BKE_attribute.h
index 3f4981993eb..eef1459be81 100644
--- a/source/blender/blenkernel/BKE_attribute.h
+++ b/source/blender/blenkernel/BKE_attribute.h
@@ -105,16 +105,6 @@ int BKE_id_attribute_to_index(const struct ID *id,
   eAttrDomainMask domain_mask,
   eCustomDataMask layer_mask);
 
-struct CustomDataLayer *BKE_id_attribute_subset_active_get(const struct ID *id,
-   int active_flag,
-   eAttrDomainMask 
domain_mask,
-   eCustomDataMask 
mask);
-void BKE_id_attribute_subset_active_set(struct ID *id,
-struct CustomDataLayer *layer,
-int active_flag,
-eAttrDomainMask domain_mask,
-eCustomDataMask mask);
-
 /**
  * Sets up a temporary ID with arbitrary CustomData domains. `r_id` will
  * be zero initialized with ID type id_type and any non-nullptr
@@ -130,10 +120,13 @@ void BKE_id_attribute_copy_domains_temp(short id_type,
 const struct CustomData *cdata,
 

[Bf-blender-cvs] [ae886596a0f] master: Nodes: Allow skipping node attachment after dragging

2022-12-15 Thread Hans Goudey
Commit: ae886596a0f1a22037232eabe4ae0cde171951c6
Author: Hans Goudey
Date:   Thu Dec 15 14:03:28 2022 -0600
Branches: master
https://developer.blender.org/rBae886596a0f1a22037232eabe4ae0cde171951c6

Nodes: Allow skipping node attachment after dragging

This patch allows skipping the automatic insertion of nodes on top of
links when the transform operator ends. When putting nodes into small
spaces this often gets in the way and wastes time. Now, when holding
`alt`, this is turned off.

The header text is also improved to add this shortcut and to remove
the Dx and Dy values and improve the formatting a bit.

Making this functionality optional might allow us to use it in more
places in the future, like for the nodes added by link-drag-search.

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

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   
release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
M   source/blender/editors/transform/transform.c
M   source/blender/editors/transform/transform.h
M   source/blender/editors/transform/transform_convert_node.cc
M   source/blender/editors/transform/transform_mode_translate.c

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 4c5969d4f0d..e6b8cc12b29 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -5779,6 +5779,8 @@ def km_transform_modal_map(_params):
 ("AUTOIK_CHAIN_LEN_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', 
"shift": True}, None),
 ("AUTOIK_CHAIN_LEN_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS', 
"shift": True}, None),
 ("INSERTOFS_TOGGLE_DIR", {"type": 'T', "value": 'PRESS'}, None),
+("NODE_ATTACH_ON", {"type": 'LEFT_ALT', "value": 'RELEASE', "any": 
True}, None),
+("NODE_ATTACH_OFF", {"type": 'LEFT_ALT', "value": 'PRESS', "any": 
True}, None),
 ("AUTOCONSTRAIN", {"type": 'MIDDLEMOUSE', "value": 'ANY'}, None),
 ("AUTOCONSTRAINPLANE", {"type": 'MIDDLEMOUSE', "value": 'ANY', 
"shift": True}, None),
 ("PRECISION", {"type": 'LEFT_SHIFT', "value": 'ANY', "any": True}, 
None),
diff --git 
a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py 
b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
index f7929005e06..2f15d908364 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -3996,6 +3996,8 @@ def km_transform_modal_map(_params):
 ("AUTOIK_CHAIN_LEN_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', 
"shift": True}, None),
 ("AUTOIK_CHAIN_LEN_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS', 
"shift": True}, None),
 ("INSERTOFS_TOGGLE_DIR", {"type": 'T', "value": 'PRESS'}, None),
+("NODE_ATTACH_ON", {"type": 'LEFT_ALT', "value": 'RELEASE', "any": 
True}, None),
+("NODE_ATTACH_OFF", {"type": 'LEFT_ALT', "value": 'PRESS', "any": 
True}, None),
 ("AUTOCONSTRAIN", {"type": 'MIDDLEMOUSE', "value": 'ANY'}, None),
 ("AUTOCONSTRAINPLANE", {"type": 'MIDDLEMOUSE', "value": 'ANY', 
"shift": True}, None),
 ("PRECISION", {"type": 'LEFT_SHIFT', "value": 'ANY', "any": True}, 
None),
diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index b8b4cf796f4..cdbd85e85a1 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -599,7 +599,9 @@ static bool transform_modal_item_poll(const wmOperator *op, 
int value)
   }
   break;
 }
-case TFM_MODAL_INSERTOFS_TOGGLE_DIR: {
+case TFM_MODAL_INSERTOFS_TOGGLE_DIR:
+case TFM_MODAL_NODE_ATTACH_ON:
+case TFM_MODAL_NODE_ATTACH_OFF: {
   if (t->spacetype != SPACE_NODE) {
 return false;
   }
@@ -661,6 +663,8 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf)
0,
"Toggle Direction for Node Auto-Offset",
""},
+  {TFM_MODAL_NODE_ATTACH_ON, "NODE_ATTACH_ON", 0, "Node Attachment", ""},
+  {TFM_MODAL_NODE_ATTACH_OFF, "NODE_ATTACH_OFF", 0, "Node Attachment 
(Off)", ""},
   {TFM_MODAL_TRANSLATE, "TRANSLATE", 0, "Move", ""},
   {TFM_MODAL_ROTATE, "ROTATE", 0, "Rotate", ""},
   {TFM_MODAL_RESIZE, "RESIZE", 0, "Resize", ""},
@@ -1112,6 +1116,17 @@ int transformEvent(TransInfo *t, const wmEvent *event)
   t->redraw |= TREDRAW_SOFT;
 }
 break;
+  case TFM_MODAL_NODE_ATTACH_ON:
+t->modifiers |= MOD_NODE_ATTACH;
+t->redraw |= TREDRAW_HARD;
+handled = true;
+break;
+  case TFM_MODAL_NODE_ATTACH

[Bf-blender-cvs] [b1494bcea7b] master: Geometry Nodes: Add error message when applying modifier with no mesh

2022-12-15 Thread Hans Goudey
Commit: b1494bcea7b6bb6088c5ad245889fa687ed23699
Author: Hans Goudey
Date:   Thu Dec 15 14:05:01 2022 -0600
Branches: master
https://developer.blender.org/rBb1494bcea7b6bb6088c5ad245889fa687ed23699

Geometry Nodes: Add error message when applying modifier with no mesh

If the resulting geometry from applying a geometry nodes modifier
contains no mesh, give an error message. This gives people something to
search and makes the behavior more purposeful.

Also remove the `modifyMesh` implementation from the geometry nodes
modifier, since it isn't necessary anymore. And remove the existing
"Modifier returned error, skipping apply" message which was cryptic
and redundant if applying returns an actual error message.

Resolves T103229

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

===

M   source/blender/editors/object/object_modifier.cc
M   source/blender/modifiers/intern/MOD_nodes.cc

===

diff --git a/source/blender/editors/object/object_modifier.cc 
b/source/blender/editors/object/object_modifier.cc
index 2fa37f205ab..2401fdf2d93 100644
--- a/source/blender/editors/object/object_modifier.cc
+++ b/source/blender/editors/object/object_modifier.cc
@@ -694,7 +694,8 @@ static Mesh *create_applied_mesh_for_modifier(Depsgraph 
*depsgraph,
   Object *ob_eval,
   ModifierData *md_eval,
   const bool use_virtual_modifiers,
-  const bool build_shapekey_layers)
+  const bool build_shapekey_layers,
+  ReportList *reports)
 {
   Mesh *me = ob_eval->runtime.data_orig ? reinterpret_cast(ob_eval->runtime.data_orig) :
   reinterpret_cast(ob_eval->data);
@@ -766,9 +767,21 @@ static Mesh *create_applied_mesh_for_modifier(Depsgraph 
*depsgraph,
   add_shapekey_layers(*mesh_temp, *me);
 }
 
-result = mti->modifyMesh(md_eval, &mectx, mesh_temp);
-if (mesh_temp != result) {
-  BKE_id_free(nullptr, mesh_temp);
+if (mti->modifyGeometrySet) {
+  GeometrySet geometry_set = GeometrySet::create_with_mesh(mesh_temp,
+   
GeometryOwnershipType::Owned);
+  mti->modifyGeometrySet(md_eval, &mectx, &geometry_set);
+  if (!geometry_set.has_mesh()) {
+BKE_report(reports, RPT_ERROR, "Evaluated geometry from modifier does 
not contain a mesh");
+return nullptr;
+  }
+  result = geometry_set.get_component_for_write().release();
+}
+else {
+  result = mti->modifyMesh(md_eval, &mectx, mesh_temp);
+  if (mesh_temp != result) {
+BKE_id_free(nullptr, mesh_temp);
+  }
 }
   }
 
@@ -817,7 +830,8 @@ static bool modifier_apply_shape(Main *bmain,
   
DEG_get_evaluated_object(depsgraph, ob),
   md_eval,
   true,
-  false);
+  false,
+  reports);
 if (!mesh_applied) {
   BKE_report(reports, RPT_ERROR, "Modifier is disabled or returned error, 
skipping apply");
   return false;
@@ -883,9 +897,9 @@ static bool modifier_apply_obdata(
   /* It's important not to apply virtual modifiers (e.g. shape-keys) 
because they're kept,
* causing them to be applied twice, see: T97758. */
   false,
-  true);
+  true,
+  reports);
   if (!mesh_applied) {
-BKE_report(reports, RPT_ERROR, "Modifier returned error, skipping 
apply");
 return false;
   }
 
diff --git a/source/blender/modifiers/intern/MOD_nodes.cc 
b/source/blender/modifiers/intern/MOD_nodes.cc
index f5ede42b0ad..64261ae5b10 100644
--- a/source/blender/modifiers/intern/MOD_nodes.cc
+++ b/source/blender/modifiers/intern/MOD_nodes.cc
@@ -1309,19 +1309,6 @@ static void modifyGeometry(ModifierData *md,
   }
 }
 
-static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh 
*mesh)
-{
-  GeometrySet geometry_set = GeometrySet::create_with_mesh(mesh, 
GeometryOwnershipType::Editable);
-
-  modifyGeometry(md, ctx, geometry_set);
-
-  Mesh *new_mesh = 
geometry_set.get_component_for_write().release();
-  if (new_mesh == nullptr) {
-return BKE_mesh_new_nomain(0, 0, 0, 0, 0);
-  }
-  return new_mesh;
-}
-
 static void modifyGeometrySet(ModifierData *md,
   const ModifierEvalContext *ctx,
   GeometrySet *geometry_set)
@@ -1882,7 +1869,7 @@ M

[Bf-blender-cvs] [7608ebe44aa] master: Fix: ignore unavailable sockets linked to multi-input socket

2022-12-15 Thread Iliya Katueshenock
Commit: 7608ebe44aa343f40f1d79f719097111eaa0c722
Author: Iliya Katueshenock
Date:   Thu Dec 15 19:32:30 2022 +0100
Branches: master
https://developer.blender.org/rB7608ebe44aa343f40f1d79f719097111eaa0c722

Fix: ignore unavailable sockets linked to multi-input socket

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

===

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 cad92cc0d90..9b89d056675 100644
--- a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
+++ b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
@@ -1141,10 +1141,11 @@ struct GeometryNodesLazyFunctionGraphBuilder {
 if (multi_input_link == link) {
   break;
 }
-if (!(multi_input_link->is_muted() ||
-  nodeIsDanglingReroute(&btree_, multi_input_link->fromnode))) 
{
-  link_index++;
+if (multi_input_link->is_muted() || 
!multi_input_link->fromsock->is_available() ||
+nodeIsDanglingReroute(&btree_, multi_input_link->fromnode)) {
+  continue;
 }
+link_index++;
   }
   if (to_bsocket.owner_node().is_muted()) {
 if (link_index == 0) {

___
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] [ef35247ee1e] master: Fix make deps harvest error on Linux, due to macOS specific folder in Vulkan

2022-12-15 Thread Brecht Van Lommel
Commit: ef35247ee1e16bab802cc5ee2a06ae1ea2b159a1
Author: Brecht Van Lommel
Date:   Thu Dec 15 19:17:36 2022 +0100
Branches: master
https://developer.blender.org/rBef35247ee1e16bab802cc5ee2a06ae1ea2b159a1

Fix make deps harvest error on Linux, due to macOS specific folder in Vulkan

===

M   build_files/build_environment/cmake/harvest.cmake

===

diff --git a/build_files/build_environment/cmake/harvest.cmake 
b/build_files/build_environment/cmake/harvest.cmake
index 60d633c0ca9..252e52361c5 100644
--- a/build_files/build_environment/cmake/harvest.cmake
+++ b/build_files/build_environment/cmake/harvest.cmake
@@ -271,7 +271,9 @@ harvest(zstd/lib zstd/lib "*.a")
 harvest(shaderc shaderc "*")
 harvest(vulkan_headers vulkan "*")
 harvest_rpath_lib(vulkan_loader/lib vulkan/lib "*${SHAREDLIBEXT}*")
-harvest(vulkan_loader/loader vulkan/loader "*")
+if(APPLE)
+  harvest(vulkan_loader/loader vulkan/loader "*")
+endif()
 
 if(UNIX AND NOT APPLE)
   harvest(libglu/lib mesa/lib "*${SHAREDLIBEXT}*")

___
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] [62f8d0d8c84] master: Fix T103170: missing Cycles viewport light threshold update after exposure edit

2022-12-15 Thread Brecht Van Lommel
Commit: 62f8d0d8c84e96e94fc580b7482e46298bfef822
Author: Brecht Van Lommel
Date:   Thu Dec 15 19:13:55 2022 +0100
Branches: master
https://developer.blender.org/rB62f8d0d8c84e96e94fc580b7482e46298bfef822

Fix T103170: missing Cycles viewport light threshold update after exposure edit

===

M   intern/cycles/scene/scene.cpp

===

diff --git a/intern/cycles/scene/scene.cpp b/intern/cycles/scene/scene.cpp
index db96af19530..e4552713a9d 100644
--- a/intern/cycles/scene/scene.cpp
+++ b/intern/cycles/scene/scene.cpp
@@ -257,6 +257,9 @@ void Scene::device_update(Device *device_, Progress 
&progress)
 light_manager->tag_update(this, ccl::LightManager::LIGHT_MODIFIED);
 object_manager->tag_update(this, ccl::ObjectManager::OBJECT_MODIFIED);
   }
+  if (film->exposure_is_modified()) {
+integrator->tag_modified();
+  }
 
   progress.set_status("Updating Shaders");
   shader_manager->device_update(device, &dscene, this, progress);

___
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] [0ce3e2ae8df] refactor-mesh-uv-map-generic: Various small cleanups to diff (whitespace, etc)

2022-12-15 Thread Hans Goudey
Commit: 0ce3e2ae8df9b9f7368e59abc0affd76dcf770a5
Author: Hans Goudey
Date:   Thu Dec 15 12:07:35 2022 -0600
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB0ce3e2ae8df9b9f7368e59abc0affd76dcf770a5

Various small cleanups to diff (whitespace, etc)

===

M   source/blender/blenkernel/BKE_mesh_legacy_convert.h
M   source/blender/blenkernel/intern/customdata.cc
M   source/blender/blenkernel/intern/pbvh_pixels.cc
M   source/blender/blenkernel/intern/subdiv_mesh.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh.cc
M   source/blender/editors/include/ED_uvedit.h
M   
source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc

===

diff --git a/source/blender/blenkernel/BKE_mesh_legacy_convert.h 
b/source/blender/blenkernel/BKE_mesh_legacy_convert.h
index 499c226c781..fee85d4b06e 100644
--- a/source/blender/blenkernel/BKE_mesh_legacy_convert.h
+++ b/source/blender/blenkernel/BKE_mesh_legacy_convert.h
@@ -10,7 +10,6 @@
 #include "BLI_utildefines.h"
 
 #ifdef __cplusplus
-#  include "BLI_array.hh"
 #  include "BLI_resource_scope.hh"
 #  include "BLI_span.hh"
 #  include "BLI_vector.hh"
diff --git a/source/blender/blenkernel/intern/customdata.cc 
b/source/blender/blenkernel/intern/customdata.cc
index cb87bd2e95d..cf6a9b18c8c 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -1520,7 +1520,6 @@ static bool layerEqual_propfloat2(const void *data1, 
const void *data2)
 {
   const float2 &a = *static_cast(data1);
   const float2 &b = *static_cast(data2);
-
   return blender::math::distance_squared(a, b) < 0.1f;
 }
 
@@ -4170,7 +4169,6 @@ void CustomData_from_bmesh_block(const CustomData *source,
   /* copies a layer at a time */
   int dest_i = 0;
   for (int src_i = 0; src_i < source->totlayer; src_i++) {
-
 if (source->layers[src_i].flag & CD_FLAG_NOCOPY) {
   continue;
 }
@@ -4418,7 +4416,9 @@ static bool 
CustomData_layer_ensure_data_exists(CustomDataLayer *layer, size_t c
   switch (layer->type) {
 /* When more instances of corrupt files are found, add them here. */
 case CD_PROP_BOOL: /* See T84935. */
-case CD_MLOOPUV:   /* See T90620. *//*TODO(@Baardaap) check if 
this is run before or after versioning. If after we need to add CD_PROP_FLOAT2 
to the list? */
+case CD_MLOOPUV:   /* See T90620. */
+  /* TODO(@Baardaap) check if this is run before or after versioning. If 
after we need to add
+   * #CD_PROP_FLOAT2 to the list? */
   layer->data = MEM_calloc_arrayN(count, typeInfo->size, 
layerType_getName(layer->type));
   BLI_assert(layer->data);
   if (typeInfo->set_default_value) {
diff --git a/source/blender/blenkernel/intern/pbvh_pixels.cc 
b/source/blender/blenkernel/intern/pbvh_pixels.cc
index 42af0cbac9c..884da8b89f0 100644
--- a/source/blender/blenkernel/intern/pbvh_pixels.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels.cc
@@ -357,7 +357,6 @@ static void update_pixels(PBVH *pbvh, Mesh *mesh, Image 
*image, ImageUser *image
 
   const float2 *ldata_uv = static_cast(
   CustomData_get_layer(&mesh->ldata, CD_PROP_FLOAT2));
-
   if (ldata_uv == nullptr) {
 return;
   }
diff --git a/source/blender/blenkernel/intern/subdiv_mesh.cc 
b/source/blender/blenkernel/intern/subdiv_mesh.cc
index 93c61220b54..55c1400c8bb 100644
--- a/source/blender/blenkernel/intern/subdiv_mesh.cc
+++ b/source/blender/blenkernel/intern/subdiv_mesh.cc
@@ -30,7 +30,6 @@
 #include "MEM_guardedalloc.h"
 
 using blender::float2;
-
 using blender::Span;
 
 /*  */
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh.cc 
b/source/blender/draw/intern/mesh_extractors/extract_mesh.cc
index 98edb1c4e3c..72d7c31110f 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh.cc
@@ -143,7 +143,6 @@ void mesh_render_data_loop_edge_flag(const MeshRenderData 
*mr,
   if (offsets.uv == -1) {
 return;
   }
-
   if (uvedit_edge_select_test_ex(mr->toolsettings, l, offsets)) {
 eattr->v_flag |= VFLAG_EDGE_UV_SELECT;
 eattr->v_flag |= VFLAG_VERT_UV_SELECT;
diff --git a/source/blender/editors/include/ED_uvedit.h 
b/source/blender/editors/include/ED_uvedit.h
index 465f1255ee0..7aa745abdf6 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -32,7 +32,6 @@ struct bContext;
 struct bNode;
 struct bNodeTree;
 struct wmKeyConfig;
-struct BMUVOffsets;
 
 /* uvedit_ops.c */
 
diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc 
b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc
index ea1b9eacd5a..d866f337a00 100644
--- a/source/blender/nodes/geometry/

[Bf-blender-cvs] [c6ff8eb837a] master: Fix build issue with NanoVDB and HIP on Linux

2022-12-15 Thread Brecht Van Lommel
Commit: c6ff8eb837ae91d3fc0b9f9fc3646d6601f096fb
Author: Brecht Van Lommel
Date:   Thu Dec 15 15:10:09 2022 +0100
Branches: master
https://developer.blender.org/rBc6ff8eb837ae91d3fc0b9f9fc3646d6601f096fb

Fix build issue with NanoVDB and HIP on Linux

This patch was already accepted upstream, so this is temporary until we update
to a new OpenVDB release that includes it.

===

M   build_files/build_environment/patches/openvdb.diff

===

diff --git a/build_files/build_environment/patches/openvdb.diff 
b/build_files/build_environment/patches/openvdb.diff
index 9896460c26c..d3f19985815 100644
--- a/build_files/build_environment/patches/openvdb.diff
+++ b/build_files/build_environment/patches/openvdb.diff
@@ -90,3 +90,25 @@ diff -Naur orig/openvdb/openvdb/tree/ValueAccessor.h 
openvdb/openvdb/openvdb/tre
  
  CacheItem(TreeCacheT& parent)
  : mParent(&parent)
+diff --git a/nanovdb/nanovdb/NanoVDB.h b/nanovdb/nanovdb/NanoVDB.h
+index f7fc304..fde5c47 100644
+--- a/nanovdb/nanovdb/NanoVDB.h
 b/nanovdb/nanovdb/NanoVDB.h
+@@ -1877,7 +1877,7 @@ __hostdev__ static inline uint32_t FindLowestOn(uint64_t 
v)
+ {
+ NANOVDB_ASSERT(v);
+ #if (defined(__CUDA_ARCH__) || defined(__HIP__)) && 
defined(NANOVDB_USE_INTRINSICS)
+-return __ffsll(v);
++return __ffsll(static_cast(v));
+ #elif defined(_MSC_VER) && defined(NANOVDB_USE_INTRINSICS)
+ unsigned long index;
+ _BitScanForward64(&index, v);
+@@ -2592,7 +2592,7 @@ public:
+ ///
+ /// @note This method is only defined for IndexGrid = NanoGrid
+ template 
+-__hostdev__ typename enable_if::value, 
uint64_t>::type valueCount() const {return DataType::mData1;}
++__hostdev__ typename enable_if::value, const 
uint64_t&>::type valueCount() const {return DataType::mData1;}
+ 
+ /// @brief Return a const reference to the tree
+ __hostdev__ const TreeT& tree() const { return *reinterpret_cast(this->treePtr()); }

___
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] [1e68c87785f] refactor-mesh-uv-map-generic: Merge branch 'master' into refactor-mesh-uv-map-generic

2022-12-15 Thread Hans Goudey
Commit: 1e68c87785f84c0229731ba349ac1521f3c6edca
Author: Hans Goudey
Date:   Thu Dec 15 10:33:23 2022 -0600
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB1e68c87785f84c0229731ba349ac1521f3c6edca

Merge branch 'master' into refactor-mesh-uv-map-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] [6546113f1ed] master: Cleanup: fix warning

2022-12-15 Thread Jacques Lucke
Commit: 6546113f1ed237029a1c37502908d31cc39f9e87
Author: Jacques Lucke
Date:   Thu Dec 15 17:30:40 2022 +0100
Branches: master
https://developer.blender.org/rB6546113f1ed237029a1c37502908d31cc39f9e87

Cleanup: fix warning

===

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

===

diff --git a/source/blender/blenkernel/intern/mesh.cc 
b/source/blender/blenkernel/intern/mesh.cc
index 77ef4674596..16858a70a0c 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -725,7 +725,7 @@ static int customdata_compare(
   }
 }
 if (!found_corresponding_layer) {
-  if ((1 << l1->type) & CD_MASK_PROP_ALL) {
+  if ((uint64_t(1) << l1->type) & CD_MASK_PROP_ALL) {
 return MESHCMP_CDLAYERS_MISMATCH;
   }
 }

___
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] [5edc7151f19] refactor-mesh-uv-map-generic: Merge branch 'master' into refactor-mesh-uv-map-generic

2022-12-15 Thread Baardaap
Commit: 5edc7151f19ebdf5813d5b5827f7cc9bebae641e
Author: Baardaap
Date:   Thu Dec 15 15:08:05 2022 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB5edc7151f19ebdf5813d5b5827f7cc9bebae641e

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

===



===

diff --cc source/blender/blenkernel/intern/customdata.cc
index dd9aaf99d32,c8d7c4f2fdc..cb87bd2e95d
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@@ -4418,7 -4492,7 +4418,7 @@@ static bool CustomData_layer_ensure_dat
switch (layer->type) {
  /* When more instances of corrupt files are found, add them here. */
  case CD_PROP_BOOL: /* See T84935. */
--case CD_MLOOPUV:   /* See T90620. */
++case CD_MLOOPUV:   /* See T90620. *//*TODO(@Baardaap) check if 
this is run before or after versioning. If after we need to add CD_PROP_FLOAT2 
to the list? */
layer->data = MEM_calloc_arrayN(count, typeInfo->size, 
layerType_getName(layer->type));
BLI_assert(layer->data);
if (typeInfo->set_default_value) {
diff --cc source/blender/draw/intern/draw_pbvh.cc
index cce7e106662,bc9c449544c..e5f8cce942a
--- a/source/blender/draw/intern/draw_pbvh.cc
+++ b/source/blender/draw/intern/draw_pbvh.cc
@@@ -66,6 -66,22 +66,22 @@@ using blender::Vector
  
  using string = std::string;
  
+ static bool valid_pbvh_attr(int type)
+ {
+   switch (type) {
+ case CD_PBVH_CO_TYPE:
+ case CD_PBVH_NO_TYPE:
+ case CD_PBVH_FSET_TYPE:
+ case CD_PBVH_MASK_TYPE:
+ case CD_PROP_COLOR:
+ case CD_PROP_BYTE_COLOR:
 -case CD_MLOOPUV:
++case CD_PROP_FLOAT2:
+   return true;
+   }
+ 
+   return false;
+ }
+ 
  struct PBVHVbo {
uint64_t type;
eAttrDomain domain;
diff --cc source/blender/modifiers/intern/MOD_array.cc
index 8d828bb45b5,1478ca0ecc5..7c277ffbeff
--- a/source/blender/modifiers/intern/MOD_array.cc
+++ b/source/blender/modifiers/intern/MOD_array.cc
@@@ -670,9 -671,10 +671,9 @@@ static Mesh *arrayModifier_doArray(Arra
  
/* handle UVs */
if (chunk_nloops > 0 && is_zero_v2(amd->uv_offset) == false) {
 -const int totuv = CustomData_number_of_layers(&result->ldata, CD_MLOOPUV);
 +const int totuv = CustomData_number_of_layers(&result->ldata, 
CD_PROP_FLOAT2);
  for (i = 0; i < totuv; i++) {
-   float(*dmloopuv)[2] = CustomData_get_layer_n(&result->ldata, 
CD_PROP_FLOAT2, i);
 -  MLoopUV *dmloopuv = static_cast(
 -  CustomData_get_layer_n(&result->ldata, CD_MLOOPUV, i));
++  float(*dmloopuv)[2] = static_cast(CustomData_get_layer_n(&result->ldata, CD_PROP_FLOAT2, i));
dmloopuv += chunk_nloops;
for (c = 1; c < count; c++) {
  const float uv_offset[2] = {
diff --cc source/blender/modifiers/intern/MOD_screw.cc
index 32237721384,930fa0c1aab..84fb4ac36cc
--- a/source/blender/modifiers/intern/MOD_screw.cc
+++ b/source/blender/modifiers/intern/MOD_screw.cc
@@@ -206,16 -205,16 +205,16 @@@ static Mesh *modifyMesh(ModifierData *m
};
  
uint maxVerts = 0, maxEdges = 0, maxPolys = 0;
-   const uint totvert = (uint)mesh->totvert;
-   const uint totedge = (uint)mesh->totedge;
-   const uint totpoly = (uint)mesh->totpoly;
+   const uint totvert = uint(mesh->totvert);
+   const uint totedge = uint(mesh->totedge);
+   const uint totpoly = uint(mesh->totpoly);
  
-   uint *edge_poly_map = NULL; /* orig edge to orig poly */
-   uint *vert_loop_map = NULL; /* orig vert to orig loop */
+   uint *edge_poly_map = nullptr; /* orig edge to orig poly */
+   uint *vert_loop_map = nullptr; /* orig vert to orig loop */
  
/* UV Coords */
-   const uint mloopuv_layers_tot = 
(uint)CustomData_number_of_layers(&mesh->ldata, CD_PROP_FLOAT2);
-   float(**mloopuv_layers)[2] = BLI_array_alloca(mloopuv_layers, 
mloopuv_layers_tot);
 -  const uint mloopuv_layers_tot = 
uint(CustomData_number_of_layers(&mesh->ldata, CD_MLOOPUV));
 -  blender::Array mloopuv_layers(mloopuv_layers_tot);
++  const uint mloopuv_layers_tot = 
uint(CustomData_number_of_layers(&mesh->ldata, CD_PROP_FLOAT2));
++  blender::Array mloopuv_layers(mloopuv_layers_tot);
float uv_u_scale;
float uv_v_minmax[2] = {FLT_MAX, -FLT_MAX};
float uv_v_range_inv;
@@@ -409,7 -408,8 +408,7 @@@
if (mloopuv_layers_tot) {
  uint uv_lay;
  for (uv_lay = 0; uv_lay < mloopuv_layers_tot; uv_lay++) {
-   mloopuv_layers[uv_lay] = CustomData_get_layer_n(&result->ldata, 
CD_PROP_FLOAT2, (int)uv_lay);
 -  mloopuv_layers[uv_lay] = static_cast(
 -  CustomData_get_layer_n(&result->ldata, CD_MLOOPUV, int(uv_lay)));
++  mloopuv_layers[uv_lay] = static_cast(CustomData_get_layer_n(&result->ldata, CD_PROP_FLOAT2, int(uv_lay)));
  }
  
  if (ltmd->flag & MOD_SCREW_UV_STRETCH_V) {
@@@ -907,32 -910,32 +909,32 @@@
  
  if (mloopuv_layers_tot) {
uint uv_lay;

[Bf-blender-cvs] [2acad794262] refactor-mesh-uv-map-generic: Cleanup: make format

2022-12-15 Thread Baardaap
Commit: 2acad794262ca912023d7fd04f16c4f72124137c
Author: Baardaap
Date:   Thu Dec 15 15:09:12 2022 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB2acad794262ca912023d7fd04f16c4f72124137c

Cleanup: make format

===

M   source/blender/draw/intern/draw_manager_data.cc
M   source/blender/modifiers/intern/MOD_array.cc
M   source/blender/modifiers/intern/MOD_screw.cc

===

diff --git a/source/blender/draw/intern/draw_manager_data.cc 
b/source/blender/draw/intern/draw_manager_data.cc
index fbeba1f943a..fc2fbd54300 100644
--- a/source/blender/draw/intern/draw_manager_data.cc
+++ b/source/blender/draw/intern/draw_manager_data.cc
@@ -695,7 +695,7 @@ static void drw_call_obinfos_init(DRWObjectInfos *ob_infos, 
Object *ob)
   drw_call_calc_orco(ob, ob_infos->orcotexfac);
   /* Random float value. */
   uint random = (DST.dupli_source) ?
-DST.dupli_source->random_id :
+ DST.dupli_source->random_id :
  /* TODO(fclem): this is rather costly to do at runtime. 
Maybe we can
   * put it in ob->runtime and make depsgraph ensure it is 
up to date. */
  BLI_hash_int_2d(BLI_hash_string(ob->id.name + 2), 0);
diff --git a/source/blender/modifiers/intern/MOD_array.cc 
b/source/blender/modifiers/intern/MOD_array.cc
index 7c277ffbeff..411c839c42a 100644
--- a/source/blender/modifiers/intern/MOD_array.cc
+++ b/source/blender/modifiers/intern/MOD_array.cc
@@ -673,7 +673,8 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd,
   if (chunk_nloops > 0 && is_zero_v2(amd->uv_offset) == false) {
 const int totuv = CustomData_number_of_layers(&result->ldata, 
CD_PROP_FLOAT2);
 for (i = 0; i < totuv; i++) {
-  float(*dmloopuv)[2] = static_cast(CustomData_get_layer_n(&result->ldata, CD_PROP_FLOAT2, i));
+  float(*dmloopuv)[2] = static_cast(
+  CustomData_get_layer_n(&result->ldata, CD_PROP_FLOAT2, i));
   dmloopuv += chunk_nloops;
   for (c = 1; c < count; c++) {
 const float uv_offset[2] = {
diff --git a/source/blender/modifiers/intern/MOD_screw.cc 
b/source/blender/modifiers/intern/MOD_screw.cc
index 84fb4ac36cc..45294acf330 100644
--- a/source/blender/modifiers/intern/MOD_screw.cc
+++ b/source/blender/modifiers/intern/MOD_screw.cc
@@ -408,7 +408,8 @@ static Mesh *modifyMesh(ModifierData *md, const 
ModifierEvalContext *ctx, Mesh *
   if (mloopuv_layers_tot) {
 uint uv_lay;
 for (uv_lay = 0; uv_lay < mloopuv_layers_tot; uv_lay++) {
-  mloopuv_layers[uv_lay] = static_cast(CustomData_get_layer_n(&result->ldata, CD_PROP_FLOAT2, int(uv_lay)));
+  mloopuv_layers[uv_lay] = static_cast(
+  CustomData_get_layer_n(&result->ldata, CD_PROP_FLOAT2, int(uv_lay)));
 }
 
 if (ltmd->flag & MOD_SCREW_UV_STRETCH_V) {

___
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] [bd04e80c09f] master: Cleanup: Move mesh modifier apply function to editors module

2022-12-15 Thread Hans Goudey
Commit: bd04e80c09f00eac05a7f5d8d0cf6732ae245763
Author: Hans Goudey
Date:   Wed Dec 14 19:12:17 2022 -0600
Branches: master
https://developer.blender.org/rBbd04e80c09f00eac05a7f5d8d0cf6732ae245763

Cleanup: Move mesh modifier apply function to editors module

The function was highly related to the apply modifier operator,
and only used once. This was too specific to be in the blenkernel,
especially in a mesh conversion file.

===

M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/blenkernel/intern/mesh_convert.cc
M   source/blender/editors/object/object_modifier.cc

===

diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index 6a55fe00bf6..472c82c3a81 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -279,18 +279,6 @@ struct Mesh *BKE_mesh_new_from_object_to_bmain(struct Main 
*bmain,
struct Object *object,
bool preserve_all_data_layers);
 
-/**
- * \param use_virtual_modifiers: When enabled calculate virtual-modifiers 
before applying `md_eval`
- * support this since virtual-modifiers are not modifiers from a user 
perspective,
- * allowing shape keys to be included with the modifier being applied, see: 
T91923.
- */
-struct Mesh *BKE_mesh_create_derived_for_modifier(struct Depsgraph *depsgraph,
-  struct Scene *scene,
-  struct Object *ob_eval,
-  struct ModifierData *md_eval,
-  bool use_virtual_modifiers,
-  bool build_shapekey_layers);
-
 /**
  * Move data from a mesh outside of the main data-base into a mesh in the 
data-base.
  * Takes ownership of the source mesh.
diff --git a/source/blender/blenkernel/intern/mesh_convert.cc 
b/source/blender/blenkernel/intern/mesh_convert.cc
index fd2bb67c648..7a4c3c0834b 100644
--- a/source/blender/blenkernel/intern/mesh_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_convert.cc
@@ -1102,142 +1102,6 @@ Mesh *BKE_mesh_new_from_object_to_bmain(Main *bmain,
   return mesh_in_bmain;
 }
 
-static void add_shapekey_layers(Mesh *mesh_dest, Mesh *mesh_src)
-{
-  KeyBlock *kb;
-  Key *key = mesh_src->key;
-  int i;
-
-  if (!mesh_src->key) {
-return;
-  }
-
-  /* ensure we can use mesh vertex count for derived mesh custom data */
-  if (mesh_src->totvert != mesh_dest->totvert) {
-CLOG_ERROR(&LOG,
-   "vertex size mismatch (mesh/dm) '%s' (%d != %d)",
-   mesh_src->id.name + 2,
-   mesh_src->totvert,
-   mesh_dest->totvert);
-return;
-  }
-
-  for (i = 0, kb = (KeyBlock *)key->block.first; kb; kb = kb->next, i++) {
-int ci;
-float *array;
-
-if (mesh_src->totvert != kb->totelem) {
-  CLOG_ERROR(&LOG,
- "vertex size mismatch (Mesh '%s':%d != KeyBlock '%s':%d)",
- mesh_src->id.name + 2,
- mesh_src->totvert,
- kb->name,
- kb->totelem);
-  array = (float *)MEM_calloc_arrayN(size_t(mesh_src->totvert), 
sizeof(float[3]), __func__);
-}
-else {
-  array = (float *)MEM_malloc_arrayN(size_t(mesh_src->totvert), 
sizeof(float[3]), __func__);
-  memcpy(array, kb->data, sizeof(float[3]) * size_t(mesh_src->totvert));
-}
-
-CustomData_add_layer_named(
-&mesh_dest->vdata, CD_SHAPEKEY, CD_ASSIGN, array, mesh_dest->totvert, 
kb->name);
-ci = CustomData_get_layer_index_n(&mesh_dest->vdata, CD_SHAPEKEY, i);
-
-mesh_dest->vdata.layers[ci].uid = kb->uid;
-  }
-}
-
-Mesh *BKE_mesh_create_derived_for_modifier(struct Depsgraph *depsgraph,
-   Scene *scene,
-   Object *ob_eval,
-   ModifierData *md_eval,
-   const bool use_virtual_modifiers,
-   const bool build_shapekey_layers)
-{
-  Mesh *me = ob_eval->runtime.data_orig ? (Mesh *)ob_eval->runtime.data_orig :
-  (Mesh *)ob_eval->data;
-  const ModifierTypeInfo *mti = 
BKE_modifier_get_info((ModifierType)md_eval->type);
-  Mesh *result = nullptr;
-  KeyBlock *kb;
-  ModifierEvalContext mectx = {depsgraph, ob_eval, MOD_APPLY_TO_BASE_MESH};
-
-  if (!(md_eval->mode & eModifierMode_Realtime)) {
-return result;
-  }
-
-  if (mti->isDisabled && mti->isDisabled(scene, md_eval, false)) {
-return result;
-  }
-
-  if (build_shapekey_layers && me->key &&
-  (kb = (KeyBlock *)BLI_findlink(&me->key->block, ob_eval->shapenr - 1))) {
-MutableSpan v

[Bf-blender-cvs] [970f4c2f9f0] master: Cleanup: Various improvements to modifier apply operator

2022-12-15 Thread Hans Goudey
Commit: 970f4c2f9f0e9cda6fa61f9ddf6da12d6bb91f2a
Author: Hans Goudey
Date:   Wed Dec 14 19:24:34 2022 -0600
Branches: master
https://developer.blender.org/rB970f4c2f9f0e9cda6fa61f9ddf6da12d6bb91f2a

Cleanup: Various improvements to modifier apply operator

Use C++ casts, decrease variable scope, use references, use const.

===

M   source/blender/editors/object/object_modifier.cc

===

diff --git a/source/blender/editors/object/object_modifier.cc 
b/source/blender/editors/object/object_modifier.cc
index 28010b7c608..2fa37f205ab 100644
--- a/source/blender/editors/object/object_modifier.cc
+++ b/source/blender/editors/object/object_modifier.cc
@@ -654,39 +654,33 @@ bool ED_object_modifier_convert_psys_to_mesh(ReportList * 
/*reports*/,
   return true;
 }
 
-static void add_shapekey_layers(Mesh *mesh_dest, Mesh *mesh_src)
+static void add_shapekey_layers(Mesh &mesh_dest, const Mesh &mesh_src)
 {
-  KeyBlock *kb;
-  Key *key = mesh_src->key;
-  int i;
-
-  if (!mesh_src->key) {
+  if (!mesh_src.key) {
 return;
   }
-
-  for (i = 0, kb = (KeyBlock *)key->block.first; kb; kb = kb->next, i++) {
-int ci;
-float *array;
-
-if (mesh_src->totvert != kb->totelem) {
+  int i;
+  LISTBASE_FOREACH_INDEX (const KeyBlock *, kb, &mesh_src.key->block, i) {
+void *array;
+if (mesh_src.totvert != kb->totelem) {
   CLOG_ERROR(&LOG,
  "vertex size mismatch (Mesh '%s':%d != KeyBlock '%s':%d)",
- mesh_src->id.name + 2,
- mesh_src->totvert,
+ mesh_src.id.name + 2,
+ mesh_src.totvert,
  kb->name,
  kb->totelem);
-  array = (float *)MEM_calloc_arrayN(size_t(mesh_src->totvert), 
sizeof(float[3]), __func__);
+  array = MEM_calloc_arrayN(size_t(mesh_src.totvert), sizeof(float[3]), 
__func__);
 }
 else {
-  array = (float *)MEM_malloc_arrayN(size_t(mesh_src->totvert), 
sizeof(float[3]), __func__);
-  memcpy(array, kb->data, sizeof(float[3]) * size_t(mesh_src->totvert));
+  array = MEM_malloc_arrayN(size_t(mesh_src.totvert), sizeof(float[3]), 
__func__);
+  memcpy(array, kb->data, sizeof(float[3]) * size_t(mesh_src.totvert));
 }
 
 CustomData_add_layer_named(
-&mesh_dest->vdata, CD_SHAPEKEY, CD_ASSIGN, array, mesh_dest->totvert, 
kb->name);
-ci = CustomData_get_layer_index_n(&mesh_dest->vdata, CD_SHAPEKEY, i);
+&mesh_dest.vdata, CD_SHAPEKEY, CD_ASSIGN, array, mesh_dest.totvert, 
kb->name);
+const int ci = CustomData_get_layer_index_n(&mesh_dest.vdata, CD_SHAPEKEY, 
i);
 
-mesh_dest->vdata.layers[ci].uid = kb->uid;
+mesh_dest.vdata.layers[ci].uid = kb->uid;
   }
 }
 
@@ -702,27 +696,28 @@ static Mesh *create_applied_mesh_for_modifier(Depsgraph 
*depsgraph,
   const bool use_virtual_modifiers,
   const bool build_shapekey_layers)
 {
-  Mesh *me = ob_eval->runtime.data_orig ? (Mesh *)ob_eval->runtime.data_orig :
-  (Mesh *)ob_eval->data;
-  const ModifierTypeInfo *mti = 
BKE_modifier_get_info((ModifierType)md_eval->type);
-  Mesh *result = nullptr;
-  KeyBlock *kb;
-  ModifierEvalContext mectx = {depsgraph, ob_eval, MOD_APPLY_TO_BASE_MESH};
+  Mesh *me = ob_eval->runtime.data_orig ? reinterpret_cast(ob_eval->runtime.data_orig) :
+  reinterpret_cast(ob_eval->data);
+  const ModifierTypeInfo *mti = 
BKE_modifier_get_info(ModifierType(md_eval->type));
+  const ModifierEvalContext mectx = {depsgraph, ob_eval, 
MOD_APPLY_TO_BASE_MESH};
 
   if (!(md_eval->mode & eModifierMode_Realtime)) {
-return result;
+return nullptr;
   }
 
   if (mti->isDisabled && mti->isDisabled(scene, md_eval, false)) {
-return result;
+return nullptr;
   }
 
-  if (build_shapekey_layers && me->key &&
-  (kb = (KeyBlock *)BLI_findlink(&me->key->block, ob_eval->shapenr - 1))) {
-BKE_keyblock_convert_to_mesh(kb, me->verts_for_write().data(), 
me->totvert);
+  if (build_shapekey_layers && me->key) {
+if (KeyBlock *kb = static_cast(
+BLI_findlink(&me->key->block, ob_eval->shapenr - 1))) {
+  BKE_keyblock_convert_to_mesh(kb, me->verts_for_write().data(), 
me->totvert);
+}
   }
 
-  Mesh *mesh_temp = (Mesh *)BKE_id_copy_ex(nullptr, &me->id, nullptr, 
LIB_ID_COPY_LOCALIZE);
+  Mesh *mesh_temp = reinterpret_cast(
+  BKE_id_copy_ex(nullptr, &me->id, nullptr, LIB_ID_COPY_LOCALIZE));
   int numVerts = 0;
   float(*deformedVerts)[3] = nullptr;
 
@@ -736,7 +731,7 @@ static Mesh *create_applied_mesh_for_modifier(Depsgraph 
*depsgraph,
 continue;
   }
   /* All virtual modifiers are deform modifiers. */
-  const ModifierTypeInfo *mti_virt = 
BKE_modifier_get_info((ModifierType)md_eval_virt->type);
+  const Mo

[Bf-blender-cvs] [d2aebf10fae] master: cmake/win: Allow running blender_test from the VS debugger

2022-12-15 Thread Ray Molenkamp
Commit: d2aebf10fae7bd6f0e854deea2c3c776bd5cde8c
Author: Ray Molenkamp
Date:   Thu Dec 15 09:04:59 2022 -0700
Branches: master
https://developer.blender.org/rBd2aebf10fae7bd6f0e854deea2c3c776bd5cde8c

cmake/win: Allow running blender_test from the VS debugger

This was missing some paths setup in the environment, ctest
normally sets this up before running the tests from the CLI
but that does not help the IDE all that much.

===

M   tests/gtests/runner/CMakeLists.txt

===

diff --git a/tests/gtests/runner/CMakeLists.txt 
b/tests/gtests/runner/CMakeLists.txt
index be0aa65d409..eac76db22db 100644
--- a/tests/gtests/runner/CMakeLists.txt
+++ b/tests/gtests/runner/CMakeLists.txt
@@ -43,6 +43,7 @@ if(WIN32)
 target_link_libraries(blender_test ${_lib})
 target_link_options(blender_test PRIVATE 
/wholearchive:$)
   endforeach()
+  set_target_properties(blender_test PROPERTIES VS_DEBUGGER_ENVIRONMENT 
"${PLATFORM_ENV_INSTALL};$")
 elseif(APPLE)
   # force_load for `_test_libs` ensures that all symbols definitely make it 
into the test binary.
   # But linking against them again using `target_link_libraries` creates 
duplicate symbol

___
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] [f15010bbe65] microfacet_hair: Remove unnecessary Jacobians

2022-12-15 Thread Weizhen Huang
Commit: f15010bbe65fee41306358b8405ba97bd244cdc8
Author: Weizhen Huang
Date:   Thu Dec 15 16:16:13 2022 +0100
Branches: microfacet_hair
https://developer.blender.org/rBf15010bbe65fee41306358b8405ba97bd244cdc8

Remove unnecessary Jacobians

===

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

===

diff --git a/intern/cycles/kernel/closure/bsdf_hair_microfacet.h 
b/intern/cycles/kernel/closure/bsdf_hair_microfacet.h
index b5e88464776..794c6930b96 100644
--- a/intern/cycles/kernel/closure/bsdf_hair_microfacet.h
+++ b/intern/cycles/kernel/closure/bsdf_hair_microfacet.h
@@ -415,12 +415,11 @@ ccl_device float3 
bsdf_microfacet_hair_eval_r_circular(ccl_private const ShaderC
 
   const float phi_m = phi_m_min + i * res;
   const float3 wm = sph_dir(tilt, phi_m);
-  const float J = fmaxf(cos(phi_i - phi_m), 0.f);
 
   if (microfacet_visible(wi, wo, make_float3(wm.x, 0.f, wm.z), wh)) {
 const float weight = (i == 0 || i == intervals - 1) ? 0.5f : (i % 2 + 
1);
 integral += weight * D(beckmann, roughness, wm, wh) *
-G(beckmann, roughness, wi, wo, wm, wh) * J;
+G(beckmann, roughness, wi, wo, wm, wh);
   }
 }
 integral *= (2.f / 3.f * res);
@@ -475,7 +474,6 @@ ccl_device float3 
bsdf_microfacet_hair_eval_tt_trt_circular(KernelGlobals kg,
 
 const float phi_mi = phi_m_min + i * res;
 const float3 wmi = sph_dir(tilt, phi_mi);
-const float J = fmaxf(cos(phi_i - phi_mi), 0.f);
 
 /* sample wh1 */
 const float2 sample1 = make_float2(lcg_step_float(&rng_quadrature),
@@ -524,7 +522,7 @@ ccl_device float3 
bsdf_microfacet_hair_eval_tt_trt_circular(KernelGlobals kg,
 
   const float3 result = T1 * T2 * D2 * A_t * dot_wt_wh2 * dot(wo, wh2) 
*
 sqr(rcp_norm_wh2) / dot(wt, wmi) * weight *
-smith_g1(beckmann, roughness, -wt, wmi, wh1) * 
dot(wi, wmi) * J;
+smith_g1(beckmann, roughness, -wt, wmi, wh1) * 
dot(wi, wmi);
 
   if (isfinite_safe(result))
 S_tt += bsdf->extra->TT * result;
@@ -579,7 +577,7 @@ ccl_device float3 
bsdf_microfacet_hair_eval_tt_trt_circular(KernelGlobals kg,
 A_tr * weight / (dot(wt, wmi) * dot(wtr, wmt)) *
 smith_g1(beckmann, roughness, -wt, wmi, wh1) *
 smith_g1(beckmann, roughness, -wtr, wmt, wh2) * 
dot(wi, wmi) *
-dot(wt, wmt) * J;
+dot(wt, wmt);
 
   if (isfinite_safe(result))
 S_trt += bsdf->extra->TRT * result;
@@ -615,13 +613,7 @@ ccl_device Spectrum 
bsdf_microfacet_hair_eval_circular(KernelGlobals kg,
   /* TODO: better estimation of the pdf */
   *pdf = 1.f;
 
-  // original from Huang's EGSR 2022
   return rgb_to_spectrum(R / cos_theta(wi));
-
-  // correction: the extra cos_theta(wo) corresponds to the lack of 
consideration of Zinke's
-  // cos_theta_i^2 in the BCSDF; for instance eq[2] in Huang's should include 
an extra cos_theta_i
-  // (plus here remember wi and wo meanings are flipped)
-  /* return rgb_to_spectrum(R / (cos_theta(wi) * cos_theta(wo))); */
 }
 
 ccl_device int bsdf_microfacet_hair_sample_circular(const KernelGlobals kg,
@@ -813,14 +805,8 @@ ccl_device int bsdf_microfacet_hair_sample_circular(const 
KernelGlobals kg,
 label |= LABEL_TRANSMIT;
   }
 
-  // original from Huang's EGSR 2022
   *eval *= visibility;
 
-  // correction: the extra cos_theta(wo) corresponds to the lack of 
consideration of Zinke's
-  // cos_theta_i^2 in the BCSDF; for instance eq[2] in Huang's should include 
an extra cos_theta_i
-  // (plus here remember wi and wo meanings are flipped)
-  /* *eval *= visibility / cos_theta(wo); */
-
   *omega_in = wo.x * X + wo.y * Y + wo.z * Z;
 
   /* correction of the cosine foreshortening term
@@ -911,14 +897,13 @@ ccl_device float3 
bsdf_microfacet_hair_eval_r_elliptic(ccl_private const ShaderC
 
 const float gamma_m = gamma_m_min + i * res;
 const float3 wm = sphg_dir(tilt, gamma_m, a, b);
-const float J = fmaxf(cos(gamma_i - gamma_m), 0.f);
 
 if (microfacet_visible(wi, wo, make_float3(wm.x, 0.f, wm.z), wh)) {
   const float weight = (i == 0 || i == intervals - 1) ? .5f : (i % 2 + 1);
   const float arc_length = sqrtf(1.f - e2 * sqr(sinf(gamma_m)));
 
   integral += weight * D(beckmann, roughness, wm, wh) *
-  G(beckmann, roughness, wi, wo, wm, wh) * arc_length * J;
+  G(beckmann, roughness, wi, wo, wm, wh) * arc_length;
 }
   }
 
@@ -990,7 +975,6 @@ ccl_device float3 
bsdf_microfacet_hair_eval_tt_trt_elliptic(KernelGlobals kg,
   for (size_t i = 0; i < intervals; i++) {
 
 const float gamma_mi = gamma_m_min + i * res;
-const float J = fmaxf(cos(gamma_i - gamma_mi), 0.f);
 
 

[Bf-blender-cvs] [51759e65957] master: Fix T101130: Scaling of NLA Strip Via S Hotkey Not Working

2022-12-15 Thread Nate Rupsis
Commit: 51759e659579eb48181306ae1574d4dfdd4a4ed9
Author: Nate Rupsis
Date:   Tue Dec 13 08:09:08 2022 -0500
Branches: master
https://developer.blender.org/rB51759e659579eb48181306ae1574d4dfdd4a4ed9

Fix T101130: Scaling of NLA Strip Via S Hotkey Not Working

After switching over to using start_frame / end_frame, scaling an NLA strip 
didn't scale the strip, it just repeated the action.

Now withing the NLA transform code, we look for TFM_TIME_EXTEND / 
TFM_TIME_SCALE transform mode, and handle the update to strip scale accordingly

===

M   source/blender/blenkernel/intern/nla.c
M   source/blender/editors/transform/transform_convert_nla.c

===

diff --git a/source/blender/blenkernel/intern/nla.c 
b/source/blender/blenkernel/intern/nla.c
index ad8085be3d6..5cdfe98f2e0 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -973,21 +973,19 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
   oEnd = ((NlaStrip *)mstrip->strips.last)->end;
   offset = mstrip->start - oStart;
 
+  /* check if scale changed */
+  oLen = oEnd - oStart;
+  nLen = mstrip->end - mstrip->start;
+  scaleChanged = !IS_EQF(oLen, nLen);
+
   /* optimization:
* don't flush if nothing changed yet
* TODO: maybe we need a flag to say always flush?
*/
-  if (IS_EQF(oStart, mstrip->start) && IS_EQF(oEnd, mstrip->end)) {
+  if (IS_EQF(oStart, mstrip->start) && IS_EQF(oEnd, mstrip->end) && 
!scaleChanged) {
 return;
   }
 
-  /* check if scale changed */
-  oLen = oEnd - oStart;
-  nLen = mstrip->end - mstrip->start;
-  if (IS_EQF(nLen, oLen) == 0) {
-scaleChanged = 1;
-  }
-
   /* for each child-strip, calculate new start/end points based on this new 
info */
   for (strip = mstrip->strips.first; strip; strip = strip->next) {
 if (scaleChanged) {
@@ -1001,6 +999,12 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
* then wait for second pass to flush scale properly. */
   strip->start = (p1 * nLen) + mstrip->start;
   strip->end = (p2 * nLen) + mstrip->start;
+
+  // Recompute the playback scale, given the new start & end frame of the 
strip.
+  const double action_len = strip->actend - strip->actstart;
+  const double repeated_len = action_len * strip->repeat;
+  const double strip_len = strip->end - strip->start;
+  strip->scale = strip_len / repeated_len;
 }
 else {
   /* just apply the changes in offset to both ends of the strip */
diff --git a/source/blender/editors/transform/transform_convert_nla.c 
b/source/blender/editors/transform/transform_convert_nla.c
index 830094ebe83..ab71fe42f07 100644
--- a/source/blender/editors/transform/transform_convert_nla.c
+++ b/source/blender/editors/transform/transform_convert_nla.c
@@ -76,6 +76,11 @@ static void applyTransformNLA_translation(PointerRNA 
*strip_rna_ptr, const Trans
   RNA_float_set(strip_rna_ptr, "frame_end", transdata->h2[0]);
 }
 
+static void applyTransformNLA_timeScale(PointerRNA *strip_rna_ptr, const float 
value)
+{
+  RNA_float_set(strip_rna_ptr, "scale", value);
+}
+
 /** \} */
 
 /*  */
@@ -204,6 +209,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
 tdn->h1[1] = yval;
 tdn->h2[0] = strip->end;
 tdn->h2[1] = yval;
+tdn->h1[2] = tdn->h2[2] = strip->scale;
 
 center[0] = (float)scene->r.cfra;
 center[1] = yval;
@@ -333,6 +339,8 @@ static void recalcData_nla(TransInfo *t)
 strip->next->start = tdn->h2[0];
   }
 
+  strip->scale = tdn->h1[2];
+
   /* flush transforms to child strips (since this should be a meta) */
   BKE_nlameta_flush_transforms(strip);
 
@@ -399,7 +407,24 @@ static void recalcData_nla(TransInfo *t)
  */
 RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &strip_ptr);
 
-applyTransformNLA_translation(&strip_ptr, tdn);
+switch (t->mode) {
+  case TFM_TIME_EXTEND:
+  case TFM_TIME_SCALE: {
+/* The final scale is the product of the original strip scale (from 
before the transform
+ * operation started) and the current scale value of this transform 
operation. */
+const float originalStripScale = tdn->h1[2];
+const float newStripScale = originalStripScale * t->values_final[0];
+applyTransformNLA_timeScale(&strip_ptr, newStripScale);
+applyTransformNLA_translation(&strip_ptr, tdn);
+break;
+  }
+  case TFM_TRANSLATION:
+applyTransformNLA_translation(&strip_ptr, tdn);
+break;
+  default:
+printf("recalcData_nla: unsupported NLA transformation mode %d\n", 
t->mode);
+continue;
+}
 
 /* flush transforms to child strips (since this should be a meta) */
 BKE_nlameta_flush_transforms(strip);

_

[Bf-blender-cvs] [5e384860a66] geometry-nodes-simulation: Merge branch 'master' into geometry-nodes-simulation

2022-12-15 Thread Jacques Lucke
Commit: 5e384860a6689f432a71d014fd40dee283e855a2
Author: Jacques Lucke
Date:   Thu Dec 15 13:29:14 2022 +0100
Branches: geometry-nodes-simulation
https://developer.blender.org/rB5e384860a6689f432a71d014fd40dee283e855a2

Merge branch 'master' into geometry-nodes-simulation

===



===



___
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] [19381673a80] temp-linux-35x-libs: More changes for new Linux libs * Remove unnecessary check for Blosc, this is part of OpenVDB lib now * Remove WITH_CXX11_ABI, always use new C++11

2022-12-15 Thread Brecht Van Lommel
Commit: 19381673a80ccf071de2615bca1ad331aafc9820
Author: Brecht Van Lommel
Date:   Thu Dec 15 13:18:27 2022 +0100
Branches: temp-linux-35x-libs
https://developer.blender.org/rB19381673a80ccf071de2615bca1ad331aafc9820

More changes for new Linux libs
* Remove unnecessary check for Blosc, this is part of OpenVDB lib now
* Remove WITH_CXX11_ABI, always use new C++11 ABI now
* Replace centos7 by glibc_228 everywhere

===

M   CMakeLists.txt
M   GNUmakefile
M   build_files/buildbot/config/blender_linux.cmake
M   build_files/cmake/platform/platform_unix.cmake
M   build_files/utils/make_update.py

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4de2454cfd8..74bfb23a3a4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -749,11 +749,6 @@ if("${CMAKE_GENERATOR}" MATCHES "Ninja")
   mark_as_advanced(WITH_NINJA_POOL_JOBS)
 endif()
 
-if(UNIX AND NOT APPLE)
-  option(WITH_CXX11_ABI "Use native C++11 ABI of compiler" ON)
-  mark_as_advanced(WITH_CXX11_ABI)
-endif()
-
 # Installation process.
 set(POSTINSTALL_SCRIPT "" CACHE FILEPATH "Run given CMake script after 
installation process")
 mark_as_advanced(POSTINSTALL_SCRIPT)
@@ -1721,12 +1716,6 @@ if(
   string(APPEND CMAKE_C_FLAGS " -std=gnu11")
 endif()
 
-if(UNIX AND NOT APPLE)
-  if(NOT WITH_CXX11_ABI)
-string(APPEND PLATFORM_CFLAGS " -D_GLIBCXX_USE_CXX11_ABI=0")
-  endif()
-endif()
-
 if(WITH_COMPILER_SHORT_FILE_MACRO)
   # Use '-fmacro-prefix-map' for Clang and GCC (MSVC doesn't support this).
   add_check_c_compiler_flag(C_PREFIX_MAP_FLAGS C_MACRO_PREFIX_MAP 
-fmacro-prefix-map=foo=bar)
diff --git a/GNUmakefile b/GNUmakefile
index 439b435f5f4..ba9ee978817 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -211,7 +211,7 @@ endif
 # Set the LIBDIR, an empty string when not found.
 LIBDIR:=$(wildcard ../lib/${OS_NCASE}_${CPU})
 ifeq (, $(LIBDIR))
-   LIBDIR:=$(wildcard ../lib/${OS_NCASE}_centos7_${CPU})
+   LIBDIR:=$(wildcard ../lib/${OS_NCASE}_${CPU}_glibc_228)
 endif
 ifeq (, $(LIBDIR))
LIBDIR:=$(wildcard ../lib/${OS_NCASE})
diff --git a/build_files/buildbot/config/blender_linux.cmake 
b/build_files/buildbot/config/blender_linux.cmake
index 078ad425124..ae7849002f7 100644
--- a/build_files/buildbot/config/blender_linux.cmake
+++ b/build_files/buildbot/config/blender_linux.cmake
@@ -7,7 +7,6 @@ 
include("${CMAKE_CURRENT_LIST_DIR}/../../cmake/config/blender_release.cmake")
 message(STATUS "Building in Rocky 8 Linux 64bit environment")
 
 set(LIBDIR_NAME "linux_x86_64_glibc_228")
-set(WITH_CXX11_ABI   OFF CACHE BOOL "" FORCE)
 
 #  Linux-specific build options 
 # Options which are specific to Linux-only platforms
diff --git a/build_files/cmake/platform/platform_unix.cmake 
b/build_files/cmake/platform/platform_unix.cmake
index bcc90cef7c2..00869414391 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -10,16 +10,15 @@ if(NOT DEFINED LIBDIR)
   string(TOLOWER ${LIBDIR_NAME} LIBDIR_NAME)
   set(LIBDIR_NATIVE_ABI ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_NAME})
 
-  # Path to precompiled libraries with known CentOS 7 ABI.
-  set(LIBDIR_CENTOS7_ABI ${CMAKE_SOURCE_DIR}/../lib/linux_centos7_x86_64)
+  # Path to precompiled libraries with known glibc 2.28 ABI.
+  set(LIBDIR_GLIBC228_ABI ${CMAKE_SOURCE_DIR}/../lib/linux_x86_64_glibc_228)
 
   # Choose the best suitable libraries.
   if(EXISTS ${LIBDIR_NATIVE_ABI})
 set(LIBDIR ${LIBDIR_NATIVE_ABI})
 set(WITH_LIBC_MALLOC_HOOK_WORKAROUND True)
-  elseif(EXISTS ${LIBDIR_CENTOS7_ABI})
-set(LIBDIR ${LIBDIR_CENTOS7_ABI})
-set(WITH_CXX11_ABI OFF)
+  elseif(EXISTS ${LIBDIR_GLIBC228_ABI})
+set(LIBDIR ${LIBDIR_GLIBC228_ABI})
 if(WITH_MEM_JEMALLOC)
   # jemalloc provides malloc hooks.
   set(WITH_LIBC_MALLOC_HOOK_WORKAROUND False)
@@ -30,7 +29,7 @@ if(NOT DEFINED LIBDIR)
 
   # Avoid namespace pollustion.
   unset(LIBDIR_NATIVE_ABI)
-  unset(LIBDIR_CENTOS7_ABI)
+  unset(LIBDIR_GLIBC228_ABI)
 endif()
 
 # Support restoring this value once pre-compiled libraries have been handled.
@@ -330,10 +329,8 @@ if(WITH_OPENVDB)
   find_package(OpenVDB)
   set_and_warn_library_found("OpenVDB" OPENVDB_FOUND WITH_OPENVDB)
 
-  if(OPENVDB_FOUND)
-  add_bundled_libraries(openvdb/lib)
-  find_package_wrapper(Blosc)
-set_and_warn_library_found("Blosc" BLOSC_FOUND WITH_OPENVDB_BLOSC)
+  if(WITH_OPENVDB)
+add_bundled_libraries(openvdb/lib)
   endif()
 endif()
 
diff --git a/build_files/utils/make_update.py b/build_files/utils/make_update.py
index 93820ee994a..fbadeecd597 100755
--- a/build_files/utils/make_update.py
+++ b/build_files/utils/make_update.py
@@ -41,7 +41,7 @@ def parse_arguments() -> argparse.Namespace:
 parser.add_argument("--svn-command", default="svn")
 parser.add_argument("--svn-branch", default=None)
 parser.add_argument("--git-command", 

[Bf-blender-cvs] [9fe1db1d2b4] master: GPencil: Fix potential memory leak

2022-12-15 Thread Antonio Vazquez
Commit: 9fe1db1d2b44854a6f98b2e213450fab34f8160a
Author: Antonio Vazquez
Date:   Thu Dec 15 13:08:46 2022 +0100
Branches: master
https://developer.blender.org/rB9fe1db1d2b44854a6f98b2e213450fab34f8160a

GPencil: Fix potential memory leak

If the layer was omitted there was a memory leak.

===

M   source/blender/editors/gpencil/gpencil_interpolate.c

===

diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c 
b/source/blender/editors/gpencil/gpencil_interpolate.c
index d4d072d7580..ad0f1f0dc34 100644
--- a/source/blender/editors/gpencil/gpencil_interpolate.c
+++ b/source/blender/editors/gpencil/gpencil_interpolate.c
@@ -486,21 +486,20 @@ static void gpencil_interpolate_set_points(bContext *C, 
tGPDinterpolate *tgpi)
   continue;
 }
 
-/* create temp data for each layer */
-tgpil = MEM_callocN(sizeof(tGPDinterpolate_layer), "GPencil Interpolate 
Layer");
-
-tgpil->gpl = gpl;
-bGPDframe *gpf = gpencil_get_previous_keyframe(gpl, scene->r.cfra, 
exclude_breakdowns);
-if (gpf == NULL) {
+bGPDframe *gpf_prv = gpencil_get_previous_keyframe(gpl, scene->r.cfra, 
exclude_breakdowns);
+if (gpf_prv == NULL) {
   continue;
 }
-tgpil->prevFrame = BKE_gpencil_frame_duplicate(gpf, true);
-
-gpf = gpencil_get_next_keyframe(gpl, scene->r.cfra, exclude_breakdowns);
-if (gpf == NULL) {
+bGPDframe *gpf_next = gpencil_get_next_keyframe(gpl, scene->r.cfra, 
exclude_breakdowns);
+if (gpf_next == NULL) {
   continue;
 }
-tgpil->nextFrame = BKE_gpencil_frame_duplicate(gpf, true);
+
+/* Create temp data for each layer. */
+tgpil = MEM_callocN(sizeof(tGPDinterpolate_layer), "GPencil Interpolate 
Layer");
+tgpil->gpl = gpl;
+tgpil->prevFrame = BKE_gpencil_frame_duplicate(gpf_prv, true);
+tgpil->nextFrame = BKE_gpencil_frame_duplicate(gpf_next, true);
 
 BLI_addtail(&tgpi->ilayers, tgpil);

___
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] [0e1440eefd9] master: Paint: Orbit around selection/stroke: remove redundant case

2022-12-15 Thread Philipp Oeser
Commit: 0e1440eefd98ef359ea83b465ada175364b1c4bf
Author: Philipp Oeser
Date:   Thu Dec 15 10:53:46 2022 +0100
Branches: master
https://developer.blender.org/rB0e1440eefd98ef359ea83b465ada175364b1c4bf

Paint: Orbit around selection/stroke: remove redundant case

Since rB8014180720d8, all paint modes support orbiting around last
stroke, so [a] the comment there is out of date and [b] the fallback
case of orbiting around the center will never be used (unless there is
no stroke information - but BKE_paint_stroke_get_average handles that
anyways).

Spotted while looking into T101766.

Maniphest Tasks: T101766

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

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_navigate.c 
b/source/blender/editors/space_view3d/view3d_navigate.c
index 047b48a72d9..ed0225f578b 100644
--- a/source/blender/editors/space_view3d/view3d_navigate.c
+++ b/source/blender/editors/space_view3d/view3d_navigate.c
@@ -174,19 +174,7 @@ bool view3d_orbit_calc_center(bContext *C, float 
r_dyn_ofs[3])
   if (ob_act && (ob_act->mode & OB_MODE_ALL_PAINT) &&
   /* with weight-paint + pose-mode, fall through to using 
calculateTransformCenter */
   ((ob_act->mode & OB_MODE_WEIGHT_PAINT) && 
BKE_object_pose_armature_get(ob_act)) == 0) {
-/* in case of sculpting use last average stroke position as a rotation
- * center, in other cases it's not clear what rotation center shall be
- * so just rotate around object origin
- */
-if (ob_act->mode &
-(OB_MODE_SCULPT | OB_MODE_TEXTURE_PAINT | OB_MODE_VERTEX_PAINT | 
OB_MODE_WEIGHT_PAINT)) {
-  float stroke[3];
-  BKE_paint_stroke_get_average(scene, ob_act_eval, stroke);
-  copy_v3_v3(lastofs, stroke);
-}
-else {
-  copy_v3_v3(lastofs, ob_act_eval->object_to_world[3]);
-}
+BKE_paint_stroke_get_average(scene, ob_act_eval, lastofs);
 is_set = true;
   }
   else if (ob_act && (ob_act->mode & OB_MODE_EDIT) && (ob_act->type == 
OB_FONT)) {

___
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] [c2e7bf39535] blender-v3.4-release: GPencil: Fix unreported interpolate crash in empty layers

2022-12-15 Thread Antonio Vazquez
Commit: c2e7bf395352d5745426de6c09945abb3a2e1a78
Author: Antonio Vazquez
Date:   Thu Dec 15 11:38:49 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rBc2e7bf395352d5745426de6c09945abb3a2e1a78

GPencil: Fix unreported interpolate crash in empty layers

If there is a layer that hasn't frames but is not the active layer
the pointer to frames can be NULL and crash.

Now, the empty layers are skipped.

Reported to me by Samuel Bernou.

===

M   source/blender/editors/gpencil/gpencil_interpolate.c

===

diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c 
b/source/blender/editors/gpencil/gpencil_interpolate.c
index cc25ed66b3d..9a5a3d5faea 100644
--- a/source/blender/editors/gpencil/gpencil_interpolate.c
+++ b/source/blender/editors/gpencil/gpencil_interpolate.c
@@ -479,15 +479,20 @@ static void gpencil_interpolate_set_points(bContext *C, 
tGPDinterpolate *tgpi)
   continue;
 }
 
-/* create temp data for each layer */
-tgpil = MEM_callocN(sizeof(tGPDinterpolate_layer), "GPencil Interpolate 
Layer");
+bGPDframe *gpf_prv = gpencil_get_previous_keyframe(gpl, scene->r.cfra);
+if (gpf_prv == NULL) {
+  continue;
+}
+bGPDframe *gpf_next = gpencil_get_next_keyframe(gpl, scene->r.cfra);
+if (gpf_next == NULL) {
+  continue;
+}
 
+/* Create temp data for each layer. */
+tgpil = MEM_callocN(sizeof(tGPDinterpolate_layer), "GPencil Interpolate 
Layer");
 tgpil->gpl = gpl;
-bGPDframe *gpf = gpencil_get_previous_keyframe(gpl, scene->r.cfra);
-tgpil->prevFrame = BKE_gpencil_frame_duplicate(gpf, true);
-
-gpf = gpencil_get_next_keyframe(gpl, scene->r.cfra);
-tgpil->nextFrame = BKE_gpencil_frame_duplicate(gpf, true);
+tgpil->prevFrame = BKE_gpencil_frame_duplicate(gpf_prv, true);
+tgpil->nextFrame = BKE_gpencil_frame_duplicate(gpf_next, true);
 
 BLI_addtail(&tgpi->ilayers, tgpil);

___
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] [e0ef5f36022] master: Fix T103234: GPencil applying armature does not work

2022-12-15 Thread Antonio Vazquez
Commit: e0ef5f360222148d52e68d820df499dd6da5ce8a
Author: Antonio Vazquez
Date:   Thu Dec 15 10:52:58 2022 +0100
Branches: master
https://developer.blender.org/rBe0ef5f360222148d52e68d820df499dd6da5ce8a

Fix T103234: GPencil applying armature does not work

The problem was the bake function was using the evaluated
data and must use the original data.

The problem was caused by commit: rBcff6eb65804d: Cleanup: Remove duplicate 
Bake modifier code.

Fix by Philipp Oeser

===

M   source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
index d99d9950efb..5163f4d7020 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
@@ -118,14 +118,12 @@ static void bakeModifier(Main *UNUSED(bmain),
  GpencilModifierData *md,
  Object *ob)
 {
-  Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
   ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)md;
-  GpencilModifierData *md_eval = 
BKE_gpencil_modifiers_findby_name(object_eval, md->name);
 
   if (mmd->object == NULL) {
 return;
   }
-  generic_bake_deform_stroke(depsgraph, md_eval, object_eval, true, 
deformStroke);
+  generic_bake_deform_stroke(depsgraph, md, ob, true, deformStroke);
 }
 
 static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))

___
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] [ba347d7c9e4] master: Fix Cycles UI for Scrambling Distance, only works with Tabulated Sobol.

2022-12-15 Thread Thomas Dinges
Commit: ba347d7c9e4ae53d98cce1231fc919591b3c5d81
Author: Thomas Dinges
Date:   Thu Dec 15 10:44:56 2022 +0100
Branches: master
https://developer.blender.org/rBba347d7c9e4ae53d98cce1231fc919591b3c5d81

Fix Cycles UI for Scrambling Distance, only works with Tabulated Sobol.

Thanks to Alaska for finding this.

===

M   intern/cycles/blender/addon/ui.py

===

diff --git a/intern/cycles/blender/addon/ui.py 
b/intern/cycles/blender/addon/ui.py
index d45d7afb16f..6ac97a32f61 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -370,7 +370,7 @@ class 
CYCLES_RENDER_PT_sampling_advanced(CyclesButtonsPanel, Panel):
 layout.separator()
 
 heading = layout.column(align=True, heading="Scrambling Distance")
-heading.active = cscene.sampling_pattern != 'TABULATED_SOBOL'
+heading.active = cscene.sampling_pattern == 'TABULATED_SOBOL'
 heading.prop(cscene, "auto_scrambling_distance", text="Automatic")
 heading.prop(cscene, "preview_scrambling_distance", text="Viewport")
 heading.prop(cscene, "scrambling_distance", text="Multiplier")

___
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] [69d1ddd4c64] master: Fix Cycles Light Tree UI after recent changes.

2022-12-15 Thread Thomas Dinges
Commit: 69d1ddd4c64056048a8d71fe7db5f878cefe4614
Author: Thomas Dinges
Date:   Thu Dec 15 10:25:06 2022 +0100
Branches: master
https://developer.blender.org/rB69d1ddd4c64056048a8d71fe7db5f878cefe4614

Fix Cycles Light Tree UI after recent changes.

===

M   intern/cycles/blender/addon/ui.py

===

diff --git a/intern/cycles/blender/addon/ui.py 
b/intern/cycles/blender/addon/ui.py
index 4746790aae8..d45d7afb16f 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -395,9 +395,13 @@ class CYCLES_RENDER_PT_sampling_lights(CyclesButtonsPanel, 
Panel):
 
 def draw(self, context):
 layout = self.layout
+layout.use_property_split = True
+layout.use_property_decorate = False
+
 scene = context.scene
 cscene = scene.cycles
 
+col = layout.column(align=True)
 col.prop(cscene, "use_light_tree")
 sub = col.row()
 sub.prop(cscene, "light_sampling_threshold", text="Light Threshold")

___
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