Merge branch 'master' into blender-projects-basics

This commit is contained in:
Julian Eisel 2022-10-06 16:03:40 +02:00
commit 818a3d3743
828 changed files with 5592 additions and 4355 deletions

View File

@ -1956,6 +1956,22 @@ if(FIRST_RUN)
info_cfg_option(WITH_MOD_OCEANSIM)
info_cfg_option(WITH_MOD_REMESH)
if(WITH_CYCLES)
info_cfg_text("Cycles:")
info_cfg_option(WITH_CYCLES_OSL)
info_cfg_option(WITH_CYCLES_EMBREE)
info_cfg_option(WITH_CYCLES_PATH_GUIDING)
if(NOT APPLE)
info_cfg_option(WITH_CYCLES_DEVICE_OPTIX)
info_cfg_option(WITH_CYCLES_DEVICE_CUDA)
info_cfg_option(WITH_CYCLES_CUDA_BINARIES)
info_cfg_option(WITH_CYCLES_DEVICE_HIP)
info_cfg_option(WITH_CYCLES_HIP_BINARIES)
info_cfg_option(WITH_CYCLES_DEVICE_ONEAPI)
info_cfg_option(WITH_CYCLES_ONEAPI_BINARIES)
endif()
endif()
info_cfg_text("")
message("${_config_msg}")

View File

@ -14,6 +14,20 @@ function(download_source dep)
else()
set(TARGET_URI https://svn.blender.org/svnroot/bf-blender/trunk/lib/packages/${TARGET_FILE})
endif()
# Validate all required variables are set and give an explicit error message
# rather than CMake erroring out later on with a more ambigious error.
if (NOT DEFINED TARGET_FILE)
message(FATAL_ERROR "${dep}_FILE variable not set")
endif()
if (NOT DEFINED TARGET_HASH)
message(FATAL_ERROR "${dep}_HASH variable not set")
endif()
if (NOT DEFINED TARGET_HASH_TYPE)
message(FATAL_ERROR "${dep}_HASH_TYPE variable not set")
endif()
if (NOT DEFINED TARGET_URI)
message(FATAL_ERROR "${dep}_URI variable not set")
endif()
set(TARGET_FILE ${PACKAGE_DIR}/${TARGET_FILE})
message("Checking source : ${dep} (${TARGET_FILE})")
if(NOT EXISTS ${TARGET_FILE})
@ -25,6 +39,36 @@ function(download_source dep)
SHOW_PROGRESS
)
endif()
if(EXISTS ${TARGET_FILE})
# Sometimes the download fails, but that is not a
# fail condition for "file(DOWNLOAD" it will warn about
# a crc mismatch and just carry on, we need to explicitly
# catch this and remove the bogus 0 byte file so we can
# retry without having to go find the file and manually
# delete it.
file (SIZE ${TARGET_FILE} TARGET_SIZE)
if(${TARGET_SIZE} EQUAL 0)
file(REMOVE ${TARGET_FILE})
message(FATAL_ERROR "for ${TARGET_FILE} file size 0, download likely failed, deleted...")
endif()
# If we are using sources from the blender repo also
# validate that the hashes match, this takes a
# little more time, but protects us when we are
# building a release package and one of the packages
# is missing or incorrect.
#
# For regular platform maintenaince this is not needed
# since the actual build of the dep will notify the
# platform maintainer if there is a problem with the
# source package and refuse to build.
if(NOT PACKAGE_USE_UPSTREAM_SOURCES)
file(${TARGET_HASH_TYPE} ${TARGET_FILE} LOCAL_HASH)
if(NOT ${TARGET_HASH} STREQUAL ${LOCAL_HASH})
message(FATAL_ERROR "${TARGET_FILE} ${TARGET_HASH_TYPE} mismatch\nExpected\t: ${TARGET_HASH}\nActual\t: ${LOCAL_HASH}")
endif()
endif()
endif()
endfunction(download_source)
download_source(ZLIB)
@ -51,7 +95,6 @@ download_source(OSL)
download_source(PYTHON)
download_source(TBB)
download_source(OPENVDB)
download_source(NANOVDB)
download_source(NUMPY)
download_source(LAME)
download_source(OGG)

View File

@ -7,7 +7,7 @@ ExternalProject_Add(external_wayland
PREFIX ${BUILD_DIR}/wayland
PATCH_COMMAND ${PATCH_CMD} -d ${BUILD_DIR}/wayland/src/external_wayland < ${PATCH_DIR}/wayland.diff
# Use `-E` so the `PKG_CONFIG_PATH` can be defined to link against our own LIBEXPAT.
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env PKG_CONFIG_PATH=${LIBDIR}/expat/lib/pkgconfig
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env PKG_CONFIG_PATH=${LIBDIR}/expat/lib/pkgconfig:${LIBDIR}/xml2/lib/pkgconfig:$PKG_CONFIG_PATH
meson --prefix ${LIBDIR}/wayland -Ddocumentation=false -Dtests=false -Dlibraries=false . ../external_wayland
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
@ -16,4 +16,5 @@ ExternalProject_Add(external_wayland
add_dependencies(
external_wayland
external_expat
external_xml2
)

View File

@ -40,15 +40,15 @@ ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,ver-xr-openxr:,ver-
force-all,force-python,force-boost,force-tbb,\
force-ocio,force-imath,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\
force-ffmpeg,force-opencollada,force-alembic,force-embree,force-oidn,force-usd,\
force-xr-openxr,force-level-zero,\
force-xr-openxr,force-level-zero, force-openpgl,\
build-all,build-python,build-boost,build-tbb,\
build-ocio,build-imath,build-openexr,build-oiio,build-llvm,build-osl,build-osd,build-openvdb,\
build-ffmpeg,build-opencollada,build-alembic,build-embree,build-oidn,build-usd,\
build-xr-openxr,build-level-zero,\
build-xr-openxr,build-level-zero, build-openpgl,\
skip-python,skip-boost,skip-tbb,\
skip-ocio,skip-imath,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,skip-openvdb,\
skip-ffmpeg,skip-opencollada,skip-alembic,skip-embree,skip-oidn,skip-usd,\
skip-xr-openxr,skip-level-zero \
skip-xr-openxr,skip-level-zero, skip-openpgl \
-- "$@" \
)
@ -136,7 +136,7 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
Build and install the OpenImageDenoise libraries.
--with-nanovdb
Build and install NanoVDB together with OpenVDB.
Build and install the NanoVDB branch of OpenVDB (instead of official release of OpenVDB).
--with-jack
Install the jack libraries.
@ -232,6 +232,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--build-level-zero=<ver>
Force the build of OneAPI Level Zero library.
--build-openpgl
Force the build of OpenPGL library.
Note about the --build-foo options:
* They force the script to prefer building dependencies rather than using available packages.
This may make things simpler and allow working around some distribution bugs, but on the other hand it will
@ -302,6 +305,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--force-level-zero=<ver>
Force the rebuild of OneAPI Level Zero library.
--force-openpgl
Force the rebuild of OpenPGL library.
Note about the --force-foo options:
* They obviously only have an effect if those libraries are built by this script
(i.e. if there is no available and satisfactory package)!
@ -363,7 +369,10 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
Unconditionally skip OpenXR-SDK installation/building.
--skip-level-zero=<ver>
Unconditionally skip OneAPI Level Zero installation/building.\""
Unconditionally skip OneAPI Level Zero installation/building.
--skip-openpgl
Unconditionally skip OpenPGL installation/building.\""
# ----------------------------------------------------------------------------
# Main Vars
@ -385,7 +394,7 @@ CLANG_FORMAT_VERSION="10.0"
CLANG_FORMAT_VERSION_MIN="6.0"
CLANG_FORMAT_VERSION_MEX="14.0"
PYTHON_VERSION="3.10.6"
PYTHON_VERSION="3.10.2"
PYTHON_VERSION_SHORT="3.10"
PYTHON_VERSION_MIN="3.10"
PYTHON_VERSION_MEX="3.12"
@ -425,7 +434,7 @@ PYTHON_ZSTANDARD_VERSION_MIN="0.15.2"
PYTHON_ZSTANDARD_VERSION_MEX="0.20.0"
PYTHON_ZSTANDARD_NAME="zstandard"
PYTHON_NUMPY_VERSION="1.23.2"
PYTHON_NUMPY_VERSION="1.22.0"
PYTHON_NUMPY_VERSION_MIN="1.14"
PYTHON_NUMPY_VERSION_MEX="2.0"
PYTHON_NUMPY_NAME="numpy"
@ -453,8 +462,8 @@ PYTHON_MODULES_PIP=(
)
BOOST_VERSION="1.80.0"
BOOST_VERSION_SHORT="1.80"
BOOST_VERSION="1.78.0"
BOOST_VERSION_SHORT="1.78"
BOOST_VERSION_MIN="1.49"
BOOST_VERSION_MEX="2.0"
BOOST_FORCE_BUILD=false
@ -496,7 +505,7 @@ OPENEXR_FORCE_REBUILD=false
OPENEXR_SKIP=false
_with_built_openexr=false
OIIO_VERSION="2.3.18.0"
OIIO_VERSION="2.3.13.0"
OIIO_VERSION_SHORT="2.3"
OIIO_VERSION_MIN="2.1.12"
OIIO_VERSION_MEX="2.4.0"
@ -534,10 +543,10 @@ OSD_SKIP=false
# OpenVDB needs to be compiled for now
OPENVDB_BLOSC_VERSION="1.21.1"
OPENVDB_VERSION="9.1.0"
OPENVDB_VERSION_SHORT="9.1"
OPENVDB_VERSION="9.0.0"
OPENVDB_VERSION_SHORT="9.0"
OPENVDB_VERSION_MIN="9.0"
OPENVDB_VERSION_MEX="9.2"
OPENVDB_VERSION_MEX="9.1"
OPENVDB_FORCE_BUILD=false
OPENVDB_FORCE_REBUILD=false
OPENVDB_SKIP=false
@ -593,6 +602,14 @@ LEVEL_ZERO_FORCE_BUILD=false
LEVEL_ZERO_FORCE_REBUILD=false
LEVEL_ZERO_SKIP=false
OPENPGL_VERSION="0.3.1"
OPENPGL_VERSION_SHORT="0.3"
OPENPGL_VERSION_MIN="0.3.1"
OPENPGL_VERSION_MEX="0.3.2"
OPENPGL_FORCE_BUILD=false
OPENPGL_FORCE_REBUILD=false
OPENPGL_SKIP=false
XR_OPENXR_VERSION="1.0.22"
XR_OPENXR_VERSION_SHORT="1.0"
XR_OPENXR_VERSION_MIN="1.0.8"
@ -827,6 +844,7 @@ while true; do
USD_FORCE_BUILD=true
XR_OPENXR_FORCE_BUILD=true
LEVEL_ZERO_FORCE_BUILD=true
OPENPGL_FORCE_BUILD=true
shift; continue
;;
--build-python)
@ -887,6 +905,9 @@ while true; do
--build-level-zero)
LEVEL_ZERO_FORCE_BUILD=true; shift; continue
;;
--build-openpgl)
OPENPGL_FORCE_BUILD=true; shift; continue
;;
--force-all)
PYTHON_FORCE_REBUILD=true
BOOST_FORCE_REBUILD=true
@ -907,6 +928,7 @@ while true; do
USD_FORCE_REBUILD=true
XR_OPENXR_FORCE_REBUILD=true
LEVEL_ZERO_FORCE_REBUILD=true
OPENPGL_FORCE_REBUILD=true
shift; continue
;;
--force-python)
@ -967,6 +989,9 @@ while true; do
--force-level-zero)
LEVEL_ZERO_FORCE_REBUILD=true; shift; continue
;;
--force-openpgl)
OPENPGL_FORCE_REBUILD=true; shift; continue
;;
--skip-python)
PYTHON_SKIP=true; shift; continue
;;
@ -1024,6 +1049,9 @@ while true; do
--skip-level-zero)
LEVEL_ZERO_SKIP=true; shift; continue
;;
--skip-openpgl)
OPENPGL_SKIP=true; shift; continue
;;
--)
# no more arguments to parse
break
@ -1173,6 +1201,9 @@ XR_OPENXR_REPO_BRANCH="master"
LEVEL_ZERO_SOURCE=("https://github.com/oneapi-src/level-zero/archive/refs/tags/v${LEVEL_ZERO_VERSION}.tar.gz")
OPENPGL_USE_REPO=false
OPENPGL_SOURCE=( "https://github.com/OpenPathGuidingLibrary/openpgl/archive/refs/tags/v${OPENPGL_VERSION}-beta.tar.gz" )
FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
# C++11 is required now
@ -1227,7 +1258,8 @@ You may also want to build them yourself (optional ones are [between brackets]):
* [Alembic $ALEMBIC_VERSION] (from $ALEMBIC_SOURCE).
* [Universal Scene Description $USD_VERSION] (from $USD_SOURCE).
* [OpenXR-SDK $XR_OPENXR_VERSION] (from $XR_OPENXR_SOURCE).
* [OneAPI Level Zero $LEVEL_ZERO_VERSION] (from $LEVEL_ZERO_SOURCE).\""
* [OneAPI Level Zero $LEVEL_ZERO_VERSION] (from $LEVEL_ZERO_SOURCE).
* [OpenPGL $OPENPGL_VERSION] (from $OPENPGL_SOURCE).\""
if [ "$DO_SHOW_DEPS" = true ]; then
PRINT ""
@ -1661,6 +1693,7 @@ _update_deps_tbb() {
USD_FORCE_BUILD=true
EMBREE_FORCE_BUILD=true
OIDN_FORCE_BUILD=true
OPENPGL_FORCE_BUILD=true
fi
if [ "$2" = true ]; then
OSD_FORCE_REBUILD=true
@ -1668,6 +1701,7 @@ _update_deps_tbb() {
USD_FORCE_REBUILD=true
EMBREE_FORCE_REBUILD=true
OIDN_FORCE_REBUILD=true
OPENPGL_FORCE_REBUILD=true
fi
}
@ -2919,10 +2953,6 @@ compile_OPENVDB() {
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D USE_STATIC_DEPENDENCIES=OFF"
cmake_d="$cmake_d -D OPENVDB_BUILD_BINARIES=OFF"
# Unfortunately OpenVDB currently forces using recent oneTBB over older versions when it finds it,
# even when TBB_ROOT is specified. So have to prevent any check for system library -
# in the hope it will not break in some other cases.
cmake_d="$cmake_d -D DISABLE_CMAKE_SEARCH_PATHS=ON"
if [ "$WITH_NANOVDB" = true ]; then
cmake_d="$cmake_d -D USE_NANOVDB=ON"
@ -2935,6 +2965,7 @@ compile_OPENVDB() {
cmake_d="$cmake_d -D Boost_USE_MULTITHREADED=ON"
cmake_d="$cmake_d -D Boost_NO_SYSTEM_PATHS=ON"
cmake_d="$cmake_d -D Boost_NO_BOOST_CMAKE=ON"
cmake_d="$cmake_d -D Boost_NO_BOOST_CMAKE=ON"
fi
if [ -d $INST/tbb ]; then
cmake_d="$cmake_d -D TBB_ROOT=$INST/tbb"
@ -3198,7 +3229,7 @@ _init_opencollada() {
_inst_shortcut=$INST/opencollada
}
_update_deps_opencollada() {
_update_deps_collada() {
:
}
@ -3309,7 +3340,12 @@ _init_embree() {
}
_update_deps_embree() {
:
if [ "$1" = true ]; then
OPENPGL_FORCE_BUILD=true
fi
if [ "$2" = true ]; then
OPENPGL_FORCE_REBUILD=true
fi
}
clean_Embree() {
@ -3328,7 +3364,7 @@ compile_Embree() {
fi
# To be changed each time we make edits that would modify the compiled results!
embree_magic=11
embree_magic=12
_init_embree
# Force having own builds for the dependencies.
@ -3965,6 +4001,112 @@ compile_Level_Zero() {
}
# ----------------------------------------------------------------------------
# Build OpenPGL
_init_openpgl() {
_src=$SRC/openpgl-$OPENPGL_VERSION
_git=false
_inst=$INST/openpgl-$OPENPGL_VERSION_SHORT
_inst_shortcut=$INST/openpgl
}
_update_deps_openpgl() {
:
}
clean_OpenPGL() {
_init_openpgl
if [ -d $_inst ]; then
# Force rebuilding the dependencies if needed.
_update_deps_openpgl false true
fi
_clean
}
compile_OpenPGL() {
if [ "$NO_BUILD" = true ]; then
WARNING "--no-build enabled, OpenPGL will not be compiled!"
return
fi
# To be changed each time we make edits that would modify the compiled results!
openpgl_magic=1
_init_openpgl
# Force having own builds for the dependencies.
_update_deps_openpgl true false
# Clean install if needed!
magic_compile_check openpgl-$OPENPGL_VERSION $openpgl_magic
if [ $? -eq 1 -o "$OPENPGL_FORCE_REBUILD" = true ]; then
clean_OpenPGL
fi
if [ ! -d $_inst ]; then
INFO "Building OpenPGL-$OPENPGL_VERSION"
# Force rebuilding the dependencies.
_update_deps_openpgl true true
prepare_inst
if [ ! -d $_src ]; then
mkdir -p $SRC
download OPENPGL_SOURCE[@] "$_src.tar.gz"
INFO "Unpacking OpenPGL-$OPENPGL_VERSION"
tar -C $SRC --transform "s,(.*/?)openpgl-$OPENPGL_VERSION-beta[^/]*(.*),\1openpgl-$OPENPGL_VERSION\2,x" \
-xf $_src.tar.gz
fi
cd $_src
INFO "$_src"
# Always refresh the whole build!
if [ -d build ]; then
rm -rf build
fi
mkdir build
cd build
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D OPENPGL_BUILD_STATIC=OFF"
cmake_d="$cmake_d -D OPENPGL_BUILD_PYTHON=OFF"
cmake_d="$cmake_d -D EMBREE_ISPC_SUPPORT=OFF"
if [ -d $INST/tbb ]; then
cmake_d="$cmake_d -D OPENPGL_TBB_ROOT=$INST/tbb"
cmake_d="$cmake_d -D TBB_ROOT=$INST/tbb"
fi
cmake $cmake_d ../
make -j$THREADS && make install
make clean
if [ ! -d $_inst ]; then
ERROR "OpenPGL-$OPENPGL_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set openpgl-$OPENPGL_VERSION $openpgl_magic
cd $CWD
INFO "Done compiling OpenPGL-$OPENPGL_VERSION!"
else
INFO "Own OpenPGL-$OPENPGL_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-openpgl option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "openpgl"
}
# ----------------------------------------------------------------------------
# Install on DEB-like
@ -4067,7 +4209,8 @@ install_DEB() {
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
libopenal-dev libepoxy-dev yasm \
libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev \
libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev libzstd-dev libpystring-dev"
libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev libzstd-dev libpystring-dev \
libglfw3-dev"
VORBIS_USE=true
OGG_USE=true
@ -4597,6 +4740,18 @@ install_DEB() {
PRINT ""
compile_Level_Zero
fi
PRINT ""
if [ "$OPENPGL_SKIP" = true ]; then
WARNING "Skipping OpenPGL installation, as requested..."
elif [ "$OPENPGL_FORCE_BUILD" = true ]; then
INFO "Forced OpenPGL building, as requested..."
compile_OpenPGL
else
# No package currently!
PRINT ""
compile_OpenPGL
fi
}
@ -5304,6 +5459,18 @@ install_RPM() {
PRINT ""
compile_Level_Zero
fi
PRINT ""
if [ "$OPENPGL_SKIP" = true ]; then
WARNING "Skipping OpenPGL installation, as requested..."
elif [ "$OPENPGL_FORCE_BUILD" = true ]; then
INFO "Forced OpenPGL building, as requested..."
compile_OpenPGL
else
# No package currently!
PRINT ""
compile_OpenPGL
fi
}
@ -5900,6 +6067,18 @@ install_ARCH() {
PRINT ""
compile_Level_Zero
fi
PRINT ""
if [ "$OPENPGL_SKIP" = true ]; then
WARNING "Skipping OpenPGL installation, as requested..."
elif [ "$OPENPGL_FORCE_BUILD" = true ]; then
INFO "Forced OpenPGL building, as requested..."
compile_OpenPGL
else
# No package currently!
PRINT ""
compile_OpenPGL
fi
}
@ -6082,6 +6261,14 @@ install_OTHER() {
INFO "Forced Level Zero building, as requested..."
compile_Level_Zero
fi
PRINT ""
if [ "$OPENPGL_SKIP" = true ]; then
WARNING "Skipping OpenPGL installation, as requested..."
elif [ "$OPENPGL_FORCE_BUILD" = true ]; then
INFO "Forced OpenPGL building, as requested..."
compile_OpenPGL
fi
}
# ----------------------------------------------------------------------------
@ -6099,7 +6286,7 @@ print_info() {
_buildargs="-U *SNDFILE* -U PYTHON* -U *BOOST* -U *Boost* -U *TBB*"
_buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CLANG* -U *CYCLES*"
_buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *BLOSC* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC* -U *USD*"
_buildargs="$_buildargs -U *EMBREE* -U *OPENIMAGEDENOISE* -U *OPENXR*"
_buildargs="$_buildargs -U *EMBREE* -U *OPENIMAGEDENOISE* -U *OPENXR* -U *OPENPGL*"
_1="-D WITH_CODEC_SNDFILE=ON"
PRINT " $_1"
@ -6218,7 +6405,7 @@ print_info() {
fi
if [ -d $INST/nanovdb ]; then
_1="-D WITH_NANOVDB=ON"
_2="-D NANOVDB_ROOT_DIR=$INST/openvdb"
_2="-D NANOVDB_ROOT_DIR=$INST/nanovdb"
PRINT " $_1"
PRINT " $_2"
_buildargs="$_buildargs $_1 $_2"
@ -6330,6 +6517,16 @@ print_info() {
#~ fi
#~ fi
if [ "$OPENPGL_SKIP" = false ]; then
if [ -d $INST/openpgl ]; then
_1="-D openpgl_DIR=$INST/openpgl/lib/cmake/openpgl-$OPENPGL_VERSION"
_2="-D WITH_CYCLES_PATH_GUIDING=ON"
PRINT " $_1"
PRINT " $_2"
_buildargs="$_buildargs $_1 $_2"
fi
fi
PRINT ""
PRINT "Or even simpler, just run (in your blender-source dir):"
PRINT " make -j$THREADS BUILD_CMAKE_ARGS=\"$_buildargs\""

View File

@ -429,6 +429,18 @@ if(WITH_HARU)
endif()
endif()
if(WITH_CYCLES_PATH_GUIDING)
find_package(openpgl QUIET)
if(openpgl_FOUND)
get_target_property(OPENPGL_LIBRARIES openpgl::openpgl LOCATION)
get_target_property(OPENPGL_INCLUDE_DIR openpgl::openpgl INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "Found OpenPGL: ${OPENPGL_LIBRARIES}")
else()
set(WITH_CYCLES_PATH_GUIDING OFF)
message(STATUS "OpenPGL not found, disabling WITH_CYCLES_PATH_GUIDING")
endif()
endif()
set(ZSTD_ROOT_DIR ${LIBDIR}/zstd)
find_package(Zstd REQUIRED)

View File

@ -584,6 +584,18 @@ if(WITH_HARU)
endif()
endif()
if(WITH_CYCLES_PATH_GUIDING)
find_package_wrapper(openpgl)
if(openpgl_FOUND)
get_target_property(OPENPGL_LIBRARIES openpgl::openpgl LOCATION)
get_target_property(OPENPGL_INCLUDE_DIR openpgl::openpgl INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "Found OpenPGL: ${OPENPGL_LIBRARIES}")
else()
set(WITH_CYCLES_PATH_GUIDING OFF)
message(STATUS "OpenPGL not found, disabling WITH_CYCLES_PATH_GUIDING")
endif()
endif()
if(EXISTS ${LIBDIR})
without_system_libs_end()
endif()

View File

@ -936,6 +936,19 @@ if(WITH_HARU)
endif()
endif()
if(WITH_CYCLES_PATH_GUIDING)
find_package(openpgl QUIET)
if(openpgl_FOUND)
get_target_property(OPENPGL_LIBRARIES_RELEASE openpgl::openpgl LOCATION_RELEASE)
get_target_property(OPENPGL_LIBRARIES_DEBUG openpgl::openpgl LOCATION_DEBUG)
set(OPENPGL_LIBRARIES optimized ${OPENPGL_LIBRARIES_RELEASE} debug ${OPENPGL_LIBRARIES_DEBUG})
get_target_property(OPENPGL_INCLUDE_DIR openpgl::openpgl INTERFACE_INCLUDE_DIRECTORIES)
else()
set(WITH_CYCLES_PATH_GUIDING OFF)
message(STATUS "OpenPGL not found, disabling WITH_CYCLES_PATH_GUIDING")
endif()
endif()
set(ZSTD_INCLUDE_DIRS ${LIBDIR}/zstd/include)
set(ZSTD_LIBRARIES ${LIBDIR}/zstd/lib/zstd_static.lib)

View File

@ -1880,6 +1880,12 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
layout.prop(rd, "use_bake_multires")
layout.prop(cscene, "bake_type")
if not rd.use_bake_multires and cscene.bake_type not in {
"AO", "POSITION", "NORMAL", "UV", "ROUGHNESS", "ENVIRONMENT"}:
row = layout.row()
row.prop(cbk, "view_from")
row.active = scene.camera is not None
class CYCLES_RENDER_PT_bake_influence(CyclesButtonsPanel, Panel):
bl_label = "Influence"

View File

@ -2,6 +2,7 @@
* Copyright 2011-2022 Blender Foundation */
#include "scene/camera.h"
#include "scene/bake.h"
#include "scene/scene.h"
#include "blender/sync.h"
@ -592,6 +593,11 @@ void BlenderSync::sync_camera(BL::RenderSettings &b_render,
blender_camera_from_object(&bcam, b_engine, b_ob);
b_engine.camera_model_matrix(b_ob, bcam.use_spherical_stereo, b_ob_matrix);
bcam.matrix = get_transform(b_ob_matrix);
scene->bake_manager->set_use_camera(b_render.bake().view_from() ==
BL::BakeSettings::view_from_ACTIVE_CAMERA);
}
else {
scene->bake_manager->set_use_camera(false);
}
/* sync */

View File

@ -60,7 +60,8 @@ BlenderSession::BlenderSession(BL::RenderEngine &b_engine,
height(0),
preview_osl(preview_osl),
python_thread_state(NULL),
use_developer_ui(false)
use_developer_ui(b_userpref.experimental().use_cycles_debug() &&
b_userpref.view().show_developer_ui())
{
/* offline render */
background = true;

View File

@ -104,10 +104,6 @@ if(CYCLES_STANDALONE_REPOSITORY)
else()
unset(_cycles_lib_dir)
endif()
else()
if(EXISTS ${LIBDIR})
set(_cycles_lib_dir ${LIBDIR})
endif()
endif()
###########################################################################
@ -277,8 +273,8 @@ endif()
# OpenPGL
###########################################################################
if(WITH_CYCLES_PATH_GUIDING)
if(EXISTS ${_cycles_lib_dir})
if(CYCLES_STANDALONE_REPOSITORY AND WITH_CYCLES_PATH_GUIDING)
if(NOT openpgl_DIR AND EXISTS ${_cycles_lib_dir})
set(openpgl_DIR ${_cycles_lib_dir}/openpgl/lib/cmake/openpgl)
endif()
@ -545,7 +541,7 @@ endif()
if(CYCLES_STANDALONE_REPOSITORY)
if((WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI) OR
WITH_CYCLES_HYDRA_RENDER_DELEGATE)
WITH_CYCLES_HYDRA_RENDER_DELEGATE)
if(MSVC AND EXISTS ${_cycles_lib_dir})
set(Epoxy_LIBRARIES "${_cycles_lib_dir}/epoxy/lib/epoxy.lib")
set(Epoxy_INCLUDE_DIRS "${_cycles_lib_dir}/epoxy/include")

View File

@ -727,14 +727,27 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
${SRC_UTIL_HEADERS}
)
set (ONEAPI_OFFLINE_COMPILER_PARALLEL_JOBS 1)
if (WITH_CYCLES_ONEAPI_BINARIES)
cmake_host_system_information(RESULT AVAILABLE_MEMORY_AMOUNT QUERY AVAILABLE_PHYSICAL_MEMORY)
# Conservative value of peak consumption here, just to be fully sure that other backend compilers will have enough memory as well
set(ONEAPI_GPU_COMPILER_MEMORY_AT_PEAK_MB 8150)
math(EXPR ONEAPI_OFFLINE_COMPILER_PARALLEL_JOBS "${AVAILABLE_MEMORY_AMOUNT} / ${ONEAPI_GPU_COMPILER_MEMORY_AT_PEAK_MB}")
if (ONEAPI_OFFLINE_COMPILER_PARALLEL_JOBS LESS 1)
set(ONEAPI_OFFLINE_COMPILER_PARALLEL_JOBS 1)
endif()
message(STATUS "${ONEAPI_OFFLINE_COMPILER_PARALLEL_JOBS} instance(s) of oneAPI offline compiler will be used.")
endif()
# SYCL_CPP_FLAGS is a variable that the user can set to pass extra compiler options
set(sycl_compiler_flags
${CMAKE_CURRENT_SOURCE_DIR}/${SRC_KERNEL_DEVICE_ONEAPI}
-fsycl
-fsycl-unnamed-lambda
-fdelayed-template-parsing
-mllvm -inlinedefault-threshold=300
-mllvm -inlinehint-threshold=400
-mllvm -inlinedefault-threshold=250
-mllvm -inlinehint-threshold=350
-fsycl-device-code-split=per_kernel
-fsycl-max-parallel-link-jobs=${ONEAPI_OFFLINE_COMPILER_PARALLEL_JOBS}
-shared
-DWITH_ONEAPI
-ffast-math

View File

@ -501,6 +501,11 @@ ccl_device_forceinline bool guiding_phase_init(KernelGlobals kg,
ccl_private float &rand)
{
#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4
/* we do not need to guide almost delta phase functions */
if (fabsf(g) >= 0.99f) {
return false;
}
if (kg->opgl_volume_sampling_distribution->Init(
kg->opgl_guiding_field, guiding_point3f(P), rand, true)) {
kg->opgl_volume_sampling_distribution->ApplySingleLobeHenyeyGreensteinProduct(guiding_vec3f(D),

View File

@ -210,8 +210,51 @@ ccl_device bool integrator_init_from_bake(KernelGlobals kg,
/* Setup ray. */
Ray ray ccl_optional_struct_init;
ray.P = P + N;
ray.D = -N;
if (kernel_data.bake.use_camera) {
float3 D = camera_direction_from_point(kg, P);
const float DN = dot(D, N);
/* Nudge camera direction, so that the faces facing away from the camera still have
* somewhat usable shading. (Otherwise, glossy faces would be simply black.)
*
* The surface normal offset affects smooth surfaces. Lower values will make
* smooth surfaces more faceted, but higher values may show up from the camera
* at grazing angles.
*
* This value can actually be pretty high before it's noticeably wrong. */
const float surface_normal_offset = 0.2f;
/* Keep the ray direction at least `surface_normal_offset` "above" the smooth normal. */
if (DN <= surface_normal_offset) {
D -= N * (DN - surface_normal_offset);
D = normalize(D);
}
/* On the backside, just lerp towards the surface normal for the ray direction,
* as DN goes from 0.0 to -1.0. */
if (DN <= 0.0f) {
D = normalize(mix(D, N, -DN));
}
/* We don't want to bake the back face, so make sure the ray direction never
* goes behind the geometry (flat) normal. This is a failsafe, and should rarely happen. */
const float true_normal_epsilon = 0.00001f;
if (dot(D, Ng) <= true_normal_epsilon) {
D -= Ng * (dot(D, Ng) - true_normal_epsilon);
D = normalize(D);
}
ray.P = P + D;
ray.D = -D;
}
else {
ray.P = P + N;
ray.D = -N;
}
ray.tmin = 0.0f;
ray.tmax = FLT_MAX;
ray.time = 0.5f;

View File

@ -59,6 +59,13 @@ ccl_device_inline void path_state_init_integrator(KernelGlobals kg,
#ifdef __PATH_GUIDING__
INTEGRATOR_STATE_WRITE(state, path, unguided_throughput) = 1.0f;
INTEGRATOR_STATE_WRITE(state, guiding, path_segment) = nullptr;
INTEGRATOR_STATE_WRITE(state, guiding, use_surface_guiding) = false;
INTEGRATOR_STATE_WRITE(state, guiding, sample_surface_guiding_rand) = 0.5f;
INTEGRATOR_STATE_WRITE(state, guiding, surface_guiding_sampling_prob) = 0.0f;
INTEGRATOR_STATE_WRITE(state, guiding, bssrdf_sampling_prob) = 0.0f;
INTEGRATOR_STATE_WRITE(state, guiding, use_volume_guiding) = false;
INTEGRATOR_STATE_WRITE(state, guiding, sample_volume_guiding_rand) = 0.5f;
INTEGRATOR_STATE_WRITE(state, guiding, volume_guiding_sampling_prob) = 0.0f;
#endif
#ifdef __MNEE__

View File

@ -1160,7 +1160,7 @@ typedef struct KernelBake {
int use;
int object_index;
int tri_offset;
int pad1;
int use_camera;
} KernelBake;
static_assert_align(KernelBake, 16);

View File

@ -16,6 +16,7 @@ CCL_NAMESPACE_BEGIN
BakeManager::BakeManager()
{
need_update_ = true;
use_camera_ = false;
}
BakeManager::~BakeManager()
@ -38,6 +39,14 @@ void BakeManager::set(Scene *scene, const std::string &object_name_)
need_update_ = true;
}
void BakeManager::set_use_camera(const bool use_camera)
{
if (use_camera_ != use_camera) {
use_camera_ = use_camera;
need_update_ = true;
}
}
void BakeManager::device_update(Device * /*device*/,
DeviceScene *dscene,
Scene *scene,
@ -49,6 +58,8 @@ void BakeManager::device_update(Device * /*device*/,
KernelBake *kbake = &dscene->data.bake;
memset(kbake, 0, sizeof(*kbake));
kbake->use_camera = use_camera_;
if (!object_name.empty()) {
scoped_callback_timer timer([scene](double time) {
if (scene->update_stats) {

View File

@ -20,6 +20,8 @@ class BakeManager {
void set(Scene *scene, const std::string &object_name);
bool get_baking() const;
void set_use_camera(bool use_camera);
void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress);
void device_free(Device *device, DeviceScene *dscene);
@ -30,6 +32,7 @@ class BakeManager {
private:
bool need_update_;
std::string object_name;
bool use_camera_;
};
CCL_NAMESPACE_END

View File

@ -31,7 +31,7 @@ ccl_device_forceinline float transform_inverse_dot(const float3 a, const float3
return dot(a, b);
}
ccl_device_inline Transform transform_inverse_impl(const Transform tfm)
ccl_device_forceinline Transform transform_inverse_impl(const Transform tfm)
{
/* This implementation matches the one in Embree exactly, to ensure consistent
* results with the ray intersection of instances. */

View File

@ -30,13 +30,19 @@ extern GHOST_TSuccess GHOST_DisposeSystemPaths(void);
/**
* Determine the base dir in which shared resources are located. It will first try to use
* "unpack and run" path, then look for properly installed path, including versioning.
* \return Unsigned char string pointing to system dir (eg /usr/share/blender/).
* \return Unsigned char string pointing to system dir (eg `/usr/share/blender/`).
*
* \note typically: `BKE_appdir_resource_path_id(BLENDER_RESOURCE_PATH_SYSTEM, false)` should be
* used instead of this function directly as it ensures environment variable overrides are used.
*/
extern const char *GHOST_getSystemDir(int version, const char *versionstr);
/**
* Determine the base dir in which user configuration is stored, including versioning.
* \return Unsigned char string pointing to user dir (eg ~).
*
* \note typically: `BKE_appdir_resource_path_id(BLENDER_RESOURCE_PATH_USER, false)` should be
* used instead of this function directly as it ensures environment variable overrides are used.
*/
extern const char *GHOST_getUserDir(int version, const char *versionstr);

View File

@ -178,24 +178,30 @@ template<typename Mesh> class Mikktspace {
// put the degenerate triangles last.
degenPrologue();
// evaluate triangle level attributes and neighbor list
initTriangle();
if (nrTriangles == 0) {
// No point in building tangents if there are no non-degenerate triangles, so just zero them
tSpaces.resize(nrTSpaces);
}
else {
// evaluate triangle level attributes and neighbor list
initTriangle();
// match up edge pairs
buildNeighbors();
// match up edge pairs
buildNeighbors();
// based on the 4 rules, identify groups based on connectivity
build4RuleGroups();
// based on the 4 rules, identify groups based on connectivity
build4RuleGroups();
// make tspaces, each group is split up into subgroups.
// Finally a tangent space is made for every resulting subgroup
generateTSpaces();
// make tspaces, each group is split up into subgroups.
// Finally a tangent space is made for every resulting subgroup
generateTSpaces();
// degenerate quads with one good triangle will be fixed by copying a space from
// the good triangle to the coinciding vertex.
// all other degenerate triangles will just copy a space from any good triangle
// with the same welded index in vertices[].
degenEpilogue();
// degenerate quads with one good triangle will be fixed by copying a space from
// the good triangle to the coinciding vertex.
// all other degenerate triangles will just copy a space from any good triangle
// with the same welded index in vertices[].
degenEpilogue();
}
uint index = 0;
for (uint f = 0; f < nrFaces; f++) {

@ -1 +1 @@
Subproject commit 726d08c9036b939f46b59bceb72a61e3102600cc
Subproject commit eb09be71a96c4fe910fdc43373be5ec08b419d2c

View File

@ -978,17 +978,30 @@ def dump_messages(do_messages, do_checks, settings):
# Get strings from addons' bl_info.
import addon_utils
for module in addon_utils.modules():
if module.bl_info['support'] != 'OFFICIAL':
# Only process official add-ons, i.e. those marked as 'OFFICIAL' and
# existing in the system add-ons directory (not user-installed ones).
if (module.bl_info['support'] != 'OFFICIAL'
or not bpy.path.is_subdir(module.__file__, bpy.utils.system_resource('SCRIPTS'))):
continue
dump_addon_bl_info(msgs, reports, module, settings)
# Get strings from addons' categories.
system_categories = set()
for module in addon_utils.modules():
if bpy.path.is_subdir(module.__file__, bpy.utils.system_resource('SCRIPTS')):
system_categories.add(module.bl_info['category'])
for uid, label, tip in bpy.types.WindowManager.addon_filter.keywords['items'](
bpy.context.window_manager,
bpy.context,
):
process_msg(msgs, settings.DEFAULT_CONTEXT, label, "Add-ons' categories", reports, None, settings)
if tip:
if label in system_categories:
# Only process add-on if it a system one (i.e shipped with Blender). Also,
# we do want to translate official categories, even if they have no official add-ons,
# hence the different test than below.
process_msg(msgs, settings.DEFAULT_CONTEXT, label, "Add-ons' categories", reports, None, settings)
elif tip:
# Only special categories get a tip (All and User).
process_msg(msgs, settings.DEFAULT_CONTEXT, label, "Add-ons' categories", reports, None, settings)
process_msg(msgs, settings.DEFAULT_CONTEXT, tip, "Add-ons' categories", reports, None, settings)
# Get strings specific to translations' menu.

View File

@ -260,9 +260,9 @@ PYGETTEXT_KEYWORDS = (() +
# NOTE: regex is a bit more complex than it would need too. Since the actual
# identifier (`B_UNIT_DEF_`) is at the end, if it's simpler/too general it
# becomes extremely slow to process some (unrelated) source files.
((r"\{(?:(?:\s*\"[^\"',]+\"\s*,)|(?:\s*NULL\s*,)){4}\s*" +
((r"\{(?:(?:\s*\"[^\",]+\"\s*,)|(?:\s*\"\\\"\",)|(?:\s*NULL\s*,)){4}\s*" +
_msg_re + r"\s*,(?:(?:\s*\"[^\"',]+\"\s*,)|(?:\s*NULL\s*,))(?:[^,]+,){2}"
+ "\s*B_UNIT_DEF_[_A-Z]+\s*\}"),) +
+ "(?:\|?\s*B_UNIT_DEF_[_A-Z]+\s*)+\}"),) +
tuple((r"{}\(\s*" + _msg_re + r"\s*,\s*(?:" +
r"\s*,\s*)?(?:".join(_ctxt_re_gen(i) for i in range(PYGETTEXT_MAX_MULTI_CTXT)) + r")?\s*\)").format(it)

View File

@ -142,8 +142,17 @@ def object_data_add(context, obdata, operator=None, name=None):
bpy.ops.object.mode_set(mode='EDIT')
else:
layer.objects.active = obj_new
if obdata and context.preferences.edit.use_enter_edit_mode:
bpy.ops.object.mode_set(mode='EDIT')
if context.preferences.edit.use_enter_edit_mode:
if obdata and obdata.library is None:
obtype = obj_new.type
mode = None
if obtype in {'ARMATURE', 'CURVE', 'CURVES', 'FONT', 'LATTICE', 'MESH', 'META', 'SURFACE'}:
mode = 'EDIT'
elif obtype == 'GPENCIL':
mode = 'EDIT_GPENCIL'
if mode is not None:
bpy.ops.object.mode_set(mode=mode)
return obj_new

View File

@ -5069,8 +5069,8 @@ def km_sculpt(params):
{"properties": [("mode", 'TOGGLE')]}),
("sculpt.face_set_change_visibility", {"type": 'H', "value": 'PRESS', "shift": True},
{"properties": [("mode", 'HIDE_ACTIVE')]}),
("sculpt.face_set_change_visibility", {"type": 'H', "value": 'PRESS', "alt": True},
{"properties": [("mode", 'SHOW_ALL')]}),
("sculpt.reveal_all", {"type": 'H', "value": 'PRESS', "alt": True},
{"properties": []}),
("sculpt.face_set_edit", {"type": 'W', "value": 'PRESS', "ctrl": True},
{"properties": [("mode", 'GROW')]}),

View File

@ -4,6 +4,9 @@ from __future__ import annotations
import bpy
from bpy.types import Operator
from bpy.app.translations import pgettext_data as data_
from bpy_extras.asset_utils import (
SpaceAssetInfo,
)
@ -33,7 +36,7 @@ class ASSET_OT_tag_add(AssetBrowserMetadataOperator, Operator):
def execute(self, context):
active_asset = SpaceAssetInfo.get_active_asset(context)
active_asset.tags.new("Tag")
active_asset.tags.new(data_("Tag"))
return {'FINISHED'}

View File

@ -62,6 +62,7 @@ class NODE_MT_geometry_node_GEO_CURVE(Menu):
node_add_menu.add_node_type(layout, "GeometryNodeSplineParameter")
node_add_menu.add_node_type(layout, "GeometryNodeInputSplineResolution")
layout.separator()
node_add_menu.add_node_type(layout, "GeometryNodeSetCurveNormal")
node_add_menu.add_node_type(layout, "GeometryNodeSetCurveRadius")
node_add_menu.add_node_type(layout, "GeometryNodeSetCurveTilt")
node_add_menu.add_node_type(layout, "GeometryNodeSetCurveHandlePositions")
@ -93,7 +94,7 @@ class NODE_MT_geometry_node_curve_topology(Menu):
def draw(self, _context):
layout = self.layout
node_add_menu.add_node_type(layout, "GeometryNodeInputControlPointNeighbors")
node_add_menu.add_node_type(layout, "GeometryNodeOffsetPointInCurve")
node_add_menu.add_node_type(layout, "GeometryNodeCurveOfPoint")
node_add_menu.add_node_type(layout, "GeometryNodePointsOfCurve")
@ -198,6 +199,7 @@ class NODE_MT_geometry_node_GEO_MESH(Menu):
node_add_menu.add_node_type(layout, "GeometryNodeMeshToPoints")
node_add_menu.add_node_type(layout, "GeometryNodeMeshToVolume")
node_add_menu.add_node_type(layout, "GeometryNodeSampleNearestSurface")
node_add_menu.add_node_type(layout, "GeometryNodeSampleUVSurface")
node_add_menu.add_node_type(layout, "GeometryNodeScaleElements")
node_add_menu.add_node_type(layout, "GeometryNodeSplitEdges")
node_add_menu.add_node_type(layout, "GeometryNodeSubdivideMesh")
@ -232,6 +234,7 @@ class NODE_MT_category_PRIMITIVES_MESH(Menu):
node_add_menu.add_node_type(layout, "GeometryNodeMeshIcoSphere")
node_add_menu.add_node_type(layout, "GeometryNodeMeshCircle")
node_add_menu.add_node_type(layout, "GeometryNodeMeshLine")
node_add_menu.add_node_type(layout, "GeometryNodeMeshUVSphere")
class NODE_MT_geometry_node_mesh_topology(Menu):

View File

@ -3,7 +3,10 @@ import bpy
from bpy.types import Menu, Panel, UIList
from bl_ui.utils import PresetPanel
from bpy.app.translations import pgettext_tip as tip_
from bpy.app.translations import (
contexts as i18n_contexts,
pgettext_tip as tip_,
)
class RENDER_PT_format_presets(PresetPanel, Panel):

View File

@ -1679,7 +1679,7 @@ class PARTICLE_PT_children_roughness(ParticleButtonsPanel, Panel):
if part.use_roughness_curve:
sub = col.column()
sub.template_curve_mapping(part, "roughness_curve")
sub.prop(part, "roughness_1", text=iface_("Roughness", i18n_contexts.id_particlesettings))
sub.prop(part, "roughness_1", text="Roughness", text_ctxt=i18n_contexts.id_particlesettings)
sub.prop(part, "roughness_1_size", text="Size")
else:
sub = col.column(align=True)

View File

@ -2,7 +2,10 @@
import bpy
from bpy.types import Header, Menu, Panel
from bpy.app.translations import pgettext_iface as iface_
from bpy.app.translations import (
pgettext_iface as iface_,
contexts as i18n_contexts,
)
class TOPBAR_HT_upper_bar(Header):
@ -269,7 +272,7 @@ class TOPBAR_MT_file(Menu):
layout = self.layout
layout.operator_context = 'INVOKE_AREA'
layout.menu("TOPBAR_MT_file_new", text="New", icon='FILE_NEW')
layout.menu("TOPBAR_MT_file_new", text="New", text_ctxt=i18n_contexts.id_windowmanager, icon='FILE_NEW')
layout.operator("wm.open_mainfile", text="Open File...", icon='FILE_FOLDER')
layout.menu("TOPBAR_MT_file_open_recent")
layout.operator("wm.revert_mainfile")
@ -727,7 +730,7 @@ class TOPBAR_MT_file_context_menu(Menu):
layout = self.layout
layout.operator_context = 'INVOKE_AREA'
layout.menu("TOPBAR_MT_file_new", text="New", icon='FILE_NEW')
layout.menu("TOPBAR_MT_file_new", text="New", text_ctxt=i18n_contexts.id_windowmanager, icon='FILE_NEW')
layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER')
layout.separator()

View File

@ -278,7 +278,7 @@ class TEXTURE_UL_texpaintslots(UIList):
# mat = data
if self.layout_type in {'DEFAULT', 'COMPACT'}:
layout.prop(item, "name", text="", emboss=False, icon_value=item.icon_value)
layout.label(text=item.name, icon_value=item.icon_value)
elif self.layout_type == 'GRID':
layout.alignment = 'CENTER'
layout.label(text="")

View File

@ -498,6 +498,115 @@ int blf_font_draw_mono(FontBLF *font, const char *str, const size_t str_len, int
/** \name Text Drawing: Buffer
* \{ */
/**
* Draw glyph `g` into `buf_info` pixels.
*/
static void blf_glyph_draw_buffer(FontBufInfoBLF *buf_info,
GlyphBLF *g,
const ft_pix pen_x,
const ft_pix pen_y_basis)
{
const int chx = ft_pix_to_int(pen_x + ft_pix_from_int(g->pos[0]));
const int chy = ft_pix_to_int(pen_y_basis + ft_pix_from_int(g->dims[1]));
ft_pix pen_y = (g->pitch < 0) ? (pen_y_basis + ft_pix_from_int(g->dims[1] - g->pos[1])) :
(pen_y_basis - ft_pix_from_int(g->dims[1] - g->pos[1]));
if ((chx + g->dims[0]) < 0 || /* Out of bounds: left. */
chx >= buf_info->dims[0] || /* Out of bounds: right. */
(ft_pix_to_int(pen_y) + g->dims[1]) < 0 || /* Out of bounds: bottom. */
ft_pix_to_int(pen_y) >= buf_info->dims[1] /* Out of bounds: top. */
) {
return;
}
/* Don't draw beyond the buffer bounds. */
int width_clip = g->dims[0];
int height_clip = g->dims[1];
int yb_start = g->pitch < 0 ? 0 : g->dims[1] - 1;
if (width_clip + chx > buf_info->dims[0]) {
width_clip -= chx + width_clip - buf_info->dims[0];
}
if (height_clip + ft_pix_to_int(pen_y) > buf_info->dims[1]) {
height_clip -= ft_pix_to_int(pen_y) + height_clip - buf_info->dims[1];
}
/* Clip drawing below the image. */
if (pen_y < 0) {
yb_start += (g->pitch < 0) ? -ft_pix_to_int(pen_y) : ft_pix_to_int(pen_y);
height_clip += ft_pix_to_int(pen_y);
pen_y = 0;
}
/* Avoid conversions in the pixel writing loop. */
const int pen_y_px = ft_pix_to_int(pen_y);
const float *b_col_float = buf_info->col_float;
const uchar *b_col_char = buf_info->col_char;
if (buf_info->fbuf) {
int yb = yb_start;
for (int y = ((chy >= 0) ? 0 : -chy); y < height_clip; y++) {
for (int x = ((chx >= 0) ? 0 : -chx); x < width_clip; x++) {
const char a_byte = *(g->bitmap + x + (yb * g->pitch));
if (a_byte) {
const float a = (a_byte / 255.0f) * b_col_float[3];
const size_t buf_ofs = (((size_t)(chx + x) +
((size_t)(pen_y_px + y) * (size_t)buf_info->dims[0])) *
(size_t)buf_info->ch);
float *fbuf = buf_info->fbuf + buf_ofs;
float font_pixel[4];
font_pixel[0] = b_col_float[0] * a;
font_pixel[1] = b_col_float[1] * a;
font_pixel[2] = b_col_float[2] * a;
font_pixel[3] = a;
blend_color_mix_float(fbuf, fbuf, font_pixel);
}
}
if (g->pitch < 0) {
yb++;
}
else {
yb--;
}
}
}
if (buf_info->cbuf) {
int yb = yb_start;
for (int y = ((chy >= 0) ? 0 : -chy); y < height_clip; y++) {
for (int x = ((chx >= 0) ? 0 : -chx); x < width_clip; x++) {
const char a_byte = *(g->bitmap + x + (yb * g->pitch));
if (a_byte) {
const float a = (a_byte / 255.0f) * b_col_float[3];
const size_t buf_ofs = (((size_t)(chx + x) +
((size_t)(pen_y_px + y) * (size_t)buf_info->dims[0])) *
(size_t)buf_info->ch);
uchar *cbuf = buf_info->cbuf + buf_ofs;
uchar font_pixel[4];
font_pixel[0] = b_col_char[0];
font_pixel[1] = b_col_char[1];
font_pixel[2] = b_col_char[2];
font_pixel[3] = unit_float_to_uchar_clamp(a);
blend_color_mix_byte(cbuf, cbuf, font_pixel);
}
}
if (g->pitch < 0) {
yb++;
}
else {
yb--;
}
}
}
}
/* Sanity checks are done by BLF_draw_buffer() */
static void blf_font_draw_buffer_ex(FontBLF *font,
GlyphCacheBLF *gc,
@ -513,10 +622,6 @@ static void blf_font_draw_buffer_ex(FontBLF *font,
/* buffer specific vars */
FontBufInfoBLF *buf_info = &font->buf_info;
const float *b_col_float = buf_info->col_float;
const uchar *b_col_char = buf_info->col_char;
int chx, chy;
int y, x;
/* another buffer specific call for color conversion */
@ -528,101 +633,7 @@ static void blf_font_draw_buffer_ex(FontBLF *font,
}
pen_x += blf_kerning(font, g_prev, g);
chx = ft_pix_to_int(pen_x + ft_pix_from_int(g->pos[0]));
chy = ft_pix_to_int(pen_y_basis + ft_pix_from_int(g->dims[1]));
if (g->pitch < 0) {
pen_y = pen_y_basis + ft_pix_from_int(g->dims[1] - g->pos[1]);
}
else {
pen_y = pen_y_basis - ft_pix_from_int(g->dims[1] - g->pos[1]);
}
if ((chx + g->dims[0]) >= 0 && chx < buf_info->dims[0] &&
(ft_pix_to_int(pen_y) + g->dims[1]) >= 0 && ft_pix_to_int(pen_y) < buf_info->dims[1]) {
/* don't draw beyond the buffer bounds */
int width_clip = g->dims[0];
int height_clip = g->dims[1];
int yb_start = g->pitch < 0 ? 0 : g->dims[1] - 1;
if (width_clip + chx > buf_info->dims[0]) {
width_clip -= chx + width_clip - buf_info->dims[0];
}
if (height_clip + ft_pix_to_int(pen_y) > buf_info->dims[1]) {
height_clip -= ft_pix_to_int(pen_y) + height_clip - buf_info->dims[1];
}
/* drawing below the image? */
if (pen_y < 0) {
yb_start += (g->pitch < 0) ? -ft_pix_to_int(pen_y) : ft_pix_to_int(pen_y);
height_clip += ft_pix_to_int(pen_y);
pen_y = 0;
}
/* Avoid conversions in the pixel writing loop. */
const int pen_y_px = ft_pix_to_int(pen_y);
if (buf_info->fbuf) {
int yb = yb_start;
for (y = ((chy >= 0) ? 0 : -chy); y < height_clip; y++) {
for (x = ((chx >= 0) ? 0 : -chx); x < width_clip; x++) {
const char a_byte = *(g->bitmap + x + (yb * g->pitch));
if (a_byte) {
const float a = (a_byte / 255.0f) * b_col_float[3];
const size_t buf_ofs = (((size_t)(chx + x) +
((size_t)(pen_y_px + y) * (size_t)buf_info->dims[0])) *
(size_t)buf_info->ch);
float *fbuf = buf_info->fbuf + buf_ofs;
float font_pixel[4];
font_pixel[0] = b_col_float[0] * a;
font_pixel[1] = b_col_float[1] * a;
font_pixel[2] = b_col_float[2] * a;
font_pixel[3] = a;
blend_color_mix_float(fbuf, fbuf, font_pixel);
}
}
if (g->pitch < 0) {
yb++;
}
else {
yb--;
}
}
}
if (buf_info->cbuf) {
int yb = yb_start;
for (y = ((chy >= 0) ? 0 : -chy); y < height_clip; y++) {
for (x = ((chx >= 0) ? 0 : -chx); x < width_clip; x++) {
const char a_byte = *(g->bitmap + x + (yb * g->pitch));
if (a_byte) {
const float a = (a_byte / 255.0f) * b_col_float[3];
const size_t buf_ofs = (((size_t)(chx + x) +
((size_t)(pen_y_px + y) * (size_t)buf_info->dims[0])) *
(size_t)buf_info->ch);
uchar *cbuf = buf_info->cbuf + buf_ofs;
uchar font_pixel[4];
font_pixel[0] = b_col_char[0];
font_pixel[1] = b_col_char[1];
font_pixel[2] = b_col_char[2];
font_pixel[3] = unit_float_to_uchar_clamp(a);
blend_color_mix_byte(cbuf, cbuf, font_pixel);
}
}
if (g->pitch < 0) {
yb++;
}
else {
yb--;
}
}
}
}
blf_glyph_draw_buffer(buf_info, g, pen_x, pen_y_basis);
pen_x = ft_pix_round_advance(pen_x, g->advance_x);
g_prev = g;

View File

@ -90,7 +90,10 @@ const char *BKE_appdir_folder_id_user_notest(int folder_id,
* Returns the path of the top-level version-specific local, user or system directory.
* If check_is_dir, then the result will be NULL if the directory doesn't exist.
*/
const char *BKE_appdir_folder_id_version(int folder_id, int version, bool check_is_dir);
const char *BKE_appdir_resource_path_id_with_version(int folder_id,
bool check_is_dir,
int version);
const char *BKE_appdir_resource_path_id(int folder_id, bool check_is_dir);
/**
* Check if this is an install with user files kept together

View File

@ -11,6 +11,9 @@
extern "C" {
#endif
#include "BLI_compiler_attrs.h"
struct Main;
struct UserDef;
/**
@ -21,13 +24,24 @@ void BKE_blender_free(void);
void BKE_blender_globals_init(void);
void BKE_blender_globals_clear(void);
/** Replace current global Main by the given one, freeing existing one. */
void BKE_blender_globals_main_replace(struct Main *bmain);
/**
* Replace current global Main by the given one, returning the old one.
*
* \warning Advanced, risky workaround addressing the issue that current RNA is not able to process
* correctly non-G_MAIN data, use with (a lot of) care.
*/
struct Main *BKE_blender_globals_main_swap(struct Main *new_gmain);
void BKE_blender_userdef_data_swap(struct UserDef *userdef_a, struct UserDef *userdef_b);
void BKE_blender_userdef_data_set(struct UserDef *userdef);
void BKE_blender_userdef_data_set_and_free(struct UserDef *userdef);
/**
* Write U from userdef.
* This function defines which settings a template will override for the user preferences.
*
* \note the order of `userdef_a` & `userdef_b` isn't important as values are simply swapped.
*/
void BKE_blender_userdef_app_template_data_swap(struct UserDef *userdef_a,
struct UserDef *userdef_b);

View File

@ -25,13 +25,13 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 2
#define BLENDER_FILE_SUBVERSION 3
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file
* was written with too new a version. */
#define BLENDER_FILE_MIN_VERSION 304
#define BLENDER_FILE_MIN_SUBVERSION 1
#define BLENDER_FILE_MIN_SUBVERSION 3
/** User readable version string. */
const char *BKE_blender_version_string(void);

View File

@ -60,6 +60,17 @@ typedef struct DupliObject {
/* Particle this dupli was generated from. */
struct ParticleSystem *particle_system;
/* Geometry set stack for instance attributes; for each level lists the
* geometry set and instance index within it.
*
* Only non-null entries are stored, ordered from innermost to outermost.
* To save memory, these arrays are allocated smaller than persistent_id,
* assuming that not every entry will be associated with a GeometrySet; any
* size between 1 and MAX_DUPLI_RECUR can be used without issues.
*/
int instance_idx[4];
const struct GeometrySet *instance_data[4];
/* Random ID for shading */
unsigned int random_id;
} DupliObject;

View File

@ -46,7 +46,7 @@ std::unique_ptr<IDProperty, IDPropertyDeleter> create(StringRefNull prop_name,
const StringRefNull value);
/** \brief Allocate a new IDProperty of type IDP_ID, set its name and value. */
std::unique_ptr<IDProperty, IDPropertyDeleter> create(StringRefNull prop_name, ID *id);
std::unique_ptr<IDProperty, IDPropertyDeleter> create(StringRefNull prop_name, ID *value);
/**
* \brief Allocate a new IDProperty of type IDP_ARRAY and sub-type IDP_INT.

View File

@ -52,7 +52,7 @@ int BKE_image_path_ensure_ext_from_imtype(char *string, char imtype);
#define IMA_CHAN_FLAG_BW 1
#define IMA_CHAN_FLAG_RGB 2
#define IMA_CHAN_FLAG_ALPHA 4
#define IMA_CHAN_FLAG_RGBA 4
char BKE_ftype_to_imtype(int ftype, const struct ImbFormatOptions *options);
int BKE_imtype_to_ftype(char imtype, struct ImbFormatOptions *r_options);

View File

@ -122,11 +122,11 @@ class AbstractTileData {
*/
class NoTileData : AbstractTileData {
public:
NoTileData(Image *UNUSED(image), ImageUser *UNUSED(image_user))
NoTileData(Image * /*image*/, ImageUser * /*image_user*/)
{
}
void init_data(TileNumber UNUSED(new_tile_number)) override
void init_data(TileNumber /*new_tile_number*/) override
{
}

View File

@ -585,6 +585,9 @@ struct LayerCollection *BKE_view_layer_active_collection_get(struct ViewLayer *v
void BKE_view_layer_need_resync_tag(struct ViewLayer *view_layer);
void BKE_view_layer_synced_ensure(const struct Scene *scene, struct ViewLayer *view_layer);
void BKE_scene_view_layers_synced_ensure(const struct Scene *scene);
void BKE_main_view_layers_synced_ensure(const struct Main *bmain);
struct ViewLayerAOV *BKE_view_layer_add_aov(struct ViewLayer *view_layer);
void BKE_view_layer_remove_aov(struct ViewLayer *view_layer, struct ViewLayerAOV *aov);
void BKE_view_layer_set_active_aov(struct ViewLayer *view_layer, struct ViewLayerAOV *aov);

View File

@ -138,6 +138,14 @@ typedef struct Main {
*/
bool is_locked_for_linking;
/**
* True if this main is the 'GMAIN' of current Blender.
*
* \note There should always be only one global main, all others generated temporarily for
* various data management process must have this property set to false..
*/
bool is_global_main;
BlendThumbnail *blen_thumb;
struct Library *curlib;
@ -202,6 +210,12 @@ typedef struct Main {
struct MainLock *lock;
} Main;
/**
* Create a new Main data-base.
*
* \note Always generate a non-global Main, use #BKE_blender_globals_main_replace to put a newly
* created one in `G_MAIN`.
*/
struct Main *BKE_main_new(void);
void BKE_main_free(struct Main *mainvar);

View File

@ -68,7 +68,7 @@ struct BoundBox *BKE_mball_boundbox_get(struct Object *ob);
* `MBall`, `MBall.001`, `MBall.002`, etc). The most important is to copy properties to the base
* meta-ball, because this meta-ball influences polygonization of meta-balls.
*/
void BKE_mball_properties_copy(struct Main *bmain, struct MetaBall *active_metaball);
void BKE_mball_properties_copy(struct Main *bmain, struct MetaBall *metaball_src);
bool BKE_mball_minmax_ex(
const struct MetaBall *mb, float min[3], float max[3], const float obmat[4][4], short flag);

View File

@ -1531,7 +1531,7 @@ struct TexResult;
#define GEO_NODE_SAMPLE_INDEX 1174
#define GEO_NODE_SAMPLE_NEAREST 1175
#define GEO_NODE_SAMPLE_NEAREST_SURFACE 1176
#define GEO_NODE_INPUT_CONTROL_POINT_NEIGHBORS 1177
#define GEO_NODE_OFFSET_POINT_IN_CURVE 1177
#define GEO_NODE_CURVE_TOPOLOGY_CURVE_OF_POINT 1178
#define GEO_NODE_CURVE_TOPOLOGY_POINTS_OF_CURVE 1179
#define GEO_NODE_MESH_TOPOLOGY_OFFSET_CORNER_IN_FACE 1180
@ -1541,6 +1541,8 @@ struct TexResult;
#define GEO_NODE_MESH_TOPOLOGY_EDGES_OF_VERTEX 1184
#define GEO_NODE_MESH_TOPOLOGY_FACE_OF_CORNER 1185
#define GEO_NODE_MESH_TOPOLOGY_VERTEX_OF_CORNER 1186
#define GEO_NODE_SAMPLE_UV_SURFACE 1187
#define GEO_NODE_SET_CURVE_NORMAL 1188
/** \} */

View File

@ -460,18 +460,22 @@ static bool get_path_user_ex(char *targetpath,
const bool check_is_dir)
{
char user_path[FILE_MAX];
const char *user_base_path;
/* for portable install, user path is always local */
if (BKE_appdir_app_is_portable_install()) {
return get_path_local_ex(
targetpath, targetpath_len, folder_name, subfolder_name, version, check_is_dir);
if (test_env_path(user_path, "BLENDER_USER_RESOURCES", check_is_dir)) {
/* Pass. */
}
user_path[0] = '\0';
else {
/* for portable install, user path is always local */
if (BKE_appdir_app_is_portable_install()) {
return get_path_local_ex(
targetpath, targetpath_len, folder_name, subfolder_name, version, check_is_dir);
}
user_path[0] = '\0';
user_base_path = GHOST_getUserDir(version, blender_version_decimal(version));
if (user_base_path) {
BLI_strncpy(user_path, user_base_path, FILE_MAX);
const char *user_base_path = GHOST_getUserDir(version, blender_version_decimal(version));
if (user_base_path) {
BLI_strncpy(user_path, user_base_path, FILE_MAX);
}
}
if (!user_path[0]) {
@ -518,7 +522,6 @@ static bool get_path_system_ex(char *targetpath,
const bool check_is_dir)
{
char system_path[FILE_MAX];
const char *system_base_path;
char relfolder[FILE_MAX];
if (folder_name) { /* `subfolder_name` may be NULL. */
@ -528,10 +531,15 @@ static bool get_path_system_ex(char *targetpath,
relfolder[0] = '\0';
}
system_path[0] = '\0';
system_base_path = GHOST_getSystemDir(version, blender_version_decimal(version));
if (system_base_path) {
BLI_strncpy(system_path, system_base_path, FILE_MAX);
if (test_env_path(system_path, "BLENDER_SYSTEM_RESOURCES", check_is_dir)) {
/* Pass. */
}
else {
system_path[0] = '\0';
const char *system_base_path = GHOST_getSystemDir(version, blender_version_decimal(version));
if (system_base_path) {
BLI_strncpy(system_path, system_base_path, FILE_MAX);
}
}
if (!system_path[0]) {
@ -752,9 +760,9 @@ const char *BKE_appdir_folder_id_create(const int folder_id, const char *subfold
return path;
}
const char *BKE_appdir_folder_id_version(const int folder_id,
const int version,
const bool check_is_dir)
const char *BKE_appdir_resource_path_id_with_version(const int folder_id,
const bool check_is_dir,
const int version)
{
static char path[FILE_MAX] = "";
bool ok;
@ -777,6 +785,11 @@ const char *BKE_appdir_folder_id_version(const int folder_id,
return ok ? path : NULL;
}
const char *BKE_appdir_resource_path_id(const int folder_id, const bool check_is_dir)
{
return BKE_appdir_resource_path_id_with_version(folder_id, check_is_dir, BLENDER_VERSION);
}
/** \} */
/* -------------------------------------------------------------------- */

View File

@ -143,7 +143,7 @@ IDProperty *BKE_asset_metadata_idprop_find(const AssetMetaData *asset_data, cons
/* Queries -------------------------------------------- */
PreviewImage *BKE_asset_metadata_preview_get_from_id(const AssetMetaData *UNUSED(asset_data),
PreviewImage *BKE_asset_metadata_preview_get_from_id(const AssetMetaData * /*asset_data*/,
const ID *id)
{
return BKE_previewimg_id_get(id);

View File

@ -334,7 +334,7 @@ class ComponentAttributeProviders {
namespace attribute_accessor_functions {
template<const ComponentAttributeProviders &providers>
inline bool is_builtin(const void *UNUSED(owner), const AttributeIDRef &attribute_id)
inline bool is_builtin(const void * /*owner*/, const AttributeIDRef &attribute_id)
{
if (!attribute_id.is_named()) {
return false;

View File

@ -62,8 +62,7 @@ void BKE_blender_free(void)
/* Needs to run before main free as wm is still referenced for icons preview jobs. */
BKE_studiolight_free();
BKE_main_free(G_MAIN);
G_MAIN = NULL;
BKE_blender_globals_clear();
if (G.log.file != NULL) {
fclose(G.log.file);
@ -146,7 +145,7 @@ void BKE_blender_globals_init(void)
U.savetime = 1;
G_MAIN = BKE_main_new();
BKE_blender_globals_main_replace(BKE_main_new());
strcpy(G.ima, "//");
@ -161,11 +160,34 @@ void BKE_blender_globals_init(void)
void BKE_blender_globals_clear(void)
{
if (G_MAIN == NULL) {
return;
}
BLI_assert(G_MAIN->is_global_main);
BKE_main_free(G_MAIN); /* free all lib data */
G_MAIN = NULL;
}
void BKE_blender_globals_main_replace(Main *bmain)
{
BLI_assert(!bmain->is_global_main);
BKE_blender_globals_clear();
bmain->is_global_main = true;
G_MAIN = bmain;
}
Main *BKE_blender_globals_main_swap(Main *new_gmain)
{
Main *old_gmain = G_MAIN;
BLI_assert(old_gmain->is_global_main);
BLI_assert(!new_gmain->is_global_main);
new_gmain->is_global_main = true;
G_MAIN = new_gmain;
old_gmain->is_global_main = false;
return old_gmain;
}
/** \} */
/* -------------------------------------------------------------------- */

View File

@ -16,6 +16,7 @@
#include "DNA_screen_types.h"
#include "DNA_workspace_types.h"
#include "BLI_fileops.h"
#include "BLI_listbase.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
@ -62,7 +63,7 @@
#endif
/* -------------------------------------------------------------------- */
/** \name High Level `.blend` file read/write.
/** \name Blend File IO (High Level)
* \{ */
static bool blendfile_or_libraries_versions_atleast(Main *bmain,
@ -287,11 +288,8 @@ static void setup_app_data(bContext *C,
}
}
/* free G_MAIN Main database */
// CTX_wm_manager_set(C, NULL);
BKE_blender_globals_clear();
bmain = G_MAIN = bfd->main;
BKE_blender_globals_main_replace(bfd->main);
bmain = G_MAIN;
bfd->main = NULL;
CTX_data_main_set(C, bmain);
@ -568,6 +566,34 @@ void BKE_blendfile_read_make_empty(bContext *C)
FOREACH_MAIN_LISTBASE_END;
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Blend File IO (Preferences)
*
* Application Templates
* =====================
*
* When using app-templates, both regular & app-template preferences are used.
* Note that "regular" preferences refers to the preferences used with no app-template is active.
*
* - Reading preferences is performed for both the app-template & regular preferences.
*
* The preferences are merged by using some from the app-template and other settings from the
* regular preferences (add-ons from the app-template for example are used),
* undo-memory uses the regular preferences (for e.g.).
*
* - Writing preferences is performed for both the app-template & regular preferences.
*
* Writing unmodified preference (#U) into the regular preferences
* would loose any settings the app-template overrides.
* To keep default settings the regular preferences is read, add-ons etc temporarily swapped
* into #U for writing, then swapped back out so as not to change the run-time preferences.
*
* \note The function #BKE_blender_userdef_app_template_data_swap determines which settings
* the app-template overrides.
* \{ */
UserDef *BKE_blendfile_userdef_read(const char *filepath, ReportList *reports)
{
BlendFileData *bfd;
@ -692,10 +718,15 @@ bool BKE_blendfile_userdef_write(const char *filepath, ReportList *reports)
bool BKE_blendfile_userdef_write_app_template(const char *filepath, ReportList *reports)
{
/* if it fails, overwrite is OK. */
UserDef *userdef_default = BKE_blendfile_userdef_read(filepath, NULL);
/* Checking that `filepath` exists is not essential, it just avoids printing a warning that
* the file can't be found. In this case it's not an error - as the file is used if it exists,
* falling back to the defaults.
* If the preferences exists but file reading fails - the file can be assumed corrupt
* so overwriting the file is OK. */
UserDef *userdef_default = BLI_exists(filepath) ? BKE_blendfile_userdef_read(filepath, NULL) :
NULL;
if (userdef_default == NULL) {
return BKE_blendfile_userdef_write(filepath, reports);
userdef_default = BKE_blendfile_userdef_from_defaults();
}
BKE_blender_userdef_app_template_data_swap(&U, userdef_default);
@ -765,6 +796,12 @@ bool BKE_blendfile_userdef_write_all(ReportList *reports)
return ok;
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Blend File IO (WorkSpace)
* \{ */
WorkspaceConfigFileData *BKE_blendfile_workspace_config_read(const char *filepath,
const void *filebuf,
int filelength,
@ -827,7 +864,7 @@ void BKE_blendfile_workspace_config_data_free(WorkspaceConfigFileData *workspace
/** \} */
/* -------------------------------------------------------------------- */
/** \name Partial `.blend` file save.
/** \name Blend File Write (Partial)
* \{ */
void BKE_blendfile_write_partial_begin(Main *bmain_src)

View File

@ -56,7 +56,7 @@ static void brush_init_data(ID *id)
BKE_brush_curve_preset(brush, CURVE_PRESET_SMOOTH);
}
static void brush_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int flag)
static void brush_copy_data(Main * /*bmain*/, ID *id_dst, const ID *id_src, const int flag)
{
Brush *brush_dst = (Brush *)id_dst;
const Brush *brush_src = (const Brush *)id_src;

View File

@ -178,7 +178,7 @@ static void bvhtree_balance(BVHTree *tree, const bool isolate)
/* Math stuff for ray casting on mesh faces and for nearest surface */
float bvhtree_ray_tri_intersection(const BVHTreeRay *ray,
const float UNUSED(m_dist),
const float /*m_dist*/,
const float v0[3],
const float v1[3],
const float v2[3])
@ -1136,7 +1136,7 @@ BVHTree *bvhtree_from_mesh_looptri_ex(BVHTreeFromMesh *data,
static BLI_bitmap *loose_verts_map_get(const MEdge *medge,
int edges_num,
const MVert *UNUSED(mvert),
const MVert * /*mvert*/,
int verts_num,
int *r_loose_vert_num)
{

View File

@ -580,7 +580,7 @@ blender::StringRef CryptomatteStampDataCallbackData::extract_layer_hash(blender:
void CryptomatteStampDataCallbackData::extract_layer_names(void *_data,
const char *propname,
char *propvalue,
int UNUSED(len))
int /*len*/)
{
CryptomatteStampDataCallbackData *data = static_cast<CryptomatteStampDataCallbackData *>(_data);
@ -598,7 +598,7 @@ void CryptomatteStampDataCallbackData::extract_layer_names(void *_data,
void CryptomatteStampDataCallbackData::extract_layer_manifest(void *_data,
const char *propname,
char *propvalue,
int UNUSED(len))
int /*len*/)
{
CryptomatteStampDataCallbackData *data = static_cast<CryptomatteStampDataCallbackData *>(_data);

View File

@ -88,10 +88,10 @@ TEST(cryptomatte, extract_layer_hash_from_metadata_key)
"cryptomatte/"));
}
static void validate_cryptomatte_session_from_stamp_data(void *UNUSED(data),
static void validate_cryptomatte_session_from_stamp_data(void * /*data*/,
const char *propname,
char *propvalue,
int UNUSED(len))
int /*len*/)
{
blender::StringRefNull prop_name(propname);
if (!prop_name.startswith("cryptomatte/")) {

View File

@ -1056,7 +1056,7 @@ BPoint *BKE_nurb_bpoint_get_prev(Nurb *nu, BPoint *bp)
return bp_prev;
}
void BKE_nurb_bezt_calc_normal(struct Nurb *UNUSED(nu), BezTriple *bezt, float r_normal[3])
void BKE_nurb_bezt_calc_normal(struct Nurb * /*nu*/, BezTriple *bezt, float r_normal[3])
{
/* calculate the axis matrix from the spline */
float dir_prev[3], dir_next[3];

View File

@ -63,7 +63,7 @@ static void curves_init_data(ID *id)
new (&curves->geometry) blender::bke::CurvesGeometry();
}
static void curves_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int flag)
static void curves_copy_data(Main * /*bmain*/, ID *id_dst, const ID *id_src, const int flag)
{
using namespace blender;
@ -263,7 +263,7 @@ BoundBox *BKE_curves_boundbox_get(Object *ob)
return ob->runtime.bb;
}
bool BKE_curves_attribute_required(const Curves *UNUSED(curves), const char *name)
bool BKE_curves_attribute_required(const Curves * /*curves*/, const char *name)
{
return STREQ(name, ATTR_POSITION);
}

View File

@ -232,7 +232,7 @@ static void layerFree_mdeformvert(void *data, const int count, const int size)
static void layerInterp_mdeformvert(const void **sources,
const float *weights,
const float *UNUSED(sub_weights),
const float * /*sub_weights*/,
const int count,
void *dest)
{
@ -331,7 +331,7 @@ static void layerConstruct_mdeformvert(void *data, const int count)
static void layerInterp_normal(const void **sources,
const float *weights,
const float *UNUSED(sub_weights),
const float * /*sub_weights*/,
const int count,
void *dest)
{
@ -472,7 +472,7 @@ static void layerCopy_propFloat(const void *source, void *dest, const int count)
static void layerInterp_propFloat(const void **sources,
const float *weights,
const float *UNUSED(sub_weights),
const float * /*sub_weights*/,
const int count,
void *dest)
{
@ -510,7 +510,7 @@ static bool layerValidate_propFloat(void *data, const uint totitems, const bool
static void layerInterp_propInt(const void **sources,
const float *weights,
const float *UNUSED(sub_weights),
const float * /*sub_weights*/,
const int count,
void *dest)
{
@ -659,7 +659,7 @@ static void layerCopy_mdisps(const void *source, void *dest, const int count)
}
}
static void layerFree_mdisps(void *data, const int count, const int UNUSED(size))
static void layerFree_mdisps(void *data, const int count, const int /*size*/)
{
MDisps *d = static_cast<MDisps *>(data);
@ -714,7 +714,7 @@ static bool layerWrite_mdisps(CDataFile *cdf, const void *data, const int count)
return true;
}
static size_t layerFilesize_mdisps(CDataFile *UNUSED(cdf), const void *data, const int count)
static size_t layerFilesize_mdisps(CDataFile * /*cdf*/, const void *data, const int count)
{
const MDisps *d = static_cast<const MDisps *>(data);
size_t size = 0;
@ -733,7 +733,7 @@ static size_t layerFilesize_mdisps(CDataFile *UNUSED(cdf), const void *data, con
* \{ */
/* copy just zeros in this case */
static void layerCopy_bmesh_elem_py_ptr(const void *UNUSED(source), void *dest, const int count)
static void layerCopy_bmesh_elem_py_ptr(const void * /*source*/, void *dest, const int count)
{
const int size = sizeof(void *);
@ -744,7 +744,7 @@ static void layerCopy_bmesh_elem_py_ptr(const void *UNUSED(source), void *dest,
}
#ifndef WITH_PYTHON
void bpy_bm_generic_invalidate(struct BPy_BMGeneric *UNUSED(self))
void bpy_bm_generic_invalidate(struct BPy_BMGeneric * /*self*/)
{
/* dummy */
}
@ -768,7 +768,7 @@ static void layerFree_bmesh_elem_py_ptr(void *data, const int count, const int s
static void layerInterp_paint_mask(const void **sources,
const float *weights,
const float *UNUSED(sub_weights),
const float * /*sub_weights*/,
int count,
void *dest)
{
@ -804,7 +804,7 @@ static void layerCopy_grid_paint_mask(const void *source, void *dest, const int
}
}
static void layerFree_grid_paint_mask(void *data, const int count, const int UNUSED(size))
static void layerFree_grid_paint_mask(void *data, const int count, const int /*size*/)
{
GridPaintMask *gpm = static_cast<GridPaintMask *>(data);
@ -977,7 +977,7 @@ static void layerDefault_mloopcol(void *data, const int count)
static void layerInterp_mloopcol(const void **sources,
const float *weights,
const float *UNUSED(sub_weights),
const float * /*sub_weights*/,
int count,
void *dest)
{
@ -1075,7 +1075,7 @@ static void layerAdd_mloopuv(void *data1, const void *data2)
static void layerInterp_mloopuv(const void **sources,
const float *weights,
const float *UNUSED(sub_weights),
const float * /*sub_weights*/,
int count,
void *dest)
{
@ -1118,8 +1118,8 @@ static bool layerValidate_mloopuv(void *data, const uint totitems, const bool do
/* origspace is almost exact copy of mloopuv's, keep in sync */
static void layerCopyValue_mloop_origspace(const void *source,
void *dest,
const int UNUSED(mixmode),
const float UNUSED(mixfactor))
const int /*mixmode*/,
const float /*mixfactor*/)
{
const OrigSpaceLoop *luv1 = static_cast<const OrigSpaceLoop *>(source);
OrigSpaceLoop *luv2 = static_cast<OrigSpaceLoop *>(dest);
@ -1169,7 +1169,7 @@ static void layerAdd_mloop_origspace(void *data1, const void *data2)
static void layerInterp_mloop_origspace(const void **sources,
const float *weights,
const float *UNUSED(sub_weights),
const float * /*sub_weights*/,
int count,
void *dest)
{
@ -1267,7 +1267,7 @@ static void layerDefault_origindex(void *data, const int count)
static void layerInterp_bweight(const void **sources,
const float *weights,
const float *UNUSED(sub_weights),
const float * /*sub_weights*/,
int count,
void *dest)
{
@ -1290,7 +1290,7 @@ static void layerInterp_bweight(const void **sources,
static void layerInterp_shapekey(const void **sources,
const float *weights,
const float *UNUSED(sub_weights),
const float * /*sub_weights*/,
int count,
void *dest)
{
@ -1335,7 +1335,7 @@ static void layerCopy_mvert_skin(const void *source, void *dest, const int count
static void layerInterp_mvert_skin(const void **sources,
const float *weights,
const float *UNUSED(sub_weights),
const float * /*sub_weights*/,
int count,
void *dest)
{
@ -1498,7 +1498,7 @@ static void layerDefault_propcol(void *data, const int count)
static void layerInterp_propcol(const void **sources,
const float *weights,
const float *UNUSED(sub_weights),
const float * /*sub_weights*/,
int count,
void *dest)
{
@ -1520,7 +1520,7 @@ static void layerInterp_propcol(const void **sources,
static void layerInterp_propfloat3(const void **sources,
const float *weights,
const float *UNUSED(sub_weights),
const float * /*sub_weights*/,
int count,
void *dest)
{
@ -1573,7 +1573,7 @@ static bool layerValidate_propfloat3(void *data, const uint totitems, const bool
static void layerInterp_propfloat2(const void **sources,
const float *weights,
const float *UNUSED(sub_weights),
const float * /*sub_weights*/,
int count,
void *dest)
{
@ -1624,7 +1624,7 @@ static bool layerValidate_propfloat2(void *data, const uint totitems, const bool
static void layerInterp_propbool(const void **sources,
const float *weights,
const float *UNUSED(sub_weights),
const float * /*sub_weights*/,
int count,
void *dest)
{
@ -3163,7 +3163,7 @@ void *CustomData_duplicate_referenced_layer_named(CustomData *data,
}
void *CustomData_duplicate_referenced_layer_anonymous(CustomData *data,
const int UNUSED(type),
const int /*type*/,
const AnonymousAttributeID *anonymous_id,
const int totelem)
{
@ -4594,10 +4594,7 @@ static void customdata_external_filename(char filepath[FILE_MAX],
BLI_path_abs(filepath, ID_BLEND_PATH_FROM_GLOBAL(id));
}
void CustomData_external_reload(CustomData *data,
ID *UNUSED(id),
eCustomDataMask mask,
int totelem)
void CustomData_external_reload(CustomData *data, ID * /*id*/, eCustomDataMask mask, int totelem)
{
for (int i = 0; i < data->totlayer; i++) {
CustomDataLayer *layer = &data->layers[i];
@ -4791,11 +4788,8 @@ void CustomData_external_write(
cdf_free(cdf);
}
void CustomData_external_add(CustomData *data,
ID *UNUSED(id),
const int type,
const int UNUSED(totelem),
const char *filepath)
void CustomData_external_add(
CustomData *data, ID * /*id*/, const int type, const int /*totelem*/, const char *filepath)
{
CustomDataExternal *external = data->external;

View File

@ -290,7 +290,7 @@ void BKE_editmesh_ensure_autosmooth(BMEditMesh *em, Mesh *me)
}
}
BoundBox *BKE_editmesh_cage_boundbox_get(Object *object, BMEditMesh *UNUSED(em))
BoundBox *BKE_editmesh_cage_boundbox_get(Object *object, BMEditMesh * /*em*/)
{
if (object->runtime.editmesh_bb_cage == nullptr) {
float min[3], max[3];

View File

@ -94,12 +94,10 @@ struct SGLSLEditMeshToTangent {
const float *uv = (const float *)BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
return mikk::float3(uv[0], uv[1], 1.0f);
}
else {
const float *orco_p = orco[BM_elem_index_get(l->v)];
float u, v;
map_to_sphere(&u, &v, orco_p[0], orco_p[1], orco_p[2]);
return mikk::float3(u, v, 1.0f);
}
const float *orco_p = orco[BM_elem_index_get(l->v)];
float u, v;
map_to_sphere(&u, &v, orco_p[0], orco_p[1], orco_p[2]);
return mikk::float3(u, v, 1.0f);
}
mikk::float3 GetNormal(const uint face_num, const uint vert_index)
@ -108,17 +106,13 @@ struct SGLSLEditMeshToTangent {
if (precomputedLoopNormals) {
return mikk::float3(precomputedLoopNormals[BM_elem_index_get(l)]);
}
else if (BM_elem_flag_test(l->f, BM_ELEM_SMOOTH) == 0) { /* flat */
if (BM_elem_flag_test(l->f, BM_ELEM_SMOOTH) == 0) { /* flat */
if (precomputedFaceNormals) {
return mikk::float3(precomputedFaceNormals[BM_elem_index_get(l->f)]);
}
else {
return mikk::float3(l->f->no);
}
}
else {
return mikk::float3(l->v->no);
return mikk::float3(l->f->no);
}
return mikk::float3(l->v->no);
}
void SetTangentSpace(const uint face_num,
@ -147,7 +141,7 @@ struct SGLSLEditMeshToTangent {
#endif
};
static void emDM_calc_loop_tangents_thread(TaskPool *__restrict UNUSED(pool), void *taskdata)
static void emDM_calc_loop_tangents_thread(TaskPool *__restrict /*pool*/, void *taskdata)
{
SGLSLEditMeshToTangent *mesh_data = static_cast<SGLSLEditMeshToTangent *>(taskdata);

View File

@ -266,7 +266,7 @@ CurveLengthFieldInput::CurveLengthFieldInput()
GVArray CurveLengthFieldInput::get_varray_for_context(const CurvesGeometry &curves,
const eAttrDomain domain,
IndexMask UNUSED(mask)) const
const IndexMask /*mask*/) const
{
return construct_curve_length_gvarray(curves, domain);
}
@ -617,7 +617,7 @@ static AttributeAccessorFunctions get_curves_accessor_functions()
return 0;
}
};
fn.domain_supported = [](const void *UNUSED(owner), const eAttrDomain domain) {
fn.domain_supported = [](const void * /*owner*/, const eAttrDomain domain) {
return ELEM(domain, ATTR_DOMAIN_POINT, ATTR_DOMAIN_CURVE);
};
fn.adapt_domain = [](const void *owner,

View File

@ -413,17 +413,17 @@ class InstancePositionAttributeProvider final : public BuiltinAttributeProvider
domain_};
}
bool try_delete(void *UNUSED(owner)) const final
bool try_delete(void * /*owner*/) const final
{
return false;
}
bool try_create(void *UNUSED(owner), const AttributeInit &UNUSED(initializer)) const final
bool try_create(void * /*owner*/, const AttributeInit & /*initializer*/) const final
{
return false;
}
bool exists(const void *UNUSED(owner)) const final
bool exists(const void * /*owner*/) const final
{
return true;
}
@ -487,10 +487,10 @@ static AttributeAccessorFunctions get_instances_accessor_functions()
return 0;
}
};
fn.domain_supported = [](const void *UNUSED(owner), const eAttrDomain domain) {
fn.domain_supported = [](const void * /*owner*/, const eAttrDomain domain) {
return domain == ATTR_DOMAIN_INSTANCE;
};
fn.adapt_domain = [](const void *UNUSED(owner),
fn.adapt_domain = [](const void * /*owner*/,
const blender::GVArray &varray,
const eAttrDomain from_domain,
const eAttrDomain to_domain) {

View File

@ -222,18 +222,17 @@ void adapt_mesh_domain_corner_to_point_impl(const Mesh &mesh,
static GVArray adapt_mesh_domain_corner_to_point(const Mesh &mesh, const GVArray &varray)
{
GVArray new_varray;
GArray<> values(varray.type(), mesh.totvert);
attribute_math::convert_to_static_type(varray.type(), [&](auto dummy) {
using T = decltype(dummy);
if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
/* We compute all interpolated values at once, because for this interpolation, one has to
* iterate over all loops anyway. */
Array<T> values(mesh.totvert);
adapt_mesh_domain_corner_to_point_impl<T>(mesh, varray.typed<T>(), values);
new_varray = VArray<T>::ForContainer(std::move(values));
adapt_mesh_domain_corner_to_point_impl<T>(
mesh, varray.typed<T>(), values.as_mutable_span().typed<T>());
}
});
return new_varray;
return GVArray::ForGArray(std::move(values));
}
/**
@ -368,16 +367,15 @@ void adapt_mesh_domain_corner_to_edge_impl(const Mesh &mesh,
static GVArray adapt_mesh_domain_corner_to_edge(const Mesh &mesh, const GVArray &varray)
{
GVArray new_varray;
GArray<> values(varray.type(), mesh.totedge);
attribute_math::convert_to_static_type(varray.type(), [&](auto dummy) {
using T = decltype(dummy);
if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
Array<T> values(mesh.totedge);
adapt_mesh_domain_corner_to_edge_impl<T>(mesh, varray.typed<T>(), values);
new_varray = VArray<T>::ForContainer(std::move(values));
adapt_mesh_domain_corner_to_edge_impl<T>(
mesh, varray.typed<T>(), values.as_mutable_span().typed<T>());
}
});
return new_varray;
return GVArray::ForGArray(std::move(values));
}
template<typename T>
@ -429,16 +427,15 @@ void adapt_mesh_domain_face_to_point_impl(const Mesh &mesh,
static GVArray adapt_mesh_domain_face_to_point(const Mesh &mesh, const GVArray &varray)
{
GVArray new_varray;
GArray<> values(varray.type(), mesh.totvert);
attribute_math::convert_to_static_type(varray.type(), [&](auto dummy) {
using T = decltype(dummy);
if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
Array<T> values(mesh.totvert);
adapt_mesh_domain_face_to_point_impl<T>(mesh, varray.typed<T>(), values);
new_varray = VArray<T>::ForContainer(std::move(values));
adapt_mesh_domain_face_to_point_impl<T>(
mesh, varray.typed<T>(), values.as_mutable_span().typed<T>());
}
});
return new_varray;
return GVArray::ForGArray(std::move(values));
}
/* Each corner's value is simply a copy of the value at its face. */
@ -461,16 +458,15 @@ void adapt_mesh_domain_face_to_corner_impl(const Mesh &mesh,
static GVArray adapt_mesh_domain_face_to_corner(const Mesh &mesh, const GVArray &varray)
{
GVArray new_varray;
GArray<> values(varray.type(), mesh.totloop);
attribute_math::convert_to_static_type(varray.type(), [&](auto dummy) {
using T = decltype(dummy);
if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
Array<T> values(mesh.totloop);
adapt_mesh_domain_face_to_corner_impl<T>(mesh, varray.typed<T>(), values);
new_varray = VArray<T>::ForContainer(std::move(values));
adapt_mesh_domain_face_to_corner_impl<T>(
mesh, varray.typed<T>(), values.as_mutable_span().typed<T>());
}
});
return new_varray;
return GVArray::ForGArray(std::move(values));
}
template<typename T>
@ -520,16 +516,15 @@ void adapt_mesh_domain_face_to_edge_impl(const Mesh &mesh,
static GVArray adapt_mesh_domain_face_to_edge(const Mesh &mesh, const GVArray &varray)
{
GVArray new_varray;
GArray<> values(varray.type(), mesh.totedge);
attribute_math::convert_to_static_type(varray.type(), [&](auto dummy) {
using T = decltype(dummy);
if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
Array<T> values(mesh.totedge);
adapt_mesh_domain_face_to_edge_impl<T>(mesh, varray.typed<T>(), values);
new_varray = VArray<T>::ForContainer(std::move(values));
adapt_mesh_domain_face_to_edge_impl<T>(
mesh, varray.typed<T>(), values.as_mutable_span().typed<T>());
}
});
return new_varray;
return GVArray::ForGArray(std::move(values));
}
static GVArray adapt_mesh_domain_point_to_face(const Mesh &mesh, const GVArray &varray)
@ -662,16 +657,15 @@ void adapt_mesh_domain_edge_to_corner_impl(const Mesh &mesh,
static GVArray adapt_mesh_domain_edge_to_corner(const Mesh &mesh, const GVArray &varray)
{
GVArray new_varray;
GArray<> values(varray.type(), mesh.totloop);
attribute_math::convert_to_static_type(varray.type(), [&](auto dummy) {
using T = decltype(dummy);
if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
Array<T> values(mesh.totloop);
adapt_mesh_domain_edge_to_corner_impl<T>(mesh, varray.typed<T>(), values);
new_varray = VArray<T>::ForContainer(std::move(values));
adapt_mesh_domain_edge_to_corner_impl<T>(
mesh, varray.typed<T>(), values.as_mutable_span().typed<T>());
}
});
return new_varray;
return GVArray::ForGArray(std::move(values));
}
template<typename T>
@ -715,16 +709,15 @@ void adapt_mesh_domain_edge_to_point_impl(const Mesh &mesh,
static GVArray adapt_mesh_domain_edge_to_point(const Mesh &mesh, const GVArray &varray)
{
GVArray new_varray;
GArray<> values(varray.type(), mesh.totvert);
attribute_math::convert_to_static_type(varray.type(), [&](auto dummy) {
using T = decltype(dummy);
if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
Array<T> values(mesh.totvert);
adapt_mesh_domain_edge_to_point_impl<T>(mesh, varray.typed<T>(), values);
new_varray = VArray<T>::ForContainer(std::move(values));
adapt_mesh_domain_edge_to_point_impl<T>(
mesh, varray.typed<T>(), values.as_mutable_span().typed<T>());
}
});
return new_varray;
return GVArray::ForGArray(std::move(values));
}
static GVArray adapt_mesh_domain_edge_to_face(const Mesh &mesh, const GVArray &varray)
@ -772,6 +765,30 @@ static GVArray adapt_mesh_domain_edge_to_face(const Mesh &mesh, const GVArray &v
} // namespace blender::bke
static bool can_simple_adapt_for_single(const eAttrDomain from_domain, const eAttrDomain to_domain)
{
/* For some domain combinations, a single value will always map directly. For others, there may
* be loose elements on the result domain that should have the default value rather than the
* single value from the source. */
switch (from_domain) {
case ATTR_DOMAIN_POINT:
/* All other domains are always connected to points. */
return true;
case ATTR_DOMAIN_EDGE:
/* There may be loose vertices not connected to edges. */
return ELEM(to_domain, ATTR_DOMAIN_FACE, ATTR_DOMAIN_CORNER);
case ATTR_DOMAIN_FACE:
/* There may be loose vertices or edges not connected to faces. */
return to_domain == ATTR_DOMAIN_CORNER;
case ATTR_DOMAIN_CORNER:
/* Only faces are always connected to corners. */
return to_domain == ATTR_DOMAIN_FACE;
default:
BLI_assert_unreachable();
return false;
}
}
static blender::GVArray adapt_mesh_attribute_domain(const Mesh &mesh,
const blender::GVArray &varray,
const eAttrDomain from_domain,
@ -786,6 +803,14 @@ static blender::GVArray adapt_mesh_attribute_domain(const Mesh &mesh,
if (from_domain == to_domain) {
return varray;
}
if (varray.is_single()) {
if (can_simple_adapt_for_single(from_domain, to_domain)) {
BUFFER_FOR_CPP_TYPE_VALUE(varray.type(), value);
varray.get_internal_single(value);
return blender::GVArray::ForSingle(
varray.type(), mesh.attributes().domain_size(to_domain), value);
}
}
switch (from_domain) {
case ATTR_DOMAIN_CORNER: {
@ -1132,17 +1157,17 @@ class NormalAttributeProvider final : public BuiltinAttributeProvider {
return VArray<float3>::ForSpan({(float3 *)BKE_mesh_poly_normals_ensure(mesh), mesh->totpoly});
}
GAttributeWriter try_get_for_write(void *UNUSED(owner)) const final
GAttributeWriter try_get_for_write(void * /*owner*/) const final
{
return {};
}
bool try_delete(void *UNUSED(owner)) const final
bool try_delete(void * /*owner*/) const final
{
return false;
}
bool try_create(void *UNUSED(owner), const AttributeInit &UNUSED(initializer)) const final
bool try_create(void * /*owner*/, const AttributeInit & /*initializer*/) const final
{
return false;
}
@ -1312,7 +1337,7 @@ static AttributeAccessorFunctions get_mesh_accessor_functions()
return 0;
}
};
fn.domain_supported = [](const void *UNUSED(owner), const eAttrDomain domain) {
fn.domain_supported = [](const void * /*owner*/, const eAttrDomain domain) {
return ELEM(domain, ATTR_DOMAIN_POINT, ATTR_DOMAIN_EDGE, ATTR_DOMAIN_FACE, ATTR_DOMAIN_CORNER);
};
fn.adapt_domain = [](const void *owner,

View File

@ -180,10 +180,10 @@ static AttributeAccessorFunctions get_pointcloud_accessor_functions()
return 0;
}
};
fn.domain_supported = [](const void *UNUSED(owner), const eAttrDomain domain) {
fn.domain_supported = [](const void * /*owner*/, const eAttrDomain domain) {
return domain == ATTR_DOMAIN_POINT;
};
fn.adapt_domain = [](const void *UNUSED(owner),
fn.adapt_domain = [](const void * /*owner*/,
const blender::GVArray &varray,
const eAttrDomain from_domain,
const eAttrDomain to_domain) {

View File

@ -242,7 +242,7 @@ GVArray InstancesFieldInput::get_varray_for_context(const fn::FieldContext &cont
}
GVArray AttributeFieldInput::get_varray_for_context(const GeometryFieldContext &context,
IndexMask UNUSED(mask)) const
const IndexMask /*mask*/) const
{
const eCustomDataType data_type = cpp_type_to_custom_data_type(*type_);
if (auto attributes = context.attributes()) {
@ -490,12 +490,13 @@ std::optional<eAttrDomain> try_detect_field_domain(const GeometryComponent &comp
return std::nullopt;
}
for (const fn::FieldInput &field_input : field_inputs->deduplicated_nodes) {
if (auto geometry_field_input = dynamic_cast<const GeometryFieldInput *>(&field_input)) {
if (const auto *geometry_field_input = dynamic_cast<const GeometryFieldInput *>(
&field_input)) {
if (!handle_domain(geometry_field_input->preferred_domain(component))) {
return std::nullopt;
}
}
else if (auto mesh_field_input = dynamic_cast<const MeshFieldInput *>(&field_input)) {
else if (const auto *mesh_field_input = dynamic_cast<const MeshFieldInput *>(&field_input)) {
if (!handle_domain(mesh_field_input->preferred_domain(*mesh))) {
return std::nullopt;
}
@ -512,12 +513,14 @@ std::optional<eAttrDomain> try_detect_field_domain(const GeometryComponent &comp
return std::nullopt;
}
for (const fn::FieldInput &field_input : field_inputs->deduplicated_nodes) {
if (auto geometry_field_input = dynamic_cast<const GeometryFieldInput *>(&field_input)) {
if (const auto *geometry_field_input = dynamic_cast<const GeometryFieldInput *>(
&field_input)) {
if (!handle_domain(geometry_field_input->preferred_domain(component))) {
return std::nullopt;
}
}
else if (auto curves_field_input = dynamic_cast<const CurvesFieldInput *>(&field_input)) {
else if (const auto *curves_field_input = dynamic_cast<const CurvesFieldInput *>(
&field_input)) {
if (!handle_domain(
curves_field_input->preferred_domain(CurvesGeometry::wrap(curves->geometry)))) {
return std::nullopt;

View File

@ -13,7 +13,6 @@
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_pointcloud_types.h"
namespace blender::bke {

View File

@ -665,7 +665,7 @@ class IDPUnknownSerializer : public IDPropertySerializer {
}
std::shared_ptr<DictionaryValue> idprop_to_dictionary(
const struct IDProperty *UNUSED(id_property)) const override
const struct IDProperty * /*id_property*/) const override
{
BLI_assert_unreachable();
return nullptr;
@ -677,7 +677,7 @@ class IDPUnknownSerializer : public IDPropertySerializer {
}
std::unique_ptr<IDProperty, IDPropertyDeleter> entry_to_idprop(
DictionaryEntryParser &UNUSED(entry_reader)) const override
DictionaryEntryParser & /*entry_reader*/) const override
{
return nullptr;
}

View File

@ -153,7 +153,7 @@ static void image_init_data(ID *id)
}
}
static void image_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int flag)
static void image_copy_data(Main * /*bmain*/, ID *id_dst, const ID *id_src, const int flag)
{
Image *image_dst = (Image *)id_dst;
const Image *image_src = (const Image *)id_src;
@ -410,7 +410,7 @@ static void image_blend_read_data(BlendDataReader *reader, ID *id)
image_runtime_reset(ima);
}
static void image_blend_read_lib(BlendLibReader *UNUSED(reader), ID *id)
static void image_blend_read_lib(BlendLibReader * /*reader*/, ID *id)
{
Image *ima = (Image *)id;
/* Images have some kind of 'main' cache, when null we should also clear all others. */
@ -1546,7 +1546,7 @@ void BKE_image_print_memlist(Main *bmain)
}
}
static bool imagecache_check_dirty(ImBuf *ibuf, void *UNUSED(userkey), void *UNUSED(userdata))
static bool imagecache_check_dirty(ImBuf *ibuf, void * /*userkey*/, void * /*userdata*/)
{
if (ibuf == nullptr) {
return false;
@ -1595,7 +1595,7 @@ void BKE_image_free_all_textures(Main *bmain)
#endif
}
static bool imagecache_check_free_anim(ImBuf *ibuf, void *UNUSED(userkey), void *userdata)
static bool imagecache_check_free_anim(ImBuf *ibuf, void * /*userkey*/, void *userdata)
{
if (ibuf == nullptr) {
return true;
@ -2470,7 +2470,7 @@ void BKE_stamp_data_free(StampData *stamp_data)
}
/* wrap for callback only */
static void metadata_set_field(void *data, const char *propname, char *propvalue, int UNUSED(len))
static void metadata_set_field(void *data, const char *propname, char *propvalue, int /*len*/)
{
/* We know it is an ImBuf* because that's what we pass to BKE_stamp_info_callback. */
ImBuf *imbuf = static_cast<ImBuf *>(data);
@ -3876,7 +3876,7 @@ static void image_create_multilayer(Image *ima, ImBuf *ibuf, int framenr)
#endif /* WITH_OPENEXR */
/** Common stuff to do with images after loading. */
static void image_init_after_load(Image *ima, ImageUser *iuser, ImBuf *UNUSED(ibuf))
static void image_init_after_load(Image *ima, ImageUser *iuser, ImBuf * /*ibuf*/)
{
/* Preview is null when it has never been used as an icon before.
* Never handle previews/icons outside of main thread. */
@ -5024,7 +5024,7 @@ void BKE_image_user_frame_calc(Image *ima, ImageUser *iuser, int cfra)
/* goes over all ImageUsers, and sets frame numbers if auto-refresh is set */
static void image_editors_update_frame(Image *ima,
ID *UNUSED(iuser_id),
ID * /*iuser_id*/,
ImageUser *iuser,
void *customdata)
{
@ -5046,8 +5046,8 @@ void BKE_image_editors_update_frame(const Main *bmain, int cfra)
}
static void image_user_id_has_animation(Image *ima,
ID *UNUSED(iuser_id),
ImageUser *UNUSED(iuser),
ID * /*iuser_id*/,
ImageUser * /*iuser*/,
void *customdata)
{
if (ima && BKE_image_is_animated(ima)) {
@ -5066,7 +5066,7 @@ bool BKE_image_user_id_has_animation(ID *id)
}
static void image_user_id_eval_animation(Image *ima,
ID *UNUSED(iduser_id),
ID * /*iduser_id*/,
ImageUser *iuser,
void *customdata)
{
@ -5330,7 +5330,7 @@ bool BKE_image_is_dirty(Image *image)
return BKE_image_is_dirty_writable(image, nullptr);
}
void BKE_image_mark_dirty(Image *UNUSED(image), ImBuf *ibuf)
void BKE_image_mark_dirty(Image * /*image*/, ImBuf *ibuf)
{
ibuf->userflags |= IB_BITMAPDIRTY;
}

View File

@ -272,7 +272,7 @@ char BKE_imtype_valid_channels(const char imtype, bool write_file)
case R_IMF_IMTYPE_JP2:
case R_IMF_IMTYPE_DPX:
case R_IMF_IMTYPE_WEBP:
chan_flag |= IMA_CHAN_FLAG_ALPHA;
chan_flag |= IMA_CHAN_FLAG_RGBA;
break;
}

View File

@ -724,6 +724,7 @@ bool BKE_image_render_write_exr(ReportList *reports,
const bool half_float = (imf && imf->depth == R_IMF_CHAN_DEPTH_16);
const bool multi_layer = !(imf && imf->imtype == R_IMF_IMTYPE_OPENEXR);
const bool write_z = !multi_layer && (imf && (imf->flag & R_IMF_FLAG_ZBUF));
const int channels = (!multi_layer && imf && imf->planes == R_IMF_PLANES_RGB) ? 3 : 4;
Vector<float *> tmp_output_rects;
/* Write first layer if not multilayer and no layer was specified. */
@ -767,9 +768,10 @@ bool BKE_image_render_write_exr(ReportList *reports,
rview->rectf, rr->rectx, rr->recty, 4, imf, tmp_output_rects) :
rview->rectf;
for (int a = 0; a < 4; a++) {
for (int a = 0; a < channels; a++) {
char passname[EXR_PASS_MAXNAME];
char layname[EXR_PASS_MAXNAME];
/* "A" is not used if only "RGB" channels are output. */
const char *chan_id = "RGBA";
if (multi_layer) {
@ -832,8 +834,8 @@ bool BKE_image_render_write_exr(ReportList *reports,
rp->rect, rr->rectx, rr->recty, rp->channels, imf, tmp_output_rects) :
rp->rect;
for (int a = 0; a < rp->channels; a++) {
/* Save Combined as RGBA if single layer save. */
for (int a = 0; a < std::min(channels, rp->channels); a++) {
/* Save Combined as RGBA or RGB if single layer save. */
char passname[EXR_PASS_MAXNAME];
char layname[EXR_PASS_MAXNAME];

View File

@ -975,6 +975,23 @@ void BKE_view_layer_synced_ensure(const Scene *scene, struct ViewLayer *view_lay
}
}
void BKE_scene_view_layers_synced_ensure(const Scene *scene)
{
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
BKE_view_layer_synced_ensure(scene, view_layer);
}
}
void BKE_main_view_layers_synced_ensure(const Main *bmain)
{
for (const Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
BKE_scene_view_layers_synced_ensure(scene);
}
/* NOTE: This is not (yet?) covered by the dirty tag and deffered resync system */
BKE_layer_collection_local_sync_all(bmain);
}
static void layer_collection_objects_sync(ViewLayer *view_layer,
LayerCollection *layer,
ListBase *r_lb_new_object_bases,

View File

@ -221,7 +221,7 @@ const char *BKE_id_remapper_result_string(const IDRemapperApplyResult result)
return "";
}
static void id_remapper_print_item_cb(ID *old_id, ID *new_id, void *UNUSED(user_data))
static void id_remapper_print_item_cb(ID *old_id, ID *new_id, void * /*user_data*/)
{
if (old_id != nullptr && new_id != nullptr) {
printf("Remap %s(%p) to %s(%p)\n", old_id->name, old_id, new_id->name, new_id);

View File

@ -23,6 +23,7 @@
#include "BKE_anim_data.h"
#include "BKE_armature.h"
#include "BKE_blender.h"
#include "BKE_collection.h"
#include "BKE_fcurve.h"
#include "BKE_global.h"
@ -1210,6 +1211,9 @@ static void lib_override_library_create_post_process(Main *bmain,
const Object *old_active_object,
const bool is_resync)
{
/* If there is an old active object, there should also always be a given view layer. */
BLI_assert(old_active_object == nullptr || view_layer != nullptr);
/* NOTE: We only care about local IDs here, if a linked object is not instantiated in any way we
* do not do anything about it. */
@ -1269,7 +1273,12 @@ static void lib_override_library_create_post_process(Main *bmain,
}
}
BKE_view_layer_synced_ensure(scene, view_layer);
if (view_layer != nullptr) {
BKE_view_layer_synced_ensure(scene, view_layer);
}
else {
BKE_scene_view_layers_synced_ensure(scene);
}
/* We need to ensure all new overrides of objects are properly instantiated. */
Collection *default_instantiating_collection = residual_storage;
@ -1379,8 +1388,14 @@ bool BKE_lib_override_library_create(Main *bmain,
if (id_hierarchy_root_reference == nullptr) {
id_hierarchy_root_reference = id_root_reference;
}
BKE_view_layer_synced_ensure(scene, view_layer);
const Object *old_active_object = BKE_view_layer_active_object_get(view_layer);
/* While in theory it _should_ be enough to ensure sync of given viewlayer (if any), or at least
* of given scene, think for now it's better to get a fully synced Main at this point, this code
* may do some very wide remapping/data access in some cases. */
BKE_main_view_layers_synced_ensure(bmain);
const Object *old_active_object = (view_layer != nullptr) ?
BKE_view_layer_active_object_get(view_layer) :
nullptr;
const bool success = lib_override_library_create_do(bmain,
scene,
@ -3131,7 +3146,7 @@ bool BKE_lib_override_library_property_operation_operands_validate(
return true;
}
void BKE_lib_override_library_validate(Main *UNUSED(bmain), ID *id, ReportList *reports)
void BKE_lib_override_library_validate(Main * /*bmain*/, ID *id, ReportList *reports)
{
if (id->override_library == nullptr) {
return;
@ -3815,9 +3830,8 @@ void BKE_lib_override_library_main_update(Main *bmain)
/* This temporary swap of G_MAIN is rather ugly,
* but necessary to avoid asserts checks in some RNA assignment functions,
* since those always use on G_MAIN when they need access to a Main database. */
Main *orig_gmain = G_MAIN;
G_MAIN = bmain;
* since those always use G_MAIN when they need access to a Main database. */
Main *orig_gmain = BKE_blender_globals_main_swap(bmain);
BLI_assert(BKE_main_namemap_validate(bmain));
@ -3830,7 +3844,9 @@ void BKE_lib_override_library_main_update(Main *bmain)
BLI_assert(BKE_main_namemap_validate(bmain));
G_MAIN = orig_gmain;
Main *tmp_gmain = BKE_blender_globals_main_swap(orig_gmain);
BLI_assert(tmp_gmain == bmain);
UNUSED_VARS_NDEBUG(tmp_gmain);
}
bool BKE_lib_override_library_id_is_user_deletable(Main *bmain, ID *id)
@ -3938,8 +3954,8 @@ ID *BKE_lib_override_library_operations_store_start(Main *bmain,
return storage_id;
}
void BKE_lib_override_library_operations_store_end(
OverrideLibraryStorage *UNUSED(override_storage), ID *local)
void BKE_lib_override_library_operations_store_end(OverrideLibraryStorage * /*override_storage*/,
ID *local)
{
BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(local));

View File

@ -29,11 +29,12 @@
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
Main *BKE_main_new(void)
Main *BKE_main_new()
{
Main *bmain = MEM_callocN(sizeof(Main), "new main");
bmain->lock = MEM_mallocN(sizeof(SpinLock), "main lock");
BLI_spin_init((SpinLock *)bmain->lock);
bmain->is_global_main = false;
return bmain;
}

View File

@ -65,10 +65,7 @@ static void metaball_init_data(ID *id)
MEMCPY_STRUCT_AFTER(metaball, DNA_struct_default_get(MetaBall), id);
}
static void metaball_copy_data(Main *UNUSED(bmain),
ID *id_dst,
const ID *id_src,
const int UNUSED(flag))
static void metaball_copy_data(Main * /*bmain*/, ID *id_dst, const ID *id_src, const int /*flag*/)
{
MetaBall *metaball_dst = (MetaBall *)id_dst;
const MetaBall *metaball_src = (const MetaBall *)id_src;

View File

@ -5,12 +5,12 @@
* \ingroup bke
*/
#include <ctype.h>
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cctype>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "MEM_guardedalloc.h"
@ -169,7 +169,7 @@ static uint partition_mainb(MetaElem **mainb, uint start, uint end, uint s, floa
uint i = start, j = end - 1;
div *= 2.0f;
while (1) {
while (true) {
while (i < j && div > (mainb[i]->bb->vec[6][s] + mainb[i]->bb->vec[0][s])) {
i++;
}
@ -222,7 +222,7 @@ static void build_bvh_spatial(
part = partition_mainb(process->mainb, start, end, s, div);
make_box_from_metaelem(&node->bb[0], process->mainb[start]);
node->child[0] = NULL;
node->child[0] = nullptr;
if (part > start + 1) {
for (j = start; j < part; j++) {
@ -234,7 +234,7 @@ static void build_bvh_spatial(
build_bvh_spatial(process, node->child[0], start, part, &node->bb[0]);
}
node->child[1] = NULL;
node->child[1] = nullptr;
if (part < end) {
make_box_from_metaelem(&node->bb[1], process->mainb[part]);
@ -461,12 +461,12 @@ static void make_face(PROCESS *process, int i1, int i2, int i3, int i4)
accumulate_vertex_normals_v3(process->no[i1],
process->no[i2],
process->no[i3],
NULL,
nullptr,
n,
process->co[i1],
process->co[i2],
process->co[i3],
NULL);
nullptr);
}
else {
normal_quad_v3(n, process->co[i1], process->co[i2], process->co[i3], process->co[i4]);
@ -677,7 +677,7 @@ static CORNER *setcorner(PROCESS *process, int i, int j, int k)
index = HASH(i, j, k);
c = process->corners[index];
for (; c != NULL; c = c->next) {
for (; c != nullptr; c = c->next) {
if (c->i == i && c->j == j && c->k == k) {
return c;
}
@ -746,7 +746,7 @@ static int otherface(int edge, int face)
/**
* create the 256 entry table for cubical polygonization
*/
static void makecubetable(void)
static void makecubetable()
{
static bool is_done = false;
int i, e, c, done[12], pos[8];
@ -765,14 +765,14 @@ static void makecubetable(void)
}
for (e = 0; e < 12; e++) {
if (!done[e] && (pos[corner1[e]] != pos[corner2[e]])) {
INTLIST *ints = NULL;
INTLIST *ints = nullptr;
INTLISTS *lists = static_cast<INTLISTS *>(MEM_callocN(sizeof(INTLISTS), "mball_intlist"));
int start = e, edge = e;
/* get face that is to right of edge from pos to neg corner: */
int face = pos[corner1[e]] ? rightface[e] : leftface[e];
while (1) {
while (true) {
edge = nextcwedge(edge, face);
done[edge] = 1;
if (pos[corner1[edge]] != pos[corner2[edge]]) {
@ -842,7 +842,7 @@ void BKE_mball_cubeTable_free(void)
MEM_freeN(lists);
lists = nlists;
}
cubetable[i] = NULL;
cubetable[i] = nullptr;
}
}
@ -859,7 +859,7 @@ static int setcenter(PROCESS *process, CENTERLIST *table[], const int i, const i
index = HASH(i, j, k);
q = table[index];
for (l = q; l != NULL; l = l->next) {
for (l = q; l != nullptr; l = l->next) {
if (l->i == i && l->j == j && l->k == k) {
return 1;
}
@ -927,7 +927,7 @@ static int getedge(EDGELIST *table[], int i1, int j1, int k1, int i2, int j2, in
k2 = t;
}
q = table[HASH(i1, j1, k1) + HASH(i2, j2, k2)];
for (; q != NULL; q = q->next) {
for (; q != nullptr; q = q->next) {
if (q->i1 == i1 && q->j1 == j1 && q->k1 == k1 && q->i2 == i2 && q->j2 == j2 && q->k2 == k2) {
return q->vid;
}
@ -1160,7 +1160,7 @@ static void polygonize(PROCESS *process)
find_first_points(process, i);
}
while (process->cubes != NULL) {
while (process->cubes != nullptr) {
c = process->cubes->cube;
process->cubes = process->cubes->next;
@ -1194,15 +1194,15 @@ static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Obje
BLI_split_name_num(obname, &obnr, ob->id.name + 2, '.');
/* make main array */
BKE_scene_base_iter_next(depsgraph, &iter, &sce_iter, 0, NULL, NULL);
BKE_scene_base_iter_next(depsgraph, &iter, &sce_iter, 0, nullptr, nullptr);
while (BKE_scene_base_iter_next(depsgraph, &iter, &sce_iter, 1, &base, &bob)) {
if (bob->type == OB_MBALL) {
zero_size = 0;
ml = NULL;
ml = nullptr;
/* If this metaball is the original that's used for duplication, only have it visible when
* the instancer is visible too. */
if ((base->flag_legacy & OB_FROMDUPLI) == 0 && ob->parent != NULL &&
if ((base->flag_legacy & OB_FROMDUPLI) == 0 && ob->parent != nullptr &&
(ob->parent->transflag & parenting_dupli_transflag) != 0 &&
(BKE_object_visibility(ob->parent, deg_eval_mode) & OB_VISIBLE_SELF) == 0) {
continue;
@ -1412,10 +1412,10 @@ Mesh *BKE_mball_polygonize(Depsgraph *depsgraph, Scene *scene, Object *ob)
}
if (!is_render && (mb->flag == MB_UPDATE_NEVER)) {
return NULL;
return nullptr;
}
if ((G.moving & (G_TRANSFORM_OBJ | G_TRANSFORM_EDIT)) && mb->flag == MB_UPDATE_FAST) {
return NULL;
return nullptr;
}
if (is_render) {
@ -1436,7 +1436,7 @@ Mesh *BKE_mball_polygonize(Depsgraph *depsgraph, Scene *scene, Object *ob)
init_meta(depsgraph, &process, scene, ob);
if (process.totelem == 0) {
freepolygonize(&process);
return NULL;
return nullptr;
}
build_bvh_spatial(&process, &process.metaball_bvh, 0, process.totelem, &process.allbb);
@ -1448,13 +1448,13 @@ Mesh *BKE_mball_polygonize(Depsgraph *depsgraph, Scene *scene, Object *ob)
ob->scale[1] < 0.00001f * (process.allbb.max[1] - process.allbb.min[1]) ||
ob->scale[2] < 0.00001f * (process.allbb.max[2] - process.allbb.min[2])) {
freepolygonize(&process);
return NULL;
return nullptr;
}
polygonize(&process);
if (process.curindex == 0) {
freepolygonize(&process);
return NULL;
return nullptr;
}
freepolygonize(&process);
@ -1463,7 +1463,7 @@ Mesh *BKE_mball_polygonize(Depsgraph *depsgraph, Scene *scene, Object *ob)
mesh->totvert = int(process.curvertex);
MVert *mvert = static_cast<MVert *>(
CustomData_add_layer(&mesh->vdata, CD_MVERT, CD_CONSTRUCT, NULL, mesh->totvert));
CustomData_add_layer(&mesh->vdata, CD_MVERT, CD_CONSTRUCT, nullptr, mesh->totvert));
for (int i = 0; i < mesh->totvert; i++) {
copy_v3_v3(mvert[i].co, process.co[i]);
}
@ -1471,9 +1471,9 @@ Mesh *BKE_mball_polygonize(Depsgraph *depsgraph, Scene *scene, Object *ob)
mesh->totpoly = int(process.curindex);
MPoly *mpoly = static_cast<MPoly *>(
CustomData_add_layer(&mesh->pdata, CD_MPOLY, CD_CONSTRUCT, NULL, mesh->totpoly));
CustomData_add_layer(&mesh->pdata, CD_MPOLY, CD_CONSTRUCT, nullptr, mesh->totpoly));
MLoop *mloop = static_cast<MLoop *>(
CustomData_add_layer(&mesh->ldata, CD_MLOOP, CD_CONSTRUCT, NULL, mesh->totpoly * 4));
CustomData_add_layer(&mesh->ldata, CD_MLOOP, CD_CONSTRUCT, nullptr, mesh->totpoly * 4));
int loop_offset = 0;
for (int i = 0; i < mesh->totpoly; i++) {

View File

@ -604,7 +604,7 @@ void BKE_mesh_to_curve_nurblist(const Mesh *me, ListBase *nurblist, const int ed
}
}
void BKE_mesh_to_curve(Main *bmain, Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob)
void BKE_mesh_to_curve(Main *bmain, Depsgraph *depsgraph, Scene * /*scene*/, Object *ob)
{
/* make new mesh data from the original copy */
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
@ -654,7 +654,7 @@ void BKE_pointcloud_from_mesh(Mesh *me, PointCloud *pointcloud)
point_positions.finish();
}
void BKE_mesh_to_pointcloud(Main *bmain, Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob)
void BKE_mesh_to_pointcloud(Main *bmain, Depsgraph *depsgraph, Scene * /*scene*/, Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@ -710,7 +710,7 @@ void BKE_mesh_edges_set_draw_render(Mesh *mesh)
}
}
void BKE_pointcloud_to_mesh(Main *bmain, Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob)
void BKE_pointcloud_to_mesh(Main *bmain, Depsgraph *depsgraph, Scene * /*scene*/, Object *ob)
{
BLI_assert(ob->type == OB_POINTCLOUD);
@ -1260,12 +1260,15 @@ static int find_object_active_key_uid(const Key &key, const Object &object)
return kb->uid;
}
static void move_shapekey_layers_to_keyblocks(Mesh &mesh, Key &key_dst, const int actshape_uid)
static void move_shapekey_layers_to_keyblocks(const Mesh &mesh,
CustomData &custom_data,
Key &key_dst,
const int actshape_uid)
{
using namespace blender::bke;
for (const int i : IndexRange(CustomData_number_of_layers(&mesh.vdata, CD_SHAPEKEY))) {
const int layer_index = CustomData_get_layer_index_n(&mesh.vdata, CD_SHAPEKEY, i);
CustomDataLayer &layer = mesh.vdata.layers[layer_index];
for (const int i : IndexRange(CustomData_number_of_layers(&custom_data, CD_SHAPEKEY))) {
const int layer_index = CustomData_get_layer_index_n(&custom_data, CD_SHAPEKEY, i);
CustomDataLayer &layer = custom_data.layers[layer_index];
KeyBlock *kb = keyblock_ensure_from_uid(key_dst, layer.uid, layer.name);
MEM_SAFE_FREE(kb->data);
@ -1286,10 +1289,10 @@ static void move_shapekey_layers_to_keyblocks(Mesh &mesh, Key &key_dst, const in
LISTBASE_FOREACH (KeyBlock *, kb, &key_dst.block) {
if (kb->totelem != mesh.totvert) {
MEM_SAFE_FREE(kb->data);
kb->totelem = mesh.totvert;
kb->data = MEM_cnew_array<float3>(kb->totelem, __func__);
CLOG_ERROR(&LOG, "Data for shape key '%s' on mesh missing from evaluated mesh ", kb->name);
}
kb->totelem = mesh.totvert;
kb->data = MEM_cnew_array<float3>(kb->totelem, __func__);
CLOG_ERROR(&LOG, "Data for shape key '%s' on mesh missing from evaluated mesh ", kb->name);
}
}
@ -1334,7 +1337,7 @@ void BKE_mesh_nomain_to_mesh(Mesh *mesh_src, Mesh *mesh_dst, Object *ob)
if (CustomData_has_layer(&mesh_src->vdata, CD_SHAPEKEY)) {
/* If no object, set to -1 so we don't mess up any shapekey layers. */
const int uid_active = ob ? find_object_active_key_uid(*key_dst, *ob) : -1;
move_shapekey_layers_to_keyblocks(*mesh_src, *key_dst, uid_active);
move_shapekey_layers_to_keyblocks(*mesh_dst, mesh_src->vdata, *key_dst, uid_active);
}
else if (mesh_src->totvert != mesh_dst->totvert) {
CLOG_ERROR(&LOG, "Mesh in Main '%s' lost shape keys", mesh_src->id.name);

View File

@ -528,7 +528,7 @@ bool BKE_mesh_center_of_volume(const Mesh *me, float r_cent[3])
* \{ */
static bool mesh_calc_center_centroid_ex(const MVert *mverts,
int UNUSED(mverts_num),
int /*mverts_num*/,
const MLoopTri *looptri,
int looptri_num,
const MLoop *mloop,

View File

@ -440,7 +440,7 @@ class VoronoiVertexWeight : public VertexWeight {
class UniformLoopWeight : public LoopWeight {
public:
float weight_at_index(const int UNUSED(index)) override
float weight_at_index(const int /*index*/) override
{
return 1.0f;
}

View File

@ -47,7 +47,7 @@ UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
uint a;
int i, totuv, nverts;
bool *winding = NULL;
bool *winding = nullptr;
BLI_buffer_declare_static(vec2f, tf_uv_buf, BLI_BUFFER_NOP, 32);
totuv = 0;
@ -61,7 +61,7 @@ UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
}
if (totuv == 0) {
return NULL;
return nullptr;
}
vmap = (UvVertMap *)MEM_callocN(sizeof(*vmap), "UvVertMap");
@ -73,13 +73,13 @@ UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
if (!vmap->vert || !vmap->buf) {
BKE_mesh_uv_vert_map_free(vmap);
return NULL;
return nullptr;
}
mp = mpoly;
for (a = 0; a < totpoly; a++, mp++) {
if (!selected || (!(hide_poly && hide_poly[a]) && (select_poly && select_poly[a]))) {
float(*tf_uv)[2] = NULL;
float(*tf_uv)[2] = nullptr;
if (use_winding) {
tf_uv = (float(*)[2])BLI_buffer_reinit_data(&tf_uv_buf, vec2f, size_t(mp->totloop));
@ -90,7 +90,7 @@ UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
for (i = 0; i < nverts; i++) {
buf->loop_of_poly_index = ushort(i);
buf->poly_index = a;
buf->separate = 0;
buf->separate = false;
buf->next = vmap->vert[mloop[mp->loopstart + i].v];
vmap->vert[mloop[mp->loopstart + i].v] = buf;
@ -109,7 +109,7 @@ UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
/* sort individual uvs for each vert */
for (a = 0; a < totvert; a++) {
UvMapVert *newvlist = NULL, *vlist = vmap->vert[a];
UvMapVert *newvlist = nullptr, *vlist = vmap->vert[a];
UvMapVert *iterv, *v, *lastv, *next;
const float *uv, *uv2;
float uvdiff[2];
@ -121,7 +121,7 @@ UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
newvlist = v;
uv = mloopuv[mpoly[v->poly_index].loopstart + v->loop_of_poly_index].uv;
lastv = NULL;
lastv = nullptr;
iterv = vlist;
while (iterv) {
@ -148,7 +148,7 @@ UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
iterv = next;
}
newvlist->separate = 1;
newvlist->separate = true;
}
vmap->vert[a] = newvlist;
@ -262,12 +262,12 @@ void BKE_mesh_vert_loop_map_create(MeshElemMap **r_map,
void BKE_mesh_vert_looptri_map_create(MeshElemMap **r_map,
int **r_mem,
const MVert *UNUSED(mvert),
const MVert * /*mvert*/,
const int totvert,
const MLoopTri *mlooptri,
const int totlooptri,
const MLoop *mloop,
const int UNUSED(totloop))
const int /*totloop*/)
{
MeshElemMap *map = MEM_cnew_array<MeshElemMap>(size_t(totvert), __func__);
int *indices = static_cast<int *>(MEM_mallocN(sizeof(int) * size_t(totlooptri) * 3, __func__));
@ -384,7 +384,7 @@ void BKE_mesh_vert_edge_vert_map_create(
void BKE_mesh_edge_loop_map_create(MeshElemMap **r_map,
int **r_mem,
const MEdge *UNUSED(medge),
const MEdge * /*medge*/,
const int totedge,
const MPoly *mpoly,
const int totpoly,
@ -437,7 +437,7 @@ void BKE_mesh_edge_loop_map_create(MeshElemMap **r_map,
void BKE_mesh_edge_poly_map_create(MeshElemMap **r_map,
int **r_mem,
const MEdge *UNUSED(medge),
const MEdge * /*medge*/,
const int totedge,
const MPoly *mpoly,
const int totpoly,
@ -624,7 +624,7 @@ static void poly_edge_loop_islands_calc(const MEdge *medge,
int *poly_groups;
int *poly_stack;
BLI_bitmap *edge_borders = NULL;
BLI_bitmap *edge_borders = nullptr;
int num_edgeborders = 0;
int poly_prev = 0;
@ -637,13 +637,13 @@ static void poly_edge_loop_islands_calc(const MEdge *medge,
bool group_id_overflow = false;
/* map vars */
int *edge_poly_mem = NULL;
int *edge_poly_mem = nullptr;
if (totpoly == 0) {
*r_totgroup = 0;
*r_poly_groups = NULL;
*r_poly_groups = nullptr;
if (r_edge_borders) {
*r_edge_borders = NULL;
*r_edge_borders = nullptr;
*r_totedgeborder = 0;
}
return;
@ -802,12 +802,12 @@ static void poly_edge_loop_islands_calc(const MEdge *medge,
}
static bool poly_is_island_boundary_smooth_cb(const MPoly *mp,
const MLoop *UNUSED(ml),
const MLoop * /*ml*/,
const MEdge *me,
const int edge_user_count,
const MPoly *mpoly_array,
const MeshElemMap *edge_poly_map,
void *UNUSED(user_data))
void * /*user_data*/)
{
/* Edge is sharp if one of its polys is flat, or edge itself is sharp,
* or edge is not used by exactly two polygons. */
@ -830,7 +830,7 @@ int *BKE_mesh_calc_smoothgroups(const MEdge *medge,
int *r_totgroup,
const bool use_bitflags)
{
int *poly_groups = NULL;
int *poly_groups = nullptr;
poly_edge_loop_islands_calc(medge,
totedge,
@ -838,14 +838,14 @@ int *BKE_mesh_calc_smoothgroups(const MEdge *medge,
totpoly,
mloop,
totloop,
NULL,
nullptr,
use_bitflags,
poly_is_island_boundary_smooth_cb,
NULL,
nullptr,
&poly_groups,
r_totgroup,
NULL,
NULL);
nullptr,
nullptr);
return poly_groups;
}
@ -860,7 +860,7 @@ void BKE_mesh_loop_islands_init(MeshIslandStore *island_store,
{
MemArena *mem = island_store->mem;
if (mem == NULL) {
if (mem == nullptr) {
mem = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
island_store->mem = mem;
}
@ -890,14 +890,14 @@ void BKE_mesh_loop_islands_clear(MeshIslandStore *island_store)
{
island_store->item_type = MISLAND_TYPE_NONE;
island_store->items_to_islands_num = 0;
island_store->items_to_islands = NULL;
island_store->items_to_islands = nullptr;
island_store->island_type = MISLAND_TYPE_NONE;
island_store->islands_num = 0;
island_store->islands = NULL;
island_store->islands = nullptr;
island_store->innercut_type = MISLAND_TYPE_NONE;
island_store->innercuts = NULL;
island_store->innercuts = nullptr;
if (island_store->mem) {
BLI_memarena_clear(island_store->mem);
@ -910,7 +910,7 @@ void BKE_mesh_loop_islands_free(MeshIslandStore *island_store)
{
if (island_store->mem) {
BLI_memarena_free(island_store->mem);
island_store->mem = NULL;
island_store->mem = nullptr;
}
}
@ -977,12 +977,12 @@ struct MeshCheckIslandBoundaryUv {
const MeshElemMap *edge_loop_map;
};
static bool mesh_check_island_boundary_uv(const MPoly *UNUSED(mp),
static bool mesh_check_island_boundary_uv(const MPoly * /*mp*/,
const MLoop *ml,
const MEdge *me,
const int UNUSED(edge_user_count),
const MPoly *UNUSED(mpoly_array),
const MeshElemMap *UNUSED(edge_poly_map),
const int /*edge_user_count*/,
const MPoly * /*mpoly_array*/,
const MeshElemMap * /*edge_poly_map*/,
void *user_data)
{
if (user_data) {
@ -1021,8 +1021,8 @@ static bool mesh_check_island_boundary_uv(const MPoly *UNUSED(mp),
return (me->flag & ME_SEAM) != 0;
}
static bool mesh_calc_islands_loop_poly_uv(const MVert *UNUSED(verts),
const int UNUSED(totvert),
static bool mesh_calc_islands_loop_poly_uv(const MVert * /*verts*/,
const int /*totvert*/,
const MEdge *edges,
const int totedge,
const MPoly *polys,
@ -1032,7 +1032,7 @@ static bool mesh_calc_islands_loop_poly_uv(const MVert *UNUSED(verts),
const MLoopUV *luvs,
MeshIslandStore *r_island_store)
{
int *poly_groups = NULL;
int *poly_groups = nullptr;
int num_poly_groups;
/* map vars */
@ -1051,10 +1051,10 @@ static bool mesh_calc_islands_loop_poly_uv(const MVert *UNUSED(verts),
/* Those are used to detect 'inner cuts', i.e. edges that are borders,
* and yet have two or more polys of a same group using them
* (typical case: seam used to unwrap properly a cylinder). */
BLI_bitmap *edge_borders = NULL;
BLI_bitmap *edge_borders = nullptr;
int num_edge_borders = 0;
char *edge_border_count = NULL;
int *edge_innercut_indices = NULL;
char *edge_border_count = nullptr;
int *edge_innercut_indices = nullptr;
int num_einnercuts = 0;
int grp_idx, p_idx, pl_idx, l_idx;
@ -1083,7 +1083,7 @@ static bool mesh_calc_islands_loop_poly_uv(const MVert *UNUSED(verts),
edge_poly_map,
false,
mesh_check_island_boundary_uv,
luvs ? &edge_boundary_check_data : NULL,
luvs ? &edge_boundary_check_data : nullptr,
&poly_groups,
&num_poly_groups,
&edge_borders,
@ -1182,7 +1182,7 @@ bool BKE_mesh_calc_islands_loop_poly_edgeseam(const MVert *verts,
MeshIslandStore *r_island_store)
{
return mesh_calc_islands_loop_poly_uv(
verts, totvert, edges, totedge, polys, totpoly, loops, totloop, NULL, r_island_store);
verts, totvert, edges, totedge, polys, totpoly, loops, totloop, nullptr, r_island_store);
}
bool BKE_mesh_calc_islands_loop_poly_uvmap(MVert *verts,
@ -1196,7 +1196,7 @@ bool BKE_mesh_calc_islands_loop_poly_uvmap(MVert *verts,
const MLoopUV *luvs,
MeshIslandStore *r_island_store)
{
BLI_assert(luvs != NULL);
BLI_assert(luvs != nullptr);
return mesh_calc_islands_loop_poly_uv(
verts, totvert, edges, totedge, polys, totpoly, loops, totloop, luvs, r_island_store);
}

View File

@ -181,7 +181,7 @@ struct MeshCalcNormalsData_Poly {
static void mesh_calc_normals_poly_fn(void *__restrict userdata,
const int pidx,
const TaskParallelTLS *__restrict UNUSED(tls))
const TaskParallelTLS *__restrict /*tls*/)
{
const MeshCalcNormalsData_Poly *data = (MeshCalcNormalsData_Poly *)userdata;
const MPoly *mp = &data->mpoly[pidx];
@ -189,9 +189,9 @@ static void mesh_calc_normals_poly_fn(void *__restrict userdata,
}
void BKE_mesh_calc_normals_poly(const MVert *mvert,
int UNUSED(mvert_len),
int /*mvert_len*/,
const MLoop *mloop,
int UNUSED(mloop_len),
int /*mloop_len*/,
const MPoly *mpoly,
int mpoly_len,
float (*r_poly_normals)[3])
@ -231,8 +231,9 @@ struct MeshCalcNormalsData_PolyAndVertex {
float (*vnors)[3];
};
static void mesh_calc_normals_poly_and_vertex_accum_fn(
void *__restrict userdata, const int pidx, const TaskParallelTLS *__restrict UNUSED(tls))
static void mesh_calc_normals_poly_and_vertex_accum_fn(void *__restrict userdata,
const int pidx,
const TaskParallelTLS *__restrict /*tls*/)
{
const MeshCalcNormalsData_PolyAndVertex *data = (MeshCalcNormalsData_PolyAndVertex *)userdata;
const MPoly *mp = &data->mpoly[pidx];
@ -294,7 +295,7 @@ static void mesh_calc_normals_poly_and_vertex_accum_fn(
}
static void mesh_calc_normals_poly_and_vertex_finalize_fn(
void *__restrict userdata, const int vidx, const TaskParallelTLS *__restrict UNUSED(tls))
void *__restrict userdata, const int vidx, const TaskParallelTLS *__restrict /*tls*/)
{
MeshCalcNormalsData_PolyAndVertex *data = (MeshCalcNormalsData_PolyAndVertex *)userdata;
@ -310,7 +311,7 @@ static void mesh_calc_normals_poly_and_vertex_finalize_fn(
void BKE_mesh_calc_normals_poly_and_vertex(const MVert *mvert,
const int mvert_len,
const MLoop *mloop,
const int UNUSED(mloop_len),
const int /*mloop_len*/,
const MPoly *mpoly,
const int mpoly_len,
float (*r_poly_normals)[3],
@ -945,7 +946,7 @@ static void mesh_edges_sharp_tag(LoopSplitTaskDataCommon *data,
}
void BKE_edges_sharp_from_angle_set(const struct MVert *mverts,
const int UNUSED(numVerts),
const int /*numVerts*/,
struct MEdge *medges,
const int numEdges,
const struct MLoop *mloops,
@ -1606,7 +1607,7 @@ static void loop_split_generator(TaskPool *pool, LoopSplitTaskDataCommon *common
void BKE_mesh_normals_loop_split(const MVert *mverts,
const float (*vert_normals)[3],
const int UNUSED(numVerts),
const int /*numVerts*/,
const MEdge *medges,
const int numEdges,
const MLoop *mloops,

View File

@ -78,7 +78,7 @@ void BKE_mesh_runtime_free_data(Mesh *mesh)
mesh_runtime_free_mutexes(mesh);
}
void BKE_mesh_runtime_reset_on_copy(Mesh *mesh, const int UNUSED(flag))
void BKE_mesh_runtime_reset_on_copy(Mesh *mesh, const int /*flag*/)
{
Mesh_Runtime *runtime = &mesh->runtime;

View File

@ -7,7 +7,7 @@
* Functions to evaluate mesh tangents.
*/
#include <limits.h>
#include <climits>
#include "MEM_guardedalloc.h"
@ -77,12 +77,12 @@ struct BKEMeshToTangent {
};
void BKE_mesh_calc_loop_tangent_single_ex(const MVert *mverts,
const int UNUSED(numVerts),
const int /*numVerts*/,
const MLoop *mloops,
float (*r_looptangent)[4],
const float (*loopnors)[3],
const MLoopUV *loopuvs,
const int UNUSED(numLoops),
const int /*numLoops*/,
const MPoly *mpolys,
const int numPolys,
ReportList *reports)
@ -224,12 +224,10 @@ struct SGLSLMeshToTangent {
const float *uv = mloopuv[loop_index].uv;
return mikk::float3(uv[0], uv[1], 1.0f);
}
else {
const float *l_orco = orco[mloop[loop_index].v];
float u, v;
map_to_sphere(&u, &v, l_orco[0], l_orco[1], l_orco[2]);
return mikk::float3(u, v, 1.0f);
}
const float *l_orco = orco[mloop[loop_index].v];
float u, v;
map_to_sphere(&u, &v, l_orco[0], l_orco[1], l_orco[2]);
return mikk::float3(u, v, 1.0f);
}
mikk::float3 GetNormal(const uint face_num, const uint vert_num)
@ -239,35 +237,31 @@ struct SGLSLMeshToTangent {
if (precomputedLoopNormals) {
return mikk::float3(precomputedLoopNormals[loop_index]);
}
else if ((mpoly[lt->poly].flag & ME_SMOOTH) == 0) { /* flat */
if ((mpoly[lt->poly].flag & ME_SMOOTH) == 0) { /* flat */
if (precomputedFaceNormals) {
return mikk::float3(precomputedFaceNormals[lt->poly]);
}
else {
#ifdef USE_LOOPTRI_DETECT_QUADS
const MPoly *mp = &mpoly[lt->poly];
float normal[3];
if (mp->totloop == 4) {
normal_quad_v3(normal,
mvert[mloop[mp->loopstart + 0].v].co,
mvert[mloop[mp->loopstart + 1].v].co,
mvert[mloop[mp->loopstart + 2].v].co,
mvert[mloop[mp->loopstart + 3].v].co);
}
else
#endif
{
normal_tri_v3(normal,
mvert[mloop[lt->tri[0]].v].co,
mvert[mloop[lt->tri[1]].v].co,
mvert[mloop[lt->tri[2]].v].co);
}
return mikk::float3(normal);
const MPoly *mp = &mpoly[lt->poly];
float normal[3];
if (mp->totloop == 4) {
normal_quad_v3(normal,
mvert[mloop[mp->loopstart + 0].v].co,
mvert[mloop[mp->loopstart + 1].v].co,
mvert[mloop[mp->loopstart + 2].v].co,
mvert[mloop[mp->loopstart + 3].v].co);
}
else
#endif
{
normal_tri_v3(normal,
mvert[mloop[lt->tri[0]].v].co,
mvert[mloop[lt->tri[1]].v].co,
mvert[mloop[lt->tri[2]].v].co);
}
return mikk::float3(normal);
}
else {
return mikk::float3(vert_normals[mloop[loop_index].v]);
}
return mikk::float3(vert_normals[mloop[loop_index].v]);
}
void SetTangentSpace(const uint face_num, const uint vert_num, mikk::float3 T, bool orientation)
@ -298,7 +292,7 @@ struct SGLSLMeshToTangent {
#endif
};
static void DM_calc_loop_tangents_thread(TaskPool *__restrict UNUSED(pool), void *taskdata)
static void DM_calc_loop_tangents_thread(TaskPool *__restrict /*pool*/, void *taskdata)
{
SGLSLMeshToTangent *mesh_data = static_cast<SGLSLMeshToTangent *>(taskdata);

View File

@ -263,7 +263,7 @@ static void mesh_calc_tessellation_for_face_with_normal_fn(void *__restrict user
data->poly_normals[index]);
}
static void mesh_calc_tessellation_for_face_free_fn(const void *__restrict UNUSED(userdata),
static void mesh_calc_tessellation_for_face_free_fn(const void *__restrict /*userdata*/,
void *__restrict tls_v)
{
TessellationUserTLS *tls_data = static_cast<TessellationUserTLS *>(tls_v);
@ -275,7 +275,7 @@ static void mesh_calc_tessellation_for_face_free_fn(const void *__restrict UNUSE
static void mesh_recalc_looptri__multi_threaded(const MLoop *mloop,
const MPoly *mpoly,
const MVert *mvert,
int UNUSED(totloop),
int /*totloop*/,
int totpoly,
MLoopTri *mlooptri,
const float (*poly_normals)[3])

View File

@ -1361,13 +1361,13 @@ static int vergedgesort(const void *v1, const void *v2)
/* Create edges based on known verts and faces,
* this function is only used when loading very old blend files */
static void mesh_calc_edges_mdata(const MVert *UNUSED(allvert),
static void mesh_calc_edges_mdata(const MVert * /*allvert*/,
const MFace *allface,
MLoop *allloop,
const MPoly *allpoly,
int UNUSED(totvert),
int /*totvert*/,
int totface,
int UNUSED(totloop),
int /*totloop*/,
int totpoly,
const bool use_old,
MEdge **r_medge,

View File

@ -165,8 +165,8 @@ ModifierData *BKE_modifier_new(int type)
return md;
}
static void modifier_free_data_id_us_cb(void *UNUSED(userData),
Object *UNUSED(ob),
static void modifier_free_data_id_us_cb(void * /*userData*/,
Object * /*ob*/,
ID **idpoin,
int cb_flag)
{
@ -336,7 +336,7 @@ ModifierData *BKE_modifier_copy_ex(const ModifierData *md, int flag)
void BKE_modifier_copydata_generic(const ModifierData *md_src,
ModifierData *md_dst,
const int UNUSED(flag))
const int /*flag*/)
{
const ModifierTypeInfo *mti = BKE_modifier_get_info(ModifierType(md_src->type));
@ -356,8 +356,8 @@ void BKE_modifier_copydata_generic(const ModifierData *md_src,
md_dst->runtime = nullptr;
}
static void modifier_copy_data_id_us_cb(void *UNUSED(userData),
Object *UNUSED(ob),
static void modifier_copy_data_id_us_cb(void * /*userData*/,
Object * /*ob*/,
ID **idpoin,
int cb_flag)
{
@ -406,7 +406,7 @@ bool BKE_modifier_supports_cage(struct Scene *scene, ModifierData *md)
{
const ModifierTypeInfo *mti = BKE_modifier_get_info(ModifierType(md->type));
return ((!mti->isDisabled || !mti->isDisabled(scene, md, 0)) &&
return ((!mti->isDisabled || !mti->isDisabled(scene, md, false)) &&
(mti->flags & eModifierTypeFlag_SupportsEditmode) && BKE_modifier_supports_mapping(md));
}
@ -415,7 +415,7 @@ bool BKE_modifier_couldbe_cage(struct Scene *scene, ModifierData *md)
const ModifierTypeInfo *mti = BKE_modifier_get_info(ModifierType(md->type));
return ((md->mode & eModifierMode_Realtime) && (md->mode & eModifierMode_Editmode) &&
(!mti->isDisabled || !mti->isDisabled(scene, md, 0)) &&
(!mti->isDisabled || !mti->isDisabled(scene, md, false)) &&
BKE_modifier_supports_mapping(md));
}
@ -513,7 +513,7 @@ int BKE_modifiers_get_cage_index(const Scene *scene,
const ModifierTypeInfo *mti = BKE_modifier_get_info(ModifierType(md->type));
bool supports_mapping;
if (mti->isDisabled && mti->isDisabled(scene, md, 0)) {
if (mti->isDisabled && mti->isDisabled(scene, md, false)) {
continue;
}
if (!(mti->flags & eModifierTypeFlag_SupportsEditmode)) {

View File

@ -118,7 +118,7 @@ static void ntree_set_typeinfo(bNodeTree *ntree, bNodeTreeType *typeinfo);
static void node_socket_copy(bNodeSocket *sock_dst, const bNodeSocket *sock_src, const int flag);
static void free_localized_node_groups(bNodeTree *ntree);
static void node_free_node(bNodeTree *ntree, bNode *node);
static void node_socket_interface_free(bNodeTree *UNUSED(ntree),
static void node_socket_interface_free(bNodeTree * /*ntree*/,
bNodeSocket *sock,
const bool do_id_user);
@ -129,7 +129,7 @@ static void ntree_init_data(ID *id)
ntree_set_typeinfo(ntree, nullptr);
}
static void ntree_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int flag)
static void ntree_copy_data(Main * /*bmain*/, ID *id_dst, const ID *id_src, const int flag)
{
bNodeTree *ntree_dst = (bNodeTree *)id_dst;
const bNodeTree *ntree_src = (const bNodeTree *)id_src;
@ -407,13 +407,13 @@ static void node_foreach_path(ID *id, BPathForeachPathData *bpath_data)
static ID **node_owner_pointer_get(ID *id)
{
if ((id->flag & LIB_EMBEDDED_DATA) == 0) {
return NULL;
return nullptr;
}
/* TODO: Sort this NO_MAIN or not for embedded node trees. See T86119. */
// BLI_assert((id->tag & LIB_TAG_NO_MAIN) == 0);
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
BLI_assert(ntree->owner_id != NULL);
BLI_assert(ntree->owner_id != nullptr);
BLI_assert(ntreeFromID(ntree->owner_id) == ntree);
return &ntree->owner_id;
@ -662,7 +662,7 @@ void ntreeBlendReadData(BlendDataReader *reader, ID *owner_id, bNodeTree *ntree)
if (BLO_read_fileversion_get(reader) > 300) {
BLI_assert((ntree->id.flag & LIB_EMBEDDED_DATA) != 0 || owner_id == nullptr);
}
BLI_assert(owner_id == NULL || owner_id->lib == ntree->id.lib);
BLI_assert(owner_id == nullptr || owner_id->lib == ntree->id.lib);
if (owner_id != nullptr && (ntree->id.flag & LIB_EMBEDDED_DATA) == 0) {
/* This is unfortunate, but currently a lot of existing files (including startup ones) have
* missing `LIB_EMBEDDED_DATA` flag.
@ -1533,7 +1533,7 @@ static bool unique_identifier_check(void *arg, const char *identifier)
}
static bNodeSocket *make_socket(bNodeTree *ntree,
bNode *UNUSED(node),
bNode * /*node*/,
int in_out,
ListBase *lb,
const char *idname,
@ -1676,7 +1676,7 @@ static bool socket_id_user_decrement(bNodeSocket *sock)
}
void nodeModifySocketType(bNodeTree *ntree,
bNode *UNUSED(node),
bNode * /*node*/,
bNodeSocket *sock,
const char *idname)
{
@ -1895,7 +1895,7 @@ const char *nodeStaticSocketInterfaceType(int type, int subtype)
return nullptr;
}
const char *nodeStaticSocketLabel(int type, int UNUSED(subtype))
const char *nodeStaticSocketLabel(int type, int /*subtype*/)
{
switch (type) {
case SOCK_FLOAT:
@ -2630,15 +2630,15 @@ static bNodeTree *ntreeAddTree_do(
bNodeTree *ntree = (bNodeTree *)BKE_libblock_alloc(bmain, ID_NT, name, flag);
BKE_libblock_init_empty(&ntree->id);
if (is_embedded) {
BLI_assert(owner_id != NULL);
BLI_assert(owner_id != nullptr);
ntree->id.flag |= LIB_EMBEDDED_DATA;
ntree->owner_id = owner_id;
bNodeTree **ntree_owner_ptr = BKE_ntree_ptr_from_id(owner_id);
BLI_assert(ntree_owner_ptr != NULL);
BLI_assert(ntree_owner_ptr != nullptr);
*ntree_owner_ptr = ntree;
}
else {
BLI_assert(owner_id == NULL);
BLI_assert(owner_id == nullptr);
}
BLI_strncpy(ntree->idname, idname, sizeof(ntree->idname));
@ -2652,7 +2652,7 @@ bNodeTree *ntreeAddTree(Main *bmain, const char *name, const char *idname)
return ntreeAddTree_do(bmain, nullptr, false, name, idname);
}
bNodeTree *ntreeAddTreeEmbedded(Main *UNUSED(bmain),
bNodeTree *ntreeAddTreeEmbedded(Main * /*bmain*/,
ID *owner_id,
const char *name,
const char *idname)
@ -3034,7 +3034,7 @@ void nodeRemoveNode(Main *bmain, bNodeTree *ntree, bNode *node, bool do_id_user)
node_free_node(ntree, node);
}
static void node_socket_interface_free(bNodeTree *UNUSED(ntree),
static void node_socket_interface_free(bNodeTree * /*ntree*/,
bNodeSocket *sock,
const bool do_id_user)
{
@ -3405,7 +3405,7 @@ static void ntree_interface_identifier_base(bNodeTree *ntree, char *base)
}
/* check if the identifier is already in use */
static bool ntree_interface_unique_identifier_check(void *UNUSED(data), const char *identifier)
static bool ntree_interface_unique_identifier_check(void * /*data*/, const char *identifier)
{
return (RNA_struct_find(identifier) != nullptr);
}
@ -3679,7 +3679,7 @@ void nodeSocketDeclarationsUpdate(bNode *node)
update_socket_declarations(&node->outputs, node->runtime->declaration->outputs());
}
bool nodeDeclarationEnsureOnOutdatedNode(bNodeTree *UNUSED(ntree), bNode *node)
bool nodeDeclarationEnsureOnOutdatedNode(bNodeTree * /*ntree*/, bNode *node)
{
if (node->runtime->declaration != nullptr) {
return false;
@ -3978,7 +3978,7 @@ void BKE_node_instance_hash_clear_tags(bNodeInstanceHash *hash)
}
}
void BKE_node_instance_hash_tag(bNodeInstanceHash *UNUSED(hash), void *value)
void BKE_node_instance_hash_tag(bNodeInstanceHash * /*hash*/, void *value)
{
bNodeInstanceHashEntry *entry = (bNodeInstanceHashEntry *)value;
entry->tag = 1;
@ -4184,9 +4184,9 @@ static void node_type_base_defaults(bNodeType *ntype)
}
/* allow this node for any tree type */
static bool node_poll_default(bNodeType *UNUSED(ntype),
bNodeTree *UNUSED(ntree),
const char **UNUSED(disabled_hint))
static bool node_poll_default(bNodeType * /*ntype*/,
bNodeTree * /*ntree*/,
const char ** /*disabled_hint*/)
{
return true;
}
@ -4392,9 +4392,9 @@ void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn)
/* callbacks for undefined types */
static bool node_undefined_poll(bNodeType *UNUSED(ntype),
bNodeTree *UNUSED(nodetree),
const char **UNUSED(r_disabled_hint))
static bool node_undefined_poll(bNodeType * /*ntype*/,
bNodeTree * /*nodetree*/,
const char ** /*r_disabled_hint*/)
{
/* this type can not be added deliberately, it's just a placeholder */
return false;
@ -4745,7 +4745,6 @@ static void registerGeometryNodes()
register_node_type_geo_flip_faces();
register_node_type_geo_geometry_to_instance();
register_node_type_geo_image_texture();
register_node_type_geo_input_control_point_neighbors();
register_node_type_geo_input_curve_handles();
register_node_type_geo_input_curve_tilt();
register_node_type_geo_input_id();
@ -4802,6 +4801,7 @@ static void registerGeometryNodes()
register_node_type_geo_mesh_topology_face_of_corner();
register_node_type_geo_mesh_topology_vertex_of_corner();
register_node_type_geo_object_info();
register_node_type_geo_offset_point_in_curve();
register_node_type_geo_points_to_vertices();
register_node_type_geo_points_to_volume();
register_node_type_geo_points();
@ -4813,12 +4813,14 @@ static void registerGeometryNodes()
register_node_type_geo_sample_index();
register_node_type_geo_sample_nearest_surface();
register_node_type_geo_sample_nearest();
register_node_type_geo_sample_uv_surface();
register_node_type_geo_scale_elements();
register_node_type_geo_scale_instances();
register_node_type_geo_separate_components();
register_node_type_geo_separate_geometry();
register_node_type_geo_self_object();
register_node_type_geo_set_curve_handles();
register_node_type_geo_set_curve_normal();
register_node_type_geo_set_curve_radius();
register_node_type_geo_set_curve_tilt();
register_node_type_geo_set_id();

View File

@ -1679,12 +1679,12 @@ void BKE_ntree_update_tag_link_removed(bNodeTree *ntree)
add_tree_tag(ntree, NTREE_CHANGED_LINK);
}
void BKE_ntree_update_tag_link_added(bNodeTree *ntree, bNodeLink *UNUSED(link))
void BKE_ntree_update_tag_link_added(bNodeTree *ntree, bNodeLink * /*link*/)
{
add_tree_tag(ntree, NTREE_CHANGED_LINK);
}
void BKE_ntree_update_tag_link_mute(bNodeTree *ntree, bNodeLink *UNUSED(link))
void BKE_ntree_update_tag_link_mute(bNodeTree *ntree, bNodeLink * /*link*/)
{
add_tree_tag(ntree, NTREE_CHANGED_LINK);
}
@ -1717,7 +1717,7 @@ void BKE_ntree_update_tag_id_changed(Main *bmain, ID *id)
FOREACH_NODETREE_END;
}
void BKE_ntree_update_tag_image_user_changed(bNodeTree *ntree, ImageUser *UNUSED(iuser))
void BKE_ntree_update_tag_image_user_changed(bNodeTree *ntree, ImageUser * /*iuser*/)
{
/* Would have to search for the node that uses the image user for a more detailed tag. */
add_tree_tag(ntree, NTREE_CHANGED_ANY);

View File

@ -321,7 +321,7 @@ static void object_free_data(ID *id)
}
static void library_foreach_modifiersForeachIDLink(void *user_data,
Object *UNUSED(object),
Object * /*object*/,
ID **id_pointer,
int cb_flag)
{
@ -331,7 +331,7 @@ static void library_foreach_modifiersForeachIDLink(void *user_data,
}
static void library_foreach_gpencil_modifiersForeachIDLink(void *user_data,
Object *UNUSED(object),
Object * /*object*/,
ID **id_pointer,
int cb_flag)
{
@ -341,7 +341,7 @@ static void library_foreach_gpencil_modifiersForeachIDLink(void *user_data,
}
static void library_foreach_shaderfxForeachIDLink(void *user_data,
Object *UNUSED(object),
Object * /*object*/,
ID **id_pointer,
int cb_flag)
{
@ -350,7 +350,7 @@ static void library_foreach_shaderfxForeachIDLink(void *user_data,
data, BKE_lib_query_foreachid_process(data, id_pointer, cb_flag));
}
static void library_foreach_constraintObjectLooper(bConstraint *UNUSED(con),
static void library_foreach_constraintObjectLooper(bConstraint * /*con*/,
ID **id_pointer,
bool is_reference,
void *user_data)
@ -361,7 +361,7 @@ static void library_foreach_constraintObjectLooper(bConstraint *UNUSED(con),
data, BKE_lib_query_foreachid_process(data, id_pointer, cb_flag));
}
static void library_foreach_particlesystemsObjectLooper(ParticleSystem *UNUSED(psys),
static void library_foreach_particlesystemsObjectLooper(ParticleSystem * /*psys*/,
ID **id_pointer,
void *user_data,
int cb_flag)
@ -1017,9 +1017,9 @@ static void expand_constraint_channels(BlendExpander *expander, ListBase *chanba
}
static void expand_object_expandModifiers(void *userData,
Object *UNUSED(ob),
Object * /*ob*/,
ID **idpoin,
int UNUSED(cb_flag))
int /*cb_flag*/)
{
BlendExpander *expander = (BlendExpander *)userData;
BLO_expand(expander, *idpoin);
@ -4126,8 +4126,8 @@ struct GPencilStrokePointIterData {
void *user_data;
};
static void foreach_display_point_gpencil_stroke_fn(bGPDlayer *UNUSED(layer),
bGPDframe *UNUSED(frame),
static void foreach_display_point_gpencil_stroke_fn(bGPDlayer * /*layer*/,
bGPDframe * /*frame*/,
bGPDstroke *stroke,
void *thunk)
{
@ -5098,7 +5098,7 @@ void BKE_object_runtime_reset(Object *object)
memset(&object->runtime, 0, sizeof(object->runtime));
}
void BKE_object_runtime_reset_on_copy(Object *object, const int UNUSED(flag))
void BKE_object_runtime_reset_on_copy(Object *object, const int /*flag*/)
{
Object_Runtime *runtime = &object->runtime;
runtime->data_eval = nullptr;

View File

@ -50,6 +50,7 @@
#include "BKE_object.h"
#include "BKE_particle.h"
#include "BKE_scene.h"
#include "BKE_type_conversions.hh"
#include "BKE_vfont.h"
#include "DEG_depsgraph.h"
@ -101,6 +102,8 @@ struct DupliContext {
Vector<Object *> *instance_stack;
int persistent_id[MAX_DUPLI_RECUR];
int64_t instance_idx[MAX_DUPLI_RECUR];
const GeometrySet *instance_data[MAX_DUPLI_RECUR];
int level;
const struct DupliGenerator *gen;
@ -151,8 +154,13 @@ static void init_context(DupliContext *r_ctx,
/**
* Create sub-context for recursive duplis.
*/
static bool copy_dupli_context(
DupliContext *r_ctx, const DupliContext *ctx, Object *ob, const float mat[4][4], int index)
static bool copy_dupli_context(DupliContext *r_ctx,
const DupliContext *ctx,
Object *ob,
const float mat[4][4],
int index,
const GeometrySet *geometry = nullptr,
int64_t instance_index = 0)
{
*r_ctx = *ctx;
@ -168,6 +176,8 @@ static bool copy_dupli_context(
mul_m4_m4m4(r_ctx->space_mat, (float(*)[4])ctx->space_mat, mat);
}
r_ctx->persistent_id[r_ctx->level] = index;
r_ctx->instance_idx[r_ctx->level] = instance_index;
r_ctx->instance_data[r_ctx->level] = geometry;
++r_ctx->level;
if (r_ctx->level == MAX_DUPLI_RECUR - 1) {
@ -184,8 +194,13 @@ static bool copy_dupli_context(
*
* \param mat: is transform of the object relative to current context (including #Object.obmat).
*/
static DupliObject *make_dupli(
const DupliContext *ctx, Object *ob, const ID *object_data, const float mat[4][4], int index)
static DupliObject *make_dupli(const DupliContext *ctx,
Object *ob,
const ID *object_data,
const float mat[4][4],
int index,
const GeometrySet *geometry = nullptr,
int64_t instance_index = 0)
{
DupliObject *dob;
int i;
@ -219,6 +234,23 @@ static DupliObject *make_dupli(
dob->persistent_id[i] = INT_MAX;
}
/* Store geometry set data for attribute lookup in innermost to outermost
* order, copying only non-null entries to save space. */
const int max_instance = sizeof(dob->instance_data) / sizeof(void *);
int next_instance = 0;
if (geometry != nullptr) {
dob->instance_idx[next_instance] = int(instance_index);
dob->instance_data[next_instance] = geometry;
next_instance++;
}
for (i = ctx->level - 1; i >= 0 && next_instance < max_instance; i--) {
if (ctx->instance_data[i] != nullptr) {
dob->instance_idx[next_instance] = int(ctx->instance_idx[i]);
dob->instance_data[next_instance] = ctx->instance_data[i];
next_instance++;
}
}
/* Meta-balls never draw in duplis, they are instead merged into one by the basis
* meta-ball outside of the group. this does mean that if that meta-ball is not in the
* scene, they will not show up at all, limitation that should be solved once. */
@ -249,9 +281,11 @@ static DupliObject *make_dupli(
static DupliObject *make_dupli(const DupliContext *ctx,
Object *ob,
const float mat[4][4],
int index)
int index,
const GeometrySet *geometry = nullptr,
int64_t instance_index = 0)
{
return make_dupli(ctx, ob, static_cast<ID *>(ob->data), mat, index);
return make_dupli(ctx, ob, static_cast<ID *>(ob->data), mat, index, geometry, instance_index);
}
/**
@ -262,7 +296,9 @@ static DupliObject *make_dupli(const DupliContext *ctx,
static void make_recursive_duplis(const DupliContext *ctx,
Object *ob,
const float space_mat[4][4],
int index)
int index,
const GeometrySet *geometry = nullptr,
int64_t instance_index = 0)
{
if (ctx->instance_stack->contains(ob)) {
/* Avoid recursive instances. */
@ -272,7 +308,7 @@ static void make_recursive_duplis(const DupliContext *ctx,
/* Simple preventing of too deep nested collections with #MAX_DUPLI_RECUR. */
if (ctx->level < MAX_DUPLI_RECUR) {
DupliContext rctx;
if (!copy_dupli_context(&rctx, ctx, ob, space_mat, index)) {
if (!copy_dupli_context(&rctx, ctx, ob, space_mat, index, geometry, instance_index)) {
return;
}
if (rctx.gen) {
@ -875,12 +911,12 @@ static void make_duplis_geometry_set_impl(const DupliContext *ctx,
Object &object = reference.object();
float matrix[4][4];
mul_m4_m4m4(matrix, parent_transform, instance_offset_matrices[i].values);
make_dupli(ctx_for_instance, &object, matrix, id);
make_dupli(ctx_for_instance, &object, matrix, id, &geometry_set, i);
float space_matrix[4][4];
mul_m4_m4m4(space_matrix, instance_offset_matrices[i].values, object.imat);
mul_m4_m4_pre(space_matrix, parent_transform);
make_recursive_duplis(ctx_for_instance, &object, space_matrix, id);
make_recursive_duplis(ctx_for_instance, &object, space_matrix, id, &geometry_set, i);
break;
}
case InstanceReference::Type::Collection: {
@ -892,8 +928,13 @@ static void make_duplis_geometry_set_impl(const DupliContext *ctx,
mul_m4_m4_pre(collection_matrix, parent_transform);
DupliContext sub_ctx;
if (!copy_dupli_context(
&sub_ctx, ctx_for_instance, ctx_for_instance->object, nullptr, id)) {
if (!copy_dupli_context(&sub_ctx,
ctx_for_instance,
ctx_for_instance->object,
nullptr,
id,
&geometry_set,
i)) {
break;
}
@ -918,8 +959,13 @@ static void make_duplis_geometry_set_impl(const DupliContext *ctx,
mul_m4_m4m4(new_transform, parent_transform, instance_offset_matrices[i].values);
DupliContext sub_ctx;
if (copy_dupli_context(
&sub_ctx, ctx_for_instance, ctx_for_instance->object, nullptr, id)) {
if (copy_dupli_context(&sub_ctx,
ctx_for_instance,
ctx_for_instance->object,
nullptr,
id,
&geometry_set,
i)) {
make_duplis_geometry_set_impl(
&sub_ctx, reference.geometry_set(), new_transform, true, false);
}
@ -1719,6 +1765,41 @@ void free_object_duplilist(ListBase *lb)
/** \name Uniform attribute lookup
* \{ */
/** Lookup instance attributes assigned via geometry nodes. */
static bool find_geonode_attribute_rgba(const DupliObject *dupli,
const char *name,
float r_value[4])
{
using namespace blender;
/* Loop over layers from innermost to outermost. */
for (const int i : IndexRange(sizeof(dupli->instance_data) / sizeof(void *))) {
/* Skip non-geonode layers. */
if (dupli->instance_data[i] == nullptr) {
continue;
}
const InstancesComponent *component =
dupli->instance_data[i]->get_component_for_read<InstancesComponent>();
if (component == nullptr) {
continue;
}
/* Attempt to look up the attribute. */
std::optional<bke::AttributeAccessor> attributes = component->attributes();
const VArray data = attributes->lookup<ColorGeometry4f>(name);
/* If the attribute was found and converted to float RGBA successfully, output it. */
if (data) {
copy_v4_v4(r_value, data[dupli->instance_idx[i]]);
return true;
}
}
return false;
}
/** Lookup an arbitrary RNA property and convert it to RGBA if possible. */
static bool find_rna_property_rgba(PointerRNA *id_ptr, const char *name, float r_data[4])
{
@ -1809,6 +1890,11 @@ bool BKE_object_dupli_find_rgba_attribute(
}
}
/* Check geometry node dupli instance attributes. */
if (dupli && find_geonode_attribute_rgba(dupli, name, r_value)) {
return true;
}
/* Check the dupli parent object. */
if (dupli_parent && find_rna_property_rgba(&dupli_parent->id, name, r_value)) {
return true;

View File

@ -278,7 +278,7 @@ void BKE_object_sync_to_original(Depsgraph *depsgraph, Object *object)
object_sync_boundbox_to_original(object_orig, object);
}
void BKE_object_eval_uber_transform(Depsgraph *UNUSED(depsgraph), Object *UNUSED(object))
void BKE_object_eval_uber_transform(Depsgraph * /*depsgraph*/, Object * /*object*/)
{
}

View File

@ -6,8 +6,8 @@
* Tree hash for the outliner space.
*/
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <cstring>
#include "BLI_mempool.h"
#include "BLI_utildefines.h"
@ -34,7 +34,6 @@ class TseGroup {
* item is exponential and becomes critically slow when there are a lot of items in the group. */
int lastused_reset_count = -1;
public:
void add_element(TreeStoreElem &elem);
void remove_element(TreeStoreElem &elem);
};
@ -144,7 +143,7 @@ void TreeHash::remove_element(TreeStoreElem &elem)
TseGroup *TreeHash::lookup_group(const TreeStoreElemKey &key) const
{
auto *group = elem_groups_.lookup_ptr(key);
const auto *group = elem_groups_.lookup_ptr(key);
if (group) {
return group->get();
}

View File

@ -89,10 +89,7 @@ static void palette_init_data(ID *id)
id_fake_user_set(&palette->id);
}
static void palette_copy_data(Main *UNUSED(bmain),
ID *id_dst,
const ID *id_src,
const int UNUSED(flag))
static void palette_copy_data(Main * /*bmain*/, ID *id_dst, const ID *id_src, const int /*flag*/)
{
Palette *palette_dst = (Palette *)id_dst;
const Palette *palette_src = (const Palette *)id_src;
@ -123,7 +120,7 @@ static void palette_blend_read_data(BlendDataReader *reader, ID *id)
BLO_read_list(reader, &palette->colors);
}
static void palette_undo_preserve(BlendLibReader *UNUSED(reader), ID *id_new, ID *id_old)
static void palette_undo_preserve(BlendLibReader * /*reader*/, ID *id_new, ID *id_old)
{
/* Whole Palette is preserved across undo-steps, and it has no extra pointer, simple. */
/* NOTE: We do not care about potential internal references to self here, Palette has none. */
@ -163,10 +160,10 @@ IDTypeInfo IDType_ID_PAL = {
/* lib_override_apply_post */ nullptr,
};
static void paint_curve_copy_data(Main *UNUSED(bmain),
static void paint_curve_copy_data(Main * /*bmain*/,
ID *id_dst,
const ID *id_src,
const int UNUSED(flag))
const int /*flag*/)
{
PaintCurve *paint_curve_dst = (PaintCurve *)id_dst;
const PaintCurve *paint_curve_src = (const PaintCurve *)id_src;
@ -1562,9 +1559,7 @@ static MultiresModifierData *sculpt_multires_modifier_get(const Scene *scene,
/* Multires can't work without displacement layer. */
return nullptr;
}
else {
need_mdisps = true;
}
need_mdisps = true;
}
/* Weight paint operates on original vertices, and needs to treat multires as regular modifier
@ -1797,7 +1792,7 @@ static void sculpt_update_object(
BLI_assert(me_eval_deform->totvert == me->totvert);
ss->deform_cos = BKE_mesh_vert_coords_alloc(me_eval, NULL);
ss->deform_cos = BKE_mesh_vert_coords_alloc(me_eval, nullptr);
BKE_pbvh_vert_coords_apply(ss->pbvh, ss->deform_cos, me->totvert);
used_me_eval = true;
@ -1982,8 +1977,9 @@ int *BKE_sculpt_face_sets_ensure(Mesh *mesh)
bool *BKE_sculpt_hide_poly_ensure(Mesh *mesh)
{
if (bool *hide_poly = static_cast<bool *>(
CustomData_get_layer_named(&mesh->pdata, CD_PROP_BOOL, ".hide_poly"))) {
bool *hide_poly = static_cast<bool *>(
CustomData_get_layer_named(&mesh->pdata, CD_PROP_BOOL, ".hide_poly"));
if (hide_poly != nullptr) {
return hide_poly;
}
return static_cast<bool *>(CustomData_add_layer_named(
@ -2137,7 +2133,7 @@ void BKE_sculpt_sync_face_visibility_to_grids(Mesh *mesh, SubdivCCG *subdiv_ccg)
".hide_poly", ATTR_DOMAIN_FACE, false);
if (hide_poly.is_single() && !hide_poly.get_internal_single()) {
/* Nothing is hidden, so we can just remove all visibility bitmaps. */
for (const int i : hide_poly.index_range()) {
for (const int i : IndexRange(subdiv_ccg->num_grids)) {
BKE_subdiv_ccg_grid_hidden_free(subdiv_ccg, i);
}
return;
@ -2291,6 +2287,7 @@ PBVH *BKE_sculpt_object_pbvh_ensure(Depsgraph *depsgraph, Object *ob)
}
BKE_pbvh_pmap_set(pbvh, ob->sculpt->pmap);
sculpt_attribute_update_refs(ob);
ob->sculpt->pbvh = pbvh;
return pbvh;
@ -2305,7 +2302,7 @@ void BKE_sculpt_bvh_update_from_ccg(PBVH *pbvh, SubdivCCG *subdiv_ccg)
subdiv_ccg->grid_hidden);
}
bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const View3D *UNUSED(v3d))
bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const View3D * /*v3d*/)
{
SculptSession *ss = ob->sculpt;
if (ss == nullptr || ss->pbvh == nullptr || ss->mode_type != OB_MODE_SCULPT) {
@ -2370,7 +2367,7 @@ static CustomData *sculpt_get_cdata(Object *ob, eAttrDomain domain)
return &ss->bm->pdata;
default:
BLI_assert_unreachable();
return NULL;
return nullptr;
}
}
else {
@ -2388,7 +2385,7 @@ static CustomData *sculpt_get_cdata(Object *ob, eAttrDomain domain)
return &me->pdata;
default:
BLI_assert_unreachable();
return NULL;
return nullptr;
}
}
}
@ -2454,9 +2451,9 @@ static bool sculpt_attribute_create(SculptSession *ss,
out->data = MEM_calloc_arrayN(totelem, elemsize, __func__);
out->data_for_bmesh = ss->bm != NULL;
out->data_for_bmesh = ss->bm != nullptr;
out->bmesh_cd_offset = -1;
out->layer = NULL;
out->layer = nullptr;
out->elem_size = elemsize;
out->used = true;
out->elem_num = totelem;
@ -2466,7 +2463,7 @@ static bool sculpt_attribute_create(SculptSession *ss,
switch (BKE_pbvh_type(ss->pbvh)) {
case PBVH_BMESH: {
CustomData *cdata = NULL;
CustomData *cdata = nullptr;
out->data_for_bmesh = true;
switch (domain) {
@ -2490,14 +2487,14 @@ static bool sculpt_attribute_create(SculptSession *ss,
cdata->layers[index].flag |= CD_FLAG_TEMPORARY | CD_FLAG_NOCOPY;
}
out->data = NULL;
out->data = nullptr;
out->layer = cdata->layers + index;
out->bmesh_cd_offset = out->layer->offset;
out->elem_size = CustomData_sizeof(proptype);
break;
}
case PBVH_FACES: {
CustomData *cdata = NULL;
CustomData *cdata = nullptr;
out->data_for_bmesh = false;
@ -2515,14 +2512,14 @@ static bool sculpt_attribute_create(SculptSession *ss,
BLI_assert(CustomData_get_named_layer_index(cdata, proptype, name) == -1);
CustomData_add_layer_named(cdata, proptype, CD_SET_DEFAULT, NULL, totelem, name);
CustomData_add_layer_named(cdata, proptype, CD_SET_DEFAULT, nullptr, totelem, name);
int index = CustomData_get_named_layer_index(cdata, proptype, name);
if (!permanent) {
cdata->layers[index].flag |= CD_FLAG_TEMPORARY | CD_FLAG_NOCOPY;
}
out->data = NULL;
out->data = nullptr;
out->layer = cdata->layers + index;
out->bmesh_cd_offset = -1;
out->data = out->layer->data;
@ -2603,7 +2600,7 @@ static SculptAttribute *sculpt_get_cached_layer(SculptSession *ss,
}
}
return NULL;
return nullptr;
}
bool BKE_sculpt_attribute_exists(Object *ob,
@ -2636,7 +2633,7 @@ static SculptAttribute *sculpt_alloc_attr(SculptSession *ss)
}
BLI_assert_unreachable();
return NULL;
return nullptr;
}
SculptAttribute *BKE_sculpt_attribute_get(struct Object *ob,
@ -2692,7 +2689,7 @@ SculptAttribute *BKE_sculpt_attribute_get(struct Object *ob,
}
}
return NULL;
return nullptr;
}
static SculptAttribute *sculpt_attribute_ensure_ex(Object *ob,
@ -2835,7 +2832,7 @@ bool BKE_sculpt_attribute_destroy(Object *ob, SculptAttribute *attr)
for (int i = 0; i < ptrs_num; i++) {
if (ptrs[i] == attr) {
ptrs[i] = NULL;
ptrs[i] = nullptr;
}
}
@ -2861,7 +2858,7 @@ bool BKE_sculpt_attribute_destroy(Object *ob, SculptAttribute *attr)
BM_data_layer_free_named(ss->bm, cdata, attr->name);
}
else {
CustomData *cdata = NULL;
CustomData *cdata = nullptr;
int totelem = 0;
switch (domain) {
@ -2889,7 +2886,7 @@ bool BKE_sculpt_attribute_destroy(Object *ob, SculptAttribute *attr)
sculpt_attribute_update_refs(ob);
}
attr->data = NULL;
attr->data = nullptr;
attr->used = false;
return true;

View File

@ -114,7 +114,7 @@ struct EncodePixelsUserData {
static void do_encode_pixels(void *__restrict userdata,
const int n,
const TaskParallelTLS *__restrict UNUSED(tls))
const TaskParallelTLS *__restrict /*tls*/)
{
EncodePixelsUserData *data = static_cast<EncodePixelsUserData *>(userdata);
Image *image = data->image;

View File

@ -70,7 +70,7 @@ static void pointcloud_init_data(ID *id)
POINTCLOUD_ATTR_POSITION);
}
static void pointcloud_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int flag)
static void pointcloud_copy_data(Main * /*bmain*/, ID *id_dst, const ID *id_src, const int flag)
{
PointCloud *pointcloud_dst = (PointCloud *)id_dst;
const PointCloud *pointcloud_src = (const PointCloud *)id_src;
@ -339,7 +339,7 @@ BoundBox *BKE_pointcloud_boundbox_get(Object *ob)
return ob->runtime.bb;
}
bool BKE_pointcloud_attribute_required(const PointCloud *UNUSED(pointcloud), const char *name)
bool BKE_pointcloud_attribute_required(const PointCloud * /*pointcloud*/, const char *name)
{
return STREQ(name, POINTCLOUD_ATTR_POSITION);
}

View File

@ -457,7 +457,7 @@ static void scene_free_data(ID *id)
BLI_assert(scene->layer_properties == nullptr);
}
static void scene_foreach_rigidbodyworldSceneLooper(struct RigidBodyWorld *UNUSED(rbw),
static void scene_foreach_rigidbodyworldSceneLooper(struct RigidBodyWorld * /*rbw*/,
ID **id_pointer,
void *user_data,
int cb_flag)
@ -1691,7 +1691,7 @@ static void scene_undo_preserve(BlendLibReader *reader, ID *id_new, ID *id_old)
}
}
static void scene_lib_override_apply_post(ID *id_dst, ID *UNUSED(id_src))
static void scene_lib_override_apply_post(ID *id_dst, ID * /*id_src*/)
{
Scene *scene = (Scene *)id_dst;
@ -2637,7 +2637,7 @@ void BKE_scene_update_sound(Depsgraph *depsgraph, Main *bmain)
BKE_sound_update_scene(depsgraph, scene);
}
void BKE_scene_update_tag_audio_volume(Depsgraph *UNUSED(depsgraph), Scene *scene)
void BKE_scene_update_tag_audio_volume(Depsgraph * /*depsgraph*/, Scene *scene)
{
BLI_assert(DEG_is_evaluated_id(&scene->id));
/* The volume is actually updated in BKE_scene_update_sound(), from either

View File

@ -167,8 +167,8 @@ void *BKE_simulation_add(Main *bmain, const char *name)
return simulation;
}
void BKE_simulation_data_update(Depsgraph *UNUSED(depsgraph),
Scene *UNUSED(scene),
Simulation *UNUSED(simulation))
void BKE_simulation_data_update(Depsgraph * /*depsgraph*/,
Scene * /*scene*/,
Simulation * /*simulation*/)
{
}

View File

@ -514,7 +514,7 @@ static bool subdiv_mesh_topology_info(const SubdivForeachContext *foreach_contex
const int num_edges,
const int num_loops,
const int num_polygons,
const int *UNUSED(subdiv_polygon_offset))
const int * /*subdiv_polygon_offset*/)
{
/* Multi-resolution grid data will be applied or become invalid after subdivision,
* so don't try to preserve it and use memory. Crease values should also not be interpolated. */
@ -626,7 +626,7 @@ static void evaluate_vertex_and_apply_displacement_interpolate(
static void subdiv_mesh_vertex_displacement_every_corner_or_edge(
const SubdivForeachContext *foreach_context,
void *UNUSED(tls),
void * /*tls*/,
const int ptex_face_index,
const float u,
const float v,
@ -643,9 +643,9 @@ static void subdiv_mesh_vertex_displacement_every_corner(
const int ptex_face_index,
const float u,
const float v,
const int UNUSED(coarse_vertex_index),
const int UNUSED(coarse_poly_index),
const int UNUSED(coarse_corner),
const int /*coarse_vertex_index*/,
const int /*coarse_poly_index*/,
const int /*coarse_corner*/,
const int subdiv_vertex_index)
{
subdiv_mesh_vertex_displacement_every_corner_or_edge(
@ -657,9 +657,9 @@ static void subdiv_mesh_vertex_displacement_every_edge(const SubdivForeachContex
const int ptex_face_index,
const float u,
const float v,
const int UNUSED(coarse_edge_index),
const int UNUSED(coarse_poly_index),
const int UNUSED(coarse_corner),
const int /*coarse_edge_index*/,
const int /*coarse_poly_index*/,
const int /*coarse_corner*/,
const int subdiv_vertex_index)
{
subdiv_mesh_vertex_displacement_every_corner_or_edge(
@ -667,13 +667,13 @@ static void subdiv_mesh_vertex_displacement_every_edge(const SubdivForeachContex
}
static void subdiv_mesh_vertex_corner(const SubdivForeachContext *foreach_context,
void *UNUSED(tls),
void * /*tls*/,
const int ptex_face_index,
const float u,
const float v,
const int coarse_vertex_index,
const int UNUSED(coarse_poly_index),
const int UNUSED(coarse_corner),
const int /*coarse_poly_index*/,
const int /*coarse_corner*/,
const int subdiv_vertex_index)
{
BLI_assert(coarse_vertex_index != ORIGINDEX_NONE);
@ -717,7 +717,7 @@ static void subdiv_mesh_vertex_edge(const SubdivForeachContext *foreach_context,
const int ptex_face_index,
const float u,
const float v,
const int UNUSED(coarse_edge_index),
const int /*coarse_edge_index*/,
const int coarse_poly_index,
const int coarse_corner,
const int subdiv_vertex_index)
@ -808,10 +808,10 @@ static void subdiv_copy_edge_data(SubdivMeshContext *ctx,
}
static void subdiv_mesh_edge(const SubdivForeachContext *foreach_context,
void *UNUSED(tls),
void * /*tls*/,
const int coarse_edge_index,
const int subdiv_edge_index,
const bool UNUSED(is_loose),
const bool /*is_loose*/,
const int subdiv_v1,
const int subdiv_v2)
{
@ -902,7 +902,7 @@ static void subdiv_mesh_loop(const SubdivForeachContext *foreach_context,
const int ptex_face_index,
const float u,
const float v,
const int UNUSED(coarse_loop_index),
const int /*coarse_loop_index*/,
const int coarse_poly_index,
const int coarse_corner,
const int subdiv_loop_index,
@ -938,7 +938,7 @@ static void subdiv_copy_poly_data(const SubdivMeshContext *ctx,
}
static void subdiv_mesh_poly(const SubdivForeachContext *foreach_context,
void *UNUSED(tls),
void * /*tls*/,
const int coarse_poly_index,
const int subdiv_poly_index,
const int start_loop_index,
@ -960,7 +960,7 @@ static void subdiv_mesh_poly(const SubdivForeachContext *foreach_context,
* \{ */
static void subdiv_mesh_vertex_loose(const SubdivForeachContext *foreach_context,
void *UNUSED(tls),
void * /*tls*/,
const int coarse_vertex_index,
const int subdiv_vertex_index)
{
@ -1098,7 +1098,7 @@ static void subdiv_mesh_vertex_of_loose_edge_interpolate(SubdivMeshContext *ctx,
}
static void subdiv_mesh_vertex_of_loose_edge(const SubdivForeachContext *foreach_context,
void *UNUSED(tls),
void * /*tls*/,
const int coarse_edge_index,
const float u,
const int subdiv_vertex_index)
@ -1110,9 +1110,9 @@ static void subdiv_mesh_vertex_of_loose_edge(const SubdivForeachContext *foreach
/* Lazily initialize a vertex to edge map to avoid quadratic runtime when subdividing loose
* edges. Do this here to avoid the cost in common cases when there are no loose edges at all. */
if (ctx->vert_to_edge_map == NULL) {
if (ctx->vert_to_edge_map == nullptr) {
std::lock_guard lock{ctx->vert_to_edge_map_mutex};
if (ctx->vert_to_edge_map == NULL) {
if (ctx->vert_to_edge_map == nullptr) {
BKE_mesh_vert_edge_map_create(&ctx->vert_to_edge_map,
&ctx->vert_to_edge_buffer,
ctx->coarse_edges,
@ -1191,7 +1191,7 @@ Mesh *BKE_subdiv_to_mesh(Subdiv *subdiv,
}
}
/* Initialize subdivision mesh creation context. */
SubdivMeshContext subdiv_context = {0};
SubdivMeshContext subdiv_context{};
subdiv_context.settings = settings;
subdiv_context.coarse_mesh = coarse_mesh;
@ -1206,7 +1206,7 @@ Mesh *BKE_subdiv_to_mesh(Subdiv *subdiv,
BKE_subdiv_stats_begin(&subdiv->stats, SUBDIV_STATS_SUBDIV_TO_MESH_GEOMETRY);
SubdivForeachContext foreach_context;
setup_foreach_callbacks(&subdiv_context, &foreach_context);
SubdivMeshTLS tls = {0};
SubdivMeshTLS tls{};
foreach_context.user_data = &subdiv_context;
foreach_context.user_data_tls_size = sizeof(SubdivMeshTLS);
foreach_context.user_data_tls = &tls;

View File

@ -61,18 +61,18 @@ void BKE_viewer_path_blend_write(struct BlendWriter *writer, const ViewerPath *v
LISTBASE_FOREACH (ViewerPathElem *, elem, &viewer_path->path) {
switch (ViewerPathElemType(elem->type)) {
case VIEWER_PATH_ELEM_TYPE_ID: {
auto typed_elem = reinterpret_cast<IDViewerPathElem *>(elem);
const auto *typed_elem = reinterpret_cast<IDViewerPathElem *>(elem);
BLO_write_struct(writer, IDViewerPathElem, typed_elem);
break;
}
case VIEWER_PATH_ELEM_TYPE_MODIFIER: {
auto typed_elem = reinterpret_cast<ModifierViewerPathElem *>(elem);
const auto *typed_elem = reinterpret_cast<ModifierViewerPathElem *>(elem);
BLO_write_struct(writer, ModifierViewerPathElem, typed_elem);
BLO_write_string(writer, typed_elem->modifier_name);
break;
}
case VIEWER_PATH_ELEM_TYPE_NODE: {
auto typed_elem = reinterpret_cast<NodeViewerPathElem *>(elem);
const auto *typed_elem = reinterpret_cast<NodeViewerPathElem *>(elem);
BLO_write_struct(writer, NodeViewerPathElem, typed_elem);
BLO_write_string(writer, typed_elem->node_name);
break;
@ -90,12 +90,12 @@ void BKE_viewer_path_blend_read_data(struct BlendDataReader *reader, ViewerPath
break;
}
case VIEWER_PATH_ELEM_TYPE_MODIFIER: {
auto typed_elem = reinterpret_cast<ModifierViewerPathElem *>(elem);
auto *typed_elem = reinterpret_cast<ModifierViewerPathElem *>(elem);
BLO_read_data_address(reader, &typed_elem->modifier_name);
break;
}
case VIEWER_PATH_ELEM_TYPE_NODE: {
auto typed_elem = reinterpret_cast<NodeViewerPathElem *>(elem);
auto *typed_elem = reinterpret_cast<NodeViewerPathElem *>(elem);
BLO_read_data_address(reader, &typed_elem->node_name);
break;
}
@ -108,7 +108,7 @@ void BKE_viewer_path_blend_read_lib(BlendLibReader *reader, Library *lib, Viewer
LISTBASE_FOREACH (ViewerPathElem *, elem, &viewer_path->path) {
switch (ViewerPathElemType(elem->type)) {
case VIEWER_PATH_ELEM_TYPE_ID: {
auto typed_elem = reinterpret_cast<IDViewerPathElem *>(elem);
auto *typed_elem = reinterpret_cast<IDViewerPathElem *>(elem);
BLO_read_id_address(reader, lib, &typed_elem->id);
break;
}
@ -125,7 +125,7 @@ void BKE_viewer_path_foreach_id(LibraryForeachIDData *data, ViewerPath *viewer_p
LISTBASE_FOREACH (ViewerPathElem *, elem, &viewer_path->path) {
switch (ViewerPathElemType(elem->type)) {
case VIEWER_PATH_ELEM_TYPE_ID: {
auto typed_elem = reinterpret_cast<IDViewerPathElem *>(elem);
auto *typed_elem = reinterpret_cast<IDViewerPathElem *>(elem);
BKE_LIB_FOREACHID_PROCESS_ID(data, typed_elem->id, IDWALK_CB_NOP);
break;
}
@ -142,7 +142,7 @@ void BKE_viewer_path_id_remap(ViewerPath *viewer_path, const IDRemapper *mapping
LISTBASE_FOREACH (ViewerPathElem *, elem, &viewer_path->path) {
switch (ViewerPathElemType(elem->type)) {
case VIEWER_PATH_ELEM_TYPE_ID: {
auto typed_elem = reinterpret_cast<IDViewerPathElem *>(elem);
auto *typed_elem = reinterpret_cast<IDViewerPathElem *>(elem);
BKE_id_remapper_apply(mappings, &typed_elem->id, ID_REMAP_APPLY_DEFAULT);
break;
}
@ -199,22 +199,22 @@ ViewerPathElem *BKE_viewer_path_elem_copy(const ViewerPathElem *src)
ViewerPathElem *dst = BKE_viewer_path_elem_new(ViewerPathElemType(src->type));
switch (ViewerPathElemType(src->type)) {
case VIEWER_PATH_ELEM_TYPE_ID: {
auto old_elem = reinterpret_cast<const IDViewerPathElem *>(src);
auto new_elem = reinterpret_cast<IDViewerPathElem *>(dst);
const auto *old_elem = reinterpret_cast<const IDViewerPathElem *>(src);
auto *new_elem = reinterpret_cast<IDViewerPathElem *>(dst);
new_elem->id = old_elem->id;
break;
}
case VIEWER_PATH_ELEM_TYPE_MODIFIER: {
auto old_elem = reinterpret_cast<const ModifierViewerPathElem *>(src);
auto new_elem = reinterpret_cast<ModifierViewerPathElem *>(dst);
const auto *old_elem = reinterpret_cast<const ModifierViewerPathElem *>(src);
auto *new_elem = reinterpret_cast<ModifierViewerPathElem *>(dst);
if (old_elem->modifier_name != nullptr) {
new_elem->modifier_name = BLI_strdup(old_elem->modifier_name);
}
break;
}
case VIEWER_PATH_ELEM_TYPE_NODE: {
auto old_elem = reinterpret_cast<const NodeViewerPathElem *>(src);
auto new_elem = reinterpret_cast<NodeViewerPathElem *>(dst);
const auto *old_elem = reinterpret_cast<const NodeViewerPathElem *>(src);
auto *new_elem = reinterpret_cast<NodeViewerPathElem *>(dst);
if (old_elem->node_name != nullptr) {
new_elem->node_name = BLI_strdup(old_elem->node_name);
}
@ -231,18 +231,18 @@ bool BKE_viewer_path_elem_equal(const ViewerPathElem *a, const ViewerPathElem *b
}
switch (ViewerPathElemType(a->type)) {
case VIEWER_PATH_ELEM_TYPE_ID: {
auto a_elem = reinterpret_cast<const IDViewerPathElem *>(a);
auto b_elem = reinterpret_cast<const IDViewerPathElem *>(b);
const auto *a_elem = reinterpret_cast<const IDViewerPathElem *>(a);
const auto *b_elem = reinterpret_cast<const IDViewerPathElem *>(b);
return a_elem->id == b_elem->id;
}
case VIEWER_PATH_ELEM_TYPE_MODIFIER: {
auto a_elem = reinterpret_cast<const ModifierViewerPathElem *>(a);
auto b_elem = reinterpret_cast<const ModifierViewerPathElem *>(b);
const auto *a_elem = reinterpret_cast<const ModifierViewerPathElem *>(a);
const auto *b_elem = reinterpret_cast<const ModifierViewerPathElem *>(b);
return StringRef(a_elem->modifier_name) == StringRef(b_elem->modifier_name);
}
case VIEWER_PATH_ELEM_TYPE_NODE: {
auto a_elem = reinterpret_cast<const NodeViewerPathElem *>(a);
auto b_elem = reinterpret_cast<const NodeViewerPathElem *>(b);
const auto *a_elem = reinterpret_cast<const NodeViewerPathElem *>(a);
const auto *b_elem = reinterpret_cast<const NodeViewerPathElem *>(b);
return StringRef(a_elem->node_name) == StringRef(b_elem->node_name);
}
}
@ -256,12 +256,12 @@ void BKE_viewer_path_elem_free(ViewerPathElem *elem)
break;
}
case VIEWER_PATH_ELEM_TYPE_MODIFIER: {
auto typed_elem = reinterpret_cast<ModifierViewerPathElem *>(elem);
auto *typed_elem = reinterpret_cast<ModifierViewerPathElem *>(elem);
MEM_SAFE_FREE(typed_elem->modifier_name);
break;
}
case VIEWER_PATH_ELEM_TYPE_NODE: {
auto typed_elem = reinterpret_cast<NodeViewerPathElem *>(elem);
auto *typed_elem = reinterpret_cast<NodeViewerPathElem *>(elem);
MEM_SAFE_FREE(typed_elem->node_name);
break;
}

View File

@ -363,7 +363,7 @@ struct VolumeGrid {
is_loaded = false;
}
void clear_reference(const char *UNUSED(volume_name))
void clear_reference(const char * /*volume_name*/)
{
/* Clear any reference to a grid in the file cache. */
local_grid = grid()->copyGridWithNewTree();
@ -515,10 +515,7 @@ static void volume_init_data(ID *id)
BLI_strncpy(volume->velocity_grid, "velocity", sizeof(volume->velocity_grid));
}
static void volume_copy_data(Main *UNUSED(bmain),
ID *id_dst,
const ID *id_src,
const int UNUSED(flag))
static void volume_copy_data(Main * /*bmain*/, ID *id_dst, const ID *id_src, const int /*flag*/)
{
Volume *volume_dst = (Volume *)id_dst;
const Volume *volume_src = (const Volume *)id_src;

View File

@ -4,9 +4,9 @@
* \ingroup bke
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "BLI_listbase.h"
#include "BLI_string.h"

View File

@ -63,7 +63,7 @@ class RawAllocator {
};
public:
void *allocate(size_t size, size_t alignment, const char *UNUSED(name))
void *allocate(size_t size, size_t alignment, const char * /*name*/)
{
BLI_assert(is_power_of_2_i(int(alignment)));
void *ptr = malloc(size + alignment + sizeof(MemHead));

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