UI: Cleanup Dialog to Manage Orphaned Data #106653

Merged
Harley Acheson merged 22 commits from Harley/blender:ManageData into main 2024-01-17 01:09:21 +01:00
643 changed files with 11461 additions and 5724 deletions
Showing only changes of commit e18d74dd44 - Show all commits

View File

@ -204,11 +204,19 @@ ifndef PYTHON
PYTHON:=python3
endif
# The Python version bundled in `LIBDIR`,
# needed when macOS & Linux are out of sync while upgrading the Python version.
ifeq ($(OS_NCASE),darwin)
PY_LIB_VERSION:=3.10
else
PY_LIB_VERSION:=3.11
endif
# For macOS python3 is not installed by default, so fallback to python binary
# in libraries, or python 2 for running make update to get it.
ifeq ($(OS_NCASE),darwin)
ifeq (, $(shell command -v $(PYTHON)))
PYTHON:=$(DEPS_INSTALL_DIR)/python/bin/python3.10
PYTHON:=$(DEPS_INSTALL_DIR)/python/bin/python$(PY_LIB_VERSION)
ifeq (, $(shell command -v $(PYTHON)))
PYTHON:=python
endif
@ -228,7 +236,7 @@ endif
# Otherwise the "autopep8" command can be used.
ifndef AUTOPEP8
ifneq (, $(LIBDIR))
AUTOPEP8:=$(wildcard $(LIBDIR)/python/lib/python3.10/site-packages/autopep8.py)
AUTOPEP8:=$(wildcard $(LIBDIR)/python/lib/python$(PY_LIB_VERSION)/site-packages/autopep8.py)
endif
ifeq (, $(AUTOPEP8))
AUTOPEP8:=autopep8

View File

@ -54,12 +54,12 @@ include(cmake/png.cmake)
include(cmake/jpeg.cmake)
include(cmake/blosc.cmake)
include(cmake/pthreads.cmake)
include(cmake/deflate.cmake)
include(cmake/imath.cmake)
include(cmake/openexr.cmake)
include(cmake/brotli.cmake)
include(cmake/freetype.cmake)
include(cmake/epoxy.cmake)
include(cmake/freeglut.cmake)
include(cmake/alembic.cmake)
include(cmake/opensubdiv.cmake)
include(cmake/sdl.cmake)
@ -105,7 +105,6 @@ if(NOT APPLE)
endif()
endif()
include(cmake/ispc.cmake)
include(cmake/openimagedenoise.cmake)
# Embree needs to be included after dpcpp as it uses it for compiling with GPU support
include(cmake/embree.cmake)
include(cmake/openpgl.cmake)
@ -133,6 +132,7 @@ if(NOT WIN32 OR ENABLE_MSYS2)
include(cmake/gmp.cmake)
include(cmake/openjpeg.cmake)
if(NOT WIN32 OR BUILD_MODE STREQUAL Release)
include(cmake/openimagedenoise.cmake)
include(cmake/lame.cmake)
include(cmake/ogg.cmake)
include(cmake/vorbis.cmake)

View File

@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: 2023 Blender Authors
#
# SPDX-License-Identifier: GPL-2.0-or-later
set(DEFLATE_EXTRA_ARGS
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
)
ExternalProject_Add(external_deflate
URL file://${PACKAGE_DIR}/${DEFLATE_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${DEFLATE_HASH_TYPE}=${DEFLATE_HASH}
PREFIX ${BUILD_DIR}/deflate
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/deflate ${DEFAULT_CMAKE_FLAGS} ${DEFLATE_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/deflate
)

View File

@ -84,7 +84,6 @@ download_source(PTHREADS)
download_source(OPENEXR)
download_source(FREETYPE)
download_source(EPOXY)
download_source(FREEGLUT)
download_source(ALEMBIC)
download_source(OPENSUBDIV)
download_source(SDL)
@ -178,3 +177,4 @@ download_source(SHADERC_GLSLANG)
download_source(VULKAN_HEADERS)
download_source(VULKAN_LOADER)
download_source(PYBIND11)
download_source(DEFLATE)

View File

@ -1,21 +0,0 @@
# SPDX-FileCopyrightText: 2012-2022 Blender Authors
#
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
if(BUILD_MODE STREQUAL Release)
set(FREEGLUT_EXTRA_ARGS
-DFREEGLUT_BUILD_SHARED_LIBS=Off
-DFREEGLUT_BUILD_STATIC_LIBS=On
)
ExternalProject_Add(external_freeglut
URL file://${PACKAGE_DIR}/${FREEGLUT_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${FREEGLUT_HASH_TYPE}=${FREEGLUT_HASH}
PREFIX ${BUILD_DIR}/freeglut
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/freeglut ${DEFAULT_C_FLAGS} ${DEFAULT_CXX_FLAGS} ${FREEGLUT_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/freeglut
)
endif()
endif()

View File

@ -21,10 +21,6 @@ if(WIN32)
# PNG.
${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_static.lib ${HARVEST_TARGET}/png/lib/libpng.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ ${HARVEST_TARGET}/png/include/ &&
# FREEGLUT -> OPENGL.
${CMAKE_COMMAND} -E copy ${LIBDIR}/freeglut/lib/freeglut_static.lib ${HARVEST_TARGET}/opengl/lib/freeglut_static.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freeglut/include/ ${HARVEST_TARGET}/opengl/include/ &&
DEPENDS
)
endif()
@ -249,7 +245,7 @@ else()
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
harvest_rpath_bin(osl/bin osl/bin "oslc")
harvest(osl/include osl/include "*.h")
harvest(osl/lib osl/lib "*.a")
harvest_rpath_lib(osl/lib osl/lib "*${SHAREDLIBEXT}*")
harvest(osl/share/OSL/shaders osl/share/OSL/shaders "*.h")
harvest(png/include png/include "*.h")
harvest(png/lib png/lib "*.a")
@ -277,6 +273,7 @@ else()
harvest(webp/lib webp/lib "*.a")
harvest(webp/include webp/include "*.h")
harvest(usd/include usd/include "*.h")
harvest(usd/include usd/include "*.hpp")
harvest_rpath_lib(usd/lib usd/lib "libusd_ms${SHAREDLIBEXT}")
harvest(usd/lib/usd usd/lib/usd "*")
harvest_rpath_python(

View File

@ -15,6 +15,7 @@ ExternalProject_Add(external_imath
PREFIX ${BUILD_DIR}/imath
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/imath ${DEFAULT_CMAKE_FLAGS} ${IMATH_EXTRA_ARGS}
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/imath/src/external_imath < ${PATCH_DIR}/imath_358.diff
INSTALL_DIR ${LIBDIR}/imath
)

View File

@ -39,7 +39,9 @@ set(ISPC_EXTRA_ARGS
-DISPC_NO_DUMPS=On
-DISPC_INCLUDE_EXAMPLES=Off
-DISPC_INCLUDE_TESTS=Off
-DLLVM_ROOT=${LIBDIR}/llvm/lib/cmake/llvm
-DISPC_INCLUDE_RT=Off
-DLLVM_CONFIG_EXECUTABLE=${LIBDIR}/llvm/bin/llvm-config
-DLLVM_DIR=${LIBDIR}/llvm/lib/cmake/llvm/
-DLLVM_LIBRARY_DIR=${LIBDIR}/llvm/lib
-DCLANG_EXECUTABLE=${LIBDIR}/llvm/bin/clang
-DCLANGPP_EXECUTABLE=${LIBDIR}/llvm/bin/clang++

View File

@ -29,6 +29,8 @@ set(LLVM_EXTRA_ARGS
-DLLVM_ENABLE_TERMINFO=OFF
-DLLVM_BUILD_LLVM_C_DYLIB=OFF
-DLLVM_ENABLE_UNWIND_TABLES=OFF
-DLLVM_ENABLE_ZSTD=OFF
-DLLVM_ENABLE_ZLIB=OFF
-DLLVM_ENABLE_PROJECTS=clang${LLVM_BUILD_CLANG_TOOLS_EXTRA}
-DPython3_ROOT_DIR=${LIBDIR}/python/
-DPython3_EXECUTABLE=${PYTHON_BINARY}

View File

@ -11,17 +11,22 @@ set(MATERIALX_EXTRA_ARGS
-DMATERIALX_BUILD_SHARED_LIBS=ON
-DMATERIALX_BUILD_TESTS=OFF
-DCMAKE_DEBUG_POSTFIX=_d
# This policy makes pybind11_ROOT work.
-DCMAKE_POLICY_DEFAULT_CMP0074=NEW
-Dpybind11_ROOT=${LIBDIR}/pybind11
-DPython_EXECUTABLE=${PYTHON_BINARY}
)
if(WIN32)
LIST(APPEND MATERIALX_EXTRA_ARGS -DPYTHON_LIBRARIES=${LIBDIR}/python/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}${PYTHON_POSTFIX}.lib)
endif()
ExternalProject_Add(external_materialx
URL file://${PACKAGE_DIR}/${MATERIALX_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${MATERIALX_HASH_TYPE}=${MATERIALX_HASH}
PREFIX ${BUILD_DIR}/materialx
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/materialx/src/external_materialx < ${PATCH_DIR}/materialx.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/materialx ${DEFAULT_CMAKE_FLAGS} ${MATERIALX_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/materialx
)

View File

@ -22,14 +22,14 @@ set(MESA_EXTRA_FLAGS
-Dcpp_args=${MESA_CXXFLAGS}
-Dc_link_args=${MESA_LDFLAGS}
-Dcpp_link_args=${MESA_LDFLAGS}
-Dglx=gallium-xlib
-Dglx=xlib
-Dgallium-drivers=swrast
-Ddri-drivers=
-Dvulkan-drivers=
-Dgbm=disabled
-Degl=disabled
-Dgles1=disabled
-Dgles2=disabled
-Dcpp_rtti=false
-Dshared-llvm=disabled
# Without this, the build fails when: `wayland-scanner` is not found.
# At some point we will likely want to support Wayland.

View File

@ -3,6 +3,8 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(MINIZIPNG_EXTRA_ARGS
# Disable most compression methods like OpenColorIO does, enabling
# more is not needed and will give link errors.
-DMZ_FETCH_LIBS=OFF
-DMZ_LIBCOMP=OFF
-DMZ_PKCRYPT=OFF
@ -11,10 +13,11 @@ set(MINIZIPNG_EXTRA_ARGS
-DMZ_SIGNING=OFF
-DMZ_LZMA=OFF
-DMZ_ZSTD=OFF
-DMZ_BZIP2=OFF
-DMZ_ICONV=OFF
-DMZ_ZLIB=ON
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
-DBZIP2_LIBRARY=${LIBDIR}/bzip2/lib/${LIBPREFIX}bz2${LIBEXT}
-DBZIP2_INCLUDE_DIR=${LIBDIR}/bzip2/include/
# Because OCIO hardcodes a non standard include path
-DCMAKE_INSTALL_INCLUDEDIR=${LIBDIR}/minizipng/include/minizip-ng
)

View File

@ -11,7 +11,7 @@ set(OPENCOLORIO_EXTRA_ARGS
-DOCIO_BUILD_DOCS=OFF
-DOCIO_BUILD_TESTS=OFF
-DOCIO_BUILD_GPU_TESTS=OFF
-DOCIO_USE_SSE=ON
-DOCIO_USE_SIMD=ON
-DOCIO_INSTALL_EXT_PACKAGES=NONE
@ -21,7 +21,7 @@ set(OPENCOLORIO_EXTRA_ARGS
-Dpystring_ROOT=${LIBDIR}/pystring
-DImath_ROOT=${LIBDIR}/imath
-Dminizip-ng_ROOT=${LIBDIR}/minizipng
-Dminizip-ng_INCLUDE_DIR=${LIBDIR}/minizipng/include
-Dminizip-ng_INCLUDE_DIR=${LIBDIR}/minizipng/include/minizip-ng
-Dminizip-ng_LIBRARY=${LIBDIR}/minizipng/lib/libminizip${LIBEXT}
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
@ -30,14 +30,10 @@ set(OPENCOLORIO_EXTRA_ARGS
)
if(APPLE)
# Work around issue where minizip-ng_LIBRARY assumes -ng in file name.
set(OPENCOLORIO_EXTRA_ARGS
${OPENCOLORIO_EXTRA_ARGS}
"-DCMAKE_SHARED_LINKER_FLAGS=-liconv ${LIBDIR}/bzip2/lib/${LIBPREFIX}bz2${LIBEXT}"
)
elseif(UNIX)
set(OPENCOLORIO_EXTRA_ARGS
${OPENCOLORIO_EXTRA_ARGS}
"-DCMAKE_SHARED_LINKER_FLAGS=${LIBDIR}/bzip2/lib/${LIBPREFIX}bz2${LIBEXT}"
-Dminizip_LIBRARY=${LIBDIR}/minizipng/lib/libminizip${LIBEXT}
)
endif()
@ -72,7 +68,6 @@ ExternalProject_Add(external_opencolorio
URL_HASH ${OPENCOLORIO_HASH_TYPE}=${OPENCOLORIO_HASH}
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/opencolorio
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/opencolorio/src/external_opencolorio < ${PATCH_DIR}/opencolorio.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/opencolorio ${DEFAULT_CMAKE_FLAGS} ${OPENCOLORIO_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/opencolorio
)
@ -93,14 +88,14 @@ if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_opencolorio after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opencolorio/include ${HARVEST_TARGET}/opencolorio/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/bin/OpenColorIO_2_2.dll ${HARVEST_TARGET}/opencolorio/bin/OpenColorIO_2_2.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/bin/OpenColorIO_2_3.dll ${HARVEST_TARGET}/opencolorio/bin/OpenColorIO_2_3.dll
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opencolorio/lib ${HARVEST_TARGET}/opencolorio/lib
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_opencolorio after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/bin/OpenColorIO_d_2_2.dll ${HARVEST_TARGET}/opencolorio/bin/OpenColorIO_d_2_2.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/bin/OpenColorIO_d_2_3.dll ${HARVEST_TARGET}/opencolorio/bin/OpenColorIO_d_2_3.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/lib/Opencolorio_d.lib ${HARVEST_TARGET}/opencolorio/lib/OpenColorIO_d.lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opencolorio/lib/site-packages ${HARVEST_TARGET}/opencolorio/lib/site-packages-debug
DEPENDEES install

View File

@ -14,8 +14,6 @@ endif()
set(OPENEXR_EXTRA_ARGS
${OPENEXR_EXTRA_ARGS}
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
-DBUILD_TESTING=OFF
-DOPENEXR_BUILD_BOTH_STATIC_SHARED=OFF
-DBUILD_SHARED_LIBS=ON
@ -23,13 +21,14 @@ set(OPENEXR_EXTRA_ARGS
-DOPENEXR_INSTALL_EXAMPLES=OFF
-DImath_DIR=${LIBDIR}/imath/lib/cmake/Imath
-DOPENEXR_LIB_SUFFIX=${OPENEXR_VERSION_BUILD_POSTFIX}
-Dlibdeflate_DIR=${LIBDIR}/deflate/lib/cmake/libdeflate
)
ExternalProject_Add(external_openexr
URL file://${PACKAGE_DIR}/${OPENEXR_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENEXR_HASH_TYPE}=${OPENEXR_HASH}
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openexr/src/external_openexr < ${PATCH_DIR}/openexr_b18905772e.diff
PATCH_COMMAND ${PATCH_CMD} -p 2 -d ${BUILD_DIR}/openexr/src/external_openexr < ${PATCH_DIR}/openexr_deflate_1588.diff
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/openexr
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openexr ${DEFAULT_CMAKE_FLAGS} ${OPENEXR_EXTRA_ARGS}
@ -51,6 +50,6 @@ endif()
add_dependencies(
external_openexr
external_zlib
external_imath
external_deflate
)

View File

@ -15,7 +15,7 @@ if(NOT APPLE)
-DOIDN_DEVICE_SYCL=ON
-DOIDN_DEVICE_SYCL_AOT=OFF
-DOIDN_DEVICE_HIP=ON
-DLEVEL_ZERO_ROOT=${LIBDIR}/level-zero/lib
-DLEVEL_ZERO_ROOT=${LIBDIR}/level-zero
)
endif()
@ -64,6 +64,21 @@ add_dependencies(
external_python
)
if(UNIX AND NOT APPLE)
add_dependencies(
external_openimagedenoise
external_dpcpp
external_ocloc
)
endif()
if(NOT APPLE)
add_dependencies(
external_openimagedenoise
external_level-zero
)
endif()
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_openimagedenoise after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openimagedenoise/bin ${HARVEST_TARGET}/openimagedenoise/bin

View File

@ -109,9 +109,9 @@ ExternalProject_Add(external_openimageio
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/openimageio
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/openimageio.diff &&
${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/oiio_deadlock.diff &&
${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/oiio_3984.diff &&
${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/oiio_webp.diff
${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/oiio_webp.diff &&
${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/oiio_4044.diff &&
${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/oiio_4062.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openimageio ${DEFAULT_CMAKE_FLAGS} ${OPENIMAGEIO_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openimageio
)

View File

@ -22,26 +22,15 @@ set(OPENSUBDIV_EXTRA_ARGS
-DNO_GLEW=ON
-DNO_GLFW=ON
-DNO_GLFW_X11=ON
-DTBB_DIR=${LIBDIR}/tbb/lib/cmake/tbb
)
if(WIN32)
set(OPENSUBDIV_EXTRA_ARGS
${OPENSUBDIV_EXTRA_ARGS}
-DTBB_INCLUDE_DIR=${LIBDIR}/tbb/include
-DTBB_LIBRARIES=${LIBDIR}/tbb/lib/tbb.lib
)
else()
set(OPENSUBDIV_EXTRA_ARGS
${OPENSUBDIV_EXTRA_ARGS}
-DTBB_LOCATION=${LIBDIR}/tbb
)
endif()
ExternalProject_Add(external_opensubdiv
URL file://${PACKAGE_DIR}/${OPENSUBDIV_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENSUBDIV_HASH_TYPE}=${OPENSUBDIV_HASH}
PREFIX ${BUILD_DIR}/opensubdiv
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/opensubdiv -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${OPENSUBDIV_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/opensubdiv
)

View File

@ -37,6 +37,7 @@ set(OPENVDB_EXTRA_ARGS
-DOPENVDB_PYTHON_WRAP_ALL_GRID_TYPES=ON
-DUSE_NUMPY=ON
-DPython_EXECUTABLE=${PYTHON_BINARY}
-Dpybind11_DIR=${LIBDIR}/pybind11/share/cmake/pybind11
# OPENVDB_AX Disabled for now as it adds ~25MB distribution wise
# with no blender code depending on it, seems wasteful.
@ -46,7 +47,11 @@ set(OPENVDB_EXTRA_ARGS
# -DLLVM_DIR=${LIBDIR}/llvm/lib/cmake/llvm
)
set(OPENVDB_PATCH ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openvdb/src/openvdb < ${PATCH_DIR}/openvdb.diff)
set(OPENVDB_PATCH
${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openvdb/src/openvdb < ${PATCH_DIR}/openvdb.diff &&
${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openvdb/src/openvdb < ${PATCH_DIR}/openvdb_1706.diff &&
${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openvdb/src/openvdb < ${PATCH_DIR}/openvdb_1733.diff
)
ExternalProject_Add(openvdb
URL file://${PACKAGE_DIR}/${OPENVDB_FILE}
@ -67,6 +72,7 @@ add_dependencies(
external_blosc
external_python
external_numpy
external_pybind11
)
if(WIN32)
@ -75,7 +81,7 @@ if(WIN32)
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openvdb/include ${HARVEST_TARGET}/openvdb/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/openvdb.lib ${HARVEST_TARGET}/openvdb/lib/openvdb.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/bin/openvdb.dll ${HARVEST_TARGET}/openvdb/bin/openvdb.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/python${PYTHON_SHORT_VERSION}/site-packages/pyopenvdb.pyd ${HARVEST_TARGET}openvdb/python/pyopenvdb.pyd
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/python${PYTHON_SHORT_VERSION}/site-packages/pyopenvdb.cp${PYTHON_SHORT_VERSION_NO_DOTS}-win_amd64.pyd ${HARVEST_TARGET}openvdb/python/pyopenvdb.cp${PYTHON_SHORT_VERSION_NO_DOTS}-win_amd64.pyd
DEPENDEES install
)
endif()
@ -83,7 +89,7 @@ if(WIN32)
ExternalProject_Add_Step(openvdb after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/openvdb_d.lib ${HARVEST_TARGET}/openvdb/lib/openvdb_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/bin/openvdb_d.dll ${HARVEST_TARGET}/openvdb/bin/openvdb_d.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/python${PYTHON_SHORT_VERSION}/site-packages/pyopenvdb_d.pyd ${HARVEST_TARGET}openvdb/python/pyopenvdb_d.pyd
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/python${PYTHON_SHORT_VERSION}/site-packages/pyopenvdb_d.cp${PYTHON_SHORT_VERSION_NO_DOTS}-win_amd64.pyd ${HARVEST_TARGET}openvdb/python/pyopenvdb_d.cp${PYTHON_SHORT_VERSION_NO_DOTS}-win_amd64.pyd
DEPENDEES install
)
endif()

View File

@ -22,7 +22,7 @@ set(OSL_EXTRA_ARGS
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
${OSL_FLEX_BISON}
-DCMAKE_CXX_STANDARD_LIBRARIES=${OSL_CMAKE_CXX_STANDARD_LIBRARIES}
-DBUILD_SHARED_LIBS=OFF
-DBUILD_SHARED_LIBS=ON
-DLINKSTATIC=OFF
-DOSL_BUILD_PLUGINS=OFF
-DSTOP_ON_WARNING=OFF
@ -38,7 +38,9 @@ set(OSL_EXTRA_ARGS
-DJPEG_ROOT=${LIBDIR}/jpeg
-DUSE_PYTHON=OFF
-DImath_ROOT=${LIBDIR}/imath
-DUSE_OIIO_STATIC=OFF
-DCMAKE_DEBUG_POSTFIX=_d
-DPython_ROOT=${LIBDIR}/python
-DPython_EXECUTABLE=${PYTHON_BINARY}
)
ExternalProject_Add(external_osl
@ -83,10 +85,14 @@ if(WIN32)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_osl after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/lib/oslcomp.lib ${HARVEST_TARGET}/osl/lib/oslcomp_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/lib/oslexec.lib ${HARVEST_TARGET}/osl/lib/oslexec_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/lib/oslquery.lib ${HARVEST_TARGET}/osl/lib/oslquery_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/lib/oslnoise.lib ${HARVEST_TARGET}/osl/lib/oslnoise_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/lib/oslcomp_d.lib ${HARVEST_TARGET}/osl/lib/oslcomp_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/lib/oslexec_d.lib ${HARVEST_TARGET}/osl/lib/oslexec_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/lib/oslquery_d.lib ${HARVEST_TARGET}/osl/lib/oslquery_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/lib/oslnoise_d.lib ${HARVEST_TARGET}/osl/lib/oslnoise_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/bin/oslcomp_d.dll ${HARVEST_TARGET}/osl/bin/oslcomp_d.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/bin/oslexec_d.dll ${HARVEST_TARGET}/osl/bin/oslexec_d.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/bin/oslquery_d.dll ${HARVEST_TARGET}/osl/bin/oslquery_d.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/bin/oslnoise_d.dll ${HARVEST_TARGET}/osl/bin/oslnoise_d.dll
DEPENDEES install
)
endif()

View File

@ -13,6 +13,7 @@ ExternalProject_Add(external_pybind11
URL_HASH ${PYBIND11_HASH_TYPE}=${PYBIND11_HASH}
PREFIX ${BUILD_DIR}/pybind11
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/pybind11/src/external_pybind11 < ${PATCH_DIR}/pybind11_4761.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/pybind11 ${DEFAULT_CMAKE_FLAGS} ${PYBIND11_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/pybind11
)

View File

@ -37,7 +37,7 @@ if(WIN32)
# regardless of the version actually in there.
PATCH_COMMAND mkdir ${PYTHON_EXTERNALS_FOLDER_DOS} &&
mklink /J ${PYTHON_EXTERNALS_FOLDER_DOS}\\zlib-1.2.13 ${ZLIB_SOURCE_FOLDER_DOS} &&
mklink /J ${PYTHON_EXTERNALS_FOLDER_DOS}\\openssl-1.1.1u ${SSL_SOURCE_FOLDER_DOS} &&
mklink /J ${PYTHON_EXTERNALS_FOLDER_DOS}\\openssl-3.0.11 ${SSL_SOURCE_FOLDER_DOS} &&
${CMAKE_COMMAND} -E copy ${ZLIB_SOURCE_FOLDER}/../external_zlib-build/zconf.h ${PYTHON_EXTERNALS_FOLDER}/zlib-1.2.13/zconf.h &&
${PATCH_CMD} --verbose -p1 -d ${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python_windows.diff
CONFIGURE_COMMAND echo "."
@ -79,16 +79,36 @@ else()
set(PYTHON_CONFIGURE_ENV ${CONFIGURE_ENV})
endif()
set(PYTHON_BINARY ${LIBDIR}/python/bin/python${PYTHON_SHORT_VERSION})
# Link against zlib statically (Unix). Avoid rpath issues (macOS).
set(PYTHON_PATCH ${PATCH_CMD} --verbose -p1 -d ${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python_unix.diff)
set(PYTHON_CONFIGURE_EXTRA_ARGS "")
set(PYTHON_CFLAGS "-I${LIBDIR}/sqlite/include -I${LIBDIR}/bzip2/include -I${LIBDIR}/lzma/include -I${LIBDIR}/zlib/include ${PLATFORM_CFLAGS}")
set(PYTHON_LDFLAGS "-L${LIBDIR}/ffi/lib -L${LIBDIR}/sqlite/lib -L${LIBDIR}/bzip2/lib -L${LIBDIR}/lzma/lib -L${LIBDIR}/zlib/lib ${PLATFORM_LDFLAGS}")
# Various flags to convince Python to use our own versions of ffi, sqlite, ssl, bzip2, lzma and zlib.
# Using pkg-config is only supported for some, and even then we need to work around issues.
set(PYTHON_CONFIGURE_EXTRA_ARGS --with-openssl=${LIBDIR}/ssl)
set(PYTHON_CFLAGS "${PLATFORM_CFLAGS} ")
# Manually specify some library paths. For ffi there is no other way, for sqlite is needed because
# LIBSQLITE3_LIBS does not work, and ssl because it uses the wrong ssl/lib dir instead of ssl/lib64.
set(PYTHON_LDFLAGS "-L${LIBDIR}/ffi/lib -L${LIBDIR}/sqlite/lib -L${LIBDIR}/ssl/lib -L${LIBDIR}/ssl/lib64 ${PLATFORM_LDFLAGS} ")
set(PYTHON_CONFIGURE_EXTRA_ENV
export CFLAGS=${PYTHON_CFLAGS} &&
export CPPFLAGS=${PYTHON_CFLAGS} &&
export LDFLAGS=${PYTHON_LDFLAGS} &&
export PKG_CONFIG_PATH=${LIBDIR}/ffi/lib/pkgconfig:${LIBDIR}/ssl/lib/pkgconfig:${LIBDIR}/ssl/lib64/pkgconfig)
# Use pkg-config for libraries that support it.
export PKG_CONFIG_PATH=${LIBDIR}/ffi/lib/pkgconfig:${LIBDIR}/sqlite/lib/pkgconfig:${LIBDIR}/ssl/lib/pkgconfig:${LIBDIR}/ssl/lib64/pkgconfig
# Use flags documented by ./configure for other libs.
export BZIP2_CFLAGS=-I${LIBDIR}/bzip2/include
export BZIP2_LIBS=${LIBDIR}/bzip2/lib/${LIBPREFIX}bz2${LIBEXT}
export LIBLZMA_CFLAGS=-I${LIBDIR}/lzma/include
export LIBLZMA_LIBS=${LIBDIR}/lzma/lib/${LIBPREFIX}lzma${LIBEXT}
export ZLIB_CFLAGS=-I${LIBDIR}/zlib/include
export ZLIB_LIBS=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
)
# This patch indludes changes to fix missing -lm for sqlite and and fix the order of
# -ldl flags for ssl to avoid link errors.
if(APPLE)
set(PYTHON_PATCH ${PATCH_CMD} --verbose -p1 -d ${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python_apple.diff)
else()
set(PYTHON_PATCH ${PATCH_CMD} --verbose -p1 -d ${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python_unix.diff)
endif()
# NOTE: untested on APPLE so far.
if(NOT APPLE)

View File

@ -111,12 +111,7 @@ ExternalProject_Add(external_usd
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/usd
LIST_SEPARATOR ^^
# usd_pull_1965.diff https://github.com/PixarAnimationStudios/USD/pull/1965
# usd_hydra.diff - https://github.com/bnagirniak/RPRHydraRenderBlenderAddon/blob/master/usd.diff
# usd_hydra.diff also included the blender changes and usd_pull_1965 and has been edited to remove those sections.
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/usd/src/external_usd < ${PATCH_DIR}/usd.diff &&
${PATCH_CMD} -p 1 -d ${BUILD_DIR}/usd/src/external_usd < ${PATCH_DIR}/usd_pull_1965.diff &&
${PATCH_CMD} -p 1 -d ${BUILD_DIR}/usd/src/external_usd < ${PATCH_DIR}/usd_hydra.diff &&
${PATCH_CMD} -p 1 -d ${BUILD_DIR}/usd/src/external_usd < ${PATCH_DIR}/usd_core_profile.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/usd -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${USD_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/usd

View File

@ -40,12 +40,12 @@ set(JPEG_HASH_TYPE MD5)
set(JPEG_FILE libjpeg-turbo-${JPEG_VERSION}.tar.gz)
set(JPEG_CPE "cpe:2.3:a:d.r.commander:libjpeg-turbo:${JPEG_VERSION}:*:*:*:*:*:*:*")
set(BOOST_VERSION 1.80.0)
set(BOOST_VERSION_SHORT 1.80)
set(BOOST_VERSION_NODOTS 1_80_0)
set(BOOST_VERSION_NODOTS_SHORT 1_80)
set(BOOST_VERSION 1.82.0)
set(BOOST_VERSION_SHORT 1.82)
set(BOOST_VERSION_NODOTS 1_82_0)
set(BOOST_VERSION_NODOTS_SHORT 1_82)
set(BOOST_URI https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_NODOTS}.tar.gz)
set(BOOST_HASH 077f074743ea7b0cb49c6ed43953ae95)
set(BOOST_HASH f7050f554a65f6a42ece221eaeec1660)
set(BOOST_HASH_TYPE MD5)
set(BOOST_FILE boost_${BOOST_VERSION_NODOTS}.tar.gz)
set(BOOST_CPE "cpe:2.3:a:boost:boost:${BOOST_VERSION}:*:*:*:*:*:*:*")
@ -65,15 +65,21 @@ set(PTHREADS_HASH_TYPE MD5)
set(PTHREADS_FILE pthreads4w-code-${PTHREADS_VERSION}.zip)
set(PTHREADS_HOMEPAGE https://github.com/fwbuilder/pthreads4w)
set(OPENEXR_VERSION 3.1.7)
set(DEFLATE_VERSION 1.18)
set(DEFLATE_URI https://github.com/ebiggers/libdeflate/archive/refs/tags/v${DEFLATE_VERSION}.tar.gz)
set(DEFLATE_HASH a29d9dd653cbe03f2d5cd83972063f9e)
set(DEFLATE_HASH_TYPE MD5)
set(DEFLATE_FILE libdeflate-v${DEFLATE_VERSION}.tar.gz)
set(OPENEXR_VERSION 3.2.1)
set(OPENEXR_URI https://github.com/AcademySoftwareFoundation/openexr/archive/v${OPENEXR_VERSION}.tar.gz)
set(OPENEXR_HASH ae68f0cb8b30a49c961fa87d31c60394)
set(OPENEXR_HASH 1d5bb07433ec641cf3bb1b519a27ea6f)
set(OPENEXR_HASH_TYPE MD5)
set(OPENEXR_FILE openexr-${OPENEXR_VERSION}.tar.gz)
set(OPENEXR_CPE "cpe:2.3:a:openexr:openexr:${OPENEXR_VERSION}:*:*:*:*:*:*:*")
set(IMATH_VERSION 3.1.7)
set(IMATH_URI https://github.com/AcademySoftwareFoundation/Imath/archive/v${OPENEXR_VERSION}.tar.gz)
set(IMATH_URI https://github.com/AcademySoftwareFoundation/Imath/archive/v${IMATH_VERSION}.tar.gz)
set(IMATH_HASH 5cedab446ab296c080957c3037c6d097)
set(IMATH_HASH_TYPE MD5)
set(IMATH_FILE imath-${IMATH_VERSION}.tar.gz)
@ -109,22 +115,15 @@ set(EPOXY_HASH f0730aad115c952e77591fcc805b1dc1)
set(EPOXY_HASH_TYPE MD5)
set(EPOXY_FILE libepoxy-${EPOXY_VERSION}.tar.gz)
set(FREEGLUT_VERSION 3.0.0)
set(FREEGLUT_URI http://prdownloads.sourceforge.net/freeglut/freeglut/${FREEGLUT_VERSION}/freeglut-${FREEGLUT_VERSION}.tar.gz)
set(FREEGLUT_HASH 90c3ca4dd9d51cf32276bc5344ec9754)
set(FREEGLUT_HASH_TYPE MD5)
set(FREEGLUT_FILE freeglut-${FREEGLUT_VERSION}.tar.gz)
set(FREEGLUT_HOMEPAGE https://freeglut.sourceforge.net/)
set(ALEMBIC_VERSION 1.8.3)
set(ALEMBIC_URI https://github.com/alembic/alembic/archive/${ALEMBIC_VERSION}.tar.gz)
set(ALEMBIC_HASH 2cd8d6e5a3ac4a014e24a4b04f4fadf9)
set(ALEMBIC_HASH_TYPE MD5)
set(ALEMBIC_FILE alembic-${ALEMBIC_VERSION}.tar.gz)
set(OPENSUBDIV_VERSION v3_5_0)
set(OPENSUBDIV_VERSION v3_6_0)
set(OPENSUBDIV_URI https://github.com/PixarAnimationStudios/OpenSubdiv/archive/${OPENSUBDIV_VERSION}.tar.gz)
set(OPENSUBDIV_HASH 230f5cd2911d6240e58a3773b9c6e5e4)
set(OPENSUBDIV_HASH cd03aaf8890bc0b8550eef62029cabe7)
set(OPENSUBDIV_HASH_TYPE MD5)
set(OPENSUBDIV_FILE opensubdiv-${OPENSUBDIV_VERSION}.tar.gz)
@ -142,9 +141,9 @@ set(OPENCOLLADA_HASH ee7dae874019fea7be11613d07567493)
set(OPENCOLLADA_HASH_TYPE MD5)
set(OPENCOLLADA_FILE opencollada-${OPENCOLLADA_VERSION}.tar.gz)
set(OPENCOLORIO_VERSION 2.2.0)
set(OPENCOLORIO_VERSION 2.3.0)
set(OPENCOLORIO_URI https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v${OPENCOLORIO_VERSION}.tar.gz)
set(OPENCOLORIO_HASH d58a5980adba2d89a363100a09daa5f3)
set(OPENCOLORIO_HASH c05f24a516fe82d381c4b0d471e12ad5)
set(OPENCOLORIO_HASH_TYPE MD5)
set(OPENCOLORIO_FILE OpenColorIO-${OPENCOLORIO_VERSION}.tar.gz)
@ -154,9 +153,9 @@ set(MINIZIPNG_HASH 09dcc8a9def348e1be9659e384c2cd55)
set(MINIZIPNG_HASH_TYPE MD5)
set(MINIZIPNG_FILE minizip-ng-${MINIZIPNG_VERSION}.tar.gz)
set(LLVM_VERSION 12.0.0)
set(LLVM_VERSION 17.0.6)
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz)
set(LLVM_HASH 5a4fab4d7fc84aefffb118ac2c8a4fc0)
set(LLVM_HASH 62a09d65240a5133f001ace48269dbfc)
set(LLVM_HASH_TYPE MD5)
set(LLVM_FILE llvm-project-${LLVM_VERSION}.src.tar.xz)
set(LLVM_CPE "cpe:2.3:a:llvm:compiler:${LLVM_VERSION}:*:*:*:*:*:*:*")
@ -168,15 +167,15 @@ if(APPLE)
set(OPENMP_HASH 6eade16057edbdecb3c4eef9daa2bfcf)
else()
set(OPENMP_VERSION ${LLVM_VERSION})
set(OPENMP_HASH ac48ce3e4582ccb82f81ab59eb3fc9dc)
set(OPENMP_HASH 5cc01d151821c546bb4ec6fb03d86c29)
endif()
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${OPENMP_VERSION}/openmp-${OPENMP_VERSION}.src.tar.xz)
set(OPENMP_HASH_TYPE MD5)
set(OPENMP_FILE openmp-${OPENMP_VERSION}.src.tar.xz)
set(OPENIMAGEIO_VERSION v2.4.15.0)
set(OPENIMAGEIO_VERSION v2.5.6.0)
set(OPENIMAGEIO_URI https://github.com/AcademySoftwareFoundation/OpenImageIO/archive/refs/tags/${OPENIMAGEIO_VERSION}.tar.gz)
set(OPENIMAGEIO_HASH 784391406ee309075a3f82e60a42f023)
set(OPENIMAGEIO_HASH d02db17716a20a71a446bdc6de57bd9c)
set(OPENIMAGEIO_HASH_TYPE MD5)
set(OPENIMAGEIO_FILE OpenImageIO-${OPENIMAGEIO_VERSION}.tar.gz)
@ -205,12 +204,12 @@ set(TIFF_FILE tiff-${TIFF_VERSION}.tar.gz)
set(TIFF_CPE "cpe:2.3:a:libtiff:libtiff:${TIFF_VERSION}:*:*:*:*:*:*:*")
set(TIFF_HOMEPAGE http://www.simplesystems.org/libtiff/)
# Recent commit from 1.13.0.2 under development, which includes string table
# Recent commit from 1.13.5.0 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_VERSION 3d52f3906b12d38ad0f4b991a8f9ea678171bd28)
set(OSL_URI https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/archive/${OSL_VERSION}.tar.gz)
set(OSL_HASH 7b6d6716b05d1addb92a8f47280bf77f)
set(OSL_HASH dfe5d69f48930badc1ad39a4e11e2e98)
set(OSL_HASH_TYPE MD5)
set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz)
@ -219,11 +218,11 @@ set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz)
# BZIP2, FFI, SQLITE and change the versions in this file as well. For compliance
# reasons there can be no exceptions to this.
set(PYTHON_VERSION 3.10.13)
set(PYTHON_SHORT_VERSION 3.10)
set(PYTHON_SHORT_VERSION_NO_DOTS 310)
set(PYTHON_VERSION 3.11.6)
set(PYTHON_SHORT_VERSION 3.11)
set(PYTHON_SHORT_VERSION_NO_DOTS 311)
set(PYTHON_URI https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz)
set(PYTHON_HASH 8847dc6458d1431d0ae0f55942deeb89)
set(PYTHON_HASH d0c5a1a31efe879723e51addf56dd206)
set(PYTHON_HASH_TYPE MD5)
set(PYTHON_FILE Python-${PYTHON_VERSION}.tar.xz)
set(PYTHON_CPE "cpe:2.3:a:python:python:${PYTHON_VERSION}:-:*:*:*:*:*:*")
@ -237,9 +236,9 @@ set(TBB_HASH_TYPE MD5)
set(TBB_FILE oneTBB-${TBB_VERSION}.tar.gz)
set(TBB_CPE "cpe:2.3:a:intel:threading_building_blocks:${TBB_YEAR}:*:*:*:*:*:*:*")
set(OPENVDB_VERSION 10.0.0)
set(OPENVDB_VERSION 11.0.0)
set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz)
set(OPENVDB_HASH 64301c737e16b26c8f3085a31e6397e9)
set(OPENVDB_HASH 025f4fc4db58419341a4991f1a16174a)
set(OPENVDB_HASH_TYPE MD5)
set(OPENVDB_FILE openvdb-${OPENVDB_VERSION}.tar.gz)
@ -273,10 +272,10 @@ set(TOML_VERSION 0.10.2)
# Build system for other packages (not used by Blender at run-time).
set(MESON_VERSION 0.63.0)
set(NUMPY_VERSION 1.23.5)
set(NUMPY_SHORT_VERSION 1.23)
set(NUMPY_VERSION 1.24.3)
set(NUMPY_SHORT_VERSION 1.24)
set(NUMPY_URI https://github.com/numpy/numpy/releases/download/v${NUMPY_VERSION}/numpy-${NUMPY_VERSION}.tar.gz)
set(NUMPY_HASH 8b2692a511a3795f3af8af2cd7566a15)
set(NUMPY_HASH 89e5e2e78407032290ae6acf6dcaea46)
set(NUMPY_HASH_TYPE MD5)
set(NUMPY_FILE numpy-${NUMPY_VERSION}.tar.gz)
set(NUMPY_CPE "cpe:2.3:a:numpy:numpy:${NUMPY_VERSION}:*:*:*:*:*:*:*")
@ -397,9 +396,9 @@ set(JEMALLOC_HASH 3d41fbf006e6ebffd489bdb304d009ae)
set(JEMALLOC_HASH_TYPE MD5)
set(JEMALLOC_FILE jemalloc-${JEMALLOC_VERSION}.tar.bz2)
set(XML2_VERSION 2.10.4)
set(XML2_URI https://download.gnome.org/sources/libxml2/2.10/libxml2-${XML2_VERSION}.tar.xz)
set(XML2_HASH 76808c467a58c31e2dbd511e71d5fd13)
set(XML2_VERSION 2.12.3)
set(XML2_URI https://download.gnome.org/sources/libxml2/2.12/libxml2-${XML2_VERSION}.tar.xz)
set(XML2_HASH 13871e7cf2137b4b9b9da753ffef538c)
set(XML2_HASH_TYPE MD5)
set(XML2_FILE libxml2-${XML2_VERSION}.tar.xz)
set(XML2_CPE "cpe:2.3:a:xmlsoft:libxml2:${XML2_VERSION}:*:*:*:*:*:*:*")
@ -465,13 +464,12 @@ set(BZIP2_HOMEPAGE https://sourceware.org/bzip2/)
# NOTE: This will *HAVE* to match the version python ships on windows which
# is hardcoded in pythons PCbuild/get_externals.bat. For compliance reasons there
# can be no exceptions to this.
set(FFI_VERSION 3.3)
set(FFI_URI https://sourceware.org/pub/libffi/libffi-${FFI_VERSION}.tar.gz)
set(FFI_HASH 72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056)
set(FFI_VERSION 3.4.4)
set(FFI_URI https://github.com/libffi/libffi/releases/download/v${FFI_VERSION}/libffi-${FFI_VERSION}.tar.gz)
set(FFI_HASH d66c56ad259a82cf2a9dfc408b32bf5da52371500b84745f7fb8b645712df676)
set(FFI_HASH_TYPE SHA256)
set(FFI_FILE libffi-${FFI_VERSION}.tar.gz)
set(FFI_CPE "cpe:2.3:a:libffi_project:libffi:${FFI_VERSION}:*:*:*:*:*:*:*")
set(FFI_HOMEPAGE https://sourceware.org/libffi/)
set(LZMA_VERSION 5.2.5)
set(LZMA_URI https://tukaani.org/xz/xz-${LZMA_VERSION}.tar.bz2)
@ -492,10 +490,10 @@ set(SSL_HOMEPAGE https://www.openssl.org)
# Note: This will *HAVE* to match the version python ships on windows which
# is hardcoded in pythons PCbuild/get_externals.bat for compliance reasons there
# can be no exceptions to this.
set(SQLITE_VERSION 3.40.1)
set(SQLLITE_LONG_VERSION 3400100)
set(SQLITE_URI https://www.sqlite.org/2022/sqlite-autoconf-${SQLLITE_LONG_VERSION}.tar.gz)
set(SQLITE_HASH b8c2d4bc0094f5c0ce985dc0e237dfcbaa1f6275)
set(SQLITE_VERSION 3.42.0)
set(SQLLITE_LONG_VERSION 3420000)
set(SQLITE_URI https://www.sqlite.org/2023/sqlite-autoconf-${SQLLITE_LONG_VERSION}.tar.gz)
set(SQLITE_HASH 036575929b174c1b829769255491ba2b32bda9ee)
set(SQLITE_HASH_TYPE SHA1)
set(SQLITE_FILE sqlite-autoconf-${SQLLITE_LONG_VERSION}.tar.gz)
set(SQLITE_CPE "cpe:2.3:a:sqlite:sqlite:${SQLITE_VERSION}:*:*:*:*:*:*:*")
@ -507,15 +505,15 @@ set(EMBREE_HASH 4b525955b08e1249a700dea5b5ffc8b2)
set(EMBREE_HASH_TYPE MD5)
set(EMBREE_FILE embree-v${EMBREE_VERSION}.zip)
set(USD_VERSION 23.05)
set(USD_VERSION 23.11)
set(USD_URI https://github.com/PixarAnimationStudios/OpenUSD/archive/v${USD_VERSION}.tar.gz)
set(USD_HASH d4d92ff112bc82a1718bcd129b853a54)
set(USD_HASH 77358a244f50fc607e8b40764ea4f6c6)
set(USD_HASH_TYPE MD5)
set(USD_FILE usd-v${USD_VERSION}.tar.gz)
set(MATERIALX_VERSION 1.38.6)
set(MATERIALX_VERSION 1.38.8)
set(MATERIALX_URI https://github.com/AcademySoftwareFoundation/MaterialX/archive/refs/tags/v${MATERIALX_VERSION}.tar.gz)
set(MATERIALX_HASH d49c9fdef34b5702fc60058d3e1864f2)
set(MATERIALX_HASH fad8f4e19305fb2ee920cbff638f3560)
set(MATERIALX_HASH_TYPE MD5)
set(MATERIALX_FILE materialx-v${MATERIALX_VERSION}.tar.gz)
@ -532,9 +530,9 @@ set(LIBGLU_HASH_TYPE MD5)
set(LIBGLU_FILE glu-${LIBGLU_VERSION}.tar.xz)
set(LIBGLU_HOMEPAGE https://gitlab.freedesktop.org/mesa/glu)
set(MESA_VERSION 21.1.5)
set(MESA_VERSION 23.3.0)
set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa/mesa-${MESA_VERSION}.tar.xz)
set(MESA_HASH 022c7293074aeeced2278c872db4fa693147c70f8595b076cf3f1ef81520766d)
set(MESA_HASH 50f729dd60ed6335b989095baad81ef5edf7cfdd4b4b48b9b955917cb07d69c5)
set(MESA_HASH_TYPE SHA256)
set(MESA_FILE mesa-${MESA_VERSION}.tar.xz)
set(MESA_CPE "cpe:2.3:a:mesa3d:mesa:${MESA_VERSION}:*:*:*:*:*:*:*")
@ -581,9 +579,9 @@ set(WAYLAND_WESTON_HASH 44542b60bf9b9fe3add904af11bbad98)
set(WAYLAND_WESTON_HASH_TYPE MD5)
set(WAYLAND_WESTON_HOMEPAGE https://wayland.freedesktop.org)
set(ISPC_VERSION v1.17.0)
set(ISPC_VERSION v1.21.1)
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
set(ISPC_HASH 4f476a3109332a77fe839a9014c60ca9)
set(ISPC_HASH edd16b016aabc07819d14fd86a1fb5d0)
set(ISPC_HASH_TYPE MD5)
set(ISPC_FILE ispc-${ISPC_VERSION}.tar.gz)
@ -616,9 +614,9 @@ set(ZSTD_HASH_TYPE SHA256)
set(ZSTD_FILE zstd-${ZSTD_VERSION}.tar.gz)
set(ZSTD_CPE "cpe:2.3:a:facebook:zstandard:${ZSTD_VERSION}:*:*:*:*:*:*:*")
set(SSE2NEON_VERSION v1.6.0)
set(SSE2NEON_VERSION 0d6e9b3dd4687a0b98c0645e001f96659aae5854)
set(SSE2NEON_URI https://github.com/DLTcollab/sse2neon/archive/${SSE2NEON_VERSION}.tar.gz)
set(SSE2NEON_HASH 06f4693219deccb91b457135d836fc514a1c0a57e9fa66b143982901d2d19677)
set(SSE2NEON_HASH 68cf4dfe6d0667ae3e3850233227c4c4937b7b83de01845d356b68d313f25e32)
set(SSE2NEON_HASH_TYPE SHA256)
set(SSE2NEON_FILE sse2neon-${SSE2NEON_VERSION}.tar.gz)
@ -826,17 +824,17 @@ set(SHADERC_GLSLANG_HASH 3b3c79ad8e9132ffcb8b63cc29c532e2)
set(SHADERC_GLSLANG_HASH_TYPE MD5)
set(SHADERC_GLSLANG_FILE glslang-${SHADERC_GLSLANG_VERSION}.tar.gz)
set(VULKAN_VERSION v1.2.198)
set(VULKAN_VERSION v1.3.270)
set(VULKAN_HEADERS_VERSION ${VULKAN_VERSION})
set(VULKAN_HEADERS_URI https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/${VULKAN_HEADERS_VERSION}.tar.gz)
set(VULKAN_HEADERS_HASH 64fe73e887c963ad546bfc7f9505fa1d)
set(VULKAN_HEADERS_HASH 805bde4c23197b86334cee5c2cf69d8e)
set(VULKAN_HEADERS_HASH_TYPE MD5)
set(VULKAN_HEADERS_FILE Vulkan-Headers-${VULKAN_HEADERS_VERSION}.tar.gz)
set(VULKAN_LOADER_VERSION ${VULKAN_VERSION})
set(VULKAN_LOADER_URI https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/${VULKAN_LOADER_VERSION}.tar.gz)
set(VULKAN_LOADER_HASH 015170a74f648fd2b41e209b6bf1ebc4)
set(VULKAN_LOADER_HASH 6903f9d285afcd1a167ec7c46cbabd49)
set(VULKAN_LOADER_HASH_TYPE MD5)
set(VULKAN_LOADER_FILE Vulkan-Loader-${VULKAN_LOADER_VERSION}.tar.gz)

View File

@ -2,44 +2,23 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(XML2_EXTRA_ARGS
-DLIBXML2_WITH_ZLIB=OFF
-DLIBXML2_WITH_LZMA=OFF
-DLIBXML2_WITH_PYTHON=OFF
-DLIBXML2_WITH_ICONV=OFF
-DLIBXML2_WITH_TESTS=OFF
-DLIBXML2_WITH_PROGRAMS=OFF
-DBUILD_SHARED_LIBS=OFF
)
ExternalProject_Add(external_xml2
URL file://${PACKAGE_DIR}/${XML2_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${XML2_HASH_TYPE}=${XML2_HASH}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/xml2 ${DEFAULT_CMAKE_FLAGS} ${XML2_EXTRA_ARGS}
PREFIX ${BUILD_DIR}/xml2
INSTALL_DIR ${LIBDIR}/xml2
)
else()
ExternalProject_Add(external_xml2
URL file://${PACKAGE_DIR}/${XML2_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${XML2_HASH_TYPE}=${XML2_HASH}
PREFIX ${BUILD_DIR}/xml2
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/xml2/src/external_xml2/ && ${CONFIGURE_COMMAND}
--prefix=${LIBDIR}/xml2
--disable-shared
--enable-static
--with-pic
--with-python=no
--with-lzma=no
--with-zlib=no
--with-iconv=no
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/xml2/src/external_xml2/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/xml2/src/external_xml2/ && make install
INSTALL_DIR ${LIBDIR}/xml2
)
endif()
set(XML2_EXTRA_ARGS
-DLIBXML2_WITH_ZLIB=OFF
-DLIBXML2_WITH_LZMA=OFF
-DLIBXML2_WITH_PYTHON=OFF
-DLIBXML2_WITH_ICONV=OFF
-DLIBXML2_WITH_TESTS=OFF
-DLIBXML2_WITH_PROGRAMS=OFF
-DBUILD_SHARED_LIBS=OFF
)
ExternalProject_Add(external_xml2
URL file://${PACKAGE_DIR}/${XML2_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${XML2_HASH_TYPE}=${XML2_HASH}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/xml2 ${DEFAULT_CMAKE_FLAGS} ${XML2_EXTRA_ARGS}
PREFIX ${BUILD_DIR}/xml2
INSTALL_DIR ${LIBDIR}/xml2
)
if(WIN32 AND BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_xml2 after_install

View File

@ -96,6 +96,10 @@ PACKAGES_FOR_LIBS=(
# Required by: `external_mesa`.
expat-devel
# Required by: `external_mesa`.
libxshmfence
libxshmfence-devel
# Required by: `external_igc` & `external_osl` as a build-time dependency.
bison
# Required by: `external_osl` as a build-time dependency.

View File

@ -0,0 +1,21 @@
diff --git a/src/Imath/half.h b/src/Imath/half.h
index 84b349ab..828e0d82 100644
--- a/src/Imath/half.h
+++ b/src/Imath/half.h
@@ -328,8 +328,14 @@ imath_half_to_float (imath_half_bits_t h)
// other compilers may provide count-leading-zeros primitives,
// but we need the community to inform us of the variants
uint32_t lc;
-# if defined(_MSC_VER) && (_M_IX86 || _M_X64)
- lc = __lzcnt (hexpmant);
+# if defined(_MSC_VER)
+ // The direct intrinsic for this is __lznct, but that is not supported
+ // on older x86_64 hardware or ARM. Instead uses the bsr instruction
+ // and one additional subtraction. This assumes hexpmant != 0, for 0
+ // bsr and lznct would behave differently.
+ unsigned long bsr;
+ _BitScanReverse (&bsr, hexpmant);
+ lc = (31 - bsr);
# elif defined(__GNUC__) || defined(__clang__)
lc = (uint32_t) __builtin_clz (hexpmant);
# else

View File

@ -1,21 +1,6 @@
diff -Naur ispc-1.17.0.org/CMakeLists.txt ispc-1.17.0/CMakeLists.txt
--- ispc-1.17.0.org/CMakeLists.txt 2022-01-15 01:35:15 -0700
+++ ispc-1.17.0/CMakeLists.txt 2022-02-12 12:44:24 -0700
@@ -36,8 +36,12 @@
cmake_minimum_required(VERSION 3.13)
if (UNIX)
- set(CMAKE_C_COMPILER "clang")
- set(CMAKE_CXX_COMPILER "clang++")
+ if (NOT CMAKE_C_COMPILER)
+ set(CMAKE_C_COMPILER "clang")
+ endif()
+ if (NOT CMAKE_CXX_COMPILER)
+ set(CMAKE_CXX_COMPILER "clang++")
+ endif()
endif()
set(PROJECT_NAME ispc)
@@ -443,7 +447,7 @@
# Include directories
@ -25,15 +10,15 @@ diff -Naur ispc-1.17.0.org/CMakeLists.txt ispc-1.17.0/CMakeLists.txt
${XE_DEPS_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
@@ -507,7 +511,7 @@
# Link against Clang libraries
foreach(clangLib ${CLANG_LIBRARY_LIST})
- find_library(${clangLib}Path NAMES ${clangLib} HINTS ${LLVM_LIBRARY_DIRS})
+ find_library(${clangLib}Path NAMES ${clangLib} HINTS ${LLVM_LIBRARY_DIRS} ${CLANG_LIBRARY_DIR})
list(APPEND CLANG_LIBRARY_FULL_PATH_LIST ${${clangLib}Path})
endforeach()
target_link_libraries(${PROJECT_NAME} ${CLANG_LIBRARY_FULL_PATH_LIST})
@@ -607,7 +607,7 @@
NAMES
"${CMAKE_STATIC_LIBRARY_PREFIX}${clangLib}${CMAKE_STATIC_LIBRARY_SUFFIX}"
clang-cpp
- HINTS ${LLVM_LIBRARY_DIRS})
+ HINTS ${LLVM_LIBRARY_DIRS} ${CLANG_LIBRARY_DIR})
if (NOT ${${clangLib}Path} IN_LIST CLANG_LIBRARY_FULL_PATH_LIST)
list(APPEND CLANG_LIBRARY_FULL_PATH_LIST ${${clangLib}Path})
endif()
@@ -546,6 +550,29 @@
endif()
endif()

View File

@ -1,13 +1,14 @@
--- a/llvm/lib/Support/Unix/Path.inc 2020-02-17 09:24:26.000000000 +0100
+++ b/llvm/lib/Support/Unix/Path.inc 2020-02-17 09:26:25.000000000 +0100
@@ -1200,7 +1200,9 @@
/// implementation.
diff -Naur ll.org/llvm/lib/Support/Unix/Path.inc ll/llvm/lib/Support/Unix/Path.inc
--- ll.org/llvm/lib/Support/Unix/Path.inc 2023-08-01 06:41:14.360891600 -0600
+++ ll/llvm/lib/Support/Unix/Path.inc 2023-08-01 07:20:02.063130200 -0600
@@ -1476,7 +1476,9 @@
std::error_code copy_file(const Twine &From, const Twine &To) {
uint32_t Flag = COPYFILE_DATA;
-#if __has_builtin(__builtin_available) && defined(COPYFILE_CLONE)
std::string FromS = From.str();
std::string ToS = To.str();
-#if __has_builtin(__builtin_available)
+ // BLENDER: This optimization makes LLVM not build on older Xcode versions,
+ // just disable until everyone has new enough Xcode versions.
+#if 0
if (__builtin_available(macos 10.12, *)) {
bool IsSymlink;
if (std::error_code Error = is_symlink_file(From, IsSymlink))
// Optimistically try to use clonefile() and handle errors, rather than
// calling stat() to see if it'll work.

View File

@ -1,13 +0,0 @@
diff -Naur orig/source/PyMaterialX/PyBind11/tools/FindPythonLibsNew.cmake external_materialx/source/PyMaterialX/PyBind11/tools/FindPythonLibsNew.cmake
--- orig/source/PyMaterialX/PyBind11/tools/FindPythonLibsNew.cmake 2022-11-04 14:23:29 -0600
+++ external_materialx/source/PyMaterialX/PyBind11/tools/FindPythonLibsNew.cmake 2022-11-08 11:58:45 -0700
@@ -181,6 +181,9 @@
string(REGEX REPLACE "\\\\" "/" PYTHON_SITE_PACKAGES "${PYTHON_SITE_PACKAGES}")
if(CMAKE_HOST_WIN32)
+ if(PYTHON_EXECUTABLE MATCHES "_d.exe$")
+ set(PYTHON_LIBRARY_SUFFIX ${PYTHON_LIBRARY_SUFFIX}_d)
+ endif()
set(PYTHON_LIBRARY "${PYTHON_PREFIX}/libs/python${PYTHON_LIBRARY_SUFFIX}.lib")
# when run in a venv, PYTHON_PREFIX points to it. But the libraries remain in the

View File

@ -22,18 +22,26 @@ diff -Naur oidn-2.0.1/core/module.cpp external_openimagedenoise/core/module.cpp
#if defined(_WIN32)
filename += ".dll";
#else
diff -Naur oidn-2.0.1/devices/CMakeLists.txt external_openimagedenoise/devices/CMakeLists.txt
--- oidn-2.0.1/devices/CMakeLists.txt 2023-06-26 09:06:31.000000000 -0600
+++ external_openimagedenoise/devices/CMakeLists.txt 2023-07-01 10:57:36.987238700 -0600
diff -Naur oidn-2.1.0/devices/CMakeLists.txt external_openimagedenoise/devices/CMakeLists.txt
--- oidn-2.1.0/devices/CMakeLists.txt 2023-10-11 14:04:08 -0600
+++ external_openimagedenoise/devices/CMakeLists.txt 2023-12-23 09:34:17 -0700
@@ -59,6 +59,8 @@
-DOIDN_API_NAMESPACE:STRING=${OIDN_API_NAMESPACE}
-DOIDN_WARN_AS_ERRORS:BOOL=${OIDN_WARN_AS_ERRORS}
-DOIDN_SANITIZER:STRING=${OIDN_SANITIZER}
+ -DPYTHON_EXECUTABLE:STRING=${PYTHON_EXECUTABLE}
+ -DPython_EXECUTABLE:STRING=${Python_EXECUTABLE}
+ -DCMAKE_DEBUG_POSTFIX:STRING=${CMAKE_DEBUG_POSTFIX}
BUILD_ALWAYS TRUE
DEPENDS
OpenImageDenoise_core
@@ -149,6 +151,7 @@
-DOIDN_API_NAMESPACE:STRING=${OIDN_API_NAMESPACE}
-DOIDN_WARN_AS_ERRORS:BOOL=${OIDN_WARN_AS_ERRORS}
-DOIDN_SANITIZER:STRING=${OIDN_SANITIZER}
+ -DPython_EXECUTABLE:STRING=${Python_EXECUTABLE}
BUILD_ALWAYS TRUE
DEPENDS
OpenImageDenoise_core
--- a/core/module.cpp 2023-11-16 19:07:32
+++ b/core/module.cpp 2023-11-16 19:08:01
@@ -37,7 +37,8 @@

View File

@ -1,13 +0,0 @@
diff --git a/src/libOpenImageIO/exif.cpp b/src/libOpenImageIO/exif.cpp
index 90eaaec6e9..1fbf04140e 100644
--- a/src/libOpenImageIO/exif.cpp
+++ b/src/libOpenImageIO/exif.cpp
@@ -1302,6 +1302,8 @@ encode_exif(const ImageSpec& spec, std::vector<char>& blob,
TIFFHeader head;
head.tiff_magic = (endianreq == endian::little) ? 0x4949 : 0x4d4d;
head.tiff_version = 42;
+ if (endianreq != endian::native)
+ swap_endian(&head.tiff_version);
// N.B. need to swap_endian head.tiff_diroff below, once we know the sizes
append(blob, head);

View File

@ -0,0 +1,13 @@
diff --git a/src/png.imageio/pngoutput.cpp b/src/png.imageio/pngoutput.cpp
index cc694f5a..f752ab7d 100644
--- a/src/png.imageio/pngoutput.cpp
+++ b/src/png.imageio/pngoutput.cpp
@@ -385,7 +385,7 @@ PNGOutput::write_scanlines(int ybegin, int yend, int z, TypeDesc format,
unassoc_scratch.reset(new float[nvals]);
float* floatvals = unassoc_scratch.get();
// Contiguize and convert to float
- OIIO::convert_image(m_spec.nchannels, m_spec.width, m_spec.height, 1,
+ OIIO::convert_image(m_spec.nchannels, m_spec.width, yend - ybegin, 1,
data, format, xstride, ystride, AutoStride,
floatvals, TypeFloat, AutoStride, AutoStride,
AutoStride);

View File

@ -0,0 +1,28 @@
diff --git a/src/include/OpenImageIO/simd.h b/src/include/OpenImageIO/simd.h
index f888b29fe..e0cdebdc1 100644
--- a/src/include/OpenImageIO/simd.h
+++ b/src/include/OpenImageIO/simd.h
@@ -46,10 +46,6 @@
#include <OpenImageIO/detail/fmt.h>
-// Without SSE, we need to fall back on Imath for matrix44 invert
-#if !OIIO_SIMD_SSE
-# include <OpenImageIO/Imath.h>
-#endif
//////////////////////////////////////////////////////////////////////////
@@ -279,6 +275,12 @@
#endif
+// Without SSE, we need to fall back on Imath for matrix44 invert
+#if !OIIO_SIMD_SSE
+# include <OpenImageIO/Imath.h>
+#endif
+
+
OIIO_NAMESPACE_BEGIN
namespace simd {

View File

@ -1,62 +0,0 @@
diff -Naur orig/src/idiff/idiff.cpp external_openimageio/src/idiff/idiff.cpp
--- orig/src/idiff/idiff.cpp 2023-06-07 07:47:42 -0600
+++ external_openimageio/src/idiff/idiff.cpp 2023-06-07 09:46:47 -0600
@@ -399,5 +399,6 @@
imagecache->invalidate_all(true);
ImageCache::destroy(imagecache);
+ default_thread_pool()->resize(0);
return ret;
}
diff -Naur orig/src/libutil/thread.cpp external_openimageio/src/libutil/thread.cpp
--- orig/src/libutil/thread.cpp 2023-06-07 07:47:42 -0600
+++ external_openimageio/src/libutil/thread.cpp 2023-06-07 09:45:39 -0600
@@ -151,9 +151,10 @@
this->set_thread(i);
}
} else { // the number of threads is decreased
+ std::vector<std::unique_ptr<std::thread>> terminating_threads;
for (int i = oldNThreads - 1; i >= nThreads; --i) {
*this->flags[i] = true; // this thread will finish
- this->terminating_threads.push_back(
+ terminating_threads.push_back(
std::move(this->threads[i]));
this->threads.erase(this->threads.begin() + i);
}
@@ -162,6 +163,11 @@
std::unique_lock<std::mutex> lock(this->mutex);
this->cv.notify_all();
}
+ // wait for the terminated threads to finish
+ for (auto& thread : terminating_threads) {
+ if (thread->joinable())
+ thread->join();
+ }
this->threads.resize(
nThreads); // safe to delete because the threads are detached
this->flags.resize(
@@ -238,16 +244,10 @@
if (thread->joinable())
thread->join();
}
- // wait for the terminated threads to finish
- for (auto& thread : this->terminating_threads) {
- if (thread->joinable())
- thread->join();
- }
// if there were no threads in the pool but some functors in the queue, the functors are not deleted by the threads
// therefore delete them here
this->clear_queue();
this->threads.clear();
- this->terminating_threads.clear();
this->flags.clear();
}
@@ -349,7 +349,6 @@
}
std::vector<std::unique_ptr<std::thread>> threads;
- std::vector<std::unique_ptr<std::thread>> terminating_threads;
std::vector<std::shared_ptr<std::atomic<bool>>> flags;
mutable pvt::ThreadsafeQueue<std::function<void(int id)>*> q;
std::atomic<bool> isDone;

View File

@ -1,28 +0,0 @@
diff --git a/share/cmake/modules/Findpystring.cmake b/share/cmake/modules/Findpystring.cmake
index 7b894a45..92618215 100644
--- a/share/cmake/modules/Findpystring.cmake
+++ b/share/cmake/modules/Findpystring.cmake
@@ -113,6 +113,11 @@ if(NOT pystring_FOUND)
-DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE}
-DCMAKE_INSTALL_PREFIX=${_EXT_DIST_ROOT}
-DCMAKE_OBJECT_PATH_MAX=${CMAKE_OBJECT_PATH_MAX}
+ -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
+ -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
+ -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
+ -DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG}
+ -DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}
)
if(CMAKE_TOOLCHAIN_FILE)
set(pystring_CMAKE_ARGS
--- a/src/OpenColorIO/FileRules.cpp
+++ b/src/OpenColorIO/FileRules.cpp
@@ -7,6 +7,9 @@
#include <regex>
#include <sstream>
+/* NOTE: this has been applied up-stream, this edit can be removed after upgrading OpenColorIO. */
+#include <cstring>
+
#include <OpenColorIO/OpenColorIO.h>
#include "CustomKeys.h"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,140 @@
diff --git a/openexr_original/cmake/OpenEXRSetup.cmake b/openexr/cmake/OpenEXRSetup.cmake
index 425992d..fa80886 100644
--- a/openexr_original/cmake/OpenEXRSetup.cmake
+++ b/openexr/cmake/OpenEXRSetup.cmake
@@ -160,71 +160,79 @@ set(OPENEXR_DEFLATE_TAG "v1.18" CACHE STRING "Tag to use for libdeflate source r
if(NOT OPENEXR_FORCE_INTERNAL_DEFLATE)
#TODO: ^^ Release should not clone from main, this is a place holder
set(CMAKE_IGNORE_PATH "${CMAKE_CURRENT_BINARY_DIR}/_deps/deflate-src/config;${CMAKE_CURRENT_BINARY_DIR}/_deps/deflate-build/config")
- include(FindPkgConfig)
- pkg_check_modules(deflate IMPORTED_TARGET GLOBAL libdeflate)
- set(CMAKE_IGNORE_PATH)
- if (deflate_FOUND)
- message(STATUS "Using libdeflate from ${deflate_LINK_LIBRARIES}")
+ find_package(libdeflate CONFIG)
+ if(libdeflate_FOUND)
+ message(STATUS "Using libdeflate from ${libdeflate_DIR}")
+ else()
+ include(FindPkgConfig)
+ pkg_check_modules(deflate IMPORTED_TARGET GLOBAL libdeflate)
+ set(CMAKE_IGNORE_PATH)
+ if (deflate_FOUND)
+ message(STATUS "Using libdeflate from ${deflate_LINK_LIBRARIES}")
+ endif()
endif()
endif()
-if(NOT TARGET PkgConfig::deflate AND NOT deflate_FOUND)
- if(OPENEXR_FORCE_INTERNAL_DEFLATE)
- message(STATUS "libdeflate forced internal, installing from ${OPENEXR_DEFLATE_REPO} (${OPENEXR_DEFLATE_TAG})")
- else()
- message(STATUS "libdeflate was not found, installing from ${OPENEXR_DEFLATE_REPO} (${OPENEXR_DEFLATE_TAG})")
- endif()
- include(FetchContent)
- FetchContent_Declare(Deflate
- GIT_REPOSITORY "${OPENEXR_DEFLATE_REPO}"
- GIT_TAG "${OPENEXR_DEFLATE_TAG}"
- GIT_SHALLOW ON
- )
+if(libdeflate_FOUND)
+ set(EXR_DEFLATE_LIB libdeflate::libdeflate_static)
+else()
+ if(NOT TARGET PkgConfig::deflate AND NOT deflate_FOUND)
+ if(OPENEXR_FORCE_INTERNAL_DEFLATE)
+ message(STATUS "libdeflate forced internal, installing from ${OPENEXR_DEFLATE_REPO} (${OPENEXR_DEFLATE_TAG})")
+ else()
+ message(STATUS "libdeflate was not found, installing from ${OPENEXR_DEFLATE_REPO} (${OPENEXR_DEFLATE_TAG})")
+ endif()
+ include(FetchContent)
+ FetchContent_Declare(Deflate
+ GIT_REPOSITORY "${OPENEXR_DEFLATE_REPO}"
+ GIT_TAG "${OPENEXR_DEFLATE_TAG}"
+ GIT_SHALLOW ON
+ )
- FetchContent_GetProperties(Deflate)
- if(NOT Deflate_POPULATED)
- FetchContent_Populate(Deflate)
- endif()
+ FetchContent_GetProperties(Deflate)
+ if(NOT Deflate_POPULATED)
+ FetchContent_Populate(Deflate)
+ endif()
- # Rather than actually compile something, just embed the sources
- # into exrcore. This could in theory cause issues when compiling as
- # a static library into another application which also uses
- # libdeflate but we switch the export symbol to hidden which should
- # hide the symbols when linking...
- set(EXR_DEFLATE_SOURCES
- lib/arm/cpu_features.c
- lib/x86/cpu_features.c
- lib/utils.c
- lib/deflate_compress.c
- lib/deflate_decompress.c
- lib/adler32.c
- lib/zlib_compress.c
- lib/zlib_decompress.c)
- # don't need these
- # lib/crc32.c
- # lib/gzip_compress.c
- # lib/gzip_decompress.c
- file(READ ${deflate_SOURCE_DIR}/lib/lib_common.h DEFLATE_HIDE)
- string(REPLACE "visibility(\"default\")" "visibility(\"hidden\")" DEFLATE_HIDE "${DEFLATE_HIDE}")
- string(REPLACE "__declspec(dllexport)" "/**/" DEFLATE_HIDE "${DEFLATE_HIDE}")
- file(WRITE ${deflate_SOURCE_DIR}/lib/lib_common.h "${DEFLATE_HIDE}")
+ # Rather than actually compile something, just embed the sources
+ # into exrcore. This could in theory cause issues when compiling as
+ # a static library into another application which also uses
+ # libdeflate but we switch the export symbol to hidden which should
+ # hide the symbols when linking...
+ set(EXR_DEFLATE_SOURCES
+ lib/arm/cpu_features.c
+ lib/x86/cpu_features.c
+ lib/utils.c
+ lib/deflate_compress.c
+ lib/deflate_decompress.c
+ lib/adler32.c
+ lib/zlib_compress.c
+ lib/zlib_decompress.c)
+ # don't need these
+ # lib/crc32.c
+ # lib/gzip_compress.c
+ # lib/gzip_decompress.c
+ file(READ ${deflate_SOURCE_DIR}/lib/lib_common.h DEFLATE_HIDE)
+ string(REPLACE "visibility(\"default\")" "visibility(\"hidden\")" DEFLATE_HIDE "${DEFLATE_HIDE}")
+ string(REPLACE "__declspec(dllexport)" "/**/" DEFLATE_HIDE "${DEFLATE_HIDE}")
+ file(WRITE ${deflate_SOURCE_DIR}/lib/lib_common.h "${DEFLATE_HIDE}")
- # cmake makes fetch content name lowercase for the properties (to deflate)
- list(TRANSFORM EXR_DEFLATE_SOURCES PREPEND ${deflate_SOURCE_DIR}/)
- set(EXR_DEFLATE_INCLUDE_DIR ${deflate_SOURCE_DIR})
- set(EXR_DEFLATE_LIB)
-else()
- set(EXR_DEFLATE_INCLUDE_DIR)
- set(EXR_DEFLATE_LIB ${deflate_LIBRARIES})
- # set EXR_DEFATE_LDFLAGS for OpenEXR.pc.in for static build
- if (BUILD_SHARED_LIBS)
- set(EXR_DEFLATE_LDFLAGS "")
+ # cmake makes fetch content name lowercase for the properties (to deflate)
+ list(TRANSFORM EXR_DEFLATE_SOURCES PREPEND ${deflate_SOURCE_DIR}/)
+ set(EXR_DEFLATE_INCLUDE_DIR ${deflate_SOURCE_DIR})
+ set(EXR_DEFLATE_LIB)
else()
- set(EXR_DEFLATE_LDFLAGS "-l${deflate_LIBRARIES}")
+ set(EXR_DEFLATE_INCLUDE_DIR)
+ set(EXR_DEFLATE_LIB ${deflate_LIBRARIES})
+ # set EXR_DEFATE_LDFLAGS for OpenEXR.pc.in for static build
+ if (BUILD_SHARED_LIBS)
+ set(EXR_DEFLATE_LDFLAGS "")
+ else()
+ set(EXR_DEFLATE_LDFLAGS "-l${deflate_LIBRARIES}")
+ endif()
+ set(EXR_DEFLATE_SOURCES)
endif()
- set(EXR_DEFLATE_SOURCES)
endif()
-
#######################################
# Find or install Imath
#######################################

View File

@ -1,7 +1,7 @@
diff -Naur orig/CMakeLists.txt external_openimageio/CMakeLists.txt
--- orig/CMakeLists.txt 2020-05-10 21:43:52 -0600
+++ external_openimageio/CMakeLists.txt 2020-05-13 17:03:35 -0600
@@ -170,7 +170,7 @@
@@ -237,7 +237,7 @@
add_subdirectory (src/iinfo)
add_subdirectory (src/maketx)
add_subdirectory (src/oiiotool)
@ -13,7 +13,7 @@ diff -Naur orig/CMakeLists.txt external_openimageio/CMakeLists.txt
diff -Naur orig/src/cmake/compiler.cmake external_openimageio/src/cmake/compiler.cmake
--- orig/src/cmake/compiler.cmake 2020-05-10 21:43:52 -0600
+++ external_openimageio/src/cmake/compiler.cmake 2020-05-13 17:02:54 -0600
@@ -172,6 +172,7 @@
@@ -188,6 +189,7 @@
add_definitions (-D_CRT_NONSTDC_NO_WARNINGS)
add_definitions (-D_SCL_SECURE_NO_WARNINGS)
add_definitions (-DJAS_WIN_MSVC_BUILD)

View File

@ -75,40 +75,3 @@ diff -Naur openvdb-8.0.0/openvdb/openvdb/version.rc.in openvdb/openvdb/openvdb/v
+
+ END
+END
diff -Naur orig/openvdb/openvdb/tree/ValueAccessor.h openvdb/openvdb/openvdb/tree/ValueAccessor.h
--- orig/openvdb/openvdb/tree/ValueAccessor.h 2022-11-02 13:58:26 -0600
+++ openvdb/openvdb/openvdb/tree/ValueAccessor.h 2022-11-02 18:55:09 -0600
@@ -872,7 +872,10 @@
using LeafNodeType = typename NodeType::LeafNodeType;
using CoordLimits = std::numeric_limits<Int32>;
- static_assert(std::is_same<NodeType, LeafNodeType>::value);
+ // Blender: Technically not an issue in OpenVDB, but USD 21.11 still builds
+ // as C++14 which does not support terse asserts yet. Add a message to
+ // explicitly select the C++14 supported static assert.
+ static_assert(std::is_same<NodeType, LeafNodeType>::value, "cache item node type is not leaf node type");
CacheItem(TreeCacheT& parent)
: mParent(&parent)
diff --git a/nanovdb/nanovdb/NanoVDB.h b/nanovdb/nanovdb/NanoVDB.h
index f7fc304..fde5c47 100644
--- a/nanovdb/nanovdb/NanoVDB.h
+++ b/nanovdb/nanovdb/NanoVDB.h
@@ -1877,7 +1877,7 @@ __hostdev__ static inline uint32_t FindLowestOn(uint64_t v)
{
NANOVDB_ASSERT(v);
#if (defined(__CUDA_ARCH__) || defined(__HIP__)) && defined(NANOVDB_USE_INTRINSICS)
- return __ffsll(v);
+ return __ffsll(static_cast<unsigned long long int>(v));
#elif defined(_MSC_VER) && defined(NANOVDB_USE_INTRINSICS)
unsigned long index;
_BitScanForward64(&index, v);
@@ -2592,7 +2592,7 @@ public:
///
/// @note This method is only defined for IndexGrid = NanoGrid<ValueIndex>
template <typename T = BuildType>
- __hostdev__ typename enable_if<is_same<T, ValueIndex>::value, uint64_t>::type valueCount() const {return DataType::mData1;}
+ __hostdev__ typename enable_if<is_same<T, ValueIndex>::value, const uint64_t&>::type valueCount() const {return DataType::mData1;}
/// @brief Return a const reference to the tree
__hostdev__ const TreeT& tree() const { return *reinterpret_cast<const TreeT*>(this->treePtr()); }

View File

@ -0,0 +1,81 @@
diff --git a/openvdb/openvdb/python/pyGrid.h b/openvdb/openvdb/python/pyGrid.h
index 9249eaf6d..f4c859110 100644
--- a/openvdb/openvdb/python/pyGrid.h
+++ b/openvdb/openvdb/python/pyGrid.h
@@ -322,7 +322,7 @@ copyToArray(GridType&, const py::object&, py::object)
#else // if defined(PY_OPENVDB_USE_NUMPY)
-using ArrayDimVec = std::vector<ssize_t>;
+using ArrayDimVec = std::vector<Py_ssize_t>;
// ID numbers for supported value types
enum class DtId { NONE, FLOAT, DOUBLE, BOOL, INT16, INT32, INT64, UINT32, UINT64/*, HALF*/ };
@@ -768,12 +768,12 @@ template<typename GridType>
inline typename GridType::Ptr
meshToLevelSet(py::array_t<float> pointsObj, py::array_t<Index32> trianglesObj, py::array_t<Index32> quadsObj, math::Transform::Ptr xform, float halfWidth)
{
- auto validate2DArray = [](py::array array, ssize_t N) {
+ auto validate2DArray = [](py::array array, Py_ssize_t N) {
if (array.ndim() != 2 || array.shape(1) != N) {
std::ostringstream os;
os << "Expected a 2-dimensional numpy.ndarray with shape(1) = "<< N;
os << ", found " << array.ndim() << "-dimensional array with shape = (";
- for (ssize_t i = 0; i < array.ndim(); ++i) {
+ for (Py_ssize_t i = 0; i < array.ndim(); ++i) {
os << array.shape(i);
if (i != array.ndim() - 1)
os << ", ";
@@ -826,12 +826,12 @@ volumeToQuadMesh(const GridType& grid, double isovalue)
std::vector<Vec4I> quads;
tools::volumeToMesh(grid, points, quads, isovalue);
- std::vector<ssize_t> shape = { static_cast<ssize_t>(points.size()), 3 };
- std::vector<ssize_t> strides = { 3 * static_cast<ssize_t>(sizeof(float)), static_cast<ssize_t>(sizeof(float))};
+ std::vector<Py_ssize_t> shape = { static_cast<Py_ssize_t>(points.size()), 3 };
+ std::vector<Py_ssize_t> strides = { 3 * static_cast<Py_ssize_t>(sizeof(float)), static_cast<Py_ssize_t>(sizeof(float))};
py::array_t<float> pointArrayObj(py::buffer_info(points.data(), sizeof(float), py::format_descriptor<float>::format(), 2, shape, strides));
- shape = { static_cast<ssize_t>(quads.size()), 4 };
- strides = { 4 * static_cast<ssize_t>(sizeof(Index32)), static_cast<ssize_t>(sizeof(Index32))};
+ shape = { static_cast<Py_ssize_t>(quads.size()), 4 };
+ strides = { 4 * static_cast<Py_ssize_t>(sizeof(Index32)), static_cast<Py_ssize_t>(sizeof(Index32))};
py::array_t<Index32> quadArrayObj(py::buffer_info(quads.data(), sizeof(Index32), py::format_descriptor<Index32>::format(), 2, shape, strides));
return std::make_tuple(pointArrayObj, quadArrayObj);
@@ -857,18 +857,18 @@ volumeToMesh(const GridType& grid, double isovalue, double adaptivity)
// Create a deep copy of the array (because the point vector will be destroyed
// when this function returns).
- std::vector<ssize_t> shape = { static_cast<ssize_t>(points.size()), 3 };
- std::vector<ssize_t> strides = { 3 * static_cast<ssize_t>(sizeof(float)), static_cast<ssize_t>(sizeof(float))};
+ std::vector<Py_ssize_t> shape = { static_cast<Py_ssize_t>(points.size()), 3 };
+ std::vector<Py_ssize_t> strides = { 3 * static_cast<Py_ssize_t>(sizeof(float)), static_cast<Py_ssize_t>(sizeof(float))};
py::buffer_info pointInfo(points.data(), sizeof(float), py::format_descriptor<float>::format(), 2, shape, strides);
py::array_t<float> pointArray(pointInfo);
- shape = { static_cast<ssize_t>(triangles.size()), 3 };
- strides = { 3 * static_cast<ssize_t>(sizeof(Index32)), static_cast<ssize_t>(sizeof(Index32))};
+ shape = { static_cast<Py_ssize_t>(triangles.size()), 3 };
+ strides = { 3 * static_cast<Py_ssize_t>(sizeof(Index32)), static_cast<Py_ssize_t>(sizeof(Index32))};
py::buffer_info triangleInfo(triangles.data(), sizeof(Index32), py::format_descriptor<Index32>::format(), 2, shape, strides);
py::array_t<Index32> triangleArray(triangleInfo);
- shape = { static_cast<ssize_t>(quads.size()), 4 };
- strides = { 4 * static_cast<ssize_t>(sizeof(Index32)), static_cast<ssize_t>(sizeof(Index32))};
+ shape = { static_cast<Py_ssize_t>(quads.size()), 4 };
+ strides = { 4 * static_cast<Py_ssize_t>(sizeof(Index32)), static_cast<Py_ssize_t>(sizeof(Index32))};
py::buffer_info quadInfo(quads.data(), sizeof(Index32), py::format_descriptor<Index32>::format(), 2, shape, strides);
py::array_t<Index32> quadArray(quadInfo);
@@ -1590,8 +1590,8 @@ exportGrid(py::module_ m)
&pyGrid::meshToLevelSet<GridType>,
py::arg("points"),
#ifdef PY_OPENVDB_USE_NUMPY
- py::arg("triangles")=py::array_t<Index32>({ 0, 3 }, { 3 * static_cast<ssize_t>(sizeof(Index32)), static_cast<ssize_t>(sizeof(Index32))} ),
- py::arg("quads")=py::array_t<Index32>({ 0, 4 }, { 4 * static_cast<ssize_t>(sizeof(Index32)), static_cast<ssize_t>(sizeof(Index32))} ),
+ py::arg("triangles")=py::array_t<Index32>({ 0, 3 }, { 3 * static_cast<Py_ssize_t>(sizeof(Index32)), static_cast<Py_ssize_t>(sizeof(Index32))} ),
+ py::arg("quads")=py::array_t<Index32>({ 0, 4 }, { 4 * static_cast<Py_ssize_t>(sizeof(Index32)), static_cast<Py_ssize_t>(sizeof(Index32))} ),
#else
py::arg("triangles")=std::vector<Index32>(),
py::arg("quads")=std::vector<Index32>(),

View File

@ -0,0 +1,21 @@
diff --git a/openvdb/openvdb/math/Half.h b/openvdb/openvdb/math/Half.h
index b8045ba441..ba72b0e6df 100644
--- a/openvdb/openvdb/math/Half.h
+++ b/openvdb/openvdb/math/Half.h
@@ -342,8 +342,14 @@ imath_half_to_float (imath_half_bits_t h)
// other compilers may provide count-leading-zeros primitives,
// but we need the community to inform us of the variants
uint32_t lc;
-# if defined(_MSC_VER) && (_M_IX86 || _M_X64)
- lc = __lzcnt (hexpmant);
+# if defined(_MSC_VER)
+ // The direct intrinsic for this is __lznct, but that is not supported
+ // on older x86_64 hardware or ARM. Instead uses the bsr instruction
+ // and one additional subtraction. This assumes hexpmant != 0, for 0
+ // bsr and lznct would behave differently.
+ unsigned long bsr;
+ _BitScanReverse (&bsr, hexpmant);
+ lc = (31 - bsr);
# elif defined(__GNUC__) || defined(__clang__)
lc = (uint32_t) __builtin_clz (hexpmant);
# else

View File

@ -1,31 +1,3 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d527232..5ad6eaa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,6 +99,11 @@ set (OSL_PTX_INSTALL_DIR "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/ptx"
CACHE STRING "Directory where OptiX PTX files will be installed")
set (CMAKE_DEBUG_POSTFIX "" CACHE STRING "Library naming postfix for Debug builds (e.g., '_debug')")
+set (USE_OIIO_STATIC ON CACHE BOOL "If OIIO is built static")
+if (USE_OIIO_STATIC)
+ add_definitions ("-DOIIO_STATIC_BUILD=1")
+ add_definitions ("-DOIIO_STATIC_DEFINE=1")
+endif ()
set (OSL_NO_DEFAULT_TEXTURESYSTEM OFF CACHE BOOL "Do not use create a raw OIIO::TextureSystem")
if (OSL_NO_DEFAULT_TEXTURESYSTEM)
diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake
index a7e098b..dad11d0 100644
--- a/src/cmake/externalpackages.cmake
+++ b/src/cmake/externalpackages.cmake
@@ -77,6 +77,7 @@ link_directories ("${Boost_LIBRARY_DIRS}")
checked_find_package (ZLIB REQUIRED) # Needed by several packages
+checked_find_package (PNG REQUIRED) # Needed since OIIO needs it
# IlmBase & OpenEXR
checked_find_package (OpenEXR REQUIRED
diff --git a/src/liboslcomp/oslcomp.cpp b/src/liboslcomp/oslcomp.cpp
index 8c2e77b..211b8a7 100644
--- a/src/liboslcomp/oslcomp.cpp
@ -44,70 +16,3 @@ index 8c2e77b..211b8a7 100644
#include <clang/Basic/TargetInfo.h>
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Frontend/TextDiagnosticPrinter.h>
diff --git a/src/liboslexec/llvm_instance.cpp b/src/liboslexec/llvm_instance.cpp
index 8f52546..8c2d0c7 100644
--- a/src/liboslexec/llvm_instance.cpp
+++ b/src/liboslexec/llvm_instance.cpp
@@ -1363,6 +1363,10 @@ BackendLLVM::run()
#ifdef OSL_LLVM_NO_BITCODE
OSL_ASSERT(!use_rs_bitcode());
ll.module(ll.new_module("llvm_ops"));
+ if (use_optix()) {
+ ll.module()->setDataLayout("e-i64:64-i128:128-v16:16-v32:32-n16:32:64");
+ ll.module()->setTargetTriple("nvptx64-nvidia-cuda");
+ }
#else
if (!use_optix()) {
if (use_rs_bitcode()) {
diff --git a/src/liboslexec/shadingsys.cpp b/src/liboslexec/shadingsys.cpp
index 46e4529..8e86486 100644
--- a/src/liboslexec/shadingsys.cpp
+++ b/src/liboslexec/shadingsys.cpp
@@ -2121,6 +2121,11 @@ ShadingSystemImpl::getattribute(ShaderGroup* group, string_view name,
return true;
}
+ if (name == "groupdata_size" && type == TypeDesc::TypeInt) {
+ *(int*)val = (int)group->m_llvm_groupdata_size;
+ return true;
+ }
+
return false;
}
diff --git a/src/liboslexec/CMakeLists.txt b/src/liboslexec/CMakeLists.txt
index 6bb0d175..19f13513 100644
--- a/src/liboslexec/CMakeLists.txt
+++ b/src/liboslexec/CMakeLists.txt
@@ -148,7 +148,9 @@ file (GLOB exec_headers "*.h")
file (GLOB compiler_headers "../liboslcomp/*.h")
FLEX_BISON ( osolex.l osogram.y oso lib_src exec_headers )
-FLEX_BISON ( ../liboslcomp/osllex.l ../liboslcomp/oslgram.y osl lib_src compiler_headers )
+if (BUILD_SHARED_LIBS)
+ FLEX_BISON ( ../liboslcomp/osllex.l ../liboslcomp/oslgram.y osl lib_src compiler_headers )
+endif()
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS" )
diff --git a/src/include/OSL/mask.h b/src/include/OSL/mask.h
index 24197af..b9275f6 100644
--- a/src/include/OSL/mask.h
+++ b/src/include/OSL/mask.h
@@ -4,7 +4,6 @@
#pragma once
-#include <immintrin.h>
#include <type_traits>
#include <OSL/oslconfig.h>
@@ -23,6 +22,8 @@ using std::countr_zero;
#elif OSL_INTEL_CLASSIC_COMPILER_VERSION
+#include <immintrin.h>
+
OSL_FORCEINLINE int popcount(uint32_t x) noexcept { return _mm_popcnt_u32(x);}
OSL_FORCEINLINE int popcount(uint64_t x) noexcept { return _mm_popcnt_u64(x); }
OSL_FORCEINLINE int countr_zero(uint32_t x) noexcept { return _bit_scan_forward(x); }

View File

@ -0,0 +1,113 @@
diff --git a/tools/FindPythonLibsNew.cmake b/tools/FindPythonLibsNew.cmake
index ce558d4ece..104448597f 100644
--- a/tools/FindPythonLibsNew.cmake
+++ b/tools/FindPythonLibsNew.cmake
@@ -172,13 +172,20 @@ _pybind11_get_if_undef(_PYTHON_VALUES 0 _PYTHON_VERSION_LIST)
_pybind11_get_if_undef(_PYTHON_VALUES 1 PYTHON_PREFIX)
_pybind11_get_if_undef(_PYTHON_VALUES 2 PYTHON_INCLUDE_DIR)
_pybind11_get_if_undef(_PYTHON_VALUES 3 PYTHON_SITE_PACKAGES)
-_pybind11_get_if_undef(_PYTHON_VALUES 4 PYTHON_MODULE_EXTENSION)
_pybind11_get_if_undef(_PYTHON_VALUES 5 PYTHON_IS_DEBUG)
_pybind11_get_if_undef(_PYTHON_VALUES 6 PYTHON_SIZEOF_VOID_P)
_pybind11_get_if_undef(_PYTHON_VALUES 7 PYTHON_LIBRARY_SUFFIX)
_pybind11_get_if_undef(_PYTHON_VALUES 8 PYTHON_LIBDIR)
_pybind11_get_if_undef(_PYTHON_VALUES 9 PYTHON_MULTIARCH)
+list(GET _PYTHON_VALUES 4 _PYTHON_MODULE_EXT_SUFFIX)
+if(PYBIND11_PYTHONLIBS_OVERWRITE OR NOT DEFINED PYTHON_MODULE_DEBUG_POSTFIX)
+ get_filename_component(PYTHON_MODULE_DEBUG_POSTFIX "${_PYTHON_MODULE_EXT_SUFFIX}" NAME_WE)
+endif()
+if(PYBIND11_PYTHONLIBS_OVERWRITE OR NOT DEFINED PYTHON_MODULE_EXTENSION)
+ get_filename_component(PYTHON_MODULE_EXTENSION "${_PYTHON_MODULE_EXT_SUFFIX}" EXT)
+endif()
+
# Make sure the Python has the same pointer-size as the chosen compiler
# Skip if CMAKE_SIZEOF_VOID_P is not defined
# This should be skipped for (non-Apple) cross-compiles (like EMSCRIPTEN)
diff --git a/tools/pybind11NewTools.cmake b/tools/pybind11NewTools.cmake
index 7d7424a790..07bd2f90eb 100644
--- a/tools/pybind11NewTools.cmake
+++ b/tools/pybind11NewTools.cmake
@@ -95,25 +95,36 @@ endif()
# Get the suffix - SO is deprecated, should use EXT_SUFFIX, but this is
# required for PyPy3 (as of 7.3.1)
-if(NOT DEFINED PYTHON_MODULE_EXTENSION)
+if(NOT DEFINED PYTHON_MODULE_EXTENSION OR NOT DEFINED PYTHON_MODULE_DEBUG_POSTFIX)
execute_process(
COMMAND
"${${_Python}_EXECUTABLE}" "-c"
"import sys, importlib; s = importlib.import_module('distutils.sysconfig' if sys.version_info < (3, 10) else 'sysconfig'); print(s.get_config_var('EXT_SUFFIX') or s.get_config_var('SO'))"
- OUTPUT_VARIABLE _PYTHON_MODULE_EXTENSION
- ERROR_VARIABLE _PYTHON_MODULE_EXTENSION_ERR
+ OUTPUT_VARIABLE _PYTHON_MODULE_EXT_SUFFIX
+ ERROR_VARIABLE _PYTHON_MODULE_EXT_SUFFIX_ERR
OUTPUT_STRIP_TRAILING_WHITESPACE)
- if(_PYTHON_MODULE_EXTENSION STREQUAL "")
+ if(_PYTHON_MODULE_EXT_SUFFIX STREQUAL "")
message(
FATAL_ERROR "pybind11 could not query the module file extension, likely the 'distutils'"
- "package is not installed. Full error message:\n${_PYTHON_MODULE_EXTENSION_ERR}")
+ "package is not installed. Full error message:\n${_PYTHON_MODULE_EXT_SUFFIX_ERR}"
+ )
endif()
# This needs to be available for the pybind11_extension function
- set(PYTHON_MODULE_EXTENSION
- "${_PYTHON_MODULE_EXTENSION}"
- CACHE INTERNAL "")
+ if(NOT DEFINED PYTHON_MODULE_DEBUG_POSTFIX)
+ get_filename_component(_PYTHON_MODULE_DEBUG_POSTFIX "${_PYTHON_MODULE_EXT_SUFFIX}" NAME_WE)
+ set(PYTHON_MODULE_DEBUG_POSTFIX
+ "${_PYTHON_MODULE_DEBUG_POSTFIX}"
+ CACHE INTERNAL "")
+ endif()
+
+ if(NOT DEFINED PYTHON_MODULE_EXTENSION)
+ get_filename_component(_PYTHON_MODULE_EXTENSION "${_PYTHON_MODULE_EXT_SUFFIX}" EXT)
+ set(PYTHON_MODULE_EXTENSION
+ "${_PYTHON_MODULE_EXTENSION}"
+ CACHE INTERNAL "")
+ endif()
endif()
# Python debug libraries expose slightly different objects before 3.8
@@ -251,6 +262,9 @@ endfunction()
function(pybind11_extension name)
# The extension is precomputed
- set_target_properties(${name} PROPERTIES PREFIX "" SUFFIX "${PYTHON_MODULE_EXTENSION}")
-
+ set_target_properties(
+ ${name}
+ PROPERTIES PREFIX ""
+ DEBUG_POSTFIX "${PYTHON_MODULE_DEBUG_POSTFIX}"
+ SUFFIX "${PYTHON_MODULE_EXTENSION}")
endfunction()
diff --git a/tools/pybind11Tools.cmake b/tools/pybind11Tools.cmake
index 66ad00a478..874fc39ebb 100644
--- a/tools/pybind11Tools.cmake
+++ b/tools/pybind11Tools.cmake
@@ -65,6 +65,7 @@ _pybind11_promote_to_cache(PYTHON_INCLUDE_DIRS)
_pybind11_promote_to_cache(PYTHON_LIBRARIES)
_pybind11_promote_to_cache(PYTHON_MODULE_PREFIX)
_pybind11_promote_to_cache(PYTHON_MODULE_EXTENSION)
+_pybind11_promote_to_cache(PYTHON_MODULE_DEBUG_POSTFIX)
_pybind11_promote_to_cache(PYTHON_VERSION_MAJOR)
_pybind11_promote_to_cache(PYTHON_VERSION_MINOR)
_pybind11_promote_to_cache(PYTHON_VERSION)
@@ -148,8 +149,11 @@ endif()
function(pybind11_extension name)
# The prefix and extension are provided by FindPythonLibsNew.cmake
- set_target_properties(${name} PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
- SUFFIX "${PYTHON_MODULE_EXTENSION}")
+ set_target_properties(
+ ${name}
+ PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
+ DEBUG_POSTFIX "${PYTHON_MODULE_DEBUG_POSTFIX}"
+ SUFFIX "${PYTHON_MODULE_EXTENSION}")
endfunction()
# Build a Python extension module:

View File

@ -0,0 +1,49 @@
diff --git a/setup.py.orig b/setup.py
index a97a755..07ce853 100644
--- a/setup.py.orig
+++ b/setup.py
@@ -2168,7 +2168,7 @@
ffi_inc = None
print('Header file {} does not exist'.format(ffi_h))
if ffi_lib is None and ffi_inc:
- for lib_name in ('ffi', 'ffi_pic'):
+ for lib_name in ('ffi_pic', ):
if (self.compiler.find_library_file(self.lib_dirs, lib_name)):
ffi_lib = lib_name
break
--- a/Modules/posixmodule.c 2022-12-09 21:44:03
+++ b/Modules/posixmodule.c 2022-12-09 21:39:46
@@ -10564,10 +10564,15 @@
Py_BEGIN_ALLOW_THREADS
#ifdef HAVE_MKFIFOAT
if (dir_fd != DEFAULT_DIR_FD) {
+// BLENDER: disable also at compile time for compatibility when linking with older Xcode.
+// https://github.com/python/cpython/issues/97897
+#ifndef __APPLE__
if (HAVE_MKFIFOAT_RUNTIME) {
result = mkfifoat(dir_fd, path->narrow, mode);
+ } else
+#endif
+ {
- } else {
mkfifoat_unavailable = 1;
result = 0;
}
@@ -10638,10 +10633,15 @@
Py_BEGIN_ALLOW_THREADS
#ifdef HAVE_MKNODAT
if (dir_fd != DEFAULT_DIR_FD) {
+// BLENDER: disable also at compile time for compatibility when linking with older Xcode.
+// https://github.com/python/cpython/issues/97897
+#ifndef __APPLE__
if (HAVE_MKNODAT_RUNTIME) {
result = mknodat(dir_fd, path->narrow, mode, device);
+ } else
+#endif
+ {
- } else {
mknodat_unavailable = 1;
result = 0;
}

View File

@ -2,31 +2,6 @@ diff --git a/setup.py.orig b/setup.py
index a97a755..07ce853 100644
--- a/setup.py.orig
+++ b/setup.py
@@ -1603,13 +1603,13 @@
version = line.split()[2]
break
if version >= version_req:
- if (self.compiler.find_library_file(self.lib_dirs, 'z')):
+ if (self.compiler.find_library_file(self.lib_dirs, 'z_pic')):
if MACOS:
zlib_extra_link_args = ('-Wl,-search_paths_first',)
else:
zlib_extra_link_args = ()
self.add(Extension('zlib', ['zlibmodule.c'],
- libraries=['z'],
+ libraries=['z_pic'],
extra_link_args=zlib_extra_link_args))
have_zlib = True
else:
@@ -1623,7 +1623,7 @@
# crc32 if we have it. Otherwise binascii uses its own.
if have_zlib:
extra_compile_args = ['-DUSE_ZLIB_CRC32']
- libraries = ['z']
+ libraries = ['z_pic']
extra_link_args = zlib_extra_link_args
else:
extra_compile_args = []
@@ -2168,7 +2168,7 @@
ffi_inc = None
print('Header file {} does not exist'.format(ffi_h))
@ -36,39 +11,32 @@ index a97a755..07ce853 100644
if (self.compiler.find_library_file(self.lib_dirs, lib_name)):
ffi_lib = lib_name
break
--- a/Modules/posixmodule.c 2022-12-09 21:44:03
+++ b/Modules/posixmodule.c 2022-12-09 21:39:46
@@ -10564,10 +10564,15 @@
Py_BEGIN_ALLOW_THREADS
#ifdef HAVE_MKFIFOAT
if (dir_fd != DEFAULT_DIR_FD) {
+// BLENDER: disable also at compile time for compatibility when linking with older Xcode.
+// https://github.com/python/cpython/issues/97897
+#ifndef __APPLE__
if (HAVE_MKFIFOAT_RUNTIME) {
result = mkfifoat(dir_fd, path->narrow, mode);
--- a/configure 2023-12-10 05:22:18.130767840 +0100
+++ b/configure 2023-12-10 05:22:05.210521365 +0100
@@ -11258,7 +11258,7 @@
#define HAVE_LIBDL 1
_ACEOF
+ } else
+#endif
+ {
- } else {
mkfifoat_unavailable = 1;
result = 0;
}
@@ -10638,10 +10633,15 @@
Py_BEGIN_ALLOW_THREADS
#ifdef HAVE_MKNODAT
if (dir_fd != DEFAULT_DIR_FD) {
+// BLENDER: disable also at compile time for compatibility when linking with older Xcode.
+// https://github.com/python/cpython/issues/97897
+#ifndef __APPLE__
if (HAVE_MKNODAT_RUNTIME) {
result = mknodat(dir_fd, path->narrow, mode, device);
- LIBS="-ldl $LIBS"
+ LIBS="-ldl -lm $LIBS"
fi
# Dynamic linking for SunOS/Solaris and SYSV
@@ -23231,7 +23231,7 @@
save_LIBS=$LIBS
- LIBS="$LIBS $OPENSSL_LIBS"
+ LIBS="$OPENSSL_LIBS $LIBS"
CFLAGS="$CFLAGS $OPENSSL_INCLUDES"
LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS $OPENSSL_LDFLAGS_RPATH"
@@ -23292,7 +23292,7 @@
save_LIBS=$LIBS
- LIBS="$LIBS $LIBCRYPTO_LIBS"
+ LIBS="$LIBCRYPTO_LIBS $LIBS"
CFLAGS="$CFLAGS $OPENSSL_INCLUDES"
LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS $OPENSSL_LDFLAGS_RPATH"
+ } else
+#endif
+ {
- } else {
mknodat_unavailable = 1;
result = 0;
}

View File

@ -20,18 +20,6 @@
+REM %MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=ARM64
+REM if errorlevel 1 exit /b
diff -aurw Python-3.10.12/PCbuild/openssl.props external_python/PCbuild/openssl.props
--- Python-3.10.12/PCbuild/openssl.props 2023-06-06 16:30:33 -0600
+++ external_python/PCbuild/openssl.props 2023-06-20 09:58:57 -0600
@@ -10,7 +10,7 @@
</Link>
</ItemDefinitionGroup>
<PropertyGroup>
- <_DLLSuffix>-1_1</_DLLSuffix>
+ <_DLLSuffix>-3</_DLLSuffix>
<_DLLSuffix Condition="$(Platform) == 'ARM'">$(_DLLSuffix)-arm</_DLLSuffix>
<_DLLSuffix Condition="$(Platform) == 'ARM64'">$(_DLLSuffix)-arm64</_DLLSuffix>
</PropertyGroup>
diff -aurw Python-3.10.12/PCbuild/openssl.vcxproj external_python/PCbuild/openssl.vcxproj
--- Python-3.10.12/PCbuild/openssl.vcxproj 2023-06-06 16:30:33 -0600
+++ external_python/PCbuild/openssl.vcxproj 2023-06-20 08:50:43 -0600
@ -44,16 +32,3 @@ diff -aurw Python-3.10.12/PCbuild/openssl.vcxproj external_python/PCbuild/openss
<_Built Include="$(IntDir)\libcrypto.lib;$(IntDir)\libcrypto-*.dll;$(IntDir)\libcrypto-*.pdb" />
<_Built Include="$(IntDir)\libssl.lib;$(IntDir)\libssl-*.dll;$(IntDir)\libssl-*.pdb" />
<_AppLink Include="$(opensslDir)\ms\applink.c" />
diff -aurw Python-3.10.12/PCbuild/regen.targets external_python/PCbuild/regen.targets
--- Python-3.10.12/PCbuild/regen.targets 2023-06-06 16:30:33 -0600
+++ external_python/PCbuild/regen.targets 2023-06-20 09:37:17 -0600
@@ -89,7 +89,7 @@
<_LicenseSources Include="$(PySourcePath)LICENSE;
$(PySourcePath)PC\crtlicense.txt;
$(bz2Dir)LICENSE;
- $(opensslOutDir)LICENSE;
+ $(opensslOutDir)LICENSE.txt;
$(libffiDir)LICENSE;" />
<_LicenseSources Include="$(tcltkDir)tcllicense.terms;
$(tcltkDir)tklicense.terms;

View File

@ -99,18 +99,3 @@ diff -Naur orig/pxr/usdImaging/CMakeLists.txt external_usd/pxr/usdImaging/CMakeL
plugin
)
diff -Naur orig/cmake/macros/Private.cmake external_usd/cmake/macros/Private.cmake
--- orig/cmake/macros/Private.cmake 2022-02-18 14:49:09 -0700
+++ external_usd/cmake/macros/Private.cmake 2022-08-05 10:42:03 -0600
@@ -900,8 +900,10 @@
return()
endif()
- if (WIN32 AND PXR_USE_DEBUG_PYTHON)
+ if (WIN32 AND PXR_USE_DEBUG_PYTHON AND NOT CMAKE_DEBUG_POSTFIX)
# On Windows when compiling with debug python the library must be named with _d.
+ # Blender: but this can be skipped if CMAKE_DEBUG_POSTFIX is set, it knows
+ # what it is doing and we don't want libraries ending in _d_d.pyd
set(LIBRARY_NAME "_${NAME}_d")
else()
set(LIBRARY_NAME "_${NAME}")

View File

@ -1,37 +0,0 @@
diff --git a/pxr/usd/usdMtlx/reader.cpp b/pxr/usd/usdMtlx/reader.cpp
index 29e901816..e6fc68b20 100644
--- a/pxr/usd/usdMtlx/reader.cpp
+++ b/pxr/usd/usdMtlx/reader.cpp
@@ -797,6 +797,15 @@ _NodeGraphBuilder::_CreateInterfaceInputs(
// We deliberately ignore tokens here.
}
+mx::StringSet _GetStdlibIncludes() {
+ mx::StringSet stdlibIncludes = UsdMtlxGetDocument("")->getReferencedSourceUris();
+ mx::StringSet normStdlibIncludes;
+ for (std::string const& entry : stdlibIncludes) {
+ normStdlibIncludes.insert(TfNormPath(entry));
+ }
+ return normStdlibIncludes;
+}
+
// Returns True if the mtlxNodeDef corresponds to a locally defined custom node
// with an associated nodegraph.
// XXX Locally defined custom nodes without nodegraphs are not supported
@@ -818,13 +827,14 @@ _NodeGraphBuilder::_IsLocalCustomNode(const mx::ConstNodeDefPtr &mtlxNodeDef)
}
// Combine with the nodeDef relative path
nodeDefUri = TfNormPath(fullMtlxPath + nodeDefUri);
+ } else {
+ nodeDefUri = TfNormPath(nodeDefUri);
}
// This is a locally defined custom node if the absolute path to the
// nodedef is not included in the stdlibDoc.
static mx::StringSet customNodeDefNames;
- static const mx::StringSet stdlibIncludes =
- UsdMtlxGetDocument("")->getReferencedSourceUris();
+ static const mx::StringSet stdlibIncludes = _GetStdlibIncludes();
if (stdlibIncludes.find(nodeDefUri) == stdlibIncludes.end()) {
// Check if we already used this custom node
if (std::find(customNodeDefNames.begin(), customNodeDefNames.end(),

View File

@ -1,106 +0,0 @@
diff --git a/build_scripts/build_usd.py b/build_scripts/build_usd.py
index cfe243effb..a4bb94eee1 100644
--- a/build_scripts/build_usd.py
+++ b/build_scripts/build_usd.py
@@ -1415,7 +1415,7 @@ def InstallDraco(context, force, buildArgs):
############################################################
# MaterialX
-MATERIALX_URL = "https://github.com/materialx/MaterialX/archive/v1.38.4.zip"
+MATERIALX_URL = "https://github.com/materialx/MaterialX/archive/v1.38.5.zip"
def InstallMaterialX(context, force, buildArgs):
with CurrentWorkingDirectory(DownloadURL(MATERIALX_URL, context, force)):
diff --git a/pxr/imaging/hdSt/materialXShaderGen.cpp b/pxr/imaging/hdSt/materialXShaderGen.cpp
index df80ff119f..e4b5f04a73 100644
--- a/pxr/imaging/hdSt/materialXShaderGen.cpp
+++ b/pxr/imaging/hdSt/materialXShaderGen.cpp
@@ -136,8 +136,7 @@ HdStMaterialXShaderGen::HdStMaterialXShaderGen(
"st" : mxHdInfo.defaultTexcoordName;
// Register the customized version of the Surface node generator
- registerImplementation("IM_surface_" + GlslShaderGenerator::TARGET,
- HdStMaterialXSurfaceNodeGen::create);
+ registerImplementation("IM_surface_genglsl", HdStMaterialXSurfaceNodeGen::create);
}
// Based on GlslShaderGenerator::generate()
@@ -273,8 +272,7 @@ HdStMaterialXShaderGen::_EmitMxFunctions(
mx::ShaderStage& mxStage) const
{
// Add global constants and type definitions
- emitLibraryInclude("stdlib/" + mx::GlslShaderGenerator::TARGET
- + "/lib/mx_math.glsl", mxContext, mxStage);
+ emitLibraryInclude("stdlib/genglsl/lib/mx_math.glsl", mxContext, mxStage);
emitLine("#if NUM_LIGHTS > 0", mxStage, false);
emitLine("#define MAX_LIGHT_SOURCES NUM_LIGHTS", mxStage, false);
emitLine("#else", mxStage, false);
@@ -394,16 +392,24 @@ HdStMaterialXShaderGen::_EmitMxFunctions(
emitSpecularEnvironment(mxContext, mxStage);
}
if (shadowing) {
- emitLibraryInclude("pbrlib/" + mx::GlslShaderGenerator::TARGET
- + "/lib/mx_shadow.glsl", mxContext, mxStage);
+ emitLibraryInclude("pbrlib/genglsl/lib/mx_shadow.glsl", mxContext, mxStage);
}
+#if MATERIALX_MAJOR_VERSION > 1 || \
+ (MATERIALX_MAJOR_VERSION == 1 && MATERIALX_MINOR_VERSION > 38) || \
+ (MATERIALX_MAJOR_VERSION == 1 && MATERIALX_MINOR_VERSION == 38 && MATERIALX_BUILD_VERSION > 4)
+ // MaterialX 1.38.5 changes the default transmission method to "refraction".
+ mxContext.getOptions().hwTransmissionRenderMethod = mx::TRANSMISSION_OPACITY;
+
+ // Emit transmission code
+ emitTransmissionRender(mxContext, mxStage);
+#endif
+
// Emit directional albedo table code.
if (mxContext.getOptions().hwDirectionalAlbedoMethod ==
mx::HwDirectionalAlbedoMethod::DIRECTIONAL_ALBEDO_TABLE ||
mxContext.getOptions().hwWriteAlbedoTable) {
- emitLibraryInclude("pbrlib/" + mx::GlslShaderGenerator::TARGET
- + "/lib/mx_table.glsl", mxContext, mxStage);
+ emitLibraryInclude("pbrlib/genglsl/lib/mx_table.glsl", mxContext, mxStage);
emitLineBreak(mxStage);
}
@@ -421,7 +427,7 @@ HdStMaterialXShaderGen::_EmitMxFunctions(
// Emit uv transform code globally if needed.
if (mxContext.getOptions().hwAmbientOcclusion) {
emitLibraryInclude(
- "stdlib/" + mx::GlslShaderGenerator::TARGET + "/lib/" +
+ "stdlib/genglsl/lib/" +
_tokenSubstitutions[ShaderGenerator::T_FILE_TRANSFORM_UV],
mxContext, mxStage);
}
@@ -490,10 +496,30 @@ HdStMaterialXShaderGen::_EmitMxSurfaceShader(
// closure/shader nodes and need to be emitted first.
emitFunctionCalls(mxGraph, mxContext, mxStage, mx::ShaderNode::Classification::TEXTURE);
+#if MATERIALX_MAJOR_VERSION == 1 && \
+ MATERIALX_MINOR_VERSION == 38 && \
+ MATERIALX_BUILD_VERSION <= 4
// Emit function calls for all surface shader nodes.
// These will internally emit their closure function calls.
emitFunctionCalls(mxGraph, mxContext, mxStage, mx::ShaderNode::Classification::SHADER |
mx::ShaderNode::Classification::SURFACE);
+#else
+ // Emit function calls for "root" closure/shader nodes.
+ // These will internally emit function calls for any dependent closure nodes upstream.
+ for (mx::ShaderGraphOutputSocket* socket : mxGraph.getOutputSockets())
+ {
+ if (socket->getConnection())
+ {
+ const mx::ShaderNode* upstream = socket->getConnection()->getNode();
+ if (upstream->getParent() == &mxGraph &&
+ (upstream->hasClassification(mx::ShaderNode::Classification::CLOSURE) ||
+ upstream->hasClassification(mx::ShaderNode::Classification::SHADER)))
+ {
+ emitFunctionCall(*upstream, mxContext, mxStage);
+ }
+ }
+ }
+#endif
}
else
{

View File

@ -199,6 +199,9 @@ if(OPENEXR_FOUND)
${IMATH_INCLUDE_DIR}
${IMATH_INCLUDE_DIR}/Imath)
endif()
set(IMATH_INCLUDE_DIRS
${IMATH_INCLUDE_DIR})
endif()
mark_as_advanced(

View File

@ -36,7 +36,13 @@ else()
set(PYTHON_ROOT_DIR "")
endif()
set(_PYTHON_VERSION_SUPPORTED 3.10)
# Temporary, keep until Python 3.11 libraries are committed for macOS.
if(APPLE)
set(_PYTHON_VERSION_SUPPORTED 3.10)
else()
set(_PYTHON_VERSION_SUPPORTED 3.11)
endif()
set(PYTHON_VERSION ${_PYTHON_VERSION_SUPPORTED} CACHE STRING "Python Version (major and minor only)")
mark_as_advanced(PYTHON_VERSION)

View File

@ -329,6 +329,7 @@ endif()
if(WITH_CYCLES AND WITH_CYCLES_OSL)
find_package(OSL REQUIRED)
endif()
add_bundled_libraries(osl/lib)
if(WITH_CYCLES AND WITH_CYCLES_EMBREE)
find_package(Embree 3.8.0 REQUIRED)

View File

@ -105,7 +105,7 @@ if(UNIX AND (NOT APPLE) AND LIBDIR AND (EXISTS ${LIBDIR}))
unset(_libdir_stale)
endif()
# Detect update in 4.1 to shared library OpenImageDenoise.
# Detect update in 4.1 to shared library OpenImageDenoise and OSL.
if(UNIX AND
DEFINED OPENIMAGEDENOISE_LIBRARY AND
OPENIMAGEDENOISE_LIBRARY MATCHES "libOpenImageDenoise.a$" AND
@ -114,3 +114,25 @@ if(UNIX AND
message(STATUS "Auto updating CMake configuration for dynamic OpenImageDenoise")
unset_cache_variables("^OPENIMAGEDENOISE")
endif()
if(UNIX AND
DEFINED OSL_OSLCOMP_LIBRARY AND
OSL_OSLCOMP_LIBRARY MATCHES "liboslcomp.a$" AND
(EXISTS ${LIBDIR}/osl/lib/liboslcomp.so OR
EXISTS ${LIBDIR}/osl/lib/liboslcomp.dylib))
message(STATUS "Auto updating CMake configuration for dynamic OpenShadingLanguage")
unset_cache_variables("^OSL_")
endif()
# Detect Python 3.10 to 3.11 upgrade for Blender 4.1.
if(UNIX AND
(NOT APPLE) AND
LIBDIR AND
EXISTS ${LIBDIR} AND
EXISTS ${LIBDIR}/python/bin/python3.11 AND
DEFINED PYTHON_VERSION AND
PYTHON_VERSION VERSION_LESS "3.11")
message(STATUS "Auto updating CMake configuration for Python 3.11")
unset_cache_variables("^PYTHON_")
endif()

View File

@ -355,6 +355,7 @@ if(WITH_CYCLES AND WITH_CYCLES_OSL)
endif()
endif()
endif()
add_bundled_libraries(osl/lib)
if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI)
set(CYCLES_LEVEL_ZERO ${LIBDIR}/level-zero CACHE PATH "Path to Level Zero installation")

View File

@ -553,8 +553,16 @@ if(WITH_JACK)
set(JACK_LIBRARIES optimized ${LIBDIR}/jack/lib/libjack.lib debug ${LIBDIR}/jack/lib/libjack_d.lib)
endif()
set(_PYTHON_VERSION "3.10")
set(_PYTHON_VERSION "3.11")
string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${_PYTHON_VERSION})
if(NOT EXISTS ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS})
set(_PYTHON_VERSION "3.10")
string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${_PYTHON_VERSION})
if(NOT EXISTS ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS})
message(FATAL_ERROR "Missing python libraries! Neither 3.11 nor 3.10 are found in ${LIBDIR}/python")
endif()
endif()
# Python executable is needed as part of the build-process,
# note that building without Python is quite unusual.
set(PYTHON_EXECUTABLE ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/bin/python$<$<CONFIG:Debug>:_d>.exe)
@ -574,8 +582,6 @@ if(WITH_PYTHON)
set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
set(PYTHON_LIBRARIES debug "${PYTHON_LIBRARY_DEBUG}" optimized "${PYTHON_LIBRARY}" )
endif()
unset(_PYTHON_VERSION)
unset(_PYTHON_VERSION_NO_DOTS)
if(NOT WITH_WINDOWS_FIND_MODULES)
# even if boost is off, we still need to install the dlls when we use our lib folder since
@ -615,7 +621,7 @@ if(WITH_BOOST)
if(NOT Boost_FOUND)
warn_hardcoded_paths(BOOST)
# This is file new in 3.4 if it does not exist, assume we are building against 3.3 libs
set(BOOST_34_TRIGGER_FILE ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_python310-${BOOST_DEBUG_POSTFIX}.lib)
set(BOOST_34_TRIGGER_FILE ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_python${_PYTHON_VERSION_NO_DOTS}-${BOOST_DEBUG_POSTFIX}.lib)
if(NOT EXISTS ${BOOST_34_TRIGGER_FILE})
set(BOOST_DEBUG_POSTFIX "vc142-mt-gd-x64-${BOOST_VERSION}")
set(BOOST_PREFIX "lib")
@ -637,8 +643,8 @@ if(WITH_BOOST)
if(EXISTS ${BOOST_34_TRIGGER_FILE})
if(WITH_USD)
set(BOOST_PYTHON_LIBRARIES
debug ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_python310-${BOOST_DEBUG_POSTFIX}.lib
optimized ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_python310-${BOOST_POSTFIX}.lib
debug ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_python${_PYTHON_VERSION_NO_DOTS}-${BOOST_DEBUG_POSTFIX}.lib
optimized ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_python${_PYTHON_VERSION_NO_DOTS}-${BOOST_POSTFIX}.lib
)
endif()
endif()
@ -662,6 +668,8 @@ if(WITH_BOOST)
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
endif()
unset(_PYTHON_VERSION)
unset(_PYTHON_VERSION_NO_DOTS)
windows_find_package(OpenImageIO)
if(NOT OpenImageIO_FOUND)

View File

@ -30,6 +30,7 @@
#include "BKE_attribute.hh"
#include "BKE_attribute_math.hh"
#include "BKE_customdata.hh"
#include "BKE_mesh.hh"
CCL_NAMESPACE_BEGIN

View File

@ -54,10 +54,11 @@ void WorkTileScheduler::reset_scheduler_state()
tile_size_ = tile_calculate_best_size(
accelerated_rt_, image_size_px_, samples_num_, max_num_path_states_, scrambling_distance_);
VLOG_WORK << "Will schedule tiles of size " << tile_size_;
const int num_path_states_in_tile = tile_size_.width * tile_size_.height *
tile_size_.num_samples;
const int num_tiles = max_num_path_states_ / num_path_states_in_tile;
VLOG_WORK << "Will schedule " << num_tiles << " tiles of size " << tile_size_;
if (num_path_states_in_tile == 0) {
num_tiles_x_ = 0;
@ -65,13 +66,10 @@ void WorkTileScheduler::reset_scheduler_state()
num_tiles_per_sample_range_ = 0;
}
else {
if (VLOG_IS_ON(3)) {
/* The logging is based on multiple tiles scheduled, ignoring overhead of multi-tile
* scheduling and purely focusing on the number of used path states. */
const int num_tiles = max_num_path_states_ / num_path_states_in_tile;
VLOG_WORK << "Number of unused path states: "
<< max_num_path_states_ - num_tiles * num_path_states_in_tile;
}
/* The logging is based on multiple tiles scheduled, ignoring overhead of multi-tile
* scheduling and purely focusing on the number of used path states. */
VLOG_WORK << "Number of unused path states: "
<< max_num_path_states_ - num_tiles * num_path_states_in_tile;
num_tiles_x_ = divide_up(image_size_px_.x, tile_size_.width);
num_tiles_y_ = divide_up(image_size_px_.y, tile_size_.height);

View File

@ -603,7 +603,7 @@ GHOST_TSuccess GHOST_SystemWin32::init()
#ifdef INW32_COMPISITING
(HBRUSH)CreateSolidBrush
#endif
(HBRUSH) GetStockObject(DKGRAY_BRUSH);
(0x00000000);
wc.lpszMenuName = 0;
wc.lpszClassName = L"GHOST_WindowClass";

View File

@ -10,8 +10,8 @@ extern "C" {
#endif
typedef struct QuadriflowRemeshData {
float *verts;
int *faces;
const float *verts;
const int *faces;
int totfaces;
int totverts;

View File

@ -21,6 +21,10 @@ from typing import (
Tuple,
)
from rna_prop_ui import (
rna_idprop_value_to_python,
)
FCurveKey = Tuple[
# `fcurve.data_path`.
str,
@ -67,6 +71,9 @@ class BakeOptions:
do_bbone: bool
"""Bake b-bone channels"""
do_custom_props: bool
"""Bake custom properties."""
def bake_action(
obj,
@ -195,9 +202,29 @@ def bake_action_iter(
"bbone_easeout": 1,
}
# Convert rna_prop types (IDPropertyArray, etc) to python types.
def clean_custom_properties(obj):
clean_props = {
key: rna_idprop_value_to_python(value)
for key, value in obj.items()
}
return clean_props
def bake_custom_properties(obj, *, custom_props, frame, group_name=""):
if frame is None or not custom_props:
return
for key, value in custom_props.items():
obj[key] = value
try:
obj.keyframe_insert(f'["{bpy.utils.escape_identifier(key)}"]', frame=frame, group=group_name)
except TypeError:
# Non animatable properties (datablocks, etc) cannot be keyed.
continue
def pose_frame_info(obj):
matrix = {}
bbones = {}
custom_props = {}
for name, pbone in obj.pose.bones.items():
if bake_options.do_visual_keying:
# Get the final transform of the bone in its own local space...
@ -209,32 +236,41 @@ def bake_action_iter(
# Bendy Bones
if pbone.bone.bbone_segments > 1:
bbones[name] = {bb_prop: getattr(pbone, bb_prop) for bb_prop in BBONE_PROPS}
return matrix, bbones
# Custom Properties
custom_props[name] = clean_custom_properties(pbone)
return matrix, bbones, custom_props
def armature_frame_info(obj):
if obj.type != 'ARMATURE':
return {}
return clean_custom_properties(obj)
if bake_options.do_parents_clear:
if bake_options.do_visual_keying:
def obj_frame_info(obj):
return obj.matrix_world.copy()
return obj.matrix_world.copy(), clean_custom_properties(obj)
else:
def obj_frame_info(obj):
parent = obj.parent
matrix = obj.matrix_basis
if parent:
return parent.matrix_world @ matrix
return parent.matrix_world @ matrix, clean_custom_properties(obj)
else:
return matrix.copy()
return matrix.copy(), clean_custom_properties(obj)
else:
if bake_options.do_visual_keying:
def obj_frame_info(obj):
parent = obj.parent
matrix = obj.matrix_world
if parent:
return parent.matrix_world.inverted_safe() @ matrix
return parent.matrix_world.inverted_safe() @ matrix, clean_custom_properties(obj)
else:
return matrix.copy()
return matrix.copy(), clean_custom_properties(obj)
else:
def obj_frame_info(obj):
return obj.matrix_basis.copy()
return obj.matrix_basis.copy(), clean_custom_properties(obj)
# -------------------------------------------------------------------------
# Setup the Context
@ -246,6 +282,7 @@ def bake_action_iter(
raise Exception("Pose and object baking is disabled, no action needed")
pose_info = []
armature_info = []
obj_info = []
# -------------------------------------------------------------------------
@ -258,11 +295,11 @@ def bake_action_iter(
# Signal we're done!
if frame is None:
break
if bake_options.do_pose:
pose_info.append((frame, *pose_frame_info(obj)))
armature_info.append((frame, armature_frame_info(obj)))
if bake_options.do_object:
obj_info.append((frame, obj_frame_info(obj)))
obj_info.append((frame, *obj_frame_info(obj)))
# -------------------------------------------------------------------------
# Clean (store initial data)
@ -298,6 +335,9 @@ def bake_action_iter(
# pose
lookup_fcurves = {(fcurve.data_path, fcurve.array_index): fcurve for fcurve in action.fcurves}
if bake_options.do_pose:
for f, armature_custom_properties in armature_info:
bake_custom_properties(obj, custom_props=armature_custom_properties, frame=f)
for name, pbone in obj.pose.bones.items():
if bake_options.only_selected and not pbone.bone.select:
continue
@ -335,7 +375,7 @@ def bake_action_iter(
rotation_mode = pbone.rotation_mode
total_new_keys = len(pose_info)
for (f, matrix, bbones) in pose_info:
for (f, matrix, bbones, custom_props) in pose_info:
pbone.matrix_basis = matrix[name].copy()
if bake_options.do_location:
@ -378,6 +418,9 @@ def bake_action_iter(
keyframes.extend_co_value(
paths_bbprops[prop_index], f, bbone_shape[prop_name]
)
# Custom Properties
if bake_options.do_custom_props:
bake_custom_properties(pbone, custom_props=custom_props[name], frame=f, group_name=name)
if is_new_action:
keyframes.insert_keyframes_into_new_action(total_new_keys, action, name)
@ -412,7 +455,7 @@ def bake_action_iter(
rotation_mode = obj.rotation_mode
total_new_keys = len(obj_info)
for (f, matrix) in obj_info:
for (f, matrix, custom_props) in obj_info:
name = "Action Bake" # XXX: placeholder
obj.matrix_basis = matrix
@ -442,6 +485,9 @@ def bake_action_iter(
if bake_options.do_scale:
keyframes.extend_co_values(path_scale, 3, f, obj.scale)
if bake_options.do_custom_props:
bake_custom_properties(obj, custom_props=custom_props, frame=f, group_name=name)
if is_new_action:
keyframes.insert_keyframes_into_new_action(total_new_keys, action, name)
else:

View File

@ -0,0 +1,14 @@
import bpy
eevee = bpy.context.scene.eevee
options = eevee.ray_tracing_options
eevee.ray_tracing_method = 'SCREEN'
options.resolution_scale = '2'
options.sample_clamp = 10.0
options.screen_trace_max_roughness = 0.5
options.screen_trace_quality = 0.25
options.screen_trace_thickness = 0.20000000298023224
options.use_denoise = True
options.denoise_spatial = True
options.denoise_temporal = True
options.denoise_bilateral = True

View File

@ -4839,7 +4839,7 @@ def km_pose(params):
op_menu("VIEW3D_MT_bone_options_enable", {"type": 'W', "value": 'PRESS', "shift": True, "ctrl": True}),
op_menu("VIEW3D_MT_bone_options_disable", {"type": 'W', "value": 'PRESS', "alt": True}),
("armature.collection_show_all", {"type": 'ACCENT_GRAVE', "value": 'PRESS', "ctrl": True}, None),
op_menu("VIEW3D_MT_bone_collections", {"type": 'M', "value": 'PRESS', "shift": True}),
("armature.assign_to_collection", {"type": 'M', "value": 'PRESS', "shift": True}, None),
("armature.move_to_collection", {"type": 'M', "value": 'PRESS'}, None),
("transform.bbone_resize", {"type": 'S', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None),
("anim.keyframe_insert", {"type": 'I', "value": 'PRESS'}, None),
@ -5779,7 +5779,7 @@ def km_edit_armature(params):
op_menu("VIEW3D_MT_bone_options_disable", {"type": 'W', "value": 'PRESS', "alt": True}),
# Armature/bone layers.
("armature.collection_show_all", {"type": 'ACCENT_GRAVE', "value": 'PRESS', "ctrl": True}, None),
op_menu("VIEW3D_MT_bone_collections", {"type": 'M', "value": 'PRESS', "shift": True}),
("armature.assign_to_collection", {"type": 'M', "value": 'PRESS', "shift": True}, None),
("armature.move_to_collection", {"type": 'M', "value": 'PRESS'}, None),
# Special transforms.
op_tool_optional(

View File

@ -259,8 +259,9 @@ class NLA_OT_bake(Operator):
('ROTATION', "Rotation", "Bake rotation channels"),
('SCALE', "Scale", "Bake scale channels"),
('BBONE', "B-Bone", "Bake B-Bone channels"),
('PROPS', "Custom Properties", "Bake custom properties")
),
default={'LOCATION', 'ROTATION', 'SCALE', 'BBONE'},
default={'LOCATION', 'ROTATION', 'SCALE', 'BBONE', 'PROPS'},
)
def execute(self, context):
@ -278,6 +279,7 @@ class NLA_OT_bake(Operator):
do_rotation='ROTATION' in self.channel_types,
do_scale='SCALE' in self.channel_types,
do_bbone='BBONE' in self.channel_types,
do_custom_props='PROPS' in self.channel_types
)
if bake_options.do_pose and self.only_selected:

View File

@ -515,6 +515,33 @@ class AddPresetTrackingSettings(AddPresetBase, Operator):
preset_subdir = "tracking_settings"
class AddPresetEEVEERaytracing(AddPresetBase, Operator):
"""Add or remove an EEVEE raytracing preset"""
bl_idname = "render.eevee_raytracing_preset_add"
bl_label = "Add Raytracing Preset"
preset_menu = "RENDER_PT_eevee_next_raytracing_presets"
preset_defines = [
"eevee = bpy.context.scene.eevee",
"options = eevee.ray_tracing_options"
]
preset_values = [
"eevee.ray_tracing_method",
"options.resolution_scale",
"options.sample_clamp",
"options.screen_trace_max_roughness",
"options.screen_trace_quality",
"options.screen_trace_thickness",
"options.use_denoise",
"options.denoise_spatial",
"options.denoise_temporal",
"options.denoise_bilateral",
]
preset_subdir = "eevee/raytracing"
class AddPresetNodeColor(AddPresetBase, Operator):
"""Add or remove a Node Color Preset"""
bl_idname = "node.node_color_preset_add"
@ -718,6 +745,7 @@ classes = (
AddPresetTrackingTrackColor,
AddPresetGpencilBrush,
AddPresetGpencilMaterial,
AddPresetEEVEERaytracing,
ExecutePreset,
WM_MT_operator_presets,
)

View File

@ -113,20 +113,7 @@ class DATA_PT_bone_collections(ArmatureButtonsPanel, Panel):
active_bcoll = arm.collections.active
row = layout.row()
rows = 1
if active_bcoll:
rows = 4
row.template_list(
"DATA_UL_bone_collections",
"collections",
arm,
"collections",
arm.collections,
"active_index",
rows=rows,
)
row.template_bone_collection_tree()
col = row.column(align=True)
col.operator("armature.collection_add", icon='ADD', text="")
@ -164,6 +151,35 @@ class ARMATURE_MT_collection_context_menu(Menu):
layout.operator("armature.collection_show_all")
class ARMATURE_MT_collection_tree_context_menu(Menu):
bl_label = "Bone Collections"
def draw(self, context):
layout = self.layout
arm = context.armature
props = layout.operator(
"armature.collection_add", text="Add Child Collection"
)
props.parent_index = arm.collections.active_index
layout.operator("armature.collection_remove")
layout.separator()
layout.operator("armature.collection_solo_visibility")
layout.operator("armature.collection_show_all")
layout.separator()
layout.operator("armature.collection_assign", text="Assign Selected Bones")
layout.operator("armature.collection_unassign", text="Remove Selected Bones")
layout.separator()
layout.operator("armature.collection_select", text="Select Bones")
layout.operator("armature.collection_deselect", text="Deselect Bones")
class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, Panel):
bl_label = "Inverse Kinematics"
bl_options = {'DEFAULT_CLOSED'}
@ -291,6 +307,7 @@ classes = (
DATA_PT_bone_collections,
DATA_UL_bone_collections,
ARMATURE_MT_collection_context_menu,
ARMATURE_MT_collection_tree_context_menu,
DATA_PT_motion_paths,
DATA_PT_motion_paths_display,
DATA_PT_display,

View File

@ -3,13 +3,13 @@
# SPDX-License-Identifier: GPL-2.0-or-later
from bpy.types import Panel
from bl_ui.properties_grease_pencil_common import GreasePencilSimplifyPanel
from bl_ui.space_view3d import (
VIEW3D_PT_shading_lighting,
VIEW3D_PT_shading_color,
VIEW3D_PT_shading_options,
)
from bl_ui.properties_grease_pencil_common import GreasePencilSimplifyPanel
from bl_ui.utils import PresetPanel
class RenderButtonsPanel:
@ -555,6 +555,13 @@ class RENDER_PT_eevee_screen_space_reflections(RenderButtonsPanel, Panel):
col.prop(props, "ssr_firefly_fac")
class RENDER_PT_eevee_next_raytracing_presets(PresetPanel, Panel):
bl_label = "Raytracing Presets"
preset_subdir = "eevee/raytracing"
preset_operator = "script.execute_preset"
preset_add_operator = "render.eevee_raytracing_preset_add"
class RENDER_PT_eevee_next_raytracing(RenderButtonsPanel, Panel):
bl_label = "Raytracing"
bl_options = {'DEFAULT_CLOSED'}
@ -564,6 +571,13 @@ class RENDER_PT_eevee_next_raytracing(RenderButtonsPanel, Panel):
def poll(cls, context):
return (context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
props = context.scene.eevee
self.layout.prop(props, "use_raytracing", text="")
def draw_header_preset(self, _context):
RENDER_PT_eevee_next_raytracing_presets.draw_panel_header(self.layout)
def draw(self, context):
layout = self.layout
layout.use_property_split = True
@ -1243,6 +1257,7 @@ classes = (
RENDER_PT_eevee_subsurface_scattering,
RENDER_PT_eevee_screen_space_reflections,
RENDER_PT_eevee_next_horizon_scan,
RENDER_PT_eevee_next_raytracing_presets,
RENDER_PT_eevee_next_raytracing,
RENDER_PT_eevee_next_screen_trace,
RENDER_PT_eevee_next_denoise,

View File

@ -337,6 +337,7 @@ class GRAPH_MT_key_blending(Menu):
layout.operator("graph.push_pull", text="Push Pull")
layout.operator("graph.shear", text="Shear Keys")
layout.operator("graph.scale_average", text="Scale Average")
layout.operator("graph.scale_from_neighbor", text="Scale from Neighbor")
layout.operator("graph.time_offset", text="Time Offset")

View File

@ -458,7 +458,7 @@ class TOPBAR_MT_file_import(Menu):
if bpy.app.build_options.io_ply:
self.layout.operator("wm.ply_import", text="Stanford PLY (.ply)")
if bpy.app.build_options.io_stl:
self.layout.operator("wm.stl_import", text="STL (.stl) (experimental)")
self.layout.operator("wm.stl_import", text="STL (.stl)")
class TOPBAR_MT_file_export(Menu):
@ -488,7 +488,7 @@ class TOPBAR_MT_file_export(Menu):
if bpy.app.build_options.io_ply:
self.layout.operator("wm.ply_export", text="Stanford PLY (.ply)")
if bpy.app.build_options.io_stl:
self.layout.operator("wm.stl_export", text="STL (.stl) (experimental)")
self.layout.operator("wm.stl_export", text="STL (.stl)")
class TOPBAR_MT_file_external_data(Menu):

View File

@ -2547,7 +2547,6 @@ class USERPREF_PT_experimental_new_features(ExperimentalPanel, Panel):
({"property": "use_sculpt_tools_tilt"}, ("blender/blender/issues/82877", "#82877")),
({"property": "use_extended_asset_browser"},
("blender/blender/projects/10", "Pipeline, Assets & IO Project Page")),
({"property": "use_override_templates"}, ("blender/blender/issues/73318", "Milestone 4")),
({"property": "use_new_volume_nodes"}, ("blender/blender/issues/103248", "#103248")),
({"property": "use_shader_node_previews"}, ("blender/blender/issues/110353", "#110353")),
),

View File

@ -3984,7 +3984,6 @@ class VIEW3D_MT_pose(Menu):
layout.separator()
layout.menu("VIEW3D_MT_pose_motion")
layout.operator("armature.move_to_collection", text="Move to Bone Collection")
layout.menu("VIEW3D_MT_bone_collections")
layout.separator()
@ -4078,46 +4077,12 @@ class VIEW3D_MT_bone_collections(Menu):
def draw(self, context):
layout = self.layout
if not context.selected_pose_bones and not context.selected_bones:
# If there are no bones to assign to any collection, there's no need
# to go over all the bone collections & try to build up the menu.
#
# The poll function shouldn't test for this, because returning False
# there will hide this menu completely from the Pose menu, and
# that's going too far.
layout.enabled = False
layout.label(text="- select bones to operate on first -")
return
layout.operator("armature.move_to_collection")
layout.operator("armature.assign_to_collection")
layout.separator()
layout.operator("armature.collection_show_all")
layout.separator()
arm = context.object.data
bone = context.active_bone
found_editable_bcoll = False
for bcoll in arm.collections:
if not bcoll.is_editable:
continue
found_editable_bcoll = True
if bcoll.name in bone.collections:
props = layout.operator("armature.collection_unassign",
text=bcoll.name,
icon='REMOVE')
else:
props = layout.operator("armature.collection_assign",
text=bcoll.name,
icon='ADD')
props.name = bcoll.name
if arm.collections and not found_editable_bcoll:
row = layout.row()
row.enabled = False
row.label(text="All bone collections are read-only")
layout.separator()
props = layout.operator("armature.collection_create_and_assign",
text="Assign to New Collection")
props.name = "New Collection"

View File

@ -68,9 +68,14 @@ void ANIM_armature_runtime_free(struct bArmature *armature);
/**
* Add a new bone collection to the given armature.
*
* \param parent_index Index into the Armature's `collections_array`. -1 adds it
* as a root (i.e. parentless) collection.
*
* The Armature owns the returned pointer.
*/
BoneCollection *ANIM_armature_bonecoll_new(bArmature *armature, const char *name);
BoneCollection *ANIM_armature_bonecoll_new(bArmature *armature,
const char *name,
int parent_index = -1);
/**
* Add a bone collection to the Armature.
@ -81,10 +86,10 @@ BoneCollection *ANIM_armature_bonecoll_new(bArmature *armature, const char *name
* NOTE: this should not typically be used. It is only used by the library overrides system to
* apply override operations.
*/
struct BoneCollection *ANIM_armature_bonecoll_insert_copy_after(
struct bArmature *armature,
struct BoneCollection *anchor,
const struct BoneCollection *bcoll_to_copy);
BoneCollection *ANIM_armature_bonecoll_insert_copy_after(bArmature *armature_dst,
const bArmature *armature_src,
const BoneCollection *anchor_in_dst,
const BoneCollection *bcoll_to_copy);
/**
* Remove the bone collection at `index` from the armature.
@ -122,6 +127,17 @@ void ANIM_armature_bonecoll_active_index_set(struct bArmature *armature,
*/
void ANIM_armature_bonecoll_active_name_set(struct bArmature *armature, const char *name);
/**
* Refresh the Armature runtime info about the active bone collection.
*
* The ground truth for the active bone collection is the collection's name,
* whereas the runtime info also contains the active collection's index and
* pointer. This function updates the runtime info to point to the named
* collection. If that named collection cannot be found, the name will be
* cleared.
*/
void ANIM_armature_bonecoll_active_runtime_refresh(struct bArmature *armature);
/**
* Determine whether the given bone collection is editable.
*
@ -132,18 +148,53 @@ bool ANIM_armature_bonecoll_is_editable(const struct bArmature *armature,
const struct BoneCollection *bcoll);
/**
* Moves the bone collection at from_index to to_index.
* Move the bone collection at from_index to its sibling at to_index.
*
* The element at `to_index` is shifted to make space; it is not overwritten.
* This shift happens towards `from_index`.
*
* This operation does not change the total number of elements in the array.
*
* \return true if the collection was successfully moved, false otherwise.
* The latter happens if either index is out of bounds, or if the indices
* are equal.
*
* \note This function is limited to moving between siblings of the bone
* collection at `from_index`.
*
* \note This function ensures that the element at index `from_index` (before
* the call) will end up at `to_index` (after the call). The element at
* `to_index` before the call will shift towards `from_index`; in other words,
* depending on the direction of movement, the moved element will end up either
* before or after that one.
*
* TODO: add ASCII-art illustration of left & right movement.
*
* \see blender::animrig::armature_bonecoll_move_to_parent() to move bone
* collections between different parents.
*/
bool ANIM_armature_bonecoll_move_to_index(bArmature *armature, int from_index, int to_index);
enum class MoveLocation {
Before, /* Move to before the item at the given index. */
After, /* Move to after the item at the given index. */
};
int ANIM_armature_bonecoll_move_before_after_index(bArmature *armature,
int from_index,
int to_index,
MoveLocation before_after);
/**
* Move the bone collection by \a step places up/down.
*
* \return whether the move actually happened.
*
* \note This function is limited to moving between siblings of the bone
* collection at `from_index`.
*
* \see blender::animrig::armature_bonecoll_move_to_parent() to move bone
* collections between different parents.
*/
bool ANIM_armature_bonecoll_move(struct bArmature *armature,
struct BoneCollection *bcoll,
@ -152,6 +203,13 @@ bool ANIM_armature_bonecoll_move(struct bArmature *armature,
struct BoneCollection *ANIM_armature_bonecoll_get_by_name(
struct bArmature *armature, const char *name) ATTR_WARN_UNUSED_RESULT;
/** Scan the bone collections to find the one with the given name.
*
* \return the index of the bone collection, or -1 if not found.
*/
int ANIM_armature_bonecoll_get_index_by_name(struct bArmature *armature,
const char *name) ATTR_WARN_UNUSED_RESULT;
void ANIM_armature_bonecoll_name_set(struct bArmature *armature,
struct BoneCollection *bcoll,
const char *name);
@ -182,6 +240,12 @@ void ANIM_armature_bonecoll_unassign_all_editbone(struct EditBone *ebone);
void ANIM_armature_bonecoll_assign_active(const struct bArmature *armature,
struct EditBone *ebone);
/**
* Return whether the Armature's active bone is assigned to the given bone collection.
*/
bool ANIM_armature_bonecoll_contains_active_bone(const struct bArmature *armature,
const struct BoneCollection *bcoll);
/**
* Reconstruct the bone collection memberships, based on the bone runtime data.
*
@ -241,6 +305,48 @@ void ANIM_armature_bonecoll_show_from_pchan(struct bArmature *armature,
namespace blender::animrig {
/**
* Return the index of the given collection in the armature's collection array,
* or -1 if not found.
*/
int armature_bonecoll_find_index(const bArmature *armature, const ::BoneCollection *bcoll);
/**
* Return the index of the given bone collection's parent, or -1 if it has no parent.
*/
int armature_bonecoll_find_parent_index(const bArmature *armature, int bcoll_index);
bool armature_bonecoll_is_root(const bArmature *armature, int bcoll_index);
bool armature_bonecoll_is_child_of(const bArmature *armature,
int potential_parent_index,
int potential_child_index);
bool armature_bonecoll_is_decendent_of(const bArmature *armature,
int potential_parent_index,
int potential_decendent_index);
bool bonecoll_has_children(const BoneCollection *bcoll);
/**
* Move a bone collection from one parent to another.
*
* \param from_bcoll_index index of the bone collection to move.
* \param to_child_num gap index of where to insert the collection; 0 to make it
* the first child, and parent->child_count to make it the last child. -1 also
* works as an indicator for the last child, as that makes it possible to call
* this function without requiring the caller to find the BoneCollection* of the
* parent.
* \param from_parent_index index of its current parent (-1 if it is a root collection).
* \param to_parent_index index of the new parent (-1 if it is to become a root collection).
* \return the collection's new index in the collections_array.
*/
int armature_bonecoll_move_to_parent(bArmature *armature,
int from_bcoll_index,
int to_child_num,
int from_parent_index,
int to_parent_index);
/* --------------------------------------------------------------------
* The following functions are only used by edit-mode Armature undo:
*/

View File

@ -142,7 +142,12 @@ bool is_autokey_flag(const Scene *scene, eKeyInsert_Flag flag);
*/
bool autokeyframe_cfra_can_key(const Scene *scene, ID *id);
void autokeyframe_object(bContext *C, Scene *scene, Object *ob);
/**
* Insert keyframes on the given object `ob` based on the auto-keying settings.
*
* \param rna_paths: Only inserts keys on those RNA paths.
*/
void autokeyframe_object(bContext *C, Scene *scene, Object *ob, Span<std::string> rna_paths);
/**
* Auto-keyframing feature - for objects
*
@ -154,12 +159,18 @@ bool autokeyframe_pchan(bContext *C, Scene *scene, Object *ob, bPoseChannel *pch
/**
* Auto-keyframing feature - for poses/pose-channels
*
* targetless_ik: has targetless ik been done on any channels?
* \param targetless_ik: Has targetless ik been done on any channels?
* \param rna_paths: Only inserts keys on those RNA paths.
*
* \note Context may not always be available,
* so must check before using it as it's a luxury for a few cases.
*/
void autokeyframe_pose(bContext *C, Scene *scene, Object *ob, short targetless_ik);
void autokeyframe_pose_channel(bContext *C,
Scene *scene,
Object *ob,
bPoseChannel *pose_channel,
Span<std::string> rna_paths,
short targetless_ik);
/**
* Use for auto-key-framing.
* \param only_if_property_keyed: if true, auto-key-framing only creates keyframes on already keyed

View File

@ -8,7 +8,9 @@
* \brief Helper functions for animation to interact with the RNA system.
*/
#include "BLI_string_ref.hh"
#include "BLI_vector.hh"
#include "DNA_action_types.h"
#include "RNA_types.hh"
namespace blender::animrig {
@ -16,4 +18,7 @@ namespace blender::animrig {
/** Get the values of the given property. Casts non-float properties to float. */
Vector<float> get_rna_values(PointerRNA *ptr, PropertyRNA *prop);
/** Get the rna path for the given rotation mode. */
StringRef get_rotation_mode_path(eRotationModes rotation_mode);
} // namespace blender::animrig

View File

@ -38,6 +38,7 @@ set(SRC
ANIM_keyframing.hh
ANIM_rna.hh
ANIM_visualkey.hh
intern/bone_collections_internal.hh
)
set(LIB

View File

@ -8,6 +8,7 @@
#include "ANIM_rna.hh"
#include "BLI_vector.hh"
#include "DNA_action_types.h"
#include "RNA_access.hh"
namespace blender::animrig {
@ -68,4 +69,16 @@ Vector<float> get_rna_values(PointerRNA *ptr, PropertyRNA *prop)
return values;
}
StringRef get_rotation_mode_path(const eRotationModes rotation_mode)
{
switch (rotation_mode) {
case ROT_MODE_QUAT:
return "rotation_quaternion";
case ROT_MODE_AXISANGLE:
return "rotation_axis_angle";
default:
return "rotation_euler";
}
}
} // namespace blender::animrig

View File

@ -26,10 +26,13 @@
#include "BKE_animsys.h"
#include "BKE_idprop.h"
#include "BKE_lib_id.h"
#include "BKE_lib_override.hh"
#include "ANIM_armature_iter.hh"
#include "ANIM_bone_collections.hh"
#include "intern/bone_collections_internal.hh"
#include <cstring>
#include <string>
@ -43,6 +46,7 @@ namespace {
constexpr eBoneCollection_Flag default_flags = BONE_COLLECTION_VISIBLE |
BONE_COLLECTION_SELECTABLE;
constexpr auto bonecoll_default_name = "Bones";
} // namespace
BoneCollection *ANIM_bonecoll_new(const char *name)
@ -92,10 +96,7 @@ static void add_reverse_pointers(BoneCollection *bcoll)
void ANIM_armature_runtime_refresh(bArmature *armature)
{
ANIM_armature_runtime_free(armature);
BoneCollection *active = ANIM_armature_bonecoll_get_by_name(armature,
armature->active_collection_name);
ANIM_armature_bonecoll_active_set(armature, active);
ANIM_armature_bonecoll_active_runtime_refresh(armature);
/* Construct the bone-to-collections mapping. */
for (BoneCollection *bcoll : armature->collections_span()) {
@ -110,6 +111,11 @@ void ANIM_armature_runtime_free(bArmature *armature)
[&](Bone *bone) { BLI_freelistN(&bone->runtime.collections); });
}
/**
* Ensure the bone collection's name is unique within the armature.
*
* This assumes that the bone collection has already been inserted into the array.
*/
static void bonecoll_ensure_name_unique(bArmature *armature, BoneCollection *bcoll)
{
struct DupNameCheckData {
@ -152,48 +158,55 @@ static void bonecoll_insert_at_index(bArmature *armature, BoneCollection *bcoll,
sizeof(BoneCollection *) * (armature->collection_array_num + 1),
__func__);
/* Shift over the collections to make room at the given index. */
if (index < armature->collection_array_num) {
BoneCollection **start = armature->collection_array + index;
const size_t count = armature->collection_array_num - index;
memmove((void *)(start + 1), (void *)start, count * sizeof(BoneCollection *));
}
armature->collection_array[index] = bcoll;
/* To keep the memory consistent, insert the new element at the end of the
* now-grown array, then rotate it into place. */
armature->collection_array[armature->collection_array_num] = bcoll;
armature->collection_array_num++;
const int rotate_count = armature->collection_array_num - index - 1;
internal::bonecolls_rotate_block(armature, index, rotate_count, +1);
if (armature->runtime.active_collection_index >= index) {
ANIM_armature_bonecoll_active_index_set(armature,
armature->runtime.active_collection_index + 1);
}
}
/**
* Appends bcoll to the end of armature's array of bone collections.
*/
static void bonecoll_append(bArmature *armature, BoneCollection *bcoll)
static void bonecoll_insert_as_root(bArmature *armature, BoneCollection *bcoll, int at_index)
{
bonecoll_insert_at_index(armature, bcoll, armature->collection_array_num);
}
/**
* Returns the index of the given collection in the armature's collection array,
* or -1 if not found.
*/
static int bonecoll_find_index(const bArmature *armature, const BoneCollection *bcoll)
{
int index = 0;
for (const BoneCollection *arm_bcoll : armature->collections_span()) {
if (arm_bcoll == bcoll) {
return index;
}
index++;
BLI_assert(at_index >= -1);
BLI_assert(at_index <= armature->collection_root_count);
if (at_index < 0) {
at_index = armature->collection_root_count;
}
return -1;
bonecoll_insert_at_index(armature, bcoll, at_index);
armature->collection_root_count++;
}
BoneCollection *ANIM_armature_bonecoll_new(bArmature *armature, const char *name)
static int bonecoll_insert_as_child(bArmature *armature,
BoneCollection *bcoll,
const int parent_index)
{
BLI_assert_msg(parent_index >= 0, "Armature bone collection index should be 0 or larger");
BLI_assert_msg(parent_index < armature->collection_array_num,
"Parent bone collection index should not point beyond the end of the array");
BoneCollection *parent = armature->collection_array[parent_index];
if (parent->child_index == 0) {
/* This parent doesn't have any children yet, so place them at the end of the array. */
parent->child_index = armature->collection_array_num;
}
const int insert_at_index = parent->child_index + parent->child_count;
bonecoll_insert_at_index(armature, bcoll, insert_at_index);
parent->child_count++;
return insert_at_index;
}
BoneCollection *ANIM_armature_bonecoll_new(bArmature *armature,
const char *name,
const int parent_index)
{
BoneCollection *bcoll = ANIM_bonecoll_new(name);
@ -203,38 +216,165 @@ BoneCollection *ANIM_armature_bonecoll_new(bArmature *armature, const char *name
}
bonecoll_ensure_name_unique(armature, bcoll);
bonecoll_append(armature, bcoll);
if (parent_index < 0) {
bonecoll_insert_as_root(armature, bcoll, -1);
}
else {
bonecoll_insert_as_child(armature, bcoll, parent_index);
}
return bcoll;
}
BoneCollection *ANIM_armature_bonecoll_insert_copy_after(bArmature *armature,
BoneCollection *anchor,
const BoneCollection *bcoll_to_copy)
/**
* Copy a BoneCollection to a new armature, updating its internal pointers to
* point to the new armature.
*
* This *only* updates the cloned BoneCollection, and does *not* actually add it
* to the armature.
*
* Child collections are not taken into account; the returned bone collection is
* without children, regardless of `bcoll_to_copy`.
*/
static BoneCollection *copy_and_update_ownership(const bArmature *armature_dst,
const BoneCollection *bcoll_to_copy)
{
BoneCollection *bcoll = static_cast<BoneCollection *>(MEM_dupallocN(bcoll_to_copy));
/* Remap the bone pointers to the given armature, as `bcoll_to_copy` will
* likely be owned by another copy of the armature. */
BLI_duplicatelist(&bcoll->bones, &bcoll->bones);
BLI_assert_msg(armature->bonehash, "Expected armature bone hash to be there");
LISTBASE_FOREACH (BoneCollectionMember *, member, &bcoll->bones) {
member->bone = BKE_armature_find_bone_name(armature, member->bone->name);
}
/* Reset the child_index and child_count properties. These are unreliable when
* coming from an override, as the original array might have been completely
* reshuffled. Children will have to be copied separately. */
bcoll->child_index = 0;
bcoll->child_count = 0;
if (bcoll_to_copy->prop) {
if (bcoll->prop) {
bcoll->prop = IDP_CopyProperty_ex(bcoll_to_copy->prop,
0 /*do_id_user ? 0 : LIB_ID_CREATE_NO_USER_REFCOUNT*/);
}
const int anchor_index = bonecoll_find_index(armature, anchor);
bonecoll_insert_at_index(armature, bcoll, anchor_index + 1);
bonecoll_ensure_name_unique(armature, bcoll);
/* Remap the bone pointers to the given armature, as `bcoll_to_copy` is
* assumed to be owned by another armature. */
BLI_duplicatelist(&bcoll->bones, &bcoll->bones);
BLI_assert_msg(armature_dst->bonehash, "Expected armature bone hash to be there");
LISTBASE_FOREACH (BoneCollectionMember *, member, &bcoll->bones) {
member->bone = BKE_armature_find_bone_name(const_cast<bArmature *>(armature_dst),
member->bone->name);
}
/* Now that the collection points to the right bones, these bones can be
* updated to point to this collection. */
add_reverse_pointers(bcoll);
return bcoll;
}
/**
* Copy all the child collections of the specified parent, from `armature_src` to `armature_dst`.
*
* This assumes that the parent itself has already been copied.
*/
static void liboverride_recursively_add_children(bArmature *armature_dst,
const bArmature *armature_src,
const int parent_bcoll_dst_index,
const BoneCollection *parent_bcoll_src)
{
BLI_assert_msg(parent_bcoll_dst_index >= 0,
"this function can only add children to another collection, it cannot add roots");
/* Iterate over the children in `armature_src`, and clone them one by one into `armature_dst`.
*
* This uses two loops. The first one adds all the children, the second loop iterates over those
* children for the recursion step. As this performs a "breadth-first insertion", it requires
* considerably less shuffling of the array as when the recursion was done immediately after
* inserting a child. */
BoneCollection *parent_bcoll_dst = armature_dst->collection_array[parent_bcoll_dst_index];
/* Big Fat Assumption: because this code runs as part of the library override system, it is
* assumed that the parent is either a newly added root, or another child that was also added by
* the liboverride system. Because this would never add a child to an original "sequence of
* siblings", insertions of children always happen at the end of the array. This means that
* `parent_bcoll_dst_index` remains constant during this entire function. */
/* Copy & insert all the children. */
for (int bcoll_src_index = parent_bcoll_src->child_index;
bcoll_src_index < parent_bcoll_src->child_index + parent_bcoll_src->child_count;
bcoll_src_index++)
{
const BoneCollection *bcoll_src = armature_src->collection_array[bcoll_src_index];
BoneCollection *bcoll_dst = copy_and_update_ownership(armature_dst, bcoll_src);
const int bcoll_index_dst = bonecoll_insert_as_child(
armature_dst, bcoll_dst, parent_bcoll_dst_index);
#ifndef NDEBUG
/* Check that the above Big Fat Assumption holds. */
BLI_assert_msg(bcoll_index_dst > parent_bcoll_dst_index,
"expecting children to be added to the array AFTER their parent");
#else
(void)bcoll_index_dst;
#endif
bonecoll_ensure_name_unique(armature_dst, bcoll_dst);
}
/* Double-check that the above Big Fat Assumption holds. */
#ifndef NDEBUG
const int new_parent_bcoll_dst_index = armature_bonecoll_find_index(armature_dst,
parent_bcoll_dst);
BLI_assert_msg(new_parent_bcoll_dst_index == parent_bcoll_dst_index,
"did not expect parent_bcoll_dst_index to change");
#endif
/* Recurse into the children to copy grandchildren. */
BLI_assert_msg(parent_bcoll_dst->child_count == parent_bcoll_src->child_count,
"all children should have been copied");
for (int child_num = 0; child_num < parent_bcoll_dst->child_count; child_num++) {
const int bcoll_src_index = parent_bcoll_src->child_index + child_num;
const int bcoll_dst_index = parent_bcoll_dst->child_index + child_num;
const BoneCollection *bcoll_src = armature_src->collection_array[bcoll_src_index];
liboverride_recursively_add_children(armature_dst, armature_src, bcoll_dst_index, bcoll_src);
}
}
BoneCollection *ANIM_armature_bonecoll_insert_copy_after(bArmature *armature_dst,
const bArmature *armature_src,
const BoneCollection *anchor_in_dst,
const BoneCollection *bcoll_to_copy)
{
#ifndef NDEBUG
/* Check that this bone collection is really a root, as this is assumed by the
* rest of this function. This is an O(n) check, though, so that's why it's
* only running in debug builds. */
const int bcoll_index_src = armature_bonecoll_find_index(armature_src, bcoll_to_copy);
if (!armature_bonecoll_is_root(armature_src, bcoll_index_src)) {
printf(
"Armature \"%s\" has library override operation that adds non-root bone collection "
"\"%s\". This is unexpected, please file a bug report.\n",
armature_src->id.name + 2,
bcoll_to_copy->name);
}
#endif
BoneCollection *bcoll = copy_and_update_ownership(armature_dst, bcoll_to_copy);
const int anchor_index = armature_bonecoll_find_index(armature_dst, anchor_in_dst);
const int bcoll_index = anchor_index + 1;
BLI_assert_msg(
bcoll_index <= armature_dst->collection_root_count,
"did not expect library override to add a child bone collection, only roots are expected");
bonecoll_insert_as_root(armature_dst, bcoll, bcoll_index);
bonecoll_ensure_name_unique(armature_dst, bcoll);
/* Library override operations are only constructed for the root bones. This means that handling
* this operation should also include copying the children. */
liboverride_recursively_add_children(armature_dst, armature_src, bcoll_index, bcoll_to_copy);
ANIM_armature_bonecoll_active_runtime_refresh(armature_dst);
return bcoll;
}
static void armature_bonecoll_active_clear(bArmature *armature)
{
armature->runtime.active_collection_index = -1;
@ -249,7 +389,7 @@ void ANIM_armature_bonecoll_active_set(bArmature *armature, BoneCollection *bcol
return;
}
const int index = bonecoll_find_index(armature, bcoll);
const int index = armature_bonecoll_find_index(armature, bcoll);
if (index == -1) {
/* TODO: print warning? Or just ignore this case? */
armature_bonecoll_active_clear(armature);
@ -281,13 +421,42 @@ void ANIM_armature_bonecoll_active_name_set(bArmature *armature, const char *nam
ANIM_armature_bonecoll_active_set(armature, bcoll);
}
void ANIM_armature_bonecoll_active_runtime_refresh(struct bArmature *armature)
{
const std::string_view active_name = armature->active_collection_name;
if (active_name.empty()) {
armature_bonecoll_active_clear(armature);
return;
}
int index = 0;
for (BoneCollection *bcoll : armature->collections_span()) {
if (bcoll->name == active_name) {
armature->runtime.active_collection_index = index;
armature->runtime.active_collection = bcoll;
return;
}
index++;
}
/* No bone collection with the name was found, so better to clear everything.*/
armature_bonecoll_active_clear(armature);
}
bool ANIM_armature_bonecoll_is_editable(const bArmature *armature, const BoneCollection *bcoll)
{
const bool is_override = ID_IS_OVERRIDE_LIBRARY(armature);
if (ID_IS_LINKED(armature) && !is_override) {
return false;
}
if (is_override && BKE_lib_override_library_is_system_defined(nullptr, &armature->id)) {
/* A system override is still not editable. */
return false;
}
if (is_override && (bcoll->flags & BONE_COLLECTION_OVERRIDE_LIBRARY_LOCAL) == 0) {
/* This particular collection was not added in the local override, so not editable. */
return false;
}
return true;
@ -303,46 +472,95 @@ bool ANIM_armature_bonecoll_move_to_index(bArmature *armature,
return false;
}
BoneCollection *bcoll = armature->collection_array[from_index];
/* Shift collections over to fill the gap at from_index and make room at to_index. */
if (from_index < to_index) {
BoneCollection **start = armature->collection_array + from_index + 1;
const size_t count = to_index - from_index;
memmove((void *)(start - 1), (void *)start, count * sizeof(BoneCollection *));
}
else {
BoneCollection **start = armature->collection_array + to_index;
const size_t count = from_index - to_index;
memmove((void *)(start + 1), (void *)start, count * sizeof(BoneCollection *));
/* Only allow moving within the same parent. This is written a bit awkwardly to avoid two calls
* to `armature_bonecoll_find_parent_index()` as that is O(n) in the number of bone collections.
*/
const int parent_index = armature_bonecoll_find_parent_index(armature, from_index);
if (!armature_bonecoll_is_child_of(armature, parent_index, to_index)) {
return false;
}
armature->collection_array[to_index] = bcoll;
if (parent_index < 0) {
/* Roots can just be moved around, as there is no `child_index` to update in this case. */
internal::bonecolls_move_to_index(armature, from_index, to_index);
return true;
}
/* Adjust the active collection index. */
if (from_index == armature->runtime.active_collection_index) {
/* If the active collection is the collection we moved. */
ANIM_armature_bonecoll_active_index_set(armature, to_index);
}
else if (from_index <= armature->runtime.active_collection_index &&
armature->runtime.active_collection_index <= to_index)
{
/* If the active collection is within the span of shifted collections. */
const int offset = from_index < to_index ? -1 : 1;
ANIM_armature_bonecoll_active_index_set(armature,
armature->runtime.active_collection_index + offset);
}
/* Store the parent's child_index, as that might move if to_index is the first child
* (bonecolls_move_to_index() will keep it pointing at that first child). */
BoneCollection *parent_bcoll = armature->collection_array[parent_index];
const int old_parent_child_index = parent_bcoll->child_index;
internal::bonecolls_move_to_index(armature, from_index, to_index);
parent_bcoll->child_index = old_parent_child_index;
return true;
}
static int bonecoll_child_number(const bArmature *armature,
const int parent_bcoll_index,
const int bcoll_index)
{
if (parent_bcoll_index < 0) {
/* Root bone collections are always at the start of the array, and thus their index is the
* 'child number'. */
return bcoll_index;
}
const BoneCollection *parent_bcoll = armature->collection_array[parent_bcoll_index];
return bcoll_index - parent_bcoll->child_index;
}
int ANIM_armature_bonecoll_move_before_after_index(bArmature *armature,
const int from_index,
int to_index,
const MoveLocation before_after)
{
const int from_parent_index = armature_bonecoll_find_parent_index(armature, from_index);
const int to_parent_index = armature_bonecoll_find_parent_index(armature, to_index);
if (from_parent_index != to_parent_index) {
/* Moving between parents. */
int to_child_num = bonecoll_child_number(armature, to_parent_index, to_index);
if (before_after == MoveLocation::After) {
to_child_num++;
}
return armature_bonecoll_move_to_parent(
armature, from_index, to_child_num, from_parent_index, to_parent_index);
}
/* Moving between siblings. */
switch (before_after) {
case MoveLocation::Before:
if (to_index > from_index) {
/* Moving to the right, but needs to go before that one, so needs a decrement. */
to_index--;
}
break;
case MoveLocation::After:
if (to_index < from_index) {
/* Moving to the left, but needs to go after that one, so needs a decrement. */
to_index++;
}
break;
}
if (!ANIM_armature_bonecoll_move_to_index(armature, from_index, to_index)) {
return -1;
}
return to_index;
}
bool ANIM_armature_bonecoll_move(bArmature *armature, BoneCollection *bcoll, const int step)
{
if (bcoll == nullptr) {
return false;
}
const int bcoll_index = bonecoll_find_index(armature, bcoll);
const int bcoll_index = armature_bonecoll_find_index(armature, bcoll);
const int to_index = bcoll_index + step;
if (bcoll_index < 0 || to_index < 0 || to_index >= armature->collection_array_num) {
return false;
@ -373,30 +591,61 @@ void ANIM_armature_bonecoll_name_set(bArmature *armature, BoneCollection *bcoll,
BKE_animdata_fix_paths_rename_all(&armature->id, "collections", old_name, bcoll->name);
}
void ANIM_armature_bonecoll_remove_from_index(bArmature *armature, const int index)
void ANIM_armature_bonecoll_remove_from_index(bArmature *armature, int index)
{
BLI_assert(0 <= index && index < armature->collection_array_num);
BoneCollection *bcoll = armature->collection_array[index];
/* Remove bone membership. */
LISTBASE_FOREACH_MUTABLE (BoneCollectionMember *, member, &bcoll->bones) {
ANIM_armature_bonecoll_unassign(bcoll, member->bone);
/* The parent needs updating, so better to find it before this bone collection is removed. */
int parent_bcoll_index = armature_bonecoll_find_parent_index(armature, index);
BoneCollection *parent_bcoll = parent_bcoll_index >= 0 ?
armature->collection_array[parent_bcoll_index] :
nullptr;
/* Move all the children of the to-be-removed bone collection to their grandparent. */
int move_to_child_num = bonecoll_child_number(armature, parent_bcoll_index, index);
while (bcoll->child_count > 0) {
/* Move the child to its grandparent, at the same spot as the to-be-removed
* bone collection. The latter thus (potentially) shifts by 1 in the array.
* After removal, this effectively makes it appear like the removed bone
* collection is replaced by all its children. */
armature_bonecoll_move_to_parent(armature,
bcoll->child_index, /* Move from index... */
move_to_child_num, /* to this child number. */
index, /* From this parent... */
parent_bcoll_index /* to that parent. */
);
/* Both 'index' and 'parent_bcoll_index' can change each iteration. */
index = internal::bonecolls_find_index_near(armature, bcoll, index);
BLI_assert_msg(index >= 0, "could not find bone collection after moving things around");
if (parent_bcoll_index >= 0) { /* If there is no parent, its index should stay -1. */
parent_bcoll_index = internal::bonecolls_find_index_near(
armature, parent_bcoll, parent_bcoll_index);
BLI_assert_msg(parent_bcoll_index >= 0,
"could not find bone collection parent after moving things around");
}
move_to_child_num++;
}
if (armature->edbo) {
LISTBASE_FOREACH (EditBone *, ebone, armature->edbo) {
ANIM_armature_bonecoll_unassign_editbone(bcoll, ebone);
/* Adjust the parent for the removal of its child. */
if (parent_bcoll_index < 0) {
/* Removing a root, so the armature itself needs to be updated. */
armature->collection_root_count--;
BLI_assert_msg(armature->collection_root_count >= 0, "armature root count cannot be negative");
}
else {
parent_bcoll->child_count--;
if (parent_bcoll->child_count == 0) {
parent_bcoll->child_index = 0;
}
}
ANIM_bonecoll_free(bcoll);
/* Shift over the collections to fill the gap. */
if (index < (armature->collection_array_num - 1)) {
BoneCollection **start = armature->collection_array + index;
const size_t count = armature->collection_array_num - index - 1;
memmove((void *)start, (void *)(start + 1), count * sizeof(BoneCollection *));
}
/* Rotate the to-be-removed collection to the last array element. */
internal::bonecolls_move_to_index(armature, index, armature->collection_array_num - 1);
/* Note: we don't bother to shrink the allocation. It's okay if the
* capacity has extra space, because the number of valid items is tracked. */
@ -404,24 +653,37 @@ void ANIM_armature_bonecoll_remove_from_index(bArmature *armature, const int ind
armature->collection_array[armature->collection_array_num] = nullptr;
/* Update the active BoneCollection. */
if (index <= armature->runtime.active_collection_index) {
int active_index = armature->runtime.active_collection_index;
if (index == armature->collection_array_num) {
/* Removing the last element: activate the now-last element. */
active_index--;
const int active_collection_index = armature->runtime.active_collection_index;
if (active_collection_index >= 0) {
/* Default: select the next sibling.
* If there is none: select the previous sibling.
* If there is none: select the parent.
*/
if (armature_bonecoll_is_child_of(armature, parent_bcoll_index, active_collection_index)) {
/* active_collection_index still points to a sibling of the removed collection. */
ANIM_armature_bonecoll_active_index_set(armature, active_collection_index);
}
else if (index < active_index) {
/* The active collection shifted, because a collection before it was removed. */
active_index--;
else if (active_collection_index > 0 &&
armature_bonecoll_is_child_of(
armature, parent_bcoll_index, active_collection_index - 1))
{
/* The child preceeding active_collection_index is a sibling of the removed collection. */
ANIM_armature_bonecoll_active_index_set(armature, active_collection_index - 1);
}
else {
/* Select the parent, or nothing if this was a root collection. In that case, if there are no
* siblings either, this just means all bone collections have been removed. */
ANIM_armature_bonecoll_active_index_set(armature, parent_bcoll_index);
}
ANIM_armature_bonecoll_active_index_set(armature, active_index);
}
internal::bonecoll_unassign_and_free(armature, bcoll);
}
void ANIM_armature_bonecoll_remove(bArmature *armature, BoneCollection *bcoll)
{
ANIM_armature_bonecoll_remove_from_index(armature, bonecoll_find_index(armature, bcoll));
ANIM_armature_bonecoll_remove_from_index(armature,
armature_bonecoll_find_index(armature, bcoll));
}
BoneCollection *ANIM_armature_bonecoll_get_by_name(bArmature *armature, const char *name)
@ -434,6 +696,17 @@ BoneCollection *ANIM_armature_bonecoll_get_by_name(bArmature *armature, const ch
return nullptr;
}
int ANIM_armature_bonecoll_get_index_by_name(bArmature *armature, const char *name)
{
for (int index = 0; index < armature->collection_array_num; index++) {
const BoneCollection *bcoll = armature->collection_array[index];
if (STREQ(bcoll->name, name)) {
return index;
}
}
return -1;
}
void ANIM_bonecoll_show(BoneCollection *bcoll)
{
bcoll->flags |= BONE_COLLECTION_VISIBLE;
@ -626,15 +899,39 @@ void ANIM_armature_bonecoll_assign_active(const bArmature *armature, EditBone *e
{
if (armature->runtime.active_collection == nullptr) {
/* No active collection, do not assign to any. */
printf("ANIM_armature_bonecoll_assign_active(%s, %s): no active collection\n",
ebone->name,
armature->id.name);
return;
}
ANIM_armature_bonecoll_assign_editbone(armature->runtime.active_collection, ebone);
}
static bool bcoll_list_contains(const ListBase /*BoneCollectionRef*/ *collection_refs,
const BoneCollection *bcoll)
{
LISTBASE_FOREACH (const BoneCollectionReference *, bcoll_ref, collection_refs) {
if (bcoll == bcoll_ref->bcoll) {
return true;
}
}
return false;
}
bool ANIM_armature_bonecoll_contains_active_bone(const struct bArmature *armature,
const struct BoneCollection *bcoll)
{
if (armature->edbo) {
if (!armature->act_edbone) {
return false;
}
return bcoll_list_contains(&armature->act_edbone->bone_collections, bcoll);
}
if (!armature->act_bone) {
return false;
}
return bcoll_list_contains(&armature->act_bone->runtime.collections, bcoll);
}
void ANIM_armature_bonecoll_show_from_bone(bArmature *armature, const Bone *bone)
{
if (ANIM_bonecoll_is_visible(armature, bone)) {
@ -674,6 +971,183 @@ void ANIM_armature_bonecoll_show_from_pchan(bArmature *armature, const bPoseChan
/* C++ only. */
namespace blender::animrig {
int armature_bonecoll_find_index(const bArmature *armature, const BoneCollection *bcoll)
{
int index = 0;
for (const BoneCollection *arm_bcoll : armature->collections_span()) {
if (arm_bcoll == bcoll) {
return index;
}
index++;
}
return -1;
}
int armature_bonecoll_find_parent_index(const bArmature *armature, const int bcoll_index)
{
if (bcoll_index < armature->collection_root_count) {
/* Don't bother iterating all collections when it's known to be a root. */
return -1;
}
int index = 0;
for (const BoneCollection *potential_parent : armature->collections_span()) {
if (potential_parent->child_index <= bcoll_index &&
bcoll_index < potential_parent->child_index + potential_parent->child_count)
{
return index;
}
index++;
}
return -1;
}
bool armature_bonecoll_is_root(const bArmature *armature, const int bcoll_index)
{
BLI_assert(bcoll_index >= 0);
return bcoll_index < armature->collection_root_count;
}
bool armature_bonecoll_is_child_of(const bArmature *armature,
const int potential_parent_index,
const int potential_child_index)
{
/* Check for roots, before we try and access collection_array[-1]. */
const bool is_root = armature_bonecoll_is_root(armature, potential_child_index);
if (is_root) {
return potential_parent_index == -1;
}
if (potential_parent_index < 0) {
return is_root;
}
const BoneCollection *potential_parent = armature->collection_array[potential_parent_index];
const int upper_bound = potential_parent->child_index + potential_parent->child_count;
return potential_parent->child_index <= potential_child_index &&
potential_child_index < upper_bound;
}
bool armature_bonecoll_is_decendent_of(const bArmature *armature,
const int potential_parent_index,
const int potential_decendent_index)
{
if (armature_bonecoll_is_child_of(armature, potential_parent_index, potential_decendent_index)) {
/* Found a direct child. */
return true;
}
const BoneCollection *potential_parent = armature->collection_array[potential_parent_index];
const int upper_bound = potential_parent->child_index + potential_parent->child_count;
for (int visit_index = potential_parent->child_index; visit_index < upper_bound; visit_index++) {
if (armature_bonecoll_is_decendent_of(armature, visit_index, potential_decendent_index)) {
return true;
}
}
return false;
}
bool bonecoll_has_children(const BoneCollection *bcoll)
{
return bcoll->child_count > 0;
}
int armature_bonecoll_move_to_parent(bArmature *armature,
const int from_bcoll_index,
int to_child_num,
const int from_parent_index,
const int to_parent_index)
{
BLI_assert(0 <= from_bcoll_index && from_bcoll_index < armature->collection_array_num);
BLI_assert(-1 <= from_parent_index && from_parent_index < armature->collection_array_num);
BLI_assert(-1 <= to_parent_index && to_parent_index < armature->collection_array_num);
if (from_parent_index == to_parent_index) {
/* TODO: use `to_child_num` to still move the child to the desired position. */
return from_bcoll_index;
}
/* The Armature itself acts like some sort of 'parent' for the root collections. By having this
* as a 'fake' BoneCollection, all the code below can just be blissfully unaware of the special
* 'all root collections should be at the start of the array' rule. */
BoneCollection armature_root;
armature_root.child_count = armature->collection_root_count;
armature_root.child_index = 0;
BoneCollection *from_parent = from_parent_index >= 0 ?
armature->collection_array[from_parent_index] :
&armature_root;
BoneCollection *to_parent = to_parent_index >= 0 ? armature->collection_array[to_parent_index] :
&armature_root;
BLI_assert_msg(-1 <= to_child_num && to_child_num <= to_parent->child_count,
"to_child_num must point to an index of a child of the new parent, or the index "
"of the last child + 1, or be -1 to indicate 'after last child'");
if (to_child_num < 0) {
to_child_num = to_parent->child_count;
}
/* The new parent might not have children yet. */
int to_bcoll_index;
if (to_parent->child_count == 0) {
/* New parents always get their children at the end of the array. */
to_bcoll_index = armature->collection_array_num - 1;
}
else {
to_bcoll_index = to_parent->child_index + to_child_num;
/* Check whether the new parent's children are to the left or right of bcoll_index.
* This determines which direction the collections have to shift, and thus which index to
* move the bcoll to. */
if (to_bcoll_index > from_bcoll_index) {
to_bcoll_index--;
}
}
/* In certain cases the 'from_parent' gets its first child removed, and needs to have its
* child_index incremented. This needs to be done by comparing these fields before the actual
* move happens (as that could also change the child_index). */
const bool needs_post_move_child_index_bump = from_parent->child_index == from_bcoll_index &&
to_bcoll_index <= from_bcoll_index;
/* bonecolls_move_to_index() will try and keep the hierarchy correct, and thus change
* to_parent->child_index to keep pointing to its current-first child. */
const bool becomes_new_first_child = to_child_num == 0 || to_parent->child_count == 0;
internal::bonecolls_move_to_index(armature, from_bcoll_index, to_bcoll_index);
/* Update child index & count of the old parent. */
from_parent->child_count--;
if (from_parent->child_count == 0) {
/* Clean up the child index when the parent has no more children. */
from_parent->child_index = 0;
}
else if (needs_post_move_child_index_bump) {
/* The start of the block of children of the old parent has moved, because
* we took out the first child. This only needs to be compensated for when
* moving it to the left (or staying put), as then its old siblings stay in
* place.
*
* This only needs to be done if there are any children left, though. */
from_parent->child_index++;
}
/* Update child index & count of the new parent. */
if (becomes_new_first_child) {
to_parent->child_index = to_bcoll_index;
}
to_parent->child_count++;
/* Copy the information from the 'fake' BoneCollection back to the armature. */
armature->collection_root_count = armature_root.child_count;
BLI_assert(armature_root.child_index == 0);
return to_bcoll_index;
}
/* Utility functions for Armature edit-mode undo. */
blender::Map<BoneCollection *, BoneCollection *> ANIM_bonecoll_array_copy_no_membership(
@ -737,4 +1211,131 @@ void ANIM_bonecoll_array_free(BoneCollection ***bcoll_array,
*bcoll_array_num = 0;
}
/** Functions declared in bone_collections_internal.hh. */
namespace internal {
void bonecolls_rotate_block(bArmature *armature,
const int start_index,
const int count,
const int direction)
{
BLI_assert_msg(direction == 1 || direction == -1, "`direction` must be either -1 or +1");
if (count == 0) {
return;
}
/* When the block [start_index:start_index+count] is moved, it causes a duplication of one
* element and overwrites another element. For example: given an array [0, 1, 2, 3, 4], moving
* indices [1, 2] by +1 would result in one double element (1) and one missing element (3): [0,
* 1, 1, 2, 4].
*
* This is resolved by moving that element to the other side of the block, so the result will be
* [0, 3, 1, 2, 4]. This breaks the hierarchical information, so it's up to the caller to update
* this one moved element.
*/
const int move_from_index = (direction > 0 ? start_index + count : start_index - 1);
const int move_to_index = (direction > 0 ? start_index : start_index + count - 1);
BoneCollection *bcoll_to_move = armature->collection_array[move_from_index];
BoneCollection **start = armature->collection_array + start_index;
memmove((void *)(start + direction), (void *)start, count * sizeof(BoneCollection *));
armature->collection_array[move_to_index] = bcoll_to_move;
/* Update all child indices that reference something in the moved block. */
for (BoneCollection *bcoll : armature->collections_span()) {
/* Having both child_index and child_count zeroed out just means "no children"; these shouldn't
* be updated at all, as here child_index is not really referencing the element at index 0. */
if (bcoll->child_index == 0 && bcoll->child_count == 0) {
continue;
}
/* Compare to the original start & end of the block (i.e. pre-move). If a
* child_index is within this range, it'll need updating. */
if (start_index <= bcoll->child_index && bcoll->child_index < start_index + count) {
bcoll->child_index += direction;
}
}
}
void bonecolls_move_to_index(bArmature *armature, const int from_index, const int to_index)
{
if (from_index == to_index) {
return;
}
BLI_assert(0 <= from_index);
BLI_assert(from_index < armature->collection_array_num);
BLI_assert(0 <= to_index);
BLI_assert(to_index < armature->collection_array_num);
if (from_index < to_index) {
const int block_start_index = from_index + 1;
const int block_count = to_index - from_index;
bonecolls_rotate_block(armature, block_start_index, block_count, -1);
}
else {
const int block_start_index = to_index;
const int block_count = from_index - to_index;
bonecolls_rotate_block(armature, block_start_index, block_count, +1);
}
}
int bonecolls_find_index_near(bArmature *armature, BoneCollection *bcoll, const int index)
{
BoneCollection **collections = armature->collection_array;
if (collections[index] == bcoll) {
return index;
}
if (index > 0 && collections[index - 1] == bcoll) {
return index - 1;
}
if (index < armature->collection_array_num - 1 && collections[index + 1] == bcoll) {
return index + 1;
}
return -1;
}
void bonecolls_debug_list(const bArmature *armature)
{
printf("\033[38;5;214mBone collections of armature \"%s\":\033[0m\n", armature->id.name + 2);
constexpr int root_ansi_color = 95;
printf(
" - \033[%dmroot\033[0m count: %d\n", root_ansi_color, armature->collection_root_count);
for (int i = 0; i < armature->collection_array_num; ++i) {
const BoneCollection *bcoll = armature->collection_array[i];
printf(" - \033[%dmcolls[%d] = %24s\033[0m ",
i < armature->collection_root_count ? root_ansi_color : 0,
i,
bcoll->name);
if (bcoll->child_index == 0 && bcoll->child_count == 0) {
printf("(leaf)");
}
else {
printf("(child index: %d, count: %d)", bcoll->child_index, bcoll->child_count);
}
printf("\n");
}
}
void bonecoll_unassign_and_free(bArmature *armature, BoneCollection *bcoll)
{
/* Remove bone membership. */
LISTBASE_FOREACH_MUTABLE (BoneCollectionMember *, member, &bcoll->bones) {
ANIM_armature_bonecoll_unassign(bcoll, member->bone);
}
if (armature->edbo) {
LISTBASE_FOREACH (EditBone *, ebone, armature->edbo) {
ANIM_armature_bonecoll_unassign_editbone(bcoll, ebone);
}
}
ANIM_bonecoll_free(bcoll);
}
} // namespace internal
} // namespace blender::animrig

View File

@ -0,0 +1,70 @@
/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup animrig
*
* \brief Internal C++ functions to deal with bone collections. These are mostly here for internal
* use in `bone_collections.cc` and have them testable by unit tests.
*/
#pragma once
#include <stdint.h>
namespace blender::animrig::internal {
/**
* Move a block of BoneCollections in the Armature's `collections_array`, from
* `start_index` to `start_index + direction`.
*
* The move operation is actually implemented as a rotation, so that no
* `BoneCollection*` is lost. In other words, one of these operations is
* performed, depending on `direction`. Here `B` indicates an element in the
* moved block, and `X` indicates the rotated element.
*
* direction = +1: [. . . X B B B B . . .] -> [. . . B B B B X . . .]
* direction = -1: [. . . B B B B X . . .] -> [. . . X B B B B . . .]
*
* This function does not alter the length of `collections_array`.
* It only performs the rotation, and updates any `child_index` when they
* reference elements of the moved block.
*
* It also does not touch any `child_count` properties of bone collections.
* Updating those, as well as any references to the rotated element, is the
* responsibility of the caller.
*
* \param direction must be either -1 or 1.
*/
void bonecolls_rotate_block(bArmature *armature, int start_index, int count, int direction);
/**
* Move a bone collection to another index.
*
* This is implemented via a call to #bonecolls_rotate_block, so all the
* documentation of that function (including its invariants and caveats) applies
* here too.
*/
void bonecolls_move_to_index(bArmature *armature, int from_index, int to_index);
/**
* Find the given bone collection in the armature's collections, and return its index.
*
* The bone collection is only searched for at the given index, index+1, and index-1.
*
* If the bone collection cannot be found, -1 is returned.
*/
int bonecolls_find_index_near(bArmature *armature, BoneCollection *bcoll, int index);
void bonecolls_debug_list(const bArmature *armature);
/**
* Unassign all (edit)bones from this bone collection, and free it.
*
* Note that this does NOT take care of updating the collection hierarchy information. See
* #ANIM_armature_bonecoll_remove_from_index and #ANIM_armature_bonecoll_remove for that.
*/
void bonecoll_unassign_and_free(bArmature *armature, BoneCollection *bcoll);
} // namespace blender::animrig::internal

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,7 @@
#include "ED_transform.hh"
#include "ANIM_keyframing.hh"
#include "ANIM_rna.hh"
#include "WM_api.hh"
#include "WM_types.hh"
@ -82,19 +83,7 @@ bool autokeyframe_cfra_can_key(const Scene *scene, ID *id)
return true;
}
static std::string get_rotation_mode_path(const eRotationModes rotmode)
{
switch (rotmode) {
case ROT_MODE_QUAT:
return "rotation_quaternion";
case ROT_MODE_AXISANGLE:
return "rotation_axis_angle";
default:
return "rotation_euler";
}
}
void autokeyframe_object(bContext *C, Scene *scene, Object *ob)
void autokeyframe_object(bContext *C, Scene *scene, Object *ob, Span<std::string> rna_paths)
{
ID *id = &ob->id;
if (!autokeyframe_cfra_can_key(scene, id)) {
@ -148,13 +137,11 @@ void autokeyframe_object(bContext *C, Scene *scene, Object *ob)
}
const float scene_frame = BKE_scene_frame_get(scene);
std::string rotation_rna_path = get_rotation_mode_path(eRotationModes(ob->rotmode));
Vector<std::string> rna_paths = {"location", rotation_rna_path, "scale"};
Main *bmain = CTX_data_main(C);
for (PointerRNA ptr : sources) {
insert_key_rna(&ptr,
rna_paths.as_span(),
rna_paths,
scene_frame,
flag,
eBezTriple_KeyframeType(scene->toolsettings->keyframe_type),
@ -199,13 +186,17 @@ bool autokeyframe_pchan(bContext *C, Scene *scene, Object *ob, bPoseChannel *pch
return true;
}
void autokeyframe_pose(bContext *C, Scene *scene, Object *ob, short targetless_ik)
void autokeyframe_pose_channel(bContext *C,
Scene *scene,
Object *ob,
bPoseChannel *pose_channel,
Span<std::string> rna_paths,
short targetless_ik)
{
Main *bmain = CTX_data_main(C);
ID *id = &ob->id;
AnimData *adt = ob->adt;
bAction *act = (adt) ? adt->action : nullptr;
bPose *pose = ob->pose;
if (!blender::animrig::autokeyframe_cfra_can_key(scene, id)) {
return;
@ -230,68 +221,57 @@ void autokeyframe_pose(bContext *C, Scene *scene, Object *ob, short targetless_i
flag |= INSERTKEY_MATRIX;
}
LISTBASE_FOREACH (bPoseChannel *, pchan, &pose->chanbase) {
if ((pchan->bone->flag & BONE_TRANSFORM) == 0 &&
!((pose->flag & POSE_MIRROR_EDIT) && (pchan->bone->flag & BONE_TRANSFORM_MIRROR)))
{
continue;
blender::Vector<PointerRNA> sources;
/* Add data-source override for the camera object. */
ANIM_relative_keyingset_add_source(sources, id, &RNA_PoseBone, pose_channel);
/* only insert into active keyingset? */
if (blender::animrig::is_autokey_flag(scene, AUTOKEY_FLAG_ONLYKEYINGSET) && (active_ks)) {
/* Run the active Keying Set on the current data-source. */
ANIM_apply_keyingset(
C, &sources, active_ks, MODIFYKEY_MODE_INSERT, anim_eval_context.eval_time);
return;
}
/* only insert into available channels? */
if (blender::animrig::is_autokey_flag(scene, AUTOKEY_FLAG_INSERTAVAILABLE)) {
if (!act) {
return;
}
blender::Vector<PointerRNA> sources;
/* Add data-source override for the camera object. */
ANIM_relative_keyingset_add_source(sources, id, &RNA_PoseBone, pchan);
/* only insert into active keyingset? */
if (blender::animrig::is_autokey_flag(scene, AUTOKEY_FLAG_ONLYKEYINGSET) && (active_ks)) {
/* Run the active Keying Set on the current data-source. */
ANIM_apply_keyingset(
C, &sources, active_ks, MODIFYKEY_MODE_INSERT, anim_eval_context.eval_time);
continue;
}
/* only insert into available channels? */
if (blender::animrig::is_autokey_flag(scene, AUTOKEY_FLAG_INSERTAVAILABLE)) {
if (!act) {
LISTBASE_FOREACH (FCurve *, fcu, &act->curves) {
/* only insert keyframes for this F-Curve if it affects the current bone */
char pchan_name[sizeof(pose_channel->name)];
if (!BLI_str_quoted_substr(fcu->rna_path, "bones[", pchan_name, sizeof(pchan_name))) {
continue;
}
LISTBASE_FOREACH (FCurve *, fcu, &act->curves) {
/* only insert keyframes for this F-Curve if it affects the current bone */
char pchan_name[sizeof(pchan->name)];
if (!BLI_str_quoted_substr(fcu->rna_path, "bones[", pchan_name, sizeof(pchan_name))) {
continue;
}
/* only if bone name matches too...
* NOTE: this will do constraints too, but those are ok to do here too?
*/
if (STREQ(pchan_name, pchan->name)) {
blender::animrig::insert_keyframe(bmain,
reports,
id,
act,
((fcu->grp) ? (fcu->grp->name) : (nullptr)),
fcu->rna_path,
fcu->array_index,
&anim_eval_context,
eBezTriple_KeyframeType(ts->keyframe_type),
flag);
}
/* only if bone name matches too...
* NOTE: this will do constraints too, but those are ok to do here too?
*/
if (STREQ(pchan_name, pose_channel->name)) {
blender::animrig::insert_keyframe(bmain,
reports,
id,
act,
((fcu->grp) ? (fcu->grp->name) : (nullptr)),
fcu->rna_path,
fcu->array_index,
&anim_eval_context,
eBezTriple_KeyframeType(ts->keyframe_type),
flag);
}
continue;
}
return;
}
Main *bmain = CTX_data_main(C);
std::string rotation_rna_path = get_rotation_mode_path(eRotationModes(pchan->rotmode));
Vector<std::string> rna_paths = {"location", rotation_rna_path, "scale"};
for (PointerRNA &ptr : sources) {
insert_key_rna(&ptr,
rna_paths,
scene_frame,
flag,
eBezTriple_KeyframeType(scene->toolsettings->keyframe_type),
bmain,
reports);
}
for (PointerRNA &ptr : sources) {
insert_key_rna(&ptr,
rna_paths,
scene_frame,
flag,
eBezTriple_KeyframeType(scene->toolsettings->keyframe_type),
bmain,
reports);
}
}

View File

@ -39,6 +39,7 @@ if(WIN32)
target_link_libraries(BlendThumb bf_blenlib dbghelp.lib Version.lib)
set_target_properties(BlendThumb PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB:msvcrt")
set_target_properties(BlendThumb PROPERTIES VS_GLOBAL_VcpkgEnabled "false")
else()
# -----------------------------------------------------------------------------

View File

@ -9,9 +9,11 @@
#pragma once
#include <string>
#include "BLI_sys_types.h"
#include "BKE_customdata.hh"
#include "DNA_customdata_types.h"
namespace blender::bke {
enum class AttrDomain : int8_t;
@ -111,7 +113,7 @@ void BKE_id_attributes_default_color_set(struct ID *id, const char *name);
const struct CustomDataLayer *BKE_id_attributes_color_find(const struct ID *id, const char *name);
void BKE_id_attribute_calc_unique_name(struct ID *id, const char *name, char *outname);
std::string BKE_id_attribute_calc_unique_name(const struct ID &id, const blender::StringRef name);
const char *BKE_uv_map_vert_select_name_get(const char *uv_map_name, char *buffer);
const char *BKE_uv_map_edge_select_name_get(const char *uv_map_name, char *buffer);

View File

@ -76,6 +76,9 @@ class AttributeIDRef {
friend std::ostream &operator<<(std::ostream &stream, const AttributeIDRef &attribute_id);
};
const CPPType *custom_data_type_to_cpp_type(eCustomDataType type);
eCustomDataType cpp_type_to_custom_data_type(const CPPType &type);
/**
* Contains information about an attribute in a geometry component.
* More information can be added in the future. E.g. whether the attribute is builtin and how it is

View File

@ -16,7 +16,7 @@
#include "BLI_math_vector.hh"
#include "BLI_offset_indices.hh"
#include "BKE_customdata.hh"
#include "BKE_attribute.hh"
namespace blender::bke::attribute_math {

View File

@ -21,7 +21,6 @@ struct Implicit_Data;
struct Depsgraph;
struct LinkNode;
struct Mesh;
struct MVertTri;
struct Object;
struct Scene;
@ -77,7 +76,7 @@ struct Cloth {
short pad3;
BVHTree *bvhtree; /* collision tree for this cloth object */
BVHTree *bvhselftree; /* collision tree for this cloth object (may be same as bvhtree) */
MVertTri *tri;
blender::int3 *vert_tris;
Implicit_Data *implicit; /* our implicit solver connects to this pointer */
blender::Set<blender::OrderedEdge> edgeset; /* used for selfcollisions */
int last_frame;

View File

@ -7,15 +7,12 @@
* \ingroup bke
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "BLI_math_vector_types.hh"
struct BVHTree;
struct Collection;
struct CollisionModifierData;
struct Depsgraph;
struct MVertTri;
struct Object;
////////////////////////////////////////
@ -90,13 +87,13 @@ typedef struct FaceCollPair {
/////////////////////////////////////////////////
struct BVHTree *bvhtree_build_from_mvert(const float (*positions)[3],
const struct MVertTri *tri,
const blender::int3 *vert_tris,
int tri_num,
float epsilon);
void bvhtree_update_from_mvert(struct BVHTree *bvhtree,
const float (*positions)[3],
const float (*positions_moving)[3],
const struct MVertTri *tri,
const blender::int3 *vert_tris,
int tri_num,
bool moving);
@ -165,7 +162,3 @@ void BKE_collider_cache_free(struct ListBase **colliders);
/////////////////////////////////////////////////
/////////////////////////////////////////////////
#ifdef __cplusplus
}
#endif

View File

@ -7,10 +7,6 @@
* \ingroup bke
*/
#ifdef __cplusplus
extern "C" {
#endif
struct ColorBand;
/** #ColorBand.data length. */
@ -27,7 +23,3 @@ void BKE_colorband_evaluate_table_rgba(const struct ColorBand *coba, float **arr
struct CBData *BKE_colorband_element_add(struct ColorBand *coba, float position);
bool BKE_colorband_element_remove(struct ColorBand *coba, int index);
void BKE_colorband_update_sort(struct ColorBand *coba);
#ifdef __cplusplus
}
#endif

View File

@ -7,10 +7,6 @@
* \ingroup bke
*/
#ifdef __cplusplus
extern "C" {
#endif
struct BlendDataReader;
struct BlendWriter;
struct ColorManagedColorspaceSettings;
@ -234,7 +230,3 @@ void BKE_color_managed_colorspace_settings_copy(
bool BKE_color_managed_colorspace_settings_equals(
const struct ColorManagedColorspaceSettings *settings1,
const struct ColorManagedColorspaceSettings *settings2);
#ifdef __cplusplus
}
#endif

View File

@ -24,6 +24,8 @@
#include "BKE_attribute_math.hh"
#include "BKE_curves.h"
struct BlendDataReader;
struct BlendWriter;
struct MDeformVert;
namespace blender::bke {
class AnonymousAttributePropagationInfo;

View File

@ -31,8 +31,6 @@ struct CustomDataTransferLayerMap;
struct ID;
struct MeshPairRemap;
using eCustomDataMask = uint64_t;
/* These names are used as prefixes for UV layer names to find the associated boolean
* layers. They should never be longer than 2 chars, as #MAX_CUSTOMDATA_LAYER_NAME
* has 4 extra bytes above what can be used for the base layer name, and these
@ -801,7 +799,5 @@ void CustomData_debug_info_from_layers(const CustomData *data, const char *inden
#endif /* !NDEBUG */
namespace blender::bke {
const CPPType *custom_data_type_to_cpp_type(eCustomDataType type);
eCustomDataType cpp_type_to_custom_data_type(const CPPType &type);
std::optional<VolumeGridType> custom_data_type_to_volume_grid_type(eCustomDataType type);
} // namespace blender::bke

View File

@ -8,7 +8,6 @@
#pragma once
#include "BKE_customdata.hh"
#include "BLI_compiler_compat.h"
#ifdef __cplusplus

View File

@ -8,8 +8,6 @@
* \ingroup bke
* \brief display list (or rather multi purpose list) stuff.
*/
#include "BKE_customdata.hh"
#include "DNA_customdata_types.h"
#ifdef __cplusplus
extern "C" {

View File

@ -422,6 +422,13 @@ class CurveLengthFieldInput final : public CurvesFieldInput {
std::optional<AttrDomain> preferred_domain(const bke::CurvesGeometry &curves) const final;
};
bool try_capture_field_on_geometry(MutableAttributeAccessor attributes,
const fn::FieldContext &field_context,
const AttributeIDRef &attribute_id,
AttrDomain domain,
const fn::Field<bool> &selection,
const fn::GField &field);
bool try_capture_field_on_geometry(GeometryComponent &component,
const AttributeIDRef &attribute_id,
AttrDomain domain,

View File

@ -394,6 +394,11 @@ class Layer : public ::GreasePencilLayer {
* drawing. */
int drawing_index_at(const int frame_number) const;
/**
* \returns true if there is a drawing on this layer at \a frame_number.
*/
bool has_drawing_at(const int frame_number) const;
/**
* \returns the key of the active frame at \a frame_number or -1 if there is no frame.
*/

View File

@ -313,8 +313,6 @@ void BKE_lnor_spacearr_tls_join(MLoopNorSpaceArray *lnors_spacearr,
MLoopNorSpace *BKE_lnor_space_create(MLoopNorSpaceArray *lnors_spacearr);
#ifdef __cplusplus
/**
* Should only be called once.
* Beware, this modifies ref_vec and other_vec in place!
@ -327,8 +325,6 @@ void BKE_lnor_space_define(MLoopNorSpace *lnor_space,
const float vec_other[3],
blender::Span<blender::float3> edge_vectors);
#endif
/**
* Add a new given loop to given lnor_space.
* Depending on \a lnor_space->data_type, we expect \a bm_loop to be a pointer to BMLoop struct
@ -516,17 +512,6 @@ bool BKE_mesh_validate_all_customdata(struct CustomData *vert_data,
void BKE_mesh_strip_loose_faces(struct Mesh *mesh);
/**
* Calculate edges from faces.
*/
void BKE_mesh_calc_edges(struct Mesh *mesh, bool keep_existing_edges, bool select_new_edges);
/**
* Calculate/create edges from tessface data
*
* \param mesh: The mesh to add edges into
*/
void BKE_mesh_calc_edges_tessface(struct Mesh *mesh);
/* In DerivedMesh.cc */
void BKE_mesh_wrapper_deferred_finalize_mdata(struct Mesh *me_eval);
@ -548,9 +533,3 @@ char *BKE_mesh_debug_info(const struct Mesh *mesh)
ATTR_NONNULL(1) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
void BKE_mesh_debug_print(const struct Mesh *mesh) ATTR_NONNULL(1);
#endif
/* -------------------------------------------------------------------- */
/** \name Inline Mesh Data Access
* \{ */
/** \} */

View File

@ -49,6 +49,13 @@ void corner_tris_calc_with_normals(Span<float3> vert_positions,
void corner_tris_calc_face_indices(OffsetIndices<int> faces, MutableSpan<int> tri_faces);
/**
* Convert triangles encoded as face corner indices to triangles encoded as vertex indices.
*/
void vert_tris_from_corner_tris(Span<int> corner_verts,
Span<int3> corner_tris,
MutableSpan<int3> vert_tris);
/** Return the triangle's three edge indices they are real edges, otherwise -1. */
int3 corner_tri_get_real_edges(Span<int2> edges,
Span<int> corner_verts,
@ -302,6 +309,9 @@ inline int edge_other_vert(const int2 edge, const int vert)
} // namespace mesh
/** Calculate edges from faces. */
void mesh_calc_edges(Mesh &mesh, bool keep_existing_edges, bool select_new_edges);
void mesh_flip_faces(Mesh &mesh, const IndexMask &selection);
/** Set mesh vertex normals to known-correct values, avoiding future lazy computation. */

View File

@ -116,6 +116,11 @@ void BKE_mesh_do_versions_cd_flag_init(Mesh *mesh);
void BKE_main_mesh_legacy_convert_auto_smooth(Main &bmain);
/**
* Calculate/create edges from tessface data
*/
void BKE_mesh_calc_edges_tessface(Mesh *mesh);
/* Inlines */
/* NOTE(@sybren): Instead of -1 that function uses ORIGINDEX_NONE as defined in BKE_customdata.hh,

View File

@ -9,12 +9,9 @@
* This file contains access functions for the Mesh.runtime struct.
*/
#include "BKE_mesh_types.hh"
struct CustomData_MeshMasks;
struct Depsgraph;
struct KeyBlock;
struct MVertTri;
struct Mesh;
struct Object;
struct Scene;
@ -44,14 +41,6 @@ void BKE_mesh_runtime_clear_geometry(Mesh *mesh);
*/
void BKE_mesh_runtime_clear_cache(Mesh *mesh);
/**
* Convert triangles encoded as face corner indices to triangles encoded as vertex indices.
*/
void BKE_mesh_runtime_verttris_from_corner_tris(MVertTri *r_verttri,
const int *corner_verts,
const blender::int3 *corner_tris,
int corner_tris_num);
/* NOTE: the functions below are defined in DerivedMesh.cc, and are intended to be moved
* to a more suitable location when that file is removed.
* They should also be renamed to use conventions from BKE, not old DerivedMesh.cc.

View File

@ -15,6 +15,7 @@
#include "FN_field.hh"
#include "FN_multi_function.hh"
#include "BKE_attribute_math.hh"
#include "BKE_geometry_fields.hh"
struct Mesh;

View File

@ -8,10 +8,11 @@
*/
#include "BLI_compiler_attrs.h"
#include "BLI_math_matrix_types.hh"
#include "BLI_span.hh"
#include "DNA_modifier_types.h" /* Needed for all enum type definitions. */
#include "BKE_customdata.hh"
#include "DNA_customdata_types.h"
namespace blender::bke {
struct GeometrySet;

View File

@ -10,28 +10,26 @@
#include "BLI_array.hh"
#include "BLI_bit_vector.hh"
#include "BLI_bitmap.h"
#include "BLI_compiler_compat.h"
#include "BLI_math_matrix_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_offset_indices.hh"
#include "BLI_ordered_edge.hh"
#include "BLI_set.hh"
#include "BLI_utildefines.h"
#include "DNA_brush_enums.h"
#include "DNA_customdata_types.h"
#include "DNA_object_enums.h"
#include "BKE_pbvh.hh"
#include "bmesh.hh"
struct BMFace;
struct BMLog;
struct BMesh;
struct BlendDataReader;
struct BlendLibReader;
struct BlendWriter;
struct Brush;
struct CustomDataLayer;
struct CurveMapping;
struct Depsgraph;
struct EnumPropertyItem;
@ -306,89 +304,6 @@ struct SculptPoseIKChain {
blender::float3 grab_delta_offset;
};
/* Cloth Brush */
/* Cloth Simulation. */
enum eSculptClothNodeSimState {
/* Constraints were not built for this node, so it can't be simulated. */
SCULPT_CLOTH_NODE_UNINITIALIZED,
/* There are constraints for the geometry in this node, but it should not be simulated. */
SCULPT_CLOTH_NODE_INACTIVE,
/* There are constraints for this node and they should be used by the solver. */
SCULPT_CLOTH_NODE_ACTIVE,
};
enum eSculptClothConstraintType {
/* Constraint that creates the structure of the cloth. */
SCULPT_CLOTH_CONSTRAINT_STRUCTURAL = 0,
/* Constraint that references the position of a vertex and a position in deformation_pos which
* can be deformed by the tools. */
SCULPT_CLOTH_CONSTRAINT_DEFORMATION = 1,
/* Constraint that references the vertex position and a editable soft-body position for
* plasticity. */
SCULPT_CLOTH_CONSTRAINT_SOFTBODY = 2,
/* Constraint that references the vertex position and its initial position. */
SCULPT_CLOTH_CONSTRAINT_PIN = 3,
};
struct SculptClothLengthConstraint {
/* Elements that are affected by the constraint. */
/* Element a should always be a mesh vertex with the index stored in elem_index_a as it is always
* deformed. Element b could be another vertex of the same mesh or any other position (arbitrary
* point, position for a previous state). In that case, elem_index_a and elem_index_b should be
* the same to avoid affecting two different vertices when solving the constraints.
* *elem_position points to the position which is owned by the element. */
int elem_index_a;
float *elem_position_a;
int elem_index_b;
float *elem_position_b;
float length;
float strength;
/* Index in #SculptClothSimulation.node_state of the node from where this constraint was created.
* This constraints will only be used by the solver if the state is active. */
int node;
eSculptClothConstraintType type;
};
struct SculptClothSimulation {
SculptClothLengthConstraint *length_constraints;
int tot_length_constraints;
blender::Set<blender::OrderedEdge> created_length_constraints;
int capacity_length_constraints;
float *length_constraint_tweak;
/* Position anchors for deformation brushes. These positions are modified by the brush and the
* final positions of the simulated vertices are updated with constraints that use these points
* as targets. */
float (*deformation_pos)[3];
float *deformation_strength;
float mass;
float damping;
float softbody_strength;
float (*acceleration)[3];
float (*pos)[3];
float (*init_pos)[3];
float (*init_no)[3];
float (*softbody_pos)[3];
float (*prev_pos)[3];
float (*last_iteration_pos)[3];
ListBase *collider_list;
int totnode;
/** #PBVHNode pointer as a key, index in #SculptClothSimulation.node_state as value. */
GHash *node_state_index;
eSculptClothNodeSimState *node_state;
};
struct SculptVertexInfo {
/* Indexed by base mesh vertex index, stores if that vertex is a boundary. */
blender::BitVector<> boundary;
@ -785,27 +700,6 @@ void BKE_sculpt_attribute_destroy_temporary_all(Object *ob);
/* Destroy attributes that were marked as stroke only in SculptAttributeParams. */
void BKE_sculpt_attributes_destroy_temporary_stroke(Object *ob);
BLI_INLINE void *BKE_sculpt_vertex_attr_get(const PBVHVertRef vertex, const SculptAttribute *attr)
{
if (attr->data) {
char *p = (char *)attr->data;
int idx = (int)vertex.i;
if (attr->data_for_bmesh) {
BMElem *v = (BMElem *)vertex.i;
idx = v->head.index;
}
return p + attr->elem_size * (int)idx;
}
else {
BMElem *v = (BMElem *)vertex.i;
return BM_ELEM_CD_GET_VOID_P(v, attr->bmesh_cd_offset);
}
return NULL;
}
/**
* Create new color layer on object if it doesn't have one and if experimental feature set has
* sculpt vertex color enabled. Returns truth if new layer has been added, false otherwise.

Some files were not shown because too many files have changed in this diff Show More