[Bf-blender-cvs] [89303959127] master: Fix T101765: Curves sculptmode: object origin and 3D cursor are visible

2022-12-13 Thread Philipp Oeser
Commit: 893039591270ad6989a5450286f82b6604ce69f6
Author: Philipp Oeser
Date:   Tue Dec 13 15:40:18 2022 +0100
Branches: master
https://developer.blender.org/rB893039591270ad6989a5450286f82b6604ce69f6

Fix T101765: Curves sculptmode: object origin and 3D cursor are visible

This is because OB_MODE_SCULPT_CURVES is not part of OB_MODE_ALL_PAINT
(yet). While there is some chance it ends up there, there are a lot of
more places that need checking and so patch only fixes the report very
isolated.

NOTE: T93501 is related (since the option to show these should also be
hidden in sculptmode)

Maniphest Tasks: T101765

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

===

M   source/blender/draw/engines/overlay/overlay_extra.cc
M   source/blender/draw/intern/draw_view.c

===

diff --git a/source/blender/draw/engines/overlay/overlay_extra.cc 
b/source/blender/draw/engines/overlay/overlay_extra.cc
index 48dfb027545..3363a94a38f 100644
--- a/source/blender/draw/engines/overlay/overlay_extra.cc
+++ b/source/blender/draw/engines/overlay/overlay_extra.cc
@@ -1552,7 +1552,8 @@ void OVERLAY_extra_cache_populate(OVERLAY_Data *vedata, 
Object *ob)
 
   const bool is_select_mode = DRW_state_is_select();
   const bool is_paint_mode = (draw_ctx->object_mode &
-  (OB_MODE_ALL_PAINT | OB_MODE_ALL_PAINT_GPENCIL)) 
!= 0;
+  (OB_MODE_ALL_PAINT | OB_MODE_ALL_PAINT_GPENCIL |
+   OB_MODE_SCULPT_CURVES)) != 0;
   const bool from_dupli = (ob->base_flag & (BASE_FROM_SET | BASE_FROM_DUPLI)) 
!= 0;
   const bool has_bounds = !ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_EMPTY, 
OB_SPEAKER, OB_LIGHTPROBE);
   const bool has_texspace = has_bounds &&
diff --git a/source/blender/draw/intern/draw_view.c 
b/source/blender/draw/intern/draw_view.c
index 35ff8891a0f..269942edaf8 100644
--- a/source/blender/draw/intern/draw_view.c
+++ b/source/blender/draw/intern/draw_view.c
@@ -59,7 +59,7 @@ static bool is_cursor_visible(const DRWContextState 
*draw_ctx, Scene *scene, Vie
   }
 
   /* don't draw cursor in paint modes, but with a few exceptions */
-  if (draw_ctx->object_mode & OB_MODE_ALL_PAINT) {
+  if ((draw_ctx->object_mode & (OB_MODE_ALL_PAINT | OB_MODE_SCULPT_CURVES)) != 
0) {
 /* exception: object is in weight paint and has deforming armature in pose 
mode */
 if (draw_ctx->object_mode & OB_MODE_WEIGHT_PAINT) {
   if (BKE_object_pose_armature_get(draw_ctx->obact) != NULL) {

___
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] [4263919270d] master: Build: fix building FFMPEG on Linux

2022-12-13 Thread Campbell Barton
Commit: 4263919270de7bbb5ebb03101b3a3442d4551736
Author: Campbell Barton
Date:   Wed Dec 14 17:47:29 2022 +1100
Branches: master
https://developer.blender.org/rB4263919270de7bbb5ebb03101b3a3442d4551736

Build: fix building FFMPEG on Linux

PKG_CONFIG_PATH wasn't set properly on Linux.

Also wrap long lines for better readability.

===

M   build_files/build_environment/cmake/ffmpeg.cmake

===

diff --git a/build_files/build_environment/cmake/ffmpeg.cmake 
b/build_files/build_environment/cmake/ffmpeg.cmake
index e2b60e161f2..41f8e16b913 100644
--- a/build_files/build_environment/cmake/ffmpeg.cmake
+++ b/build_files/build_environment/cmake/ffmpeg.cmake
@@ -1,9 +1,55 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 
-set(FFMPEG_CFLAGS "-I${mingw_LIBDIR}/lame/include 
-I${mingw_LIBDIR}/openjpeg/include/ -I${mingw_LIBDIR}/ogg/include 
-I${mingw_LIBDIR}/vorbis/include -I${mingw_LIBDIR}/theora/include 
-I${mingw_LIBDIR}/opus/include -I${mingw_LIBDIR}/vpx/include 
-I${mingw_LIBDIR}/x264/include -I${mingw_LIBDIR}/xvidcore/include 
-I${mingw_LIBDIR}/zlib/include -I${mingw_LIBDIR}/aom/include")
-set(FFMPEG_LDFLAGS "-L${mingw_LIBDIR}/lame/lib -L${mingw_LIBDIR}/openjpeg/lib 
-L${mingw_LIBDIR}/ogg/lib -L${mingw_LIBDIR}/vorbis/lib 
-L${mingw_LIBDIR}/theora/lib -L${mingw_LIBDIR}/opus/lib 
-L${mingw_LIBDIR}/vpx/lib -L${mingw_LIBDIR}/x264/lib 
-L${mingw_LIBDIR}/xvidcore/lib -L${mingw_LIBDIR}/zlib/lib 
-L${mingw_LIBDIR}/aom/lib")
-set(FFMPEG_EXTRA_FLAGS --pkg-config-flags=--static 
--extra-cflags=${FFMPEG_CFLAGS} --extra-ldflags=${FFMPEG_LDFLAGS})
-set(FFMPEG_ENV 
PKG_CONFIG_PATH=${mingw_LIBDIR}/openjpeg/lib/pkgconfig:${mingw_LIBDIR}/x264/lib/pkgconfig:${mingw_LIBDIR}/vorbis/lib/pkgconfig:${mingw_LIBDIR}/ogg/lib/pkgconfig:${mingw_LIBDIR}:${mingw_LIBDIR}/vpx/lib/pkgconfig:${mingw_LIBDIR}/theora/lib/pkgconfig:${mingw_LIBDIR}/openjpeg/lib/pkgconfig:${mingw_LIBDIR}/opus/lib/pkgconfig:${mingw_LIBDIR}/aom/lib/pkgconfig:)
+if(WIN32)
+  set(temp_LIBDIR ${mingw_LIBDIR})
+else()
+  set(temp_LIBDIR ${LIBDIR})
+endif()
+
+set(FFMPEG_CFLAGS "\
+-I${temp_LIBDIR}/lame/include \
+-I${temp_LIBDIR}/openjpeg/include/ \
+-I${temp_LIBDIR}/ogg/include \
+-I${temp_LIBDIR}/vorbis/include \
+-I${temp_LIBDIR}/theora/include \
+-I${temp_LIBDIR}/opus/include \
+-I${temp_LIBDIR}/vpx/include \
+-I${temp_LIBDIR}/x264/include \
+-I${temp_LIBDIR}/xvidcore/include \
+-I${temp_LIBDIR}/zlib/include \
+-I${temp_LIBDIR}/aom/include"
+)
+set(FFMPEG_LDFLAGS "\
+-L${temp_LIBDIR}/lame/lib \
+-L${temp_LIBDIR}/openjpeg/lib \
+-L${temp_LIBDIR}/ogg/lib \
+-L${temp_LIBDIR}/vorbis/lib \
+-L${temp_LIBDIR}/theora/lib \
+-L${temp_LIBDIR}/opus/lib \
+-L${temp_LIBDIR}/vpx/lib \
+-L${temp_LIBDIR}/x264/lib \
+-L${temp_LIBDIR}/xvidcore/lib \
+-L${temp_LIBDIR}/zlib/lib \
+-L${temp_LIBDIR}/aom/lib"
+)
+set(FFMPEG_EXTRA_FLAGS
+  --pkg-config-flags=--static
+  --extra-cflags=${FFMPEG_CFLAGS}
+  --extra-ldflags=${FFMPEG_LDFLAGS}
+)
+set(FFMPEG_ENV "PKG_CONFIG_PATH=\
+${temp_LIBDIR}/openjpeg/lib/pkgconfig:\
+${temp_LIBDIR}/x264/lib/pkgconfig:\
+${temp_LIBDIR}/vorbis/lib/pkgconfig:\
+${temp_LIBDIR}/ogg/lib/pkgconfig:\
+${temp_LIBDIR}/vpx/lib/pkgconfig:\
+${temp_LIBDIR}/theora/lib/pkgconfig:\
+${temp_LIBDIR}/openjpeg/lib/pkgconfig:\
+${temp_LIBDIR}/opus/lib/pkgconfig:\
+${temp_LIBDIR}/aom/lib/pkgconfig"
+)
+
+unset(temp_LIBDIR)
 
 if(WIN32)
   set(FFMPEG_ENV set ${FFMPEG_ENV} &&)

___
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] [fd36221930e] master: GHOST/Wayland: fix memory leak when Wayland fails to start

2022-12-13 Thread Campbell Barton
Commit: fd36221930e35efd2c09af8fb91234a510e3b9dc
Author: Campbell Barton
Date:   Wed Dec 14 17:09:55 2022 +1100
Branches: master
https://developer.blender.org/rBfd36221930e35efd2c09af8fb91234a510e3b9dc

GHOST/Wayland: fix memory leak when Wayland fails to start

===

M   intern/ghost/intern/GHOST_SystemWayland.cpp

===

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 0c292adb044..6bc07fed10c 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -5316,7 +5316,7 @@ GHOST_SystemWayland::GHOST_SystemWayland(bool background)
   /* Connect to the Wayland server. */
   display_->wl_display = wl_display_connect(nullptr);
   if (!display_->wl_display) {
-gwl_display_destroy(display_);
+this->~GHOST_SystemWayland();
 throw std::runtime_error("Wayland: unable to connect to display!");
   }
 
@@ -5360,7 +5360,7 @@ GHOST_SystemWayland::GHOST_SystemWayland(bool background)
   "WAYLAND found but libdecor was not, install libdecor for 
Wayland support, "
   "falling back to X11\n");
 #  endif
-  gwl_display_destroy(display_);
+  this->~GHOST_SystemWayland();
   throw std::runtime_error("Wayland: unable to find libdecor!");
 
   use_libdecor = true;
@@ -5377,7 +5377,7 @@ GHOST_SystemWayland::GHOST_SystemWayland(bool background)
 GWL_LibDecor_System &decor = *display_->libdecor;
 decor.context = libdecor_new(display_->wl_display, &libdecor_interface);
 if (!decor.context) {
-  gwl_display_destroy(display_);
+  this->~GHOST_SystemWayland();
   throw std::runtime_error("Wayland: unable to create window 
decorations!");
 }
   }
@@ -5388,7 +5388,7 @@ GHOST_SystemWayland::GHOST_SystemWayland(bool background)
   {
 GWL_XDG_Decor_System &decor = *display_->xdg_decor;
 if (!decor.shell) {
-  gwl_display_destroy(display_);
+  this->~GHOST_SystemWayland();
   throw std::runtime_error("Wayland: unable to access xdg_shell!");
 }
   }

___
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] [b848de75462] master: Fix T102213: Invalid font size in the image editor with some scripts

2022-12-13 Thread nutti
Commit: b848de754621ccbf2e2960919699df796413f2c7
Author: nutti
Date:   Wed Dec 14 15:40:53 2022 +1100
Branches: master
https://developer.blender.org/rBb848de754621ccbf2e2960919699df796413f2c7

Fix T102213: Invalid font size in the image editor with some scripts

The size could be left at an unexpected value by scripts, causing
the wrong size to be shown.

Ref D16493

===

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

===

diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index a62e027ba03..af97b37acc1 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -3531,6 +3531,9 @@ void ED_region_info_draw_multiline(ARegion *region,
   /* background box */
   rcti rect = *ED_region_visible_rect(region);
 
+  /* Needed in case scripts leave the font size at an unexpected value, see: 
T102213. */
+  BLF_size(fontid, style->widget.points * U.dpi_fac);
+
   /* Box fill entire width or just around text. */
   if (!full_redraw) {
 const char **text = &text_array[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] [ad39c0f3121] master: Build: add missing library to the linux-rocky8-setup.sh script

2022-12-13 Thread Campbell Barton
Commit: ad39c0f31218b5a977dd32817f216851b6560427
Author: Campbell Barton
Date:   Wed Dec 14 15:23:47 2022 +1100
Branches: master
https://developer.blender.org/rBad39c0f31218b5a977dd32817f216851b6560427

Build: add missing library to the linux-rocky8-setup.sh script

===

M   build_files/build_environment/linux/linux-rocky8-setup.sh

===

diff --git a/build_files/build_environment/linux/linux-rocky8-setup.sh 
b/build_files/build_environment/linux/linux-rocky8-setup.sh
index a1696ad5ccc..7be07b40a3e 100644
--- a/build_files/build_environment/linux/linux-rocky8-setup.sh
+++ b/build_files/build_environment/linux/linux-rocky8-setup.sh
@@ -81,6 +81,7 @@ PACKAGES_FOR_LIBS=(
 # NOTE(@campbellbarton): while `python39` is available, the default Python 
version is 3.6.
 # This is used for the `python3-mako` package for e.g.
 # So use the "default" system Python since it means it's most compatible 
with other packages.
+python3
 
 # Required by: `mesa`.
 expat-devel
@@ -89,8 +90,11 @@ PACKAGES_FOR_LIBS=(
 bison
 # Required by: `external_osl` as a build-time dependency.
 flex
+
 # Required by: `external_ispc`.
 ncurses-devel
+# Required by: `external_ispc` (when building with CLANG).
+libstdc++-static
 )
 
 # Additional packages needed for building Blender.

___
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] [396816faacf] master: Libs: bump libspnav to 1.1

2022-12-13 Thread Campbell Barton
Commit: 396816faacf349a04edda2ef2e714b4a505bc0cf
Author: Campbell Barton
Date:   Wed Dec 14 15:10:34 2022 +1100
Branches: master
https://developer.blender.org/rB396816faacf349a04edda2ef2e714b4a505bc0cf

Libs: bump libspnav to 1.1

Version 0.2.3 doesn't include the fix needed for space-mouse enterprise,
see T101866.

===

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 870f2da9abe..b27dcb4fa4e 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -369,9 +369,9 @@ set(WEBP_HASH_TYPE MD5)
 set(WEBP_FILE libwebp-${WEBP_VERSION}.tar.gz)
 set(WEBP_CPE "cpe:2.3:a:webmproject:libwebp:${WEBP_VERSION}:*:*:*:*:*:*:*")
 
-set(SPNAV_VERSION 0.2.3)
-set(SPNAV_URI 
http://downloads.sourceforge.net/project/spacenav/spacenav%20library%20%28SDK%29/libspnav%20${SPNAV_VERSION}/libspnav-${SPNAV_VERSION}.tar.gz)
-set(SPNAV_HASH 44d840540d53326d4a119c0f1aa7bf0a)
+set(SPNAV_VERSION 1.1)
+set(SPNAV_URI 
https://github.com/FreeSpacenav/libspnav/releases/download/v${SPNAV_VERSION}/libspnav-${SPNAV_VERSION}.tar.gz)
+set(SPNAV_HASH 7c0032034672dfba3c4bb9b49a440e70)
 set(SPNAV_HASH_TYPE MD5)
 set(SPNAV_FILE libspnav-${SPNAV_VERSION}.tar.gz)

___
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] [491fc5cacea] master: Build: disable X11 support for spnav on Linux

2022-12-13 Thread Campbell Barton
Commit: 491fc5cacead98b1979560b752c0bd9ab0327519
Author: Campbell Barton
Date:   Wed Dec 14 14:57:13 2022 +1100
Branches: master
https://developer.blender.org/rB491fc5cacead98b1979560b752c0bd9ab0327519

Build: disable X11 support for spnav on Linux

This prevented building Blender without X11 (Wayland only).

===

M   build_files/build_environment/cmake/spnav.cmake

===

diff --git a/build_files/build_environment/cmake/spnav.cmake 
b/build_files/build_environment/cmake/spnav.cmake
index 33a262cbc86..12b904866df 100644
--- a/build_files/build_environment/cmake/spnav.cmake
+++ b/build_files/build_environment/cmake/spnav.cmake
@@ -5,7 +5,20 @@ ExternalProject_Add(external_spnav
   DOWNLOAD_DIR ${DOWNLOAD_DIR}
   URL_HASH ${SPNAV_HASH_TYPE}=${SPNAV_HASH}
   PREFIX ${BUILD_DIR}/spnav
-  CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd 
${BUILD_DIR}/spnav/src/external_spnav/ && ${CONFIGURE_COMMAND} 
--prefix=${LIBDIR}/spnav --disable-shared --enable-static --with-pic
+
+  CONFIGURE_COMMAND
+  ${CONFIGURE_ENV} &&
+  cd ${BUILD_DIR}/spnav/src/external_spnav/ &&
+  ${CONFIGURE_COMMAND}
+  --prefix=${LIBDIR}/spnav
+  # X11 is not needed as Blender polls the device as part of the GHOST event 
loop.
+  # This is used to support `3dxserv`, however this is no longer supported by 
3DCONNEXION.
+  # Disable so building without X11 is supported (WAYLAND only).
+  --disable-x11
+  --disable-shared
+  --enable-static
+  --with-pic
+
   BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/spnav/src/external_spnav/ 
&& make -j${MAKE_THREADS}
   INSTALL_COMMAND ${CONFIGURE_ENV} && cd 
${BUILD_DIR}/spnav/src/external_spnav/ && make install
   INSTALL_DIR ${LIBDIR}/spnav

___
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] [1324db0ad15] master: Cleanup: cmake indentation

2022-12-13 Thread Campbell Barton
Commit: 1324db0ad154f1006c772bd1bbed173cfe80bb5d
Author: Campbell Barton
Date:   Wed Dec 14 14:21:51 2022 +1100
Branches: master
https://developer.blender.org/rB1324db0ad154f1006c772bd1bbed173cfe80bb5d

Cleanup: cmake indentation

===

M   build_files/build_environment/cmake/cve_check.cmake
M   build_files/build_environment/cmake/download.cmake
M   build_files/build_environment/cmake/freetype.cmake
M   build_files/build_environment/cmake/gmp.cmake
M   build_files/build_environment/cmake/harvest.cmake
M   build_files/build_environment/cmake/ispc.cmake
M   build_files/build_environment/cmake/opencolorio.cmake
M   build_files/build_environment/cmake/openjpeg.cmake
M   build_files/build_environment/cmake/openpgl.cmake
M   build_files/build_environment/cmake/potrace.cmake
M   build_files/build_environment/cmake/pthreads.cmake
M   build_files/build_environment/cmake/sndfile.cmake
M   build_files/build_environment/cmake/yamlcpp.cmake

===

diff --git a/build_files/build_environment/cmake/cve_check.cmake 
b/build_files/build_environment/cmake/cve_check.cmake
index ac42444aef1..941b6b0cae9 100644
--- a/build_files/build_environment/cmake/cve_check.cmake
+++ b/build_files/build_environment/cmake/cve_check.cmake
@@ -26,13 +26,13 @@ set(SBOMCONTENTS)
 get_cmake_property(_variableNames VARIABLES)
 foreach (_variableName ${_variableNames})
   if(_variableName MATCHES "CPE$")
-  string(REPLACE ":" ";" CPE_LIST ${${_variableName}})
-  string(REPLACE "_CPE" "_ID" CPE_DEPNAME ${_variableName})
-  list(GET CPE_LIST 3 CPE_VENDOR)
-  list(GET CPE_LIST 4 CPE_NAME)
-  list(GET CPE_LIST 5 CPE_VERSION)
-  set(${CPE_DEPNAME} "${CPE_VENDOR},${CPE_NAME},${CPE_VERSION}")
-  set(SBOMCONTENTS 
"${SBOMCONTENTS}${CPE_VENDOR},${CPE_NAME},${CPE_VERSION},,,\n")
+string(REPLACE ":" ";" CPE_LIST ${${_variableName}})
+string(REPLACE "_CPE" "_ID" CPE_DEPNAME ${_variableName})
+list(GET CPE_LIST 3 CPE_VENDOR)
+list(GET CPE_LIST 4 CPE_NAME)
+list(GET CPE_LIST 5 CPE_VERSION)
+set(${CPE_DEPNAME} "${CPE_VENDOR},${CPE_NAME},${CPE_VERSION}")
+set(SBOMCONTENTS 
"${SBOMCONTENTS}${CPE_VENDOR},${CPE_NAME},${CPE_VERSION},,,\n")
   endif()
 endforeach()
 configure_file(${CMAKE_SOURCE_DIR}/cmake/cve_check.csv.in 
${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv @ONLY)
diff --git a/build_files/build_environment/cmake/download.cmake 
b/build_files/build_environment/cmake/download.cmake
index a6fa82bceed..4f8ecc7d0ce 100644
--- a/build_files/build_environment/cmake/download.cmake
+++ b/build_files/build_environment/cmake/download.cmake
@@ -32,12 +32,13 @@ function(download_source dep)
   message("Checking source : ${dep} (${TARGET_FILE})")
   if(NOT EXISTS ${TARGET_FILE})
 message("Checking source : ${dep} - source not found downloading from 
${TARGET_URI}")
-file(DOWNLOAD ${TARGET_URI} ${TARGET_FILE}
- TIMEOUT 1800  # seconds
- EXPECTED_HASH ${TARGET_HASH_TYPE}=${TARGET_HASH}
- TLS_VERIFY ON
- SHOW_PROGRESS
-)
+file(
+  DOWNLOAD ${TARGET_URI} ${TARGET_FILE}
+  TIMEOUT 1800  # seconds
+  EXPECTED_HASH ${TARGET_HASH_TYPE}=${TARGET_HASH}
+  TLS_VERIFY ON
+  SHOW_PROGRESS
+)
   endif()
   if(EXISTS ${TARGET_FILE})
 # Sometimes the download fails, but that is not a
diff --git a/build_files/build_environment/cmake/freetype.cmake 
b/build_files/build_environment/cmake/freetype.cmake
index c0cb3c3401b..27aace7a115 100644
--- a/build_files/build_environment/cmake/freetype.cmake
+++ b/build_files/build_environment/cmake/freetype.cmake
@@ -32,9 +32,10 @@ add_dependencies(
 if(BUILD_MODE STREQUAL Release AND WIN32)
   ExternalProject_Add_Step(external_freetype after_install
 COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freetype 
${HARVEST_TARGET}/freetype
-   # harfbuzz *NEEDS* to find freetype.lib and will not be conviced to 
take alternative names so just give it
-   # what it wants. 
-   COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/freetype/lib/freetype2st.lib 
${LIBDIR}/freetype/lib/freetype.lib
+ # harfbuzz *NEEDS* to find freetype.lib and will not be conviced to 
take alternative names so just give it
+ # what it wants.
+ COMMAND ${CMAKE_COMMAND} -E copy 
${LIBDIR}/freetype/lib/freetype2st.lib ${LIBDIR}/freetype/lib/freetype.lib
+
 DEPENDEES install
   )
 endif()
diff --git a/build_files/build_environment/cmake/gmp.cmake 
b/build_files/build_environment/cmake/gmp.cmake
index ddfdba6662d..df4d20fb934 100644
--- a/build_files/build_environment/cmake/gmp.cmake
+++ b/build_files/build_environment/cmake/gmp.cmake
@@ -40,19 +40,21 @@ endif()
 
 if(BUILD_MODE STREQUAL Release AND WIN32)
   ExternalProject_Add_Step(external_gmp after_install
-  COMMAND  ${CMAKE_COMMAND} -E copy 
${BUILD_DIR}/gmp/src/external_gmp/.libs/

[Bf-blender-cvs] [5025a3833ab] master: CMake: fix build error on Linux where MAN page generation failed

2022-12-13 Thread Campbell Barton
Commit: 5025a3833abcdf35530dba30786afc10d1e814dd
Author: Campbell Barton
Date:   Wed Dec 14 14:12:05 2022 +1100
Branches: master
https://developer.blender.org/rB5025a3833abcdf35530dba30786afc10d1e814dd

CMake: fix build error on Linux where MAN page generation failed

Move man-page generation to an install step to ensure the shared
libraries have been copied before running Blender.

===

M   source/creator/CMakeLists.txt

===

diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 82a37614841..3ecea7c5929 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -562,19 +562,6 @@ endmacro()
 
 if(UNIX AND NOT APPLE)
 
-  if(NOT WITH_PYTHON_MODULE)
-if(WITH_DOC_MANPAGE)
-  add_custom_target(
-blender_man_page ALL
-COMMAND
-  ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1.py
-  --blender ${EXECUTABLE_OUTPUT_PATH}/blender
-  --output ${CMAKE_CURRENT_BINARY_DIR}/blender.1
-  )
-  add_dependencies(blender_man_page blender)
-endif()
-  endif()
-
   if(PLATFORM_BUNDLED_LIBRARIES AND TARGETDIR_LIB)
 install(
   FILES ${PLATFORM_BUNDLED_LIBRARIES}
@@ -603,12 +590,6 @@ if(UNIX AND NOT APPLE)
   DESTINATION "."
 )
 
-if(WITH_DOC_MANPAGE)
-  install(
-FILES ${CMAKE_CURRENT_BINARY_DIR}/blender.1
-DESTINATION "."
-  )
-endif()
 install(
   FILES
 ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
@@ -655,13 +636,6 @@ if(UNIX AND NOT APPLE)
   TARGETS blender
   DESTINATION bin
 )
-if(WITH_DOC_MANPAGE)
-  # Manual page (only with `blender` binary).
-  install(
-FILES ${CMAKE_CURRENT_BINARY_DIR}/blender.1
-DESTINATION share/man/man1
-  )
-endif()
 
 # Misc files.
 install(
@@ -1677,6 +1651,42 @@ if(WIN32)
   windows_generate_shared_manifest()
 endif()
 
+# -
+# Steps that Run Blender
+#
+# As executing Blender is needed - it's important this operation runs after 
the shared
+# libraries have been installed to their destination.
+
+if(UNIX AND NOT APPLE)
+  if(NOT WITH_PYTHON_MODULE)
+if(WITH_DOC_MANPAGE)
+  install(
+CODE "\
+execute_process(\
+  COMMAND \
+  \"${CMAKE_SOURCE_DIR}/doc/manpage/blender.1.py\" \
+  --blender \"${EXECUTABLE_OUTPUT_PATH}/blender\" \
+  --output \"${CMAKE_CURRENT_BINARY_DIR}/blender.1\"\
+)"
+DEPENDS blender
+  )
+
+  if(WITH_INSTALL_PORTABLE)
+install(
+  FILES ${CMAKE_CURRENT_BINARY_DIR}/blender.1
+  DESTINATION "."
+)
+  else()
+# Manual page (only with `blender` binary).
+install(
+  FILES ${CMAKE_CURRENT_BINARY_DIR}/blender.1
+  DESTINATION share/man/man1
+)
+  endif()
+endif()
+  endif()
+endif()
+
 # -
 # Post-install script

___
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] [4710582f8f3] master: UI: Fix typo in 'CONSTRAINT_SPACE_PARLOCAL' description

2022-12-13 Thread Ian Karanja
Commit: 4710582f8f37137fb1334c9f4b99ade1bb9f089a
Author: Ian Karanja
Date:   Tue Dec 13 21:51:20 2022 -0500
Branches: master
https://developer.blender.org/rB4710582f8f37137fb1334c9f4b99ade1bb9f089a

UI: Fix typo in 'CONSTRAINT_SPACE_PARLOCAL' description

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

===

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

===

diff --git a/source/blender/makesrna/intern/rna_object_api.c 
b/source/blender/makesrna/intern/rna_object_api.c
index 3d4d72cefaf..9c62fd241e0 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -40,7 +40,7 @@ static const EnumPropertyItem space_items[] = {
  "LOCAL_WITH_PARENT",
  0,
  "Local With Parent",
- "The rest pose local space of a bone (thus matrix includes parent 
transforms)"},
+ "The rest pose local space of a bone (this matrix includes parent 
transforms)"},
 {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space", "The local space of an 
object/bone"},
 {0, NULL, 0, NULL, NULL},
 };

___
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] [93a629f1478] master: Fix T103119: Allow Win32 Diacritical Composition

2022-12-13 Thread Harley Acheson
Commit: 93a629f14781a920a785c08555e04fbea47b5ac0
Author: Harley Acheson
Date:   Tue Dec 13 18:30:20 2022 -0800
Branches: master
https://developer.blender.org/rB93a629f14781a920a785c08555e04fbea47b5ac0

Fix T103119: Allow Win32 Diacritical Composition

Allow keyboard layouts which include "dead keys" to enter diacritics
by calling MapVirtualKeyW even when not key_down.

See D16770 for more details.

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

Reviewed by Campbell Barton

===

M   intern/ghost/intern/GHOST_SystemWin32.cpp

===

diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp 
b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 7aef23b39b6..75a4cc8389a 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -1210,16 +1210,16 @@ GHOST_EventKey 
*GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA
 const bool ctrl_pressed = has_state && state[VK_CONTROL] & 0x80;
 const bool alt_pressed = has_state && state[VK_MENU] & 0x80;
 
-if (!key_down) {
-  /* Pass. */
-}
+/* We can be here with !key_down if processing dead keys (diacritics). See 
T103119. */
+
 /* No text with control key pressed (Alt can be used to insert special 
characters though!). */
-else if (ctrl_pressed && !alt_pressed) {
+if (ctrl_pressed && !alt_pressed) {
   /* Pass. */
 }
 /* Don't call #ToUnicodeEx on dead keys as it clears the buffer and so 
won't allow diacritical
- * composition. */
-else if (MapVirtualKeyW(vk, 2) != 0) {
+ * composition. XXX: we are not checking return of MapVirtualKeyW for high 
bit set, which is
+ * what is supposed to indicate dead keys. But this is working now so 
approach cautiously. */
+else if (MapVirtualKeyW(vk, MAPVK_VK_TO_CHAR) != 0) {
   wchar_t utf16[3] = {0};
   int r;
   /* TODO: #ToUnicodeEx can respond with up to 4 utf16 chars (only 2 here).
@@ -1234,6 +1234,10 @@ GHOST_EventKey 
*GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA
   utf8_char[0] = '\0';
 }
   }
+  if (!key_down) {
+/* Clear or wm_event_add_ghostevent will warn of unexpected data on 
key up. */
+utf8_char[0] = '\0';
+  }
 }
 
 #ifdef WITH_INPUT_IME

___
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] [76aba51a219] master: Build: update centos7 script to run on rocky8

2022-12-13 Thread Campbell Barton
Commit: 76aba51a219560a8796bae171f1e31ebccf072e4
Author: Campbell Barton
Date:   Fri Dec 9 12:55:38 2022 +1100
Branches: master
https://developer.blender.org/rB76aba51a219560a8796bae171f1e31ebccf072e4

Build: update centos7 script to run on rocky8

===

R064build_files/build_environment/linux/linux-centos7-setup.sh  
build_files/build_environment/linux/linux-rocky8-setup.sh

===

diff --git a/build_files/build_environment/linux/linux-centos7-setup.sh 
b/build_files/build_environment/linux/linux-rocky8-setup.sh
similarity index 64%
rename from build_files/build_environment/linux/linux-centos7-setup.sh
rename to build_files/build_environment/linux/linux-rocky8-setup.sh
index e664f530edb..a1696ad5ccc 100644
--- a/build_files/build_environment/linux/linux-centos7-setup.sh
+++ b/build_files/build_environment/linux/linux-rocky8-setup.sh
@@ -11,19 +11,25 @@ if [ `id -u` -ne 0 ]; then
exit 1
 fi
 
+# Packages `ninja-build` and `meson` are not available unless CBR or 
PowerTools repositories are enabled.
+# See: https://wiki.rockylinux.org/rocky/repo/#notes-on-unlisted-repositories
+dnf config-manager --set-enabled powertools
+
 # yum-config-manager does not come in the default minimal install,
 # so make sure it is installed and available.
 yum -y update
 yum -y install yum-utils
 
-# Install all the packages needed for a new toolchain.
+# Install all the packages needed for a new tool-chain.
 #
 # NOTE: Keep this separate from the packages install, since otherwise
-# older toolchain will be installed.
+# older tool-chain will be installed.
 yum -y update
-yum -y install epel-release
-yum -y install centos-release-scl
-yum -y install devtoolset-9
+yum -y install scl-utils
+yum -y install scl-utils-build
+
+# Currently this is defined by the VFX platform (CY2023), see: 
https://vfxplatform.com
+yum -y install gcc-toolset-11
 
 # Install packages needed for Blender's dependencies.
 PACKAGES_FOR_LIBS=(
@@ -47,19 +53,12 @@ PACKAGES_FOR_LIBS=(
 automake
 libtool
 
-# Meta-build system used by various packages.
-meson
+# TODO: why is this needed?
+patchelf
+
 # Builds generated by meson use Ninja for the actual build.
 ninja-build
 
-# Required by Blender build option: `WITH_GHOST_X11`.
-libXrandr-devel
-libXinerama-devel
-libXcursor-devel
-libXi-devel
-libX11-devel
-libXt-devel
-
 # Required by Blender build option: `WITH_GHOST_WAYLAND`.
 mesa-libEGL-devel
 # Required by: Blender & `external_opensubdiv` (probably others).
@@ -79,16 +78,18 @@ PACKAGES_FOR_LIBS=(
 # Why are both needed?
 yasm
 
-# Required by: `meson` (Python based build system).
-python36
-# Required by: `mako` (Python module used for building `external_mesa`)
-python-setuptools
+# NOTE(@campbellbarton): while `python39` is available, the default Python 
version is 3.6.
+# This is used for the `python3-mako` package for e.g.
+# So use the "default" system Python since it means it's most compatible 
with other packages.
+
+# Required by: `mesa`.
+expat-devel
 
 # Required by: `external_igc` & `external_osl` as a build-time dependency.
 bison
 # Required by: `external_osl` as a build-time dependency.
 flex
-# TODO: dependencies build without this, consider removal.
+# Required by: `external_ispc`.
 ncurses-devel
 )
 
@@ -96,35 +97,22 @@ PACKAGES_FOR_LIBS=(
 PACKAGES_FOR_BLENDER=(
 # Required by Blender build option: `WITH_GHOST_WAYLAND`.
 libxkbcommon-devel
+
+# Required by Blender build option: `WITH_GHOST_X11`.
+libX11-devel
+libXcursor-devel
+libXi-devel
+libXinerama-devel
+libXrandr-devel
+libXt-devel
+libXxf86vm-devel
 )
 
 yum -y install -y ${PACKAGES_FOR_LIBS[@]} ${PACKAGES_FOR_BLENDER[@]}
 
-# Dependencies for Mesa
-yum -y install expat-devel
-python3 -m pip install mako
-
-# Dependencies for pip (needed for buildbot-worker).
-yum -y install python36-pip python36-devel
+# Dependencies for pip (needed for buildbot-worker), uses Python3.6.
+yum -y install python3 python3-pip python3-devel
 
 # Dependencies for asound.
 yum -y install -y  \
 alsa-lib-devel pulseaudio-libs-devel
-
-alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake 10  \
---slave /usr/local/bin/ctest ctest /usr/bin/ctest  \
---slave /usr/local/bin/cpack cpack /usr/bin/cpack  \
---slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake  \
---family cmake
-
-alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20  \
---slave /usr/local/bin/ctest ctest /usr/bin/ctest3  \
---slave /usr/local/bin/cpack cpack /usr/bin/cpack3  \
---slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake3  \
---family cmake
-
-alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20  \
---slave /usr/local/bin/ctest ctest /u

[Bf-blender-cvs] [b1b5b48d534] master: Cleanup: quiet format warning

2022-12-13 Thread Campbell Barton
Commit: b1b5b48d5341a0b3a7d650ab0b2b27e05e1a2e50
Author: Campbell Barton
Date:   Wed Dec 14 12:25:35 2022 +1100
Branches: master
https://developer.blender.org/rBb1b5b48d5341a0b3a7d650ab0b2b27e05e1a2e50

Cleanup: quiet format warning

===

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

===

diff --git a/source/blender/draw/intern/draw_pbvh.cc 
b/source/blender/draw/intern/draw_pbvh.cc
index c3d660b8ecd..bc9c449544c 100644
--- a/source/blender/draw/intern/draw_pbvh.cc
+++ b/source/blender/draw/intern/draw_pbvh.cc
@@ -900,7 +900,7 @@ struct PBVHBatches {
 break;
   }
   default:
-printf("%s: Unsupported attribute type %d\n", __func__, type);
+printf("%s: Unsupported attribute type %u\n", __func__, type);
 BLI_assert_unreachable();
 
 return;

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


[Bf-blender-cvs] [27eea5e69ec] universal-scene-description: Merge branch 'master' into universal-scene-description

2022-12-13 Thread Michael Kowalski
Commit: 27eea5e69ecabfeec912e30923f26835de0f420c
Author: Michael Kowalski
Date:   Tue Dec 13 18:40:08 2022 -0500
Branches: universal-scene-description
https://developer.blender.org/rB27eea5e69ecabfeec912e30923f26835de0f420c

Merge branch 'master' into universal-scene-description

===



===

diff --cc source/blender/io/usd/CMakeLists.txt
index 455bda271e7,ebd292782c0..ece12f5fe7e
--- a/source/blender/io/usd/CMakeLists.txt
+++ b/source/blender/io/usd/CMakeLists.txt
@@@ -156,7 -123,7 +156,8 @@@ set(LI
  
  list(APPEND LIB
${BOOST_LIBRARIES}
 +  ${PYTHON_LINKFLAGS}
+   ${BOOST_PYTHON_LIBRARIES}
${PYTHON_LIBRARIES}
  )
  
@@@ -179,10 -146,10 +180,11 @@@ if(WIN32
set_property(TARGET bf_usd APPEND_STRING PROPERTY INTERFACE_LINK_OPTIONS 
"$<$:/WHOLEARCHIVE:${USD_RELEASE_LIB}>")
  endif()
  
- # Source: 
https://github.com/PixarAnimationStudios/USD/blob/master/BUILDING.md#linking-whole-archives
+ # Source:
+ # 
https://github.com/PixarAnimationStudios/USD/blob/master/BUILDING.md#linking-whole-archives
  if(WIN32)
target_link_libraries(bf_usd INTERFACE ${USD_LIBRARIES})
 +  target_compile_options(bf_usd PRIVATE /w34101)
  elseif(APPLE)
target_link_libraries(bf_usd INTERFACE -Wl,-force_load ${USD_LIBRARIES})
  elseif(UNIX)
diff --cc source/blender/io/usd/intern/usd_capi_export.cc
index 85335172533,28da9e388c5..8c724e6c0be
--- a/source/blender/io/usd/intern/usd_capi_export.cc
+++ b/source/blender/io/usd/intern/usd_capi_export.cc
@@@ -60,15 -40,8 +60,13 @@@ struct ExportJobData 
wmWindowManager *wm;
  
char filepath[FILE_MAX];
 +  char usdz_filepath[FILE_MAX];
 +  bool is_usdz_export;
USDExportParams params;
  
-   short *stop;
-   short *do_update;
 +  float *progress;
 +
 +  bool was_canceled;
bool export_ok;
timeit::TimePoint start_time;
  };
@@@ -241,119 -54,6 +239,119 @@@ static void report_job_duration(const E
std::cout << '\n';
  }
  
 +static void process_usdz_textures(const ExportJobData *data, const char 
*path) {
 +  const eUSDZTextureDownscaleSize enum_value = 
data->params.usdz_downscale_size;
 +  if (enum_value == USD_TEXTURE_SIZE_KEEP) {
 +return;
 +  }
 +
 +  int image_size = (
 +  (enum_value == USD_TEXTURE_SIZE_CUSTOM ? 
data->params.usdz_downscale_custom_size : enum_value)
 +  );
 +
 +  image_size = image_size < 128 ? 128 : image_size;
 +
 +  char texture_path[4096];
 +  BLI_strcpy_rlen(texture_path, path);
 +  BLI_path_append(texture_path, 4096, "textures");
-   BLI_path_slash_ensure(texture_path);
++  BLI_path_slash_ensure(texture_path, sizeof(texture_path));
 +
 +  struct direntry *entries;
 +  unsigned int num_files = BLI_filelist_dir_contents(texture_path, &entries);
 +
 +  for (int index = 0; index < num_files; index++) {
 +/* We can skip checking extensions as this folder is only created
 + * when we're doing a USDZ export. */
 +if (!BLI_is_dir(entries[index].path)) {
 +  Image *im = BKE_image_load_ex(data->bmain, entries[index].path, 
LIB_ID_CREATE_NO_MAIN);
 +  if (!im) {
 +std::cerr << "-- Unable to open file for downscaling: " << 
entries[index].path << std::endl;
 +continue;
 +  }
 +
 +  int width, height;
 +  BKE_image_get_size(im, NULL, &width, &height);
 +  const int longest = width >= height ? width : height;
 +  const float scale = 1.0 / ((float)longest / (float)image_size);
 +
 +  if (longest > image_size) {
 +const int width_adjusted  = (float)width * scale;
 +const int height_adjusted = (float)height * scale;
 +BKE_image_scale(im, width_adjusted, height_adjusted);
 +
 +ImageSaveOptions opts;
 +
 +if (BKE_image_save_options_init(&opts, data->bmain, data->scene, im, 
NULL, false, false)) {
 +  bool result = BKE_image_save(NULL, data->bmain, im, NULL, &opts);
 +  if (!result) {
 +std::cerr << "-- Unable to resave " << data->filepath << " (new 
size: "
 +  << width_adjusted << "x" << height_adjusted << ")" << 
std::endl;
 +  }
 +  else {
 +std::cout << "Downscaled " << entries[index].path << " to "
 +  << width_adjusted << "x" << height_adjusted << 
std::endl;
 +  }
 +}
 +
 +BKE_image_save_options_free(&opts);
 +  }
 +
 +  /* Make sure to free the image so it doesn't stick
 +   * around in the library of the open file. */
 +  BKE_id_free(data->bmain, (void*)im);
 +}
 +  }
 +
 +  BLI_filelist_free(entries, num_files);
 +}
 +
 +static bool perform_usdz_conversion(const ExportJobData *data)
 +{
 +  char usdc_temp_dir[FILE_MAX], usdc_file[FILE_MAX];
 +  BLI_split_dirfile(data->filepath, usdc_temp_dir, usdc_file, FILE_MAX, 
FILE_MAX);
 +
 +  char usdz_file[FILE_MAX];
 +  BLI_split_file_part(data->usdz_filepath, usdz_file, FILE_MAX);
 +
 +  char original_working_dir[FILE_MAX];

[Bf-blender-cvs] [d2fd7fc1768] refactor-mesh-corners-generic: Merge branch 'refactor-mesh-position-generic' into refactor-mesh-corners-generic

2022-12-13 Thread Hans Goudey
Commit: d2fd7fc1768f038fa46d5535bcbf688fb99f9bd8
Author: Hans Goudey
Date:   Tue Dec 13 18:44:17 2022 -0600
Branches: refactor-mesh-corners-generic
https://developer.blender.org/rBd2fd7fc1768f038fa46d5535bcbf688fb99f9bd8

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

2022-12-13 Thread Hans Goudey
Commit: 9c081829ae772533f5ba89576e879e4e9658ddff
Author: Hans Goudey
Date:   Tue Dec 13 18:42:04 2022 -0600
Branches: refactor-mesh-position-generic
https://developer.blender.org/rB9c081829ae772533f5ba89576e879e4e9658ddff

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

===



===



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


[Bf-blender-cvs] [75ad8da1ea6] master: Refactor: Replace old Mesh edge split implementation

2022-12-13 Thread Hans Goudey
Commit: 75ad8da1ea6799e3983e4146f4b20dc4bfbb8415
Author: Hans Goudey
Date:   Tue Dec 13 18:39:36 2022 -0600
Branches: master
https://developer.blender.org/rB75ad8da1ea6799e3983e4146f4b20dc4bfbb8415

Refactor: Replace old Mesh edge split implementation

Recently a new geometry node for splitting edges was added in D16399.
However, there was already a similar implementation in mesh.cc that was
mainly used to fake auto smooth support in Cycles by splitting sharp
edges and edges around sharp faces.

While there are still possibilities for optimization in the new code,
the implementation is safer and simpler, multi-threaded, and aligns
better with development plans for caching topology on Mesh and other
recent developments with attributes.

This patch removes the old code and moves the node implementation to
the geometry module so it can be used in editors and RNA. The "free
loop normals" argument is deprecated now, since it was only an internal
optimization exposed for Cycles.

The new mesh `editors` function creates an `IndexMask` of edges to
split by reusing some of the code from the corner normal calculation.

This change will help to simplify the changes in D16530 and T102858.

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

===

M   intern/cycles/blender/util.h
M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/blenkernel/intern/mesh.cc
M   source/blender/editors/include/ED_mesh.h
M   source/blender/editors/mesh/CMakeLists.txt
M   source/blender/editors/mesh/mesh_data.cc
M   source/blender/editors/object/object_bake_api.c
M   source/blender/geometry/CMakeLists.txt
A   source/blender/geometry/GEO_mesh_split_edges.hh
A   source/blender/geometry/intern/mesh_split_edges.cc
M   source/blender/makesrna/intern/rna_mesh_api.c
M   source/blender/nodes/geometry/nodes/node_geo_edge_split.cc

===

diff --git a/intern/cycles/blender/util.h b/intern/cycles/blender/util.h
index dbdfbaddaf1..9a4b8c5cc64 100644
--- a/intern/cycles/blender/util.h
+++ b/intern/cycles/blender/util.h
@@ -113,6 +113,7 @@ static inline BL::Mesh object_to_mesh(BL::BlendData & 
/*data*/,
 
   if ((bool)mesh && subdivision_type == Mesh::SUBDIVISION_NONE) {
 if (mesh.use_auto_smooth()) {
+  mesh.calc_normals_split();
   mesh.split_faces(false);
 }
 
diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index a2067169506..6a55fe00bf6 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -254,14 +254,6 @@ void BKE_mesh_texspace_get_reference(struct Mesh *me,
  float **r_size);
 void BKE_mesh_texspace_copy_from_object(struct Mesh *me, struct Object *ob);
 
-/**
- * Split faces based on the edge angle and loop normals.
- * Matches behavior of face splitting in render engines.
- *
- * \note Will leave #CD_NORMAL loop data layer which is used by render engines 
to set shading up.
- */
-void BKE_mesh_split_faces(struct Mesh *mesh, bool free_loop_normals);
-
 /**
  * Create new mesh from the given object at its current state.
  * The owner of this mesh is unknown, it is up to the caller to decide.
diff --git a/source/blender/blenkernel/intern/mesh.cc 
b/source/blender/blenkernel/intern/mesh.cc
index 1fd2a72f311..77ef4674596 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -1836,267 +1836,6 @@ void BKE_mesh_calc_normals_split(Mesh *mesh)
   BKE_mesh_calc_normals_split_ex(mesh, nullptr, 
ensure_corner_normal_layer(*mesh));
 }
 
-/* Split faces helper functions. */
-
-struct SplitFaceNewVert {
-  struct SplitFaceNewVert *next;
-  int new_index;
-  int orig_index;
-  const float *vnor;
-};
-
-struct SplitFaceNewEdge {
-  struct SplitFaceNewEdge *next;
-  int new_index;
-  int orig_index;
-  int v1;
-  int v2;
-};
-
-/**
- * Detect necessary new vertices, and update loop vertex indices accordingly.
- * \warning Leaves mesh in invalid state.
- * \param lnors_spacearr: Mandatory because trying to do the job in simple way 
without that data is
- * doomed to fail, even when only dealing with smooth/flat faces one can find 
cases that no simple
- * algorithm can handle properly.
- */
-static int split_faces_prepare_new_verts(Mesh &mesh,
- const MLoopNorSpaceArray 
&lnors_spacearr,
- SplitFaceNewVert **new_verts,
- MemArena &memarena)
-{
-  const int loops_len = mesh.totloop;
-  int verts_len = mesh.totvert;
-  MutableSpan loops = mesh.loops_for_write();
-  BKE_mesh_vertex_normals_ensure(&mesh);
-  float(*vert_normals)[3] = BKE_mesh_vertex_normals_for_write(&mesh);
-
-  BitVector<> verts_used(verts_len, false);
-  BitVector<> done_loops(loops_len, false);
-
-  BLI_assert(ln

[Bf-blender-cvs] [8e2dae3f8d0] refactor-mesh-corners-generic: Merge branch 'refactor-mesh-position-generic' into refactor-mesh-corners-generic

2022-12-13 Thread Hans Goudey
Commit: 8e2dae3f8d0c363431778b94a2bc4e2bee65f39a
Author: Hans Goudey
Date:   Tue Dec 13 17:11:13 2022 -0600
Branches: refactor-mesh-corners-generic
https://developer.blender.org/rB8e2dae3f8d0c363431778b94a2bc4e2bee65f39a

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

===



===

diff --cc source/blender/blenkernel/intern/mesh.cc
index 6a9f4b05027,3d5e2f69cb2..20db130fc4f
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@@ -512,12 -516,8 +515,14 @@@ static int customdata_compare
}
/* At this point `l1` and `l2` have the same name and type, so they 
should be compared. */
  
+   found_corresponding_layer = true;
+ 
 +  if (StringRef(l1->name) == ".corner_edge") {
 +/* TODO(Hans): This attribute wasn't tested before loops were 
refactored into separate
 + * corner edges and corner verts arrays. Remove after updating tests. 
*/
 +continue;
 +  }
 +
switch (l1->type) {
  /* We're order-agnostic for edges here. */
  case CD_MEDGE: {
diff --cc source/blender/blenkernel/intern/multires.cc
index 1f48f247726,8a12684530d..292edf53293
--- a/source/blender/blenkernel/intern/multires.cc
+++ b/source/blender/blenkernel/intern/multires.cc
@@@ -1595,7 -1618,7 +1617,7 @@@ int mdisp_rot_face_to_crn
  float mindist = FLT_MAX;
  
  for (i = 0; i < mpoly->totloop; i++) {
-   float len = len_v3v3(nullptr, positions[corner_verts[mpoly->loopstart + 
i]].co);
 -  float len = len_v3v3(nullptr, positions[mloop[mpoly->loopstart + i].v]);
++  float len = len_v3v3(nullptr, positions[corner_verts[mpoly->loopstart + 
i]]);
if (len < mindist) {
  mindist = len;
  minS = i;
diff --cc source/blender/blenkernel/intern/pbvh_pixels.cc
index d6757afcbef,e21103c9f19..a1c1a88e398
--- a/source/blender/blenkernel/intern/pbvh_pixels.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels.cc
@@@ -361,8 -361,10 +361,10 @@@ static void update_pixels(PBVH *pbvh, M
  return;
}
  
-   uv_islands::MeshData mesh_data(
-   pbvh->looptri, pbvh->totprim, pbvh->totvert, pbvh->corner_verts, 
ldata_uv);
+   uv_islands::MeshData mesh_data({pbvh->looptri, pbvh->totprim},
 - {pbvh->mloop, mesh->totloop},
++ {pbvh->corner_verts, mesh->totloop},
+  pbvh->totvert,
+  {ldata_uv, mesh->totloop});
uv_islands::UVIslands islands(mesh_data);
  
uv_islands::UVIslandsMask uv_masks;
diff --cc source/blender/blenkernel/intern/pbvh_uv_islands.cc
index c62d7f2586d,21645e50e7e..b4cf67b8eb3
--- a/source/blender/blenkernel/intern/pbvh_uv_islands.cc
+++ b/source/blender/blenkernel/intern/pbvh_uv_islands.cc
@@@ -125,14 -125,14 +125,14 @@@ static void mesh_data_init_primitives(M
  
  static void mesh_data_init_edges(MeshData &mesh_data)
  {
-   mesh_data.edges.reserve(mesh_data.looptri_len * 2);
-   EdgeHash *eh = BLI_edgehash_new_ex(__func__, mesh_data.looptri_len * 3);
-   for (int64_t i = 0; i < mesh_data.looptri_len; i++) {
- const MLoopTri &tri = mesh_data.looptri[i];
+   mesh_data.edges.reserve(mesh_data.looptris.size() * 2);
+   EdgeHash *eh = BLI_edgehash_new_ex(__func__, mesh_data.looptris.size() * 3);
+   for (int64_t i = 0; i < mesh_data.looptris.size(); i++) {
+ const MLoopTri &tri = mesh_data.looptris[i];
  MeshPrimitive &primitive = mesh_data.primitives[i];
  for (int j = 0; j < 3; j++) {
 -  int v1 = mesh_data.loops[tri.tri[j]].v;
 -  int v2 = mesh_data.loops[tri.tri[(j + 1) % 3]].v;
 +  int v1 = mesh_data.corner_verts[tri.tri[j]];
 +  int v2 = mesh_data.corner_verts[tri.tri[(j + 1) % 3]];
  
void **edge_index_ptr;
int64_t edge_index;
@@@ -215,16 -215,11 +215,11 @@@ static void mesh_data_init(MeshData &me
mesh_data_init_primitive_uv_island_ids(mesh_data);
  }
  
- MeshData::MeshData(const MLoopTri *looptri,
-const int64_t looptri_len,
-const int64_t vert_len,
-const int *corner_verts,
-const MLoopUV *mloopuv)
- : looptri(looptri),
-   looptri_len(looptri_len),
-   vert_len(vert_len),
-   corner_verts(corner_verts),
-   mloopuv(mloopuv)
+ MeshData::MeshData(const Span looptris,
 -   const Span loops,
++   const Span corner_verts,
+const int verts_num,
+const Span mloopuv)
 -: looptris(looptris), verts_num(verts_num), loops(loops), mloopuv(mloopuv)
++: looptris(looptris), verts_num(verts_num), corner_verts(corner_verts), 
mloopuv(mloopuv)
  {
mesh_data_init(*this);
  }
diff --cc source/blender/blenkernel/intern/pbvh_uv_islands.hh
index c086f79371c,4d81f5da00c..5d893f87d47
--- 

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

2022-12-13 Thread Hans Goudey
Commit: b0b60df326167411e3be008dac8316623b5dd3b3
Author: Hans Goudey
Date:   Tue Dec 13 16:53:53 2022 -0600
Branches: refactor-mesh-position-generic
https://developer.blender.org/rBb0b60df326167411e3be008dac8316623b5dd3b3

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

===



===

diff --cc source/blender/blenkernel/intern/paint.cc
index 49a9e2e25d4,e6d61ddcdd3..caaf2956ff3
--- a/source/blender/blenkernel/intern/paint.cc
+++ b/source/blender/blenkernel/intern/paint.cc
@@@ -79,8 -75,11 +79,8 @@@ static SculptAttribute *sculpt_attribut
 const 
SculptAttributeParams *params,
 PBVHType pbvhtype,
 bool flat_array_for_bmesh);
- void sculptsession_bmesh_add_layers(Object *ob);
+ static void sculptsession_bmesh_add_layers(Object *ob);
  
 -using blender::MutableSpan;
 -using blender::Span;
 -
  static void palette_init_data(ID *id)
  {
Palette *palette = (Palette *)id;

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


[Bf-blender-cvs] [a55163c880c] master: Cleanup: Reduce indentation when setting node active

2022-12-13 Thread Hans Goudey
Commit: a55163c880c4c5720a1db8021c42339a05474e70
Author: Hans Goudey
Date:   Tue Dec 13 16:01:47 2022 -0600
Branches: master
https://developer.blender.org/rBa55163c880c4c5720a1db8021c42339a05474e70

Cleanup: Reduce indentation when setting node active

===

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

===

diff --git a/source/blender/editors/space_node/node_edit.cc 
b/source/blender/editors/space_node/node_edit.cc
index b7b82fbd661..1bf5b938ee3 100644
--- a/source/blender/editors/space_node/node_edit.cc
+++ b/source/blender/editors/space_node/node_edit.cc
@@ -673,136 +673,137 @@ void ED_node_set_active(
   }
 
   nodeSetActive(ntree, node);
+  if (node->type == NODE_GROUP) {
+return;
+  }
 
-  if (node->type != NODE_GROUP) {
-const bool was_output = (node->flag & NODE_DO_OUTPUT) != 0;
-bool do_update = false;
+  const bool was_output = (node->flag & NODE_DO_OUTPUT) != 0;
+  bool do_update = false;
+
+  /* generic node group output: set node as active output */
+  if (node->type == NODE_GROUP_OUTPUT) {
+for (bNode *node_iter : ntree->all_nodes()) {
+  if (node_iter->type == NODE_GROUP_OUTPUT) {
+node_iter->flag &= ~NODE_DO_OUTPUT;
+  }
+}
+
+node->flag |= NODE_DO_OUTPUT;
+if (!was_output) {
+  do_update = true;
+  BKE_ntree_update_tag_active_output_changed(ntree);
+}
+  }
 
-/* generic node group output: set node as active output */
-if (node->type == NODE_GROUP_OUTPUT) {
+  /* tree specific activate calls */
+  if (ntree->type == NTREE_SHADER) {
+if (ELEM(node->type,
+ SH_NODE_OUTPUT_MATERIAL,
+ SH_NODE_OUTPUT_WORLD,
+ SH_NODE_OUTPUT_LIGHT,
+ SH_NODE_OUTPUT_LINESTYLE)) {
   for (bNode *node_iter : ntree->all_nodes()) {
-if (node_iter->type == NODE_GROUP_OUTPUT) {
+if (node_iter->type == node->type) {
   node_iter->flag &= ~NODE_DO_OUTPUT;
 }
   }
 
   node->flag |= NODE_DO_OUTPUT;
-  if (!was_output) {
-do_update = true;
-BKE_ntree_update_tag_active_output_changed(ntree);
-  }
+  BKE_ntree_update_tag_active_output_changed(ntree);
 }
 
-/* tree specific activate calls */
-if (ntree->type == NTREE_SHADER) {
-  if (ELEM(node->type,
-   SH_NODE_OUTPUT_MATERIAL,
-   SH_NODE_OUTPUT_WORLD,
-   SH_NODE_OUTPUT_LIGHT,
-   SH_NODE_OUTPUT_LINESTYLE)) {
-for (bNode *node_iter : ntree->all_nodes()) {
-  if (node_iter->type == node->type) {
-node_iter->flag &= ~NODE_DO_OUTPUT;
-  }
-}
+ED_node_tree_propagate_change(nullptr, bmain, ntree);
 
-node->flag |= NODE_DO_OUTPUT;
-BKE_ntree_update_tag_active_output_changed(ntree);
-  }
+if ((node->flag & NODE_ACTIVE_TEXTURE) && !was_active_texture) {
+  /* If active texture changed, free glsl materials. */
+  LISTBASE_FOREACH (Material *, ma, &bmain->materials) {
+if (ma->nodetree && ma->use_nodes && ntreeHasTree(ma->nodetree, 
ntree)) {
+  GPU_material_free(&ma->gpumaterial);
 
-  ED_node_tree_propagate_change(nullptr, bmain, ntree);
-
-  if ((node->flag & NODE_ACTIVE_TEXTURE) && !was_active_texture) {
-/* If active texture changed, free glsl materials. */
-LISTBASE_FOREACH (Material *, ma, &bmain->materials) {
-  if (ma->nodetree && ma->use_nodes && ntreeHasTree(ma->nodetree, 
ntree)) {
-GPU_material_free(&ma->gpumaterial);
-
-/* Sync to active texpaint slot, otherwise we can end up painting 
on a different slot
- * than we are looking at. */
-if (ma->texpaintslot) {
-  if (node->id != nullptr && GS(node->id->name) == ID_IM) {
-Image *image = (Image *)node->id;
-for (int i = 0; i < ma->tot_slots; i++) {
-  if (ma->texpaintslot[i].ima == image) {
-ma->paint_active_slot = i;
-  }
+  /* Sync to active texpaint slot, otherwise we can end up painting on 
a different slot
+   * than we are looking at. */
+  if (ma->texpaintslot) {
+if (node->id != nullptr && GS(node->id->name) == ID_IM) {
+  Image *image = (Image *)node->id;
+  for (int i = 0; i < ma->tot_slots; i++) {
+if (ma->texpaintslot[i].ima == image) {
+  ma->paint_active_slot = i;
 }
   }
 }
   }
 }
+  }
 
-LISTBASE_FOREACH (World *, wo, &bmain->worlds) {
-  if (wo->nodetree && wo->use_nodes && ntreeHasTree(wo->nodetree, 
ntree)) {
-GPU_material_free(&wo->gpumaterial);
-  }
+  LISTBASE_FOREACH (World *, wo, &bmain->worlds) {
+if (wo->nodetree && wo->use_nodes && ntreeHasTree(wo->

[Bf-blender-cvs] [ae7ef8bcc66] master: Cleanup: Use const variables in node drawing

2022-12-13 Thread Hans Goudey
Commit: ae7ef8bcc66f25200a677718b3df500f876b1c57
Author: Hans Goudey
Date:   Tue Dec 13 16:44:13 2022 -0600
Branches: master
https://developer.blender.org/rBae7ef8bcc66f25200a677718b3df500f876b1c57

Cleanup: Use const variables in node drawing

===

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

===

diff --git a/source/blender/editors/space_node/node_draw.cc 
b/source/blender/editors/space_node/node_draw.cc
index 65cbb49aaed..3bb10404302 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -2813,9 +2813,9 @@ static void frame_node_draw_label(TreeDrawContext 
&tree_draw_ctx,
 BLF_wordwrap(fontid, line_width);
 
 LISTBASE_FOREACH (const TextLine *, line, &text->lines) {
-  ResultBLF info;
   if (line->line[0]) {
 BLF_position(fontid, x, y, 0);
+ResultBLF info;
 BLF_draw_ex(fontid, line->line, line->len, &info);
 y -= line_spacing * info.lines;
   }
@@ -2890,10 +2890,8 @@ static void frame_node_draw(const bContext &C,
 static void reroute_node_draw(
 const bContext &C, ARegion ®ion, bNodeTree &ntree, bNode &node, uiBlock 
&block)
 {
-  char showname[128]; /* 128 used below */
-  const rctf &rct = node.runtime->totr;
-
   /* skip if out of view */
+  const rctf &rct = node.runtime->totr;
   if (rct.xmax < region.v2d.cur.xmin || rct.xmin > region.v2d.cur.xmax ||
   rct.ymax < region.v2d.cur.ymin || node.runtime->totr.ymin > 
region.v2d.cur.ymax) {
 UI_block_end(&C, &block);
@@ -2902,6 +2900,7 @@ static void reroute_node_draw(
 
   if (node.label[0] != '\0') {
 /* draw title (node label) */
+char showname[128]; /* 128 used below */
 BLI_strncpy(showname, node.label, sizeof(showname));
 const short width = 512;
 const int x = BLI_rctf_cent_x(&node.runtime->totr) - (width / 2);
@@ -2987,7 +2986,7 @@ static void node_draw_nodetree(const bContext &C,
   continue;
 }
 
-bNodeInstanceKey key = BKE_node_instance_key(parent_key, &ntree, nodes[i]);
+const bNodeInstanceKey key = BKE_node_instance_key(parent_key, &ntree, 
nodes[i]);
 node_draw(C, tree_draw_ctx, region, snode, ntree, *nodes[i], *blocks[i], 
key);
   }
 
@@ -3017,7 +3016,7 @@ static void node_draw_nodetree(const bContext &C,
   continue;
 }
 
-bNodeInstanceKey key = BKE_node_instance_key(parent_key, &ntree, nodes[i]);
+const bNodeInstanceKey key = BKE_node_instance_key(parent_key, &ntree, 
nodes[i]);
 node_draw(C, tree_draw_ctx, region, snode, ntree, *nodes[i], *blocks[i], 
key);
   }
 }
@@ -3025,8 +3024,6 @@ static void node_draw_nodetree(const bContext &C,
 /* Draw the breadcrumb on the top of the editor. */
 static void draw_tree_path(const bContext &C, ARegion ®ion)
 {
-  using namespace blender;
-
   GPU_matrix_push_projection();
   wmOrtho2_region_pixelspace(®ion);
 
@@ -3042,7 +3039,7 @@ static void draw_tree_path(const bContext &C, ARegion 
®ion)
   uiLayout *layout = UI_block_layout(
   block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, x, y, width, 1, 0, style);
 
-  Vector context_path = 
ed::space_node::context_path_for_space_node(C);
+  const Vector context_path = 
ed::space_node::context_path_for_space_node(C);
   ui::template_breadcrumbs(*layout, context_path);
 
   UI_block_layout_resolve(block, nullptr, nullptr);
@@ -3115,7 +3112,7 @@ static void draw_nodetree(const bContext &C,
   SpaceNode *snode = CTX_wm_space_node(&C);
   ntree.ensure_topology_cache();
 
-  Span nodes = ntree.all_nodes();
+  const Span nodes = ntree.all_nodes();
 
   Array blocks = node_uiblocks_init(C, nodes);
 
@@ -3126,7 +3123,7 @@ static void draw_nodetree(const bContext &C,
   tree_draw_ctx.geo_tree_log->ensure_node_warnings();
   tree_draw_ctx.geo_tree_log->ensure_node_run_time();
 }
-WorkSpace *workspace = CTX_wm_workspace(&C);
+const WorkSpace *workspace = CTX_wm_workspace(&C);
 tree_draw_ctx.active_geometry_nodes_viewer = 
viewer_path::find_geometry_nodes_viewer(
 workspace->viewer_path, *snode);
   }

___
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] [f613614fceb] master: Fix T103136: Cannot activate viewer node in group

2022-12-13 Thread Hans Goudey
Commit: f613614fcebf4dd769abd0d2cfb72fe95ff7bc4c
Author: Hans Goudey
Date:   Tue Dec 13 16:42:06 2022 -0600
Branches: master
https://developer.blender.org/rBf613614fcebf4dd769abd0d2cfb72fe95ff7bc4c

Fix T103136: Cannot activate viewer node in group

90ea1b76434fe175e99 created an item for the viewer node path
but didn't add it to the list, which also caused memory leaks.

===

M   source/blender/editors/util/ed_viewer_path.cc

===

diff --git a/source/blender/editors/util/ed_viewer_path.cc 
b/source/blender/editors/util/ed_viewer_path.cc
index f0bbade6361..be569aa02fa 100644
--- a/source/blender/editors/util/ed_viewer_path.cc
+++ b/source/blender/editors/util/ed_viewer_path.cc
@@ -64,6 +64,7 @@ static void viewer_path_for_geometry_node(const SpaceNode 
&snode,
 NodeViewerPathElem *node_elem = BKE_viewer_path_elem_new_node();
 node_elem->node_id = node->identifier;
 node_elem->node_name = BLI_strdup(node->name);
+BLI_addtail(&r_dst.path, node_elem);
   }
 
   NodeViewerPathElem *viewer_node_elem = BKE_viewer_path_elem_new_node();
@@ -111,7 +112,7 @@ void activate_geometry_node(Main &bmain, SpaceNode &snode, 
bNode &node)
   }
 }
 
-/* Enable viewer in one viewport if it is disable in all of them. */
+/* Enable viewer in one viewport if it is disabled in all of them. */
 if (!found_view3d_with_enabled_viewer && any_view3d_without_viewer != 
nullptr) {
   any_view3d_without_viewer->flag2 |= V3D_SHOW_VIEWER;
 }

___
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] [23b776e5b31] master: Cleanup: Remove disabled code

2022-12-13 Thread Hans Goudey
Commit: 23b776e5b313b069456f6d5c82a0a217058a94b1
Author: Hans Goudey
Date:   Tue Dec 13 16:00:15 2022 -0600
Branches: master
https://developer.blender.org/rB23b776e5b313b069456f6d5c82a0a217058a94b1

Cleanup: Remove disabled code

===

M   source/blender/editors/space_node/node_edit.cc
M   source/blender/editors/transform/transform.c

===

diff --git a/source/blender/editors/space_node/node_edit.cc 
b/source/blender/editors/space_node/node_edit.cc
index 95f64999f6e..b7b82fbd661 100644
--- a/source/blender/editors/space_node/node_edit.cc
+++ b/source/blender/editors/space_node/node_edit.cc
@@ -791,16 +791,6 @@ void ED_node_set_active(
 ED_node_tree_propagate_change(nullptr, bmain, ntree);
   }
 }
-else if (ntree->type == NTREE_TEXTURE) {
-  /* XXX */
-#if 0
-  if (node->id) {
-BIF_preview_changed(-1);
-allqueue(REDRAWBUTSSHADING, 1);
-allqueue(REDRAWIPO, 0);
-  }
-#endif
-}
 else if (ntree->type == NTREE_GEOMETRY) {
   if (node->type == GEO_NODE_VIEWER) {
 if ((node->flag & NODE_DO_OUTPUT) == 0) {
diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index 77b6f169a08..b8b4cf796f4 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -534,27 +534,6 @@ static void viewRedrawPost(bContext *C, TransInfo *t)
 /* XXX(ton): temp, first hack to get auto-render in compositor work. */
 WM_event_add_notifier(C, NC_SCENE | ND_TRANSFORM_DONE, CTX_data_scene(C));
   }
-
-#if 0 /* TRANSFORM_FIX_ME */
-  if (t->spacetype == SPACE_VIEW3D) {
-allqueue(REDRAWBUTSOBJECT, 0);
-allqueue(REDRAWVIEW3D, 0);
-  }
-  else if (t->spacetype == SPACE_IMAGE) {
-allqueue(REDRAWIMAGE, 0);
-allqueue(REDRAWVIEW3D, 0);
-  }
-  else if (ELEM(t->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_GRAPH)) {
-allqueue(REDRAWVIEW3D, 0);
-allqueue(REDRAWACTION, 0);
-allqueue(REDRAWNLA, 0);
-allqueue(REDRAWIPO, 0);
-allqueue(REDRAWTIME, 0);
-allqueue(REDRAWBUTSOBJECT, 0);
-  }
-
-  scrarea_queue_headredraw(curarea);
-#endif
 }
 
 /* * */

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


[Bf-blender-cvs] [9f1d7d930d0] master: Cleanup: fix comile error from last commit

2022-12-13 Thread Joseph Eagar
Commit: 9f1d7d930d0e12ab23ed620abcc617bb9d9ec307
Author: Joseph Eagar
Date:   Tue Dec 13 13:58:27 2022 -0800
Branches: master
https://developer.blender.org/rB9f1d7d930d0e12ab23ed620abcc617bb9d9ec307

Cleanup: fix comile error from last commit

===

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

===

diff --git a/source/blender/blenkernel/intern/paint.cc 
b/source/blender/blenkernel/intern/paint.cc
index 718ec5318ac..e6d61ddcdd3 100644
--- a/source/blender/blenkernel/intern/paint.cc
+++ b/source/blender/blenkernel/intern/paint.cc
@@ -75,7 +75,7 @@ static SculptAttribute *sculpt_attribute_ensure_ex(Object *ob,
const SculptAttributeParams 
*params,
PBVHType pbvhtype,
bool flat_array_for_bmesh);
-void sculptsession_bmesh_add_layers(Object *ob);
+static void sculptsession_bmesh_add_layers(Object *ob);
 
 using blender::MutableSpan;
 using blender::Span;

___
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] [6f9cfb037a8] master: Sculpt: Fix T102991: Multires fast navigate not implemented

2022-12-13 Thread Joseph Eagar
Commit: 6f9cfb037a8e5dbd8707877d0a9539ae8d358656
Author: Joseph Eagar
Date:   Tue Dec 13 12:24:24 2022 -0800
Branches: master
https://developer.blender.org/rB6f9cfb037a8e5dbd8707877d0a9539ae8d358656

Sculpt: Fix T102991: Multires fast navigate not implemented

PBVH draw code now builds coarse triangle index buffers
for multires. Note that the coarse grids can be at any
multires depth but is currently hardcoded to 1.

===

M   source/blender/blenkernel/BKE_pbvh.h
M   source/blender/blenkernel/intern/pbvh.c
M   source/blender/draw/DRW_pbvh.h
M   source/blender/draw/intern/draw_manager_data.cc
M   source/blender/draw/intern/draw_pbvh.cc
M   source/blender/gpu/intern/gpu_shader_builder_stubs.cc

===

diff --git a/source/blender/blenkernel/BKE_pbvh.h 
b/source/blender/blenkernel/BKE_pbvh.h
index 139b6ff6bbe..8f66d552387 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -414,7 +414,8 @@ void BKE_pbvh_sync_visibility_from_verts(PBVH *pbvh, struct 
Mesh *me);
 int BKE_pbvh_count_grid_quads(BLI_bitmap **grid_hidden,
   const int *grid_indices,
   int totgrid,
-  int gridsize);
+  int gridsize,
+  int display_gridsize);
 
 /**
  * Multi-res level, only valid for type == #PBVH_GRIDS.
diff --git a/source/blender/blenkernel/intern/pbvh.c 
b/source/blender/blenkernel/intern/pbvh.c
index 98e21c685a2..35c2c660fd2 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -383,7 +383,8 @@ static void update_vb(PBVH *pbvh, PBVHNode *node, BBC 
*prim_bbc, int offset, int
 int BKE_pbvh_count_grid_quads(BLI_bitmap **grid_hidden,
   const int *grid_indices,
   int totgrid,
-  int gridsize)
+  int gridsize,
+  int display_gridsize)
 {
   const int gridarea = (gridsize - 1) * (gridsize - 1);
   int totquad = 0;
@@ -391,13 +392,18 @@ int BKE_pbvh_count_grid_quads(BLI_bitmap **grid_hidden,
   /* grid hidden layer is present, so have to check each grid for
* visibility */
 
+  int depth1 = (int)(log2((double)gridsize - 1.0) + DBL_EPSILON);
+  int depth2 = (int)(log2((double)display_gridsize - 1.0) + DBL_EPSILON);
+
+  int skip = depth2 < depth1 ? 1 << (depth1 - depth2 - 1) : 1;
+
   for (int i = 0; i < totgrid; i++) {
 const BLI_bitmap *gh = grid_hidden[grid_indices[i]];
 
 if (gh) {
   /* grid hidden are present, have to check each element */
-  for (int y = 0; y < gridsize - 1; y++) {
-for (int x = 0; x < gridsize - 1; x++) {
+  for (int y = 0; y < gridsize - skip; y += skip) {
+for (int x = 0; x < gridsize - skip; x += skip) {
   if (!paint_is_grid_face_hidden(gh, gridsize, x, y)) {
 totquad++;
   }
@@ -414,8 +420,11 @@ int BKE_pbvh_count_grid_quads(BLI_bitmap **grid_hidden,
 
 static void build_grid_leaf_node(PBVH *pbvh, PBVHNode *node)
 {
-  int totquads = BKE_pbvh_count_grid_quads(
-  pbvh->grid_hidden, node->prim_indices, node->totprim, 
pbvh->gridkey.grid_size);
+  int totquads = BKE_pbvh_count_grid_quads(pbvh->grid_hidden,
+   node->prim_indices,
+   node->totprim,
+   pbvh->gridkey.grid_size,
+   pbvh->gridkey.grid_size);
   BKE_pbvh_node_fully_hidden_set(node, (totquads == 0));
   BKE_pbvh_node_mark_rebuild_draw(node);
 }
diff --git a/source/blender/draw/DRW_pbvh.h b/source/blender/draw/DRW_pbvh.h
index ffd4b92d87b..6f9daac0a35 100644
--- a/source/blender/draw/DRW_pbvh.h
+++ b/source/blender/draw/DRW_pbvh.h
@@ -86,12 +86,14 @@ struct GPUBatch *DRW_pbvh_tris_get(PBVHBatches *batches,
struct PBVHAttrReq *attrs,
int attrs_num,
PBVH_GPU_Args *args,
-   int *r_prim_count);
+   int *r_prim_count,
+   bool do_coarse_grids);
 struct GPUBatch *DRW_pbvh_lines_get(struct PBVHBatches *batches,
 struct PBVHAttrReq *attrs,
 int attrs_num,
 PBVH_GPU_Args *args,
-int *r_prim_count);
+int *r_prim_count,
+bool do_coarse_grids);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/draw/intern/draw_manager_data.cc 
b/source/blender/draw/intern/draw_manager_data.cc
index beeff6f35c2..d4ffd3f8

[Bf-blender-cvs] [939b63bcd6c] master: Sculpt: Fix more attribute bugs when switching PBVH modes

2022-12-13 Thread Joseph Eagar
Commit: 939b63bcd6c2e2bb92c7d5feb466bb44f4427fc8
Author: Joseph Eagar
Date:   Tue Dec 13 13:42:25 2022 -0800
Branches: master
https://developer.blender.org/rB939b63bcd6c2e2bb92c7d5feb466bb44f4427fc8

Sculpt: Fix more attribute bugs when switching PBVH modes

Fixed more cases where attributes weren't being reinitialized
on switching PBVH mode:

* When PBVH_GRIDS and PBVH_BMESH force attributes into simple
  array mode they no longer override simple_array in the
  SculptAttributeParams parameters, instead they set a field
  in SculptAttribute itself.  Thus if the attribute is
  reinitialized in another mode it won't retain the simple_array
  parameter.
* sculpt_attribute_ensure_ex now calls sculpt_attr_update if
  the attribute already exists.
* Fixed a bug from a couple commits ago that set
  SculptAttribute.data_for_bmesh wrong.

===

M   source/blender/blenkernel/BKE_paint.h
M   source/blender/blenkernel/intern/multires.cc
M   source/blender/blenkernel/intern/paint.cc
M   source/blender/draw/intern/draw_pbvh.cc

===

diff --git a/source/blender/blenkernel/BKE_paint.h 
b/source/blender/blenkernel/BKE_paint.h
index 434255b2d9c..4acaa7b05e1 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -516,6 +516,11 @@ typedef struct SculptAttribute {
   int elem_size, elem_num;
   bool data_for_bmesh; /* Temporary data store as array outside of bmesh. */
 
+  /* Data is a flat array outside the CustomData system.
+   * This will be true if simple_array is requested in
+   * SculptAttributeParams, or the PBVH type is PBVH_GRIDS or PBVH_BMESH.
+   */
+  bool simple_array; 
   /* Data stored per BMesh element. */
   int bmesh_cd_offset;
 
diff --git a/source/blender/blenkernel/intern/multires.cc 
b/source/blender/blenkernel/intern/multires.cc
index 7f9a0d64e4b..3700432696a 100644
--- a/source/blender/blenkernel/intern/multires.cc
+++ b/source/blender/blenkernel/intern/multires.cc
@@ -426,6 +426,28 @@ void multires_flush_sculpt_updates(Object *object)
   }
 
   Mesh *mesh = static_cast(object->data);
+
+  /* Check that the multires modifier still exists.
+   * Fixes crash when deleting multires modifier
+   * from within sculpt mode.
+   */
+  ModifierData *md;
+  MultiresModifierData *mmd = nullptr;
+  VirtualModifierData virtualModifierData;
+
+  for (md = BKE_modifiers_get_virtual_modifierlist(object, 
&virtualModifierData); md;
+   md = md->next) {
+if (md->type == eModifierType_Multires) {
+  if (BKE_modifier_is_enabled(nullptr, md, eModifierMode_Realtime)) {
+mmd = (MultiresModifierData *)md;
+  }
+}
+  }
+
+  if (!mmd) {
+return;
+  }
+
   multiresModifier_reshapeFromCCG(
   sculpt_session->multires.modifier->totlvl, mesh, 
sculpt_session->subdiv_ccg);
 
diff --git a/source/blender/blenkernel/intern/paint.cc 
b/source/blender/blenkernel/intern/paint.cc
index 3100b4cc20c..718ec5318ac 100644
--- a/source/blender/blenkernel/intern/paint.cc
+++ b/source/blender/blenkernel/intern/paint.cc
@@ -2454,7 +2454,7 @@ static bool sculpt_attribute_create(SculptSession *ss,
   permanent = (out->params.permanent = false);
 }
 
-simple_array = (out->params.simple_array = true);
+simple_array = true;
   }
 
   BLI_assert(!(simple_array && permanent));
@@ -2466,8 +2466,8 @@ static bool sculpt_attribute_create(SculptSession *ss,
 
 out->data = MEM_calloc_arrayN(totelem, elemsize, __func__);
 
-out->data_for_bmesh = false;
-out->params.simple_array = true;
+out->data_for_bmesh = ss->bm != nullptr;
+out->simple_array = true;
 out->bmesh_cd_offset = -1;
 out->layer = nullptr;
 out->elem_size = elemsize;
@@ -2477,6 +2477,8 @@ static bool sculpt_attribute_create(SculptSession *ss,
 return true;
   }
 
+  out->simple_array = false;
+
   switch (BKE_pbvh_type(ss->pbvh)) {
 case PBVH_BMESH: {
   CustomData *cdata = nullptr;
@@ -2512,8 +2514,6 @@ static bool sculpt_attribute_create(SculptSession *ss,
 case PBVH_FACES: {
   CustomData *cdata = nullptr;
 
-  out->data_for_bmesh = false;
-
   switch (domain) {
 case ATTR_DOMAIN_POINT:
   cdata = &me->vdata;
@@ -2535,10 +2535,10 @@ static bool sculpt_attribute_create(SculptSession *ss,
 cdata->layers[index].flag |= CD_FLAG_TEMPORARY | CD_FLAG_NOCOPY;
   }
 
-  out->data = nullptr;
   out->layer = cdata->layers + index;
-  out->bmesh_cd_offset = -1;
   out->data = out->layer->data;
+  out->data_for_bmesh = false;
+  out->bmesh_cd_offset = -1;
   out->elem_size = CustomData_get_elem_size(out->layer);
 
   break;
@@ -2566,31 +2566,36 @@ static bool sculpt_attr_update(Object *ob, 
SculptAttribute *attr)
 
   bool bad = false;
 
-  if (attr->params.simple_array) {
+  if (attr->data) {
 bad = attr->elem_num != elem_num;
-
-if (bad) {
-

[Bf-blender-cvs] [8ee020d11fe] master: Fix T103195: Initialize face sets from bevel weights broken

2022-12-13 Thread Hans Goudey
Commit: 8ee020d11fe8debfd64274658d71d0d60b27e676
Author: Hans Goudey
Date:   Tue Dec 13 14:26:46 2022 -0600
Branches: master
https://developer.blender.org/rB8ee020d11fe8debfd64274658d71d0d60b27e676

Fix T103195: Initialize face sets from bevel weights broken

The conversion from char to float (divide by 255) wasn't removed in
291c313f80b48fcc. Also fix a crash when the edge crease layer
didn't exist.

===

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

===

diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.cc 
b/source/blender/editors/sculpt_paint/sculpt_face_set.cc
index d0c8a19434b..7253a41f97f 100644
--- a/source/blender/editors/sculpt_paint/sculpt_face_set.cc
+++ b/source/blender/editors/sculpt_paint/sculpt_face_set.cc
@@ -692,7 +692,7 @@ static int sculpt_face_set_init_exec(bContext *C, 
wmOperator *op)
   CustomData_get_layer(&mesh->edata, CD_CREASE));
   sculpt_face_sets_init_flood_fill(
   ob, [&](const int /*from_face*/, const int edge, const int 
/*to_face*/) -> bool {
-return creases[edge] < threshold;
+return creases ? creases[edge] < threshold : true;
   });
   break;
 }
@@ -709,7 +709,7 @@ static int sculpt_face_set_init_exec(bContext *C, 
wmOperator *op)
   CustomData_get_layer(&mesh->edata, CD_BWEIGHT));
   sculpt_face_sets_init_flood_fill(
   ob, [&](const int /*from_face*/, const int edge, const int 
/*to_face*/) -> bool {
-return bevel_weights ? bevel_weights[edge] / 255.0f < threshold : 
true;
+return bevel_weights ? bevel_weights[edge] < threshold : true;
   });
   break;
 }

___
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] [bdd34f4fa25] master: Fix T103051: Changed behavior when removing a material slot

2022-12-13 Thread Hans Goudey
Commit: bdd34f4fa25c7382bac452db82af639bab453046
Author: Hans Goudey
Date:   Tue Dec 13 13:36:48 2022 -0600
Branches: master
https://developer.blender.org/rBbdd34f4fa25c7382bac452db82af639bab453046

Fix T103051: Changed behavior when removing a material slot

Before f1c0249f34c4171ec311 the material was assigned to the previous
slot rather than the next. Though the behavior is arbitrary, there
is no reason to change it.

===

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

===

diff --git a/source/blender/blenkernel/intern/mesh.cc 
b/source/blender/blenkernel/intern/mesh.cc
index 1fafec810ba..1fd2a72f311 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -1363,7 +1363,7 @@ void BKE_mesh_material_index_remove(Mesh *me, short index)
   }
   MutableVArraySpan indices_span(material_indices.varray);
   for (const int i : indices_span.index_range()) {
-if (indices_span[i] > 0 && indices_span[i] > index) {
+if (indices_span[i] > 0 && indices_span[i] >= index) {
   indices_span[i]--;
 }
   }

___
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] [29f342774ce] master: Fix T103052: Box trim does not create face sets attribute

2022-12-13 Thread Hans Goudey
Commit: 29f342774ce134c723a7acf80adfa408e482a042
Author: Hans Goudey
Date:   Tue Dec 13 14:11:06 2022 -0600
Branches: master
https://developer.blender.org/rB29f342774ce134c723a7acf80adfa408e482a042

Fix T103052: Box trim does not create face sets attribute

Previously the sculpt box trim operator always created face sets,
but after face sets became optional it only modified them if they
already existed. Absent a better way to turn the behavior on and off,
the fix is to just always create face sets.

===

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

===

diff --git a/source/blender/editors/sculpt_paint/paint_mask.c 
b/source/blender/editors/sculpt_paint/paint_mask.c
index eb24d15dad5..ad9ae6b4349 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -1345,6 +1345,11 @@ static void 
sculpt_gesture_apply_trim(SculptGestureContext *sgcontext)
 
 static void sculpt_gesture_trim_begin(bContext *C, SculptGestureContext 
*sgcontext)
 {
+  Object *object = sgcontext->vc.obact;
+  SculptSession *ss = object->sculpt;
+  Mesh *mesh = (Mesh *)object->data;
+  ss->face_sets = BKE_sculpt_face_sets_ensure(mesh);
+
   Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
   sculpt_gesture_trim_calculate_depth(sgcontext);
   sculpt_gesture_trim_geometry_generate(sgcontext);
@@ -1369,9 +1374,9 @@ static void sculpt_gesture_trim_end(bContext *UNUSED(C), 
SculptGestureContext *s
 {
   Object *object = sgcontext->vc.obact;
   SculptSession *ss = object->sculpt;
+  Mesh *mesh = (Mesh *)object->data;
 
-  ss->face_sets = CustomData_get_layer_named(
-  &((Mesh *)object->data)->pdata, CD_PROP_INT32, ".sculpt_face_set");
+  ss->face_sets = CustomData_get_layer_named(&mesh->pdata, CD_PROP_INT32, 
".sculpt_face_set");
   if (ss->face_sets) {
 /* Assign a new Face Set ID to the new faces created by the trim 
operation. */
 const int next_face_set_id = 
ED_sculpt_face_sets_find_next_available_id(object->data);

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


[Bf-blender-cvs] [b255bb87cbf] refactor-mesh-uv-map-generic: Make generated objects use 'UVMap' as name for their uv maps.

2022-12-13 Thread Martijn Versteegh
Commit: b255bb87cbf978d866038f15750bcbbdd2c57519
Author: Martijn Versteegh
Date:   Tue Dec 13 19:50:49 2022 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rBb255bb87cbf978d866038f15750bcbbdd2c57519

Make generated objects use 'UVMap' as name for their uv maps.

Now the UVMaps are stored in a float2 attribute layer, the default
layername is 'Float2'. Using 'UVMap' as name for a uv map is more
descriptive.

===

M   source/blender/modifiers/intern/MOD_ocean.c
M   
source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc

===

diff --git a/source/blender/modifiers/intern/MOD_ocean.c 
b/source/blender/modifiers/intern/MOD_ocean.c
index 6da94bd4f90..44ea944bc83 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -288,8 +288,8 @@ static Mesh *generate_ocean_geometry(OceanModifierData 
*omd, Mesh *mesh_orig, co
 
   /* add uvs */
   if (CustomData_number_of_layers(&result->ldata, CD_PROP_FLOAT2) < 
MAX_MTFACE) {
-gogd.mloopuvs = CustomData_add_layer(
-&result->ldata, CD_PROP_FLOAT2, CD_SET_DEFAULT, NULL, polys_num * 4);
+gogd.mloopuvs = CustomData_add_layer_named(
+&result->ldata, CD_PROP_FLOAT2, CD_SET_DEFAULT, NULL, polys_num * 4, 
"UVMap");
 
 if (gogd.mloopuvs) { /* unlikely to fail */
   gogd.ix = 1.0 / gogd.rx;
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 4d59d904405..623ff98fc0d 100644
--- 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
@@ -35,7 +35,7 @@ static Mesh *create_ico_sphere_mesh(const int subdivisions, 
const float radius)
   bmesh_create_params.use_toolflags = true;
   const BMAllocTemplate allocsize = {0, 0, 0, 0};
   BMesh *bm = BM_mesh_create(&allocsize, &bmesh_create_params);
-  BM_data_layer_add_named(bm, &bm->ldata, CD_PROP_FLOAT2, nullptr);
+  BM_data_layer_add_named(bm, &bm->ldata, CD_PROP_FLOAT2, "UVMap");
   /* Make sure the associated bool layers exists as well.
* Normally this would be done when adding a UV layer via python
* or when copying from Mesh, but when we 'manually' create the UV layer

___
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] [2c5a525d640] master: Cleanup: indentation, remove and rename variables

2022-12-13 Thread Germano Cavalcante
Commit: 2c5a525d6409dec84c6ace8fb5d67d8f10f5889d
Author: Germano Cavalcante
Date:   Tue Dec 13 13:26:03 2022 -0300
Branches: master
https://developer.blender.org/rB2c5a525d6409dec84c6ace8fb5d67d8f10f5889d

Cleanup: indentation, remove and rename variables

The `transform_convert_clip_mirror_modifier_apply` code is made more readable 
by:
- decreasing indentation;
- removing `axis` and `tolerance` variables;
- renaming `int clip` to `bool is_clipping`;

===

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

===

diff --git a/source/blender/editors/transform/transform_convert.c 
b/source/blender/editors/transform/transform_convert.c
index f9ad09b7a10..b5373b4fd6c 100644
--- a/source/blender/editors/transform/transform_convert.c
+++ b/source/blender/editors/transform/transform_convert.c
@@ -1070,87 +1070,75 @@ void 
transform_convert_clip_mirror_modifier_apply(TransDataContainer *tc)
 {
   Object *ob = tc->obedit;
   ModifierData *md = ob->modifiers.first;
-  float tolerance[3] = {0.0f, 0.0f, 0.0f};
-  int axis = 0;
 
   for (; md; md = md->next) {
 if ((md->type == eModifierType_Mirror) && (md->mode & 
eModifierMode_Realtime)) {
   MirrorModifierData *mmd = (MirrorModifierData *)md;
 
-  if (mmd->flag & MOD_MIR_CLIPPING) {
-axis = 0;
-if (mmd->flag & MOD_MIR_AXIS_X) {
-  axis |= 1;
-  tolerance[0] = mmd->tolerance;
-}
-if (mmd->flag & MOD_MIR_AXIS_Y) {
-  axis |= 2;
-  tolerance[1] = mmd->tolerance;
-}
-if (mmd->flag & MOD_MIR_AXIS_Z) {
-  axis |= 4;
-  tolerance[2] = mmd->tolerance;
-}
-if (axis) {
-  float mtx[4][4], imtx[4][4];
-  int i;
+  if ((mmd->flag & MOD_MIR_CLIPPING) == 0) {
+continue;
+  }
 
-  if (mmd->mirror_ob) {
-float obinv[4][4];
+  if ((mmd->flag & (MOD_MIR_AXIS_X | MOD_MIR_AXIS_Y | MOD_MIR_AXIS_Y)) == 
0) {
+continue;
+  }
 
-invert_m4_m4(obinv, mmd->mirror_ob->object_to_world);
-mul_m4_m4m4(mtx, obinv, ob->object_to_world);
-invert_m4_m4(imtx, mtx);
-  }
+  float mtx[4][4], imtx[4][4];
 
-  TransData *td = tc->data;
-  for (i = 0; i < tc->data_len; i++, td++) {
-int clip;
-float loc[3], iloc[3];
+  if (mmd->mirror_ob) {
+float obinv[4][4];
 
-if (td->loc == NULL) {
-  break;
-}
+invert_m4_m4(obinv, mmd->mirror_ob->object_to_world);
+mul_m4_m4m4(mtx, obinv, ob->object_to_world);
+invert_m4_m4(imtx, mtx);
+  }
 
-if (td->flag & TD_SKIP) {
-  continue;
-}
+  TransData *td = tc->data;
+  for (int i = 0; i < tc->data_len; i++, td++) {
+float loc[3], iloc[3];
 
-copy_v3_v3(loc, td->loc);
-copy_v3_v3(iloc, td->iloc);
+if (td->loc == NULL) {
+  break;
+}
 
-if (mmd->mirror_ob) {
-  mul_m4_v3(mtx, loc);
-  mul_m4_v3(mtx, iloc);
-}
+if (td->flag & TD_SKIP) {
+  continue;
+}
 
-clip = 0;
-if (axis & 1) {
-  if (fabsf(iloc[0]) <= tolerance[0] || loc[0] * iloc[0] < 0.0f) {
-loc[0] = 0.0f;
-clip = 1;
-  }
-}
+copy_v3_v3(loc, td->loc);
+copy_v3_v3(iloc, td->iloc);
 
-if (axis & 2) {
-  if (fabsf(iloc[1]) <= tolerance[1] || loc[1] * iloc[1] < 0.0f) {
-loc[1] = 0.0f;
-clip = 1;
-  }
-}
-if (axis & 4) {
-  if (fabsf(iloc[2]) <= tolerance[2] || loc[2] * iloc[2] < 0.0f) {
-loc[2] = 0.0f;
-clip = 1;
-  }
-}
-if (clip) {
-  if (mmd->mirror_ob) {
-mul_m4_v3(imtx, loc);
-  }
-  copy_v3_v3(td->loc, loc);
-}
+if (mmd->mirror_ob) {
+  mul_m4_v3(mtx, loc);
+  mul_m4_v3(mtx, iloc);
+}
+
+bool is_clipping = false;
+if (mmd->flag & MOD_MIR_AXIS_X) {
+  if (fabsf(iloc[0]) <= mmd->tolerance || loc[0] * iloc[0] < 0.0f) {
+loc[0] = 0.0f;
+is_clipping = true;
+  }
+}
+
+if (mmd->flag & MOD_MIR_AXIS_Y) {
+  if (fabsf(iloc[1]) <= mmd->tolerance || loc[1] * iloc[1] < 0.0f) {
+loc[1] = 0.0f;
+is_clipping = true;
+  }
+}
+if (mmd->flag & MOD_MIR_AXIS_Z) {
+  if (fabsf(iloc[2]) <= mmd->tolerance || loc[2] * iloc[2] < 0.0f) {
+loc[2] = 0.0f;
+is_clipping = true;
+  }
+}
+
+if (is_clipping) {
+  if (mmd->mirror_ob) {
+

[Bf-blender-cvs] [31ba4dd82e2] master: Build: bump OSL version to hash in 1.13 which is under development

2022-12-13 Thread Brecht Van Lommel
Commit: 31ba4dd82e2fff2a79c398b1ec1bfa523d107def
Author: Brecht Van Lommel
Date:   Tue Dec 13 18:53:12 2022 +0100
Branches: master
https://developer.blender.org/rB31ba4dd82e2fff2a79c398b1ec1bfa523d107def

Build: bump OSL version to hash in 1.13 which is under development

This includes string table changes to make the Cycles OptiX support work.

===

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 097f632b356..870f2da9abe 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -195,9 +195,12 @@ set(TIFF_HASH_TYPE MD5)
 set(TIFF_FILE tiff-${TIFF_VERSION}.tar.gz)
 set(TIFF_CPE "cpe:2.3:a:libtiff:libtiff:${TIFF_VERSION}:*:*:*:*:*:*:*")
 
-set(OSL_VERSION 1.12.7.1)
-set(OSL_URI 
https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/archive/v${OSL_VERSION}.tar.gz)
-set(OSL_HASH 53211da86c34ba6e0344998c1a6d219c)
+# Recent commit from 1.13.0.2 under development, which includes string table
+# changes that make the Cycles OptiX implementation work. Official 1.12 OSL
+# releases should also build but without OptiX support.
+set(OSL_VERSION 1a7670600c8b08c2443a78d03c8c27e9a1149140)
+set(OSL_URI 
https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/archive/${OSL_VERSION}.tar.gz)
+set(OSL_HASH 7b6d6716b05d1addb92a8f47280bf77f)
 set(OSL_HASH_TYPE MD5)
 set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz)

___
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] [b50c475cd25] master: Cleanup: move listbase.c to c++

2022-12-13 Thread Jacques Lucke
Commit: b50c475cd251cbb730ac4af26cb99bc71e529147
Author: Jacques Lucke
Date:   Tue Dec 13 18:12:52 2022 +0100
Branches: master
https://developer.blender.org/rBb50c475cd251cbb730ac4af26cb99bc71e529147

Cleanup: move listbase.c to c++

===

M   intern/ghost/test/CMakeLists.txt
M   source/blender/blenlib/CMakeLists.txt
R072source/blender/blenlib/intern/listbase.c
source/blender/blenlib/intern/listbase.cc
M   source/blender/makesdna/intern/CMakeLists.txt

===

diff --git a/intern/ghost/test/CMakeLists.txt b/intern/ghost/test/CMakeLists.txt
index 3f74f97f115..11dd6f75ef9 100644
--- a/intern/ghost/test/CMakeLists.txt
+++ b/intern/ghost/test/CMakeLists.txt
@@ -167,7 +167,7 @@ add_library(bli_lib
   "../../../source/blender/blenlib/intern/rct.c"
   "../../../source/blender/blenlib/intern/string.c"
   "../../../source/blender/blenlib/intern/string_utf8.c"
-  "../../../source/blender/blenlib/intern/listbase.c"
+  "../../../source/blender/blenlib/intern/listbase.cc"
   "../../../source/blender/blenlib/intern/math_color.c"
   "../../../source/blender/blenlib/intern/math_geom.c"
   "../../../source/blender/blenlib/intern/math_matrix.c"
diff --git a/source/blender/blenlib/CMakeLists.txt 
b/source/blender/blenlib/CMakeLists.txt
index 1229344cb05..17218a2daed 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -89,7 +89,7 @@ set(SRC
   intern/lasso_2d.c
   intern/lazy_threading.cc
   intern/length_parameterize.cc
-  intern/listbase.c
+  intern/listbase.cc
   intern/math_base.c
   intern/math_base_inline.c
   intern/math_base_safe_inline.c
diff --git a/source/blender/blenlib/intern/listbase.c 
b/source/blender/blenlib/intern/listbase.cc
similarity index 72%
rename from source/blender/blenlib/intern/listbase.c
rename to source/blender/blenlib/intern/listbase.cc
index 3932e5eb051..ee0c6fcd5c3 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.cc
@@ -22,56 +22,56 @@
 
 void BLI_movelisttolist(ListBase *dst, ListBase *src)
 {
-  if (src->first == NULL) {
+  if (src->first == nullptr) {
 return;
   }
 
-  if (dst->first == NULL) {
+  if (dst->first == nullptr) {
 dst->first = src->first;
 dst->last = src->last;
   }
   else {
-((Link *)dst->last)->next = src->first;
-((Link *)src->first)->prev = dst->last;
+((Link *)dst->last)->next = static_cast(src->first);
+((Link *)src->first)->prev = static_cast(dst->last);
 dst->last = src->last;
   }
-  src->first = src->last = NULL;
+  src->first = src->last = nullptr;
 }
 
 void BLI_movelisttolist_reverse(ListBase *dst, ListBase *src)
 {
-  if (src->first == NULL) {
+  if (src->first == nullptr) {
 return;
   }
 
-  if (dst->first == NULL) {
+  if (dst->first == nullptr) {
 dst->first = src->first;
 dst->last = src->last;
   }
   else {
-((Link *)src->last)->next = dst->first;
-((Link *)dst->first)->prev = src->last;
+((Link *)src->last)->next = static_cast(dst->first);
+((Link *)dst->first)->prev = static_cast(src->last);
 dst->first = src->first;
   }
 
-  src->first = src->last = NULL;
+  src->first = src->last = nullptr;
 }
 
 void BLI_addhead(ListBase *listbase, void *vlink)
 {
-  Link *link = vlink;
+  Link *link = static_cast(vlink);
 
-  if (link == NULL) {
+  if (link == nullptr) {
 return;
   }
 
-  link->next = listbase->first;
-  link->prev = NULL;
+  link->next = static_cast(listbase->first);
+  link->prev = nullptr;
 
   if (listbase->first) {
 ((Link *)listbase->first)->prev = link;
   }
-  if (listbase->last == NULL) {
+  if (listbase->last == nullptr) {
 listbase->last = link;
   }
   listbase->first = link;
@@ -79,19 +79,19 @@ void BLI_addhead(ListBase *listbase, void *vlink)
 
 void BLI_addtail(ListBase *listbase, void *vlink)
 {
-  Link *link = vlink;
+  Link *link = static_cast(vlink);
 
-  if (link == NULL) {
+  if (link == nullptr) {
 return;
   }
 
-  link->next = NULL;
-  link->prev = listbase->last;
+  link->next = nullptr;
+  link->prev = static_cast(listbase->last);
 
   if (listbase->last) {
 ((Link *)listbase->last)->next = link;
   }
-  if (listbase->first == NULL) {
+  if (listbase->first == nullptr) {
 listbase->first = link;
   }
   listbase->last = link;
@@ -99,9 +99,9 @@ void BLI_addtail(ListBase *listbase, void *vlink)
 
 void BLI_remlink(ListBase *listbase, void *vlink)
 {
-  Link *link = vlink;
+  Link *link = static_cast(vlink);
 
-  if (link == NULL) {
+  if (link == nullptr) {
 return;
   }
 
@@ -132,8 +132,8 @@ bool BLI_remlink_safe(ListBase *listbase, void *vlink)
 
 void BLI_listbase_swaplinks(ListBase *listbase, void *vlinka, void *vlinkb)
 {
-  Link *linka = vlinka;
-  Link *linkb = vlinkb;
+  Link *linka = static_cast(vlinka);
+  Link *linkb = static_cast(vlinkb);
 
   if (!linka || !linkb) {
 return;
@

[Bf-blender-cvs] [0a5e8a63420] master: Sculpt: Fix crash in dyntopo

2022-12-13 Thread Joseph Eagar
Commit: 0a5e8a63420de7efcf874370009831da8f19e215
Author: Joseph Eagar
Date:   Tue Dec 13 08:46:05 2022 -0800
Branches: master
https://developer.blender.org/rB0a5e8a63420de7efcf874370009831da8f19e215

Sculpt: Fix crash in dyntopo

Attribute wrangler in PBVH_BMESH mode was
converting real attributes (e.g. vertex node index)
into simple arrays when validating the attribute list.

===

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

===

diff --git a/source/blender/blenkernel/intern/paint.cc 
b/source/blender/blenkernel/intern/paint.cc
index 200eb3e8732..3100b4cc20c 100644
--- a/source/blender/blenkernel/intern/paint.cc
+++ b/source/blender/blenkernel/intern/paint.cc
@@ -2466,7 +2466,8 @@ static bool sculpt_attribute_create(SculptSession *ss,
 
 out->data = MEM_calloc_arrayN(totelem, elemsize, __func__);
 
-out->data_for_bmesh = ss->bm != nullptr;
+out->data_for_bmesh = false;
+out->params.simple_array = true;
 out->bmesh_cd_offset = -1;
 out->layer = nullptr;
 out->elem_size = elemsize;
@@ -2598,7 +2599,7 @@ static bool sculpt_attr_update(Object *ob, 
SculptAttribute *attr)
 attr,
 &attr->params,
 BKE_pbvh_type(ss->pbvh),
-true);
+attr->data_for_bmesh);
   }
 
   return bad;

___
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] [246df680958] master: Sculpt: Fix crash with unsupported attr types in pbvh draw

2022-12-13 Thread Joseph Eagar
Commit: 246df68095835110a3e11eb3c7a9d2acb048332c
Author: Joseph Eagar
Date:   Tue Dec 13 08:37:04 2022 -0800
Branches: master
https://developer.blender.org/rB246df68095835110a3e11eb3c7a9d2acb048332c

Sculpt: Fix crash with unsupported attr types in pbvh draw

===

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

===

diff --git a/source/blender/draw/intern/draw_pbvh.cc 
b/source/blender/draw/intern/draw_pbvh.cc
index cac3e3339fc..d56a86ab44c 100644
--- a/source/blender/draw/intern/draw_pbvh.cc
+++ b/source/blender/draw/intern/draw_pbvh.cc
@@ -66,6 +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:
+  return true;
+  }
+
+  return false;
+}
+
 struct PBVHVbo {
   uint64_t type;
   eAttrDomain domain;
@@ -228,6 +244,10 @@ struct PBVHBatches {
 for (int i : IndexRange(attrs_num)) {
   PBVHAttrReq *attr = attrs + i;
 
+  if (!valid_pbvh_attr(attr->type)) {
+continue;
+  }
+
   PBVHVbo vbo(attr->domain, attr->type, string(attr->name));
   vbo.build_key();
 
@@ -858,10 +878,10 @@ struct PBVHBatches {
 break;
   }
   default:
-BLI_assert(0);
-printf("%s: error\n", __func__);
+printf("%s: Unsupported attribute type %d\n", __func__, type);
+BLI_assert_unreachable();
 
-break;
+return;
 }
 
 if (need_aliases) {
@@ -1227,6 +1247,10 @@ struct PBVHBatches {
 for (int i : IndexRange(attrs_num)) {
   PBVHAttrReq *attr = attrs + i;
 
+  if (!valid_pbvh_attr(attr->type)) {
+continue;
+  }
+
   if (!has_vbo(attr->domain, int(attr->type), attr->name)) {
 create_vbo(attr->domain, uint32_t(attr->type), attr->name, args);
   }

___
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] [ea7570989d2] master: Cleanup: add utility method to get group input nodes

2022-12-13 Thread Jacques Lucke
Commit: ea7570989d2abef4208dc41ba118859244b1db03
Author: Jacques Lucke
Date:   Tue Dec 13 17:25:37 2022 +0100
Branches: master
https://developer.blender.org/rBea7570989d2abef4208dc41ba118859244b1db03

Cleanup: add utility method to get group input nodes

===

M   source/blender/blenkernel/BKE_node_runtime.hh
M   source/blender/blenkernel/intern/node_tree_field_inferencing.cc
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/modifiers/intern/MOD_nodes.cc
M   source/blender/nodes/intern/derived_node_tree.cc

===

diff --git a/source/blender/blenkernel/BKE_node_runtime.hh 
b/source/blender/blenkernel/BKE_node_runtime.hh
index 979c7630865..6a00e70cb5b 100644
--- a/source/blender/blenkernel/BKE_node_runtime.hh
+++ b/source/blender/blenkernel/BKE_node_runtime.hh
@@ -421,6 +421,11 @@ inline const bNode *bNodeTree::group_output_node() const
   return this->runtime->group_output_node;
 }
 
+inline blender::Span bNodeTree::group_input_nodes() const
+{
+  return this->nodes_by_type("NodeGroupInput");
+}
+
 inline blender::Span bNodeTree::all_input_sockets() const
 {
   
BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this));
diff --git a/source/blender/blenkernel/intern/node_tree_field_inferencing.cc 
b/source/blender/blenkernel/intern/node_tree_field_inferencing.cc
index 82e425dfbb9..88fd3636633 100644
--- a/source/blender/blenkernel/intern/node_tree_field_inferencing.cc
+++ b/source/blender/blenkernel/intern/node_tree_field_inferencing.cc
@@ -340,7 +340,7 @@ static void determine_group_input_states(
   }
   /* Check if group inputs are required to be single values, because they are 
(indirectly)
* connected to some socket that does not support fields. */
-  for (const bNode *node : tree.nodes_by_type("NodeGroupInput")) {
+  for (const bNode *node : tree.group_input_nodes()) {
 for (const bNodeSocket *output_socket : 
node->output_sockets().drop_back(1)) {
   SocketFieldState &state = 
field_state_by_socket_id[output_socket->index_in_tree()];
   if (state.requires_single) {
@@ -349,7 +349,7 @@ static void determine_group_input_states(
 }
   }
   /* If an input does not support fields, this should be reflected in all 
Group Input nodes. */
-  for (const bNode *node : tree.nodes_by_type("NodeGroupInput")) {
+  for (const bNode *node : tree.group_input_nodes()) {
 for (const bNodeSocket *output_socket : 
node->output_sockets().drop_back(1)) {
   SocketFieldState &state = 
field_state_by_socket_id[output_socket->index_in_tree()];
   const bool supports_field = 
new_inferencing_interface.inputs[output_socket->index()] !=
diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index 424a4c17e82..6313791bd3c 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -634,6 +634,8 @@ typedef struct bNodeTree {
   bool has_undefined_nodes_or_sockets() const;
   /** Get the active group output node. */
   const bNode *group_output_node() const;
+  /** Get all input nodes of the node group. */
+  blender::Span group_input_nodes() const;
 #endif
 } bNodeTree;
 
diff --git a/source/blender/modifiers/intern/MOD_nodes.cc 
b/source/blender/modifiers/intern/MOD_nodes.cc
index a8e5e2ab0a2..f5ede42b0ad 100644
--- a/source/blender/modifiers/intern/MOD_nodes.cc
+++ b/source/blender/modifiers/intern/MOD_nodes.cc
@@ -1401,7 +1401,7 @@ static void attribute_search_update_fn(
 }
   }
   else {
-for (const bNode *node : nmd->node_group->nodes_by_type("NodeGroupInput")) 
{
+for (const bNode *node : nmd->node_group->group_input_nodes()) {
   for (const bNodeSocket *socket : node->output_sockets()) {
 if (socket->type == SOCK_GEOMETRY) {
   sockets_to_check.append(socket);
diff --git a/source/blender/nodes/intern/derived_node_tree.cc 
b/source/blender/nodes/intern/derived_node_tree.cc
index 50fbf791536..ece60ffe4ab 100644
--- a/source/blender/nodes/intern/derived_node_tree.cc
+++ b/source/blender/nodes/intern/derived_node_tree.cc
@@ -115,7 +115,7 @@ Vector 
DInputSocket::get_corresponding_group_input_sockets() cons
   BLI_assert(child_context != nullptr);
 
   const bNodeTree &child_tree = child_context->btree();
-  Span group_input_nodes = 
child_tree.nodes_by_type("NodeGroupInput");
+  Span group_input_nodes = child_tree.group_input_nodes();
   const int socket_index = bsocket_->index();
   Vector sockets;
   for (const bNode *group_input_node : group_input_nodes) {

___
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] [8cd9317b67e] refactor-mesh-position-generic: Various small cleanups

2022-12-13 Thread Hans Goudey
Commit: 8cd9317b67e860d1af173d46a502aeba1aba709c
Author: Hans Goudey
Date:   Mon Dec 12 23:11:47 2022 -0600
Branches: refactor-mesh-position-generic
https://developer.blender.org/rB8cd9317b67e860d1af173d46a502aeba1aba709c

Various small cleanups

===

M   source/blender/blenkernel/intern/multires.cc
M   source/blender/blenkernel/intern/object.cc
M   source/blender/blenkernel/intern/subdiv_eval.c
M   source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc
M   source/blender/io/usd/intern/usd_reader_mesh.cc
M   source/blender/makesdna/DNA_mesh_types.h
M   source/blender/makesdna/DNA_meshdata_types.h
M   source/blender/modifiers/intern/MOD_mask.cc
M   source/blender/modifiers/intern/MOD_normal_edit.cc
M   source/blender/modifiers/intern/MOD_screw.cc
M   source/blender/render/intern/multires_bake.cc

===

diff --git a/source/blender/blenkernel/intern/multires.cc 
b/source/blender/blenkernel/intern/multires.cc
index a53e6704f57..0f043c60558 100644
--- a/source/blender/blenkernel/intern/multires.cc
+++ b/source/blender/blenkernel/intern/multires.cc
@@ -1596,7 +1596,7 @@ int mdisp_rot_face_to_crn(
 float mindist = FLT_MAX;
 
 for (i = 0; i < mpoly->totloop; i++) {
-  float len = len_v3v3(nullptr, positions[mloop[mpoly->loopstart + 
i].v].co);
+  float len = len_v3v3(nullptr, positions[mloop[mpoly->loopstart + i].v]);
   if (len < mindist) {
 mindist = len;
 minS = i;
diff --git a/source/blender/blenkernel/intern/object.cc 
b/source/blender/blenkernel/intern/object.cc
index a86856fde09..4922d283c03 100644
--- a/source/blender/blenkernel/intern/object.cc
+++ b/source/blender/blenkernel/intern/object.cc
@@ -4806,9 +4806,9 @@ bool BKE_object_shapekey_remove(Main *bmain, Object *ob, 
KeyBlock *kb)
   switch (ob->type) {
 case OB_MESH: {
   Mesh *mesh = (Mesh *)ob->data;
-  MutableSpan verts = mesh->positions_for_write();
+  MutableSpan positions = mesh->positions_for_write();
   BKE_keyblock_convert_to_mesh(
-  key->refkey, reinterpret_cast(verts.data()), 
mesh->totvert);
+  key->refkey, reinterpret_cast(positions.data()), 
mesh->totvert);
   break;
 }
 case OB_CURVES_LEGACY:
diff --git a/source/blender/blenkernel/intern/subdiv_eval.c 
b/source/blender/blenkernel/intern/subdiv_eval.c
index 97c8d08589b..60ba96c86a2 100644
--- a/source/blender/blenkernel/intern/subdiv_eval.c
+++ b/source/blender/blenkernel/intern/subdiv_eval.c
@@ -81,8 +81,7 @@ static void set_coarse_positions(Subdiv *subdiv,
  const Mesh *mesh,
  const float (*coarse_vertex_cos)[3])
 {
-  const float (*positions)[3]
- = BKE_mesh_positions(mesh);
+  const float(*positions)[3] = BKE_mesh_positions(mesh);
   const MPoly *mpoly = BKE_mesh_polys(mesh);
   const MLoop *mloop = BKE_mesh_loops(mesh);
   /* Mark vertices which needs new coordinates. */
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc 
b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc
index 730f7c400a7..5a4b9dab8ad 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc
@@ -1411,7 +1411,7 @@ struct LineartEdgeNeighbor {
   int v1, v2;
 };
 
-typedef struct VertData {
+struct VertData {
   const float (*positions)[3];
   LineartVert *v_arr;
   double (*model_view)[4];
diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc 
b/source/blender/io/usd/intern/usd_reader_mesh.cc
index 6977c4927dc..1a206a2ec22 100644
--- a/source/blender/io/usd/intern/usd_reader_mesh.cc
+++ b/source/blender/io/usd/intern/usd_reader_mesh.cc
@@ -695,9 +695,9 @@ void USDMeshReader::read_mesh_sample(ImportSettings 
*settings,
* in code that expect this data to be there. */
 
   if (new_mesh || (settings->read_flag & MOD_MESHSEQ_READ_VERT) != 0) {
-MutableSpan verts = mesh->positions_for_write();
+MutableSpan mesh_positions = mesh->positions_for_write();
 for (int i = 0; i < positions_.size(); i++) {
-  verts[i] = {positions_[i][0], positions_[i][1], positions_[i][2]};
+  mesh_positions[i] = {positions_[i][0], positions_[i][1], 
positions_[i][2]};
 }
 BKE_mesh_tag_coords_changed(mesh);
 
diff --git a/source/blender/makesdna/DNA_mesh_types.h 
b/source/blender/makesdna/DNA_mesh_types.h
index 7e0911a9968..eede33fa24f 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -13,10 +13,6 @@
 #include "DNA_meshdata_types.h"
 #include "DNA_session_uuid_types.h"
 
-#ifdef __cplusplus
-#  include "BLI_math_vec_types.hh"
-#endif
-
 /** Workaround to forward-declare C++ type in C header. */
 #ifdef __cplusplus
 
diff --git a/source/blender/makesdna/DNA_meshdata

[Bf-blender-cvs] [9579e3eef23] master: Cleanup: remove unused parameter in calc_brush_local_mat.

2022-12-13 Thread Jeroen Bakker
Commit: 9579e3eef2340a336329b8670e9b3923f7d75ce4
Author: Jeroen Bakker
Date:   Tue Dec 13 15:52:50 2022 +0100
Branches: master
https://developer.blender.org/rB9579e3eef2340a336329b8670e9b3923f7d75ce4

Cleanup: remove unused parameter in calc_brush_local_mat.

===

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

===

diff --git a/source/blender/editors/sculpt_paint/sculpt.cc 
b/source/blender/editors/sculpt_paint/sculpt.cc
index 98cb6130f87..416f394e8ee 100644
--- a/source/blender/editors/sculpt_paint/sculpt.cc
+++ b/source/blender/editors/sculpt_paint/sculpt.cc
@@ -2862,10 +2862,7 @@ static void calc_local_y(ViewContext *vc, const float 
center[3], float y[3])
   mul_m4_v3(ob->world_to_object, y);
 }
 
-static void calc_brush_local_mat(const Brush *brush,
- const MTex *mtex,
- Object *ob,
- float local_mat[4][4])
+static void calc_brush_local_mat(const MTex *mtex, Object *ob, float 
local_mat[4][4])
 {
   const StrokeCache *cache = ob->sculpt->cache;
   float tmat[4][4];
@@ -2938,7 +2935,7 @@ static void update_brush_local_mat(Sculpt *sd, Object *ob)
   if (cache->mirror_symmetry_pass == 0 && cache->radial_symmetry_pass == 0) {
 const Brush *brush = BKE_paint_brush(&sd->paint);
 const MTex *mask_tex = BKE_brush_mask_texture_get(brush, OB_MODE_SCULPT);
-calc_brush_local_mat(brush, mask_tex, ob, cache->brush_local_mat);
+calc_brush_local_mat(mask_tex, ob, cache->brush_local_mat);
   }
 }

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

2022-12-13 Thread Martijn Versteegh
Commit: 2ba38549f6aaf5adce9a727ebc1bc7742e1e52fa
Author: Martijn Versteegh
Date:   Tue Dec 13 00:01:38 2022 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB2ba38549f6aaf5adce9a727ebc1bc7742e1e52fa

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

===



===

diff --cc source/blender/blenkernel/intern/pbvh_uv_islands.cc
index 3ac4660fe15,21645e50e7e..c16ddfeaffb
--- a/source/blender/blenkernel/intern/pbvh_uv_islands.cc
+++ b/source/blender/blenkernel/intern/pbvh_uv_islands.cc
@@@ -115,8 -115,8 +115,8 @@@ static void mesh_data_init_primitives(M
  for (int j = 0; j < 3; j++) {
MeshUVVert uv_vert;
uv_vert.loop = tri.tri[j];
-   uv_vert.vertex = &mesh_data.vertices[mesh_data.mloop[uv_vert.loop].v];
+   uv_vert.vertex = &mesh_data.vertices[mesh_data.loops[uv_vert.loop].v];
 -  uv_vert.uv = mesh_data.mloopuv[uv_vert.loop].uv;
 +  uv_vert.uv = mesh_data.mloopuv[uv_vert.loop];
primitive.vertices.append(uv_vert);
  }
  mesh_data.primitives.append(primitive);
@@@ -215,16 -215,11 +215,11 @@@ static void mesh_data_init(MeshData &me
mesh_data_init_primitive_uv_island_ids(mesh_data);
  }
  
- MeshData::MeshData(const MLoopTri *looptri,
-const int64_t looptri_len,
-const int64_t vert_len,
-const MLoop *mloop,
-const float2 *mloopuv)
- : looptri(looptri),
-   looptri_len(looptri_len),
-   vert_len(vert_len),
-   mloop(mloop),
-   mloopuv(mloopuv)
+ MeshData::MeshData(const Span looptris,
+const Span loops,
+const int verts_num,
 -   const Span mloopuv)
++   const Span mloopuv)
+ : looptris(looptris), verts_num(verts_num), loops(loops), mloopuv(mloopuv)
  {
mesh_data_init(*this);
  }
diff --cc source/blender/blenkernel/intern/pbvh_uv_islands.hh
index eb6f05e356c,4d81f5da00c..98dc0342883
--- a/source/blender/blenkernel/intern/pbvh_uv_islands.hh
+++ b/source/blender/blenkernel/intern/pbvh_uv_islands.hh
@@@ -92,11 -92,10 +92,10 @@@ struct MeshPrimitive 
   */
  struct MeshData {
   public:
-   const MLoopTri *looptri;
-   const int64_t looptri_len;
-   const int64_t vert_len;
-   const MLoop *mloop;
-   const float2 *mloopuv;
+   const Span looptris;
+   const int64_t verts_num;
+   const Span loops;
 -  const Span mloopuv;
++  const Span mloopuv;
  
Vector primitives;
Vector edges;
@@@ -105,11 -104,10 +104,10 @@@
int64_t uv_island_len;
  
   public:
-   explicit MeshData(const MLoopTri *looptri,
- const int64_t looptri_len,
- const int64_t vert_len,
- const MLoop *mloop,
- const float2 *mloopuv);
+   explicit MeshData(const Span looptris,
+ const Span loops,
+ const int verts_num,
 -const Span mloopuv);
++const Span mloopuv);
  };
  
  struct UVVertex {

___
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] [d2feeef6683] refactor-mesh-uv-map-generic: Cleanup: make format

2022-12-13 Thread Martijn Versteegh
Commit: d2feeef6683dbb5d57d88f8c59110ab9ad698f53
Author: Martijn Versteegh
Date:   Mon Dec 12 23:56:12 2022 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rBd2feeef6683dbb5d57d88f8c59110ab9ad698f53

Cleanup: make format

===

M   source/blender/bmesh/intern/bmesh_interp.c

===

diff --git a/source/blender/bmesh/intern/bmesh_interp.c 
b/source/blender/bmesh/intern/bmesh_interp.c
index 745257dd919..92fb0bf225a 100644
--- a/source/blender/bmesh/intern/bmesh_interp.c
+++ b/source/blender/bmesh/intern/bmesh_interp.c
@@ -876,15 +876,27 @@ void BM_data_layer_ensure_named(BMesh *bm, CustomData 
*data, int type, const cha
 void BM_uv_map_ensure_selection_and_pin_attributes(BMesh *bm)
 {
   const int nr_uv_layers = CustomData_number_of_layers(&bm->ldata, 
CD_PROP_FLOAT2);
-  for (int l = 0; l < nr_uv_layers; l++ ) {
-/* note: you can't re-use the returnvalue of CustomData_get_layer_name() 
because adding layers can invalidate that. */
+  for (int l = 0; l < nr_uv_layers; l++) {
+/* note: you can't re-use the returnvalue of CustomData_get_layer_name() 
because adding layers
+ * can invalidate that. */
 char name[MAX_CUSTOMDATA_LAYER_NAME];
 BM_data_layer_ensure_named(
-bm, &bm->ldata, CD_PROP_BOOL, 
BKE_get_uv_map_vert_selection_name(CustomData_get_layer_name(&bm->ldata, 
CD_PROP_FLOAT2, l), name));
+bm,
+&bm->ldata,
+CD_PROP_BOOL,
+BKE_get_uv_map_vert_selection_name(
+CustomData_get_layer_name(&bm->ldata, CD_PROP_FLOAT2, l), name));
 BM_data_layer_ensure_named(
-bm, &bm->ldata, CD_PROP_BOOL, 
BKE_get_uv_map_edge_selection_name(CustomData_get_layer_name(&bm->ldata, 
CD_PROP_FLOAT2, l), name));
+bm,
+&bm->ldata,
+CD_PROP_BOOL,
+BKE_get_uv_map_edge_selection_name(
+CustomData_get_layer_name(&bm->ldata, CD_PROP_FLOAT2, l), name));
 BM_data_layer_ensure_named(
-bm, &bm->ldata, CD_PROP_BOOL, 
BKE_get_uv_map_pin_name(CustomData_get_layer_name(&bm->ldata, CD_PROP_FLOAT2, 
l), name));
+bm,
+&bm->ldata,
+CD_PROP_BOOL,
+BKE_get_uv_map_pin_name(CustomData_get_layer_name(&bm->ldata, 
CD_PROP_FLOAT2, l), name));
   }
 }

___
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] [3ef95d7f196] geometry-nodes-simulation: add theme color for simulation region

2022-12-13 Thread Jacques Lucke
Commit: 3ef95d7f19606cc689724182075634a59ceca04b
Author: Jacques Lucke
Date:   Tue Dec 13 11:44:14 2022 +0100
Branches: geometry-nodes-simulation
https://developer.blender.org/rB3ef95d7f19606cc689724182075634a59ceca04b

add theme color for simulation region

===

M   release/datafiles/userdef/userdef_default_theme.c
M   source/blender/blenloader/intern/versioning_userdef.c
M   source/blender/editors/include/UI_resources.h
M   source/blender/editors/interface/resources.cc
M   source/blender/editors/space_node/node_draw.cc
M   source/blender/makesdna/DNA_userdef_types.h
M   source/blender/makesrna/intern/rna_userdef.c

===

diff --git a/release/datafiles/userdef/userdef_default_theme.c 
b/release/datafiles/userdef/userdef_default_theme.c
index 04ad04d4812..0b177fad3f6 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -866,6 +866,7 @@ const bTheme U_theme_default = {
 .nodeclass_layout = RGBA(0x6c696fff),
 .nodeclass_geometry = RGBA(0x00d6a3ff),
 .nodeclass_attribute = RGBA(0x001566ff),
+.node_region_simulation = RGBA(0x00ff),
 .movie = RGBA(0x0f0f0fcc),
 .gp_vertex_size = 3,
 .gp_vertex = RGBA(0x97979700),
diff --git a/source/blender/blenloader/intern/versioning_userdef.c 
b/source/blender/blenloader/intern/versioning_userdef.c
index b4890131861..3003f6678dd 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -98,6 +98,10 @@ static void do_versions_theme(const UserDef *userdef, bTheme 
*btheme)
*/
   {
 /* Keep this block, even when empty. */
+
+if (btheme->space_node.node_region_simulation[3] == 0) {
+  btheme->space_node.node_region_simulation[3] = 0.1f;
+}
   }
 
 #undef FROM_DEFAULT_V4_UCHAR
diff --git a/source/blender/editors/include/UI_resources.h 
b/source/blender/editors/include/UI_resources.h
index 9a46728097c..e6225ebe60f 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -177,6 +177,8 @@ typedef enum ThemeColorID {
   TH_NODE_GEOMETRY,
   TH_NODE_ATTRIBUTE,
 
+  TH_NODE_REGION_SIMULATION,
+
   TH_CONSOLE_OUTPUT,
   TH_CONSOLE_INPUT,
   TH_CONSOLE_INFO,
diff --git a/source/blender/editors/interface/resources.cc 
b/source/blender/editors/interface/resources.cc
index 74590dccec4..0b7286f65ba 100644
--- a/source/blender/editors/interface/resources.cc
+++ b/source/blender/editors/interface/resources.cc
@@ -635,6 +635,9 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int 
spacetype, int colorid)
 case TH_NODE_GRID_LEVELS:
   cp = &ts->grid_levels;
   break;
+case TH_NODE_REGION_SIMULATION:
+  cp = ts->node_region_simulation;
+  break;
 
 case TH_SEQ_MOVIE:
   cp = ts->movie;
diff --git a/source/blender/editors/space_node/node_draw.cc 
b/source/blender/editors/space_node/node_draw.cc
index f31899c0374..2ca30e3808c 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -92,7 +92,8 @@ using blender::Vector;
 
 namespace blender::ed::space_node {
 struct SubContext {
-  float3 color;
+  float4 background_color;
+  float4 outline_color;
   Vector input_nodes;
   Vector output_nodes;
 };
@@ -2370,7 +2371,7 @@ static void node_draw_basis(const bContext &C,
 UI_GetThemeColor4fv(TH_REDALERT, color_outline);
   }
   else {
-copy_v3_v3(color_outline, context->color);
+copy_v3_v3(color_outline, context->outline_color);
 color_outline[3] = 1.0f;
   }
 }
@@ -3045,7 +3046,11 @@ static void node_draw_sub_context_frames(TreeDrawContext 
&tree_draw_ctx,
   for (const bNode *sim_input : all_simulation_inputs) {
 const auto &storage = *static_cast(sim_input->storage);
 if (const bNode *sim_output = ntree.node_by_id(storage.output_node_id)) {
-  sub_contexts.append({float3(0.0f, 0.0f, 0.0f), {sim_input}, 
{sim_output}});
+  float4 background_color;
+  UI_GetThemeColor4fv(TH_NODE_REGION_SIMULATION, background_color);
+  float4 outline_color = background_color;
+  outline_color[3] = 1.0f;
+  sub_contexts.append({background_color, outline_color, {sim_input}, 
{sim_output}});
 }
   }
 
@@ -3117,14 +3122,14 @@ static void 
node_draw_sub_context_frames(TreeDrawContext &tree_draw_ctx,
 immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
 
 GPU_blend(GPU_BLEND_ALPHA);
-immUniformColor4f(sub_context.color[0], sub_context.color[1], 
sub_context.color[2], 0.2f);
+immUniformColor4fv(sub_context.background_color);
 immBegin(GPU_PRIM_TRI_FAN, boundary_positions.size() + 1);
 for (const float3 &p : boundary_positions) {
   immVertex3fv(pos, p);
 }
 immVertex3fv(pos, boundary_positi

[Bf-blender-cvs] [85a743e08bf] master: Fix T103061: GPencil export to SVG wrong line thickness

2022-12-13 Thread Antonio Vazquez
Commit: 85a743e08bfcaa321c7f0e7ced6bf9003a359888
Author: Antonio Vazquez
Date:   Tue Dec 13 11:39:13 2022 +0100
Branches: master
https://developer.blender.org/rB85a743e08bfcaa321c7f0e7ced6bf9003a359888

Fix T103061: GPencil export to SVG wrong line thickness

When the line was very thin the precision of the thickness
calculation was not precise enough.

The algorithm has been improved. This affects SVG and PDF.

===

M   source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc
M   source/blender/io/gpencil/intern/gpencil_io_export_svg.cc

===

diff --git a/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc 
b/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc
index c042ca597c8..23fea9b6460 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc
@@ -177,7 +177,8 @@ void GpencilExporterPDF::export_gpencil_layers()
 /* Apply layer thickness change. */
 gps_duplicate->thickness += gpl->line_change;
 /* Apply object scale to thickness. */
-gps_duplicate->thickness *= mat4_to_scale(ob->object_to_world);
+const float scalef = mat4_to_scale(ob->object_to_world);
+gps_duplicate->thickness = ceilf((float)gps_duplicate->thickness * 
scalef);
 CLAMP_MIN(gps_duplicate->thickness, 1.0f);
 /* Fill. */
 if ((is_fill) && (params_.flag & GP_EXPORT_FILL)) {
@@ -236,7 +237,9 @@ void 
GpencilExporterPDF::export_stroke_to_polyline(bGPDlayer *gpl,
 
   if (is_stroke && !do_fill) {
 HPDF_Page_SetLineJoin(page_, HPDF_ROUND_JOIN);
-HPDF_Page_SetLineWidth(page_, MAX2((radius * 2.0f) - gpl->line_change, 
1.0f));
+const float width = MAX2(
+MAX2(gps->thickness + gpl->line_change, (radius * 2.0f) + 
gpl->line_change), 1.0f);
+HPDF_Page_SetLineWidth(page_, width);
   }
 
   /* Loop all points. */
diff --git a/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc 
b/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc
index b85fd33e116..2c4c09ce1a0 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc
@@ -198,7 +198,8 @@ void GpencilExporterSVG::export_gpencil_layers()
 /* Apply layer thickness change. */
 gps_duplicate->thickness += gpl->line_change;
 /* Apply object scale to thickness. */
-gps_duplicate->thickness *= mat4_to_scale(ob->object_to_world);
+const float scalef = mat4_to_scale(ob->object_to_world);
+gps_duplicate->thickness = ceilf((float)gps_duplicate->thickness * 
scalef);
 CLAMP_MIN(gps_duplicate->thickness, 1.0f);
 
 const bool is_normalized = ((params_.flag & GP_EXPORT_NORM_THICKNESS) 
!= 0) ||
@@ -308,7 +309,9 @@ void 
GpencilExporterSVG::export_stroke_to_polyline(bGPDlayer *gpl,
   color_string_set(gpl, gps, node_gps, do_fill);
 
   if (is_stroke && !do_fill) {
-node_gps.append_attribute("stroke-width").set_value((radius * 2.0f) - 
gpl->line_change);
+const float width = MAX2(
+MAX2(gps->thickness + gpl->line_change, (radius * 2.0f) + 
gpl->line_change), 1.0f);
+node_gps.append_attribute("stroke-width").set_value(width);
   }
 
   std::string txt;

___
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] [02a264f5ab6] geometry-nodes-simulation: Merge branch 'master' into geometry-nodes-simulation

2022-12-13 Thread Jacques Lucke
Commit: 02a264f5ab666c8acab8f6b06332c992faf24ae4
Author: Jacques Lucke
Date:   Tue Dec 13 11:15:20 2022 +0100
Branches: geometry-nodes-simulation
https://developer.blender.org/rB02a264f5ab666c8acab8f6b06332c992faf24ae4

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] [e8c7866608b] master: Add-ons: Exclude contrib for beta, rc and release builds.

2022-12-13 Thread Thomas Dinges
Commit: e8c7866608bb71b674afd9420a22b993e066f873
Author: Thomas Dinges
Date:   Tue Dec 13 11:12:36 2022 +0100
Branches: master
https://developer.blender.org/rBe8c7866608bb71b674afd9420a22b993e066f873

Add-ons: Exclude contrib for beta, rc and release builds.

* Make it clearer that contrib isn't shipped with releases, by already 
excluding it in beta.
* Improve the UI by hiding the "Testing" enum item in these case.

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

===

M   release/scripts/startup/bl_ui/__init__.py
M   source/creator/CMakeLists.txt

===

diff --git a/release/scripts/startup/bl_ui/__init__.py 
b/release/scripts/startup/bl_ui/__init__.py
index eaf61b58e6d..4822370c9ea 100644
--- a/release/scripts/startup/bl_ui/__init__.py
+++ b/release/scripts/startup/bl_ui/__init__.py
@@ -94,6 +94,16 @@ _namespace = globals()
 _modules_loaded = [_namespace[name] for name in _modules]
 del _namespace
 
+def _addon_support_items():
+"""Return the addon support levels suitable for this Blender build."""
+
+items = [
+('OFFICIAL', "Official", "Officially supported"),
+('COMMUNITY', "Community", "Maintained by community developers"),
+]
+if bpy.app.version_cycle == 'alpha':
+items.append(('TESTING', "Testing", "Newly contributed scripts 
(excluded from release builds)"))
+return items
 
 def register():
 from bpy.utils import register_class
@@ -141,11 +151,7 @@ def register():
 )
 
 WindowManager.addon_support = EnumProperty(
-items=[
-('OFFICIAL', "Official", "Officially supported"),
-('COMMUNITY', "Community", "Maintained by community developers"),
-('TESTING', "Testing", "Newly contributed scripts (excluded from 
release builds)")
-],
+items=_addon_support_items(),
 name="Support",
 description="Display support level",
 default={'OFFICIAL', 'COMMUNITY'},
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 6837bc0da9e..82a37614841 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -394,9 +394,10 @@ install(
 if(WITH_PYTHON)
   # install(CODE "message(\"copying blender scripts...\")")
 
-  # exclude addons_contrib if release
+  # exclude addons_contrib if release branch
   if("${BLENDER_VERSION_CYCLE}" STREQUAL "release" OR
- "${BLENDER_VERSION_CYCLE}" STREQUAL "rc")
+ "${BLENDER_VERSION_CYCLE}" STREQUAL "rc" OR
+ "${BLENDER_VERSION_CYCLE}" STREQUAL "beta")
 set(ADDON_EXCLUDE_CONDITIONAL "addons_contrib/*")
   else()
 set(ADDON_EXCLUDE_CONDITIONAL "_addons_contrib/*")  # Dummy, won't do 
anything.

___
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] [a14a1520240] master: PBVH: Fix crash with incorrect initialized span lengths.

2022-12-13 Thread Jeroen Bakker
Commit: a14a15202407b14b73188e1f0997bcad9c670ab5
Author: Jeroen Bakker
Date:   Tue Dec 13 10:15:32 2022 +0100
Branches: master
https://developer.blender.org/rBa14a15202407b14b73188e1f0997bcad9c670ab5

PBVH: Fix crash with incorrect initialized span lengths.

PBVH doesn't store the loop size. We need to get that from the mesh.
We should perhaps also store the mloop len insize the PBVH.

===

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

===

diff --git a/source/blender/blenkernel/intern/pbvh_pixels.cc 
b/source/blender/blenkernel/intern/pbvh_pixels.cc
index bb7e912fd94..e21103c9f19 100644
--- a/source/blender/blenkernel/intern/pbvh_pixels.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels.cc
@@ -362,9 +362,9 @@ static void update_pixels(PBVH *pbvh, Mesh *mesh, Image 
*image, ImageUser *image
   }
 
   uv_islands::MeshData mesh_data({pbvh->looptri, pbvh->totprim},
- {pbvh->mloop, pbvh->totprim},
+ {pbvh->mloop, mesh->totloop},
  pbvh->totvert,
- {ldata_uv, pbvh->totprim});
+ {ldata_uv, mesh->totloop});
   uv_islands::UVIslands islands(mesh_data);
 
   uv_islands::UVIslandsMask uv_masks;

___
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] [8f5df25f339] master: Cleanup: Use BKE_brush_mask_texture_get in sculpt code.

2022-12-13 Thread Jeroen Bakker
Commit: 8f5df25f33987120f3852c99a4ae5d1c72dd5912
Author: Jeroen Bakker
Date:   Tue Dec 13 09:14:33 2022 +0100
Branches: master
https://developer.blender.org/rB8f5df25f33987120f3852c99a4ae5d1c72dd5912

Cleanup: Use BKE_brush_mask_texture_get in sculpt code.

In preparation to sanatize the mask texture and color texture in sculpt code. 
In sculpt
mode the mask texture is read from mtex, leaving the mask_mtex when we want to 
use color
textures in sculpt mode.

===

M   source/blender/editors/sculpt_paint/sculpt.cc
M   source/blender/editors/sculpt_paint/sculpt_expand.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h

===

diff --git a/source/blender/editors/sculpt_paint/sculpt.cc 
b/source/blender/editors/sculpt_paint/sculpt.cc
index 113fec4fcdf..98cb6130f87 100644
--- a/source/blender/editors/sculpt_paint/sculpt.cc
+++ b/source/blender/editors/sculpt_paint/sculpt.cc
@@ -1319,6 +1319,7 @@ static bool sculpt_brush_use_topology_rake(const 
SculptSession *ss, const Brush
  */
 static int sculpt_brush_needs_normal(const SculptSession *ss, Sculpt *sd, 
const Brush *brush)
 {
+  const MTex *mask_tex = BKE_brush_mask_texture_get(brush, OB_MODE_SCULPT);
   return ((SCULPT_TOOL_HAS_NORMAL_WEIGHT(brush->sculpt_tool) &&
(ss->cache->normal_weight > 0.0f)) ||
   SCULPT_automasking_needs_normal(ss, sd, brush) ||
@@ -1334,7 +1335,7 @@ static int sculpt_brush_needs_normal(const SculptSession 
*ss, Sculpt *sd, const
SCULPT_TOOL_ELASTIC_DEFORM,
SCULPT_TOOL_THUMB) ||
 
-  (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA)) ||
+  (mask_tex->brush_map_mode == MTEX_MAP_MODE_AREA)) ||
  sculpt_brush_use_topology_rake(ss, brush);
 }
 
@@ -2861,7 +2862,10 @@ static void calc_local_y(ViewContext *vc, const float 
center[3], float y[3])
   mul_m4_v3(ob->world_to_object, y);
 }
 
-static void calc_brush_local_mat(const Brush *brush, Object *ob, float 
local_mat[4][4])
+static void calc_brush_local_mat(const Brush *brush,
+ const MTex *mtex,
+ Object *ob,
+ float local_mat[4][4])
 {
   const StrokeCache *cache = ob->sculpt->cache;
   float tmat[4][4];
@@ -2885,7 +2889,7 @@ static void calc_brush_local_mat(const Brush *brush, 
Object *ob, float local_mat
   /* Calculate the X axis of the local matrix. */
   cross_v3_v3v3(v, up, cache->sculpt_normal);
   /* Apply rotation (user angle, rake, etc.) to X axis. */
-  angle = brush->mtex.rot - cache->special_rotation;
+  angle = mtex->rot - cache->special_rotation;
   rotate_v3_v3v3fl(mat[0], v, cache->sculpt_normal, angle);
 
   /* Get other axes. */
@@ -2932,7 +2936,9 @@ static void update_brush_local_mat(Sculpt *sd, Object *ob)
   StrokeCache *cache = ob->sculpt->cache;
 
   if (cache->mirror_symmetry_pass == 0 && cache->radial_symmetry_pass == 0) {
-calc_brush_local_mat(BKE_paint_brush(&sd->paint), ob, 
cache->brush_local_mat);
+const Brush *brush = BKE_paint_brush(&sd->paint);
+const MTex *mask_tex = BKE_brush_mask_texture_get(brush, OB_MODE_SCULPT);
+calc_brush_local_mat(brush, mask_tex, ob, cache->brush_local_mat);
   }
 }
 
@@ -3512,7 +3518,8 @@ static void do_brush_action(Sculpt *sd,
 update_sculpt_normal(sd, ob, nodes, totnode);
   }
 
-  if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA) {
+  const MTex *mask_tex = BKE_brush_mask_texture_get(brush, 
static_cast(ob->mode));
+  if (mask_tex->brush_map_mode == MTEX_MAP_MODE_AREA) {
 update_brush_local_mat(sd, ob);
   }
 
@@ -4047,7 +4054,7 @@ static void sculpt_fix_noise_tear(Sculpt *sd, Object *ob)
 {
   SculptSession *ss = ob->sculpt;
   Brush *brush = BKE_paint_brush(&sd->paint);
-  MTex *mtex = &brush->mtex;
+  const MTex *mtex = BKE_brush_mask_texture_get(brush, OB_MODE_SCULPT);
 
   if (ss->multires.active && mtex->tex && mtex->tex->type == TEX_NOISE) {
 multires_stitch_grids(ob);
@@ -5196,12 +5203,12 @@ bool SCULPT_stroke_get_location(bContext *C,
 static void sculpt_brush_init_tex(Sculpt *sd, SculptSession *ss)
 {
   Brush *brush = BKE_paint_brush(&sd->paint);
-  MTex *mtex = &brush->mtex;
+  const MTex *mask_tex = BKE_brush_mask_texture_get(brush, OB_MODE_SCULPT);
 
   /* Init mtex nodes. */
-  if (mtex->tex && mtex->tex->nodetree) {
+  if (mask_tex->tex && mask_tex->tex->nodetree) {
 /* Has internal flag to detect it only does it once. */
-ntreeTexBeginExecTree(mtex->tex->nodetree);
+ntreeTexBeginExecTree(mask_tex->tex->nodetree);
   }
 
   if (ss->tex_pool == nullptr) {
@@ -5630,10 +5637,10 @@ static void sculpt_stroke_update_step(bContext *C,
 static void sculpt_brush_exit_tex(Sculpt *sd)
 {
   Brush *brush = BKE_paint_brush(&sd->paint);
-  MTex *mtex = &brush->mtex;
+  const MTex *mask_tex = BKE_brush_mask_texture_get(brush, OB_MODE_SCULPT);
 
-  if (mtex->tex && mte