diff --git a/.clang-tidy b/.clang-tidy index d65027687bb..b51555b55dd 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -39,9 +39,8 @@ Checks: > -modernize-use-nodiscard, -modernize-loop-convert, -modernize-pass-by-value, - -modernize-use-default-member-init, - -modernize-raw-string-literal, - -modernize-avoid-bind, - -modernize-use-transparent-functors, WarningsAsErrors: '*' +CheckOptions: + - key: modernize-use-default-member-init.UseAssignment + value: 1 diff --git a/build_files/build_environment/cmake/opencolorio.cmake b/build_files/build_environment/cmake/opencolorio.cmake index e8b0043edf7..4ad401800d0 100644 --- a/build_files/build_environment/cmake/opencolorio.cmake +++ b/build_files/build_environment/cmake/opencolorio.cmake @@ -32,8 +32,8 @@ set(OPENCOLORIO_EXTRA_ARGS if(APPLE AND NOT("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")) set(OPENCOLORIO_EXTRA_ARGS - ${OPENCOLORIO_EXTRA_ARGS} - -DOCIO_USE_SSE=OFF + ${OPENCOLORIO_EXTRA_ARGS} + -DOCIO_USE_SSE=OFF ) endif() diff --git a/build_files/build_environment/cmake/python.cmake b/build_files/build_environment/cmake/python.cmake index bfb318f9939..dfb2437d3cb 100644 --- a/build_files/build_environment/cmake/python.cmake +++ b/build_files/build_environment/cmake/python.cmake @@ -79,7 +79,7 @@ else() set(PYTHON_CONFIGURE_ENV ${CONFIGURE_ENV}) set(PYTHON_BINARY ${BUILD_DIR}/python/src/external_python/python) set(PYTHON_PATCH ${PATCH_CMD} --verbose -p1 -d ${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python_linux.diff) - endif() + endif() set(PYTHON_CONFIGURE_EXTRA_ARGS "--with-openssl=${LIBDIR}/ssl") set(PYTHON_CFLAGS "-I${LIBDIR}/sqlite/include -I${LIBDIR}/bzip2/include -I${LIBDIR}/lzma/include -I${LIBDIR}/zlib/include") diff --git a/build_files/build_environment/cmake/ssl.cmake b/build_files/build_environment/cmake/ssl.cmake index e1c168817f4..e6741ebb385 100644 --- a/build_files/build_environment/cmake/ssl.cmake +++ b/build_files/build_environment/cmake/ssl.cmake @@ -20,7 +20,7 @@ set(SSL_CONFIGURE_COMMAND ./Configure) set(SSL_PATCH_CMD echo .) if(APPLE) - set(SSL_OS_COMPILER "blender-darwin-${CMAKE_OSX_ARCHITECTURES}") + set(SSL_OS_COMPILER "blender-darwin-${CMAKE_OSX_ARCHITECTURES}") else() if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") set(SSL_EXTRA_ARGS enable-ec_nistp_64_gcc_128) diff --git a/build_files/build_environment/cmake/versions.cmake b/build_files/build_environment/cmake/versions.cmake index 8d3793ef242..98558721cb3 100644 --- a/build_files/build_environment/cmake/versions.cmake +++ b/build_files/build_environment/cmake/versions.cmake @@ -265,7 +265,7 @@ set(PUGIXML_URI https://github.com/zeux/pugixml/archive/v${PUGIXML_VERSION}.tar. set(PUGIXML_HASH 0c208b0664c7fb822bf1b49ad035e8fd) set(FLEXBISON_VERSION 2.5.5) -set(FLEXBISON_URI http://prdownloads.sourceforge.net/winflexbison//win_flex_bison-2.5.5.zip) +set(FLEXBISON_URI http://prdownloads.sourceforge.net/winflexbison/win_flex_bison-2.5.5.zip) set(FLEXBISON_HASH d87a3938194520d904013abef3df10ce) # Libraries to keep Python modules static on Linux. @@ -309,7 +309,7 @@ set(LIBGLU_URI ftp://ftp.freedesktop.org/pub/mesa/glu/glu-${LIBGLU_VERSION}.tar. set(LIBGLU_HASH 151aef599b8259efe9acd599c96ea2a3) set(MESA_VERSION 18.3.1) -set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa//mesa-${MESA_VERSION}.tar.xz) +set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa/mesa-${MESA_VERSION}.tar.xz) set(MESA_HASH d60828056d77bfdbae0970f9b15fb1be) set(NASM_VERSION 2.15.02) diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index 3e84a60033a..9c898a04d55 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -53,15 +53,15 @@ getopt \ --long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,\ with-all,with-opencollada,with-jack,with-embree,with-oidn,with-nanovdb,\ ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,ver-xr-openxr:,\ -force-all,force-python,force-numpy,force-boost,force-tbb,\ +force-all,force-python,force-boost,force-tbb,\ force-ocio,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,\ -build-all,build-python,build-numpy,build-boost,build-tbb,\ +build-all,build-python,build-boost,build-tbb,\ build-ocio,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,\ -skip-python,skip-numpy,skip-boost,skip-tbb,\ +skip-python,skip-boost,skip-tbb,\ skip-ocio,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 \ @@ -188,9 +188,6 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS: --build-python Force the build of Python. - --build-numpy - Force the build of NumPy. - --build-boost Force the build of Boost. @@ -255,9 +252,6 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS: --force-python Force the rebuild of Python. - --force-numpy - Force the rebuild of NumPy. - --force-boost Force the rebuild of Boost. @@ -315,9 +309,6 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS: --skip-python Unconditionally skip Python installation/building. - --skip-numpy - Unconditionally skip NumPy installation/building. - --skip-boost Unconditionally skip Boost installation/building. @@ -389,18 +380,62 @@ PYTHON_VERSION="3.9.1" PYTHON_VERSION_SHORT="3.9" PYTHON_VERSION_MIN="3.7" PYTHON_VERSION_MAX="3.10" -PYTHON_VERSION_INSTALLED=$PYTHON_VERSION_MIN +PYTHON_VERSION_INSTALLED=$PYTHON_VERSION_SHORT PYTHON_FORCE_BUILD=false PYTHON_FORCE_REBUILD=false PYTHON_SKIP=false -NUMPY_VERSION="1.19.5" -NUMPY_VERSION_SHORT="1.19" -NUMPY_VERSION_MIN="1.8" -NUMPY_VERSION_MAX="2.0" -NUMPY_FORCE_BUILD=false -NUMPY_FORCE_REBUILD=false -NUMPY_SKIP=false +# Additional Python modules. +PYTHON_IDNA_VERSION="2.9" +PYTHON_IDNA_VERSION_MIN="2.0" +PYTHON_IDNA_VERSION_MAX="3.0" +PYTHON_IDNA_NAME="idna" + +PYTHON_CHARDET_VERSION="3.0.4" +PYTHON_CHARDET_VERSION_MIN="3.0" +PYTHON_CHARDET_VERSION_MAX="5.0" +PYTHON_CHARDET_NAME="chardet" + +PYTHON_URLLIB3_VERSION="1.25.9" +PYTHON_URLLIB3_VERSION_MIN="1.0" +PYTHON_URLLIB3_VERSION_MAX="2.0" +PYTHON_URLLIB3_NAME="urllib3" + +PYTHON_CERTIFI_VERSION="2020.4.5.2" +PYTHON_CERTIFI_VERSION_MIN="2020.0" +PYTHON_CERTIFI_VERSION_MAX="2021.0" +PYTHON_CERTIFI_NAME="certifi" + +PYTHON_REQUESTS_VERSION="2.23.0" +PYTHON_REQUESTS_VERSION_MIN="2.0" +PYTHON_REQUESTS_VERSION_MAX="3.0" +PYTHON_REQUESTS_NAME="requests" + +PYTHON_NUMPY_VERSION="1.19.5" +PYTHON_NUMPY_VERSION_MIN="1.14" +PYTHON_NUMPY_VERSION_MAX="2.0" +PYTHON_NUMPY_NAME="numpy" + +# As package-ready parameters (only used with distro packages). +PYTHON_MODULES_PACKAGES=( + "$PYTHON_IDNA_NAME $PYTHON_IDNA_VERSION_MIN $PYTHON_IDNA_VERSION_MAX" + "$PYTHON_CHARDET_NAME $PYTHON_CHARDET_VERSION_MIN $PYTHON_CHARDET_VERSION_MAX" + "$PYTHON_URLLIB3_NAME $PYTHON_URLLIB3_VERSION_MIN $PYTHON_URLLIB3_VERSION_MAX" + "$PYTHON_CERTIFI_NAME $PYTHON_CERTIFI_VERSION_MIN $PYTHON_CERTIFI_VERSION_MAX" + "$PYTHON_REQUESTS_NAME $PYTHON_REQUESTS_VERSION_MIN $PYTHON_REQUESTS_VERSION_MAX" + "$PYTHON_NUMPY_NAME $PYTHON_NUMPY_VERSION_MIN $PYTHON_NUMPY_VERSION_MAX" +) + +# As pip-ready parameters (only used when building python). +PYTHON_MODULES_PIP=( + "$PYTHON_IDNA_NAME==$PYTHON_IDNA_VERSION" + "$PYTHON_CHARDET_NAME==$PYTHON_CHARDET_VERSION" + "$PYTHON_URLLIB3_NAME==$PYTHON_URLLIB3_VERSION" + "$PYTHON_CERTIFI_NAME==$PYTHON_CERTIFI_VERSION" + "$PYTHON_REQUESTS_NAME==$PYTHON_REQUESTS_VERSION" + "$PYTHON_NUMPY_NAME==$PYTHON_NUMPY_VERSION" +) + BOOST_VERSION="1.73.0" BOOST_VERSION_SHORT="1.73" @@ -491,10 +526,10 @@ ALEMBIC_FORCE_BUILD=false ALEMBIC_FORCE_REBUILD=false ALEMBIC_SKIP=false -USD_VERSION="20.05" -USD_VERSION_SHORT="20.05" +USD_VERSION="20.08" +USD_VERSION_SHORT="20.08" USD_VERSION_MIN="20.05" -USD_VERSION_MAX="20.06" +USD_VERSION_MAX="21.00" USD_FORCE_BUILD=false USD_FORCE_REBUILD=false USD_SKIP=false @@ -730,7 +765,6 @@ while true; do ;; --build-all) PYTHON_FORCE_BUILD=true - NUMPY_FORCE_BUILD=true BOOST_FORCE_BUILD=true TBB_FORCE_BUILD=true OCIO_FORCE_BUILD=true @@ -751,12 +785,6 @@ while true; do ;; --build-python) PYTHON_FORCE_BUILD=true - NUMPY_FORCE_BUILD=true - shift; continue - ;; - --build-numpy) - PYTHON_FORCE_BUILD=true - NUMPY_FORCE_BUILD=true shift; continue ;; --build-boost) @@ -809,7 +837,6 @@ while true; do ;; --force-all) PYTHON_FORCE_REBUILD=true - NUMPY_FORCE_REBUILD=true BOOST_FORCE_REBUILD=true TBB_FORCE_REBUILD=true OCIO_FORCE_REBUILD=true @@ -830,12 +857,8 @@ while true; do ;; --force-python) PYTHON_FORCE_REBUILD=true - NUMPY_FORCE_REBUILD=true shift; continue ;; - --force-numpy) - NUMPY_FORCE_REBUILD=true; shift; continue - ;; --force-boost) BOOST_FORCE_REBUILD=true; shift; continue ;; @@ -887,9 +910,6 @@ while true; do --skip-python) PYTHON_SKIP=true; shift; continue ;; - --skip-numpy) - NUMPY_SKIP=true; shift; continue - ;; --skip-boost) BOOST_SKIP=true; shift; continue ;; @@ -990,11 +1010,10 @@ PRINT "" # This has to be done here, because user might force some versions... PYTHON_SOURCE=( "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz" ) -NUMPY_SOURCE=( "https://github.com/numpy/numpy/releases/download/v$NUMPY_VERSION/numpy-$NUMPY_VERSION.tar.gz" ) _boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'` BOOST_SOURCE=( "https://dl.bintray.com/boostorg/release/$BOOST_VERSION/source/boost_$_boost_version_nodots.tar.bz2" ) -BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams --with-python --with-program_options" +BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams --with-python --with-program_options --with-serialization --with-atomic" TBB_SOURCE=( "https://github.com/oneapi-src/oneTBB/archive/$TBB_VERSION$TBB_VERSION_UPDATE.tar.gz" ) TBB_SOURCE_CMAKE=( "https://raw.githubusercontent.com/wjakob/tbb/master/CMakeLists.txt" ) @@ -1103,7 +1122,7 @@ Those libraries should be available as packages in all recent distributions (opt * libjpeg, libpng, libtiff, [openjpeg2], [libopenal]. * libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed). * libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp. - * libsdl2, libglew, libpugixml, libpotrace, [libgmp], [libglewmx], fontconfig.\"" + * libsdl2, libglew, libpugixml, libpotrace, [libgmp], [libglewmx], fontconfig, [libharu/libhpdf].\"" DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES: @@ -1112,19 +1131,24 @@ The following libraries will probably not all be available as packages in your d You can force install_deps to build those with '--build-all' or relevant 'build-foo' options, see '--help' message. You may also want to build them yourself (optional ones are [between brackets]): - * Python $PYTHON_VERSION_MIN (from $PYTHON_SOURCE). - * [NumPy $NUMPY_VERSION_MIN] (from $NUMPY_SOURCE). - * Boost $BOOST_VERSION_MIN (from $BOOST_SOURCE, modules: $BOOST_BUILD_MODULES). - * TBB $TBB_VERSION_MIN (from $TBB_SOURCE). - * [FFMpeg $FFMPEG_VERSION_MIN (needs libvorbis, libogg, libtheora, libx264, libmp3lame, libxvidcore, libvpx, ...)] (from $FFMPEG_SOURCE). - * [OpenColorIO $OCIO_VERSION_MIN] (from $OCIO_SOURCE). - * ILMBase $OPENEXR_VERSION_MIN (from $OPENEXR_SOURCE). - * OpenEXR $OPENEXR_VERSION_MIN (from $OPENEXR_SOURCE). - * OpenImageIO $OIIO_VERSION_MIN (from $OIIO_SOURCE). - * [LLVM $LLVM_VERSION_MIN (with clang)] (from $LLVM_SOURCE, and $LLVM_CLANG_SOURCE). - * [OpenShadingLanguage $OSL_VERSION_MIN] (from $OSL_SOURCE_REPO, branch $OSL_SOURCE_REPO_BRANCH, commit $OSL_SOURCE_REPO_UID). - * [OpenSubDiv $OSD_VERSION_MIN] (from $OSD_SOURCE_REPO, branch $OSD_SOURCE_REPO_BRANCH, commit $OSD_SOURCE_REPO_UID). - * [OpenVDB $OPENVDB_VERSION_MIN] (from $OPENVDB_SOURCE), [Blosc $OPENVDB_BLOSC_VERSION] (from $OPENVDB_BLOSC_SOURCE). + * Python $PYTHON_VERSION (from $PYTHON_SOURCE). + ** [IDNA $PYTHON_IDNA_VERSION] (use pip). + ** [Chardet $PYTHON_CHARDET_VERSION] (use pip). + ** [Urllib3 $PYTHON_URLLIB3_VERSION] (use pip). + ** [Certifi $PYTHON_CERTIFI_VERSION] (use pip). + ** [Requests $PYTHON_REQUESTS_VERSION] (use pip). + ** [NumPy $PYTHON_NUMPY_VERSION] (use pip). + * Boost $BOOST_VERSION (from $BOOST_SOURCE, modules: $BOOST_BUILD_MODULES). + * TBB $TBB_VERSION (from $TBB_SOURCE). + * [FFMpeg $FFMPEG_VERSION (needs libvorbis, libogg, libtheora, libx264, libmp3lame, libxvidcore, libvpx, ...)] (from $FFMPEG_SOURCE). + * [OpenColorIO $OCIO_VERSION] (from $OCIO_SOURCE). + * ILMBase $OPENEXR_VERSION (from $OPENEXR_SOURCE). + * OpenEXR $OPENEXR_VERSION (from $OPENEXR_SOURCE). + * OpenImageIO $OIIO_VERSION (from $OIIO_SOURCE). + * [LLVM $LLVM_VERSION (with clang)] (from $LLVM_SOURCE, and $LLVM_CLANG_SOURCE). + * [OpenShadingLanguage $OSL_VERSION] (from $OSL_SOURCE_REPO, branch $OSL_SOURCE_REPO_BRANCH, commit $OSL_SOURCE_REPO_UID). + * [OpenSubDiv $OSD_VERSION] (from $OSD_SOURCE_REPO, branch $OSD_SOURCE_REPO_BRANCH, commit $OSD_SOURCE_REPO_UID). + * [OpenVDB $OPENVDB_VERSION] (from $OPENVDB_SOURCE), [Blosc $OPENVDB_BLOSC_VERSION] (from $OPENVDB_BLOSC_SOURCE). * [OpenCollada $OPENCOLLADA_VERSION] (from $OPENCOLLADA_SOURCE). * [Embree $EMBREE_VERSION] (from $EMBREE_SOURCE). * [OpenImageDenoise $OIDN_VERSION] (from $OIDN_SOURCE). @@ -1309,18 +1333,22 @@ magic_compile_set() { # Note: should clean nicely in $INST, but not in $SRC, when we switch to a new version of a lib... _clean() { - rm -rf `readlink -f $_inst_shortcut` + if [ $_inst_shortcut ]; then + rm -rf `readlink -f $_inst_shortcut` + rm -rf $_inst_shortcut + fi # Only remove $_src dir when not using git repo (avoids to re-clone the whole repo every time!!!). if [ $_git == false ]; then rm -rf $_src fi rm -rf $_inst - rm -rf $_inst_shortcut } _create_inst_shortcut() { - rm -f $_inst_shortcut - ln -s $_inst $_inst_shortcut + if [ $_inst_shortcut ]; then + rm -f $_inst_shortcut + ln -s $_inst $_inst_shortcut + fi } # ldconfig @@ -1350,14 +1378,19 @@ _init_python() { } _update_deps_python() { - : + if [ "$1" = true ]; then + BOOST_FORCE_BUILD=true + fi + if [ "$2" = true ]; then + BOOST_FORCE_REBUILD=true + fi } clean_Python() { - clean_Numpy _init_python if [ -d $_inst ]; then - _update_deps_python + # Force rebuilding the dependencies if needed. + _update_deps_python false true fi _clean } @@ -1369,9 +1402,12 @@ compile_Python() { fi # To be changed each time we make edits that would modify the compiled result! - py_magic=1 + py_magic=3 _init_python + # Force having own builds for the dependencies. + _update_deps_python true false + # Clean install if needed! magic_compile_check python-$PYTHON_VERSION $py_magic if [ $? -eq 1 -o "$PYTHON_FORCE_REBUILD" = true ]; then @@ -1380,10 +1416,9 @@ compile_Python() { if [ ! -d $_inst ]; then INFO "Building Python-$PYTHON_VERSION" - _is_building=true - # Rebuild dependencies as well! - _update_deps_python + # Force rebuilding the dependencies. + _update_deps_python true true prepare_inst @@ -1413,96 +1448,25 @@ compile_Python() { magic_compile_set python-$PYTHON_VERSION $py_magic + PYTHON_VERSION_INSTALLED=$PYTHON_VERSION_SHORT + cd $CWD INFO "Done compiling Python-$PYTHON_VERSION!" - _is_building=false else INFO "Own Python-$PYTHON_VERSION is up to date, nothing to do!" INFO "If you want to force rebuild of this lib, use the --force-python option." fi run_ldconfig "python-$PYTHON_VERSION_SHORT" -} -# ---------------------------------------------------------------------------- -# Build Numpy - -_init_numpy() { - _src=$SRC/numpy-$NUMPY_VERSION - _git=false - _inst=$INST/numpy-$NUMPY_VERSION - _python=$INST/python-$PYTHON_VERSION_SHORT - _site=lib/python$PYTHON_VERSION_SHORT/site-packages - _inst_shortcut=$_python/$_site/numpy -} - -_update_deps_numpy() { - : -} - -clean_Numpy() { - _init_numpy - if [ -d $_inst ]; then - _update_deps_numpy - fi - _clean -} - -compile_Numpy() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, Numpy will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled result! - numpy_magic=0 - _init_numpy - - # Clean install if needed! - magic_compile_check numpy-$NUMPY_VERSION $numpy_magic - if [ $? -eq 1 -o "$NUMPY_FORCE_REBUILD" = true ]; then - clean_Numpy - fi - - if [ ! -d $_inst ]; then - INFO "Building Numpy-$NUMPY_VERSION" - _is_building=true - - # Rebuild dependencies as well! - _update_deps_numpy - - prepare_inst - - if [ ! -d $_src ]; then - mkdir -p $SRC - download NUMPY_SOURCE[@] $_src.tar.gz - - INFO "Unpacking Numpy-$NUMPY_VERSION" - tar -C $SRC -xf $_src.tar.gz - fi - - cd $_src - - $_python/bin/python3 setup.py install --old-and-unmanageable --prefix=$_inst - - if [ -d $_inst ]; then - # Can't use _create_inst_shortcut here... - rm -f $_inst_shortcut - ln -s $_inst/$_site/numpy $_inst_shortcut - else - ERROR "Numpy-$NUMPY_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set numpy-$NUMPY_VERSION $numpy_magic - - cd $CWD - INFO "Done compiling Numpy-$NUMPY_VERSION!" - _is_building=false - else - INFO "Own Numpy-$NUMPY_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-numpy option." - fi + # Extra step: install required modules with pip. + _python="$_inst/bin/python3" + $_python -m pip install --upgrade pip + for module in "${PYTHON_MODULES_PIP[@]}" + do + PRINT "" + $_python -m pip install $module --no-binary :all: + done } # ---------------------------------------------------------------------------- @@ -1516,22 +1480,25 @@ _init_boost() { } _update_deps_boost() { - OIIO_FORCE_REBUILD=true - OSL_FORCE_REBUILD=true - OPENVDB_FORCE_REBUILD=true - ALEMBIC_FORCE_REBUILD=true - if [ "$_is_building" = true ]; then + if [ "$1" = true ]; then OIIO_FORCE_BUILD=true OSL_FORCE_BUILD=true OPENVDB_FORCE_BUILD=true ALEMBIC_FORCE_BUILD=true fi + if [ "$2" = true ]; then + OIIO_FORCE_REBUILD=true + OSL_FORCE_REBUILD=true + OPENVDB_FORCE_REBUILD=true + ALEMBIC_FORCE_REBUILD=true + fi } clean_Boost() { _init_boost if [ -d $_inst ]; then - _update_deps_boost + # Force rebuilding the dependencies if needed. + _update_deps_boost false true fi _clean } @@ -1543,10 +1510,13 @@ compile_Boost() { fi # To be changed each time we make edits that would modify the compiled result! - boost_magic=11 + boost_magic=14 _init_boost + # Force having own builds for the dependencies. + _update_deps_boost true false + # Clean install if needed! magic_compile_check boost-$BOOST_VERSION $boost_magic if [ $? -eq 1 -o "$BOOST_FORCE_REBUILD" = true ]; then @@ -1555,10 +1525,9 @@ compile_Boost() { if [ ! -d $_inst ]; then INFO "Building Boost-$BOOST_VERSION" - _is_building=true - # Rebuild dependencies as well! - _update_deps_boost + # Force rebuilding the dependencies. + _update_deps_boost true true prepare_inst @@ -1571,7 +1540,11 @@ compile_Boost() { cd $_src if [ ! -f $_src/b2 ]; then - ./bootstrap.sh + if [ -d $INST/python-$PYTHON_VERSION_INSTALLED ]; then + ./bootstrap.sh --with-python-root="$INST/python-$PYTHON_VERSION_INSTALLED" + else + ./bootstrap.sh + fi fi ./b2 -j$THREADS -a $BOOST_BUILD_MODULES \ --prefix=$_inst --disable-icu boost.locale.icu=off install @@ -1588,7 +1561,6 @@ compile_Boost() { cd $CWD INFO "Done compiling Boost-$BOOST_VERSION!" - _is_building=false else INFO "Own Boost-$BOOST_VERSION is up to date, nothing to do!" INFO "If you want to force rebuild of this lib, use the --force-boost option." @@ -1609,24 +1581,27 @@ _init_tbb() { } _update_deps_tbb() { - OSD_FORCE_REBUILD=true - OPENVDB_FORCE_REBUILD=true - USD_FORCE_REBUILD=true - EMBREE_FORCE_REBUILD=true - OIDN_FORCE_REBUILD=true - if [ "$_is_building" = true ]; then + if [ "$1" = true ]; then OSD_FORCE_BUILD=true OPENVDB_FORCE_BUILD=true USD_FORCE_BUILD=true EMBREE_FORCE_BUILD=true OIDN_FORCE_BUILD=true fi + if [ "$2" = true ]; then + OSD_FORCE_REBUILD=true + OPENVDB_FORCE_REBUILD=true + USD_FORCE_REBUILD=true + EMBREE_FORCE_REBUILD=true + OIDN_FORCE_REBUILD=true + fi } clean_TBB() { _init_tbb if [ -d $_inst ]; then - _update_deps_tbb + # Force rebuilding the dependencies if needed. + _update_deps_tbb false true fi _clean } @@ -1641,6 +1616,9 @@ compile_TBB() { tbb_magic=0 _init_tbb + # Force having own builds for the dependencies. + _update_deps_tbb true false + # Clean install if needed! magic_compile_check tbb-$TBB_VERSION $tbb_magic if [ $? -eq 1 -o "$TBB_FORCE_REBUILD" = true ]; then @@ -1649,10 +1627,9 @@ compile_TBB() { if [ ! -d $_inst ]; then INFO "Building TBB-$TBB_VERSION$TBB_VERSION_UPDATE" - _is_building=true - # Rebuild dependencies as well! - _update_deps_tbb + # Force rebuilding the dependencies. + _update_deps_tbb true true prepare_inst @@ -1713,7 +1690,6 @@ compile_TBB() { cd $CWD INFO "Done compiling TBB-$TBB_VERSION$TBB_VERSION_UPDATE!" - _is_building=false else INFO "Own TBB-$TBB_VERSION$TBB_VERSION_UPDATE is up to date, nothing to do!" INFO "If you want to force rebuild of this lib, use the --force-tbb option." @@ -1743,7 +1719,8 @@ _update_deps_ocio() { clean_OCIO() { _init_ocio if [ -d $_inst ]; then - _update_deps_ocio + # Force rebuilding the dependencies if needed. + _update_deps_ocio false true fi _clean } @@ -1758,6 +1735,9 @@ compile_OCIO() { ocio_magic=2 _init_ocio + # Force having own builds for the dependencies. + _update_deps_ocio true false + # Clean install if needed! magic_compile_check ocio-$OCIO_VERSION $ocio_magic if [ $? -eq 1 -o "$OCIO_FORCE_REBUILD" = true ]; then @@ -1766,10 +1746,9 @@ compile_OCIO() { if [ ! -d $_inst ]; then INFO "Building OpenColorIO-$OCIO_VERSION" - _is_building=true - # Rebuild dependencies as well! - _update_deps_ocio + # Force rebuilding the dependencies. + _update_deps_ocio true true prepare_inst @@ -1842,7 +1821,6 @@ compile_OCIO() { cd $CWD INFO "Done compiling OpenColorIO-$OCIO_VERSION!" - _is_building=false else INFO "Own OpenColorIO-$OCIO_VERSION is up to date, nothing to do!" INFO "If you want to force rebuild of this lib, use the --force-ocio option." @@ -1862,18 +1840,21 @@ _init_openexr() { } _update_deps_openexr() { - OIIO_FORCE_REBUILD=true - ALEMBIC_FORCE_REBUILD=true - if [ "$_is_building" = true ]; then + if [ "$1" = true ]; then OIIO_FORCE_BUILD=true ALEMBIC_FORCE_BUILD=true fi + if [ "$2" = true ]; then + OIIO_FORCE_REBUILD=true + ALEMBIC_FORCE_REBUILD=true + fi } clean_OPENEXR() { _init_openexr if [ -d $_inst ]; then - _update_deps_openexr + # Force rebuilding the dependencies if needed. + _update_deps_openexr false true fi _clean } @@ -1886,6 +1867,10 @@ compile_OPENEXR() { # To be changed each time we make edits that would modify the compiled result! openexr_magic=15 + _init_openexr + + # Force having own builds for the dependencies. + _update_deps_openexr true false # Clean install if needed! magic_compile_check openexr-$OPENEXR_VERSION $openexr_magic @@ -1894,14 +1879,12 @@ compile_OPENEXR() { fi PRINT "" - _init_openexr if [ ! -d $_inst ]; then INFO "Building ILMBase-$OPENEXR_VERSION and OpenEXR-$OPENEXR_VERSION" - _is_building=true - # Rebuild dependencies as well! - _update_deps_openexr + # Force rebuilding the dependencies. + _update_deps_openexr true true prepare_inst @@ -1969,7 +1952,6 @@ compile_OPENEXR() { cd $CWD INFO "Done compiling OpenEXR-$OPENEXR_VERSION!" - _is_building=false else INFO "Own OpenEXR-$OPENEXR_VERSION is up to date, nothing to do!" INFO "If you want to force rebuild of this lib, use the --force-openexr option." @@ -1992,16 +1974,19 @@ _init_oiio() { } _update_deps_oiio() { - OSL_FORCE_REBUILD=true - if [ "$_is_building" = true ]; then + if [ "$1" = true ]; then OSL_FORCE_BUILD=true fi + if [ "$2" = true ]; then + OSL_FORCE_REBUILD=true + fi } clean_OIIO() { _init_oiio if [ -d $_inst ]; then - _update_deps_oiio + # Force rebuilding the dependencies if needed. + _update_deps_oiio false true fi _clean } @@ -2016,6 +2001,9 @@ compile_OIIO() { oiio_magic=17 _init_oiio + # Force having own builds for the dependencies. + _update_deps_oiio true false + # Clean install if needed! magic_compile_check oiio-$OIIO_VERSION $oiio_magic if [ $? -eq 1 -o "$OIIO_FORCE_REBUILD" = true ]; then @@ -2024,10 +2012,9 @@ compile_OIIO() { if [ ! -d $_inst ]; then INFO "Building OpenImageIO-$OIIO_VERSION" - _is_building=true - # Rebuild dependencies as well! - _update_deps_oiio + # Force rebuilding the dependencies. + _update_deps_oiio true true prepare_inst @@ -2091,7 +2078,7 @@ compile_OIIO() { #cmake_d="$cmake_d -D CMAKE_VERBOSE_MAKEFILE=ON" if [ -d $INST/boost ]; then - cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON" + cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON -D Boost_NO_BOOST_CMAKE=ON" fi # Looks like we do not need ocio in oiio for now... @@ -2121,7 +2108,6 @@ compile_OIIO() { cd $CWD INFO "Done compiling OpenImageIO-$OIIO_VERSION!" - _is_building=false else INFO "Own OpenImageIO-$OIIO_VERSION is up to date, nothing to do!" INFO "If you want to force rebuild of this lib, use the --force-oiio option." @@ -2143,16 +2129,19 @@ _init_llvm() { } _update_deps_llvm() { - OSL_FORCE_REBUILD=true - if [ "$_is_building" = true ]; then + if [ "$1" = true ]; then OSL_FORCE_BUILD=true fi + if [ "$2" = true ]; then + OSL_FORCE_REBUILD=true + fi } clean_LLVM() { _init_llvm if [ -d $_inst ]; then - _update_deps_llvm + # Force rebuilding the dependencies if needed. + _update_deps_llvm false true fi _clean } @@ -2167,6 +2156,9 @@ compile_LLVM() { llvm_magic=3 _init_llvm + # Force having own builds for the dependencies. + _update_deps_llvm true false + # Clean install if needed! magic_compile_check llvm-$LLVM_VERSION $llvm_magic if [ $? -eq 1 -o "$LLVM_FORCE_REBUILD" = true ]; then @@ -2175,10 +2167,9 @@ compile_LLVM() { if [ ! -d $_inst ]; then INFO "Building LLVM-$LLVM_VERSION (CLANG included!)" - _is_building=true - # Rebuild dependencies as well! - _update_deps_llvm + # Force rebuilding the dependencies. + _update_deps_llvm true true prepare_inst @@ -2237,7 +2228,6 @@ compile_LLVM() { cd $CWD INFO "Done compiling LLVM-$LLVM_VERSION (CLANG included)!" - _is_building=false else INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!" INFO "If you want to force rebuild of this lib, use the --force-llvm option." @@ -2261,7 +2251,8 @@ _update_deps_osl() { clean_OSL() { _init_osl if [ -d $_inst ]; then - _update_deps_osl + # Force rebuilding the dependencies if needed. + _update_deps_osl false true fi _clean } @@ -2276,6 +2267,9 @@ compile_OSL() { osl_magic=21 _init_osl + # Force having own builds for the dependencies. + _update_deps_osl true false + # Clean install if needed! magic_compile_check osl-$OSL_VERSION $osl_magic if [ $? -eq 1 -o "$OSL_FORCE_REBUILD" = true ]; then @@ -2285,10 +2279,9 @@ compile_OSL() { if [ ! -d $_inst ]; then INFO "Building OpenShadingLanguage-$OSL_VERSION" - _is_building=true - # Rebuild dependencies as well! - _update_deps_osl + # Force rebuilding the dependencies. + _update_deps_osl true true prepare_inst @@ -2348,7 +2341,7 @@ compile_OSL() { fi if [ -d $INST/boost ]; then - cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON" + cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON -D Boost_NO_BOOST_CMAKE=ON" fi if [ -d $INST/oiio ]; then @@ -2385,7 +2378,6 @@ compile_OSL() { cd $CWD INFO "Done compiling OpenShadingLanguage-$OSL_VERSION!" - _is_building=false else INFO "Own OpenShadingLanguage-$OSL_VERSION is up to date, nothing to do!" INFO "If you want to force rebuild of this lib, use the --force-osl option." @@ -2411,7 +2403,8 @@ _update_deps_osd() { clean_OSD() { _init_osd if [ -d $_inst ]; then - _update_deps_osd + # Force rebuilding the dependencies if needed. + _update_deps_osd false true fi _clean } @@ -2426,6 +2419,9 @@ compile_OSD() { osd_magic=2 _init_osd + # Force having own builds for the dependencies. + _update_deps_osd true false + # Clean install if needed! magic_compile_check osd-$OSD_VERSION $osd_magic if [ $? -eq 1 -o "$OSD_FORCE_REBUILD" = true ]; then @@ -2434,10 +2430,9 @@ compile_OSD() { if [ ! -d $_inst ]; then INFO "Building OpenSubdiv-$OSD_VERSION" - _is_building=true - # Rebuild dependencies as well! - _update_deps_osd + # Force rebuilding the dependencies. + _update_deps_osd true true prepare_inst @@ -2499,7 +2494,6 @@ compile_OSD() { cd $CWD INFO "Done compiling OpenSubdiv-$OSD_VERSION!" - _is_building=false else INFO "Own OpenSubdiv-$OSD_VERSION is up to date, nothing to do!" INFO "If you want to force rebuild of this lib, use the --force-osd option." @@ -2519,16 +2513,19 @@ _init_blosc() { } _update_deps_blosc() { - OPENVDB_FORCE_REBUILD=true - if [ "$_is_building" = true ]; then + if [ "$1" = true ]; then OPENVDB_FORCE_BUILD=true fi + if [ "$2" = true ]; then + OPENVDB_FORCE_REBUILD=true + fi } clean_BLOSC() { _init_blosc if [ -d $_inst ]; then - _update_deps_blosc + # Force rebuilding the dependencies if needed. + _update_deps_blosc false true fi _clean } @@ -2543,6 +2540,9 @@ compile_BLOSC() { blosc_magic=0 _init_blosc + # Force having own builds for the dependencies. + _update_deps_blosc true false + # Clean install if needed! magic_compile_check blosc-$OPENVDB_BLOSC_VERSION $blosc_magic if [ $? -eq 1 -o "$OPENVDB_FORCE_REBUILD" = true ]; then @@ -2552,10 +2552,9 @@ compile_BLOSC() { if [ ! -d $_inst ]; then INFO "Building Blosc-$OPENVDB_BLOSC_VERSION" - _is_building=true - # Rebuild dependencies as well! - _update_deps_blosc + # Force rebuilding the dependencies. + _update_deps_blosc true true prepare_inst @@ -2597,7 +2596,6 @@ compile_BLOSC() { fi cd $CWD INFO "Done compiling Blosc-$OPENVDB_BLOSC_VERSION!" - _is_building=false else INFO "Own Blosc-$OPENVDB_BLOSC_VERSION is up to date, nothing to do!" INFO "If you want to force rebuild of this lib (and openvdb), use the --force-openvdb option." @@ -2624,7 +2622,8 @@ _update_deps_nanovdb() { clean_nanovdb() { _init_nanovdb if [ -d $_inst ]; then - _update_deps_nanovdb + # Force rebuilding the dependencies if needed. + _update_deps_nanovdb false true fi _git=true # Mere trick to prevent clean from removing $_src... _clean @@ -2635,6 +2634,9 @@ install_NanoVDB() { nanovdb_magic=1 _init_nanovdb + # Force having own builds for the dependencies. + _update_deps_nanovdb true false + # Clean install if needed! magic_compile_check nanovdb-$OPENVDB_VERSION $nanovdb_magic if [ $? -eq 1 ]; then @@ -2643,10 +2645,9 @@ install_NanoVDB() { if [ ! -d $_inst ]; then INFO "Installing NanoVDB v$OPENVDB_VERSION" - _is_building=true - # Rebuild dependencies as well! - _update_deps_nanovdb + # Force rebuilding the dependencies. + _update_deps_nanovdb true true prepare_inst @@ -2703,7 +2704,6 @@ install_NanoVDB() { cd $CWD INFO "Done compiling NanoVDB-v$OPENVDB_VERSION!" - _is_building=false else INFO "Own NanoVDB-v$OPENVDB_VERSION is up to date, nothing to do!" fi @@ -2729,7 +2729,8 @@ _update_deps_openvdb() { clean_OPENVDB() { _init_openvdb if [ -d $_inst ]; then - _update_deps_openvdb + # Force rebuilding the dependencies if needed. + _update_deps_openvdb false true fi _clean } @@ -2747,6 +2748,9 @@ compile_OPENVDB() { openvdb_magic=2 _init_openvdb + # Force having own builds for the dependencies. + _update_deps_openvdb true false + # Clean install if needed! magic_compile_check openvdb-$OPENVDB_VERSION $openvdb_magic if [ $? -eq 1 -o "$OPENVDB_FORCE_REBUILD" = true ]; then @@ -2755,10 +2759,9 @@ compile_OPENVDB() { if [ ! -d $_inst ]; then INFO "Building OpenVDB-$OPENVDB_VERSION (with NanoVDB: $WITH_NANOVDB)" - _is_building=true - # Rebuild dependencies as well! - _update_deps_openvdb + # Force rebuilding the dependencies. + _update_deps_openvdb true true prepare_inst @@ -2803,6 +2806,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" @@ -2833,7 +2837,6 @@ compile_OPENVDB() { cd $CWD INFO "Done compiling OpenVDB-$OPENVDB_VERSION!" - _is_building=false else INFO "Own OpenVDB-$OPENVDB_VERSION is up to date, nothing to do!" INFO "If you want to force rebuild of this lib, use the --force-openvdb option." @@ -2863,7 +2866,8 @@ _update_deps_alembic() { clean_ALEMBIC() { _init_alembic if [ -d $_inst ]; then - _update_deps_alembic + # Force rebuilding the dependencies if needed. + _update_deps_alembic false true fi _clean } @@ -2878,6 +2882,9 @@ compile_ALEMBIC() { alembic_magic=2 _init_alembic + # Force having own builds for the dependencies. + _update_deps_alembic true false + # Clean install if needed! magic_compile_check alembic-$ALEMBIC_VERSION $alembic_magic if [ $? -eq 1 -o "$ALEMBIC_FORCE_REBUILD" = true ]; then @@ -2886,10 +2893,9 @@ compile_ALEMBIC() { if [ ! -d $_inst ]; then INFO "Building Alembic-$ALEMBIC_VERSION" - _is_building=true - # Rebuild dependencies as well! - _update_deps_alembic + # Force rebuilding the dependencies. + _update_deps_alembic true true prepare_inst @@ -2944,7 +2950,6 @@ compile_ALEMBIC() { cd $CWD INFO "Done compiling Alembic-$ALEMBIC_VERSION!" - _is_building=false else INFO "Own Alembic-$ALEMBIC_VERSION is up to date, nothing to do!" INFO "If you want to force rebuild of this lib, use the --force-alembic option." @@ -2968,7 +2973,8 @@ _update_deps_usd() { clean_USD() { _init_usd if [ -d $_inst ]; then - _update_deps_usd + # Force rebuilding the dependencies if needed. + _update_deps_usd false true fi _clean } @@ -2983,6 +2989,9 @@ compile_USD() { usd_magic=1 _init_usd + # Force having own builds for the dependencies. + _update_deps_usd true false + # Clean install if needed! magic_compile_check usd-$USD_VERSION $usd_magic if [ $? -eq 1 -o "$USD_FORCE_REBUILD" = true ]; then @@ -2991,10 +3000,9 @@ compile_USD() { if [ ! -d $_inst ]; then INFO "Building USD-$USD_VERSION" - _is_building=true - # Rebuild dependencies as well! - _update_deps_usd + # Force rebuilding the dependencies. + _update_deps_usd true true prepare_inst @@ -3042,7 +3050,6 @@ compile_USD() { cd $CWD INFO "Done compiling USD-$USD_VERSION!" - _is_building=false else INFO "Own USD-$USD_VERSION is up to date, nothing to do!" INFO "If you want to force rebuild of this lib, use the --force-usd option." @@ -3067,7 +3074,8 @@ _update_deps_collada() { clean_OpenCOLLADA() { _init_opencollada if [ -d $_inst ]; then - _update_deps_collada + # Force rebuilding the dependencies if needed. + _update_deps_collada false true fi _clean } @@ -3082,6 +3090,9 @@ compile_OpenCOLLADA() { opencollada_magic=9 _init_opencollada + # Force having own builds for the dependencies. + _update_deps_opencollada true false + # Clean install if needed! magic_compile_check opencollada-$OPENCOLLADA_VERSION $opencollada_magic if [ $? -eq 1 -o "$OPENCOLLADA_FORCE_REBUILD" = true ]; then @@ -3090,10 +3101,9 @@ compile_OpenCOLLADA() { if [ ! -d $_inst ]; then INFO "Building OpenCOLLADA-$OPENCOLLADA_VERSION" - _is_building=true - # Rebuild dependencies as well! - _update_deps_collada + # Force rebuilding the dependencies. + _update_deps_collada true true prepare_inst @@ -3149,7 +3159,6 @@ compile_OpenCOLLADA() { cd $CWD INFO "Done compiling OpenCOLLADA-$OPENCOLLADA_VERSION!" - _is_building=false else INFO "Own OpenCOLLADA-$OPENCOLLADA_VERSION is up to date, nothing to do!" INFO "If you want to force rebuild of this lib, use the --force-opencollada option." @@ -3173,7 +3182,8 @@ _update_deps_embree() { clean_Embree() { _init_embree if [ -d $_inst ]; then - _update_deps_embree + # Force rebuilding the dependencies if needed. + _update_deps_embree false true fi _clean } @@ -3188,6 +3198,9 @@ compile_Embree() { embree_magic=10 _init_embree + # Force having own builds for the dependencies. + _update_deps_embree true false + # Clean install if needed! magic_compile_check embree-$EMBREE_VERSION $embree_magic if [ $? -eq 1 -o "$EMBREE_FORCE_REBUILD" = true ]; then @@ -3196,10 +3209,9 @@ compile_Embree() { if [ ! -d $_inst ]; then INFO "Building Embree-$EMBREE_VERSION" - _is_building=true - # Rebuild dependencies as well! - _update_deps_embree + # Force rebuilding the dependencies. + _update_deps_embree true true prepare_inst @@ -3262,7 +3274,6 @@ compile_Embree() { cd $CWD INFO "Done compiling Embree-$EMBREE_VERSION!" - _is_building=false else INFO "Own Embree-$EMBREE_VERSION is up to date, nothing to do!" INFO "If you want to force rebuild of this lib, use the --force-embree option." @@ -3279,16 +3290,19 @@ _init_ispc() { } _update_deps_ispc() { - OIDN_FORCE_REBUILD=true - if [ "$_is_building" = true ]; then + if [ "$1" = true ]; then OIDN_FORCE_BUILD=true fi + if [ "$2" = true ]; then + OIDN_FORCE_REBUILD=true + fi } clean_ispc() { _init_ispc if [ -d $_inst ]; then - _update_deps_ispc + # Force rebuilding the dependencies if needed. + _update_deps_ispc false true fi _clean } @@ -3298,6 +3312,9 @@ install_ISPC() { ispc_magic=0 _init_ispc + # Force having own builds for the dependencies. + _update_deps_ispc true false + # Clean install if needed! magic_compile_check ispc-$ISPC_VERSION $ispc_magic if [ $? -eq 1 ]; then @@ -3306,10 +3323,9 @@ install_ISPC() { if [ ! -d $_inst ]; then INFO "Installing Implicit SPMD Program Compiler v$ISPC_VERSION" - _is_building=true - # Rebuild dependencies as well! - _update_deps_ispc + # Force rebuilding the dependencies. + _update_deps_ispc true true prepare_inst @@ -3335,7 +3351,6 @@ install_ISPC() { cd $CWD INFO "Done compiling ISPC-v$ISPC_VERSION!" - _is_building=false else INFO "Own ISPC-v$ISPC_VERSION is up to date, nothing to do!" fi @@ -3359,7 +3374,8 @@ _update_deps_oidn() { clean_oidn() { _init_oidn if [ -d $_inst ]; then - _update_deps_oidn + # Force rebuilding the dependencies if needed. + _update_deps_oidn false true fi _clean } @@ -3377,6 +3393,9 @@ compile_OIDN() { oidn_magic=9 _init_oidn + # Force having own builds for the dependencies. + _update_deps_oidn true false + # Clean install if needed! magic_compile_check oidn-$OIDN_VERSION $oidn_magic if [ $? -eq 1 -o "$OIDN_FORCE_REBUILD" = true ]; then @@ -3385,10 +3404,9 @@ compile_OIDN() { if [ ! -d $_inst ]; then INFO "Building OpenImageDenoise-$OIDN_VERSION" - _is_building=true - # Rebuild dependencies as well! - _update_deps_oidn + # Force rebuilding the dependencies. + _update_deps_oidn true true prepare_inst @@ -3447,7 +3465,6 @@ compile_OIDN() { cd $CWD INFO "Done compiling OpenImageDenoise-$OIDN_VERSION!" - _is_building=false else INFO "Own OpenImageDenoise-$OIDN_VERSION is up to date, nothing to do!" INFO "If you want to force rebuild of this lib, use the --force-oidn option." @@ -3472,7 +3489,8 @@ _update_deps_ffmpeg() { clean_FFmpeg() { _init_ffmpeg if [ -d $_inst ]; then - _update_deps_ffmpeg + # Force rebuilding the dependencies if needed. + _update_deps_ffmpeg false true fi _clean } @@ -3487,6 +3505,9 @@ compile_FFmpeg() { ffmpeg_magic=5 _init_ffmpeg + # Force having own builds for the dependencies. + _update_deps_ffmpeg true false + # Clean install if needed! magic_compile_check ffmpeg-$FFMPEG_VERSION $ffmpeg_magic if [ $? -eq 1 -o "$FFMPEG_FORCE_REBUILD" = true ]; then @@ -3495,10 +3516,9 @@ compile_FFmpeg() { if [ ! -d $_inst ]; then INFO "Building ffmpeg-$FFMPEG_VERSION" - _is_building=true - # Rebuild dependencies as well! - _update_deps_ffmpeg + # Force rebuilding the dependencies. + _update_deps_ffmpeg true true prepare_inst @@ -3577,7 +3597,6 @@ compile_FFmpeg() { cd $CWD INFO "Done compiling ffmpeg-$FFMPEG_VERSION!" - _is_building=false else INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!" INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option." @@ -3601,7 +3620,8 @@ _update_deps_xr_openxr_sdk() { clean_XR_OpenXR_SDK() { _init_xr_openxr_sdk if [ -d $_inst ]; then - _update_deps_xr_openxr_sdk + # Force rebuilding the dependencies if needed. + _update_deps_xr_openxr_sdk false true fi _clean } @@ -3616,6 +3636,9 @@ compile_XR_OpenXR_SDK() { xr_openxr_magic=2 _init_xr_openxr_sdk + # Force having own builds for the dependencies. + _update_deps_xr_openxr_sdk true false + # Clean install if needed! magic_compile_check xr-openxr-$XR_OPENXR_VERSION $xr_openxr_magic if [ $? -eq 1 -o "$XR_OPENXR_FORCE_REBUILD" = true ]; then @@ -3624,10 +3647,9 @@ compile_XR_OpenXR_SDK() { if [ ! -d $_inst ]; then INFO "Building XR-OpenXR-SDK-$XR_OPENXR_VERSION" - _is_building=true - # Rebuild dependencies as well! - _update_deps_xr_openxr_sdk + # Force rebuilding the dependencies. + _update_deps_xr_openxr_sdk true true prepare_inst @@ -3688,7 +3710,6 @@ compile_XR_OpenXR_SDK() { cd $CWD INFO "Done compiling XR-OpenXR-SDK-$XR_OPENXR_VERSION!" - _is_building=false else INFO "Own XR-OpenXR-SDK-$XR_OPENXR_VERSION is up to date, nothing to do!" INFO "If you want to force rebuild of this lib, use the --force-xr-openxr option." @@ -3799,7 +3820,7 @@ install_DEB() { libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \ libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \ libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev \ - libgmp-dev libpugixml-dev libpotrace-dev" + libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev" # libglewmx-dev (broken in deb testing currently...) VORBIS_USE=true @@ -3950,9 +3971,9 @@ install_DEB() { PRINT "" _do_compile_python=false if [ "$PYTHON_SKIP" = true ]; then - WARNING "Skipping Python/NumPy installation, as requested..." + WARNING "Skipping Python installation, as requested..." elif [ "$PYTHON_FORCE_BUILD" = true ]; then - INFO "Forced Python/NumPy building, as requested..." + INFO "Forced Python building, as requested..." _do_compile_python=true else check_package_version_ge_lt_DEB python3-dev $PYTHON_VERSION_MIN $PYTHON_VERSION_MAX @@ -3962,17 +3983,21 @@ install_DEB() { install_packages_DEB python3-dev clean_Python PRINT "" - if [ "$NUMPY_SKIP" = true ]; then - WARNING "Skipping NumPy installation, as requested..." - else - check_package_DEB python3-numpy + + for module in "${PYTHON_MODULES_PACKAGES[@]}" + do + module=($module) + package="python3-${module[0]}" + package_vmin=${module[1]} + package_vmax=${module[2]} + check_package_version_ge_lt_DEB "$package" $package_vmin $package_vmax if [ $? -eq 0 ]; then - install_packages_DEB python3-numpy + install_packages_DEB "$package" else - WARNING "Sorry, using python package but no valid numpy package available!" \ - " Use --build-numpy to force building of both Python and NumPy." + WARNING "Sorry, using python package but no valid $package package available!" \ + " Use --build-python to force building of Python and use pip to get the packages." fi - fi + done else _do_compile_python=true fi @@ -3981,12 +4006,6 @@ install_DEB() { if $_do_compile_python; then install_packages_DEB libffi-dev compile_Python - PRINT "" - if [ "$NUMPY_SKIP" = true ]; then - WARNING "Skipping NumPy installation, as requested..." - else - compile_Numpy - fi fi @@ -4466,7 +4485,7 @@ install_RPM() { wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \ glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \ libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel \ - gmp-devel pugixml-devel potrace-devel" + gmp-devel pugixml-devel potrace-devel libharu-devel" OPENJPEG_USE=true VORBIS_USE=true @@ -4586,7 +4605,7 @@ install_RPM() { if [ "$PYTHON_SKIP" = true ]; then WARNING "Skipping Python installation, as requested..." elif [ "$PYTHON_FORCE_BUILD" = true ]; then - INFO "Forced Python/NumPy building, as requested..." + INFO "Forced Python building, as requested..." _do_compile_python=true else check_package_version_ge_lt_RPM python3-devel $PYTHON_VERSION_MIN $PYTHON_VERSION_MAX @@ -4595,18 +4614,21 @@ install_RPM() { install_packages_RPM python3-devel clean_Python - PRINT "" - if [ "$NUMPY_SKIP" = true ]; then - WARNING "Skipping NumPy installation, as requested..." - else - check_package_version_ge_lt_RPM python3-numpy $NUMPY_VERSION_MIN $NUMPY_VERSION_MAX + + for module in "${PYTHON_MODULES_PACKAGES[@]}" + do + module=($module) + package="python3-${module[0]}" + package_vmin=${module[1]} + package_vmax=${module[2]} + check_package_version_ge_lt_RPM "$package" $package_vmin $package_vmax if [ $? -eq 0 ]; then - install_packages_RPM python3-numpy + install_packages_RPM "$package" else - WARNING "Sorry, using python package but no valid numpy package available!" \ - " Use --build-numpy to force building of both Python and NumPy." + WARNING "Sorry, using python package but no valid $package package available!" \ + " Use --build-python to force building of Python and use pip to get the packages." fi - fi + done else _do_compile_python=true fi @@ -4615,12 +4637,6 @@ install_RPM() { if [ "$_do_compile_python" = true ]; then install_packages_RPM libffi-devel compile_Python - PRINT "" - if [ "$NUMPY_SKIP" = true ]; then - WARNING "Skipping NumPy installation, as requested..." - else - compile_Numpy - fi fi @@ -5042,7 +5058,7 @@ install_ARCH() { _packages="$BASE_DEVEL git cmake fontconfig \ libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \ $OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl2 fftw \ - libxml2 yaml-cpp tinyxml python-requests jemalloc gmp potrace pugixml" + libxml2 yaml-cpp tinyxml python-requests jemalloc gmp potrace pugixml libharu" OPENJPEG_USE=true VORBIS_USE=true @@ -5127,7 +5143,7 @@ install_ARCH() { if [ "$PYTHON_SKIP" = true ]; then WARNING "Skipping Python installation, as requested..." elif [ "$PYTHON_FORCE_BUILD" = true ]; then - INFO "Forced Python/NumPy building, as requested..." + INFO "Forced Python building, as requested..." _do_compile_python=true else check_package_version_ge_lt_ARCH python $PYTHON_VERSION_MIN $PYTHON_VERSION_MAX @@ -5137,17 +5153,21 @@ install_ARCH() { install_packages_ARCH python clean_Python PRINT "" - if [ "$NUMPY_SKIP" = true ]; then - WARNING "Skipping NumPy installation, as requested..." - else - check_package_version_ge_ARCH python-numpy $NUMPY_VERSION_MIN $NUMPY_VERSION_MAX + + for module in "${PYTHON_MODULES_PACKAGES[@]}" + do + module=($module) + package="python-${module[0]}" + package_vmin=${module[1]} + package_vmax=${module[2]} + check_package_version_ge_lt_ARCH "$package" $package_vmin $package_vmax if [ $? -eq 0 ]; then - install_packages_ARCH python-numpy + install_packages_ARCH "$package" else - WARNING "Sorry, using python package but no valid numpy package available!" \ - "Use --build-numpy to force building of both Python and NumPy." + WARNING "Sorry, using python package but no valid $package package available!" \ + " Use --build-python to force building of Python and use pip to get the packages." fi - fi + done else _do_compile_python=true fi @@ -5156,12 +5176,6 @@ install_ARCH() { if [ "$_do_compile_python" = true ]; then install_packages_ARCH libffi compile_Python - PRINT "" - if [ "$NUMPY_SKIP" = true ]; then - WARNING "Skipping NumPy installation, as requested..." - else - compile_Numpy - fi fi @@ -5494,16 +5508,10 @@ install_OTHER() { PRINT "" if [ "$PYTHON_SKIP" = true ]; then - WARNING "Skipping Python/NumPy installation, as requested..." + WARNING "Skipping Python installation, as requested..." elif [ "$PYTHON_FORCE_BUILD" = true ]; then - INFO "Forced Python/NumPy building, as requested..." + INFO "Forced Python building, as requested..." compile_Python - PRINT "" - if [ "$NUMPY_SKIP" = true ]; then - WARNING "Skipping NumPy installation, as requested..." - else - compile_Numpy - fi fi @@ -5737,9 +5745,11 @@ print_info() { if [ -d $INST/boost ]; then _1="-D BOOST_ROOT=$INST/boost" _2="-D Boost_NO_SYSTEM_PATHS=ON" + _3="-D Boost_NO_BOOST_CMAKE=ON" PRINT " $_1" PRINT " $_2" - _buildargs="$_buildargs $_1 $_2" + PRINT " $_3" + _buildargs="$_buildargs $_1 $_2 $_3" fi if [ -d $INST/tbb ]; then diff --git a/build_files/cmake/Modules/FindAudaspace.cmake b/build_files/cmake/Modules/FindAudaspace.cmake index 07ce2ba33d0..d4a68461d32 100644 --- a/build_files/cmake/Modules/FindAudaspace.cmake +++ b/build_files/cmake/Modules/FindAudaspace.cmake @@ -19,7 +19,7 @@ #============================================================================= IF(NOT AUDASPACE_ROOT_DIR AND NOT $ENV{AUDASPACE_ROOT_DIR} STREQUAL "") - SET(AUDASPACE_ROOT_DIR $ENV{AUDASPACE_ROOT_DIR}) + SET(AUDASPACE_ROOT_DIR $ENV{AUDASPACE_ROOT_DIR}) ENDIF() SET(_audaspace_SEARCH_DIRS diff --git a/build_files/cmake/Modules/FindEmbree.cmake b/build_files/cmake/Modules/FindEmbree.cmake index 0716f47ca52..af545cee00c 100644 --- a/build_files/cmake/Modules/FindEmbree.cmake +++ b/build_files/cmake/Modules/FindEmbree.cmake @@ -59,14 +59,14 @@ FOREACH(COMPONENT ${_embree_FIND_COMPONENTS}) PATH_SUFFIXES lib64 lib ) - IF (NOT EMBREE_${UPPERCOMPONENT}_LIBRARY) - IF (EMBREE_EMBREE3_LIBRARY) + IF(NOT EMBREE_${UPPERCOMPONENT}_LIBRARY) + IF(EMBREE_EMBREE3_LIBRARY) # If we can't find all the static libraries, try to fall back to the shared library if found. # This allows building with a shared embree library SET(_embree_LIBRARIES ${EMBREE_EMBREE3_LIBRARY}) BREAK() - ENDIF () - ENDIF () + ENDIF() + ENDIF() LIST(APPEND _embree_LIBRARIES "${EMBREE_${UPPERCOMPONENT}_LIBRARY}") ENDFOREACH() diff --git a/build_files/cmake/Modules/GTest.cmake b/build_files/cmake/Modules/GTest.cmake index d32e49d2145..4faa47452b1 100644 --- a/build_files/cmake/Modules/GTest.cmake +++ b/build_files/cmake/Modules/GTest.cmake @@ -272,7 +272,7 @@ cmake_policy(SET CMP0057 NEW) # if IN_LIST #------------------------------------------------------------------------------ function(gtest_add_tests) - if (ARGC LESS 1) + if(ARGC LESS 1) message(FATAL_ERROR "No arguments supplied to gtest_add_tests()") endif() @@ -298,7 +298,7 @@ function(gtest_add_tests) set(autoAddSources YES) else() # Non-keyword syntax, convert to keyword form - if (ARGC LESS 3) + if(ARGC LESS 3) message(FATAL_ERROR "gtest_add_tests() without keyword options requires at least 3 arguments") endif() set(ARGS_TARGET "${ARGV0}") diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index d1f51b99c67..aebcd25e3b6 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -389,7 +389,7 @@ function(blender_add_lib endfunction() function(blender_add_test_suite) - if (ARGC LESS 1) + if(ARGC LESS 1) message(FATAL_ERROR "No arguments supplied to blender_add_test_suite()") endif() @@ -1209,9 +1209,9 @@ function(find_python_package site-packages dist-packages vendor-packages - NO_DEFAULT_PATH - DOC - "Path to python site-packages or dist-packages containing '${package}' module" + NO_DEFAULT_PATH + DOC + "Path to python site-packages or dist-packages containing '${package}' module" ) mark_as_advanced(PYTHON_${_upper_package}_PATH) diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index a2448829206..7ded075e8e3 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -353,7 +353,7 @@ endif() if(WITH_PUGIXML) find_package_wrapper(PugiXML) - if (NOT PUGIXML_FOUND) + if(NOT PUGIXML_FOUND) set(WITH_PUGIXML OFF) message(STATUS "PugiXML not found, disabling WITH_PUGIXML") endif() diff --git a/extern/mantaflow/helper/util/vectorbase.h b/extern/mantaflow/helper/util/vectorbase.h index 9b4d9c83f0b..3c7c6e6bc01 100644 --- a/extern/mantaflow/helper/util/vectorbase.h +++ b/extern/mantaflow/helper/util/vectorbase.h @@ -664,6 +664,11 @@ template inline Vec3i toVec3iRound(T v) return Vec3i((int)round(v[0]), (int)round(v[1]), (int)round(v[2])); } +template inline Vec3i toVec3iFloor(T v) +{ + return Vec3i((int)floor(v[0]), (int)floor(v[1]), (int)floor(v[2])); +} + //! convert to int Vector if values are close enough to an int template inline Vec3i toVec3iChecked(T v) { diff --git a/extern/mantaflow/preprocessed/fileio/iovdb.cpp b/extern/mantaflow/preprocessed/fileio/iovdb.cpp index cc2d0aa508d..e615741e0f7 100644 --- a/extern/mantaflow/preprocessed/fileio/iovdb.cpp +++ b/extern/mantaflow/preprocessed/fileio/iovdb.cpp @@ -209,11 +209,11 @@ typename GridType::Ptr exportVDB(Grid *from, float clip, openvdb::FloatGrid:: openvdb::Coord(from->getSizeX() - 1, from->getSizeY() - 1, from->getSizeZ() - 1)); openvdb::tools::Dense dense(bbox, data); - // Trick: Set clip value to very small / negative value in order to copy all values of dense - // grids - float tmpClip = (from->saveSparse()) ? clip : -std::numeric_limits::max(); + // Use clip value, or (when not exporting in sparse mode) clear it in order to copy all values + // of dense grid + ValueT tmpClip = (from->saveSparse()) ? ValueT(clip) : ValueT(0); // Copy from dense to sparse grid structure considering clip value - openvdb::tools::copyFromDense(dense, *to, ValueT(tmpClip)); + openvdb::tools::copyFromDense(dense, *to, tmpClip); // If present, use clip grid to trim down current vdb grid even more if (from->saveSparse() && clipGrid && !clipGrid->empty()) { @@ -245,10 +245,10 @@ void exportVDB(ParticleDataImpl *from, std::vector vdbValues; std::string name = from->getName(); + BasicParticleSystem *pp = dynamic_cast(from->getParticleSys()); FOR_PARTS(*from) { // Optionally, skip exporting particles that have been marked as deleted - BasicParticleSystem *pp = dynamic_cast(from->getParticleSys()); if (skipDeletedParts && !pp->isActive(idx)) { continue; } diff --git a/extern/mantaflow/preprocessed/gitinfo.h b/extern/mantaflow/preprocessed/gitinfo.h index ddc644db724..1bb96fe3baa 100644 --- a/extern/mantaflow/preprocessed/gitinfo.h +++ b/extern/mantaflow/preprocessed/gitinfo.h @@ -1,3 +1,3 @@ -#define MANTA_GIT_VERSION "commit 1c86d86496e7f7473c36248d12ef07bf4d9d2840" +#define MANTA_GIT_VERSION "commit 39b7a415721ecbf6643612a24e8eadd221aeb934" diff --git a/extern/mantaflow/preprocessed/grid.h b/extern/mantaflow/preprocessed/grid.h index 3d6f8558b8f..9c3d954771e 100644 --- a/extern/mantaflow/preprocessed/grid.h +++ b/extern/mantaflow/preprocessed/grid.h @@ -204,14 +204,12 @@ class GridBase : public PbClass { inline void checkIndex(int i, int j, int k) const; //! Check if indices are within bounds, otherwise error (should only be called when debugging) inline void checkIndex(IndexInt idx) const; - //! Check if index is within given boundaries - inline bool isInBounds(const Vec3i &p, int bnd) const; - //! Check if index is within given boundaries - inline bool isInBounds(const Vec3i &p) const; - //! Check if index is within given boundaries + //! Check if vector int is within given boundaries + inline bool isInBounds(const Vec3i &p, int bnd = 0) const; + //! Check if vector real is within given boundaries inline bool isInBounds(const Vec3 &p, int bnd = 0) const { - return isInBounds(toVec3i(p), bnd); + return isInBounds(toVec3iFloor(p), bnd); } //! Check if linear index is in the range of the array inline bool isInBounds(IndexInt idx) const; @@ -1785,11 +1783,6 @@ inline void GridBase::checkIndex(IndexInt idx) const } } -bool GridBase::isInBounds(const Vec3i &p) const -{ - return (p.x >= 0 && p.y >= 0 && p.z >= 0 && p.x < mSize.x && p.y < mSize.y && p.z < mSize.z); -} - bool GridBase::isInBounds(const Vec3i &p, int bnd) const { bool ret = (p.x >= bnd && p.y >= bnd && p.x < mSize.x - bnd && p.y < mSize.y - bnd); diff --git a/extern/mantaflow/preprocessed/plugin/flip.cpp b/extern/mantaflow/preprocessed/plugin/flip.cpp index eaa1ebe45d5..d6fd3437959 100644 --- a/extern/mantaflow/preprocessed/plugin/flip.cpp +++ b/extern/mantaflow/preprocessed/plugin/flip.cpp @@ -429,7 +429,7 @@ void markFluidCells(const BasicParticleSystem &parts, for (IndexInt idx = 0; idx < parts.size(); idx++) { if (!parts.isActive(idx) || (ptype && ((*ptype)[idx] & exclude))) continue; - Vec3i p = toVec3i(parts.getPos(idx)); + Vec3i p = toVec3iFloor(parts.getPos(idx)); if (flags.isInBounds(p) && flags.isEmpty(p)) flags(p) = (flags(p) | FlagGrid::TypeFluid) & ~FlagGrid::TypeEmpty; } @@ -544,7 +544,7 @@ void adjustNumber(BasicParticleSystem &parts, // count particles in cells, and delete excess particles for (IndexInt idx = 0; idx < (int)parts.size(); idx++) { if (parts.isActive(idx)) { - Vec3i p = toVec3i(parts.getPos(idx)); + Vec3i p = toVec3iFloor(parts.getPos(idx)); if (!tmp.isInBounds(p)) { parts.kill(idx); // out of domain, remove continue; @@ -711,7 +711,7 @@ void gridParticleIndex(const BasicParticleSystem &parts, for (IndexInt idx = 0; idx < (IndexInt)parts.size(); idx++) { if (parts.isActive(idx)) { // check index for validity... - Vec3i p = toVec3i(parts.getPos(idx)); + Vec3i p = toVec3iFloor(parts.getPos(idx)); if (!index.isInBounds(p)) { inactive++; continue; @@ -740,7 +740,7 @@ void gridParticleIndex(const BasicParticleSystem &parts, for (IndexInt idx = 0; idx < (IndexInt)parts.size(); idx++) { if (!parts.isActive(idx)) continue; - Vec3i p = toVec3i(parts.getPos(idx)); + Vec3i p = toVec3iFloor(parts.getPos(idx)); if (!index.isInBounds(p)) { continue; } @@ -1636,7 +1636,7 @@ struct knPushOutofObs : public KernelBase { { if (!parts.isActive(idx) || (ptype && ((*ptype)[idx] & exclude))) return; - Vec3i p = toVec3i(parts.getPos(idx)); + Vec3i p = toVec3iFloor(parts.getPos(idx)); if (!flags.isInBounds(p)) return; diff --git a/extern/mantaflow/preprocessed/plugin/initplugins.cpp b/extern/mantaflow/preprocessed/plugin/initplugins.cpp index dce7b72de6c..a0cc2761dab 100644 --- a/extern/mantaflow/preprocessed/plugin/initplugins.cpp +++ b/extern/mantaflow/preprocessed/plugin/initplugins.cpp @@ -2278,7 +2278,7 @@ T convolveGrid(Grid &originGrid, GaussianKernelCreator &gkSigma, Vec3 pos, in step = Vec3(0.0, 0.0, 1.0); T pxResult(0); for (int i = 0; i < gkSigma.mDim; ++i) { - Vec3i curpos = toVec3i(pos - step * (i - gkSigma.mDim / 2)); + Vec3i curpos = toVec3iFloor(pos - step * (i - gkSigma.mDim / 2)); if (originGrid.isInBounds(curpos)) pxResult += gkSigma.get1DKernelValue(i) * originGrid.get(curpos); else { // TODO , improve... @@ -2423,7 +2423,7 @@ struct KnBlurMACGridGauss : public KernelBase { Vec3 pxResult(0.0f); for (int di = 0; di < gkSigma.mDim; ++di) { - Vec3i curpos = toVec3i(pos - step * (di - gkSigma.mDim / 2)); + Vec3i curpos = toVec3iFloor(pos - step * (di - gkSigma.mDim / 2)); if (!originGrid.isInBounds(curpos)) { if (curpos.x < 0) curpos.x = 0; diff --git a/extern/mantaflow/preprocessed/plugin/secondaryparticles.cpp b/extern/mantaflow/preprocessed/plugin/secondaryparticles.cpp index 8ebc239e8fc..7a1d8224d94 100644 --- a/extern/mantaflow/preprocessed/plugin/secondaryparticles.cpp +++ b/extern/mantaflow/preprocessed/plugin/secondaryparticles.cpp @@ -1214,8 +1214,8 @@ struct knFlipUpdateSecondaryParticlesLinear : public KernelBase { // anti tunneling for small obstacles for (int ct = 1; ct < antitunneling; ct++) { - Vec3i tempPos = toVec3i(pts_sec[idx].pos + - ct * (1 / Real(antitunneling)) * dt * v_sec[idx]); + Vec3i tempPos = toVec3iFloor(pts_sec[idx].pos + + ct * (1 / Real(antitunneling)) * dt * v_sec[idx]); if (!flags.isInBounds(tempPos) || flags(tempPos) & FlagGrid::TypeObstacle) { pts_sec.kill(idx); return; @@ -1234,8 +1234,8 @@ struct knFlipUpdateSecondaryParticlesLinear : public KernelBase { // anti tunneling for small obstacles for (int ct = 1; ct < antitunneling; ct++) { - Vec3i tempPos = toVec3i(pts_sec[idx].pos + - ct * (1 / Real(antitunneling)) * dt * v_sec[idx]); + Vec3i tempPos = toVec3iFloor(pts_sec[idx].pos + + ct * (1 / Real(antitunneling)) * dt * v_sec[idx]); if (!flags.isInBounds(tempPos) || flags(tempPos) & FlagGrid::TypeObstacle) { pts_sec.kill(idx); return; @@ -1252,7 +1252,7 @@ struct knFlipUpdateSecondaryParticlesLinear : public KernelBase { const Vec3 vj = v.getInterpolated(pts_sec[idx].pos); // anti tunneling for small obstacles for (int ct = 1; ct < antitunneling; ct++) { - Vec3i tempPos = toVec3i(pts_sec[idx].pos + ct * (1 / Real(antitunneling)) * dt * vj); + Vec3i tempPos = toVec3iFloor(pts_sec[idx].pos + ct * (1 / Real(antitunneling)) * dt * vj); if (!flags.isInBounds(tempPos) || flags(tempPos) & FlagGrid::TypeObstacle) { pts_sec.kill(idx); return; @@ -1474,8 +1474,8 @@ struct knFlipUpdateSecondaryParticlesCubic : public KernelBase { // anti tunneling for small obstacles for (int ct = 1; ct < antitunneling; ct++) { - Vec3i tempPos = toVec3i(pts_sec[idx].pos + - ct * (1 / Real(antitunneling)) * dt * v_sec[idx]); + Vec3i tempPos = toVec3iFloor(pts_sec[idx].pos + + ct * (1 / Real(antitunneling)) * dt * v_sec[idx]); if (!flags.isInBounds(tempPos) || flags(tempPos) & FlagGrid::TypeObstacle) { pts_sec.kill(idx); return; @@ -1515,8 +1515,8 @@ struct knFlipUpdateSecondaryParticlesCubic : public KernelBase { // anti tunneling for small obstacles for (int ct = 1; ct < antitunneling; ct++) { - Vec3i tempPos = toVec3i(pts_sec[idx].pos + - ct * (1 / Real(antitunneling)) * dt * v_sec[idx]); + Vec3i tempPos = toVec3iFloor(pts_sec[idx].pos + + ct * (1 / Real(antitunneling)) * dt * v_sec[idx]); if (!flags.isInBounds(tempPos) || flags(tempPos) & FlagGrid::TypeObstacle) { pts_sec.kill(idx); return; @@ -1554,8 +1554,8 @@ struct knFlipUpdateSecondaryParticlesCubic : public KernelBase { // anti tunneling for small obstacles for (int ct = 1; ct < antitunneling; ct++) { - Vec3i tempPos = toVec3i(pts_sec[idx].pos + ct * (1 / Real(antitunneling)) * dt * - (sumNumerator / sumDenominator)); + Vec3i tempPos = toVec3iFloor(pts_sec[idx].pos + ct * (1 / Real(antitunneling)) * dt * + (sumNumerator / sumDenominator)); if (!flags.isInBounds(tempPos) || flags(tempPos) & FlagGrid::TypeObstacle) { pts_sec.kill(idx); return; @@ -1863,7 +1863,7 @@ struct knFlipDeleteParticlesInObstacle : public KernelBase { return; const Vec3 &xi = pts[idx].pos; - const Vec3i xidx = toVec3i(xi); + const Vec3i xidx = toVec3iFloor(xi); // remove particles that completely left the bounds if (!flags.isInBounds(xidx)) { pts.kill(idx); diff --git a/extern/mantaflow/preprocessed/plugin/surfaceturbulence.cpp b/extern/mantaflow/preprocessed/plugin/surfaceturbulence.cpp index aa04b551e1e..e5aa09117ea 100644 --- a/extern/mantaflow/preprocessed/plugin/surfaceturbulence.cpp +++ b/extern/mantaflow/preprocessed/plugin/surfaceturbulence.cpp @@ -2145,8 +2145,7 @@ void PbRegister_particleSurfaceTurbulence() void debugCheckParts(const BasicParticleSystem &parts, const FlagGrid &flags) { for (int idx = 0; idx < parts.size(); idx++) { - Vec3i p = toVec3i(parts.getPos(idx)); - if (!flags.isInBounds(p)) { + if (!flags.isInBounds(parts.getPos(idx))) { debMsg("bad position??? " << idx << " " << parts.getPos(idx), 1); exit(1); } diff --git a/extern/quadriflow/CMakeLists.txt b/extern/quadriflow/CMakeLists.txt index e24151d8bf6..1ab2322f73b 100644 --- a/extern/quadriflow/CMakeLists.txt +++ b/extern/quadriflow/CMakeLists.txt @@ -102,7 +102,7 @@ set(SRC ) set(LIB - ${BOOST_LIBRARIES} + ${BOOST_LIBRARIES} ) blender_add_lib(extern_quadriflow "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/intern/cycles/app/cycles_cubin_cc.cpp b/intern/cycles/app/cycles_cubin_cc.cpp index 7631cb9bed5..e5d256dd113 100644 --- a/intern/cycles/app/cycles_cubin_cc.cpp +++ b/intern/cycles/app/cycles_cubin_cc.cpp @@ -103,7 +103,7 @@ static bool compile_cuda(CompilationSettings &settings) return false; } - /* Tranfer options to a classic C array. */ + /* Transfer options to a classic C array. */ vector opts(options.size()); for (size_t i = 0; i < options.size(); i++) { opts[i] = options[i].c_str(); diff --git a/intern/cycles/blender/blender_particles.cpp b/intern/cycles/blender/blender_particles.cpp index d5dd7215c47..ae43dae4dc1 100644 --- a/intern/cycles/blender/blender_particles.cpp +++ b/intern/cycles/blender/blender_particles.cpp @@ -31,7 +31,7 @@ bool BlenderSync::sync_dupli_particle(BL::Object &b_ob, BL::DepsgraphObjectInstance &b_instance, Object *object) { - /* test if this dupli was generated from a particle sytem */ + /* Test if this dupli was generated from a particle system. */ BL::ParticleSystem b_psys = b_instance.particle_system(); if (!b_psys) return false; diff --git a/intern/cycles/blender/blender_session.h b/intern/cycles/blender/blender_session.h index 68db8a2fb58..d967b81c854 100644 --- a/intern/cycles/blender/blender_session.h +++ b/intern/cycles/blender/blender_session.h @@ -136,7 +136,7 @@ class BlenderSession { /* ** Resumable render ** */ - /* Overall number of chunks in which the sample range is to be devided. */ + /* Overall number of chunks in which the sample range is to be divided. */ static int num_resumable_chunks; /* Current resumable chunk index to render. */ diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index 4bcadab35a1..aea601480bf 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -942,7 +942,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine &b_engine, else if (shadingsystem == 1) params.shadingsystem = SHADINGSYSTEM_OSL; - /* color managagement */ + /* Color management. */ params.display_buffer_linear = b_engine.support_display_space_shader(b_scene); if (b_engine.is_preview()) { diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp index 1727082b7ec..296f9130f43 100644 --- a/intern/cycles/bvh/bvh_build.cpp +++ b/intern/cycles/bvh/bvh_build.cpp @@ -703,7 +703,7 @@ BVHNode *BVHBuild::build_node(const BVHRange &range, unalignedSplitSAH = params.sah_node_cost * unaligned_split.bounds.half_area() + params.sah_primitive_cost * unaligned_split.nodeSAH; /* TOOD(sergey): Check we can create leaf already. */ - /* Check whether unaligned split is better than the regulat one. */ + /* Check whether unaligned split is better than the regular one. */ if (unalignedSplitSAH < splitSAH) { do_unalinged_split = true; } @@ -842,7 +842,7 @@ BVHNode *BVHBuild::create_leaf_node(const BVHRange &range, const vector object_references; uint visibility[PRIMITIVE_NUM_TOTAL] = {0}; - /* NOTE: Keep initializtion in sync with actual number of primitives. */ + /* NOTE: Keep initialization in sync with actual number of primitives. */ BoundBox bounds[PRIMITIVE_NUM_TOTAL] = { BoundBox::empty, BoundBox::empty, BoundBox::empty, BoundBox::empty}; int ob_num = 0; diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake index b29f392a754..04ff598621a 100644 --- a/intern/cycles/cmake/external_libs.cmake +++ b/intern/cycles/cmake/external_libs.cmake @@ -383,7 +383,7 @@ if(WITH_CYCLES_OPENSUBDIV) optimized ${OPENSUBDIV_ROOT_DIR}/lib/osdGPU.lib debug ${OPENSUBDIV_ROOT_DIR}/lib/osdCPU_d.lib debug ${OPENSUBDIV_ROOT_DIR}/lib/osdGPU_d.lib - ) + ) endif() endif() endif() diff --git a/intern/cycles/device/cuda/device_cuda_impl.cpp b/intern/cycles/device/cuda/device_cuda_impl.cpp index cff30eb9b48..44a51835f4c 100644 --- a/intern/cycles/device/cuda/device_cuda_impl.cpp +++ b/intern/cycles/device/cuda/device_cuda_impl.cpp @@ -184,7 +184,7 @@ CUDADevice::CUDADevice(DeviceInfo &info, Stats &stats, Profiler &profiler, bool functions.loaded = false; - /* Intialize CUDA. */ + /* Initialize CUDA. */ CUresult result = cuInit(0); if (result != CUDA_SUCCESS) { set_error(string_printf("Failed to initialize CUDA runtime (%s)", cuewErrorString(result))); diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp index 44959577fb5..b272e59f99d 100644 --- a/intern/cycles/device/device_multi.cpp +++ b/intern/cycles/device/device_multi.cpp @@ -296,7 +296,7 @@ class MultiDevice : public Device { i++; } - /* Change geomtry BVH pointers back to the multi BVH */ + /* Change geometry BVH pointers back to the multi BVH. */ for (size_t k = 0; k < bvh->geometry.size(); ++k) { bvh->geometry[k]->bvh = geom_bvhs[k]; } diff --git a/intern/cycles/device/device_network.h b/intern/cycles/device/device_network.h index e74c4508ab6..b3a0f6daa57 100644 --- a/intern/cycles/device/device_network.h +++ b/intern/cycles/device/device_network.h @@ -80,7 +80,7 @@ class network_device_memory : public device_memory { vector local_data; }; -/* Common netowrk error function / object for both DeviceNetwork and DeviceServer*/ +/* Common network error function / object for both DeviceNetwork and DeviceServer. */ class NetworkError { public: NetworkError() diff --git a/intern/cycles/device/opencl/device_opencl.h b/intern/cycles/device/opencl/device_opencl.h index 4fd3c27f17e..2d6c6d04214 100644 --- a/intern/cycles/device/opencl/device_opencl.h +++ b/intern/cycles/device/opencl/device_opencl.h @@ -34,7 +34,7 @@ CCL_NAMESPACE_BEGIN /* Disable workarounds, seems to be working fine on latest drivers. */ # define CYCLES_DISABLE_DRIVER_WORKAROUNDS -/* Define CYCLES_DISABLE_DRIVER_WORKAROUNDS to disable workaounds for testing */ +/* Define CYCLES_DISABLE_DRIVER_WORKAROUNDS to disable workarounds for testing. */ # ifndef CYCLES_DISABLE_DRIVER_WORKAROUNDS /* Work around AMD driver hangs by ensuring each command is finished before doing anything else. */ # undef clEnqueueNDRangeKernel @@ -287,7 +287,7 @@ class OpenCLDevice : public Device { /* Try to load the program from device cache or disk */ bool load(); - /* Compile the kernel (first separate, failback to local) */ + /* Compile the kernel (first separate, fail-back to local). */ void compile(); /* Create the OpenCL kernels after loading or compiling */ void create_kernels(); @@ -628,7 +628,7 @@ class OpenCLDevice : public Device { void release_mem_object_safe(cl_mem mem); void release_program_safe(cl_program program); - /* ** Those guys are for workign around some compiler-specific bugs ** */ + /* ** Those guys are for working around some compiler-specific bugs ** */ cl_program load_cached_kernel(ustring key, thread_scoped_lock &cache_locker); diff --git a/intern/cycles/device/opencl/device_opencl_impl.cpp b/intern/cycles/device/opencl/device_opencl_impl.cpp index ec699462bfe..aee3b0fb64f 100644 --- a/intern/cycles/device/opencl/device_opencl_impl.cpp +++ b/intern/cycles/device/opencl/device_opencl_impl.cpp @@ -2151,7 +2151,7 @@ void OpenCLDevice::release_program_safe(cl_program program) } } -/* ** Those guys are for workign around some compiler-specific bugs ** */ +/* ** Those guys are for working around some compiler-specific bugs ** */ cl_program OpenCLDevice::load_cached_kernel(ustring key, thread_scoped_lock &cache_locker) { diff --git a/intern/cycles/kernel/bvh/bvh_types.h b/intern/cycles/kernel/bvh/bvh_types.h index b173568266b..9f0879a2069 100644 --- a/intern/cycles/kernel/bvh/bvh_types.h +++ b/intern/cycles/kernel/bvh/bvh_types.h @@ -42,7 +42,7 @@ CCL_NAMESPACE_BEGIN #define BVH_FEATURE(f) (((BVH_FUNCTION_FEATURES) & (f)) != 0) -/* Debugging heleprs */ +/* Debugging helpers. */ #ifdef __KERNEL_DEBUG__ # define BVH_DEBUG_INIT() \ do { \ diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h b/intern/cycles/kernel/closure/bsdf_microfacet.h index d9e81535b62..32639ba24ec 100644 --- a/intern/cycles/kernel/closure/bsdf_microfacet.h +++ b/intern/cycles/kernel/closure/bsdf_microfacet.h @@ -125,7 +125,7 @@ ccl_device_inline void microfacet_beckmann_sample_slopes(KernelGlobals *kg, } *slope_y = fast_ierff(2.0f * randv - 1.0f); #else - /* Use precomputed table on CPU, it gives better perfomance. */ + /* Use precomputed table on CPU, it gives better performance. */ int beckmann_table_offset = kernel_data.tables.beckmann_offset; *slope_x = lookup_table_read_2D( diff --git a/intern/cycles/kernel/filter/filter_transform_gpu.h b/intern/cycles/kernel/filter/filter_transform_gpu.h index adc85881fe5..ec258a5212a 100644 --- a/intern/cycles/kernel/filter/filter_transform_gpu.h +++ b/intern/cycles/kernel/filter/filter_transform_gpu.h @@ -78,7 +78,7 @@ ccl_device void kernel_filter_construct_transform(const ccl_global float *ccl_re /* === Generate the feature transformation. === * This transformation maps the num_features-dimensional feature space to a reduced feature * (r-feature) space which generally has fewer dimensions. - * This mainly helps to prevent overfitting. */ + * This mainly helps to prevent over-fitting. */ float feature_matrix[DENOISE_FEATURES * DENOISE_FEATURES]; math_matrix_zero(feature_matrix, num_features); FOR_PIXEL_WINDOW @@ -91,7 +91,7 @@ ccl_device void kernel_filter_construct_transform(const ccl_global float *ccl_re math_matrix_jacobi_eigendecomposition(feature_matrix, transform, num_features, transform_stride); *rank = 0; - /* Prevent overfitting when a small window is used. */ + /* Prevent over-fitting when a small window is used. */ int max_rank = min(num_features, num_pixels / 3); if (pca_threshold < 0.0f) { float threshold_energy = 0.0f; diff --git a/intern/cycles/kernel/filter/filter_transform_sse.h b/intern/cycles/kernel/filter/filter_transform_sse.h index 5a124b5d73b..0304d990f9f 100644 --- a/intern/cycles/kernel/filter/filter_transform_sse.h +++ b/intern/cycles/kernel/filter/filter_transform_sse.h @@ -93,7 +93,7 @@ ccl_device void kernel_filter_construct_transform(const float *ccl_restrict buff math_matrix_jacobi_eigendecomposition(feature_matrix, transform, num_features, 1); *rank = 0; - /* Prevent overfitting when a small window is used. */ + /* Prevent over-fitting when a small window is used. */ int max_rank = min(num_features, num_pixels / 3); if (pca_threshold < 0.0f) { float threshold_energy = 0.0f; diff --git a/intern/cycles/kernel/geom/geom_object.h b/intern/cycles/kernel/geom/geom_object.h index 1907f5d3935..fe73335a335 100644 --- a/intern/cycles/kernel/geom/geom_object.h +++ b/intern/cycles/kernel/geom/geom_object.h @@ -435,7 +435,7 @@ ccl_device_inline float bvh_instance_push( return t; } -/* Transorm ray to exit static object in BVH */ +/* Transform ray to exit static object in BVH. */ ccl_device_inline float bvh_instance_pop( KernelGlobals *kg, int object, const Ray *ray, float3 *P, float3 *dir, float3 *idir, float t) @@ -497,7 +497,7 @@ ccl_device_inline float bvh_instance_motion_push(KernelGlobals *kg, return t; } -/* Transorm ray to exit motion blurred object in BVH */ +/* Transform ray to exit motion blurred object in BVH. */ ccl_device_inline float bvh_instance_motion_pop(KernelGlobals *kg, int object, diff --git a/intern/cycles/kernel/kernel_bake.h b/intern/cycles/kernel/kernel_bake.h index e876e5d8ca6..ddcf94be1de 100644 --- a/intern/cycles/kernel/kernel_bake.h +++ b/intern/cycles/kernel/kernel_bake.h @@ -251,7 +251,7 @@ ccl_device void kernel_bake_evaluate( path_rng_2D(kg, rng_hash, sample, num_samples, PRNG_FILTER_U, &filter_x, &filter_y); } - /* Barycentric UV with subpixel offset. */ + /* Barycentric UV with sub-pixel offset. */ float u = primitive[2]; float v = primitive[3]; diff --git a/intern/cycles/kernel/kernel_film.h b/intern/cycles/kernel/kernel_film.h index 17b69b6198b..a6fd4f1dc7e 100644 --- a/intern/cycles/kernel/kernel_film.h +++ b/intern/cycles/kernel/kernel_film.h @@ -63,12 +63,12 @@ ccl_device float4 film_map(KernelGlobals *kg, float4 rgba_in, float scale) { float4 result; - /* conversion to srgb */ + /* Conversion to SRGB. */ result.x = color_linear_to_srgb(rgba_in.x * scale); result.y = color_linear_to_srgb(rgba_in.y * scale); result.z = color_linear_to_srgb(rgba_in.z * scale); - /* clamp since alpha might be > 1.0 due to russian roulette */ + /* Clamp since alpha might be > 1.0 due to Russian roulette. */ result.w = saturate(rgba_in.w * scale); return result; diff --git a/intern/cycles/kernel/kernel_jitter.h b/intern/cycles/kernel/kernel_jitter.h index b9c48b86a5d..f4e60a807f7 100644 --- a/intern/cycles/kernel/kernel_jitter.h +++ b/intern/cycles/kernel/kernel_jitter.h @@ -21,7 +21,7 @@ CCL_NAMESPACE_BEGIN /* "Correlated Multi-Jittered Sampling" * Andrew Kensler, Pixar Technical Memo 13-01, 2013 */ -/* todo: find good value, suggested 64 gives pattern on cornell box ceiling */ +/* TODO: find good value, suggested 64 gives pattern on cornell box ceiling. */ #define CMJ_RANDOM_OFFSET_LIMIT 4096 ccl_device_inline bool cmj_is_pow2(int i) @@ -179,7 +179,7 @@ ccl_device void cmj_sample_2D(int s, int N, int p, float *fx, float *fy) smodm = cmj_fast_mod_pow2(s, m); } else { - /* Doing s*inmv gives precision issues here. */ + /* Doing `s * inmv` gives precision issues here. */ sdivm = s / m; smodm = s - sdivm * m; } diff --git a/intern/cycles/kernel/kernel_path_branched.h b/intern/cycles/kernel/kernel_path_branched.h index b9569f531e6..9ce7a147369 100644 --- a/intern/cycles/kernel/kernel_path_branched.h +++ b/intern/cycles/kernel/kernel_path_branched.h @@ -155,7 +155,7 @@ ccl_device_forceinline void kernel_branched_path_volume(KernelGlobals *kg, else # endif /* __VOLUME_DECOUPLED__ */ { - /* GPU: no decoupled ray marching, scatter probalistically */ + /* GPU: no decoupled ray marching, scatter probabilistically. */ int num_samples = kernel_data.integrator.volume_samples; float num_samples_inv = 1.0f / num_samples; diff --git a/intern/cycles/kernel/kernel_random.h b/intern/cycles/kernel/kernel_random.h index a9b17854f25..49e5e25c2e0 100644 --- a/intern/cycles/kernel/kernel_random.h +++ b/intern/cycles/kernel/kernel_random.h @@ -304,7 +304,7 @@ ccl_device_inline bool sample_is_even(int pattern, int sample) #elif defined(__KERNEL_OPENCL__) return popcount(sample & 0xaaaaaaaa) & 1; #else - /* TODO(Stefan): popcnt intrinsic for Windows with fallback for older CPUs. */ + /* TODO(Stefan): pop-count intrinsic for Windows with fallback for older CPUs. */ int i = sample & 0xaaaaaaaa; i = i - ((i >> 1) & 0x55555555); i = (i & 0x33333333) + ((i >> 2) & 0x33333333); diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index f0e65542693..82cc11922e0 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -1641,7 +1641,7 @@ enum RayState { RAY_UPDATE_BUFFER, /* Denotes ray needs to skip most surface shader work. */ RAY_HAS_ONLY_VOLUME, - /* Donotes ray has hit background */ + /* Denotes ray has hit background */ RAY_HIT_BACKGROUND, /* Denotes ray has to be regenerated */ RAY_TO_REGENERATE, @@ -1699,7 +1699,7 @@ typedef struct WorkTile { ccl_global float *buffer; } WorkTile; -/* Precoumputed sample table sizes for PMJ02 sampler. */ +/* Pre-computed sample table sizes for PMJ02 sampler. */ #define NUM_PMJ_SAMPLES 64 * 64 #define NUM_PMJ_PATTERNS 48 diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp index 2a4a1dfe325..2b7c21d0bc4 100644 --- a/intern/cycles/kernel/osl/osl_services.cpp +++ b/intern/cycles/kernel/osl/osl_services.cpp @@ -1033,7 +1033,7 @@ bool OSLRenderServices::get_background_attribute( return set_attribute_int(f, type, derivatives, val); } else if (name == u_ndc) { - /* NDC coordinates with special exception for otho */ + /* NDC coordinates with special exception for orthographic projection. */ OSLThreadData *tdata = kg->osl_tdata; OSL::ShaderGlobals *globals = &tdata->globals; float3 ndc[3]; diff --git a/intern/cycles/kernel/osl/osl_shader.cpp b/intern/cycles/kernel/osl/osl_shader.cpp index 3d0813c15e3..8606c459375 100644 --- a/intern/cycles/kernel/osl/osl_shader.cpp +++ b/intern/cycles/kernel/osl/osl_shader.cpp @@ -129,7 +129,7 @@ static void shaderdata_to_shaderglobals( /* clear trace data */ tdata->tracedata.init = false; - /* used by renderservices */ + /* Used by render-services. */ sd->osl_globals = kg; sd->osl_path_state = state; } diff --git a/intern/cycles/kernel/shaders/node_image_texture.osl b/intern/cycles/kernel/shaders/node_image_texture.osl index 22d34a1082c..9e2ef84c872 100644 --- a/intern/cycles/kernel/shaders/node_image_texture.osl +++ b/intern/cycles/kernel/shaders/node_image_texture.osl @@ -42,7 +42,7 @@ point map_to_sphere(vector dir) float v, u; if (len > 0.0) { if (dir[0] == 0.0 && dir[1] == 0.0) { - u = 0.0; /* Othwise domain error. */ + u = 0.0; /* Otherwise domain error. */ } else { u = (1.0 - atan2(dir[0], dir[1]) / M_PI) / 2.0; diff --git a/intern/cycles/kernel/split/kernel_branched.h b/intern/cycles/kernel/split/kernel_branched.h index bfcd21baac4..45f5037d321 100644 --- a/intern/cycles/kernel/split/kernel_branched.h +++ b/intern/cycles/kernel/split/kernel_branched.h @@ -41,7 +41,7 @@ ccl_device_inline void kernel_split_branched_path_indirect_loop_init(KernelGloba # undef BRANCHED_STORE - /* set loop counters to intial position */ + /* Set loop counters to initial position. */ branched_state->next_closure = 0; branched_state->next_sample = 0; } diff --git a/intern/cycles/kernel/split/kernel_do_volume.h b/intern/cycles/kernel/split/kernel_do_volume.h index b24699ec39c..1775e870f07 100644 --- a/intern/cycles/kernel/split/kernel_do_volume.h +++ b/intern/cycles/kernel/split/kernel_do_volume.h @@ -35,7 +35,7 @@ ccl_device_noinline bool kernel_split_branched_path_volume_indirect_light_iter(K PathRadiance *L = &kernel_split_state.path_radiance[ray_index]; ShaderData *emission_sd = AS_SHADER_DATA(&kernel_split_state.sd_DL_shadow[ray_index]); - /* GPU: no decoupled ray marching, scatter probalistically */ + /* GPU: no decoupled ray marching, scatter probabilistically. */ int num_samples = kernel_data.integrator.volume_samples; float num_samples_inv = 1.0f / num_samples; diff --git a/intern/cycles/kernel/split/kernel_enqueue_inactive.h b/intern/cycles/kernel/split/kernel_enqueue_inactive.h index 31d2daef616..745313f89f1 100644 --- a/intern/cycles/kernel/split/kernel_enqueue_inactive.h +++ b/intern/cycles/kernel/split/kernel_enqueue_inactive.h @@ -20,7 +20,7 @@ ccl_device void kernel_enqueue_inactive(KernelGlobals *kg, ccl_local_param unsigned int *local_queue_atomics) { #ifdef __BRANCHED_PATH__ - /* Enqeueue RAY_INACTIVE rays into QUEUE_INACTIVE_RAYS queue. */ + /* Enqueue RAY_INACTIVE rays into QUEUE_INACTIVE_RAYS queue. */ if (ccl_local_id(0) == 0 && ccl_local_id(1) == 0) { *local_queue_atomics = 0; } diff --git a/intern/cycles/kernel/split/kernel_shader_setup.h b/intern/cycles/kernel/split/kernel_shader_setup.h index 900cbcb869c..551836d1653 100644 --- a/intern/cycles/kernel/split/kernel_shader_setup.h +++ b/intern/cycles/kernel/split/kernel_shader_setup.h @@ -25,7 +25,7 @@ CCL_NAMESPACE_BEGIN ccl_device void kernel_shader_setup(KernelGlobals *kg, ccl_local_param unsigned int *local_queue_atomics) { - /* Enqeueue RAY_TO_REGENERATE rays into QUEUE_HITBG_BUFF_UPDATE_TOREGEN_RAYS queue. */ + /* Enqueue RAY_TO_REGENERATE rays into QUEUE_HITBG_BUFF_UPDATE_TOREGEN_RAYS queue. */ if (ccl_local_id(0) == 0 && ccl_local_id(1) == 0) { *local_queue_atomics = 0; } diff --git a/intern/cycles/kernel/svm/svm_hsv.h b/intern/cycles/kernel/svm/svm_hsv.h index 1f7bd421869..c299cf58c7f 100644 --- a/intern/cycles/kernel/svm/svm_hsv.h +++ b/intern/cycles/kernel/svm/svm_hsv.h @@ -37,7 +37,7 @@ ccl_device void svm_node_hsv( color = rgb_to_hsv(color); - /* remember: fmod doesn't work for negative numbers here */ + /* Remember: `fmodf` doesn't work for negative numbers here. */ color.x = fmodf(color.x + hue + 0.5f, 1.0f); color.y = saturate(color.y * sat); color.z *= val; @@ -48,7 +48,7 @@ ccl_device void svm_node_hsv( color.y = fac * color.y + (1.0f - fac) * in_color.y; color.z = fac * color.z + (1.0f - fac) * in_color.z; - /* Clamp color to prevent negative values caused by oversaturation. */ + /* Clamp color to prevent negative values caused by over saturation. */ color.x = max(color.x, 0.0f); color.y = max(color.y, 0.0f); color.z = max(color.z, 0.0f); diff --git a/intern/cycles/kernel/svm/svm_image.h b/intern/cycles/kernel/svm/svm_image.h index f57c85fc23e..742addab611 100644 --- a/intern/cycles/kernel/svm/svm_image.h +++ b/intern/cycles/kernel/svm/svm_image.h @@ -38,7 +38,7 @@ ccl_device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, return r; } -/* Remap coordnate from 0..1 box to -1..-1 */ +/* Remap coordinate from 0..1 box to -1..-1 */ ccl_device_inline float3 texco_remap_square(float3 co) { return (co - make_float3(0.5f, 0.5f, 0.5f)) * 2.0f; diff --git a/intern/cycles/kernel/svm/svm_noise.h b/intern/cycles/kernel/svm/svm_noise.h index 7db8ffcc6e1..7ad61f23cc1 100644 --- a/intern/cycles/kernel/svm/svm_noise.h +++ b/intern/cycles/kernel/svm/svm_noise.h @@ -615,8 +615,8 @@ ccl_device_noinline float perlin_3d(float x, float y, float z) * * Point Offset from v0 * v0 (0, 0, 0, 0) - * v1 (0, 0, 1, 0) The full avx type is computed by inserting the following - * v2 (0, 1, 0, 0) sse types into both the low and high parts of the avx. + * v1 (0, 0, 1, 0) The full AVX type is computed by inserting the following + * v2 (0, 1, 0, 0) sse types into both the low and high parts of the AVX. * v3 (0, 1, 1, 0) * v4 (1, 0, 0, 0) * v5 (1, 0, 1, 0) (0, 1, 0, 1) = shuffle<0, 2, 0, 2>(shuffle<2, 2, 2, 2>(V, V + 1)) diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h index c228df14985..4a00afc1d7f 100644 --- a/intern/cycles/kernel/svm/svm_types.h +++ b/intern/cycles/kernel/svm/svm_types.h @@ -205,8 +205,8 @@ typedef enum NodeHairInfo { NODE_INFO_CURVE_IS_STRAND, NODE_INFO_CURVE_INTERCEPT, NODE_INFO_CURVE_THICKNESS, - /*fade for minimum hair width transpency*/ - /*NODE_INFO_CURVE_FADE,*/ + /* Fade for minimum hair width transiency. */ + // NODE_INFO_CURVE_FADE, NODE_INFO_CURVE_TANGENT_NORMAL, NODE_INFO_CURVE_RANDOM, } NodeHairInfo; diff --git a/intern/cycles/render/alembic.cpp b/intern/cycles/render/alembic.cpp index a9d43415865..5942e512e60 100644 --- a/intern/cycles/render/alembic.cpp +++ b/intern/cycles/render/alembic.cpp @@ -1346,7 +1346,7 @@ void AlembicProcedural::generate(Scene *scene, Progress &progress) bool need_shader_updates = false; - /* check for changes in shaders (newly requested atttributes) */ + /* Check for changes in shaders (newly requested attributes). */ foreach (Node *object_node, objects) { AlembicObject *object = static_cast(object_node); @@ -1626,7 +1626,7 @@ void AlembicProcedural::read_subd(Scene *scene, mesh->clear_non_sockets(); - /* udpate sockets */ + /* Update sockets. */ Object *object = abc_object->get_object(); cached_data.transforms.copy_to_socket(frame_time, object, object->get_tfm_socket()); @@ -1660,7 +1660,7 @@ void AlembicProcedural::read_subd(Scene *scene, mesh->set_num_subd_faces(mesh->get_subd_shader().size()); - /* udpate attributes */ + /* Update attributes. */ update_attributes(mesh->subd_attributes, cached_data, frame_time); diff --git a/intern/cycles/render/alembic.h b/intern/cycles/render/alembic.h index 77bdac09ba2..6b0d32fb3ab 100644 --- a/intern/cycles/render/alembic.h +++ b/intern/cycles/render/alembic.h @@ -361,7 +361,7 @@ class AlembicProcedural : public Procedural { /* Tag for an update only if something was modified. */ void tag_update(Scene *scene); - /* Returns a pointer to an exisiting or a newly created AlembicObject for the given path. */ + /* Returns a pointer to an existing or a newly created AlembicObject for the given path. */ AlembicObject *get_or_create_object(const ustring &path); private: diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp index 045931ffdac..0948b20628f 100644 --- a/intern/cycles/render/buffers.cpp +++ b/intern/cycles/render/buffers.cpp @@ -448,7 +448,7 @@ bool RenderBuffers::get_pass_rect( pixels[1] = f.y * scale_exposure; pixels[2] = f.z * scale_exposure; - /* clamp since alpha might be > 1.0 due to russian roulette */ + /* Clamp since alpha might be > 1.0 due to Russian roulette. */ pixels[3] = saturate(f.w * scale); } } diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp index 3beb3d1d4d3..30bf6c4241a 100644 --- a/intern/cycles/render/camera.cpp +++ b/intern/cycles/render/camera.cpp @@ -252,11 +252,11 @@ void Camera::update(Scene *scene) Transform fulltoborder = transform_from_viewplane(viewport_camera_border); Transform bordertofull = transform_inverse(fulltoborder); - /* ndc to raster */ + /* NDC to raster. */ Transform ndctoraster = transform_scale(width, height, 1.0f) * bordertofull; Transform full_ndctoraster = transform_scale(full_width, full_height, 1.0f) * bordertofull; - /* raster to screen */ + /* Raster to screen. */ Transform screentondc = fulltoborder * transform_from_viewplane(viewplane); Transform screentoraster = ndctoraster * screentondc; @@ -264,7 +264,7 @@ void Camera::update(Scene *scene) Transform full_screentoraster = full_ndctoraster * screentondc; Transform full_rastertoscreen = transform_inverse(full_screentoraster); - /* screen to camera */ + /* Screen to camera. */ ProjectionTransform cameratoscreen; if (camera_type == CAMERA_PERSPECTIVE) cameratoscreen = projection_perspective(fov, nearclip, farclip); diff --git a/intern/cycles/render/colorspace.cpp b/intern/cycles/render/colorspace.cpp index 57979d5f225..4c9e86ea278 100644 --- a/intern/cycles/render/colorspace.cpp +++ b/intern/cycles/render/colorspace.cpp @@ -386,7 +386,7 @@ void ColorSpaceManager::free_memory() #endif } -/* Template instanstations so we don't have to inline functions. */ +/* Template instantiations so we don't have to inline functions. */ template void ColorSpaceManager::to_scene_linear(ustring, uchar *, size_t, bool); template void ColorSpaceManager::to_scene_linear(ustring, ushort *, size_t, bool); template void ColorSpaceManager::to_scene_linear(ustring, half *, size_t, bool); diff --git a/intern/cycles/render/denoising.cpp b/intern/cycles/render/denoising.cpp index 76408ca4849..ddbe7484800 100644 --- a/intern/cycles/render/denoising.cpp +++ b/intern/cycles/render/denoising.cpp @@ -847,7 +847,7 @@ bool DenoiseImage::save_output(const string &out_filepath, string &error) out.reset(); - /* Copy temporary file to outputput filepath. */ + /* Copy temporary file to output filepath. */ string rename_error; if (ok && !OIIO::Filesystem::rename(tmp_filepath, out_filepath, rename_error)) { error = "Failed to move denoised image to " + out_filepath + ": " + rename_error; diff --git a/intern/cycles/render/geometry.cpp b/intern/cycles/render/geometry.cpp index b6fe8a66b87..9ea56b30ffa 100644 --- a/intern/cycles/render/geometry.cpp +++ b/intern/cycles/render/geometry.cpp @@ -1453,7 +1453,7 @@ void GeometryManager::device_update_preprocess(Device *device, Scene *scene, Pro if (shader->need_update_uvs) { device_update_flags |= ATTR_FLOAT2_NEEDS_REALLOC; - /* Attributes might need to be tesselated if added. */ + /* Attributes might need to be tessellated if added. */ if (geom->is_mesh()) { Mesh *mesh = static_cast(geom); if (mesh->need_tesselation()) { @@ -1465,7 +1465,7 @@ void GeometryManager::device_update_preprocess(Device *device, Scene *scene, Pro if (shader->need_update_attribute) { device_update_flags |= ATTRS_NEED_REALLOC; - /* Attributes might need to be tesselated if added. */ + /* Attributes might need to be tessellated if added. */ if (geom->is_mesh()) { Mesh *mesh = static_cast(geom); if (mesh->need_tesselation()) { diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp index 4adfebf80ae..5e068e74ce0 100644 --- a/intern/cycles/render/graph.cpp +++ b/intern/cycles/render/graph.cpp @@ -276,7 +276,7 @@ void ShaderGraph::connect(ShaderOutput *from, ShaderInput *to) emission->set_color(make_float3(1.0f, 1.0f, 1.0f)); emission->set_strength(1.0f); convert = add(emission); - /* Connect float inputs to Strength to save an additional Falue->Color conversion. */ + /* Connect float inputs to Strength to save an additional Value->Color conversion. */ if (from->type() == SocketType::FLOAT) { convert_in = convert->input("Strength"); } diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index a09a680f93f..29a95beaf7e 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -419,7 +419,7 @@ int ImageManager::add_image_slot(ImageLoader *loader, thread_scoped_lock device_lock(images_mutex); - /* Fnd existing image. */ + /* Find existing image. */ for (slot = 0; slot < images.size(); slot++) { img = images[slot]; if (img && ImageLoader::equals(img->loader, loader) && img->params == params) { diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index 638ac376157..1e54a237816 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -979,7 +979,7 @@ void LightManager::device_update(Device *device, VLOG(1) << "Total " << scene->lights.size() << " lights."; - /* Detect which lights are enabled, also determins if we need to update the background. */ + /* Detect which lights are enabled, also determines if we need to update the background. */ test_enabled_lights(scene); device_free(device, dscene, need_update_background); diff --git a/intern/cycles/render/merge.cpp b/intern/cycles/render/merge.cpp index 3ea3952b96c..8a58c827e82 100644 --- a/intern/cycles/render/merge.cpp +++ b/intern/cycles/render/merge.cpp @@ -151,7 +151,7 @@ static bool parse_channels(const ImageSpec &in_spec, string layername, passname, channelname; if (parse_channel_name( pass.channel_name, layername, passname, channelname, multiview_channels)) { - /* Channer part of a render layer. */ + /* Channel part of a render layer. */ pass.op = parse_channel_operation(passname); } else { @@ -163,7 +163,7 @@ static bool parse_channels(const ImageSpec &in_spec, file_layers[layername].passes.push_back(pass); } - /* Loop over all detected RenderLayers, check whether they contain a full set of input channels. + /* Loop over all detected render-layers, check whether they contain a full set of input channels. * Any channels that won't be processed internally are also passed through. */ for (auto &i : file_layers) { const string &name = i.first; @@ -457,7 +457,7 @@ static bool save_output(const string &filepath, out.reset(); - /* Copy temporary file to outputput filepath. */ + /* Copy temporary file to output filepath. */ string rename_error; if (ok && !OIIO::Filesystem::rename(tmp_filepath, filepath, rename_error)) { error = "Failed to move merged image to " + filepath + ": " + rename_error; diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h index 4d51b4fccaf..d4603143ef4 100644 --- a/intern/cycles/render/nodes.h +++ b/intern/cycles/render/nodes.h @@ -1612,7 +1612,7 @@ class OSLNode : public ShaderNode { SHADER_NODE_NO_CLONE_CLASS(OSLNode) - /* ideally we could beter detect this, but we can't query this now */ + /* Ideally we could better detect this, but we can't query this now. */ bool has_spatial_varying() { return true; diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp index 889636fe0f3..53c67049571 100644 --- a/intern/cycles/render/osl.cpp +++ b/intern/cycles/render/osl.cpp @@ -380,7 +380,7 @@ const char *OSLShaderManager::shader_load_filepath(string filepath) return hash; } - /* autocompile .OSL to .OSO if needed */ + /* Auto-compile .OSL to .OSO if needed. */ if (oso_modified_time == 0 || (oso_modified_time < modified_time)) { OSLShaderManager::osl_compile(filepath, osopath); modified_time = path_modified_time(osopath); @@ -562,7 +562,7 @@ OSLNode *OSLShaderManager::osl_node(ShaderGraph *graph, } } - /* set bytcode hash or filepath */ + /* Set byte-code hash or file-path. */ if (!bytecode_hash.empty()) { node->bytecode_hash = bytecode_hash; } diff --git a/intern/cycles/render/scene.h b/intern/cycles/render/scene.h index 7595817226c..61c753e411c 100644 --- a/intern/cycles/render/scene.h +++ b/intern/cycles/render/scene.h @@ -358,7 +358,7 @@ class Scene : public NodeOwner { DeviceRequestedFeatures get_requested_device_features(); - /* Maximumnumber of closure during session lifetime. */ + /* Maximum number of closure during session lifetime. */ int max_closure_global; /* Get maximum number of closures to be used in kernel. */ diff --git a/intern/cycles/subd/subd_split.cpp b/intern/cycles/subd/subd_split.cpp index 928f5bf2ed7..4d648eb1f77 100644 --- a/intern/cycles/subd/subd_split.cpp +++ b/intern/cycles/subd/subd_split.cpp @@ -549,7 +549,7 @@ void DiagSplit::split_ngon(const Mesh::SubdFace &face, Patch *patches, size_t pa subpatch.edge_v1.indices_decrease_along_edge = true; subpatch.edge_u0.indices_decrease_along_edge = u0_reversed; - /* Perfrom split. */ + /* Perform split. */ { subpatch.edge_u0.T = T(subpatch.patch, subpatch.c00, subpatch.c10); subpatch.edge_u1.T = T(subpatch.patch, subpatch.c01, subpatch.c11); @@ -646,7 +646,7 @@ void DiagSplit::post_split() /* Set start and end indices for edges generated from a split. */ foreach (Edge &edge, edges) { if (edge.start_vert_index < 0) { - /* Fixup offsets. */ + /* Fix up offsets. */ if (edge.top_indices_decrease) { edge.top_offset = edge.top->T - edge.top_offset; } diff --git a/intern/cycles/subd/subd_split.h b/intern/cycles/subd/subd_split.h index 773f4ddf120..7416b2fbbf8 100644 --- a/intern/cycles/subd/subd_split.h +++ b/intern/cycles/subd/subd_split.h @@ -40,7 +40,7 @@ class DiagSplit { SubdParams params; vector subpatches; - /* deque is used so that element pointers remain vaild when size is changed. */ + /* `deque` is used so that element pointers remain valid when size is changed. */ deque edges; float3 to_world(Patch *patch, float2 uv); diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h index 8caabf6eac3..ad04340231e 100644 --- a/intern/cycles/util/util_math.h +++ b/intern/cycles/util/util_math.h @@ -349,7 +349,7 @@ ccl_device_inline float fractf(float x) return x - floorf(x); } -/* Adapted from godotengine math_funcs.h. */ +/* Adapted from godot-engine math_funcs.h. */ ccl_device_inline float wrapf(float value, float max, float min) { float range = max - min; @@ -385,7 +385,7 @@ ccl_device_inline float nonzerof(float f, float eps) return f; } -/* Signum function testing for zero. Matches GLSL and OSL functions. */ +/* `signum` function testing for zero. Matches GLSL and OSL functions. */ ccl_device_inline float compatible_signf(float f) { if (f == 0.0f) { @@ -754,7 +754,7 @@ ccl_device_inline float2 map_to_sphere(const float3 co) float u, v; if (l > 0.0f) { if (UNLIKELY(co.x == 0.0f && co.y == 0.0f)) { - u = 0.0f; /* othwise domain error */ + u = 0.0f; /* Otherwise domain error. */ } else { u = (1.0f - atan2f(co.x, co.y) / M_PI_F) / 2.0f; diff --git a/intern/cycles/util/util_math_fast.h b/intern/cycles/util/util_math_fast.h index 07b0878e3d5..107b36ce6cd 100644 --- a/intern/cycles/util/util_math_fast.h +++ b/intern/cycles/util/util_math_fast.h @@ -84,7 +84,7 @@ ccl_device_inline int fast_rint(float x) { /* used by sin/cos/tan range reduction. */ #ifdef __KERNEL_SSE4__ - /* Single roundps instruction on SSE4.1+ (for gcc/clang at least). */ + /* Single `roundps` instruction on SSE4.1+ (for gcc/clang at least). */ return float_to_int(rintf(x)); #else /* emulate rounding by adding/subtracting 0.5. */ @@ -613,7 +613,7 @@ ccl_device_inline float fast_erfcf(float x) ccl_device_inline float fast_ierff(float x) { - /* From: Approximating the erfinv function by Mike Giles. */ + /* From: Approximating the `erfinv` function by Mike Giles. */ /* To avoid trouble at the limit, clamp input to 1-eps. */ float a = fabsf(x); if (a > 0.99999994f) { diff --git a/intern/cycles/util/util_math_matrix.h b/intern/cycles/util/util_math_matrix.h index 1dc661a7aa7..123736f75a6 100644 --- a/intern/cycles/util/util_math_matrix.h +++ b/intern/cycles/util/util_math_matrix.h @@ -161,7 +161,7 @@ ccl_device_inline void math_trimatrix_add_gramian(ccl_global float *A, } } -/* Transpose matrix A inplace. */ +/* Transpose matrix A in place. */ ccl_device_inline void math_matrix_transpose(ccl_global float *A, int n, int stride) { for (int i = 0; i < n; i++) { diff --git a/intern/cycles/util/util_md5.h b/intern/cycles/util/util_md5.h index 4622945f9d2..3102a0f4bad 100644 --- a/intern/cycles/util/util_md5.h +++ b/intern/cycles/util/util_md5.h @@ -49,7 +49,7 @@ class MD5Hash { void process(const uint8_t *data); void finish(uint8_t digest[16]); - uint32_t count[2]; /* message length in bits, lsw first */ + uint32_t count[2]; /* message length in bits, LSW first. */ uint32_t abcd[4]; /* digest buffer */ uint8_t buf[64]; /* accumulate block */ }; diff --git a/intern/cycles/util/util_stack_allocator.h b/intern/cycles/util/util_stack_allocator.h index 36db655e5eb..ef31c0fe5e2 100644 --- a/intern/cycles/util/util_stack_allocator.h +++ b/intern/cycles/util/util_stack_allocator.h @@ -126,7 +126,7 @@ template class ccl_try_align(16) StackAllocator return size_t(-1); } - /* Rebind to other ype of allocator. */ + /* Rebind to other type of allocator. */ template struct rebind { typedef StackAllocator other; diff --git a/intern/cycles/util/util_string.h b/intern/cycles/util/util_string.h index f51aa7111e8..6b6f493bd94 100644 --- a/intern/cycles/util/util_string.h +++ b/intern/cycles/util/util_string.h @@ -66,9 +66,9 @@ string string_from_wstring(const wstring &path); string string_to_ansi(const string &str); #endif -/* Make a string from a size in bytes in human readable form */ +/* Make a string from a size in bytes in human readable form. */ string string_human_readable_size(size_t size); -/* Make a string from a unitless quantity in human readable form */ +/* Make a string from a unit-less quantity in human readable form. */ string string_human_readable_number(size_t num); CCL_NAMESPACE_END diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h index d6eb5f9db1d..727fd4b9601 100644 --- a/intern/ffmpeg/ffmpeg_compat.h +++ b/intern/ffmpeg/ffmpeg_compat.h @@ -49,16 +49,6 @@ #include -/* Stupid way to distinguish FFmpeg from Libav: - * - FFmpeg's MICRO version starts from 100 and goes up, while - * - Libav's micro is always below 100. - */ -#if LIBAVCODEC_VERSION_MICRO >= 100 -# define AV_USING_FFMPEG -#else -# define AV_USING_LIBAV -#endif - #if (LIBAVFORMAT_VERSION_MAJOR > 52) || \ ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 105)) # define FFMPEG_HAVE_AVIO 1 @@ -528,22 +518,6 @@ bool av_check_encoded_with_ffmpeg(AVFormatContext *ctx) return false; } -/* Libav doesn't have av_guess_frame_rate(). - * It was introduced in FFmpeg's lavf 55.1.100. */ -#ifdef AV_USING_LIBAV -AVRational av_guess_frame_rate(AVFormatContext *ctx, AVStream *stream, AVFrame *frame) -{ - (void)ctx; - (void)frame; -# if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 23, 1) - /* For until r_frame_rate was deprecated (in Libav) use it. */ - return stream->r_frame_rate; -# else - return stream->avg_frame_rate; -# endif -} -#endif - #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 32, 0) # define AV_OPT_SEARCH_FAKE_OBJ 0 #endif diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h index 8bce064ce63..bd7ba6657f0 100644 --- a/intern/ghost/GHOST_Types.h +++ b/intern/ghost/GHOST_Types.h @@ -580,7 +580,7 @@ typedef struct { GHOST_TUns32 xPixels; /** Number of lines. */ GHOST_TUns32 yPixels; - /** Numberof bits per pixel. */ + /** Number of bits per pixel. */ GHOST_TUns32 bpp; /** Refresh rate (in Hertz). */ GHOST_TUns32 frequency; diff --git a/intern/ghost/intern/GHOST_Context.h b/intern/ghost/intern/GHOST_Context.h index d07913b28c4..810b78a7d39 100644 --- a/intern/ghost/intern/GHOST_Context.h +++ b/intern/ghost/intern/GHOST_Context.h @@ -127,8 +127,8 @@ class GHOST_Context : public GHOST_IContext { } /** - * Gets the OpenGL framebuffer associated with the OpenGL context - * \return The ID of an OpenGL framebuffer object. + * Gets the OpenGL frame-buffer associated with the OpenGL context + * \return The ID of an OpenGL frame-buffer object. */ virtual unsigned int getDefaultFramebuffer() { diff --git a/intern/ghost/intern/GHOST_ContextCGL.h b/intern/ghost/intern/GHOST_ContextCGL.h index d499ec987b0..8e4376236fa 100644 --- a/intern/ghost/intern/GHOST_ContextCGL.h +++ b/intern/ghost/intern/GHOST_ContextCGL.h @@ -115,10 +115,10 @@ class GHOST_ContextCGL : public GHOST_Context { /** The OpenGL drawing context */ NSOpenGLContext *m_openGLContext; - /** The virtualized default framebuffer */ + /** The virtualized default frame-buffer. */ unsigned int m_defaultFramebuffer; - /** The virtualized default framebuffer's texture */ + /** The virtualized default frame-buffer's texture. */ MTLTexture *m_defaultFramebufferMetalTexture; bool m_coreProfile; diff --git a/intern/ghost/intern/GHOST_ContextD3D.h b/intern/ghost/intern/GHOST_ContextD3D.h index 18b4a5d1286..8b9537ca439 100644 --- a/intern/ghost/intern/GHOST_ContextD3D.h +++ b/intern/ghost/intern/GHOST_ContextD3D.h @@ -97,8 +97,8 @@ class GHOST_ContextD3D : public GHOST_Context { } /** - * Gets the OpenGL framebuffer associated with the OpenGL context - * \return The ID of an OpenGL framebuffer object. + * Gets the OpenGL frame-buffer associated with the OpenGL context + * \return The ID of an OpenGL frame-buffer object. */ unsigned int getDefaultFramebuffer() { diff --git a/intern/ghost/intern/GHOST_Debug.h b/intern/ghost/intern/GHOST_Debug.h index 424f95aa573..13858410c5a 100644 --- a/intern/ghost/intern/GHOST_Debug.h +++ b/intern/ghost/intern/GHOST_Debug.h @@ -26,7 +26,7 @@ #ifdef _MSC_VER # ifdef DEBUG -/* Suppress stl-MSVC debug info warning. */ +/* Suppress STL-MSVC debug info warning. */ # pragma warning(disable : 4786) # endif #endif diff --git a/intern/ghost/intern/GHOST_DropTargetX11.cpp b/intern/ghost/intern/GHOST_DropTargetX11.cpp index 816d9c254ee..82ed9de230d 100644 --- a/intern/ghost/intern/GHOST_DropTargetX11.cpp +++ b/intern/ghost/intern/GHOST_DropTargetX11.cpp @@ -203,7 +203,7 @@ void *GHOST_DropTargetX11::getURIListGhostData(unsigned char *dropBuffer, int dr GHOST_TStringArray *strArray = NULL; int totPaths = 0, curLength = 0; - /* count total number of file pathes in buffer */ + /* Count total number of file paths in buffer. */ for (int i = 0; i <= dropBufferSize; i++) { if (dropBuffer[i] == 0 || dropBuffer[i] == '\n' || dropBuffer[i] == '\r') { if (curLength) { diff --git a/intern/ghost/intern/GHOST_DropTargetX11.h b/intern/ghost/intern/GHOST_DropTargetX11.h index 7d777270317..f538dbbb617 100644 --- a/intern/ghost/intern/GHOST_DropTargetX11.h +++ b/intern/ghost/intern/GHOST_DropTargetX11.h @@ -103,22 +103,22 @@ class GHOST_DropTargetX11 { /* Data type of the dragged object */ GHOST_TDragnDropTypes m_draggedObjectType; - /* is dnd stuff initialzied */ + /* Is drag-and-drop stuff initialized. */ static bool m_xdndInitialized; - /* class holding internal stiff of xdnd library */ + /* Class holding internal stiff of `xdnd` library. */ static DndClass m_dndClass; - /* list of supported types to be dragged into */ + /* List of supported types to be dragged into. */ static Atom *m_dndTypes; - /* list of supported dran'n'drop actions */ + /* List of supported drag-and-drop actions. */ static Atom *m_dndActions; - /* List of supported MIME types to be dragged into */ + /* List of supported MIME types to be dragged into. */ static const char *m_dndMimeTypes[]; - /* counter of references to global XDND structures */ + /* Counter of references to global #XDND structures. */ static int m_refCounter; #ifdef WITH_CXX_GUARDEDALLOC diff --git a/intern/ghost/intern/GHOST_ImeWin32.h b/intern/ghost/intern/GHOST_ImeWin32.h index 63ecfd96cb8..cbef0f0edc4 100644 --- a/intern/ghost/intern/GHOST_ImeWin32.h +++ b/intern/ghost/intern/GHOST_ImeWin32.h @@ -303,10 +303,10 @@ class GHOST_ImeWin32 { */ void EndIME(HWND window_handle); - /* Updatg resultInfo and compInfo */ + /** Update #resultInfo and #compInfo */ void UpdateInfo(HWND window_handle); - /* disable ime when start up */ + /** Disable IME when start up. */ void CheckFirst(HWND window_handle); ImeComposition resultInfo, compInfo; diff --git a/intern/ghost/intern/GHOST_SystemPathsWin32.cpp b/intern/ghost/intern/GHOST_SystemPathsWin32.cpp index 193633b5c3e..47e71b0d733 100644 --- a/intern/ghost/intern/GHOST_SystemPathsWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemPathsWin32.cpp @@ -40,7 +40,7 @@ GHOST_SystemPathsWin32::~GHOST_SystemPathsWin32() const GHOST_TUns8 *GHOST_SystemPathsWin32::getSystemDir(int, const char *versionstr) const { - /* 1 utf-16 might translante into 3 utf-8. 2 utf-16 translates into 4 utf-8*/ + /* 1 utf-16 might translate into 3 utf-8. 2 utf-16 translates into 4 utf-8. */ static char knownpath[MAX_PATH * 3 + 128] = {0}; PWSTR knownpath_16 = NULL; diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 718ace9db4a..b71b6b9e170 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -963,7 +963,7 @@ GHOST_EventButton *GHOST_SystemWin32::processButtonEvent(GHOST_TEventType type, processCursorEvent(window); } else { - /* Tablet should be hadling inbetween mouse moves, only move to event position. */ + /* Tablet should be handling in between mouse moves, only move to event position. */ DWORD msgPos = ::GetMessagePos(); int msgPosX = GET_X_LPARAM(msgPos); int msgPosY = GET_Y_LPARAM(msgPos); diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 8e7b966aadf..9152aa22495 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -23,7 +23,7 @@ * \ingroup GHOST */ -#include /* Allow detectable auto-repeate. */ +#include /* Allow detectable auto-repeat. */ #include #include #include @@ -185,10 +185,10 @@ GHOST_SystemX11::GHOST_SystemX11() : GHOST_System(), m_xkb_descr(NULL), m_start_ GHOST_ASSERT(false, "Could not instantiate timer!"); } - /* Taking care not to overflow the tv.tv_sec * 1000 */ + /* Taking care not to overflow the `tv.tv_sec * 1000`. */ m_start_time = GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000; - /* Use detectable auto-repeate, mac and windows also do this. */ + /* Use detectable auto-repeat, mac and windows also do this. */ int use_xkb; int xkb_opcode, xkb_event, xkb_error; int xkb_major = XkbMajorVersion, xkb_minor = XkbMinorVersion; @@ -528,7 +528,7 @@ bool GHOST_SystemX11::openX11_IM() if (!m_display) return false; - /* set locale modifiers such as "@im=ibus" specified by XMODIFIERS */ + /* set locale modifiers such as `@im=ibus` specified by XMODIFIERS. */ XSetLocaleModifiers(""); m_xim = XOpenIM(m_display, NULL, (char *)GHOST_X11_RES_NAME, (char *)GHOST_X11_RES_CLASS); @@ -1146,7 +1146,7 @@ void GHOST_SystemX11::processEvent(XEvent *xe) */ if ((xke->keycode >= 10 && xke->keycode < 20) && ((key_sym = XLookupKeysym(xke, ShiftMask)) >= XK_0) && (key_sym <= XK_9)) { - /* pass (keep shift'ed key_sym) */ + /* Pass (keep shifted `key_sym`). */ } else { /* regular case */ @@ -1161,12 +1161,12 @@ void GHOST_SystemX11::processEvent(XEvent *xe) #endif #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) - /* getting unicode on key-up events gives XLookupNone status */ + /* Setting unicode on key-up events gives #XLookupNone status. */ XIC xic = window->getX11_XIC(); if (xic && xke->type == KeyPress) { Status status; - /* use utf8 because its not locale depentant, from xorg docs */ + /* Use utf8 because its not locale repentant, from XORG docs. */ if (!(len = Xutf8LookupString( xic, xke, utf8_buf, sizeof(utf8_array) - 5, &key_sym, &status))) { utf8_buf[0] = '\0'; @@ -1269,8 +1269,7 @@ void GHOST_SystemX11::processEvent(XEvent *xe) gbmask = GHOST_kButtonMaskRight; /* It seems events 6 and 7 are for horizontal scrolling. * you can re-order button mapping like this... (swaps 6,7 with 8,9) - * xmodmap -e "pointer = 1 2 3 4 5 8 9 6 7" - */ + * `xmodmap -e "pointer = 1 2 3 4 5 8 9 6 7"` */ else if (xbe.button == 6) gbmask = GHOST_kButtonMaskButton6; else if (xbe.button == 7) @@ -1289,8 +1288,7 @@ void GHOST_SystemX11::processEvent(XEvent *xe) /* change of size, border, layer etc. */ case ConfigureNotify: { - /* XConfigureEvent & xce = xe->xconfigure; */ - + // XConfigureEvent & xce = xe->xconfigure; g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window); break; } @@ -1934,8 +1932,8 @@ static GHOST_TKey ghost_key_from_keycode(const XkbDescPtr xkb_descr, const KeyCo #define XCLIB_XCOUT_SENTCONVSEL 1 /* sent a request */ #define XCLIB_XCOUT_INCR 2 /* in an incr loop */ #define XCLIB_XCOUT_FALLBACK 3 /* STRING failed, need fallback to UTF8 */ -#define XCLIB_XCOUT_FALLBACK_UTF8 4 /* UTF8 failed, move to compouned */ -#define XCLIB_XCOUT_FALLBACK_COMP 5 /* compouned failed, move to text. */ +#define XCLIB_XCOUT_FALLBACK_UTF8 4 /* UTF8 failed, move to compound. */ +#define XCLIB_XCOUT_FALLBACK_COMP 5 /* compound failed, move to text. */ #define XCLIB_XCOUT_FALLBACK_TEXT 6 /* Retrieves the contents of a selections. */ @@ -2198,30 +2196,30 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const restore_events.push_back(evt); } - /* fallback is needed. set XA_STRING to target and restart the loop. */ + /* Fallback is needed. Set #XA_STRING to target and restart the loop. */ if (context == XCLIB_XCOUT_FALLBACK) { context = XCLIB_XCOUT_NONE; target = m_atom.STRING; continue; } else if (context == XCLIB_XCOUT_FALLBACK_UTF8) { - /* utf8 fail, move to compouned text. */ + /* utf8 fail, move to compound text. */ context = XCLIB_XCOUT_NONE; target = m_atom.COMPOUND_TEXT; continue; } else if (context == XCLIB_XCOUT_FALLBACK_COMP) { - /* compouned text fail, move to text. */ + /* Compound text fail, move to text. */ context = XCLIB_XCOUT_NONE; target = m_atom.TEXT; continue; } else if (context == XCLIB_XCOUT_FALLBACK_TEXT) { - /* text fail, nothing else to try, break. */ + /* Text fail, nothing else to try, break. */ context = XCLIB_XCOUT_NONE; } - /* only continue if xcout() is doing something */ + /* Only continue if #xcout() is doing something. */ if (context == XCLIB_XCOUT_NONE) break; } @@ -2232,9 +2230,7 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const } if (sel_len) { - /* only print the buffer out, and free it, if it's not - * empty - */ + /* Only print the buffer out, and free it, if it's not empty. */ unsigned char *tmp_data = (unsigned char *)malloc(sel_len + 1); memcpy((char *)tmp_data, (char *)sel_buf, sel_len); tmp_data[sel_len] = '\0'; @@ -2288,28 +2284,28 @@ void GHOST_SystemX11::putClipboard(GHOST_TInt8 *buffer, bool selection) const * \{ */ class DialogData { public: - /* Width of the dialog */ + /* Width of the dialog. */ uint width; - /* Heigth of the dialog */ + /* Height of the dialog. */ uint height; - /* Default padding (x direction) between controls and edge of dialog */ + /* Default padding (x direction) between controls and edge of dialog. */ uint padding_x; - /* Default padding (y direction) between controls and edge of dialog */ + /* Default padding (y direction) between controls and edge of dialog. */ uint padding_y; - /* Width of a single button */ + /* Width of a single button. */ uint button_width; - /* Height of a single button */ + /* Height of a single button. */ uint button_height; - /* Inset of a button to its text */ + /* Inset of a button to its text. */ uint button_inset_x; - /* Size of the border of the button */ + /* Size of the border of the button. */ uint button_border_size; /* Height of a line of text */ uint line_height; - /* offset of the text inside the button */ + /* Offset of the text inside the button. */ uint button_text_offset_y; - /* Construct a new DialogData with the default settings */ + /* Construct a new #DialogData with the default settings. */ DialogData() : width(640), height(175), diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h index bcebda66ae3..a7e325bc9e1 100644 --- a/intern/ghost/intern/GHOST_SystemX11.h +++ b/intern/ghost/intern/GHOST_SystemX11.h @@ -24,7 +24,7 @@ #pragma once -#include /* Allow detectable auto-repeate. */ +#include /* Allow detectable auto-repeat. */ #include #include "../GHOST_Types.h" diff --git a/intern/ghost/intern/GHOST_Window.h b/intern/ghost/intern/GHOST_Window.h index d897fafc003..1f2fed5b823 100644 --- a/intern/ghost/intern/GHOST_Window.h +++ b/intern/ghost/intern/GHOST_Window.h @@ -392,7 +392,7 @@ class GHOST_Window : public GHOST_IWindow { /** Stores whether this is a full screen window. */ bool m_fullScreen; - /** Whether to attempt to initialize a context with a stereo framebuffer. */ + /** Whether to attempt to initialize a context with a stereo frame-buffer. */ bool m_wantStereoVisual; /** Full-screen width */ diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 6a084dcca22..18aa19c0863 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -1368,7 +1368,7 @@ GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 *bitmap GHOST_TUns32 fullBitRow, fullMaskRow; int x, y, cols; - cols = sizeX / 8; /* Num of whole bytes per row (width of bm/mask) */ + cols = sizeX / 8; /* Number of whole bytes per row (width of bm/mask). */ if (sizeX % 8) cols++; @@ -1407,7 +1407,7 @@ GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 *bitmap GHOST_TSuccess GHOST_WindowWin32::setProgressBar(float progress) { - /*SetProgressValue sets state to TBPF_NORMAL automaticly*/ + /* #SetProgressValue sets state to #TBPF_NORMAL automatically. */ if (m_Bar && S_OK == m_Bar->SetProgressValue(m_hWnd, 10000 * progress, 10000)) return GHOST_kSuccess; diff --git a/intern/ghost/intern/GHOST_WindowWin32.h b/intern/ghost/intern/GHOST_WindowWin32.h index a7e7cdc6602..661d80c02aa 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.h +++ b/intern/ghost/intern/GHOST_WindowWin32.h @@ -573,7 +573,7 @@ class GHOST_WindowWin32 : public GHOST_Window { /** Pointer to system. */ GHOST_SystemWin32 *m_system; - /** Pointer to COM IDropTarget implementor. */ + /** Pointer to COM #IDropTarget implementer. */ GHOST_DropTargetWin32 *m_dropTarget; /** Window handle. */ HWND m_hWnd; @@ -582,14 +582,16 @@ class GHOST_WindowWin32 : public GHOST_Window { /** Flag for if window has captured the mouse. */ bool m_hasMouseCaptured; - /** Flag if an operator grabs the mouse with WM_cursor_grab_enable/ungrab(). - * Multiple grabs must be released with a single ungrab. */ + /** + * Flag if an operator grabs the mouse with #WM_cursor_grab_enable, #WM_cursor_grab_disable + * Multiple grabs must be released with a single un-grab. + */ bool m_hasGrabMouse; /** Count of number of pressed buttons. */ int m_nPressedButtons; /** HCURSOR structure of the custom cursor. */ HCURSOR m_customCursor; - /** Request GL context aith alpha channel. */ + /** Request GL context with alpha channel. */ bool m_wantAlphaBackground; /** ITaskbarList3 structure for progress bar. */ diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 9a38631adb9..86a7246a284 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -1169,7 +1169,7 @@ GHOST_TSuccess GHOST_WindowX11::setOrder(GHOST_TWindowOrder order) XGetWindowAttributes(m_display, m_window, &attr); - /* iconized windows give bad match error */ + /* Minimized windows give bad match error. */ if (attr.map_state == IsViewable) XSetInputFocus(m_display, m_window, RevertToPointerRoot, CurrentTime); XFlush(m_display); diff --git a/intern/ghost/intern/GHOST_XrGraphicsBinding.cpp b/intern/ghost/intern/GHOST_XrGraphicsBinding.cpp index 39b7f0776e1..30a2a238ccd 100644 --- a/intern/ghost/intern/GHOST_XrGraphicsBinding.cpp +++ b/intern/ghost/intern/GHOST_XrGraphicsBinding.cpp @@ -125,7 +125,7 @@ class GHOST_XrGraphicsBindingOpenGL : public GHOST_IXrGraphicsBinding { oxr_binding.wgl.hGLRC = ctx_wgl.m_hGLRC; #endif - /* Generate a framebuffer to use for blitting into the texture. */ + /* Generate a frame-buffer to use for blitting into the texture. */ glGenFramebuffers(1, &m_fbo); } diff --git a/intern/ghost/intern/GHOST_XrSession.cpp b/intern/ghost/intern/GHOST_XrSession.cpp index 73b73a8f046..a1fd7fc2781 100644 --- a/intern/ghost/intern/GHOST_XrSession.cpp +++ b/intern/ghost/intern/GHOST_XrSession.cpp @@ -338,7 +338,7 @@ void GHOST_XrSession::endFrameDrawing(std::vector - projection_layer_views; /* Keep alive until xrEndFrame() call! */ + projection_layer_views; /* Keep alive until #xrEndFrame() call! */ XrCompositionLayerProjection proj_layer; std::vector layers; @@ -354,7 +354,7 @@ void GHOST_XrSession::draw(void *draw_customdata) static void copy_openxr_pose_to_ghost_pose(const XrPosef &oxr_pose, GHOST_XrPose &r_ghost_pose) { - /* Set and convert to Blender coodinate space. */ + /* Set and convert to Blender coordinate space. */ r_ghost_pose.position[0] = oxr_pose.position.x; r_ghost_pose.position[1] = oxr_pose.position.y; r_ghost_pose.position[2] = oxr_pose.position.z; @@ -366,7 +366,7 @@ static void copy_openxr_pose_to_ghost_pose(const XrPosef &oxr_pose, GHOST_XrPose static void ghost_xr_draw_view_info_from_view(const XrView &view, GHOST_XrDrawViewInfo &r_info) { - /* Set and convert to Blender coodinate space. */ + /* Set and convert to Blender coordinate space. */ copy_openxr_pose_to_ghost_pose(view.pose, r_info.eye_pose); r_info.fov.angle_left = view.fov.angleLeft; diff --git a/intern/ghost/test/CMakeLists.txt b/intern/ghost/test/CMakeLists.txt index 27a764cd050..37bb00332dd 100644 --- a/intern/ghost/test/CMakeLists.txt +++ b/intern/ghost/test/CMakeLists.txt @@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 3.5) project(GhostMultiTest) -list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../../..//build_files/cmake/Modules") +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../../../build_files/cmake/Modules") set(WITH_GUARDEDALLOC ON) diff --git a/intern/iksolver/intern/IK_QJacobian.cpp b/intern/iksolver/intern/IK_QJacobian.cpp index 7f77968a5d4..82aaaf7bb9a 100644 --- a/intern/iksolver/intern/IK_QJacobian.cpp +++ b/intern/iksolver/intern/IK_QJacobian.cpp @@ -203,7 +203,7 @@ void IK_QJacobian::InvertSDLS() // singular the least squares inverse tries to minimize |J(dtheta) - dX)| // and doesn't try to minimize dTheta. This results in eratic changes in // angle. The damped least squares minimizes |dtheta| to try and reduce this - // erratic behaviour. + // erratic behavior. // // The selectively damped least squares (SDLS) is used here instead of the // DLS. The SDLS damps individual singular values, instead of using a single @@ -325,7 +325,7 @@ void IK_QJacobian::InvertDLS() // inverse tries to minimize |J(dtheta) - dX)| and doesn't // try to minimize dTheta. This results in eratic changes in angle. // Damped least squares minimizes |dtheta| to try and reduce this - // erratic behaviour. + // erratic behavior. // We don't want to use the damped solution everywhere so we // only increase lamda from zero as we approach a singularity. diff --git a/intern/libmv/libmv/numeric/numeric.h b/intern/libmv/libmv/numeric/numeric.h index 6312b4eb1a6..f5478bee6ab 100644 --- a/intern/libmv/libmv/numeric/numeric.h +++ b/intern/libmv/libmv/numeric/numeric.h @@ -463,7 +463,7 @@ inline bool isnan(double i) { #endif } -/// Ceil function that has the same behaviour for positive +/// Ceil function that has the same behavior for positive /// and negative values template FloatType ceil0(const FloatType& value) { diff --git a/intern/mikktspace/mikktspace.c b/intern/mikktspace/mikktspace.c index 17cd997f451..b0119f54019 100644 --- a/intern/mikktspace/mikktspace.c +++ b/intern/mikktspace/mikktspace.c @@ -138,7 +138,7 @@ MIKK_INLINE tbool VNotZero(const SVec3 v) // Shift operations in C are only defined for shift values which are // not negative and smaller than sizeof(value) * CHAR_BIT. -// The mask, used with bitwise-and (&), prevents undefined behaviour +// The mask, used with bitwise-and (&), prevents undefined behavior // when the shift count is 0 or >= the width of unsigned int. MIKK_INLINE unsigned int rotl(unsigned int value, unsigned int count) { @@ -1454,12 +1454,12 @@ static void BuildNeighborsFast(STriInfo pTriInfos[], pEdges[f * 3 + i].f = f; // record face number } - // sort over all edges by i0, this is the pricy one. + // sort over all edges by i0, this is the pricey one. QuickSortEdges(pEdges, 0, iNrTrianglesIn * 3 - 1, 0, uSeed); // sort channel 0 which is i0 // sub sort over i1, should be fast. // could replace this with a 64 bit int sort over (i0,i1) - // with i0 as msb in the quicksort call above. + // with i0 as msb in the quick-sort call above. iEntries = iNrTrianglesIn * 3; iCurStartIndex = 0; for (i = 1; i < iEntries; i++) { diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 342b72acb8c..73cc674858c 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -235,6 +235,7 @@ class IMAGE_MT_image(Menu): layout.menu("IMAGE_MT_image_invert") layout.operator("image.resize", text="Resize") + layout.menu("IMAGE_MT_image_flip") if ima and not show_render: if ima.packed_file: @@ -250,6 +251,13 @@ class IMAGE_MT_image(Menu): layout.operator("palette.extract_from_image", text="Extract Palette") layout.operator("gpencil.image_to_grease_pencil", text="Generate Grease Pencil") +class IMAGE_MT_image_flip(Menu): + bl_label = "Flip" + + def draw(self, _context): + layout = self.layout + layout.operator("image.flip", text="Horizontally").use_flip_horizontal = True + layout.operator("image.flip", text="Vertically").use_flip_vertical = True class IMAGE_MT_image_invert(Menu): bl_label = "Invert" @@ -1584,6 +1592,7 @@ classes = ( IMAGE_MT_select, IMAGE_MT_select_linked, IMAGE_MT_image, + IMAGE_MT_image_flip, IMAGE_MT_image_invert, IMAGE_MT_uvs, IMAGE_MT_uvs_showhide, diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py index f15eed64913..40b57fd10de 100644 --- a/release/scripts/startup/nodeitems_builtins.py +++ b/release/scripts/startup/nodeitems_builtins.py @@ -487,6 +487,7 @@ geometry_node_categories = [ NodeItem("GeometryNodeAttributeCompare"), NodeItem("GeometryNodeAttributeFill"), NodeItem("GeometryNodeAttributeMix"), + NodeItem("GeometryNodeAttributeProximity"), NodeItem("GeometryNodeAttributeColorRamp"), NodeItem("GeometryNodeAttributeVectorMath"), NodeItem("GeometryNodeAttributeSampleTexture"), @@ -525,6 +526,7 @@ geometry_node_categories = [ ]), GeometryNodeCategory("GEO_VOLUME", "Volume", items=[ NodeItem("GeometryNodePointsToVolume"), + NodeItem("GeometryNodeVolumeToMesh"), ]), GeometryNodeCategory("GEO_UTILITIES", "Utilities", items=[ NodeItem("ShaderNodeMapRange"), diff --git a/source/blender/blenkernel/BKE_blender_undo.h b/source/blender/blenkernel/BKE_blender_undo.h index e5ce91df3fb..1febe75b6f2 100644 --- a/source/blender/blenkernel/BKE_blender_undo.h +++ b/source/blender/blenkernel/BKE_blender_undo.h @@ -27,12 +27,14 @@ struct Main; struct MemFileUndoData; struct bContext; +enum eUndoStepDir; + #define BKE_UNDO_STR_MAX 64 struct MemFileUndoData *BKE_memfile_undo_encode(struct Main *bmain, struct MemFileUndoData *mfu_prev); bool BKE_memfile_undo_decode(struct MemFileUndoData *mfu, - const int undo_direction, + const enum eUndoStepDir undo_direction, const bool use_old_bmain_data, struct bContext *C); void BKE_memfile_undo_free(struct MemFileUndoData *mfu); diff --git a/source/blender/blenkernel/BKE_bvhutils.h b/source/blender/blenkernel/BKE_bvhutils.h index 84a17136361..78908908343 100644 --- a/source/blender/blenkernel/BKE_bvhutils.h +++ b/source/blender/blenkernel/BKE_bvhutils.h @@ -38,6 +38,7 @@ struct BMEditMesh; struct MFace; struct MVert; struct Mesh; +struct PointCloud; struct BVHCache; @@ -249,6 +250,20 @@ float bvhtree_sphereray_tri_intersection(const BVHTreeRay *ray, const float v1[3], const float v2[3]); +typedef struct BVHTreeFromPointCloud { + struct BVHTree *tree; + + BVHTree_NearestPointCallback nearest_callback; + + const float (*coords)[3]; +} BVHTreeFromPointCloud; + +BVHTree *BKE_bvhtree_from_pointcloud_get(struct BVHTreeFromPointCloud *data, + const struct PointCloud *pointcloud, + const int tree_type); + +void free_bvhtree_from_pointcloud(struct BVHTreeFromPointCloud *data); + /** * BVHCache */ diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index aed97d4708f..d6b6ffd425e 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -59,7 +59,7 @@ typedef struct Global { short moving; - /** To indicate render is busy, prevent renderwindow events etc. */ + /** To indicate render is busy, prevent render-window events etc. */ bool is_rendering; /** diff --git a/source/blender/blenkernel/BKE_gpencil_modifier.h b/source/blender/blenkernel/BKE_gpencil_modifier.h index 61ccf3d60f6..c066c161f46 100644 --- a/source/blender/blenkernel/BKE_gpencil_modifier.h +++ b/source/blender/blenkernel/BKE_gpencil_modifier.h @@ -248,7 +248,7 @@ typedef struct GpencilModifierTypeInfo { #define GPENCIL_MODIFIER_TYPE_PANEL_PREFIX "MOD_PT_gpencil_" -/* Initialize modifier's global data (type info and some common global storages). */ +/* Initialize modifier's global data (type info and some common global storage). */ void BKE_gpencil_modifier_init(void); void BKE_gpencil_modifierType_panel_id(GpencilModifierType type, char *r_idname); diff --git a/source/blender/blenkernel/BKE_keyconfig.h b/source/blender/blenkernel/BKE_keyconfig.h index ab42d5742ea..1cacbf61976 100644 --- a/source/blender/blenkernel/BKE_keyconfig.h +++ b/source/blender/blenkernel/BKE_keyconfig.h @@ -43,10 +43,10 @@ typedef struct wmKeyConfigPrefType_Runtime { typedef struct wmKeyConfigPrefType_Runtime wmKeyConfigPrefType_Runtime; #endif -/* KeyConfig preferenes (UserDef). */ +/* KeyConfig preferences (UserDef). */ struct wmKeyConfigPref *BKE_keyconfig_pref_ensure(struct UserDef *userdef, const char *kc_idname); -/* KeyConfig preferenes (RNA). */ +/* KeyConfig preferences (RNA). */ struct wmKeyConfigPrefType_Runtime *BKE_keyconfig_pref_type_find(const char *idname, bool quiet); void BKE_keyconfig_pref_type_add(struct wmKeyConfigPrefType_Runtime *kpt_rt); void BKE_keyconfig_pref_type_remove(const struct wmKeyConfigPrefType_Runtime *kpt_rt); diff --git a/source/blender/blenkernel/BKE_lib_id.h b/source/blender/blenkernel/BKE_lib_id.h index cfd1db1317c..5a8d36b94ec 100644 --- a/source/blender/blenkernel/BKE_lib_id.h +++ b/source/blender/blenkernel/BKE_lib_id.h @@ -219,7 +219,7 @@ void id_fake_user_set(struct ID *id); void id_fake_user_clear(struct ID *id); void BKE_id_clear_newpoin(struct ID *id); -/** Flags to control make local code behaviour. */ +/** Flags to control make local code behavior. */ enum { /** Making that ID local is part of making local a whole library. */ LIB_ID_MAKELOCAL_FULL_LIBRARY = 1 << 0, diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h index 29072742f81..8e2f6e6f10c 100644 --- a/source/blender/blenkernel/BKE_mask.h +++ b/source/blender/blenkernel/BKE_mask.h @@ -269,18 +269,18 @@ int BKE_mask_spline_differentiate_calc_total(const struct MaskSpline *spline, const unsigned int resol); float (*BKE_mask_spline_differentiate_with_resolution(struct MaskSpline *spline, - unsigned int *tot_diff_point, - const unsigned int resol))[2]; + const unsigned int resol, + unsigned int *r_tot_diff_point))[2]; void BKE_mask_spline_feather_collapse_inner_loops(struct MaskSpline *spline, float (*feather_points)[2], const unsigned int tot_feather_point); float (*BKE_mask_spline_differentiate( - struct MaskSpline *spline, int width, int height, unsigned int *tot_diff_point))[2]; + struct MaskSpline *spline, int width, int height, unsigned int *r_tot_diff_point))[2]; float (*BKE_mask_spline_feather_differentiated_points_with_resolution( struct MaskSpline *spline, - unsigned int *tot_feather_point, const unsigned int resol, - const bool do_feather_isect))[2]; + const bool do_feather_isect, + unsigned int *r_tot_feather_point))[2]; /* *** mask point functions which involve evaluation *** */ float (*BKE_mask_spline_feather_points(struct MaskSpline *spline, int *tot_feather_point))[2]; @@ -289,7 +289,7 @@ float *BKE_mask_point_segment_diff(struct MaskSpline *spline, struct MaskSplinePoint *point, int width, int height, - unsigned int *tot_diff_point); + unsigned int *r_tot_diff_point); float *BKE_mask_point_segment_feather_diff(struct MaskSpline *spline, struct MaskSplinePoint *point, diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 685a8ed98e2..32b74d161b2 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -399,7 +399,7 @@ typedef struct ModifierTypeInfo { /* Used to find a modifier's panel type. */ #define MODIFIER_TYPE_PANEL_PREFIX "MOD_PT_" -/* Initialize modifier's global data (type info and some common global storages). */ +/* Initialize modifier's global data (type info and some common global storage). */ void BKE_modifier_init(void); const ModifierTypeInfo *BKE_modifier_get_info(ModifierType type); diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index dcfd6ca7bdd..f4f753c4084 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -453,7 +453,9 @@ void ntreeUpdateTree(struct Main *main, struct bNodeTree *ntree); void ntreeUpdateAllNew(struct Main *main); void ntreeUpdateAllUsers(struct Main *main, struct ID *id); -void ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***deplist, int *totnodes); +void ntreeGetDependencyList(struct bNodeTree *ntree, + struct bNode ***r_deplist, + int *r_deplist_len); /* XXX old trees handle output flags automatically based on special output * node types and last active selection. @@ -1366,6 +1368,8 @@ int ntreeTexExecTree(struct bNodeTree *ntree, #define GEO_NODE_POINTS_TO_VOLUME 1022 #define GEO_NODE_COLLECTION_INFO 1023 #define GEO_NODE_IS_VIEWPORT 1024 +#define GEO_NODE_ATTRIBUTE_PROXIMITY 1025 +#define GEO_NODE_VOLUME_TO_MESH 1026 /** \} */ diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index ecabda9e207..e04b4634bf6 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -366,7 +366,7 @@ typedef struct SculptBoundaryEditInfo { /* How many steps were needed to reach this vertex from the boundary. */ int num_propagation_steps; - /* Stregth that is used to deform this vertex. */ + /* Strength that is used to deform this vertex. */ float strength_factor; } SculptBoundaryEditInfo; @@ -538,7 +538,7 @@ typedef struct SculptSession { float gesture_initial_normal[3]; bool gesture_initial_hit; - /* TODO(jbakker): Replace rv3d adn v3d with ViewContext */ + /* TODO(jbakker): Replace rv3d and v3d with ViewContext */ struct RegionView3D *rv3d; struct View3D *v3d; struct Scene *scene; diff --git a/source/blender/blenkernel/BKE_shader_fx.h b/source/blender/blenkernel/BKE_shader_fx.h index 23bd62c70bc..e385f77565b 100644 --- a/source/blender/blenkernel/BKE_shader_fx.h +++ b/source/blender/blenkernel/BKE_shader_fx.h @@ -149,7 +149,7 @@ typedef struct ShaderFxTypeInfo { #define SHADERFX_TYPE_PANEL_PREFIX "FX_PT_" -/* Initialize global data (type info and some common global storages). */ +/* Initialize global data (type info and some common global storage). */ void BKE_shaderfx_init(void); void BKE_shaderfxType_panel_id(ShaderFxType type, char *r_idname); diff --git a/source/blender/blenkernel/BKE_softbody.h b/source/blender/blenkernel/BKE_softbody.h index d1cffd26432..4f8b21141b6 100644 --- a/source/blender/blenkernel/BKE_softbody.h +++ b/source/blender/blenkernel/BKE_softbody.h @@ -49,7 +49,7 @@ typedef struct BodyPoint { /* allocates and initializes general main data */ extern struct SoftBody *sbNew(struct Scene *scene); -/* frees internal data and softbody itself */ +/* frees internal data and soft-body itself */ extern void sbFree(struct Object *ob); /* frees simulation data to reset simulation */ @@ -66,7 +66,7 @@ extern void sbObjectStep(struct Depsgraph *depsgraph, /* makes totally fresh start situation, resets time */ extern void sbObjectToSoftbody(struct Object *ob); -/* links the softbody module to a 'test for Interrupt' function */ +/* links the soft-body module to a 'test for Interrupt' function */ /* pass NULL to unlink again */ extern void sbSetInterruptCallBack(int (*f)(void)); diff --git a/source/blender/blenkernel/BKE_undo_system.h b/source/blender/blenkernel/BKE_undo_system.h index 4c3b21482ea..620496864f5 100644 --- a/source/blender/blenkernel/BKE_undo_system.h +++ b/source/blender/blenkernel/BKE_undo_system.h @@ -96,6 +96,12 @@ typedef struct UndoStep { /* Over alloc 'type->struct_size'. */ } UndoStep; +typedef enum eUndoStepDir { + STEP_REDO = 1, + STEP_UNDO = -1, + STEP_INVALID = 0, +} eUndoStepDir; + typedef enum UndoPushReturn { UNDO_PUSH_RET_FAILURE = 0, UNDO_PUSH_RET_SUCCESS = (1 << 0), @@ -127,7 +133,7 @@ typedef struct UndoType { bool (*step_encode)(struct bContext *C, struct Main *bmain, UndoStep *us); void (*step_decode)( - struct bContext *C, struct Main *bmain, UndoStep *us, int dir, bool is_final); + struct bContext *C, struct Main *bmain, UndoStep *us, const eUndoStepDir dir, bool is_final); /** * \note When freeing all steps, @@ -203,9 +209,9 @@ UndoStep *BKE_undosys_step_find_by_name_with_type(UndoStack *ustack, UndoStep *BKE_undosys_step_find_by_type(UndoStack *ustack, const UndoType *ut); UndoStep *BKE_undosys_step_find_by_name(UndoStack *ustack, const char *name); -int BKE_undosys_step_calc_direction(const UndoStack *ustack, - const UndoStep *us_target, - const UndoStep *us_reference); +eUndoStepDir BKE_undosys_step_calc_direction(const UndoStack *ustack, + const UndoStep *us_target, + const UndoStep *us_reference); bool BKE_undosys_step_load_data_ex(UndoStack *ustack, struct bContext *C, diff --git a/source/blender/blenkernel/BKE_volume_to_mesh.hh b/source/blender/blenkernel/BKE_volume_to_mesh.hh new file mode 100644 index 00000000000..1ec8a8e84cd --- /dev/null +++ b/source/blender/blenkernel/BKE_volume_to_mesh.hh @@ -0,0 +1,43 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "DNA_modifier_types.h" + +#ifdef WITH_OPENVDB +# include +#endif + +struct Mesh; +struct VolumeGrid; + +namespace blender::bke { + +struct VolumeToMeshResolution { + VolumeToMeshResolutionMode mode; + union { + float voxel_size; + float voxel_amount; + } settings; +}; + +#ifdef WITH_OPENVDB +struct Mesh *volume_to_mesh(const openvdb::GridBase &grid, + const VolumeToMeshResolution &resolution, + const float threshold, + const float adaptivity); +#endif + +} // namespace blender::bke diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 0853ab9d82b..0da9598f0ad 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -259,6 +259,7 @@ set(SRC intern/unit.c intern/volume.cc intern/volume_render.cc + intern/volume_to_mesh.cc intern/workspace.c intern/world.c intern/writeavi.c @@ -413,6 +414,7 @@ set(SRC BKE_unit.h BKE_volume.h BKE_volume_render.h + BKE_volume_to_mesh.hh BKE_workspace.h BKE_world.h BKE_writeavi.h @@ -683,7 +685,7 @@ endif() if(WITH_OPENVDB) list(APPEND INC - ../../../intern/openvdb + ../../../intern/openvdb ) list(APPEND INC_SYS ${OPENVDB_INCLUDE_DIRS} @@ -697,10 +699,10 @@ endif() if(WITH_QUADRIFLOW) list(APPEND INC - ../../../intern/quadriflow + ../../../intern/quadriflow ) list(APPEND LIB - bf_intern_quadriflow + bf_intern_quadriflow ) add_definitions(-DWITH_QUADRIFLOW) endif() diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c index 8c666597276..8f74b8ff054 100644 --- a/source/blender/blenkernel/intern/armature_update.c +++ b/source/blender/blenkernel/intern/armature_update.c @@ -428,8 +428,8 @@ static void splineik_evaluate_bone( if (fabsf(scaleFac) != 0.0f) { scale = 1.0f / fabsf(scaleFac); - /* we need to clamp this within sensible values */ - /* NOTE: these should be fine for now, but should get sanitised in future */ + /* We need to clamp this within sensible values. */ + /* NOTE: these should be fine for now, but should get sanitized in future. */ CLAMP(scale, 0.0001f, 100000.0f); } else { @@ -483,7 +483,7 @@ static void splineik_evaluate_bone( final_scale = 1.0f; } - /* apply the scaling (assuming normalised scale) */ + /* Apply the scaling (assuming normalized scale). */ mul_v3_fl(poseMat[0], final_scale); mul_v3_fl(poseMat[2], final_scale); break; diff --git a/source/blender/blenkernel/intern/blender_undo.c b/source/blender/blenkernel/intern/blender_undo.c index 9e061b1ac69..d826aaf24e3 100644 --- a/source/blender/blenkernel/intern/blender_undo.c +++ b/source/blender/blenkernel/intern/blender_undo.c @@ -48,6 +48,7 @@ #include "BKE_context.h" #include "BKE_global.h" #include "BKE_main.h" +#include "BKE_undo_system.h" #include "BLO_readfile.h" #include "BLO_undofile.h" @@ -62,7 +63,7 @@ #define UNDO_DISK 0 bool BKE_memfile_undo_decode(MemFileUndoData *mfu, - const int undo_direction, + const eUndoStepDir undo_direction, const bool use_old_bmain_data, bContext *C) { @@ -80,7 +81,7 @@ bool BKE_memfile_undo_decode(MemFileUndoData *mfu, } else { struct BlendFileReadParams params = {0}; - params.undo_direction = undo_direction > 0 ? 1 : -1; + params.undo_direction = undo_direction; if (!use_old_bmain_data) { params.skip_flags |= BLO_READ_SKIP_UNDO_OLD_MAIN; } diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c index 49475c014cd..32710c4fa60 100644 --- a/source/blender/blenkernel/intern/blendfile.c +++ b/source/blender/blenkernel/intern/blendfile.c @@ -57,6 +57,7 @@ #include "BKE_scene.h" #include "BKE_screen.h" #include "BKE_studiolight.h" +#include "BKE_undo_system.h" #include "BKE_workspace.h" #include "BLO_readfile.h" @@ -148,7 +149,7 @@ static void setup_app_data(bContext *C, LOAD_UNDO, } mode; - if (params->undo_direction != 0) { + if (params->undo_direction != STEP_INVALID) { BLI_assert(bfd->curscene != NULL); mode = LOAD_UNDO; } diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index fd5cb33f02d..790fb128c7c 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -27,6 +27,7 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" +#include "DNA_pointcloud_types.h" #include "BLI_linklist.h" #include "BLI_math.h" @@ -1717,3 +1718,41 @@ void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data) memset(data, 0, sizeof(*data)); } + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Point Cloud BVH Building + * \{ */ + +BVHTree *BKE_bvhtree_from_pointcloud_get(BVHTreeFromPointCloud *data, + const PointCloud *pointcloud, + const int tree_type) +{ + BVHTree *tree = BLI_bvhtree_new(pointcloud->totpoint, 0.0f, tree_type, 6); + if (!tree) { + return NULL; + } + + for (int i = 0; i < pointcloud->totpoint; i++) { + BLI_bvhtree_insert(tree, i, pointcloud->co[i], 1); + } + BLI_assert(BLI_bvhtree_get_len(tree) == pointcloud->totpoint); + BLI_bvhtree_balance(tree); + + data->coords = pointcloud->co; + data->tree = tree; + data->nearest_callback = NULL; + + return tree; +} + +void free_bvhtree_from_pointcloud(BVHTreeFromPointCloud *data) +{ + if (data->tree) { + BLI_bvhtree_free(data->tree); + } + memset(data, 0, sizeof(*data)); +} + +/** \} */ diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 601ee57fc89..dd0572f9b12 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -1909,7 +1909,7 @@ bool BKE_collection_move(Main *bmain, /** \name Iterators * \{ */ -/* scene collection iteractor */ +/* Scene collection iterator. */ typedef struct CollectionsIteratorData { Scene *scene; @@ -1941,10 +1941,12 @@ static void scene_collections_build_array(Collection *collection, void *data) (*array)++; } -static void scene_collections_array(Scene *scene, Collection ***collections_array, int *tot) +static void scene_collections_array(Scene *scene, + Collection ***r_collections_array, + int *r_collections_array_len) { - *collections_array = NULL; - *tot = 0; + *r_collections_array = NULL; + *r_collections_array_len = 0; if (scene == NULL) { return; @@ -1952,14 +1954,15 @@ static void scene_collections_array(Scene *scene, Collection ***collections_arra Collection *collection = scene->master_collection; BLI_assert(collection != NULL); - scene_collection_callback(collection, scene_collections_count, tot); + scene_collection_callback(collection, scene_collections_count, r_collections_array_len); - if (*tot == 0) { + if (*r_collections_array_len == 0) { return; } - Collection **array = MEM_mallocN(sizeof(Collection *) * (*tot), "CollectionArray"); - *collections_array = array; + Collection **array = MEM_mallocN(sizeof(Collection *) * (*r_collections_array_len), + "CollectionArray"); + *r_collections_array = array; scene_collection_callback(collection, scene_collections_build_array, &array); } diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 31860bbe0b4..4a25b0e9d98 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -3419,7 +3419,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, break; } - /* Set output format, png in case exr isn't supported */ + /* Set output format, PNG in case EXR isn't supported. */ #ifdef WITH_OPENEXR if (format == R_IMF_IMTYPE_OPENEXR) { /* OpenEXR 32-bit float */ ibuf->ftype = IMB_FTYPE_OPENEXR; diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c index 1c9430a35a2..6911248d198 100644 --- a/source/blender/blenkernel/intern/lib_override.c +++ b/source/blender/blenkernel/intern/lib_override.c @@ -789,9 +789,11 @@ bool BKE_lib_override_library_resync(Main *bmain, Scene *scene, ViewLayer *view_ ID *id_root_reference = id_root->override_library->reference; + BKE_main_relations_create(bmain, 0); + lib_override_local_group_tag(bmain, id_root, LIB_TAG_DOIT, LIB_TAG_MISSING); - lib_override_linked_group_tag(bmain, id_root_reference, LIB_TAG_DOIT, LIB_TAG_MISSING, true); + lib_override_linked_group_tag(bmain, id_root_reference, LIB_TAG_DOIT, LIB_TAG_MISSING, false); /* Make a mapping 'linked reference IDs' -> 'Local override IDs' of existing overrides. */ GHash *linkedref_to_old_override = BLI_ghash_new( @@ -804,12 +806,40 @@ bool BKE_lib_override_library_resync(Main *bmain, Scene *scene, ViewLayer *view_ * same linked ID in a same hierarchy. */ if (!BLI_ghash_haskey(linkedref_to_old_override, id->override_library->reference)) { BLI_ghash_insert(linkedref_to_old_override, id->override_library->reference, id); - BLI_assert(id->override_library->reference->tag & LIB_TAG_DOIT); + if ((id->override_library->reference->tag & LIB_TAG_DOIT) == 0) { + /* We have an override, but now it does not seem to be necessary to override that ID + * anymore. Check if there are some actual overrides from the user, otherwise assume + * that we can get rid of this local override. */ + LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &id->override_library->properties) { + if (op->rna_prop_type != PROP_POINTER) { + id->override_library->reference->tag |= LIB_TAG_DOIT; + break; + } + + bool do_break = false; + LISTBASE_FOREACH (IDOverrideLibraryPropertyOperation *, opop, &op->operations) { + if ((opop->flag & IDOVERRIDE_LIBRARY_FLAG_IDPOINTER_MATCH_REFERENCE) == 0) { + id->override_library->reference->tag |= LIB_TAG_DOIT; + do_break = true; + break; + } + } + if (do_break) { + break; + } + } + } } } } FOREACH_MAIN_ID_END; + /* Code above may have added some tags, we need to update this too. */ + lib_override_hierarchy_dependencies_recursive_tag( + bmain, id_root_reference, LIB_TAG_DOIT, LIB_TAG_MISSING); + + BKE_main_relations_free(bmain); + /* Make new override from linked data. */ /* Note that this call also remaps all pointers of tagged IDs from old override IDs to new * override IDs (including within the old overrides themselves, since those are tagged too diff --git a/source/blender/blenkernel/intern/mask_evaluate.c b/source/blender/blenkernel/intern/mask_evaluate.c index 595fd0c9550..a42836b5399 100644 --- a/source/blender/blenkernel/intern/mask_evaluate.c +++ b/source/blender/blenkernel/intern/mask_evaluate.c @@ -128,8 +128,8 @@ int BKE_mask_spline_differentiate_calc_total(const MaskSpline *spline, const uns } float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline, - unsigned int *tot_diff_point, - const unsigned int resol))[2] + const unsigned int resol, + unsigned int *r_tot_diff_point))[2] { MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline); @@ -140,12 +140,12 @@ float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline, if (spline->tot_point <= 1) { /* nothing to differentiate */ - *tot_diff_point = 0; + *r_tot_diff_point = 0; return NULL; } /* len+1 because of 'forward_diff_bezier' function */ - *tot_diff_point = tot; + *r_tot_diff_point = tot; diff_points = fp = MEM_mallocN((tot + 1) * sizeof(*diff_points), "mask spline vets"); a = spline->tot_point - 1; @@ -192,11 +192,11 @@ float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline, } float (*BKE_mask_spline_differentiate( - MaskSpline *spline, int width, int height, unsigned int *tot_diff_point))[2] + MaskSpline *spline, int width, int height, unsigned int *r_tot_diff_point))[2] { uint resol = BKE_mask_spline_resolution(spline, width, height); - return BKE_mask_spline_differentiate_with_resolution(spline, tot_diff_point, resol); + return BKE_mask_spline_differentiate_with_resolution(spline, resol, r_tot_diff_point); } /* ** feather points self-intersection collapse routine ** */ @@ -507,9 +507,9 @@ void BKE_mask_spline_feather_collapse_inner_loops(MaskSpline *spline, /** only called from #BKE_mask_spline_feather_differentiated_points_with_resolution() ! */ static float (*mask_spline_feather_differentiated_points_with_resolution__even( MaskSpline *spline, - unsigned int *tot_feather_point, const unsigned int resol, - const bool do_feather_isect))[2] + const bool do_feather_isect, + unsigned int *r_tot_feather_point))[2] { MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline); MaskSplinePoint *point_curr, *point_prev; @@ -569,7 +569,7 @@ static float (*mask_spline_feather_differentiated_points_with_resolution__even( point_curr++; } - *tot_feather_point = tot; + *r_tot_feather_point = tot; if ((spline->flag & MASK_SPLINE_NOINTERSECT) && do_feather_isect) { BKE_mask_spline_feather_collapse_inner_loops(spline, feather, tot); @@ -581,9 +581,9 @@ static float (*mask_spline_feather_differentiated_points_with_resolution__even( /** only called from #BKE_mask_spline_feather_differentiated_points_with_resolution() ! */ static float (*mask_spline_feather_differentiated_points_with_resolution__double( MaskSpline *spline, - unsigned int *tot_feather_point, const unsigned int resol, - const bool do_feather_isect))[2] + const bool do_feather_isect, + unsigned int *r_tot_feather_point))[2] { MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline); @@ -594,12 +594,12 @@ static float (*mask_spline_feather_differentiated_points_with_resolution__double if (spline->tot_point <= 1) { /* nothing to differentiate */ - *tot_feather_point = 0; + *r_tot_feather_point = 0; return NULL; } /* len+1 because of 'forward_diff_bezier' function */ - *tot_feather_point = tot; + *r_tot_feather_point = tot; feather = fp = MEM_mallocN((tot + 1) * sizeof(*feather), "mask spline vets"); a = spline->tot_point - 1; @@ -724,24 +724,24 @@ static float (*mask_spline_feather_differentiated_points_with_resolution__double * values align with #BKE_mask_spline_differentiate_with_resolution * when \a resol arguments match. */ -float ( - *BKE_mask_spline_feather_differentiated_points_with_resolution(MaskSpline *spline, - unsigned int *tot_feather_point, - const unsigned int resol, - const bool do_feather_isect))[2] +float (*BKE_mask_spline_feather_differentiated_points_with_resolution( + MaskSpline *spline, + const unsigned int resol, + const bool do_feather_isect, + unsigned int *r_tot_feather_point))[2] { switch (spline->offset_mode) { case MASK_SPLINE_OFFSET_EVEN: return mask_spline_feather_differentiated_points_with_resolution__even( - spline, tot_feather_point, resol, do_feather_isect); + spline, resol, do_feather_isect, r_tot_feather_point); case MASK_SPLINE_OFFSET_SMOOTH: default: return mask_spline_feather_differentiated_points_with_resolution__double( - spline, tot_feather_point, resol, do_feather_isect); + spline, resol, do_feather_isect, r_tot_feather_point); } } -float (*BKE_mask_spline_feather_points(MaskSpline *spline, int *tot_feather_point))[2] +float (*BKE_mask_spline_feather_points(MaskSpline *spline, int *r_tot_feather_point))[2] { MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline); @@ -783,7 +783,7 @@ float (*BKE_mask_spline_feather_points(MaskSpline *spline, int *tot_feather_poin } } - *tot_feather_point = tot; + *r_tot_feather_point = tot; return feather; } @@ -793,7 +793,7 @@ float *BKE_mask_point_segment_feather_diff(MaskSpline *spline, MaskSplinePoint *point, int width, int height, - unsigned int *tot_feather_point) + unsigned int *r_tot_feather_point) { float *feather, *fp; unsigned int resol = BKE_mask_spline_feather_resolution(spline, width, height); @@ -812,7 +812,7 @@ float *BKE_mask_point_segment_feather_diff(MaskSpline *spline, fp[1] = co[1] + n[1] * weight; } - *tot_feather_point = resol; + *r_tot_feather_point = resol; return feather; } @@ -821,7 +821,7 @@ float *BKE_mask_point_segment_diff(MaskSpline *spline, MaskSplinePoint *point, int width, int height, - unsigned int *tot_diff_point) + unsigned int *r_tot_diff_point) { MaskSplinePoint *points_array = BKE_mask_spline_point_array_from_point(spline, point); @@ -837,7 +837,7 @@ float *BKE_mask_point_segment_diff(MaskSpline *spline, } /* resol+1 because of 'forward_diff_bezier' function */ - *tot_diff_point = resol + 1; + *r_tot_diff_point = resol + 1; diff_points = fp = MEM_callocN(sizeof(float[2]) * (resol + 1), "mask segment vets"); for (j = 0; j < 2; j++) { diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index 583ee8f2857..d29a6e75954 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -646,11 +646,11 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, const unsigned int resol_b = BKE_mask_spline_feather_resolution(spline, width, height) / 4; const unsigned int resol = CLAMPIS(MAX2(resol_a, resol_b), 4, 512); - diff_points = BKE_mask_spline_differentiate_with_resolution(spline, &tot_diff_point, resol); + diff_points = BKE_mask_spline_differentiate_with_resolution(spline, resol, &tot_diff_point); if (do_feather) { diff_feather_points = BKE_mask_spline_feather_differentiated_points_with_resolution( - spline, &tot_diff_feather_points, resol, false); + spline, resol, false, &tot_diff_feather_points); BLI_assert(diff_feather_points); } else { diff --git a/source/blender/blenkernel/intern/multires_unsubdivide.c b/source/blender/blenkernel/intern/multires_unsubdivide.c index e3d670f7c39..02b9bb852d6 100644 --- a/source/blender/blenkernel/intern/multires_unsubdivide.c +++ b/source/blender/blenkernel/intern/multires_unsubdivide.c @@ -201,8 +201,8 @@ static void unsubdivide_face_center_vertex_tag(BMesh *bm, BMVert *initial_vertex /* Repeat a similar operation for all vertices in the queue. */ /* In this case, add to the queue the vertices connected by 2 steps using the diagonals in any - * direction. If a solution exists and intial_vertex was a pole, this is guaranteed that will tag - * all the (0,0) vertices of the grids, and nothing else. */ + * direction. If a solution exists and `initial_vertex` was a pole, this is guaranteed that will + * tag all the (0,0) vertices of the grids, and nothing else. */ /* If it was not a pole, it may or may not find a solution, even if the solution exists. */ while (!BLI_gsqueue_is_empty(queue)) { BMVert *from_v; diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 3c9c255cacd..d611f9b002a 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -3917,22 +3917,23 @@ static int node_get_deplist_recurs(bNodeTree *ntree, bNode *node, bNode ***nsort return level; } -void ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***deplist, int *totnodes) +void ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***r_deplist, int *r_deplist_len) { - *totnodes = 0; + *r_deplist_len = 0; /* first clear data */ LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { node->done = false; - (*totnodes)++; + (*r_deplist_len)++; } - if (*totnodes == 0) { - *deplist = nullptr; + if (*r_deplist_len == 0) { + *r_deplist = nullptr; return; } bNode **nsort; - nsort = *deplist = (bNode **)MEM_callocN((*totnodes) * sizeof(bNode *), "sorted node array"); + nsort = *r_deplist = (bNode **)MEM_callocN((*r_deplist_len) * sizeof(bNode *), + "sorted node array"); /* recursive check */ LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { @@ -4752,6 +4753,7 @@ static void registerGeometryNodes() register_node_type_geo_attribute_compare(); register_node_type_geo_attribute_fill(); + register_node_type_geo_attribute_proximity(); register_node_type_geo_attribute_vector_math(); register_node_type_geo_triangulate(); register_node_type_geo_edge_split(); @@ -4775,6 +4777,7 @@ static void registerGeometryNodes() register_node_type_geo_points_to_volume(); register_node_type_geo_collection_info(); register_node_type_geo_is_viewport(); + register_node_type_geo_volume_to_mesh(); } static void registerFunctionNodes() @@ -4940,10 +4943,3 @@ void BKE_nodetree_remove_layer_n(bNodeTree *ntree, Scene *scene, const int layer } } } - -void BKE_nodetree_shading_params_eval(struct Depsgraph *depsgraph, - bNodeTree *ntree_dst, - const bNodeTree *ntree_src) -{ - DEG_debug_print_eval(depsgraph, __func__, ntree_src->id.name, ntree_dst); -} diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c index 643510cf652..07e7d07f1ef 100644 --- a/source/blender/blenkernel/intern/undo_system.c +++ b/source/blender/blenkernel/intern/undo_system.c @@ -176,8 +176,12 @@ static bool undosys_step_encode(bContext *C, Main *bmain, UndoStack *ustack, Und return ok; } -static void undosys_step_decode( - bContext *C, Main *bmain, UndoStack *ustack, UndoStep *us, int dir, bool is_final) +static void undosys_step_decode(bContext *C, + Main *bmain, + UndoStack *ustack, + UndoStep *us, + const eUndoStepDir dir, + bool is_final) { CLOG_INFO(&LOG, 2, "addr=%p, name='%s', type='%s'", us, us->name, us->type->name); @@ -677,9 +681,9 @@ UndoStep *BKE_undosys_step_find_by_type(UndoStack *ustack, const UndoType *ut) * * \return -1 for undo, 1 for redo, 0 in case of error. */ -int BKE_undosys_step_calc_direction(const UndoStack *ustack, - const UndoStep *us_target, - const UndoStep *us_reference) +eUndoStepDir BKE_undosys_step_calc_direction(const UndoStack *ustack, + const UndoStep *us_target, + const UndoStep *us_reference) { if (us_reference == NULL) { us_reference = ustack->step_active; @@ -694,26 +698,26 @@ int BKE_undosys_step_calc_direction(const UndoStack *ustack, * to the end of the list, rather than its start. */ /* NOTE: in case target step is the active one, we assume we are in an undo case... */ if (ELEM(us_target, us_reference, us_reference->prev)) { - return -1; + return STEP_UNDO; } if (us_target == us_reference->next) { - return 1; + return STEP_REDO; } /* Search forward, and then backward. */ for (UndoStep *us_iter = us_reference->next; us_iter != NULL; us_iter = us_iter->next) { if (us_iter == us_target) { - return 1; + return STEP_REDO; } } for (UndoStep *us_iter = us_reference->prev; us_iter != NULL; us_iter = us_iter->prev) { if (us_iter == us_target) { - return -1; + return STEP_UNDO; } } BLI_assert(!"Target undo step not found, this should not happen and may indicate an undo stack corruption"); - return 0; + return STEP_INVALID; } /** @@ -752,8 +756,8 @@ bool BKE_undosys_step_load_data_ex(UndoStack *ustack, } /* This considers we are in undo case if both `us_target` and `us_reference` are the same. */ - const int undo_dir = BKE_undosys_step_calc_direction(ustack, us_target, us_reference); - BLI_assert(undo_dir != 0); + const eUndoStepDir undo_dir = BKE_undosys_step_calc_direction(ustack, us_target, us_reference); + BLI_assert(undo_dir != STEP_INVALID); /* This will be the active step once the undo process is complete. * diff --git a/source/blender/blenkernel/intern/volume_to_mesh.cc b/source/blender/blenkernel/intern/volume_to_mesh.cc new file mode 100644 index 00000000000..7ab67516242 --- /dev/null +++ b/source/blender/blenkernel/intern/volume_to_mesh.cc @@ -0,0 +1,183 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include + +#include "BLI_float3.hh" +#include "BLI_span.hh" +#include "BLI_utildefines.h" + +#include "DNA_mesh_types.h" +#include "DNA_meshdata_types.h" +#include "DNA_volume_types.h" + +#include "BKE_mesh.h" +#include "BKE_volume.h" + +#ifdef WITH_OPENVDB +# include +# include +#endif + +#include "BKE_volume_to_mesh.hh" + +namespace blender::bke { + +#ifdef WITH_OPENVDB + +struct VolumeToMeshOp { + const openvdb::GridBase &base_grid; + const VolumeToMeshResolution resolution; + const float threshold; + const float adaptivity; + std::vector verts; + std::vector tris; + std::vector quads; + + template bool operator()() + { + if constexpr (std::is_scalar_v) { + this->generate_mesh_data(); + return true; + } + return false; + } + + template void generate_mesh_data() + { + const GridType &grid = static_cast(base_grid); + + if (this->resolution.mode == VOLUME_TO_MESH_RESOLUTION_MODE_GRID) { + this->grid_to_mesh(grid); + return; + } + + const float resolution_factor = this->compute_resolution_factor(base_grid); + typename GridType::Ptr temp_grid = this->create_grid_with_changed_resolution( + grid, resolution_factor); + this->grid_to_mesh(*temp_grid); + } + + template + typename GridType::Ptr create_grid_with_changed_resolution(const GridType &old_grid, + const float resolution_factor) + { + BLI_assert(resolution_factor > 0.0f); + + openvdb::Mat4R xform; + xform.setToScale(openvdb::Vec3d(resolution_factor)); + openvdb::tools::GridTransformer transformer{xform}; + + typename GridType::Ptr new_grid = GridType::create(); + transformer.transformGrid(old_grid, *new_grid); + new_grid->transform() = old_grid.transform(); + new_grid->transform().preScale(1.0f / resolution_factor); + return new_grid; + } + + float compute_resolution_factor(const openvdb::GridBase &grid) const + { + const openvdb::Vec3s voxel_size{grid.voxelSize()}; + const float current_voxel_size = std::max({voxel_size[0], voxel_size[1], voxel_size[2]}); + const float desired_voxel_size = this->compute_desired_voxel_size(grid); + return current_voxel_size / desired_voxel_size; + } + + float compute_desired_voxel_size(const openvdb::GridBase &grid) const + { + if (this->resolution.mode == VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_SIZE) { + return this->resolution.settings.voxel_size; + } + const openvdb::CoordBBox coord_bbox = base_grid.evalActiveVoxelBoundingBox(); + const openvdb::BBoxd bbox = grid.transform().indexToWorld(coord_bbox); + const float max_extent = bbox.extents()[bbox.maxExtent()]; + const float voxel_size = max_extent / this->resolution.settings.voxel_amount; + return voxel_size; + } + + template void grid_to_mesh(const GridType &grid) + { + openvdb::tools::volumeToMesh( + grid, this->verts, this->tris, this->quads, this->threshold, this->adaptivity); + + /* Better align generated mesh with volume (see T85312). */ + openvdb::Vec3s offset = grid.voxelSize() / 2.0f; + for (openvdb::Vec3s &position : this->verts) { + position += offset; + } + } +}; + +static Mesh *new_mesh_from_openvdb_data(Span verts, + Span tris, + Span quads) +{ + const int tot_loops = 3 * tris.size() + 4 * quads.size(); + const int tot_polys = tris.size() + quads.size(); + + Mesh *mesh = BKE_mesh_new_nomain(verts.size(), 0, 0, tot_loops, tot_polys); + + /* Write vertices. */ + for (const int i : verts.index_range()) { + const blender::float3 co = blender::float3(verts[i].asV()); + copy_v3_v3(mesh->mvert[i].co, co); + } + + /* Write triangles. */ + for (const int i : tris.index_range()) { + mesh->mpoly[i].loopstart = 3 * i; + mesh->mpoly[i].totloop = 3; + for (int j = 0; j < 3; j++) { + /* Reverse vertex order to get correct normals. */ + mesh->mloop[3 * i + j].v = tris[i][2 - j]; + } + } + + /* Write quads. */ + const int poly_offset = tris.size(); + const int loop_offset = tris.size() * 3; + for (const int i : quads.index_range()) { + mesh->mpoly[poly_offset + i].loopstart = loop_offset + 4 * i; + mesh->mpoly[poly_offset + i].totloop = 4; + for (int j = 0; j < 4; j++) { + /* Reverse vertex order to get correct normals. */ + mesh->mloop[loop_offset + 4 * i + j].v = quads[i][3 - j]; + } + } + + BKE_mesh_calc_edges(mesh, false, false); + BKE_mesh_calc_normals(mesh); + return mesh; +} + +Mesh *volume_to_mesh(const openvdb::GridBase &grid, + const VolumeToMeshResolution &resolution, + const float threshold, + const float adaptivity) +{ + const VolumeGridType grid_type = BKE_volume_grid_type_openvdb(grid); + + VolumeToMeshOp to_mesh_op{grid, resolution, threshold, adaptivity}; + if (!BKE_volume_grid_type_operation(grid_type, to_mesh_op)) { + return nullptr; + } + + return new_mesh_from_openvdb_data(to_mesh_op.verts, to_mesh_op.tris, to_mesh_op.quads); +} + +#endif /* WITH_OPENVDB */ + +} // namespace blender::bke diff --git a/source/blender/blenkernel/tracking_private.h b/source/blender/blenkernel/tracking_private.h index c8e7fea6601..35c5221efa3 100644 --- a/source/blender/blenkernel/tracking_private.h +++ b/source/blender/blenkernel/tracking_private.h @@ -125,7 +125,7 @@ float *tracking_track_get_mask_for_region(int frame_width, const float region_max[2], MovieTrackingTrack *track); -/*********************** Frame accessr *************************/ +/*********************** Frame Accessor *************************/ struct libmv_FrameAccessor; diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h index 9f144a0ddaa..df80e720363 100644 --- a/source/blender/blenlib/BLI_fileops.h +++ b/source/blender/blenlib/BLI_fileops.h @@ -88,10 +88,10 @@ typedef enum eFileAttributes { FILE_ATTR_TEMPORARY = 1 << 7, /* Used for temporary storage. */ FILE_ATTR_SPARSE_FILE = 1 << 8, /* Sparse File. */ FILE_ATTR_OFFLINE = 1 << 9, /* Data is not immediately available. */ - FILE_ATTR_ALIAS = 1 << 10, /* Mac Alias or Windows Lnk. File-based redirection. */ - FILE_ATTR_REPARSE_POINT = 1 << 11, /* File has associated reparse point. */ + FILE_ATTR_ALIAS = 1 << 10, /* Mac Alias or Windows LNK. File-based redirection. */ + FILE_ATTR_REPARSE_POINT = 1 << 11, /* File has associated re-parse point. */ FILE_ATTR_SYMLINK = 1 << 12, /* Reference to another file. */ - FILE_ATTR_JUNCTION_POINT = 1 << 13, /* Folder Symlink. */ + FILE_ATTR_JUNCTION_POINT = 1 << 13, /* Folder Symbolic-link. */ FILE_ATTR_MOUNT_POINT = 1 << 14, /* Volume mounted as a folder. */ FILE_ATTR_HARDLINK = 1 << 15, /* Duplicated directory entry. */ } eFileAttributes; diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index f45a4d6fdef..fe995b2e46e 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -177,7 +177,7 @@ typedef enum eEulerRotationOrders { EULER_ORDER_YZX, EULER_ORDER_ZXY, EULER_ORDER_ZYX, - /* there are 6 more entries with dulpicate entries included */ + /* There are 6 more entries with duplicate entries included. */ } eEulerRotationOrders; void eulO_to_quat(float quat[4], const float eul[3], const short order); diff --git a/source/blender/blenlib/BLI_mesh_intersect.hh b/source/blender/blenlib/BLI_mesh_intersect.hh index ddda3edf2ff..a7996939bb1 100644 --- a/source/blender/blenlib/BLI_mesh_intersect.hh +++ b/source/blender/blenlib/BLI_mesh_intersect.hh @@ -95,7 +95,7 @@ struct Plane { /* Test equality on the exact fields. */ bool operator==(const Plane &other) const; - /* Hash onthe exact fields. */ + /* Hash on the exact fields. */ uint64_t hash() const; void make_canonical(); @@ -144,7 +144,7 @@ struct Face : NonCopyable { /* Test equality of verts, in same positions. */ bool operator==(const Face &other) const; - /* Test equaliy faces allowing cyclic shifts. */ + /* Test equality faces allowing cyclic shifts. */ bool cyclic_equal(const Face &other) const; FacePos next_pos(FacePos p) const diff --git a/source/blender/blenlib/BLI_sys_types.h b/source/blender/blenlib/BLI_sys_types.h index ff1f6af9573..2740e3740f2 100644 --- a/source/blender/blenlib/BLI_sys_types.h +++ b/source/blender/blenlib/BLI_sys_types.h @@ -40,7 +40,7 @@ extern "C" { #if defined(__linux__) || defined(__GNU__) || defined(__NetBSD__) || defined(__OpenBSD__) || \ defined(__FreeBSD_kernel__) || defined(__HAIKU__) -/* Linux-i386, Linux-Alpha, Linux-ppc */ +/* Linux-i386, Linux-Alpha, Linux-PPC */ # include /* XXX */ diff --git a/source/blender/blenlib/BLI_system.h b/source/blender/blenlib/BLI_system.h index 8dd0706e1e2..0d5b2e6e2df 100644 --- a/source/blender/blenlib/BLI_system.h +++ b/source/blender/blenlib/BLI_system.h @@ -49,7 +49,7 @@ void BLI_hostname_get(char *buffer, size_t bufsize); size_t BLI_system_memory_max_in_megabytes(void); int BLI_system_memory_max_in_megabytes_int(void); -/* getpid */ +/* For `getpid`. */ #ifdef WIN32 # define BLI_SYSTEM_PID_H diff --git a/source/blender/blenlib/BLI_voronoi_2d.h b/source/blender/blenlib/BLI_voronoi_2d.h index 92c7d367b48..0e27229352f 100644 --- a/source/blender/blenlib/BLI_voronoi_2d.h +++ b/source/blender/blenlib/BLI_voronoi_2d.h @@ -50,7 +50,7 @@ typedef struct VoronoiEdge { /* point on Voronoi place on the right side of edge */ float right[2]; - /* directional coeffitients satisfying equation y = f * x + g (edge lies on this line) */ + /* Directional coefficients satisfying equation `y = f * x + g` (edge lies on this line). */ float f, g; /* some edges consist of two parts, diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h index dc4d6d8fce4..f771d26baab 100644 --- a/source/blender/blenlib/BLI_winstuff.h +++ b/source/blender/blenlib/BLI_winstuff.h @@ -64,7 +64,7 @@ extern "C" { # define S_ISDIR(x) (((x)&_S_IFDIR) == _S_IFDIR) #endif -/* defines for using ISO C++ conformant names */ +/* Defines for using ISO C++ conferment names. */ #if !defined(_MSC_VER) || _MSC_VER < 1900 # define snprintf _snprintf #endif diff --git a/source/blender/blenlib/intern/BLI_filelist.c b/source/blender/blenlib/intern/BLI_filelist.c index fe3ec368379..cc01693422c 100644 --- a/source/blender/blenlib/intern/BLI_filelist.c +++ b/source/blender/blenlib/intern/BLI_filelist.c @@ -369,7 +369,7 @@ void BLI_filelist_entry_datetime_to_string(const struct stat *st, int yesterday_yday = 0; if (r_is_today || r_is_yesterday) { - /* Localtime() has only one buffer so need to get data out before called again. */ + /* `localtime()` has only one buffer so need to get data out before called again. */ const time_t ts_now = time(NULL); struct tm *today = localtime(&ts_now); diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 0f90ad3a490..e1e71b02615 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -94,7 +94,7 @@ struct BVHTree { BVHNode *nodearray; /* pre-alloc branch nodes */ BVHNode **nodechild; /* pre-alloc children for nodes */ float *nodebv; /* pre-alloc bounding-volumes for nodes */ - float epsilon; /* epslion is used for inflation of the k-dop */ + float epsilon; /* Epsilon is used for inflation of the K-DOP. */ int totleaf; /* leafs */ int totbranch; axis_t start_axis, stop_axis; /* bvhtree_kdop_axes array indices according to axis */ @@ -365,7 +365,7 @@ static void create_kdop_hull( int k; axis_t axis_iter; - /* don't init boudings for the moving case */ + /* Don't initialize bounds for the moving case */ if (!moving) { node_minmax_init(tree, node); } @@ -573,9 +573,9 @@ typedef struct BVHBuildHelper { int tree_type; int totleafs; - /** Min number of leafs that are archievable from a node at depth N */ + /** Min number of leafs that are achievable from a node at depth `N`. */ int leafs_per_child[32]; - /** Number of nodes at depth N (tree_type^N) */ + /** Number of nodes at depth `N (tree_type^N)`. */ int branches_on_level[32]; /** Number of leafs that are placed on the level that is not 100% filled */ diff --git a/source/blender/blenlib/intern/array_store.c b/source/blender/blenlib/intern/array_store.c index 847cb42186a..08164e75009 100644 --- a/source/blender/blenlib/intern/array_store.c +++ b/source/blender/blenlib/intern/array_store.c @@ -533,7 +533,7 @@ static void bchunk_list_calc_trim_len(const BArrayInfo *info, data_trim_len = data_trim_len - data_last_chunk_len; if (data_last_chunk_len) { if (data_last_chunk_len < info->chunk_byte_size_min) { - /* may be zero and thats OK */ + /* May be zero and that's OK. */ data_trim_len -= info->chunk_byte_size; data_last_chunk_len += info->chunk_byte_size; } diff --git a/source/blender/blenlib/intern/boxpack_2d.c b/source/blender/blenlib/intern/boxpack_2d.c index 3d010011a79..84b3f728884 100644 --- a/source/blender/blenlib/intern/boxpack_2d.c +++ b/source/blender/blenlib/intern/boxpack_2d.c @@ -385,7 +385,7 @@ void BLI_box_pack_2d(BoxPack *boxarray, const uint len, float *r_tot_x, float *r box++; /* next box, needed for the loop below */ /* ...done packing the first box */ - /* Main boxpacking loop */ + /* Main box-packing loop */ for (box_index = 1; box_index < len; box_index++, box++) { /* These floats are used for sorting re-sorting */ diff --git a/source/blender/blenlib/intern/delaunay_2d.cc b/source/blender/blenlib/intern/delaunay_2d.cc index f0b65a55816..1cf2046ce16 100644 --- a/source/blender/blenlib/intern/delaunay_2d.cc +++ b/source/blender/blenlib/intern/delaunay_2d.cc @@ -561,14 +561,14 @@ template void cdt_draw(const std::string &label, const CDTArrangemen const vec2 &uco = u->co.approx; const vec2 &vco = v->co.approx; int strokew = e->input_ids == nullptr ? thin_line : thick_line; - f << "\n"; f << " " << vertname(u) << vertname(v) << "\n"; f << "\n"; if (draw_edge_labels) { f << ""; + << R"(" font-size="small">)"; f << vertname(u) << vertname(v) << sename(&e->symedges[0]) << sename(&e->symedges[1]) << "\n"; } @@ -576,13 +576,13 @@ template void cdt_draw(const std::string &label, const CDTArrangemen int i = 0; for (const CDTVert *v : cdt.verts) { - f << "co.approx[0]) << "\" cy=\"" << SY(v->co.approx[1]) + f << R"(co.approx[0]) << "\" cy=\"" << SY(v->co.approx[1]) << "\" r=\"" << vert_radius << "\">\n"; f << " [" << i << "]" << v->co.approx << "\n"; f << "\n"; if (draw_vert_labels) { f << "co.approx[0]) + vert_radius << "\" y=\"" - << SY(v->co.approx[1]) - vert_radius << "\" font-size=\"small\">[" << i << "]\n"; + << SY(v->co.approx[1]) - vert_radius << R"(" font-size="small">[)" << i << "]\n"; } ++i; } @@ -754,7 +754,7 @@ template<> CDTVert::CDTVert(const vec2 &pt) { this->co.exact = pt; this->co.approx = pt; - this->co.abs_approx = pt; /* Not used, so does't matter. */ + this->co.abs_approx = pt; /* Not used, so doesn't matter. */ this->input_ids = nullptr; this->symedge = nullptr; this->index = -1; @@ -1411,12 +1411,12 @@ void dc_tri(CDTArrangement *cdt, /* Guibas-Stolfi Divide-and_Conquer algorithm. */ template void dc_triangulate(CDTArrangement *cdt, Array> &sites) { - /* Compress sites in place to eliminted verts that merge to others. */ + /* Compress sites in place to eliminated verts that merge to others. */ int i = 0; int j = 0; int nsites = sites.size(); while (j < nsites) { - /* Invariante: sites[0..i-1] have non-merged verts from 0..(j-1) in them. */ + /* Invariant: `sites[0..i-1]` have non-merged verts from `0..(j-1)` in them. */ sites[i] = sites[j++]; if (sites[i].v->merge_to_index < 0) { i++; diff --git a/source/blender/blenlib/intern/dot_export.cc b/source/blender/blenlib/intern/dot_export.cc index eb15a51366e..13a2341a9d5 100644 --- a/source/blender/blenlib/intern/dot_export.cc +++ b/source/blender/blenlib/intern/dot_export.cc @@ -275,10 +275,10 @@ NodeWithSocketsRef::NodeWithSocketsRef(Node &node, { std::stringstream ss; - ss << "<"; + ss << R"(<
)"; /* Header */ - ss << ""; @@ -291,7 +291,7 @@ NodeWithSocketsRef::NodeWithSocketsRef(Node &node, if (name.size() == 0) { name = "No Name"; } - ss << ""; } @@ -304,7 +304,7 @@ NodeWithSocketsRef::NodeWithSocketsRef(Node &node, if (name.size() == 0) { name = "No Name"; } - ss << ""; } diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index 301d9dc2296..e755a8e75b5 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -307,7 +307,7 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile *pf) /* Extract the first 256 character from TTF */ lcode = charcode = FT_Get_First_Char(face, &glyph_index); - /* No charmap found from the ttf so we need to figure it out */ + /* No `charmap` found from the TTF so we need to figure it out. */ if (glyph_index == 0) { FT_CharMap found = NULL; FT_CharMap charmap; diff --git a/source/blender/blenlib/intern/gsqueue.c b/source/blender/blenlib/intern/gsqueue.c index 118d19418d4..ae34074e804 100644 --- a/source/blender/blenlib/intern/gsqueue.c +++ b/source/blender/blenlib/intern/gsqueue.c @@ -41,7 +41,7 @@ struct QueueChunk { struct _GSQueue { struct QueueChunk *chunk_first; /* first active chunk to pop from */ - struct QueueChunk *chunk_last; /* flast active chunk to push onto */ + struct QueueChunk *chunk_last; /* last active chunk to push onto */ struct QueueChunk *chunk_free; /* free chunks to reuse */ size_t chunk_first_index; /* index into 'chunk_first' */ size_t chunk_last_index; /* index into 'chunk_last' */ diff --git a/source/blender/blenlib/intern/jitter_2d.c b/source/blender/blenlib/intern/jitter_2d.c index c92aeddb27d..068cb3d2f70 100644 --- a/source/blender/blenlib/intern/jitter_2d.c +++ b/source/blender/blenlib/intern/jitter_2d.c @@ -179,7 +179,7 @@ void BLI_jitter_init(float (*jitarr)[2], int num) MEM_freeN(jit2); - /* finally, move jittertab to be centered around (0, 0) */ + /* Finally, move jitter to be centered around (0, 0). */ for (i = 0; i < num; i++) { jitarr[i][0] -= 0.5f; jitarr[i][1] -= 0.5f; diff --git a/source/blender/blenlib/intern/kdtree_impl.h b/source/blender/blenlib/intern/kdtree_impl.h index 26b2228cdbc..c92dc2e95a3 100644 --- a/source/blender/blenlib/intern/kdtree_impl.h +++ b/source/blender/blenlib/intern/kdtree_impl.h @@ -158,7 +158,7 @@ static uint kdtree_balance(KDTreeNode *nodes, uint nodes_len, uint axis, const u return 0 + ofs; } - /* quicksort style sorting around median */ + /* Quick-sort style sorting around median. */ left = 0; right = nodes_len - 1; median = nodes_len / 2; diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c index b332a0b2cb9..28aa81e5858 100644 --- a/source/blender/blenlib/intern/math_base_inline.c +++ b/source/blender/blenlib/intern/math_base_inline.c @@ -379,7 +379,7 @@ MINLINE float fractf(float a) return a - floorf(a); } -/* Adapted from godotengine math_funcs.h. */ +/* Adapted from godot-engine math_funcs.h. */ MINLINE float wrapf(float value, float max, float min) { float range = max - min; @@ -716,7 +716,7 @@ MALWAYS_INLINE __m128 _bli_math_improve_5throot_solution(const __m128 old_result __m128 approx2 = _mm_mul_ps(old_result, old_result); __m128 approx4 = _mm_mul_ps(approx2, approx2); __m128 t = _mm_div_ps(x, approx4); - __m128 summ = _mm_add_ps(_mm_mul_ps(_mm_set1_ps(4.0f), old_result), t); /* fma */ + __m128 summ = _mm_add_ps(_mm_mul_ps(_mm_set1_ps(4.0f), old_result), t); /* FMA. */ return _mm_mul_ps(summ, _mm_set1_ps(1.0f / 5.0f)); } diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c index a1caf2fe02d..26828cb8717 100644 --- a/source/blender/blenlib/intern/math_color_inline.c +++ b/source/blender/blenlib/intern/math_color_inline.c @@ -41,7 +41,7 @@ MALWAYS_INLINE __m128 srgb_to_linearrgb_v4_simd(const __m128 c) __m128 cmp = _mm_cmplt_ps(c, _mm_set1_ps(0.04045f)); __m128 lt = _mm_max_ps(_mm_mul_ps(c, _mm_set1_ps(1.0f / 12.92f)), _mm_set1_ps(0.0f)); __m128 gtebase = _mm_mul_ps(_mm_add_ps(c, _mm_set1_ps(0.055f)), - _mm_set1_ps(1.0f / 1.055f)); /* fma */ + _mm_set1_ps(1.0f / 1.055f)); /* FMA. */ __m128 gte = _bli_math_fastpow24(gtebase); return _bli_math_blend_sse(cmp, lt, gte); } diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 0873dece864..5d78bb0b901 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -5233,7 +5233,7 @@ void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const f len = sqrtf(x * x + y * y + z * z); if (len > 0.0f) { if (UNLIKELY(x == 0.0f && y == 0.0f)) { - *r_u = 0.0f; /* othwise domain error */ + *r_u = 0.0f; /* Otherwise domain error. */ } else { *r_u = (1.0f - atan2f(x, y) / (float)M_PI) / 2.0f; @@ -5836,7 +5836,7 @@ bool form_factor_visible_quad(const float p[3], return true; } -/* altivec optimization, this works, but is unused */ +/* `AltiVec` optimization, this works, but is unused. */ #if 0 # include @@ -6125,7 +6125,7 @@ bool is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3], bool is_quad_convex_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2]) { - /* linetests, the 2 diagonals have to instersect to be convex */ + /* Line-tests, the 2 diagonals have to intersect to be convex. */ return (isect_seg_seg_v2(v1, v3, v2, v4) > 0); } @@ -6233,7 +6233,7 @@ float cubic_tangent_factor_circle_v3(const float tan_l[3], const float tan_r[3]) return (1.0f / 3.0f) * 0.75f; } if (tan_dot < -1.0f + eps) { - /* parallele tangents (half-circle) */ + /* Parallel tangents (half-circle). */ return (1.0f / 2.0f); } diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index f0d8bea52b9..57fe99ce019 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -594,7 +594,7 @@ float quat_split_swing_and_twist(const float q_in[4], int axis, float r_swing[4] BLI_assert(fabsf(r_swing[axis + 1]) < BLI_ASSERT_UNIT_EPSILON); } - /* Output twist last just in case q ovelaps r_twist. */ + /* Output twist last just in case q overlaps r_twist. */ if (r_twist) { r_twist[0] = cos_t; zero_v3(r_twist + 1); diff --git a/source/blender/blenlib/intern/math_vec.cc b/source/blender/blenlib/intern/math_vec.cc index 84fa6c69d17..1d138d0b0f4 100644 --- a/source/blender/blenlib/intern/math_vec.cc +++ b/source/blender/blenlib/intern/math_vec.cc @@ -104,7 +104,7 @@ mpq2::isect_result mpq2::isect_seg_seg(const mpq2 &v1, } else { ans.lambda = ((v1[1] - v3[1]) * (v4[0] - v3[0]) - (v1[0] - v3[0]) * (v4[1] - v3[1])) / div; - /* Avoid dividing mu by div: it is expensive in multiprecision. */ + /* Avoid dividing mu by div: it is expensive in multi-precision. */ mpq_class mudiv = ((v1[1] - v3[1]) * (v2[0] - v1[0]) - (v1[0] - v3[0]) * (v2[1] - v1[1])); if (ans.lambda >= 0 && ans.lambda <= 1 && ((div > 0 && mudiv >= 0 && mudiv <= div) || (div < 0 && mudiv <= 0 && mudiv >= div))) { diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc index 85a6ab42013..b2b8dd4e900 100644 --- a/source/blender/blenlib/intern/mesh_intersect.cc +++ b/source/blender/blenlib/intern/mesh_intersect.cc @@ -1055,25 +1055,22 @@ static std::ostream &operator<<(std::ostream &os, const CoplanarClusterInfo &cli enum ITT_value_kind { INONE, IPOINT, ISEGMENT, ICOPLANAR }; struct ITT_value { - mpq3 p1; /* Only relevant for IPOINT and ISEGMENT kind. */ - mpq3 p2; /* Only relevant for ISEGMENT kind. */ - int t_source; /* Index of the source triangle that intersected the target one. */ - enum ITT_value_kind kind; + mpq3 p1; /* Only relevant for IPOINT and ISEGMENT kind. */ + mpq3 p2; /* Only relevant for ISEGMENT kind. */ + int t_source = -1; /* Index of the source triangle that intersected the target one. */ + enum ITT_value_kind kind = INONE; - ITT_value() : t_source(-1), kind(INONE) - { - } - ITT_value(ITT_value_kind k) : t_source(-1), kind(k) + ITT_value() = default; + explicit ITT_value(ITT_value_kind k) : kind(k) { } ITT_value(ITT_value_kind k, int tsrc) : t_source(tsrc), kind(k) { } - ITT_value(ITT_value_kind k, const mpq3 &p1) : p1(p1), t_source(-1), kind(k) + ITT_value(ITT_value_kind k, const mpq3 &p1) : p1(p1), kind(k) { } - ITT_value(ITT_value_kind k, const mpq3 &p1, const mpq3 &p2) - : p1(p1), p2(p2), t_source(-1), kind(k) + ITT_value(ITT_value_kind k, const mpq3 &p1, const mpq3 &p2) : p1(p1), p2(p2), kind(k) { } ITT_value(const ITT_value &other) @@ -1385,7 +1382,7 @@ static ITT_value itt_canon2(const mpq3 &p1, return ITT_value(ISEGMENT, intersect_1, intersect_2); } -/* Helper function for intersect_tri_tri. Args have been canonicalized for triangle 1. */ +/* Helper function for intersect_tri_tri. Arguments have been canonicalized for triangle 1. */ static ITT_value itt_canon1(const mpq3 &p1, const mpq3 &q1, @@ -2026,7 +2023,7 @@ class TriOverlaps { if (dbg_level > 0) { std::cout << "TriOverlaps construction\n"; } - /* Tree type is 8 => octtree; axis = 6 => using XYZ axes only. */ + /* Tree type is 8 => octree; axis = 6 => using XYZ axes only. */ tree_ = BLI_bvhtree_new(tm.face_size(), FLT_EPSILON, 8, 6); /* In the common case of a binary boolean and no self intersection in * each shape, we will use two trees and simple bounding box overlap. */ @@ -2378,7 +2375,7 @@ static CDT_data calc_cluster_subdivided(const CoplanarClusterInfo &clinfo, } } } - /* Use CDT to subdivide the cluster triangles and the points and segs in itts. */ + /* Use CDT to subdivide the cluster triangles and the points and segments in itts. */ CDT_data cd_data = prepare_cdt_input_for_cluster(tm, clinfo, c, itts); do_cdt(cd_data); return cd_data; diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 7cd7991b8d8..39f5abc4cd8 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -459,7 +459,7 @@ static wchar_t *next_slash(wchar_t *path) return slash; } -/* adds a slash if the unc path points sto a share */ +/* Adds a slash if the UNC path points to a share. */ static void BLI_path_add_slash_to_share(wchar_t *uncpath) { wchar_t *slash_after_server = next_slash(uncpath + 2); @@ -1279,7 +1279,7 @@ void BLI_setenv(const char *env, const char *val) uputenv(env, val); #else - /* linux/osx/bsd */ + /* Linux/macOS/BSD */ if (val) { setenv(env, val, 1); } diff --git a/source/blender/blenlib/intern/polyfill_2d.c b/source/blender/blenlib/intern/polyfill_2d.c index fe9fa514e08..dadef979b09 100644 --- a/source/blender/blenlib/intern/polyfill_2d.c +++ b/source/blender/blenlib/intern/polyfill_2d.c @@ -253,7 +253,7 @@ static uint kdtree2d_balance_recursive( return 0 + ofs; } - /* quicksort style sorting around median */ + /* Quick-sort style sorting around median. */ neg = 0; pos = totnode - 1; median = totnode / 2; @@ -284,7 +284,7 @@ static uint kdtree2d_balance_recursive( } } - /* set node and sort subnodes */ + /* Set node and sort sub-nodes. */ node = &nodes[median]; node->axis = axis; axis = !axis; diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 2a520516418..8c9a229860e 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -526,10 +526,10 @@ static unsigned int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int fl if (eve->poly_nr == nr) { if (eve->f != SF_VERT_ZERO_LEN) { verts++; - eve->f = SF_VERT_NEW; /* flag for connectedges later on */ + eve->f = SF_VERT_NEW; /* Flag for connect edges later on. */ sc->vert = eve; sc->edge_first = sc->edge_last = NULL; - /* Note, debug print only will work for curve polyfill, union is in use for mesh */ + /* Note, debug print only will work for curve poly-fill, union is in use for mesh. */ /* if (even->tmp.v == NULL) eve->tmp.u = verts; */ sc++; } @@ -609,7 +609,7 @@ static unsigned int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int fl sc = scdata; for (a = 0; a < verts; a++) { /* printf("VERTEX %d index %d\n", a, sc->vert->tmp.u); */ - /* set connectflags */ + /* Set connect-flags. */ for (ed1 = sc->edge_first; ed1; ed1 = eed_next) { eed_next = ed1->next; if (ed1->v1->edge_tot == 1 || ed1->v2->edge_tot == 1) { diff --git a/source/blender/blenlib/intern/scanfill_utils.c b/source/blender/blenlib/intern/scanfill_utils.c index b49239547c2..ec0f8659395 100644 --- a/source/blender/blenlib/intern/scanfill_utils.c +++ b/source/blender/blenlib/intern/scanfill_utils.c @@ -244,7 +244,7 @@ static bool scanfill_preprocess_self_isect(ScanFillContext *sf_ctx, continue; } - /* maintain coorect terminating edge */ + /* Maintain correct terminating edge. */ if (pi->edge_last == eed) { pi->edge_last = NULL; } diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index d1e133318ba..bb00755e901 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -30,7 +30,7 @@ #include #if defined(__NetBSD__) || defined(__DragonFly__) || defined(__HAIKU__) -/* Other modern unix os's should probably use this also */ +/* Other modern unix OS's should probably use this also. */ # include # define USE_STATFS_STATVFS #endif @@ -113,7 +113,7 @@ double BLI_dir_free_space(const char *dir) char tmp[4]; tmp[0] = '\\'; - tmp[1] = 0; /* Just a failsafe */ + tmp[1] = 0; /* Just a fail-safe. */ if (ELEM(dir[0] == '/', '\\')) { tmp[0] = '\\'; tmp[1] = 0; diff --git a/source/blender/blenlib/intern/string_search.cc b/source/blender/blenlib/intern/string_search.cc index d64587b85b4..a5983967542 100644 --- a/source/blender/blenlib/intern/string_search.cc +++ b/source/blender/blenlib/intern/string_search.cc @@ -446,7 +446,7 @@ int BLI_string_search_query(StringSearch *search, const char *query, void ***r_d for (const int score : result_indices_by_score.keys()) { found_scores.append(score); } - std::sort(found_scores.begin(), found_scores.end(), std::greater()); + std::sort(found_scores.begin(), found_scores.end(), std::greater<>()); /* Add results to output vector in correct order. First come the results with the best match * score. Results with the same score are in the order they have been added to the search. */ diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index a637a5f24e6..7aa5930b4ad 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -225,8 +225,7 @@ int BLI_utf8_invalid_strip(char *str, size_t length) return tot; } -/* compatible with BLI_strncpy, but esnure no partial utf8 chars */ - +/** Compatible with #BLI_strncpy, but ensure no partial UTF8 chars. */ #define BLI_STR_UTF8_CPY(dst, src, maxncpy) \ { \ size_t utf8_size; \ diff --git a/source/blender/blenlib/intern/system.c b/source/blender/blenlib/intern/system.c index 8e3d489fbb3..e32f310549c 100644 --- a/source/blender/blenlib/intern/system.c +++ b/source/blender/blenlib/intern/system.c @@ -71,7 +71,7 @@ int BLI_cpu_support_sse2(void) #endif } -/* Windows stackwalk lives in system_win32.c */ +/* Windows stack-walk lives in system_win32.c */ #if !defined(_MSC_VER) /** * Write a backtrace into a file for systems which support it. diff --git a/source/blender/blenlib/intern/task_graph.cc b/source/blender/blenlib/intern/task_graph.cc index 4f112c5b2c8..5b804cd1df8 100644 --- a/source/blender/blenlib/intern/task_graph.cc +++ b/source/blender/blenlib/intern/task_graph.cc @@ -70,7 +70,7 @@ struct TaskNode { #ifdef WITH_TBB tbb_node(task_graph->tbb_graph, tbb::flow::unlimited, - std::bind(&TaskNode::run, this, std::placeholders::_1)), + [&](const tbb::flow::continue_msg input) { run(input); }), #endif run_func(run_func), task_data(task_data), diff --git a/source/blender/blenlib/intern/threads.cc b/source/blender/blenlib/intern/threads.cc index b42c50803e0..35097013439 100644 --- a/source/blender/blenlib/intern/threads.cc +++ b/source/blender/blenlib/intern/threads.cc @@ -468,7 +468,7 @@ void BLI_spin_lock(SpinLock *spin) #elif defined(_MSC_VER) while (InterlockedExchangeAcquire(spin, 1)) { while (*spin) { - /* Spin-lock hint for processors with hyperthreading. */ + /* Spin-lock hint for processors with hyper-threading. */ YieldProcessor(); } } diff --git a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc index 487afc095f9..d00e8bf55fd 100644 --- a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc +++ b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc @@ -1661,10 +1661,10 @@ void rand_delaunay_test(int test_kind, } } for (int i = 0; i < size; ++i) { - /* Horizontal edges: connect p(i,0) to p(i,size-1). */ + /* Horizontal edges: connect `p(i,0)` to `p(i,size-1)`. */ in.edge[i].first = i * size; in.edge[i].second = i * size + size - 1; - /* Vertical edges: conntect p(0,i) to p(size-1,i). */ + /* Vertical edges: connect `p(0,i)` to `p(size-1,i)`. */ in.edge[size + i].first = i; in.edge[size + i].second = (size - 1) * size + i; } @@ -1695,7 +1695,7 @@ void rand_delaunay_test(int test_kind, in.vert[ib][1] = T(sin(angle2)); in.vert[ic][0] = T((param * cos(angle3))); in.vert[ic][1] = T((param * sin(angle3))); - /* Put the coordinates in ccw order. */ + /* Put the coordinates in CCW order. */ in.face[i].append(ia); int orient = orient2d(in.vert[ia], in.vert[ib], in.vert[ic]); if (orient >= 0) { diff --git a/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc b/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc index 3c9d12c7178..6ef94bd62e3 100644 --- a/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc +++ b/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc @@ -291,7 +291,7 @@ static void test_polyfill_template_main(const char *id, (void)0 /* -------------------------------------------------------------------- */ -/* visualisation functions (not needed for testing) */ +/* visualization functions (not needed for testing) */ #ifdef USE_OBJ_PREVIEW static void polyfill_to_obj(const char *id, diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index 7dbe73cbd6a..c7f02de21ea 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -84,8 +84,8 @@ struct BlendFileReadParams { uint skip_flags : 3; /* eBLOReadSkip */ uint is_startup : 1; - /** Whether we are reading the memfile for an undo (< 0) or a redo (> 0). */ - int undo_direction : 2; + /** Whether we are reading the memfile for an undo or a redo. */ + int undo_direction; /* eUndoStepDir */ }; /* skip reading some data-block types (may want to skip screen data too). */ @@ -134,8 +134,8 @@ struct LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int *r_tot_names); struct LinkNode *BLO_blendhandle_get_datablock_info(BlendHandle *bh, int ofblocktype, - int *tot_info_items); -struct LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *tot_prev); + int *r_tot_info_items); +struct LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *r_tot_prev); struct LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh); void BLO_blendhandle_close(BlendHandle *bh); diff --git a/source/blender/blenloader/intern/blend_validate.c b/source/blender/blenloader/intern/blend_validate.c index ea3ecc21ecf..7261db5d3a6 100644 --- a/source/blender/blenloader/intern/blend_validate.c +++ b/source/blender/blenloader/intern/blend_validate.c @@ -23,7 +23,7 @@ * \note Does not *fix* anything, only reports found errors. */ -#include /* for strrchr strncmp strstr */ +#include /* for #strrchr #strncmp #strstr */ #include "BLI_utildefines.h" diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 0b0594c7f4a..19033ba9bf1 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -177,7 +177,9 @@ LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, * \return A BLI_linklist of BLODataBlockInfo *. The links and #BLODataBlockInfo.asset_data should * be freed with MEM_freeN. */ -LinkNode *BLO_blendhandle_get_datablock_info(BlendHandle *bh, int ofblocktype, int *tot_info_items) +LinkNode *BLO_blendhandle_get_datablock_info(BlendHandle *bh, + int ofblocktype, + int *r_tot_info_items) { FileData *fd = (FileData *)bh; LinkNode *infos = NULL; @@ -208,7 +210,7 @@ LinkNode *BLO_blendhandle_get_datablock_info(BlendHandle *bh, int ofblocktype, i } } - *tot_info_items = tot; + *r_tot_info_items = tot; return infos; } @@ -218,10 +220,10 @@ LinkNode *BLO_blendhandle_get_datablock_info(BlendHandle *bh, int ofblocktype, i * * \param bh: The blendhandle to access. * \param ofblocktype: The type of names to get. - * \param tot_prev: The length of the returned list. + * \param r_tot_prev: The length of the returned list. * \return A BLI_linklist of PreviewImage. The PreviewImage links should be freed with malloc. */ -LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *tot_prev) +LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *r_tot_prev) { FileData *fd = (FileData *)bh; LinkNode *previews = NULL; @@ -243,6 +245,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to case ID_OB: /* fall through */ case ID_GR: /* fall through */ case ID_SCE: /* fall through */ + case ID_AC: /* fall through */ new_prv = MEM_callocN(sizeof(PreviewImage), "newpreview"); BLI_linklist_prepend(&previews, new_prv); tot++; @@ -301,7 +304,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to } } - *tot_prev = tot; + *r_tot_prev = tot; return previews; } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 2192e9a378f..89d4fe0b222 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -94,6 +94,7 @@ #include "BKE_report.h" #include "BKE_scene.h" #include "BKE_screen.h" +#include "BKE_undo_system.h" #include "BKE_workspace.h" #include "DRW_engine.h" @@ -1294,12 +1295,12 @@ static ssize_t fd_read_from_memfile(FileData *filedata, seek += readsize; if (r_is_memchunck_identical != NULL) { /* `is_identical` of current chunk represents whether it changed compared to previous undo - * step. this is fine in redo case (filedata->undo_direction > 0), but not in undo case, - * where we need an extra flag defined when saving the next (future) step after the one we - * want to restore, as we are supposed to 'come from' that future undo step, and not the - * one before current one. */ - *r_is_memchunck_identical &= filedata->undo_direction > 0 ? chunk->is_identical : - chunk->is_identical_future; + * step. this is fine in redo case, but not in undo case, where we need an extra flag + * defined when saving the next (future) step after the one we want to restore, as we are + * supposed to 'come from' that future undo step, and not the one before current one. */ + *r_is_memchunck_identical &= filedata->undo_direction == STEP_REDO ? + chunk->is_identical : + chunk->is_identical_future; } } while (totread < size); @@ -1782,25 +1783,25 @@ BlendThumbnail *BLO_thumbnail_from_file(const char *filepath) /** \name Old/New Pointer Map * \{ */ -/* only direct databocks */ +/* Only direct data-blocks. */ static void *newdataadr(FileData *fd, const void *adr) { return oldnewmap_lookup_and_inc(fd->datamap, adr, true); } -/* only direct databocks */ +/* Only direct data-blocks. */ static void *newdataadr_no_us(FileData *fd, const void *adr) { return oldnewmap_lookup_and_inc(fd->datamap, adr, false); } -/* direct datablocks with global linking */ +/* Direct datablocks with global linking. */ void *blo_read_get_new_globaldata_address(FileData *fd, const void *adr) { return oldnewmap_lookup_and_inc(fd->globmap, adr, true); } -/* used to restore packed data after undo */ +/* Used to restore packed data after undo. */ static void *newpackedadr(FileData *fd, const void *adr) { if (fd->packedmap && adr) { @@ -2400,11 +2401,12 @@ static int direct_link_id_restore_recalc(const FileData *fd, /* Tags that were set between the target state and the current state, * that we need to perform again. */ - if (fd->undo_direction < 0) { + if (fd->undo_direction == STEP_UNDO) { /* Undo: tags from target to the current state. */ recalc |= id_current->recalc_up_to_undo_push; } else { + BLI_assert(fd->undo_direction == STEP_REDO); /* Redo: tags from current to the target state. */ recalc |= id_target->recalc_up_to_undo_push; } diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index 86f05eda7b7..e007d42b283 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -91,7 +91,7 @@ typedef struct FileData { struct MemFile *memfile; /** Whether we are undoing (< 0) or redoing (> 0), used to choose which 'unchanged' flag to use * to detect unchanged data from memfile. */ - short undo_direction; + int undo_direction; /* eUndoStepDir */ /** Variables needed for reading from file. */ gzFile gzfiledes; diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index 767f24cf175..3b9ad64770d 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -339,7 +339,7 @@ static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNo NodeImageMultiFile *nimf = node->storage; bNodeSocket *sock; - /* CMP_NODE_OUTPUT_MULTI_FILE has been redeclared as CMP_NODE_OUTPUT_FILE */ + /* CMP_NODE_OUTPUT_MULTI_FILE has been re-declared as CMP_NODE_OUTPUT_FILE */ node->type = CMP_NODE_OUTPUT_FILE; /* initialize the node-wide image format from render data, if available */ diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index df9268f0da1..e383d46858f 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -1190,7 +1190,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } - /* Remove old deprecated region from filebrowsers */ + /* Remove old deprecated region from file-browsers. */ else if (sl->spacetype == SPACE_FILE) { LISTBASE_FOREACH (ARegion *, region, regionbase) { if (region->regiontype == RGN_TYPE_CHANNELS) { diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 7dc2c9e86ee..0e90d9b6045 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -1390,7 +1390,7 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports)) } } - /* Cleanup deprecated flag from particlesettings data-blocks. */ + /* Cleanup deprecated flag from particle-settings data-blocks. */ for (ParticleSettings *part = bmain->particles.first; part; part = part->id.next) { part->draw &= ~PART_DRAW_EMITTER; } @@ -2110,7 +2110,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } for (Tex *tex = bmain->textures.first; tex; tex = tex->id.next) { - /* Removed envmap, pointdensity, voxeldata, ocean textures. */ + /* Removed environment map, point-density, voxel-data, ocean textures. */ if (ELEM(tex->type, 10, 14, 15, 16)) { tex->type = 0; } @@ -4303,7 +4303,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - /* Elatic deform brush */ + /* Elastic deform brush */ for (Brush *br = bmain->brushes.first; br; br = br->id.next) { if (br->ob_mode & OB_MODE_SCULPT && br->elastic_deform_volume_preservation == 0.0f) { br->elastic_deform_volume_preservation = 0.5f; diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index 10224ef3bc5..4e952431243 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -659,7 +659,7 @@ static void do_versions_291_fcurve_handles_limit(FCurve *fcu) { uint i = 1; for (BezTriple *bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) { - /* Only adjust bezier keyframes. */ + /* Only adjust bezier key-frames. */ if (bezt->ipo != BEZT_IPO_BEZ) { continue; } @@ -1098,10 +1098,10 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } if (!MAIN_VERSION_ATLEAST(bmain, 291, 5)) { - /* Fix fcurves to allow for new bezier handles behaviour (T75881 and D8752). */ + /* Fix fcurves to allow for new bezier handles behavior (T75881 and D8752). */ for (bAction *act = bmain->actions.first; act; act = act->id.next) { for (FCurve *fcu = act->curves.first; fcu; fcu = fcu->next) { - /* Only need to fix Bezier curves with at least 2 keyframes. */ + /* Only need to fix Bezier curves with at least 2 key-frames. */ if (fcu->totvert < 2 || fcu->bezt == NULL) { continue; } diff --git a/source/blender/blenloader/intern/versioning_cycles.c b/source/blender/blenloader/intern/versioning_cycles.c index 631abe10ddc..816b90491aa 100644 --- a/source/blender/blenloader/intern/versioning_cycles.c +++ b/source/blender/blenloader/intern/versioning_cycles.c @@ -1420,7 +1420,7 @@ void do_versions_after_linking_cycles(Main *bmain) } if (!MAIN_VERSION_ATLEAST(bmain, 280, 64)) { - /* Unfiy Cycles and Eevee settings. */ + /* Unify Cycles and Eevee settings. */ Scene *scene = bmain->scenes.first; const char *engine = (scene) ? scene->r.engine : "CYCLES"; diff --git a/source/blender/blentranslation/intern/blt_lang.c b/source/blender/blentranslation/intern/blt_lang.c index 6de1d85a6a8..97a1a83792a 100644 --- a/source/blender/blentranslation/intern/blt_lang.c +++ b/source/blender/blentranslation/intern/blt_lang.c @@ -201,7 +201,7 @@ void BLT_lang_init(void) const char *const messagepath = BKE_appdir_folder_id(BLENDER_DATAFILES, "locale"); #endif - /* Make sure LANG is correct and wouldn't cause #std::rumtime_error. */ + /* Make sure LANG is correct and wouldn't cause #std::runtime_error. */ #ifndef _WIN32 /* TODO(sergey): This code only ensures LANG is set properly, so later when * Cycles will try to use file system API from boost there will be no runtime diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index b913bdd12e4..cf907862120 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -2158,7 +2158,7 @@ BMFace *bmesh_kernel_join_face_kill_edge(BMesh *bm, BMFace *f1, BMFace *f2, BMEd l_f1->next->prev = l_f2->prev; l_f2->prev->next = l_f1->next; - /* if l_f1 was baseloop, make l_f1->next the base. */ + /* If `l_f1` was base-loop, make `l_f1->next` the base. */ if (BM_FACE_FIRST_LOOP(f1) == l_f1) { BM_FACE_FIRST_LOOP(f1) = l_f1->next; } diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.c b/source/blender/bmesh/intern/bmesh_edgeloop.c index ec97ea51047..51a6ada6c42 100644 --- a/source/blender/bmesh/intern/bmesh_edgeloop.c +++ b/source/blender/bmesh/intern/bmesh_edgeloop.c @@ -450,7 +450,7 @@ void BM_mesh_edgeloops_calc_order(BMesh *UNUSED(bm), ListBase *eloops, const boo } mul_v3_fl(cent, 1.0f / (float)tot); - /* find far outest loop */ + /* Find the furthest out loop. */ { BMEdgeLoopStore *el_store_best = NULL; float len_best_sq = -1.0f; diff --git a/source/blender/bmesh/intern/bmesh_error.h b/source/blender/bmesh/intern/bmesh_error.h index 1837ad8dd71..fdec043ec48 100644 --- a/source/blender/bmesh/intern/bmesh_error.h +++ b/source/blender/bmesh/intern/bmesh_error.h @@ -33,7 +33,7 @@ void BMO_error_raise(BMesh *bm, BMOperator *owner, int errcode, const char *msg) int BMO_error_get(BMesh *bm, const char **msg, BMOperator **op); bool BMO_error_occurred(BMesh *bm); -/* same as geterror, only pops the error off the stack as well */ +/* Same as #BMO_error_get, only pops the error off the stack as well. */ int BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op); void BMO_error_clear(BMesh *bm); diff --git a/source/blender/bmesh/intern/bmesh_iterators.c b/source/blender/bmesh/intern/bmesh_iterators.c index 44e3ef6e6ee..c81d4f9b67c 100644 --- a/source/blender/bmesh/intern/bmesh_iterators.c +++ b/source/blender/bmesh/intern/bmesh_iterators.c @@ -177,7 +177,7 @@ void *BM_iter_as_arrayN(BMesh *bm, BLI_assert(stack_array_size == 0 || (stack_array_size && stack_array)); - /* we can't rely on coun't being set */ + /* We can't rely on #BMIter.count being set. */ switch (itype) { case BM_VERTS_OF_MESH: iter.count = bm->totvert; diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index d8cdff1a4cc..a259d97379d 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -54,7 +54,8 @@ #include "DNA_modifier_types.h" -/* The formatting of these bmesh operators is parsed by +/** + * The formatting of these bmesh operators is parsed by * 'doc/python_api/rst_from_bmesh_opdefines.py' * for use in python docs, so reStructuredText may be used * rather than doxygen syntax. @@ -65,8 +66,7 @@ * """ * Region Extend. * - * paragraph1, Extends bleh bleh bleh. - * Bleh Bleh bleh. + * paragraph1, Extends on the title above. * * Another paragraph. * @@ -1268,7 +1268,7 @@ static BMOpDefine bmo_subdivide_edges_def = { {"quad_corner_type", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_subdivide_edges_quad_corner_type}, /* quad corner type */ {"use_grid_fill", BMO_OP_SLOT_BOOL}, /* fill in fully-selected faces with a grid */ {"use_single_edge", BMO_OP_SLOT_BOOL}, /* tessellate the case of one edge selected in a quad or triangle */ - {"use_only_quads", BMO_OP_SLOT_BOOL}, /* only subdivide quads (for loopcut) */ + {"use_only_quads", BMO_OP_SLOT_BOOL}, /* Only subdivide quads (for loop-cut). */ {"use_sphere", BMO_OP_SLOT_BOOL}, /* for making new primitives only */ {"use_smooth_even", BMO_OP_SLOT_BOOL}, /* maintain even offset when smoothing */ {{'\0'}}, diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h index 2f7d91c78c4..2d9e244e54d 100644 --- a/source/blender/bmesh/intern/bmesh_operators.h +++ b/source/blender/bmesh/intern/bmesh_operators.h @@ -24,7 +24,7 @@ /*--------defines/enumerations for specific operators-------*/ -/*quad innervert values*/ +/* Quad `innervert` values. */ enum { SUBD_CORNER_INNERVERT, SUBD_CORNER_PATH, diff --git a/source/blender/bmesh/intern/bmesh_polygon_edgenet.c b/source/blender/bmesh/intern/bmesh_polygon_edgenet.c index 1d000b3b232..dcf9717465c 100644 --- a/source/blender/bmesh/intern/bmesh_polygon_edgenet.c +++ b/source/blender/bmesh/intern/bmesh_polygon_edgenet.c @@ -1566,7 +1566,7 @@ bool BM_face_split_edgenet_connect_islands(BMesh *bm, for (uint g_index = 1; g_index < group_arr_len; g_index++) { struct EdgeGroupIsland *g = group_arr[g_index]; - /* the range of verts this group uses in 'verts_arr' (not uncluding the last index) */ + /* The range of verts this group uses in 'verts_arr' (not including the last index). */ vert_range[0] = vert_range[1]; vert_range[1] += g->vert_len; diff --git a/source/blender/bmesh/intern/bmesh_structure.c b/source/blender/bmesh/intern/bmesh_structure.c index ef4a9c9de1c..cd230e76aca 100644 --- a/source/blender/bmesh/intern/bmesh_structure.c +++ b/source/blender/bmesh/intern/bmesh_structure.c @@ -537,7 +537,7 @@ int bmesh_radial_length(const BMLoop *l) do { if (UNLIKELY(!l_iter)) { - /* radial cycle is broken (not a circulat loop) */ + /* Radial cycle is broken (not a circular loop). */ BMESH_ASSERT(0); return 0; } diff --git a/source/blender/bmesh/intern/bmesh_walkers.h b/source/blender/bmesh/intern/bmesh_walkers.h index a973e12a4c7..22ee8809a19 100644 --- a/source/blender/bmesh/intern/bmesh_walkers.h +++ b/source/blender/bmesh/intern/bmesh_walkers.h @@ -122,7 +122,7 @@ enum { BMW_CONNECTED_VERTEX, /* end of array index enum vals */ - /* do not intitialze function pointers and struct size in BMW_init */ + /* Do not initialize function pointers and struct size in #BMW_init. */ BMW_CUSTOM, BMW_MAXWALKERS, }; diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index 8c2e820df63..da2603ad8cd 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -55,7 +55,7 @@ static bool UNUSED_FUNCTION(check_hole_in_region)(BMesh *bm, BMFace *f) BMLoop *l2, *l3; BMFace *f2; - /* checks if there are any unmarked boundary edges in the face regio */ + /* Checks if there are any unmarked boundary edges in the face region. */ BMW_init(®walker, bm, @@ -159,7 +159,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op) } BLI_array_clear(faces); - faces = NULL; /* forces different allocatio */ + faces = NULL; /* Forces different allocation. */ BMW_init(®walker, bm, diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c index 6e968d58631..c128872be07 100644 --- a/source/blender/bmesh/operators/bmo_dupe.c +++ b/source/blender/bmesh/operators/bmo_dupe.c @@ -109,7 +109,7 @@ static BMEdge *bmo_edge_copy(BMOperator *op, BMO_slot_map_elem_insert(op, slot_edgemap_out, e_src, e_dst); BMO_slot_map_elem_insert(op, slot_edgemap_out, e_dst, e_src); - /* add to new/old edge map if necassary */ + /* Add to new/old edge map if necessary. */ if (rlen < 2) { /* not sure what non-manifold cases of greater than three * radial should do. */ diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c index 009c4f1f2c5..3869a0678e2 100644 --- a/source/blender/bmesh/operators/bmo_inset.c +++ b/source/blender/bmesh/operators/bmo_inset.c @@ -967,7 +967,7 @@ void bmo_inset_region_exec(BMesh *bm, BMOperator *op) is_mid = false; } - /* distable gives odd results at times, see T39288. */ + /* Disable since this gives odd results at times, see T39288. */ #if 0 else if (compare_v3v3(f_a->no, f_b->no, 0.001f) == false) { /* epsilon increased to fix T32329. */ diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c index 1da4be57568..086114f64e9 100644 --- a/source/blender/bmesh/operators/bmo_join_triangles.c +++ b/source/blender/bmesh/operators/bmo_join_triangles.c @@ -66,7 +66,7 @@ static float quad_calc_error(const float v1[3], error += diff; } - /* Colinearity */ + /* Co-linearity */ { float edge_vecs[4][3]; float diff; diff --git a/source/blender/bmesh/operators/bmo_normals.c b/source/blender/bmesh/operators/bmo_normals.c index 8e7bfbb649d..3311ffefb0d 100644 --- a/source/blender/bmesh/operators/bmo_normals.c +++ b/source/blender/bmesh/operators/bmo_normals.c @@ -29,7 +29,7 @@ #include "intern/bmesh_operators_private.h" /* own include */ -/********* righthand faces implementation ****** */ +/********* Right-hand faces implementation ****** */ #define FACE_FLAG (1 << 0) #define FACE_FLIP (1 << 1) diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index d661859c8e3..8e088683d62 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -962,7 +962,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op) BM_mesh_calc_uvs_sphere(bm, FACE_MARK, cd_loop_uv_offset); } - /* and now do imat */ + /* Now apply the inverse matrix. */ BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) { if (BMO_vert_flag_test(bm, eve, VERT_MARK)) { mul_m4_v3(mat, eve->co); @@ -1585,9 +1585,9 @@ void BM_mesh_calc_uvs_cone(BMesh *bm, float inv_mat[4][4]; int loop_index; - /* Transform the upvector like we did the cone itself, without location. */ + /* Transform the up-vector like we did the cone itself, without location. */ mul_mat3_m4_v3(mat, local_up); - /* Remove global scaling... */ + /* Remove global scaling. */ normalize_v3(local_up); invert_m4_m4(inv_mat, mat); diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c index 02f17ea5d4a..361b10520da 100644 --- a/source/blender/bmesh/operators/bmo_removedoubles.c +++ b/source/blender/bmesh/operators/bmo_removedoubles.c @@ -387,7 +387,7 @@ void bmo_average_vert_facedata_exec(BMesh *bm, BMOperator *op) BMOIter siter; BMIter iter; BMVert *v; - BMLoop *l /* , *firstl = NULL */; + BMLoop *l; CDBlockBytes min, max; int i; diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index 8b2f9478aab..be996e6ffe4 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -51,13 +51,13 @@ typedef struct SubDParams { BMOpSlot *slot_custom_patterns; /* BMO_slot_get(params->op->slots_in, "custom_patterns"); */ float fractal_ofs[3]; - /* rumtime storage for shape key */ + /* Runtime storage for shape key. */ struct { int cd_vert_shape_offset; int cd_vert_shape_offset_tmp; int totlayer; - /* shapekey holding displaced vertex coordinates for current geometry */ + /* Shape-key holding displaced vertex coordinates for current geometry. */ int tmpkey; } shape_info; @@ -1094,7 +1094,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op) } } - /* obvously don't test for other patterns matching */ + /* Obviously don't test for other patterns matching. */ continue; } diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 36fe6ee655c..25459414cd7 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -3433,7 +3433,7 @@ static EdgeHalf *next_edgehalf_bev(BevelParams *bp, } normalize_v3(dir_new_edge); - /* Use this edge if it is the most parallel to the orignial so far. */ + /* Use this edge if it is the most parallel to the original so far. */ float new_dot = dot_v3v3(dir_new_edge, dir_start_edge); if (new_dot > best_dot) { second_best_dot = best_dot; /* For remembering if the choice was too close. */ @@ -4674,7 +4674,7 @@ static VMesh *pipe_adj_vmesh(BevelParams *bp, BevVert *bv, BoundVert *vpipe) f = (float)k / (float)ns; /* Ring runs along the pipe, so segment is used here. */ } - /* Place the vertex by interpolatin between the two profile points using the factor. */ + /* Place the vertex by interpolating between the two profile points using the factor. */ interp_v3_v3v3(mesh_vert(vm, i, j, k)->co, profile_point_pipe1, profile_point_pipe2, f); } else { @@ -6385,7 +6385,7 @@ static bool bev_rebuild_polygon(BMesh *bm, BevelParams *bp, BMFace *f) /* Edges in face are non-contiguous in our ordering around bv. * Which way should we go when going from eprev to e? */ if (count_ccw_edges_between(eprev, e) < count_ccw_edges_between(e, eprev)) { - /* Go counterclockewise from eprev to e. */ + /* Go counter-clockwise from eprev to e. */ go_ccw = true; } else { @@ -6419,7 +6419,7 @@ static bool bev_rebuild_polygon(BMesh *bm, BevelParams *bp, BMFace *f) BLI_array_append(ee, bme); } while (v != vend) { - /* Check for special case: multisegment 3rd face opposite a beveled edge with no vmesh. */ + /* Check for special case: multi-segment 3rd face opposite a beveled edge with no vmesh. */ bool corner3special = (vm->mesh_kind == M_NONE && v->ebev != e && v->ebev != eprev); if (go_ccw) { int i = v->index; @@ -7566,7 +7566,7 @@ void BM_mesh_bevel(BMesh *bm, } } - /* Perhaps clamp offset to avoid geometry colliisions. */ + /* Perhaps clamp offset to avoid geometry collisions. */ if (limit_offset) { bevel_limit_offset(&bp, bm); diff --git a/source/blender/bmesh/tools/bmesh_decimate_collapse.c b/source/blender/bmesh/tools/bmesh_decimate_collapse.c index 6ae889fcee5..92ca8e38737 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_collapse.c +++ b/source/blender/bmesh/tools/bmesh_decimate_collapse.c @@ -1318,9 +1318,9 @@ void BM_mesh_decimate_collapse(BMesh *bm, UNUSED_VARS(do_triangulate); #endif - /* alloc vars */ + /* Allocate variables. */ vquadrics = MEM_callocN(sizeof(Quadric) * bm->totvert, __func__); - /* since some edges may be degenerate, we might be over allocing a little here */ + /* Since some edges may be degenerate, we might be over allocating a little here. */ eheap = BLI_heap_new_ex(bm->totedge); eheap_table = MEM_mallocN(sizeof(HeapNode *) * bm->totedge, __func__); tot_edge_orig = bm->totedge; diff --git a/source/blender/bmesh/tools/bmesh_decimate_dissolve.c b/source/blender/bmesh/tools/bmesh_decimate_dissolve.c index 94a578fe1d7..2254b46f860 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_dissolve.c +++ b/source/blender/bmesh/tools/bmesh_decimate_dissolve.c @@ -188,7 +188,7 @@ static void mul_v2_m3v3_center(float r[2], static bool bm_loop_collapse_is_degenerate(BMLoop *l_ear) { - /* calculate relative to the centeral vertex for higher precision */ + /* Calculate relative to the central vertex for higher precision. */ const float *center = l_ear->v->co; float tri_2d[3][2]; diff --git a/source/blender/bmesh/tools/bmesh_edgenet.c b/source/blender/bmesh/tools/bmesh_edgenet.c index 1ab37ec0684..51af4d24e52 100644 --- a/source/blender/bmesh/tools/bmesh_edgenet.c +++ b/source/blender/bmesh/tools/bmesh_edgenet.c @@ -295,7 +295,7 @@ static LinkNode *bm_edgenet_path_calc(BMEdge *e, vn_1->flag = vn_2->flag = (f_index == -1) ? VNINFO_FLAG_IS_MIXFACE : 0; - /* prime the searchlist */ + /* Prime the search-list. */ BLI_linklist_prepend_pool(&v_ls_prev, e->v1, path_pool); BLI_linklist_prepend_pool(&v_ls_prev, e->v2, path_pool); diff --git a/source/blender/bmesh/tools/bmesh_intersect.c b/source/blender/bmesh/tools/bmesh_intersect.c index db05abe0e48..81b016e9601 100644 --- a/source/blender/bmesh/tools/bmesh_intersect.c +++ b/source/blender/bmesh/tools/bmesh_intersect.c @@ -1036,7 +1036,7 @@ bool BM_mesh_intersect(BMesh *bm, #endif if (boolean_mode != BMESH_ISECT_BOOLEAN_NONE) { - /* keep original geometrty for raycast callbacks */ + /* Keep original geometry for ray-cast callbacks. */ float **cos; int i, j; @@ -1546,7 +1546,7 @@ bool BM_mesh_intersect(BMesh *bm, bool do_remove, do_flip; { - /* for now assyme this is an OK face to test with (not degenerate!) */ + /* For now assume this is an OK face to test with (not degenerate!) */ BMFace *f = ftable[groups_array[fg]]; float co[3]; int hits; diff --git a/source/blender/compositor/COM_compositor.h b/source/blender/compositor/COM_compositor.h index b308241ff34..6c8d372f587 100644 --- a/source/blender/compositor/COM_compositor.h +++ b/source/blender/compositor/COM_compositor.h @@ -268,8 +268,8 @@ extern "C" { * When an ExecutionGroup schedules a Chunk the schedule method of the WorkScheduler * The Workscheduler determines if the chunk can be run on an OpenCLDevice * (and that there are available OpenCLDevice). - * If this is the case the chunk will be added to the worklist for OpenCLDevice's - * otherwise the chunk will be added to the worklist of CPUDevices. + * If this is the case the chunk will be added to the work-list for OpenCLDevice's + * otherwise the chunk will be added to the work-list of CPUDevices. * * A thread will read the work-list and sends a workpackage to its device. * diff --git a/source/blender/compositor/nodes/COM_KeyingNode.cpp b/source/blender/compositor/nodes/COM_KeyingNode.cpp index 4e81a412c29..13bdabcdfd8 100644 --- a/source/blender/compositor/nodes/COM_KeyingNode.cpp +++ b/source/blender/compositor/nodes/COM_KeyingNode.cpp @@ -239,7 +239,7 @@ void KeyingNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(inputScreen, keyingOperation->getInputSocket(1)); if (keying_data->blur_pre) { - /* chroma preblur operation for input of keying operation */ + /* Chroma pre-blur operation for input of keying operation. */ NodeOperationOutput *preBluredImage = setupPreBlur( converter, inputImage, keying_data->blur_pre); converter.addLink(preBluredImage, keyingOperation->getInputSocket(0)); diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp index 29e18047578..52de0198a00 100644 --- a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp @@ -61,11 +61,10 @@ void ChromaMatteOperation::executePixelSampled(float output[4], this->m_inputImageProgram->readSampled(inImage, x, y, sampler); /* Store matte(alpha) value in [0] to go with - * COM_SetAlphaMultiplyOperation and the Value output. - */ + * #COM_SetAlphaMultiplyOperation and the Value output. */ - /* Algorithm from book "Video Demistified," does not include the spill reduction part */ - /* find theta, the angle that the color space should be rotated based on key */ + /* Algorithm from book "Video Demystified", does not include the spill reduction part. */ + /* Find theta, the angle that the color space should be rotated based on key. */ /* rescale to -1.0..1.0 */ // inImage[0] = (inImage[0] * 2.0f) - 1.0f; // UNUSED diff --git a/source/blender/compositor/operations/COM_CryptomatteOperation.cpp b/source/blender/compositor/operations/COM_CryptomatteOperation.cpp index 07466cdeccd..ccd291697cf 100644 --- a/source/blender/compositor/operations/COM_CryptomatteOperation.cpp +++ b/source/blender/compositor/operations/COM_CryptomatteOperation.cpp @@ -49,7 +49,7 @@ void CryptomatteOperation::executePixel(float output[4], int x, int y, void *dat for (size_t i = 0; i < inputs.size(); i++) { inputs[i]->read(input, x, y, data); if (i == 0) { - /* Write the frontmost object as false color for picking. */ + /* Write the front-most object as false color for picking. */ output[0] = input[0]; uint32_t m3hash; ::memcpy(&m3hash, &input[0], sizeof(uint32_t)); diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp index fbbd373ba09..b548a684ba5 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp @@ -1256,7 +1256,7 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float * * Each version has slightly different criteria for detecting an edge pixel. */ - if (this->m_adjecentOnly) { // if "adjacent only" inner edge mode is turned on + if (this->m_adjacentOnly) { // if "adjacent only" inner edge mode is turned on if (this->m_keepInside) { // if "keep inside" buffer edge mode is turned on do_adjacentKeepBorders(t, rw, limask, lomask, lres, res, rsize); } @@ -1313,7 +1313,7 @@ DoubleEdgeMaskOperation::DoubleEdgeMaskOperation() this->addOutputSocket(COM_DT_VALUE); this->m_inputInnerMask = nullptr; this->m_inputOuterMask = nullptr; - this->m_adjecentOnly = false; + this->m_adjacentOnly = false; this->m_keepInside = false; this->setComplex(true); } diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h index e53aa7eb8aa..813f5009815 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h @@ -27,7 +27,7 @@ class DoubleEdgeMaskOperation : public NodeOperation { */ SocketReader *m_inputOuterMask; SocketReader *m_inputInnerMask; - bool m_adjecentOnly; + bool m_adjacentOnly; bool m_keepInside; float *m_cachedInstance; @@ -56,9 +56,9 @@ class DoubleEdgeMaskOperation : public NodeOperation { ReadBufferOperation *readOperation, rcti *output); - void setAdjecentOnly(bool adjecentOnly) + void setAdjecentOnly(bool adjacentOnly) { - this->m_adjecentOnly = adjecentOnly; + this->m_adjacentOnly = adjacentOnly; } void setKeepInside(bool keepInside) { diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp index c47d3b52beb..4d3efec7c85 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp @@ -42,7 +42,8 @@ void *GaussianAlphaXBlurOperation::initializeTileData(rcti * /*rect*/) void GaussianAlphaXBlurOperation::initExecution() { - /* BlurBaseOperation::initExecution(); */ /* until we suppoer size input - comment this */ + /* Until we support size input - comment this. */ + // BlurBaseOperation::initExecution(); initMutex(); diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp index 7a0dff73941..a722a879b8d 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp @@ -42,7 +42,8 @@ void *GaussianAlphaYBlurOperation::initializeTileData(rcti * /*rect*/) void GaussianAlphaYBlurOperation::initExecution() { - /* BlurBaseOperation::initExecution(); */ /* until we suppoer size input - comment this */ + /* Until we support size input - comment this. */ + // BlurBaseOperation::initExecution(); initMutex(); diff --git a/source/blender/compositor/operations/COM_MixOperation.cpp b/source/blender/compositor/operations/COM_MixOperation.cpp index 948e69bf8eb..76a66727a75 100644 --- a/source/blender/compositor/operations/COM_MixOperation.cpp +++ b/source/blender/compositor/operations/COM_MixOperation.cpp @@ -705,7 +705,7 @@ void MixMultiplyOperation::executePixelSampled(float output[4], clampIfNeeded(output); } -/* ******** Mix Ovelray Operation ******** */ +/* ******** Mix Overlay Operation ******** */ MixOverlayOperation::MixOverlayOperation() { diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp index f7b908deaf4..d6894dfc8ad 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp @@ -589,7 +589,7 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd, printf("Found uninitialized speed in vector buffer... fixed.\n"); } - /* min speed? then copy speedbuffer to recalculate speed vectors */ + /* Min speed? then copy speed-buffer to recalculate speed vectors. */ if (nbd->minspeed) { float minspeed = (float)nbd->minspeed; float minspeedsq = minspeed * minspeed; @@ -619,7 +619,7 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd, SWAP(float *, minvecbufrect, vecbufrect); } - /* make vertex buffer with averaged speed and zvalues */ + /* Make vertex buffer with averaged speed and Z-values. */ rectvz = (float *)MEM_callocN(sizeof(float[4]) * (xsize + 1) * (ysize + 1), "vertices"); dvz = rectvz; for (y = 0; y <= ysize; y++) { @@ -728,7 +728,8 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd, antialias_tagbuf(xsize, ysize, rectmove); - /* has to become static, the init-jit calls a random-seed, screwing up texture noise node */ + /* Has to become static, the jitter initialization calls a random-seed, + * screwing up texture noise node. */ if (firsttime) { firsttime = 0; BLI_jitter_init(jit, 256); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index c3304cd80ff..d8dc66883a0 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -178,7 +178,7 @@ IDNode *DepsgraphNodeBuilder::add_id_node(ID *id) if (id_node->components.is_empty() && deg_copy_on_write_is_needed(id_type)) { ComponentNode *comp_cow = id_node->add_component(NodeType::COPY_ON_WRITE); OperationNode *op_cow = comp_cow->add_operation( - function_bind(deg_evaluate_copy_on_write, _1, id_node), + [id_node](::Depsgraph *depsgraph) { deg_evaluate_copy_on_write(depsgraph, id_node); }, OperationCode::COPY_ON_WRITE, "", -1); @@ -696,7 +696,9 @@ void DepsgraphNodeBuilder::build_object(int base_index, add_operation_node(&object->id, NodeType::SYNCHRONIZATION, OperationCode::SYNCHRONIZE_TO_ORIGINAL, - function_bind(BKE_object_sync_to_original, _1, object_cow)); + [object_cow](::Depsgraph *depsgraph) { + BKE_object_sync_to_original(depsgraph, object_cow); + }); } void DepsgraphNodeBuilder::build_object_from_layer(int base_index, @@ -725,16 +727,15 @@ void DepsgraphNodeBuilder::build_object_flags(int base_index, Object *object_cow = get_cow_datablock(object); const bool is_from_set = (linked_state == DEG_ID_LINKED_VIA_SET); /* TODO(sergey): Is this really best component to be used? */ - add_operation_node(&object->id, - NodeType::OBJECT_FROM_LAYER, - OperationCode::OBJECT_BASE_FLAGS, - function_bind(BKE_object_eval_eval_base_flags, - _1, - scene_cow, - view_layer_index_, - object_cow, - base_index, - is_from_set)); + add_operation_node( + &object->id, + NodeType::OBJECT_FROM_LAYER, + OperationCode::OBJECT_BASE_FLAGS, + [view_layer_index = view_layer_index_, scene_cow, object_cow, base_index, is_from_set]( + ::Depsgraph *depsgraph) { + BKE_object_eval_eval_base_flags( + depsgraph, scene_cow, view_layer_index, object_cow, base_index, is_from_set); + }); } void DepsgraphNodeBuilder::build_object_proxy_from(Object *object, bool is_object_visible) @@ -853,34 +854,38 @@ void DepsgraphNodeBuilder::build_object_transform(Object *object) op_node = add_operation_node(&object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_INIT); op_node->set_as_entry(); /* Local transforms (from transform channels - loc/rot/scale + deltas). */ - add_operation_node(&object->id, - NodeType::TRANSFORM, - OperationCode::TRANSFORM_LOCAL, - function_bind(BKE_object_eval_local_transform, _1, ob_cow)); + add_operation_node( + &object->id, + NodeType::TRANSFORM, + OperationCode::TRANSFORM_LOCAL, + [ob_cow](::Depsgraph *depsgraph) { BKE_object_eval_local_transform(depsgraph, ob_cow); }); /* Object parent. */ if (object->parent != nullptr) { - add_operation_node(&object->id, - NodeType::TRANSFORM, - OperationCode::TRANSFORM_PARENT, - function_bind(BKE_object_eval_parent, _1, ob_cow)); + add_operation_node( + &object->id, + NodeType::TRANSFORM, + OperationCode::TRANSFORM_PARENT, + [ob_cow](::Depsgraph *depsgraph) { BKE_object_eval_parent(depsgraph, ob_cow); }); } /* Object constraints. */ if (object->constraints.first != nullptr) { build_object_constraints(object); } /* Rest of transformation update. */ - add_operation_node(&object->id, - NodeType::TRANSFORM, - OperationCode::TRANSFORM_EVAL, - function_bind(BKE_object_eval_uber_transform, _1, ob_cow)); + add_operation_node( + &object->id, + NodeType::TRANSFORM, + OperationCode::TRANSFORM_EVAL, + [ob_cow](::Depsgraph *depsgraph) { BKE_object_eval_uber_transform(depsgraph, ob_cow); }); /* Operation to take of rigid body simulation. soft bodies and other friends * in the context of point cache invalidation. */ add_operation_node(&object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_SIMULATION_INIT); /* Object transform is done. */ - op_node = add_operation_node(&object->id, - NodeType::TRANSFORM, - OperationCode::TRANSFORM_FINAL, - function_bind(BKE_object_eval_transform_final, _1, ob_cow)); + op_node = add_operation_node( + &object->id, + NodeType::TRANSFORM, + OperationCode::TRANSFORM_FINAL, + [ob_cow](::Depsgraph *depsgraph) { BKE_object_eval_transform_final(depsgraph, ob_cow); }); op_node->set_as_exit(); } @@ -904,12 +909,14 @@ void DepsgraphNodeBuilder::build_object_transform(Object *object) void DepsgraphNodeBuilder::build_object_constraints(Object *object) { /* create node for constraint stack */ - add_operation_node( - &object->id, - NodeType::TRANSFORM, - OperationCode::TRANSFORM_CONSTRAINTS, - function_bind( - BKE_object_eval_constraints, _1, get_cow_datablock(scene_), get_cow_datablock(object))); + Scene *scene_cow = get_cow_datablock(scene_); + Object *object_cow = get_cow_datablock(object); + add_operation_node(&object->id, + NodeType::TRANSFORM, + OperationCode::TRANSFORM_CONSTRAINTS, + [scene_cow, object_cow](::Depsgraph *depsgraph) { + BKE_object_eval_constraints(depsgraph, scene_cow, object_cow); + }); } void DepsgraphNodeBuilder::build_object_pointcache(Object *object) @@ -922,7 +929,9 @@ void DepsgraphNodeBuilder::build_object_pointcache(Object *object) add_operation_node(&object->id, NodeType::POINT_CACHE, OperationCode::POINT_CACHE_RESET, - function_bind(BKE_object_eval_ptcache_reset, _1, scene_cow, object_cow)); + [scene_cow, object_cow](::Depsgraph *depsgraph) { + BKE_object_eval_ptcache_reset(depsgraph, scene_cow, object_cow); + }); } /** @@ -950,10 +959,10 @@ void DepsgraphNodeBuilder::build_animdata(ID *id) operation_node = add_operation_node(id, NodeType::ANIMATION, OperationCode::ANIMATION_ENTRY); operation_node->set_as_entry(); /* All the evaluation nodes. */ - add_operation_node(id, - NodeType::ANIMATION, - OperationCode::ANIMATION_EVAL, - function_bind(BKE_animsys_eval_animdata, _1, id_cow)); + add_operation_node( + id, NodeType::ANIMATION, OperationCode::ANIMATION_EVAL, [id_cow](::Depsgraph *depsgraph) { + BKE_animsys_eval_animdata(depsgraph, id_cow); + }); /* Explicit exit operation. */ operation_node = add_operation_node(id, NodeType::ANIMATION, OperationCode::ANIMATION_EXIT); operation_node->set_as_exit(); @@ -989,10 +998,11 @@ void DepsgraphNodeBuilder::build_animation_images(ID *id) { if (BKE_image_user_id_has_animation(id)) { ID *id_cow = get_cow_id(id); - add_operation_node(id, - NodeType::IMAGE_ANIMATION, - OperationCode::IMAGE_ANIMATION, - function_bind(BKE_image_user_id_eval_animation, _1, id_cow)); + add_operation_node( + id, + NodeType::IMAGE_ANIMATION, + OperationCode::IMAGE_ANIMATION, + [id_cow](::Depsgraph *depsgraph) { BKE_image_user_id_eval_animation(depsgraph, id_cow); }); } } @@ -1020,12 +1030,15 @@ void DepsgraphNodeBuilder::build_driver(ID *id, FCurve *fcurve, int driver_index * has not yet been allocated at this point we can't. As a workaround * the animation systems allocates an array so we can do a fast lookup * with the driver index. */ - ensure_operation_node(id, - NodeType::PARAMETERS, - OperationCode::DRIVER, - function_bind(BKE_animsys_eval_driver, _1, id_cow, driver_index, fcurve), - fcurve->rna_path ? fcurve->rna_path : "", - fcurve->array_index); + ensure_operation_node( + id, + NodeType::PARAMETERS, + OperationCode::DRIVER, + [id_cow, driver_index, fcurve](::Depsgraph *depsgraph) { + BKE_animsys_eval_driver(depsgraph, id_cow, driver_index, fcurve); + }, + fcurve->rna_path ? fcurve->rna_path : "", + fcurve->array_index); build_driver_variables(id, fcurve); } @@ -1103,10 +1116,11 @@ void DepsgraphNodeBuilder::build_world(World *world) add_id_node(&world->id); World *world_cow = get_cow_datablock(world); /* Shading update. */ - add_operation_node(&world->id, - NodeType::SHADING, - OperationCode::WORLD_UPDATE, - function_bind(BKE_world_eval, _1, world_cow)); + add_operation_node( + &world->id, + NodeType::SHADING, + OperationCode::WORLD_UPDATE, + [world_cow](::Depsgraph *depsgraph) { BKE_world_eval(depsgraph, world_cow); }); build_idproperties(world->id.properties); /* Animation. */ build_animdata(&world->id); @@ -1142,16 +1156,19 @@ void DepsgraphNodeBuilder::build_rigidbody(Scene *scene) * instead? */ /* Init/rebuild operation. */ - add_operation_node(&scene->id, - NodeType::TRANSFORM, - OperationCode::RIGIDBODY_REBUILD, - function_bind(BKE_rigidbody_rebuild_sim, _1, scene_cow)); - /* Do-sim operation. */ - OperationNode *sim_node = add_operation_node( + add_operation_node( &scene->id, NodeType::TRANSFORM, - OperationCode::RIGIDBODY_SIM, - function_bind(BKE_rigidbody_eval_simulation, _1, scene_cow)); + OperationCode::RIGIDBODY_REBUILD, + [scene_cow](::Depsgraph *depsgraph) { BKE_rigidbody_rebuild_sim(depsgraph, scene_cow); }); + /* Do-sim operation. */ + OperationNode *sim_node = add_operation_node(&scene->id, + NodeType::TRANSFORM, + OperationCode::RIGIDBODY_SIM, + [scene_cow](::Depsgraph *depsgraph) { + BKE_rigidbody_eval_simulation(depsgraph, + scene_cow); + }); sim_node->set_as_entry(); sim_node->set_as_exit(); sim_node->owner->entry_operation = sim_node; @@ -1173,12 +1190,13 @@ void DepsgraphNodeBuilder::build_rigidbody(Scene *scene) /* Create operation for flushing results. */ /* Object's transform component - where the rigidbody operation * lives. */ - add_operation_node( - &object->id, - NodeType::TRANSFORM, - OperationCode::RIGIDBODY_TRANSFORM_COPY, - function_bind( - BKE_rigidbody_object_sync_transforms, _1, scene_cow, get_cow_datablock(object))); + Object *object_cow = get_cow_datablock(object); + add_operation_node(&object->id, + NodeType::TRANSFORM, + OperationCode::RIGIDBODY_TRANSFORM_COPY, + [scene_cow, object_cow](::Depsgraph *depsgraph) { + BKE_rigidbody_object_sync_transforms(depsgraph, scene_cow, object_cow); + }); } FOREACH_COLLECTION_OBJECT_RECURSIVE_END; } @@ -1219,9 +1237,10 @@ void DepsgraphNodeBuilder::build_particle_systems(Object *object, bool is_object Object *ob_cow = get_cow_datablock(object); OperationNode *op_node; - op_node = add_operation_node(psys_comp, - OperationCode::PARTICLE_SYSTEM_INIT, - function_bind(BKE_particle_system_eval_init, _1, ob_cow)); + op_node = add_operation_node( + psys_comp, OperationCode::PARTICLE_SYSTEM_INIT, [ob_cow](::Depsgraph *depsgraph) { + BKE_particle_system_eval_init(depsgraph, ob_cow); + }); op_node->set_as_entry(); /* Build all particle systems. */ LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) { @@ -1278,7 +1297,9 @@ void DepsgraphNodeBuilder::build_particle_settings(ParticleSettings *particle_se add_operation_node(&particle_settings->id, NodeType::PARTICLE_SETTINGS, OperationCode::PARTICLE_SETTINGS_RESET, - function_bind(BKE_particle_settings_eval_reset, _1, particle_settings_cow)); + [particle_settings_cow](::Depsgraph *depsgraph) { + BKE_particle_settings_eval_reset(depsgraph, particle_settings_cow); + }); op_node = add_operation_node( &particle_settings->id, NodeType::PARTICLE_SETTINGS, OperationCode::PARTICLE_SETTINGS_EVAL); op_node->set_as_exit(); @@ -1323,11 +1344,12 @@ void DepsgraphNodeBuilder::build_object_data_geometry(Object *object, bool is_ob op_node = add_operation_node(&object->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_INIT); op_node->set_as_entry(); /* Geometry evaluation. */ - op_node = add_operation_node( - &object->id, - NodeType::GEOMETRY, - OperationCode::GEOMETRY_EVAL, - function_bind(BKE_object_eval_uber_data, _1, scene_cow, object_cow)); + op_node = add_operation_node(&object->id, + NodeType::GEOMETRY, + OperationCode::GEOMETRY_EVAL, + [scene_cow, object_cow](::Depsgraph *depsgraph) { + BKE_object_eval_uber_data(depsgraph, scene_cow, object_cow); + }); op_node->set_as_exit(); /* Materials. */ build_materials(object->mat, object->totcol); @@ -1337,10 +1359,11 @@ void DepsgraphNodeBuilder::build_object_data_geometry(Object *object, bool is_ob build_object_data_geometry_datablock((ID *)object->data, is_object_visible); build_dimensions(object); /* Batch cache. */ - add_operation_node(&object->id, - NodeType::BATCH_CACHE, - OperationCode::GEOMETRY_SELECT_UPDATE, - function_bind(BKE_object_select_update, _1, object_cow)); + add_operation_node( + &object->id, + NodeType::BATCH_CACHE, + OperationCode::GEOMETRY_SELECT_UPDATE, + [object_cow](::Depsgraph *depsgraph) { BKE_object_select_update(depsgraph, object_cow); }); } void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata, bool is_object_visible) @@ -1368,7 +1391,9 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata, bool op_node = add_operation_node(obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL, - function_bind(BKE_mesh_eval_geometry, _1, (Mesh *)obdata_cow)); + [obdata_cow](::Depsgraph *depsgraph) { + BKE_mesh_eval_geometry(depsgraph, (Mesh *)obdata_cow); + }); op_node->set_as_entry(); break; } @@ -1378,11 +1403,12 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata, bool break; } case ID_CU: { - op_node = add_operation_node( - obdata, - NodeType::GEOMETRY, - OperationCode::GEOMETRY_EVAL, - function_bind(BKE_curve_eval_geometry, _1, (Curve *)obdata_cow)); + op_node = add_operation_node(obdata, + NodeType::GEOMETRY, + OperationCode::GEOMETRY_EVAL, + [obdata_cow](::Depsgraph *depsgraph) { + BKE_curve_eval_geometry(depsgraph, (Curve *)obdata_cow); + }); op_node->set_as_entry(); /* Make sure objects used for bevel.taper are in the graph. * NOTE: This objects might be not linked to the scene. */ @@ -1399,22 +1425,25 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata, bool break; } case ID_LT: { - op_node = add_operation_node( - obdata, - NodeType::GEOMETRY, - OperationCode::GEOMETRY_EVAL, - function_bind(BKE_lattice_eval_geometry, _1, (Lattice *)obdata_cow)); + op_node = add_operation_node(obdata, + NodeType::GEOMETRY, + OperationCode::GEOMETRY_EVAL, + [obdata_cow](::Depsgraph *depsgraph) { + BKE_lattice_eval_geometry(depsgraph, (Lattice *)obdata_cow); + }); op_node->set_as_entry(); break; } case ID_GD: { /* GPencil evaluation operations. */ - op_node = add_operation_node( - obdata, - NodeType::GEOMETRY, - OperationCode::GEOMETRY_EVAL, - function_bind(BKE_gpencil_frame_active_set, _1, (bGPdata *)obdata_cow)); + op_node = add_operation_node(obdata, + NodeType::GEOMETRY, + OperationCode::GEOMETRY_EVAL, + [obdata_cow](::Depsgraph *depsgraph) { + BKE_gpencil_frame_active_set(depsgraph, + (bGPdata *)obdata_cow); + }); op_node->set_as_entry(); break; } @@ -1430,11 +1459,12 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata, bool } case ID_VO: { /* Volume frame update. */ - op_node = add_operation_node( - obdata, - NodeType::GEOMETRY, - OperationCode::GEOMETRY_EVAL, - function_bind(BKE_volume_eval_geometry, _1, (Volume *)obdata_cow)); + op_node = add_operation_node(obdata, + NodeType::GEOMETRY, + OperationCode::GEOMETRY_EVAL, + [obdata_cow](::Depsgraph *depsgraph) { + BKE_volume_eval_geometry(depsgraph, (Volume *)obdata_cow); + }); op_node->set_as_entry(); break; } @@ -1450,7 +1480,9 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata, bool add_operation_node(obdata, NodeType::BATCH_CACHE, OperationCode::GEOMETRY_SELECT_UPDATE, - function_bind(BKE_object_data_select_update, _1, obdata_cow)); + [obdata_cow](::Depsgraph *depsgraph) { + BKE_object_data_select_update(depsgraph, obdata_cow); + }); } void DepsgraphNodeBuilder::build_armature(bArmature *armature) @@ -1466,7 +1498,9 @@ void DepsgraphNodeBuilder::build_armature(bArmature *armature) add_operation_node(&armature->id, NodeType::ARMATURE, OperationCode::ARMATURE_EVAL, - function_bind(BKE_armature_refresh_layer_used, _1, armature_cow)); + [armature_cow](::Depsgraph *depsgraph) { + BKE_armature_refresh_layer_used(depsgraph, armature_cow); + }); build_armature_bones(&armature->bonebase); } @@ -1506,7 +1540,7 @@ void DepsgraphNodeBuilder::build_light(Light *lamp) add_operation_node(&lamp->id, NodeType::SHADING, OperationCode::LIGHT_UPDATE, - function_bind(BKE_light_eval, _1, lamp_cow)); + [lamp_cow](::Depsgraph *depsgraph) { BKE_light_eval(depsgraph, lamp_cow); }); } void DepsgraphNodeBuilder::build_nodetree_socket(bNodeSocket *socket) @@ -1534,7 +1568,6 @@ void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree) } /* nodetree itself */ add_id_node(&ntree->id); - bNodeTree *ntree_cow = get_cow_datablock(ntree); /* General parameters. */ build_parameters(&ntree->id); build_idproperties(ntree->id.properties); @@ -1542,12 +1575,7 @@ void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree) build_animdata(&ntree->id); /* Shading update. */ add_operation_node(&ntree->id, NodeType::SHADING, OperationCode::MATERIAL_UPDATE); - /* NOTE: We really pass original and CoW node trees here, this is how the - * callback works. Ideally we need to find a better way for that. */ - add_operation_node(&ntree->id, - NodeType::SHADING_PARAMETERS, - OperationCode::MATERIAL_UPDATE, - function_bind(BKE_nodetree_shading_params_eval, _1, ntree_cow, ntree)); + add_operation_node(&ntree->id, NodeType::SHADING_PARAMETERS, OperationCode::MATERIAL_UPDATE); /* nodetree's nodes... */ LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) { build_idproperties(bnode->prop); @@ -1626,10 +1654,11 @@ void DepsgraphNodeBuilder::build_material(Material *material) add_id_node(&material->id); Material *material_cow = get_cow_datablock(material); /* Shading update. */ - add_operation_node(&material->id, - NodeType::SHADING, - OperationCode::MATERIAL_UPDATE, - function_bind(BKE_material_eval, _1, material_cow)); + add_operation_node( + &material->id, + NodeType::SHADING, + OperationCode::MATERIAL_UPDATE, + [material_cow](::Depsgraph *depsgraph) { BKE_material_eval(depsgraph, material_cow); }); build_idproperties(material->id.properties); /* Material animation. */ build_animdata(&material->id); @@ -1714,7 +1743,9 @@ void DepsgraphNodeBuilder::build_cachefile(CacheFile *cache_file) add_operation_node(cache_file_id, NodeType::CACHE, OperationCode::FILE_CACHE_UPDATE, - function_bind(BKE_cachefile_eval, bmain_, _1, cache_file_cow)); + [bmain = bmain_, cache_file_cow](::Depsgraph *depsgraph) { + BKE_cachefile_eval(bmain, depsgraph, cache_file_cow); + }); } void DepsgraphNodeBuilder::build_mask(Mask *mask) @@ -1729,15 +1760,16 @@ void DepsgraphNodeBuilder::build_mask(Mask *mask) build_animdata(mask_id); build_parameters(mask_id); /* Animation based on mask's shapes. */ - add_operation_node(mask_id, - NodeType::ANIMATION, - OperationCode::MASK_ANIMATION, - function_bind(BKE_mask_eval_animation, _1, mask_cow)); + add_operation_node( + mask_id, + NodeType::ANIMATION, + OperationCode::MASK_ANIMATION, + [mask_cow](::Depsgraph *depsgraph) { BKE_mask_eval_animation(depsgraph, mask_cow); }); /* Final mask evaluation. */ - add_operation_node(mask_id, - NodeType::PARAMETERS, - OperationCode::MASK_EVAL, - function_bind(BKE_mask_eval_update, _1, mask_cow)); + add_operation_node( + mask_id, NodeType::PARAMETERS, OperationCode::MASK_EVAL, [mask_cow](::Depsgraph *depsgraph) { + BKE_mask_eval_update(depsgraph, mask_cow); + }); /* Build parents. */ LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) { LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) { @@ -1781,12 +1813,16 @@ void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip) add_operation_node(clip_id, NodeType::PARAMETERS, OperationCode::MOVIECLIP_EVAL, - function_bind(BKE_movieclip_eval_update, _1, bmain_, clip_cow)); + [bmain = bmain_, clip_cow](::Depsgraph *depsgraph) { + BKE_movieclip_eval_update(depsgraph, bmain, clip_cow); + }); add_operation_node(clip_id, NodeType::BATCH_CACHE, OperationCode::MOVIECLIP_SELECT_UPDATE, - function_bind(BKE_movieclip_eval_selection_update, _1, clip_cow)); + [clip_cow](::Depsgraph *depsgraph) { + BKE_movieclip_eval_selection_update(depsgraph, clip_cow); + }); } void DepsgraphNodeBuilder::build_lightprobe(LightProbe *probe) @@ -1826,7 +1862,9 @@ void DepsgraphNodeBuilder::build_sound(bSound *sound) add_operation_node(&sound->id, NodeType::AUDIO, OperationCode::SOUND_EVAL, - function_bind(BKE_sound_evaluate, _1, bmain_, sound_cow)); + [bmain = bmain_, sound_cow](::Depsgraph *depsgraph) { + BKE_sound_evaluate(depsgraph, bmain, sound_cow); + }); build_idproperties(sound->id.properties); build_animdata(&sound->id); build_parameters(&sound->id); @@ -1849,7 +1887,9 @@ void DepsgraphNodeBuilder::build_simulation(Simulation *simulation) add_operation_node(&simulation->id, NodeType::SIMULATION, OperationCode::SIMULATION_EVAL, - function_bind(BKE_simulation_data_update, _1, scene_cow, simulation_cow)); + [scene_cow, simulation_cow](::Depsgraph *depsgraph) { + BKE_simulation_data_update(depsgraph, scene_cow, simulation_cow); + }); } void DepsgraphNodeBuilder::build_scene_sequencer(Scene *scene) @@ -1865,7 +1905,9 @@ void DepsgraphNodeBuilder::build_scene_sequencer(Scene *scene) add_operation_node(&scene->id, NodeType::SEQUENCER, OperationCode::SEQUENCES_EVAL, - function_bind(BKE_scene_eval_sequencer_sequences, _1, scene_cow)); + [scene_cow](::Depsgraph *depsgraph) { + BKE_scene_eval_sequencer_sequences(depsgraph, scene_cow); + }); /* Make sure data for sequences is in the graph. */ Sequence *seq; SEQ_ALL_BEGIN (scene->ed, seq) { @@ -1904,7 +1946,9 @@ void DepsgraphNodeBuilder::build_scene_audio(Scene *scene) add_operation_node(&scene->id, NodeType::AUDIO, OperationCode::AUDIO_VOLUME, - function_bind(BKE_scene_update_tag_audio_volume, _1, scene_cow)); + [scene_cow](::Depsgraph *depsgraph) { + BKE_scene_update_tag_audio_volume(depsgraph, scene_cow); + }); } void DepsgraphNodeBuilder::build_scene_speakers(Scene * /*scene*/, ViewLayer *view_layer) diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc index 8ba4b4a427f..13caba67713 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc @@ -66,16 +66,18 @@ void DepsgraphNodeBuilder::build_pose_constraints(Object *object, data.builder = this; data.is_parent_visible = is_object_visible; BKE_constraints_id_loop(&pchan->constraints, constraint_walk, &data); + /* Create node for constraint stack. */ + Scene *scene_cow = get_cow_datablock(scene_); + Object *object_cow = get_cow_datablock(object); add_operation_node(&object->id, NodeType::BONE, pchan->name, OperationCode::BONE_CONSTRAINTS, - function_bind(BKE_pose_constraints_evaluate, - _1, - get_cow_datablock(scene_), - get_cow_datablock(object), - pchan_index)); + [scene_cow, object_cow, pchan_index](::Depsgraph *depsgraph) { + BKE_pose_constraints_evaluate( + depsgraph, scene_cow, object_cow, pchan_index); + }); } /* IK Solver Eval Steps */ @@ -96,16 +98,17 @@ void DepsgraphNodeBuilder::build_ik_pose(Object *object, bPoseChannel *pchan, bC int rootchan_index = BLI_findindex(&object->pose->chanbase, rootchan); BLI_assert(rootchan_index != -1); + /* Operation node for evaluating/running IK Solver. */ + Scene *scene_cow = get_cow_datablock(scene_); + Object *object_cow = get_cow_datablock(object); add_operation_node(&object->id, NodeType::EVAL_POSE, rootchan->name, OperationCode::POSE_IK_SOLVER, - function_bind(BKE_pose_iktree_evaluate, - _1, - get_cow_datablock(scene_), - get_cow_datablock(object), - rootchan_index)); + [scene_cow, object_cow, rootchan_index](::Depsgraph *depsgraph) { + BKE_pose_iktree_evaluate(depsgraph, scene_cow, object_cow, rootchan_index); + }); } /* Spline IK Eval Steps */ @@ -130,15 +133,17 @@ void DepsgraphNodeBuilder::build_splineik_pose(Object *object, * start. */ int rootchan_index = BLI_findindex(&object->pose->chanbase, rootchan); BLI_assert(rootchan_index != -1); + + Scene *scene_cow = get_cow_datablock(scene_); + Object *object_cow = get_cow_datablock(object); add_operation_node(&object->id, NodeType::EVAL_POSE, rootchan->name, OperationCode::POSE_SPLINE_IK_SOLVER, - function_bind(BKE_pose_splineik_evaluate, - _1, - get_cow_datablock(scene_), - get_cow_datablock(object), - rootchan_index)); + [scene_cow, object_cow, rootchan_index](::Depsgraph *depsgraph) { + BKE_pose_splineik_evaluate( + depsgraph, scene_cow, object_cow, rootchan_index); + }); } /* Pose/Armature Bones Graph */ @@ -193,23 +198,30 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) op_node = add_operation_node(&object->id, NodeType::EVAL_POSE, OperationCode::POSE_INIT, - function_bind(BKE_pose_eval_init, _1, scene_cow, object_cow)); + [scene_cow, object_cow](::Depsgraph *depsgraph) { + BKE_pose_eval_init(depsgraph, scene_cow, object_cow); + }); op_node->set_as_entry(); op_node = add_operation_node(&object->id, NodeType::EVAL_POSE, OperationCode::POSE_INIT_IK, - function_bind(BKE_pose_eval_init_ik, _1, scene_cow, object_cow)); + [scene_cow, object_cow](::Depsgraph *depsgraph) { + BKE_pose_eval_init_ik(depsgraph, scene_cow, object_cow); + }); add_operation_node(&object->id, NodeType::EVAL_POSE, OperationCode::POSE_CLEANUP, - function_bind(BKE_pose_eval_cleanup, _1, scene_cow, object_cow)); + [scene_cow, object_cow](::Depsgraph *depsgraph) { + BKE_pose_eval_cleanup(depsgraph, scene_cow, object_cow); + }); - op_node = add_operation_node(&object->id, - NodeType::EVAL_POSE, - OperationCode::POSE_DONE, - function_bind(BKE_pose_eval_done, _1, object_cow)); + op_node = add_operation_node( + &object->id, + NodeType::EVAL_POSE, + OperationCode::POSE_DONE, + [object_cow](::Depsgraph *depsgraph) { BKE_pose_eval_done(depsgraph, object_cow); }); op_node->set_as_exit(); /* Bones. */ int pchan_index = 0; @@ -223,7 +235,9 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) NodeType::BONE, pchan->name, OperationCode::BONE_POSE_PARENT, - function_bind(BKE_pose_eval_bone, _1, scene_cow, object_cow, pchan_index)); + [scene_cow, object_cow, pchan_index](::Depsgraph *depsgraph) { + BKE_pose_eval_bone(depsgraph, scene_cow, object_cow, pchan_index); + }); /* NOTE: Dedicated noop for easier relationship construction. */ add_operation_node(&object->id, NodeType::BONE, pchan->name, OperationCode::BONE_READY); @@ -232,16 +246,20 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) NodeType::BONE, pchan->name, OperationCode::BONE_DONE, - function_bind(BKE_pose_bone_done, _1, object_cow, pchan_index)); + [object_cow, pchan_index](::Depsgraph *depsgraph) { + BKE_pose_bone_done(depsgraph, object_cow, pchan_index); + }); /* B-Bone shape computation - the real last step if present. */ if (check_pchan_has_bbone(object, pchan)) { - op_node = add_operation_node( - &object->id, - NodeType::BONE, - pchan->name, - OperationCode::BONE_SEGMENTS, - function_bind(BKE_pose_eval_bbone_segments, _1, object_cow, pchan_index)); + op_node = add_operation_node(&object->id, + NodeType::BONE, + pchan->name, + OperationCode::BONE_SEGMENTS, + [object_cow, pchan_index](::Depsgraph *depsgraph) { + BKE_pose_eval_bbone_segments( + depsgraph, object_cow, pchan_index); + }); } op_node->set_as_exit(); @@ -304,10 +322,11 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object, bool is_object_visibl if (object->pose->flag & POSE_CONSTRAINTS_NEED_UPDATE_FLAGS) { BKE_pose_update_constraint_flags(object->pose); } - op_node = add_operation_node(&object->id, - NodeType::EVAL_POSE, - OperationCode::POSE_INIT, - function_bind(BKE_pose_eval_proxy_init, _1, object_cow)); + op_node = add_operation_node( + &object->id, + NodeType::EVAL_POSE, + OperationCode::POSE_INIT, + [object_cow](::Depsgraph *depsgraph) { BKE_pose_eval_proxy_init(depsgraph, object_cow); }); op_node->set_as_entry(); int pchan_index = 0; @@ -318,12 +337,14 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object, bool is_object_visibl /* Bone is ready for solvers. */ add_operation_node(&object->id, NodeType::BONE, pchan->name, OperationCode::BONE_READY); /* Bone is fully evaluated. */ - op_node = add_operation_node( - &object->id, - NodeType::BONE, - pchan->name, - OperationCode::BONE_DONE, - function_bind(BKE_pose_eval_proxy_copy_bone, _1, object_cow, pchan_index)); + op_node = add_operation_node(&object->id, + NodeType::BONE, + pchan->name, + OperationCode::BONE_DONE, + [object_cow, pchan_index](::Depsgraph *depsgraph) { + BKE_pose_eval_proxy_copy_bone( + depsgraph, object_cow, pchan_index); + }); op_node->set_as_exit(); /* Custom properties. */ @@ -343,11 +364,14 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object, bool is_object_visibl op_node = add_operation_node(&object->id, NodeType::EVAL_POSE, OperationCode::POSE_CLEANUP, - function_bind(BKE_pose_eval_proxy_cleanup, _1, object_cow)); - op_node = add_operation_node(&object->id, - NodeType::EVAL_POSE, - OperationCode::POSE_DONE, - function_bind(BKE_pose_eval_proxy_done, _1, object_cow)); + [object_cow](::Depsgraph *depsgraph) { + BKE_pose_eval_proxy_cleanup(depsgraph, object_cow); + }); + op_node = add_operation_node( + &object->id, + NodeType::EVAL_POSE, + OperationCode::POSE_DONE, + [object_cow](::Depsgraph *depsgraph) { BKE_pose_eval_proxy_done(depsgraph, object_cow); }); op_node->set_as_exit(); } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc index b1fd86f13bc..29aa05b83db 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc @@ -160,11 +160,12 @@ void DepsgraphNodeBuilder::build_view_layer(Scene *scene, build_scene_sequencer(scene); } /* Collections. */ - add_operation_node( - &scene->id, - NodeType::LAYER_COLLECTIONS, - OperationCode::VIEW_LAYER_EVAL, - function_bind(BKE_layer_eval_view_layer_indexed, _1, scene_cow, view_layer_index_)); + add_operation_node(&scene->id, + NodeType::LAYER_COLLECTIONS, + OperationCode::VIEW_LAYER_EVAL, + [view_layer_index = view_layer_index_, scene_cow](::Depsgraph *depsgraph) { + BKE_layer_eval_view_layer_indexed(depsgraph, scene_cow, view_layer_index); + }); /* Parameters evaluation for scene relations mainly. */ build_scene_compositor(scene); build_scene_parameters(scene); diff --git a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc index a0cbbbc163d..9afae0f2c22 100644 --- a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc +++ b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc @@ -184,7 +184,7 @@ static void deg_debug_graphviz_legend(DotExportContext &ctx) std::stringstream ss; ss << "<"; - ss << "
"; + ss << R"(
)"; ss << ((name.size() == 0) ? "No Name" : name); ss << "
"; + ss << R"("; ss << name; ss << ""; + ss << R"("; ss << name; ss << "
"; + ss << R"(
)"; ss << ""; #ifdef COLOR_SCHEME_NODE_CLASS diff --git a/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc b/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc index 0cdd627dd44..df343a3eb28 100644 --- a/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc +++ b/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc @@ -87,7 +87,7 @@ string gnuplotify_name(const string &name) for (int i = 0; i < length; i++) { const char ch = name[i]; if (ch == '_') { - result += "\\\\\\"; + result += R"(\\\)"; } result += ch; } diff --git a/source/blender/draw/engines/eevee/eevee_data.c b/source/blender/draw/engines/eevee/eevee_data.c index 47068d0b843..b453df284ed 100644 --- a/source/blender/draw/engines/eevee/eevee_data.c +++ b/source/blender/draw/engines/eevee/eevee_data.c @@ -130,7 +130,7 @@ EEVEE_ObjectMotionData *EEVEE_motion_blur_object_data_get(EEVEE_MotionBlurData * } EEVEE_ObjectKey key, *key_p; - /* Small hack to avoid another comparisson. */ + /* Small hack to avoid another comparison. */ key.ob = (Object *)((char *)ob + hair); DupliObject *dup = DRW_object_get_dupli(ob); if (dup) { diff --git a/source/blender/draw/engines/eevee/eevee_effects.c b/source/blender/draw/engines/eevee/eevee_effects.c index ca583143572..698b959f1a9 100644 --- a/source/blender/draw/engines/eevee/eevee_effects.c +++ b/source/blender/draw/engines/eevee/eevee_effects.c @@ -242,7 +242,7 @@ void EEVEE_effects_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) } { - /* Perform min/max downsample */ + /* Perform min/max down-sample. */ DRW_PASS_CREATE(psl->maxz_downlevel_ps, downsample_write | DRW_STATE_DEPTH_ALWAYS); grp = DRW_shgroup_create(EEVEE_shaders_effect_maxz_downlevel_sh_get(), psl->maxz_downlevel_ps); DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &txl->maxzbuffer); diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index c6760de5cfa..802b47b61a4 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -319,7 +319,7 @@ static void eevee_draw_scene(void *vedata) EEVEE_renderpasses_output_accumulate(sldata, vedata, false); /* Transparent */ - /* TODO(fclem): should be its own Framebuffer. + /* TODO(fclem): should be its own Frame-buffer. * This is needed because dualsource blending only works with 1 color buffer. */ GPU_framebuffer_texture_attach(fbl->main_color_fb, dtxl->depth, 0, 0); GPU_framebuffer_bind(fbl->main_color_fb); diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c index 040aa8c8d9c..c4973dc2e8b 100644 --- a/source/blender/draw/engines/eevee/eevee_lightcache.c +++ b/source/blender/draw/engines/eevee/eevee_lightcache.c @@ -99,9 +99,9 @@ typedef struct EEVEE_LightBake { GPUTexture *rt_color; /** Target cube depth texture. */ GPUTexture *rt_depth; - /** Target cube framebuffers. */ + /** Target cube frame-buffers. */ GPUFrameBuffer *rt_fb[6]; - /** Storage framebuffer. */ + /** Storage frame-buffer. */ GPUFrameBuffer *store_fb; /** Cube render target resolution. */ int rt_res; @@ -135,7 +135,7 @@ typedef struct EEVEE_LightBake { int grid_curr; /** The current light bounce being evaluated. */ int bounce_curr, bounce_len; - /** Resolution of the Visibility shadowmap. */ + /** Resolution of the Visibility shadow-map. */ float vis_res; /** Result of previous light bounce. */ GPUTexture *grid_prev; @@ -163,7 +163,7 @@ typedef struct EEVEE_LightBake { /** For only handling the resources. */ bool resource_only; bool own_resources; - /** If the lightcache was created for baking, it's first owned by the baker. */ + /** If the light-cache was created for baking, it's first owned by the baker. */ bool own_light_cache; /** ms. delay the start of the baking to not slowdown interactions (TODO remove) */ int delay; @@ -907,7 +907,7 @@ static void eevee_lightbake_cache_create(EEVEE_Data *vedata, EEVEE_LightBake *lb Scene *scene_eval = DEG_get_evaluated_scene(lbake->depsgraph); lbake->sldata = sldata; - /* Disable all effects BUT high bitdepth shadows. */ + /* Disable all effects BUT high bit-depth shadows. */ scene_eval->eevee.flag &= SCE_EEVEE_SHADOW_HIGH_BITDEPTH; scene_eval->eevee.taa_samples = 1; scene_eval->eevee.gi_irradiance_smoothing = 0.0f; @@ -980,7 +980,7 @@ static void eevee_lightbake_copy_irradiance(EEVEE_LightBake *lbake, LightCache * { DRW_TEXTURE_FREE_SAFE(lbake->grid_prev); - /* Copy texture by reading back and reuploading it. */ + /* Copy texture by reading back and re-uploading it. */ float *tex = GPU_texture_read(lcache->grid_tx.tex, GPU_DATA_FLOAT, 0); lbake->grid_prev = DRW_texture_create_2d_array(lbake->irr_size[0], lbake->irr_size[1], @@ -1330,7 +1330,7 @@ void EEVEE_lightbake_update(void *custom_data) EEVEE_LightBake *lbake = (EEVEE_LightBake *)custom_data; Scene *scene_orig = lbake->scene; - /* If a new lightcache was created, free the old one and reference the new. */ + /* If a new light-cache was created, free the old one and reference the new. */ if (lbake->lcache && scene_orig->eevee.light_cache_data != lbake->lcache) { if (scene_orig->eevee.light_cache_data != NULL) { EEVEE_lightcache_free(scene_orig->eevee.light_cache_data); @@ -1353,7 +1353,7 @@ static bool lightbake_do_sample(EEVEE_LightBake *lbake, Depsgraph *depsgraph = lbake->depsgraph; - /* TODO: make DRW manager instanciable (and only lock on drawing) */ + /* TODO: make DRW manager instantiable (and only lock on drawing) */ eevee_lightbake_context_enable(lbake); DRW_custom_pipeline(&draw_engine_eevee_type, depsgraph, render_callback, lbake); lbake->done += 1; diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 3671bea9ac0..395d4dc790d 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -704,11 +704,11 @@ static void lightbake_planar_ensure_view(EEVEE_PlanarReflection *eplanar, static void eevee_lightprobes_extract_from_cache(EEVEE_LightProbesInfo *pinfo, LightCache *lcache) { /* copy the entire cache for now (up to MAX_PROBE) */ - /* TODO Frutum cull to only add visible probes. */ + /* TODO: frustum cull to only add visible probes. */ memcpy(pinfo->probe_data, lcache->cube_data, sizeof(EEVEE_LightProbe) * max_ii(1, min_ii(lcache->cube_len, MAX_PROBE))); - /* TODO compute the max number of grid based on sample count. */ + /* TODO: compute the max number of grid based on sample count. */ memcpy(pinfo->grid_data, lcache->grid_data, sizeof(EEVEE_LightGrid) * max_ii(1, min_ii(lcache->grid_len, MAX_GRID))); @@ -1041,7 +1041,7 @@ void EEVEE_lightbake_filter_glossy(EEVEE_ViewLayerData *sldata, pinfo->layer = probe_idx * 6; pinfo->roughness = i / (float)maxlevel; pinfo->roughness *= pinfo->roughness; /* Disney Roughness */ - pinfo->roughness *= pinfo->roughness; /* Distribute Roughness accros lod more evenly */ + pinfo->roughness *= pinfo->roughness; /* Distribute Roughness across lod more evenly. */ CLAMP(pinfo->roughness, 1e-8f, 0.99999f); /* Avoid artifacts */ #if 1 /* Variable Sample count and bias (fast) */ diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c index 628941f68a2..a9998b33b7e 100644 --- a/source/blender/draw/engines/eevee/eevee_lookdev.c +++ b/source/blender/draw/engines/eevee/eevee_lookdev.c @@ -344,7 +344,7 @@ void EEVEE_lookdev_draw(EEVEE_Data *vedata) DRW_view_set_active(effects->lookdev_view); - /* Find the right framebuffers to render to. */ + /* Find the right frame-buffers to render to. */ GPUFrameBuffer *fb = (effects->target_buffer == fbl->effect_color_fb) ? fbl->main_fb : fbl->effect_fb; diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index 273521b0b28..56e4af0b6de 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -234,7 +234,7 @@ void EEVEE_materials_init(EEVEE_ViewLayerData *sldata, } { - /* Update noise Framebuffer. */ + /* Update noise Frame-buffer. */ GPU_framebuffer_ensure_config( &fbl->update_noise_fb, {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE_LAYER(e_data.util_tex, 2)}); diff --git a/source/blender/draw/engines/eevee/eevee_occlusion.c b/source/blender/draw/engines/eevee/eevee_occlusion.c index fd96a076c68..a3b581357e0 100644 --- a/source/blender/draw/engines/eevee/eevee_occlusion.c +++ b/source/blender/draw/engines/eevee/eevee_occlusion.c @@ -273,7 +273,7 @@ void EEVEE_occlusion_output_accumulate(EEVEE_ViewLayerData *sldata, EEVEE_Data * if (fbl->ao_accum_fb != NULL) { DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); - /* Update the min_max/horizon buffers so the refracion materials appear in it. */ + /* Update the min_max/horizon buffers so the refraction materials appear in it. */ EEVEE_create_minmax_buffer(vedata, dtxl->depth, -1); EEVEE_occlusion_compute(sldata, vedata, dtxl->depth, -1); diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index 9702db5fecc..9845ec903e5 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -518,7 +518,7 @@ typedef struct EEVEE_LightsInfo { struct EEVEE_Shadow shadow_data[MAX_SHADOW]; struct EEVEE_ShadowCube shadow_cube_data[MAX_SHADOW_CUBE]; struct EEVEE_ShadowCascade shadow_cascade_data[MAX_SHADOW_CASCADE]; - /* Additionnal rendering info for cascade. */ + /* Additional rendering info for cascade. */ struct EEVEE_ShadowCascadeRender shadow_cascade_render[MAX_SHADOW_CASCADE]; /* Back index in light_data. */ uchar shadow_cube_light_indices[MAX_SHADOW_CUBE]; @@ -766,7 +766,7 @@ typedef struct EEVEE_EffectsInfo { struct GPUTexture *source_buffer; /* latest updated texture */ struct GPUFrameBuffer *target_buffer; /* next target to render to */ struct GPUTexture *final_tx; /* Final color to transform to display color space. */ - struct GPUFrameBuffer *final_fb; /* Framebuffer with final_tx as attachment. */ + struct GPUFrameBuffer *final_fb; /* Frame-buffer with final_tx as attachment. */ } EEVEE_EffectsInfo; /* ***************** COMMON DATA **************** */ @@ -1431,7 +1431,7 @@ static const float texcomat[4][4] = { {0.5f, 0.5f, 0.5f, 1.0f}, }; -/* Cubemap Matrices */ +/* Cube-map Matrices */ static const float cubefacemat[6][4][4] = { /* Pos X */ {{0.0f, 0.0f, -1.0f, 0.0f}, diff --git a/source/blender/draw/engines/eevee/eevee_render.c b/source/blender/draw/engines/eevee/eevee_render.c index bb974688404..72b12f6daeb 100644 --- a/source/blender/draw/engines/eevee/eevee_render.c +++ b/source/blender/draw/engines/eevee/eevee_render.c @@ -556,7 +556,7 @@ void EEVEE_render_draw(EEVEE_Data *vedata, RenderEngine *engine, RenderLayer *rl DRW_render_instance_buffer_finish(); /* Need to be called after DRW_render_instance_buffer_finish() */ - /* Also we weed to have a correct fbo bound for DRW_hair_update */ + /* Also we weed to have a correct FBO bound for DRW_hair_update */ GPU_framebuffer_bind(fbl->main_fb); DRW_hair_update(); diff --git a/source/blender/draw/engines/eevee/eevee_sampling.c b/source/blender/draw/engines/eevee/eevee_sampling.c index 253dae79902..aa11f072fa5 100644 --- a/source/blender/draw/engines/eevee/eevee_sampling.c +++ b/source/blender/draw/engines/eevee/eevee_sampling.c @@ -69,11 +69,11 @@ void EEVEE_sample_rectangle(int sample_ofs, BLI_halton_2d(ht_primes, ht_offset, sample_ofs, ht_point); - /* Decorelate AA and shadow samples. (see T68594) */ + /* De-correlate AA and shadow samples. (see T68594) */ ht_point[0] = fmod(ht_point[0] * 1151.0, 1.0); ht_point[1] = fmod(ht_point[1] * 1069.0, 1.0); - /* Change ditribution center to be 0,0 */ + /* Change distribution center to be 0,0 */ ht_point[0] = (ht_point[0] > 0.5f) ? ht_point[0] - 1.0f : ht_point[0]; ht_point[1] = (ht_point[1] > 0.5f) ? ht_point[1] - 1.0f : ht_point[1]; diff --git a/source/blender/draw/engines/eevee/eevee_screen_raytrace.c b/source/blender/draw/engines/eevee/eevee_screen_raytrace.c index ed7d53b51af..1465c9dd84c 100644 --- a/source/blender/draw/engines/eevee/eevee_screen_raytrace.c +++ b/source/blender/draw/engines/eevee/eevee_screen_raytrace.c @@ -106,7 +106,7 @@ int EEVEE_screen_raytrace_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) GPU_framebuffer_texture_attach(fbl->main_fb, effects->ssr_specrough_input, 2, 0); - /* Raytracing output */ + /* Ray-tracing output. */ effects->ssr_hit_output = DRW_texture_pool_query_2d( tracing_res[0], tracing_res[1], GPU_RG16I, &draw_engine_eevee_type); effects->ssr_pdf_output = DRW_texture_pool_query_2d( diff --git a/source/blender/draw/engines/eevee/eevee_shaders.c b/source/blender/draw/engines/eevee/eevee_shaders.c index 7a277c18f01..7a83bebdeca 100644 --- a/source/blender/draw/engines/eevee/eevee_shaders.c +++ b/source/blender/draw/engines/eevee/eevee_shaders.c @@ -85,7 +85,7 @@ static struct { struct GPUShader *lookdev_background; struct GPUShader *update_noise_sh; - /* Downsample Depth */ + /* Down-sample Depth */ struct GPUShader *minz_downlevel_sh; struct GPUShader *maxz_downlevel_sh; struct GPUShader *minz_downdepth_sh; @@ -96,7 +96,7 @@ static struct { struct GPUShader *minz_copydepth_sh; struct GPUShader *maxz_copydepth_sh; - /* Simple Downsample */ + /* Simple Down-sample */ struct GPUShader *downsample_sh; struct GPUShader *downsample_cube_sh; diff --git a/source/blender/draw/engines/eevee/eevee_shadows.c b/source/blender/draw/engines/eevee/eevee_shadows.c index fa5afd60235..e29830defff 100644 --- a/source/blender/draw/engines/eevee/eevee_shadows.c +++ b/source/blender/draw/engines/eevee/eevee_shadows.c @@ -141,7 +141,7 @@ void EEVEE_shadows_caster_register(EEVEE_ViewLayerData *sldata, Object *ob) } if (ob->base_flag & BASE_FROM_DUPLI) { - /* Duplis will always refresh the shadowmaps as if they were deleted each frame. */ + /* Duplis will always refresh the shadow-maps as if they were deleted each frame. */ /* TODO(fclem): fix this. */ update = true; } @@ -259,7 +259,7 @@ void EEVEE_shadows_update(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) BoundSphere *bsphere = linfo->shadow_bounds; /* Search for deleted shadow casters or if shcaster WAS in shadow radius. */ for (int i = 0; i < backbuffer->count; i++) { - /* If the shadowcaster has been deleted or updated. */ + /* If the shadow-caster has been deleted or updated. */ if (BLI_BITMAP_TEST(backbuffer->update, i)) { for (int j = 0; j < linfo->cube_len; j++) { if (!BLI_BITMAP_TEST(&linfo->sh_cube_update[0], j)) { @@ -273,7 +273,7 @@ void EEVEE_shadows_update(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) /* Search for updates in current shadow casters. */ bbox = frontbuffer->bbox; for (int i = 0; i < frontbuffer->count; i++) { - /* If the shadowcaster has been updated. */ + /* If the shadow-caster has been updated. */ if (BLI_BITMAP_TEST(frontbuffer->update, i)) { for (int j = 0; j < linfo->cube_len; j++) { if (!BLI_BITMAP_TEST(&linfo->sh_cube_update[0], j)) { diff --git a/source/blender/draw/engines/eevee/eevee_shadows_cascade.c b/source/blender/draw/engines/eevee/eevee_shadows_cascade.c index 246bc18b71a..6cb4b39fafa 100644 --- a/source/blender/draw/engines/eevee/eevee_shadows_cascade.c +++ b/source/blender/draw/engines/eevee/eevee_shadows_cascade.c @@ -330,7 +330,7 @@ static void eevee_shadow_cascade_setup(EEVEE_LightsInfo *linfo, DRW_debug_sphere(center, csm_render->radius[c], dbg_col); #endif - /* Project into lightspace */ + /* Project into light-space. */ mul_m4_v3(viewmat, center); /* Snap projection center to nearest texel to cancel shimmering. */ @@ -376,7 +376,7 @@ static void eevee_shadow_cascade_setup(EEVEE_LightsInfo *linfo, #endif } - /* Bias is in clipspace, divide by range. */ + /* Bias is in clip-space, divide by range. */ shdw_data->bias = csm_render->original_bias * 0.05f / fabsf(sh_far - sh_near); shdw_data->near = sh_near; shdw_data->far = sh_far; diff --git a/source/blender/draw/engines/eevee/eevee_shadows_cube.c b/source/blender/draw/engines/eevee/eevee_shadows_cube.c index 19b86476c29..89caa0dd193 100644 --- a/source/blender/draw/engines/eevee/eevee_shadows_cube.c +++ b/source/blender/draw/engines/eevee/eevee_shadows_cube.c @@ -142,7 +142,7 @@ static void eevee_ensure_cube_views( float winmat[4][4]; float side = near; - /* TODO shadowcube array. */ + /* TODO: shadow-cube array. */ if (true) { /* This half texel offset is used to ensure correct filtering between faces. */ /* FIXME: This exhibit float precision issue with lower cube_res. diff --git a/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl index 312d9f63ce0..9199eae816d 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl @@ -211,16 +211,16 @@ void main() float w = 1.0 / (50.0 * float(KERNEL) * 4.0); accum_bg += center_color * w; w_accum.x += w; - /* Note: In Jimenez's presentation, they used center sample. - * We use background color as it contains more informations for foreground + /* NOTE: In Jimenez's presentation, they used center sample. + * We use background color as it contains more information for foreground * elements that have not enough weights. - * Yield beter blur in complex motion. */ + * Yield better blur in complex motion. */ center_color = accum_bg / w_accum.x; #endif /* Merge background. */ accum += accum_bg; w_accum.y += w_accum.x; - /* Balance accumulation for failled samples. + /* Balance accumulation for failed samples. * We replace the missing foreground by the background. */ float blend_fac = saturate(1.0 - w_accum.y / w_accum.z); fragColor = (accum / w_accum.z) + center_color * blend_fac; diff --git a/source/blender/draw/engines/external/external_engine.c b/source/blender/draw/engines/external/external_engine.c index 1b331052a06..adb21540afb 100644 --- a/source/blender/draw/engines/external/external_engine.c +++ b/source/blender/draw/engines/external/external_engine.c @@ -108,7 +108,7 @@ static void external_engine_init(void *vedata) const DRWContextState *draw_ctx = DRW_context_state_get(); ARegion *region = draw_ctx->region; - /* Depth prepass */ + /* Depth pre-pass. */ if (!e_data.depth_sh) { const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[GPU_SHADER_CFG_DEFAULT]; diff --git a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c index f2472699300..33b91efc848 100644 --- a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c +++ b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c @@ -365,7 +365,7 @@ GPENCIL_tLayer *gpencil_layer_cache_add(GPENCIL_PrivateData *pd, DRW_shgroup_call_procedural_triangles(grp, NULL, 1); if (gpl->blend_mode == eGplBlendMode_HardLight) { - /* We cannot do custom blending on MultiTarget framebuffers. + /* We cannot do custom blending on Multi-Target frame-buffers. * Workaround by doing 2 passes. */ grp = DRW_shgroup_create(sh, tgp_layer->blend_ps); DRW_shgroup_state_disable(grp, DRW_STATE_BLEND_MUL); diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c index 6627d38366f..e738b0d063c 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@ -281,7 +281,7 @@ void GPENCIL_cache_init(void *ved) }); } else { - /* Free uneeded buffers. */ + /* Free unneeded buffers. */ GPU_FRAMEBUFFER_FREE_SAFE(fbl->snapshot_fb); DRW_TEXTURE_FREE_SAFE(txl->snapshot_depth_tx); DRW_TEXTURE_FREE_SAFE(txl->snapshot_color_tx); @@ -333,7 +333,7 @@ void GPENCIL_cache_init(void *ved) pd->dof_params[0] = -focus_dist * pd->dof_params[1]; } else { - /* Disable DoF blur scalling. */ + /* Disable DoF blur scaling. */ pd->camera = NULL; } } @@ -346,7 +346,7 @@ typedef struct gpIterPopulateData { GPENCIL_PrivateData *pd; GPENCIL_MaterialPool *matpool; DRWShadingGroup *grp; - /* Last material UBO bound. Used to avoid uneeded buffer binding. */ + /* Last material UBO bound. Used to avoid unneeded buffer binding. */ GPUUniformBuf *ubo_mat; GPUUniformBuf *ubo_lights; /* Last texture bound. */ @@ -385,7 +385,7 @@ static void gpencil_drawcall_flush(gpIterPopulateData *iter) iter->vcount = 0; } -/* Group drawcalls that are consecutive and with the same type. Reduces GPU driver overhead. */ +/* Group draw-calls that are consecutive and with the same type. Reduces GPU driver overhead. */ static void gpencil_drawcall_add( gpIterPopulateData *iter, struct GPUBatch *geom, bool instancing, int v_first, int v_count) { @@ -399,7 +399,7 @@ static void gpencil_drawcall_add( #endif int last = iter->vfirst + iter->vcount; - /* Interupt drawcall grouping if the sequence is not consecutive. */ + /* Interrupt draw-call grouping if the sequence is not consecutive. */ if ((geom != iter->geom) || (v_first - last > 3)) { gpencil_drawcall_flush(iter); } @@ -686,7 +686,7 @@ void GPENCIL_cache_finish(void *ved) /* Sort object by decreasing Z to avoid most of alpha ordering issues. */ gpencil_object_cache_sort(pd); - /* Create framebuffers only if needed. */ + /* Create frame-buffers only if needed. */ if (pd->tobjects.first) { eGPUTextureFormat format = pd->use_signed_fb ? GPU_RGBA16F : GPU_R11F_G11F_B10F; diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h index 2b07ea53187..5ceb909bc88 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.h +++ b/source/blender/draw/engines/gpencil/gpencil_engine.h @@ -110,7 +110,7 @@ BLI_STATIC_ASSERT_ALIGN(gpLight, 16) typedef struct GPENCIL_MaterialPool { /* Linklist. */ struct GPENCIL_MaterialPool *next; - /* GPU representatin of materials. */ + /* GPU representation of materials. */ gpMaterial mat_data[GP_MATERIAL_BUFFER_LEN]; /* Matching ubo. */ struct GPUUniformBuf *ubo; @@ -122,7 +122,7 @@ typedef struct GPENCIL_MaterialPool { } GPENCIL_MaterialPool; typedef struct GPENCIL_LightPool { - /* GPU representatin of materials. */ + /* GPU representation of materials. */ gpLight light_data[GPENCIL_LIGHT_BUFFER_LEN]; /* Matching ubo. */ struct GPUUniformBuf *ubo; @@ -151,7 +151,7 @@ typedef struct GPENCIL_tVfx { /** Linklist */ struct GPENCIL_tVfx *next; DRWPass *vfx_ps; - /* Framebuffer reference since it may not be allocated yet. */ + /* Frame-buffer reference since it may not be allocated yet. */ GPUFrameBuffer **target_fb; } GPENCIL_tVfx; @@ -352,7 +352,7 @@ typedef struct GPENCIL_PrivateData { bool use_lighting; /* Use physical lights or just ambient lighting. */ bool use_lights; - /* Do we need additional framebuffers? */ + /* Do we need additional frame-buffers? */ bool use_layer_fb; bool use_object_fb; bool use_mask_fb; diff --git a/source/blender/draw/engines/gpencil/gpencil_render.c b/source/blender/draw/engines/gpencil/gpencil_render.c index 9ac9a4dc078..b597a786e86 100644 --- a/source/blender/draw/engines/gpencil/gpencil_render.c +++ b/source/blender/draw/engines/gpencil/gpencil_render.c @@ -47,7 +47,7 @@ void GPENCIL_render_init(GPENCIL_Data *vedata, const float *viewport_size = DRW_viewport_size_get(); const int size[2] = {(int)viewport_size[0], (int)viewport_size[1]}; - /* Set the pers & view matrix. */ + /* Set the perspective & view matrix. */ float winmat[4][4], viewmat[4][4], viewinv[4][4]; struct Object *camera = DEG_get_evaluated_object(depsgraph, RE_GetCamera(engine->re)); diff --git a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c index f4af5ebff99..0b66141e51a 100644 --- a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c +++ b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c @@ -397,7 +397,7 @@ static void gpencil_vfx_shadow(ShadowShaderFxData *fx, Object *ob, gpIterVfxData unit_m4(uv_mat); zero_v2(wave_ofs); - /* We reseted the uv_mat so we need to accound for the rotation in the */ + /* We reset the uv_mat so we need to account for the rotation in the */ copy_v2_fl2(tmp, 0.0f, blur_size[1]); rotate_v2_v2fl(blur_dir, tmp, -fx->rotation); mul_v2_v2(blur_dir, vp_size_inv); diff --git a/source/blender/draw/engines/overlay/overlay_antialiasing.c b/source/blender/draw/engines/overlay/overlay_antialiasing.c index 229f9c5a88f..c602e536f79 100644 --- a/source/blender/draw/engines/overlay/overlay_antialiasing.c +++ b/source/blender/draw/engines/overlay/overlay_antialiasing.c @@ -93,7 +93,7 @@ void OVERLAY_antialiasing_init(OVERLAY_Data *vedata) line_tex = txl->overlay_line_tx; } else { - /* Just a copy of the defaults framebuffers. */ + /* Just a copy of the defaults frame-buffers. */ color_tex = dtxl->color_overlay; } diff --git a/source/blender/draw/engines/overlay/overlay_armature.c b/source/blender/draw/engines/overlay/overlay_armature.c index cbd2589f20f..7042d095b56 100644 --- a/source/blender/draw/engines/overlay/overlay_armature.c +++ b/source/blender/draw/engines/overlay/overlay_armature.c @@ -1691,13 +1691,13 @@ static void draw_bone_degrees_of_freedom(ArmatureDrawContext *ctx, bPoseChannel unit_m4(posetrans); translate_m4(posetrans, pchan->pose_mat[3][0], pchan->pose_mat[3][1], pchan->pose_mat[3][2]); - /* in parent-bone pose space... */ + /* In parent-bone pose space... */ if (pchan->parent) { copy_m4_m4(tmp, pchan->parent->pose_mat); zero_v3(tmp[3]); mul_m4_m4m4(posetrans, posetrans, tmp); } - /* ... but own restspace */ + /* ... but own rest-space. */ mul_m4_m4m3(posetrans, posetrans, pchan->bone->bone_mat); float scale = pchan->bone->length * pchan->size[1]; diff --git a/source/blender/draw/engines/overlay/overlay_edit_mesh.c b/source/blender/draw/engines/overlay/overlay_edit_mesh.c index 38e171cb5e2..40a9dbe01c0 100644 --- a/source/blender/draw/engines/overlay/overlay_edit_mesh.c +++ b/source/blender/draw/engines/overlay/overlay_edit_mesh.c @@ -344,7 +344,7 @@ void OVERLAY_edit_mesh_draw(OVERLAY_Data *vedata) if (pd->edit_mesh.do_zbufclip) { DRW_draw_pass(psl->edit_mesh_depth_ps[IN_FRONT]); - /* render facefill */ + /* Render face-fill. */ DRW_view_set_active(pd->view_edit_faces); DRW_draw_pass(psl->edit_mesh_faces_ps[NOT_IN_FRONT]); diff --git a/source/blender/draw/engines/overlay/overlay_edit_uv.c b/source/blender/draw/engines/overlay/overlay_edit_uv.c index 06ef56a212b..22433905b75 100644 --- a/source/blender/draw/engines/overlay/overlay_edit_uv.c +++ b/source/blender/draw/engines/overlay/overlay_edit_uv.c @@ -403,8 +403,8 @@ void OVERLAY_edit_uv_cache_init(OVERLAY_Data *vedata) * has the correct batches with the correct selection state. See T83187. */ if (pd->edit_uv.do_uv_overlay || pd->edit_uv.do_uv_shadow_overlay) { uint objects_len = 0; - Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs( - draw_ctx->view_layer, NULL, &objects_len); + Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data( + draw_ctx->view_layer, NULL, &objects_len, draw_ctx->object_mode); for (uint ob_index = 0; ob_index < objects_len; ob_index++) { Object *object_eval = DEG_get_evaluated_object(draw_ctx->depsgraph, objects[ob_index]); DRW_mesh_batch_cache_validate((Mesh *)object_eval->data); diff --git a/source/blender/draw/engines/overlay/overlay_extra.c b/source/blender/draw/engines/overlay/overlay_extra.c index 39f17581e0d..91e605bf0ae 100644 --- a/source/blender/draw/engines/overlay/overlay_extra.c +++ b/source/blender/draw/engines/overlay/overlay_extra.c @@ -642,10 +642,10 @@ void OVERLAY_light_cache_populate(OVERLAY_Data *vedata, Object *ob) } instdata; copy_m4_m4(instdata.mat, ob->obmat); - /* FIXME / TODO: clipend has no meaning nowadays. - * In EEVEE, Only clipsta is used shadowmaping. + /* FIXME / TODO: clip_end has no meaning nowadays. + * In EEVEE, Only clip_sta is used shadow-mapping. * Clip end is computed automatically based on light power. - * For now, always use the custom distance as clipend. */ + * For now, always use the custom distance as clip_end. */ instdata.clip_end = la->att_dist; instdata.clip_sta = la->clipsta; diff --git a/source/blender/draw/engines/overlay/overlay_metaball.c b/source/blender/draw/engines/overlay/overlay_metaball.c index f973c1eda8a..46076a7c88b 100644 --- a/source/blender/draw/engines/overlay/overlay_metaball.c +++ b/source/blender/draw/engines/overlay/overlay_metaball.c @@ -63,7 +63,7 @@ static void metaball_instance_data_set( mul_v3_v3fl(data->mat[1], ob->obmat[1], radius / 0.05f); mul_v3_v3fl(data->mat[2], ob->obmat[2], radius / 0.05f); mul_v3_m4v3(data->mat[3], ob->obmat, pos); - /* WATCH: Reminder, alpha is wiresize. */ + /* WATCH: Reminder, alpha is wire-size. */ OVERLAY_bone_instance_data_set_color(data, color); } diff --git a/source/blender/draw/engines/overlay/overlay_particle.c b/source/blender/draw/engines/overlay/overlay_particle.c index fa95bad4d86..71064e7ff47 100644 --- a/source/blender/draw/engines/overlay/overlay_particle.c +++ b/source/blender/draw/engines/overlay/overlay_particle.c @@ -185,7 +185,7 @@ void OVERLAY_particle_cache_populate(OVERLAY_Data *vedata, Object *ob) /* TODO(fclem): Here would be a good place for preemptive culling. */ - /* fclem: Is color even usefull in our modern context? */ + /* NOTE(fclem): Is color even useful in our modern context? */ Material *ma = BKE_object_material_get(ob, part->omat); float color[4] = {0.6f, 0.6f, 0.6f, part->draw_size}; if (ma != NULL) { diff --git a/source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl index eaa553a10de..9bd49bb84f8 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl @@ -288,7 +288,7 @@ void main() ls_ray_dir -= ls_ray_ori; - /* TODO: Align rays to volume center so that it mimics old behaviour of slicing the volume. */ + /* TODO: Align rays to volume center so that it mimics old behavior of slicing the volume. */ float dist = line_unit_box_intersect_dist(ls_ray_ori, ls_ray_dir); if (dist > 0.0) { diff --git a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c index 20c30d9ce68..feb48b2623d 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c +++ b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c @@ -75,7 +75,7 @@ static void workbench_taa_jitter_init_order(float (*table)[2], int num) swap_v2_v2(table[0], table[closest_index]); } - /* sort list based on furtest distance with previous */ + /* Sort list based on farthest distance with previous. */ for (int i = 0; i < num - 2; i++) { float f_squared_dist = 0.0; int f_index = i; diff --git a/source/blender/draw/engines/workbench/workbench_effect_dof.c b/source/blender/draw/engines/workbench/workbench_effect_dof.c index 73cd501190f..a00453fe125 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_dof.c +++ b/source/blender/draw/engines/workbench/workbench_effect_dof.c @@ -104,7 +104,7 @@ static void workbench_dof_setup_samples(struct GPUUniformBuf **ubo, square_to_circle(x, y, &r, &T); samp[2] = r; - /* Bokeh shape parametrisation */ + /* Bokeh shape parameterization. */ if (bokeh_sides > 1.0f) { float denom = T - (2.0 * M_PI / bokeh_sides) * floorf((bokeh_sides * T + M_PI) / (2.0 * M_PI)); diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c index 6aa794bda51..6e9118bfe46 100644 --- a/source/blender/draw/engines/workbench/workbench_materials.c +++ b/source/blender/draw/engines/workbench/workbench_materials.c @@ -76,7 +76,7 @@ void workbench_material_ubo_data(WORKBENCH_PrivateData *wpd, alpha *= mat->a; copy_v3_v3(data->base_color, &mat->r); metallic = mat->metallic; - roughness = sqrtf(mat->roughness); /* Remap to disney roughness. */ + roughness = sqrtf(mat->roughness); /* Remap to Disney roughness. */ } else { copy_v3_fl(data->base_color, 0.8f); diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h index d157c260fbd..522aae7f542 100644 --- a/source/blender/draw/engines/workbench/workbench_private.h +++ b/source/blender/draw/engines/workbench/workbench_private.h @@ -225,7 +225,7 @@ BLI_STATIC_ASSERT_ALIGN(WORKBENCH_UBO_Material, 16) typedef struct WORKBENCH_Prepass { /** Hash storing shading group for each Material or GPUTexture to reduce state changes. */ struct GHash *material_hash; - /** First common (non-vcol and non-image colored) shading group to created subgroups. */ + /** First common (non-vertex-color and non-image-colored) shading group to created subgroups. */ struct DRWShadingGroup *common_shgrp; /** First Vertex Color shading group to created subgroups. */ struct DRWShadingGroup *vcol_shgrp; @@ -384,7 +384,7 @@ typedef struct WORKBENCH_ViewLayerData { struct GPUUniformBuf *cavity_sample_ubo; /** Blue noise texture used to randomize the sampling of some effects.*/ struct GPUTexture *cavity_jitter_tx; - /** Materials ubos allocated in a memblock for easy bookeeping. */ + /** Materials UBO's allocated in a memblock for easy bookkeeping. */ struct BLI_memblock *material_ubo; struct BLI_memblock *material_ubo_data; /** Number of samples for which cavity_sample_ubo is valid. */ diff --git a/source/blender/draw/engines/workbench/workbench_shadow.c b/source/blender/draw/engines/workbench/workbench_shadow.c index 881c186e3e5..99d945c311e 100644 --- a/source/blender/draw/engines/workbench/workbench_shadow.c +++ b/source/blender/draw/engines/workbench/workbench_shadow.c @@ -157,7 +157,7 @@ void workbench_shadow_cache_init(WORKBENCH_Data *data) DRWState state = DRW_STATE_DEPTH_LESS | DRW_STATE_STENCIL_ALWAYS; #endif - /* TODO(fclem): Merge into one pass with subpasses. */ + /* TODO(fclem): Merge into one pass with sub-passes. */ DRW_PASS_CREATE(psl->shadow_ps[0], state | depth_pass_state); DRW_PASS_CREATE(psl->shadow_ps[1], state | depth_fail_state); diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 4a43107c612..2545cfa65dc 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -93,7 +93,7 @@ typedef char DRWViewportEmptyList; #define DRW_VIEWPORT_LIST_SIZE(list) \ (sizeof(list) == sizeof(DRWViewportEmptyList) ? 0 : ((sizeof(list)) / sizeof(void *))) -/* Unused members must be either pass list or 'char *' when not usd. */ +/* Unused members must be either pass list or 'char *' when not used. */ #define DRW_VIEWPORT_DATA_SIZE(ty) \ { \ DRW_VIEWPORT_LIST_SIZE(*(((ty *)NULL)->fbl)), DRW_VIEWPORT_LIST_SIZE(*(((ty *)NULL)->txl)), \ @@ -327,14 +327,14 @@ typedef enum { /** Culling test */ DRW_STATE_CULL_BACK = (1 << 7), DRW_STATE_CULL_FRONT = (1 << 8), - /** Stencil test . These options are mutal exclusive and packed into 2 bits*/ + /** Stencil test . These options are mutually exclusive and packed into 2 bits. */ DRW_STATE_STENCIL_ALWAYS = (1 << 9), DRW_STATE_STENCIL_EQUAL = (2 << 9), DRW_STATE_STENCIL_NEQUAL = (3 << 9), /** Blend state. These options are mutual exclusive and packed into 4 bits */ DRW_STATE_BLEND_ADD = (1 << 11), - /** Same as additive but let alpha accumulate without premult. */ + /** Same as additive but let alpha accumulate without pre-multiply. */ DRW_STATE_BLEND_ADD_FULL = (2 << 11), /** Standard alpha blending. */ DRW_STATE_BLEND_ALPHA = (3 << 11), diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index 5333f59bf38..fcd626eb92b 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -1325,7 +1325,7 @@ GPUBatch *DRW_cache_field_vortex_get(void) #undef SPIRAL_RESOL } -/* Screenaligned circle. */ +/* Screen-aligned circle. */ GPUBatch *DRW_cache_field_curve_get(void) { #define CIRCLE_RESOL 32 @@ -1414,7 +1414,7 @@ GPUBatch *DRW_cache_field_cone_limit_get(void) #undef CIRCLE_RESOL } -/* Screenaligned dashed circle */ +/* Screen-aligned dashed circle */ GPUBatch *DRW_cache_field_sphere_limit_get(void) { #define CIRCLE_RESOL 32 @@ -3385,7 +3385,7 @@ GPUBatch *DRW_cache_particles_get_prim(int type) int v = 0; int flag = VCLASS_EMPTY_AXES; - /* Set minimum to 0.001f so we can easilly normalize to get the color. */ + /* Set minimum to 0.001f so we can easily normalize to get the color. */ GPU_vertbuf_vert_set(vbo, v++, &(Vert){{0.0f, 0.0001f, 0.0f}, flag}); GPU_vertbuf_vert_set(vbo, v++, &(Vert){{0.0f, 2.0f, 0.0f}, flag}); GPU_vertbuf_vert_set(vbo, v++, &(Vert){{0.0001f, 0.0f, 0.0f}, flag}); diff --git a/source/blender/draw/intern/draw_cache.h b/source/blender/draw/intern/draw_cache.h index 9fd7ffd4692..c15c246992d 100644 --- a/source/blender/draw/intern/draw_cache.h +++ b/source/blender/draw/intern/draw_cache.h @@ -239,7 +239,7 @@ typedef struct DRWVolumeGrid { float texture_to_object[4][4]; float object_to_texture[4][4]; - /* Transfrom from bounds to texture space. */ + /* Transform from bounds to texture space. */ float object_to_bounds[4][4]; float bounds_to_texture[4][4]; } DRWVolumeGrid; diff --git a/source/blender/draw/intern/draw_cache_impl_displist.c b/source/blender/draw/intern/draw_cache_impl_displist.c index 72f3e7b0fa8..d606f70db9e 100644 --- a/source/blender/draw/intern/draw_cache_impl_displist.c +++ b/source/blender/draw/intern/draw_cache_impl_displist.c @@ -774,7 +774,7 @@ void DRW_displist_vertbuf_create_loop_pos_and_nor_and_uv_and_tan(ListBase *lb, } } -/* Edge detection/adjecency */ +/* Edge detection/adjacency. */ #define NO_EDGE INT_MAX static void set_edge_adjacency_lines_indices( EdgeHash *eh, GPUIndexBufBuilder *elb, bool *r_is_manifold, uint v1, uint v2, uint v3) diff --git a/source/blender/draw/intern/draw_cache_impl_hair.c b/source/blender/draw/intern/draw_cache_impl_hair.c index 327a92a997e..fd28ac00186 100644 --- a/source/blender/draw/intern/draw_cache_impl_hair.c +++ b/source/blender/draw/intern/draw_cache_impl_hair.c @@ -318,7 +318,7 @@ bool hair_ensure_procedural_data(Object *object, HairBatchCache *cache = hair_batch_cache_get(hair); *r_hair_cache = &cache->hair; - const int steps = 2; /* TODO: don't hardcode? */ + const int steps = 2; /* TODO: don't hard-code? */ (*r_hair_cache)->final[subdiv].strands_res = 1 << (steps + subdiv); /* Refreshed on combing and simulation. */ diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 3f014a01680..1a1caa2943a 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -405,7 +405,7 @@ static void drw_mesh_weight_state_extract(Object *ob, &wstate->defgroup_sel_count); } } - /* With only one selected bone Multipaint reverts to regular mode. */ + /* With only one selected bone Multi-paint reverts to regular mode. */ else { wstate->defgroup_sel_count = 0; MEM_SAFE_FREE(wstate->defgroup_sel); diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c index 5029e71cac8..fef8ba4b606 100644 --- a/source/blender/draw/intern/draw_common.c +++ b/source/blender/draw/intern/draw_common.c @@ -161,7 +161,7 @@ void DRW_globals_update(void) /* Grid */ UI_GetThemeColorShade4fv(TH_GRID, 10, gb->colorGrid); - /* emphasise division lines lighter instead of darker, if background is darker than grid */ + /* Emphasize division lines lighter instead of darker, if background is darker than grid. */ UI_GetThemeColorShade4fv( TH_GRID, (gb->colorGrid[0] + gb->colorGrid[1] + gb->colorGrid[2] + 0.12f > @@ -333,7 +333,7 @@ int DRW_object_wire_theme_get(Object *ob, ViewLayer *view_layer, float **r_color theme_id = TH_EMPTY; break; case OB_LIGHTPROBE: - /* TODO add lightprobe color */ + /* TODO: add light-probe color. */ theme_id = TH_EMPTY; break; default: diff --git a/source/blender/draw/intern/draw_hair.c b/source/blender/draw/intern/draw_hair.c index 86f1b0e0ebb..bca227a24e2 100644 --- a/source/blender/draw/intern/draw_hair.c +++ b/source/blender/draw/intern/draw_hair.c @@ -320,7 +320,7 @@ void DRW_hair_update(void) max_size = max_ii(max_size, pr_call->vert_len); } - /* Create target Texture / Framebuffer */ + /* Create target Texture / Frame-buffer */ /* Don't use max size as it can be really heavy and fail. * Do chunks of maximum 2048 * 2048 hair points. */ int width = 2048; diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index cf78959e712..fd40d38d238 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -1570,13 +1570,13 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph, drw_engines_enable(view_layer, engine_type, gpencil_engine_needed); drw_engines_data_validate(); - /* Update ubos */ + /* Update UBO's */ DRW_globals_update(); drw_debug_init(); DRW_hair_init(); - /* No framebuffer allowed before drawing. */ + /* No frame-buffer allowed before drawing. */ BLI_assert(GPU_framebuffer_active_get() == GPU_framebuffer_back_get()); /* Init engines */ @@ -1642,7 +1642,7 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph, DRW_draw_callbacks_post_scene(); if (WM_draw_region_get_bound_viewport(region)) { - /* Don't unbind the framebuffer yet in this case and let + /* Don't unbind the frame-buffer yet in this case and let * GPU_viewport_unbind do it, so that we can still do further * drawing of action zones on top. */ } @@ -1715,7 +1715,12 @@ void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph, GPU_matrix_identity_set(); GPU_matrix_identity_projection_set(); - const bool do_overlays = (v3d->flag2 & V3D_HIDE_OVERLAYS) == 0; + const bool do_overlays = (v3d->flag2 & V3D_HIDE_OVERLAYS) == 0 || + (ELEM(v3d->shading.type, OB_WIRE, OB_SOLID)) || + (ELEM(v3d->shading.type, OB_MATERIAL) && + (v3d->shading.flag & V3D_SHADING_SCENE_WORLD) == 0) || + (ELEM(v3d->shading.type, OB_RENDER) && + (v3d->shading.flag & V3D_SHADING_SCENE_WORLD_RENDER) == 0); GPU_viewport_unbind_from_offscreen(render_viewport, ofs, do_color_management, do_overlays); if (draw_background) { @@ -2083,12 +2088,12 @@ void DRW_draw_render_loop_2d_ex(struct Depsgraph *depsgraph, drw_engines_enable_editors(); drw_engines_data_validate(); - /* Update ubos */ + /* Update UBO's */ DRW_globals_update(); drw_debug_init(); - /* No framebuffer allowed before drawing. */ + /* No frame-buffer allowed before drawing. */ BLI_assert(GPU_framebuffer_active_get() == GPU_framebuffer_back_get()); GPU_framebuffer_bind(DST.default_framebuffer); GPU_framebuffer_clear_depth_stencil(DST.default_framebuffer, 1.0f, 0xFF); @@ -2186,7 +2191,7 @@ void DRW_draw_render_loop_2d_ex(struct Depsgraph *depsgraph, GPU_depth_test(GPU_DEPTH_LESS_EQUAL); if (WM_draw_region_get_bound_viewport(region)) { - /* Don't unbind the framebuffer yet in this case and let + /* Don't unbind the frame-buffer yet in this case and let * GPU_viewport_unbind do it, so that we can still do further * drawing of action zones on top. */ } @@ -2368,7 +2373,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, drw_context_state_init(); drw_viewport_var_init(); - /* Update ubos */ + /* Update UBO's */ DRW_globals_update(); /* Init engines */ @@ -2440,7 +2445,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, DRW_render_instance_buffer_finish(); } - /* Setup framebuffer */ + /* Setup frame-buffer. */ draw_select_framebuffer_depth_only_setup(viewport_size); GPU_framebuffer_bind(g_select_buffer.framebuffer_depth_only); GPU_framebuffer_clear_depth(g_select_buffer.framebuffer_depth_only, 1.0f); @@ -2516,7 +2521,7 @@ static void drw_draw_depth_loop_impl(struct Depsgraph *depsgraph, drw_task_graph_init(); drw_engines_data_validate(); - /* Setup framebuffer */ + /* Setup frame-buffer. */ DefaultFramebufferList *fbl = (DefaultFramebufferList *)GPU_viewport_framebuffer_list_get( DST.viewport); GPU_framebuffer_bind(fbl->depth_only_fb); @@ -2526,7 +2531,7 @@ static void drw_draw_depth_loop_impl(struct Depsgraph *depsgraph, drw_context_state_init(); drw_viewport_var_init(); - /* Update ubos */ + /* Update UBO's */ DRW_globals_update(); /* Init engines */ @@ -2582,7 +2587,7 @@ static void drw_draw_depth_loop_impl(struct Depsgraph *depsgraph, drw_state_ensure_not_reused(&DST); #endif - /* Changin context */ + /* Changing context. */ if (use_opengl_context) { DRW_opengl_context_disable(); } @@ -2666,7 +2671,7 @@ void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d, cons DST.viewport = viewport; drw_viewport_var_init(); - /* Update ubos */ + /* Update UBO's */ DRW_globals_update(); /* Init Select Engine */ @@ -2723,7 +2728,7 @@ void DRW_draw_depth_object( GPU_matrix_set(rv3d->viewmat); GPU_matrix_mul(object->obmat); - /* Setup framebuffer */ + /* Setup frame-buffer. */ DefaultFramebufferList *fbl = GPU_viewport_framebuffer_list_get(viewport); GPU_framebuffer_bind(fbl->depth_only_fb); diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h index 3ab60bc3c96..f540ff09032 100644 --- a/source/blender/draw/intern/draw_manager.h +++ b/source/blender/draw/intern/draw_manager.h @@ -266,14 +266,14 @@ typedef union DRWCommand { DRWCommandClear clear; } DRWCommand; -/* Used for agregating calls into GPUVertBufs. */ +/** Used for aggregating calls into #GPUVertBuf's. */ struct DRWCallBuffer { GPUVertBuf *buf; GPUVertBuf *buf_select; int count; }; -/* Used by DRWUniform.type */ +/** Used by #DRWUniform.type */ typedef enum { DRW_UNIFORM_INT = 0, DRW_UNIFORM_INT_COPY, @@ -324,8 +324,8 @@ struct DRWUniform { /* DRW_UNIFORM_BLOCK_OBATTRS */ struct GPUUniformAttrList *uniform_attrs; }; - int location; /* Uniform location or binding point for textures and ubos. */ - uint8_t type; /* DRWUniformType */ + int location; /* Uniform location or binding point for textures and UBO's. */ + uint8_t type; /* #DRWUniformType */ uint8_t length; /* Length of vector types. */ uint8_t arraysize; /* Array size of scalar/vector types. */ }; diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index 57b3373932e..6bdc5305fed 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -978,7 +978,7 @@ static void drw_sculpt_get_frustum_planes(Object *ob, float planes[6][4]) static void drw_sculpt_generate_calls(DRWSculptCallbackData *scd) { - /* PBVH should always exist for non-empty meshes, created by depsgrah eval. */ + /* PBVH should always exist for non-empty meshes, created by depsgraph eval. */ PBVH *pbvh = (scd->ob->sculpt) ? scd->ob->sculpt->pbvh : NULL; if (!pbvh) { return; @@ -1601,10 +1601,10 @@ static void draw_frustum_bound_sphere_calc(const BoundBox *bbox, /* Detect which of the corner of the far clipping plane is the farthest to the origin */ float nfar[4]; /* most extreme far point in NDC space */ - float farxy[2]; /* farpoint projection onto the near plane */ + float farxy[2]; /* far-point projection onto the near plane */ float farpoint[3] = {0.0f}; /* most extreme far point in camera coordinate */ float nearpoint[3]; /* most extreme near point in camera coordinate */ - float farcenter[3] = {0.0f}; /* center of far cliping plane in camera coordinate */ + float farcenter[3] = {0.0f}; /* center of far clipping plane in camera coordinate */ float F = -1.0f, N; /* square distance of far and near point to origin */ float f, n; /* distance of far and near point to z axis. f is always > 0 but n can be < 0 */ float e, s; /* far and near clipping distance (<0) */ diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c index 67778584d25..4c8fcb0e016 100644 --- a/source/blender/draw/intern/draw_manager_exec.c +++ b/source/blender/draw/intern/draw_manager_exec.c @@ -272,7 +272,7 @@ static void drw_stencil_state_set(uint write_mask, uint reference, uint compare_ GPU_stencil_compare_mask_set(compare_mask); } -/* Reset state to not interfer with other UI drawcall */ +/* Reset state to not interfere with other UI draw-call. */ void DRW_state_reset_ex(DRWState state) { DST.state = ~state; @@ -855,7 +855,7 @@ static void draw_call_batching_do(DRWShadingGroup *shgroup, DRWCommandsState *state, DRWCommandDraw *call) { - /* If any condition requires to interupt the merging. */ + /* If any condition requires to interrupt the merging. */ bool neg_scale = DRW_handle_negative_scale_get(&call->handle); int chunk = DRW_handle_chunk_get(&call->handle); int id = DRW_handle_id_get(&call->handle); diff --git a/source/blender/draw/intern/draw_manager_texture.c b/source/blender/draw/intern/draw_manager_texture.c index 8b948e62cf3..e9432f370b8 100644 --- a/source/blender/draw/intern/draw_manager_texture.c +++ b/source/blender/draw/intern/draw_manager_texture.c @@ -26,7 +26,7 @@ /* Maybe gpu_texture.c is a better place for this. */ static bool drw_texture_format_supports_framebuffer(eGPUTextureFormat format) { - /* Some formats do not work with framebuffers. */ + /* Some formats do not work with frame-buffers. */ switch (format) { /* Only add formats that are COMPATIBLE with FB. * Generally they are multiple of 16bit. */ diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 64fa93773b9..24bb58535a5 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -430,7 +430,7 @@ static bool acf_generic_dataexpand_setting_valid(bAnimContext *ac, case ACHANNEL_SETTING_MUTE: return ((ac) && (ac->spacetype == SPACE_NLA)); - /* select is ok for most "ds*" channels (e.g. dsmat) */ + /* Select is ok for most `ds*` channels (e.g. `dsmat`) */ case ACHANNEL_SETTING_SELECT: return true; diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 7afb03b833d..109cf79c786 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -1736,7 +1736,7 @@ static int animchannels_group_exec(bContext *C, wmOperator *op) /* free temp data */ ANIM_animdata_freelist(&anim_data); - /* updatss */ + /* Updates. */ WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); } diff --git a/source/blender/editors/animation/anim_motion_paths.c b/source/blender/editors/animation/anim_motion_paths.c index 088ac9dbcba..bd7d0eed2c9 100644 --- a/source/blender/editors/animation/anim_motion_paths.c +++ b/source/blender/editors/animation/anim_motion_paths.c @@ -331,7 +331,7 @@ static void motionpath_calculate_update_range(MPathTarget *mpt, int fcu_sfra = motionpath_get_prev_prev_keyframe(mpt, &fcu_keys, current_frame); int fcu_efra = motionpath_get_next_next_keyframe(mpt, &fcu_keys, current_frame); - /* Extend range furher, since accelleration compensation propagates even further away. */ + /* Extend range fuhrer, since acceleration compensation propagates even further away. */ if (fcu->auto_smoothing != FCURVE_SMOOTH_NONE) { fcu_sfra = motionpath_get_prev_prev_keyframe(mpt, &fcu_keys, fcu_sfra); fcu_efra = motionpath_get_next_next_keyframe(mpt, &fcu_keys, fcu_efra); diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index db3a1b99135..0d1633ab3a2 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -614,7 +614,7 @@ int insert_vert_fcurve( return -1; } - /* set handletype and interpolation */ + /* Set handle-type and interpolation. */ if ((fcu->totvert > 2) && (flag & INSERTKEY_REPLACE) == 0) { BezTriple *bezt = (fcu->bezt + a); diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c index e538c20df6c..68fff1091af 100644 --- a/source/blender/editors/armature/armature_add.c +++ b/source/blender/editors/armature/armature_add.c @@ -122,9 +122,6 @@ EditBone *ED_armature_ebone_add_primitive(Object *obedit_arm, float length, bool return bone; } -/* previously addvert_armature */ -/* the ctrl-click method */ - /** * Note this is already ported to multi-objects as it is. * Since only the active bone is extruded even for single objects, diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c index fba88e78162..3d1d8d0d1f1 100644 --- a/source/blender/editors/armature/armature_utils.c +++ b/source/blender/editors/armature/armature_utils.c @@ -699,11 +699,11 @@ void ED_armature_from_edit(Main *bmain, bArmature *arm) BKE_armature_bonelist_free(&arm->bonebase, true); arm->act_bone = NULL; - /* remove zero sized bones, this gives unstable restposes */ + /* Remove zero sized bones, this gives unstable rest-poses. */ for (eBone = arm->edbo->first; eBone; eBone = neBone) { float len_sq = len_squared_v3v3(eBone->head, eBone->tail); neBone = eBone->next; - /* TODO(sergey): How to ensure this is a constexpr? */ + /* TODO(sergey): How to ensure this is a `constexpr`? */ if (len_sq <= square_f(0.000001f)) { /* FLT_EPSILON is too large? */ EditBone *fBone; diff --git a/source/blender/editors/armature/editarmature_undo.c b/source/blender/editors/armature/editarmature_undo.c index c6d7d2eb869..337d1138b23 100644 --- a/source/blender/editors/armature/editarmature_undo.c +++ b/source/blender/editors/armature/editarmature_undo.c @@ -178,8 +178,11 @@ static bool armature_undosys_step_encode(struct bContext *C, struct Main *bmain, return true; } -static void armature_undosys_step_decode( - struct bContext *C, struct Main *bmain, UndoStep *us_p, int UNUSED(dir), bool UNUSED(is_final)) +static void armature_undosys_step_decode(struct bContext *C, + struct Main *bmain, + UndoStep *us_p, + const eUndoStepDir UNUSED(dir), + bool UNUSED(is_final)) { ArmatureUndoStep *us = (ArmatureUndoStep *)us_p; diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 3c0b6dacbf6..ae1516dad05 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -422,7 +422,7 @@ static void bvh_callback(void *userdata, int index, const BVHTreeRay *ray, BVHTr } } -/* Raytracing for vertex to bone/vertex visibility */ +/* Ray-tracing for vertex to bone/vertex visibility. */ static void heat_ray_tree_create(LaplacianSystem *sys) { const MLoopTri *looptri = sys->heat.mlooptri; diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 91893af003f..78bce8679bb 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -149,7 +149,7 @@ bool ED_object_posemode_exit(bContext *C, Object *ob) return ok; } -/* if a selected or active bone is protected, throw error (oonly if warn == 1) and return 1 */ +/* if a selected or active bone is protected, throw error (only if warn == 1) and return 1 */ /* only_selected == 1: the active bone is allowed to be protected */ #if 0 /* UNUSED 2.5 */ static bool pose_has_protected_selected(Object *ob, short warn) diff --git a/source/blender/editors/armature/pose_group.c b/source/blender/editors/armature/pose_group.c index 55c9877e55f..38d15d8b880 100644 --- a/source/blender/editors/armature/pose_group.c +++ b/source/blender/editors/armature/pose_group.c @@ -423,7 +423,7 @@ static int group_sort_exec(bContext *C, wmOperator *UNUSED(op)) BLI_addtail(&pose->agroups, agrp_array[i].agrp); } - /* fix changed bone group indizes in bones */ + /* Fix changed bone group indices in bones. */ for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { for (i = 0; i < agrp_count; i++) { if (pchan->agrp_index == agrp_array[i].index) { diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index 947e2dbf5aa..45f623f3a9d 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -1106,7 +1106,7 @@ static void poselib_keytag_pose(bContext *C, Scene *scene, tPoseLib_PreviewData if (pchan) { if (!any_bone_selected || ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED))) { if (autokey) { - /* add datasource override for the PoseChannel, to be used later */ + /* Add data-source override for the PoseChannel, to be used later. */ ANIM_relative_keyingset_add_source(&dsources, &pld->ob->id, &RNA_PoseBone, pchan); /* clear any unkeyed tags */ @@ -1142,7 +1142,7 @@ static void poselib_preview_apply(bContext *C, wmOperator *op) /* only recalc pose (and its dependencies) if pose has changed */ if (pld->redraw == PL_PREVIEW_REDRAWALL) { - /* don't clear pose if firsttime */ + /* Don't clear pose if first time. */ if ((pld->flag & PL_PREVIEW_FIRSTTIME) == 0) { poselib_backup_restore(pld); } diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c index 0b3c3855059..d636f0d68af 100644 --- a/source/blender/editors/armature/pose_slide.c +++ b/source/blender/editors/armature/pose_slide.c @@ -689,7 +689,7 @@ static void pose_slide_rest_pose_apply(bContext *C, tPoseSlideOp *pso) /* Not strictly a transform, but custom properties contribute * to the pose produced in many rigs (e.g. the facial rigs used in Sintel). */ /* TODO Not implemented */ - // pose_slide_apply_props(pso, pfl, "[\""); /* dummy " for texteditor bugs */ + // pose_slide_apply_props(pso, pfl, "[\""); } } @@ -702,7 +702,7 @@ static void pose_slide_apply(bContext *C, tPoseSlideOp *pso) { tPChanFCurveLink *pfl; - /* sanitise the frame ranges */ + /* Sanitize the frame ranges. */ if (pso->prevFrame == pso->nextFrame) { /* move out one step either side */ pso->prevFrame--; @@ -765,7 +765,7 @@ static void pose_slide_apply(bContext *C, tPoseSlideOp *pso) if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_PROPS) && (pfl->oldprops)) { /* Not strictly a transform, but custom properties contribute * to the pose produced in many rigs (e.g. the facial rigs used in Sintel). */ - pose_slide_apply_props(pso, pfl, "[\""); /* dummy " for texteditor bugs */ + pose_slide_apply_props(pso, pfl, "[\""); } } @@ -1125,7 +1125,7 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event) if (event->val == KM_PRESS) { switch (event->type) { /* Transform Channel Limits */ - /* XXX: Replace these hardcoded hotkeys with a modalmap that can be customised */ + /* XXX: Replace these hard-coded hotkeys with a modal-map that can be customized. */ case EVT_GKEY: /* Location */ { pose_slide_toggle_channels_mode(op, pso, PS_TFM_LOC); @@ -1183,7 +1183,7 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event) } } else { - /* unhandled event - maybe it was some view manip? */ + /* unhandled event - maybe it was some view manipulation? */ /* allow to pass through */ return OPERATOR_RUNNING_MODAL | OPERATOR_PASS_THROUGH; } diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c index 3505aea3f40..722865cc942 100644 --- a/source/blender/editors/armature/pose_transform.c +++ b/source/blender/editors/armature/pose_transform.c @@ -225,7 +225,7 @@ static void applyarmature_process_selected_recursive(bArmature *arm, ApplyArmature_ParentState new_pstate = {.bone = bone}; if (BLI_findptr(selected, pchan, offsetof(CollectionPointerLink, ptr.data))) { - /* SELECTED BONE: Snap to final pose transform minus unapplied parent effects. + /* SELECTED BONE: Snap to final pose transform minus un-applied parent effects. * * I.e. bone position with accumulated parent effects but no local * transformation will match the original final pose_mat. diff --git a/source/blender/editors/armature/pose_utils.c b/source/blender/editors/armature/pose_utils.c index 2a6dc9f406b..7e6da7f96b0 100644 --- a/source/blender/editors/armature/pose_utils.c +++ b/source/blender/editors/armature/pose_utils.c @@ -312,7 +312,7 @@ void poseAnim_mapping_autoKeyframe(bContext *C, Scene *scene, ListBase *pfLinks, continue; } - /* add datasource override for the PoseChannel, to be used later */ + /* Add data-source override for the PoseChannel, to be used later. */ ANIM_relative_keyingset_add_source(&dsources, &pfl->ob->id, &RNA_PoseBone, pchan); /* clear any unkeyed tags */ diff --git a/source/blender/editors/curve/editcurve_undo.c b/source/blender/editors/curve/editcurve_undo.c index 534d29c0cc7..681f387e83e 100644 --- a/source/blender/editors/curve/editcurve_undo.c +++ b/source/blender/editors/curve/editcurve_undo.c @@ -238,8 +238,11 @@ static bool curve_undosys_step_encode(struct bContext *C, struct Main *bmain, Un return true; } -static void curve_undosys_step_decode( - struct bContext *C, struct Main *bmain, UndoStep *us_p, int UNUSED(dir), bool UNUSED(is_final)) +static void curve_undosys_step_decode(struct bContext *C, + struct Main *bmain, + UndoStep *us_p, + const eUndoStepDir UNUSED(dir), + bool UNUSED(is_final)) { CurveUndoStep *us = (CurveUndoStep *)us_p; diff --git a/source/blender/editors/curve/editfont_undo.c b/source/blender/editors/curve/editfont_undo.c index 8559234b62f..07f062e7a53 100644 --- a/source/blender/editors/curve/editfont_undo.c +++ b/source/blender/editors/curve/editfont_undo.c @@ -356,8 +356,11 @@ static bool font_undosys_step_encode(struct bContext *C, struct Main *bmain, Und return true; } -static void font_undosys_step_decode( - struct bContext *C, struct Main *bmain, UndoStep *us_p, int UNUSED(dir), bool UNUSED(is_final)) +static void font_undosys_step_decode(struct bContext *C, + struct Main *bmain, + UndoStep *us_p, + const eUndoStepDir UNUSED(dir), + bool UNUSED(is_final)) { /* TODO(campbell): undo_system: use low-level API to set mode. */ ED_object_mode_set_ex(C, OB_MODE_EDIT, false, NULL); diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c index 22a628de8b1..ac75ae44c8a 100644 --- a/source/blender/editors/gpencil/gpencil_convert.c +++ b/source/blender/editors/gpencil/gpencil_convert.c @@ -370,7 +370,7 @@ static int gpencil_find_end_of_stroke_idx(tGpTimingData *gtd, static void gpencil_stroke_path_animation_preprocess_gaps(tGpTimingData *gtd, RNG *rng, int *nbr_gaps, - float *tot_gaps_time) + float *r_tot_gaps_time) { float delta_time = 0.0f; @@ -387,10 +387,10 @@ static void gpencil_stroke_path_animation_preprocess_gaps(tGpTimingData *gtd, } gtd->tot_time -= delta_time; - *tot_gaps_time = (float)(*nbr_gaps) * gtd->gap_duration; - gtd->tot_time += *tot_gaps_time; + *r_tot_gaps_time = (float)(*nbr_gaps) * gtd->gap_duration; + gtd->tot_time += *r_tot_gaps_time; if (G.debug & G_DEBUG) { - printf("%f, %f, %f, %d\n", gtd->tot_time, delta_time, *tot_gaps_time, *nbr_gaps); + printf("%f, %f, %f, %d\n", gtd->tot_time, delta_time, *r_tot_gaps_time, *nbr_gaps); } if (gtd->gap_randomness > 0.0f) { BLI_rng_srandom(rng, gtd->seed); diff --git a/source/blender/editors/gpencil/gpencil_undo.c b/source/blender/editors/gpencil/gpencil_undo.c index e545a3365e9..4e172104ce7 100644 --- a/source/blender/editors/gpencil/gpencil_undo.c +++ b/source/blender/editors/gpencil/gpencil_undo.c @@ -36,6 +36,7 @@ #include "BKE_blender_undo.h" #include "BKE_context.h" #include "BKE_gpencil.h" +#include "BKE_undo_system.h" #include "ED_gpencil.h" @@ -61,19 +62,19 @@ int ED_gpencil_session_active(void) return (BLI_listbase_is_empty(&undo_nodes) == false); } -int ED_undo_gpencil_step(bContext *C, const int step) +int ED_undo_gpencil_step(bContext *C, const eUndoStepDir step) { bGPdata **gpd_ptr = NULL, *new_gpd = NULL; gpd_ptr = ED_gpencil_data_get_pointers(C, NULL); - if (step == -1) { /* undo */ + if (step == STEP_UNDO) { if (cur_node->prev) { cur_node = cur_node->prev; new_gpd = cur_node->gpd; } } - else if (step == 1) { + else if (step == STEP_REDO) { if (cur_node->next) { cur_node = cur_node->next; new_gpd = cur_node->gpd; diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index acaa6495ba9..0136d599e8a 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -62,6 +62,8 @@ struct bAnimContext; struct wmKeyConfig; struct wmOperator; +enum eUndoStepDir; + #define GPENCIL_MINIMUM_JOIN_DIST 20.0f /* Reproject stroke modes. */ @@ -213,7 +215,7 @@ bool ED_gpencil_anim_copybuf_paste(struct bAnimContext *ac, const short copy_mod /* ------------ Grease-Pencil Undo System ------------------ */ int ED_gpencil_session_active(void); -int ED_undo_gpencil_step(struct bContext *C, const int step); +int ED_undo_gpencil_step(struct bContext *C, const enum eUndoStepDir step); /* ------------ Grease-Pencil Armature ------------------ */ bool ED_gpencil_add_armature(const struct bContext *C, diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index c09bf41e152..1820c2f133c 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -433,7 +433,7 @@ void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], * (for anything fancy use UI_GetThemeColor[Fancy] then BLF_color) */ void UI_FontThemeColor(int fontid, int colorid); -/* clear the framebuffer using the input colorid */ +/* Clear the frame-buffer using the input colorid. */ void UI_ThemeClearColor(int colorid); /* internal (blender) usage only, for init and set active */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 4f70d68f495..10cbc2dc5fa 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1422,10 +1422,10 @@ static bool ui_but_event_property_operator_string(const bContext *C, // printf("prop shortcut: '%s' (%s)\n", RNA_property_identifier(prop), data_path); } - /* we have a datapath! */ + /* We have a data-path! */ bool found = false; if (data_path || (prop_enum_value_ok && prop_enum_value_id)) { - /* create a property to host the "datapath" property we're sending to the operators */ + /* Create a property to host the "data_path" property we're sending to the operators. */ IDProperty *prop_path; const IDPropertyTemplate val = {0}; @@ -1945,7 +1945,7 @@ void ui_fontscale(short *points, float aspect) } } -/* project button or block (but==NULL) to pixels in regionspace */ +/* Project button or block (but==NULL) to pixels in region-space. */ static void ui_but_to_pixelrect(rcti *rect, const ARegion *region, uiBlock *block, uiBut *but) { rctf rectf; @@ -4024,7 +4024,7 @@ static uiBut *ui_def_but(uiBlock *block, but->emboss = block->emboss; but->pie_dir = UI_RADIAL_NONE; - but->block = block; /* pointer back, used for frontbuffer status, and picker */ + but->block = block; /* pointer back, used for front-buffer status, and picker. */ if ((block->flag & UI_BUT_ALIGN) && ui_but_can_align(but)) { but->alignnr = block->alignnr; @@ -4747,7 +4747,7 @@ static int findBitIndex(uint x) return idx; } -/* autocomplete helper functions */ +/* Auto-complete helper functions. */ struct AutoComplete { size_t maxlen; int matches; diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index 85730d138ac..53a04ec9db5 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -953,7 +953,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) } } - /* If the button reprents an id, it can set the "id" context pointer. */ + /* If the button represents an id, it can set the "id" context pointer. */ if (U.experimental.use_asset_browser && ED_asset_can_make_single_from_context(C)) { ID *id = CTX_data_pointer_get_type(C, "id", &RNA_ID).data; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 0bae57f14d3..d10cdc207c2 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -355,7 +355,7 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(region), GPU_blend(GPU_BLEND_NONE); # if 0 - /* restore scissortest */ + /* Restore scissor-test. */ GPU_scissor(scissor[0], scissor[1], scissor[2], scissor[3]); # endif @@ -1410,7 +1410,7 @@ void ui_draw_but_UNITVEC(uiBut *but, const uiWidgetColors *wcol, const rcti *rec GPU_batch_uniform_3fv(sphere, "light", light); GPU_batch_draw(sphere); - /* restore */ + /* Restore. */ GPU_face_culling(GPU_CULL_NONE); /* AA circle */ @@ -1740,7 +1740,7 @@ void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, immEnd(); immUnbindProgram(); - /* restore scissortest */ + /* Restore scissor-test. */ GPU_scissor(scissor[0], scissor[1], scissor[2], scissor[3]); /* outline */ @@ -2030,7 +2030,7 @@ void ui_draw_but_CURVEPROFILE(ARegion *region, } immUnbindProgram(); - /* restore scissortest */ + /* Restore scissor-test. */ GPU_scissor(scissor[0], scissor[1], scissor[2], scissor[3]); /* Outline */ diff --git a/source/blender/editors/interface/interface_eyedropper_depth.c b/source/blender/editors/interface/interface_eyedropper_depth.c index ead65a62226..e71a0b9196c 100644 --- a/source/blender/editors/interface/interface_eyedropper_depth.c +++ b/source/blender/editors/interface/interface_eyedropper_depth.c @@ -66,9 +66,9 @@ typedef struct DepthDropper { bool is_undo; bool is_set; - float init_depth; /* for resetting on cancel */ + float init_depth; /* For resetting on cancel. */ - bool accum_start; /* has mouse been presed */ + bool accum_start; /* Has mouse been pressed. */ float accum_depth; int accum_tot; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 9ee625fc02e..abe40f88ec6 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -349,7 +349,7 @@ typedef struct uiHandleButtonData { #endif ColorBand *coba; - /* tooltip */ + /* Tool-tip. */ uint tooltip_force : 1; /* auto open */ @@ -1617,7 +1617,7 @@ static int ui_handler_region_drag_toggle(bContext *C, const wmEvent *event, void static bool ui_but_is_drag_toggle(const uiBut *but) { return ((ui_drag_toggle_but_is_supported(but) == true) && - /* menu check is importnt so the button dragged over isn't removed instantly */ + /* Menu check is important so the button dragged over isn't removed instantly. */ (ui_block_is_menu(but->block) == false)); } @@ -3710,9 +3710,9 @@ static void ui_do_but_textedit( case EVT_AKEY: - /* Ctrl + A: Select all */ + /* Ctrl-A: Select all. */ #if defined(__APPLE__) - /* OSX uses cmd-a systemwide, so add it */ + /* OSX uses Command-A system-wide, so add it. */ if ((event->oskey && !IS_EVENT_MOD(event, shift, alt, ctrl)) || (event->ctrl && !IS_EVENT_MOD(event, shift, alt, oskey))) #else @@ -3726,7 +3726,7 @@ static void ui_do_but_textedit( break; case EVT_TABKEY: - /* there is a key conflict here, we can't tab with autocomplete */ + /* There is a key conflict here, we can't tab with auto-complete. */ if (but->autocomplete_func || data->searchbox) { const int autocomplete = ui_textedit_autocomplete(C, but, data); changed = autocomplete != AUTOCOMPLETE_NO_MATCH; @@ -3735,13 +3735,14 @@ static void ui_do_but_textedit( button_activate_state(C, but, BUTTON_STATE_EXIT); } } - /* the hotkey here is not well defined, was G.qual so we check all */ - else if (IS_EVENT_MOD(event, shift, ctrl, alt, oskey)) { - ui_textedit_prev_but(block, but, data); - button_activate_state(C, but, BUTTON_STATE_EXIT); - } - else { - ui_textedit_next_but(block, but, data); + else if (!IS_EVENT_MOD(event, ctrl, alt, oskey)) { + /* Use standard keys for cycling through buttons Tab, Shift-Tab to reverse. */ + if (event->shift) { + ui_textedit_prev_but(block, but, data); + } + else { + ui_textedit_next_but(block, but, data); + } button_activate_state(C, but, BUTTON_STATE_EXIT); } retval = WM_UI_HANDLER_BREAK; @@ -4575,7 +4576,7 @@ static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, cons return WM_UI_HANDLER_BREAK; } if (ELEM(event->type, MOUSEPAN, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->ctrl) { - /* Support ctrl-wheel to cycle values on expanded enum rows. */ + /* Support Ctrl-Wheel to cycle values on expanded enum rows. */ if (but->type == UI_BTYPE_ROW) { int type = event->type; int val = event->val; @@ -5086,7 +5087,7 @@ static int ui_do_but_NUM( else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { if (data->dragchange) { #ifdef USE_DRAG_MULTINUM - /* if we started multibutton but didn't drag, then edit */ + /* If we started multi-button but didn't drag, then edit. */ if (data->multi_data.init == BUTTON_MULTI_INIT_SETUP) { click = 1; } @@ -5408,7 +5409,7 @@ static int ui_do_but_SLI( else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { if (data->dragchange) { #ifdef USE_DRAG_MULTINUM - /* if we started multibutton but didn't drag, then edit */ + /* If we started multi-button but didn't drag, then edit. */ if (data->multi_data.init == BUTTON_MULTI_INIT_SETUP) { click = 1; } @@ -7822,7 +7823,7 @@ static void ui_blocks_set_tooltips(ARegion *region, const bool enable) } /** - * Recreate tooltip (use to update dynamic tips) + * Recreate tool-tip (use to update dynamic tips) */ void UI_but_tooltip_refresh(bContext *C, uiBut *but) { @@ -7921,7 +7922,7 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s return; } - /* highlight has timers for tooltips and auto open */ + /* Highlight has timers for tool-tips and auto open. */ if (state == BUTTON_STATE_HIGHLIGHT) { but->flag &= ~UI_SELECT; @@ -8261,7 +8262,7 @@ static void button_activate_exit( } } - /* disable tooltips until mousemove + last active flag */ + /* Disable tool-tips until mouse-move + last active flag. */ LISTBASE_FOREACH (uiBlock *, block_iter, &data->region->uiblocks) { LISTBASE_FOREACH (uiBut *, bt, &block_iter->buttons) { bt->flag &= ~UI_BUT_LAST_ACTIVE; @@ -8349,7 +8350,7 @@ static uiBut *ui_context_button_active(const ARegion *region, bool (*but_check_c but_found = activebut; - /* recurse into opened menu, like colorpicker case */ + /* Recurse into opened menu, like color-picker case. */ if (data && data->menu && (region != data->menu->region)) { region = data->menu->region; } @@ -8531,7 +8532,7 @@ void UI_context_update_anim_flag(const bContext *C) } if (activebut) { - /* always recurse into opened menu, so all buttons update (like colorpicker) */ + /* Always recurse into opened menu, so all buttons update (like color-picker). */ uiHandleButtonData *data = activebut->active; if (data && data->menu) { region = data->menu->region; @@ -8573,7 +8574,8 @@ static int ui_handle_button_over(bContext *C, const wmEvent *event, ARegion *reg button_activate_init(C, region, but, BUTTON_ACTIVATE_OVER); if (event->alt && but->active) { - /* display tooltips if holding alt on mouseover when tooltips are off in prefs */ + /* Display tool-tips if holding Alt on mouse-over when tool-tips are disabled in the + * preferences. */ but->active->tooltip_force = true; } } @@ -8795,7 +8797,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) button_activate_state(C, but, BUTTON_STATE_EXIT); } else if (event->x != event->prevx || event->y != event->prevy) { - /* re-enable tooltip on mouse move */ + /* Re-enable tool-tip on mouse move. */ ui_blocks_set_tooltips(region, true); button_tooltip_timer_reset(C, but); } @@ -8819,7 +8821,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) break; } /* XXX hardcoded keymap check... but anyway, - * while view changes, tooltips should be removed */ + * while view changes, tool-tips should be removed */ case WHEELUPMOUSE: case WHEELDOWNMOUSE: case MIDDLEMOUSE: @@ -9522,7 +9524,7 @@ static int ui_handle_menu_button(bContext *C, const wmEvent *event, uiPopupBlock /* pass, skip for dialogs */ } else if (!ui_region_contains_point_px(but->active->region, event->x, event->y)) { - /* pass, needed to click-exit outside of non-flaoting menus */ + /* Pass, needed to click-exit outside of non-floating menus. */ ui_region_auto_open_clear(but->active->region); } else if ((!ELEM(event->type, MOUSEMOVE, WHEELUPMOUSE, WHEELDOWNMOUSE, MOUSEPAN)) && @@ -10144,7 +10146,7 @@ static int ui_handle_menu_event(bContext *C, ui_mouse_motion_towards_check(block, menu, &event->x, is_parent_inside == false); - /* check for all parent rects, enables arrowkeys to be used */ + /* Check for all parent rects, enables arrow-keys to be used. */ for (saferct = block->saferct.first; saferct; saferct = saferct->next) { /* for mouse move we only check our own rect, for other * events we check all preceding block rects too to make @@ -10418,7 +10420,7 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle } } - /* check pie velociy here if gesture has ended */ + /* Check pie velocity here if gesture has ended. */ if (block->pie_data.flags & UI_PIE_GESTURE_END_WAIT) { float len_sq = 10; @@ -10744,7 +10746,7 @@ static int ui_region_handler(bContext *C, const wmEvent *event, void *UNUSED(use } } - /* re-enable tooltips */ + /* Re-enable tool-tips. */ if (event->type == MOUSEMOVE && (event->x != event->prevx || event->y != event->prevy)) { ui_blocks_set_tooltips(region, true); } @@ -10841,7 +10843,7 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE } } - /* re-enable tooltips */ + /* Re-enable tool-tips. */ if (event->type == MOUSEMOVE && (event->x != event->prevx || event->y != event->prevy)) { ui_blocks_set_tooltips(region, true); } @@ -10935,7 +10937,7 @@ static int ui_popup_handler(bContext *C, const wmEvent *event, void *userdata) WM_event_add_mousemove(win); } else { - /* re-enable tooltips */ + /* Re-enable tool-tips */ if (event->type == MOUSEMOVE && (event->x != event->prevx || event->y != event->prevy)) { ui_blocks_set_tooltips(menu->region, true); } @@ -10945,7 +10947,7 @@ static int ui_popup_handler(bContext *C, const wmEvent *event, void *userdata) ui_apply_but_funcs_after(C); if (reset_pie) { - /* reaqcuire window in case pie invalidates it somehow */ + /* Reacquire window in case pie invalidates it somehow. */ wmWindow *win = CTX_wm_window(C); if (win) { diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index f4e68ca3909..6a921f3f541 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -525,7 +525,7 @@ struct uiBlock { /** for doing delayed */ int bounds, minbounds; - /** pulldowns, to detect outside, can differ per case how it is created */ + /** pull-downs, to detect outside, can differ per case how it is created. */ rctf safety; /** uiSafetyRct list */ ListBase saferct; @@ -659,7 +659,7 @@ void ui_block_cm_to_display_space_v3(uiBlock *block, float pixel[3]); /* interface_regions.c */ struct uiKeyNavLock { - /* set when we're using keyinput */ + /* Set when we're using key-input. */ bool is_keynav; /* only used to check if we've moved the cursor */ int event_xy[2]; @@ -756,7 +756,7 @@ uiBlock *ui_block_func_COLOR(struct bContext *C, uiPopupBlockHandle *handle, voi ColorPicker *ui_block_colorpicker_create(struct uiBlock *block); /* interface_region_search.c */ -/* Searchbox for string button */ +/* Search-box for string button. */ struct ARegion *ui_searchbox_create_generic(struct bContext *C, struct ARegion *butregion, uiButSearch *search_but); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 3281b8de920..fef243d7193 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -2642,7 +2642,7 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname static void search_id_collection(StructRNA *ptype, PointerRNA *r_ptr, PropertyRNA **r_prop) { /* look for collection property in Main */ - /* Note: using global Main is OK-ish here, UI shall not access other Mains anyay... */ + /* NOTE: using global Main is OK-ish here, UI shall not access other Mains anyway. */ RNA_main_pointer_create(G_MAIN, r_ptr); *r_prop = NULL; @@ -2821,7 +2821,7 @@ void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt) UI_menutype_draw(C, mt, layout); - /* menus are created flipped (from event handling pov) */ + /* Menus are created flipped (from event handling point of view). */ layout->root->block->flag ^= UI_BLOCK_IS_FLIP; } diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index e5aa0665a16..05a2a6ef29b 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -901,7 +901,7 @@ bool UI_context_copy_to_selected_list(bContext *C, MEM_freeN(link); } else { - /* avoid prepending 'data' to the path */ + /* Avoid prepending 'data' to the path. */ RNA_id_pointer_create(id_data, &link->ptr); } diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index b4af63b6f4d..7343417137a 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -926,9 +926,9 @@ bool UI_panel_matches_search_filter(const Panel *panel) /** * Set the flag telling the panel to use its search result status for its expansion. */ -static void panel_set_expansion_from_seach_filter_recursive(const bContext *C, - Panel *panel, - const bool use_search_closed) +static void panel_set_expansion_from_search_filter_recursive(const bContext *C, + Panel *panel, + const bool use_search_closed) { /* This has to run on inactive panels that may not have a type, * but we can prevent running on header-less panels in some cases. */ @@ -939,21 +939,21 @@ static void panel_set_expansion_from_seach_filter_recursive(const bContext *C, LISTBASE_FOREACH (Panel *, child_panel, &panel->children) { /* Don't check if the sub-panel is active, otherwise the * expansion won't be reset when the parent is closed. */ - panel_set_expansion_from_seach_filter_recursive(C, child_panel, use_search_closed); + panel_set_expansion_from_search_filter_recursive(C, child_panel, use_search_closed); } } /** * Set the flag telling every panel to override its expansion with its search result status. */ -static void region_panels_set_expansion_from_seach_filter(const bContext *C, - ARegion *region, - const bool use_search_closed) +static void region_panels_set_expansion_from_search_filter(const bContext *C, + ARegion *region, + const bool use_search_closed) { LISTBASE_FOREACH (Panel *, panel, ®ion->panels) { /* Don't check if the panel is active, otherwise the expansion won't * be correct when switching back to tab after exiting search. */ - panel_set_expansion_from_seach_filter_recursive(C, panel, use_search_closed); + panel_set_expansion_from_search_filter_recursive(C, panel, use_search_closed); } set_panels_list_data_expand_flag(C, region); } @@ -1339,7 +1339,7 @@ void ui_draw_aligned_panel(const uiStyle *style, { const Panel *panel = block->panel; - /* Add 0.001f to prevent flicker frpm float inaccuracy. */ + /* Add 0.001f to prevent flicker from float inaccuracy. */ const rcti header_rect = { rect->xmin, rect->xmax, @@ -1923,10 +1923,10 @@ void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y) const bool region_search_filter_active = region->flag & RGN_FLAG_SEARCH_FILTER_ACTIVE; if (properties_space_needs_realign(area, region)) { - region_panels_set_expansion_from_seach_filter(C, region, region_search_filter_active); + region_panels_set_expansion_from_search_filter(C, region, region_search_filter_active); } else if (region->flag & RGN_FLAG_SEARCH_FILTER_UPDATE) { - region_panels_set_expansion_from_seach_filter(C, region, region_search_filter_active); + region_panels_set_expansion_from_search_filter(C, region, region_search_filter_active); } if (region->flag & RGN_FLAG_SEARCH_FILTER_ACTIVE) { @@ -2366,7 +2366,7 @@ static int ui_handle_panel_category_cycling(const wmEvent *event, PanelCategoryDyn *pc_dyn = UI_panel_category_find(region, category); if (LIKELY(pc_dyn)) { if (is_mousewheel) { - /* We can probably get rid of this and only allow ctrl-tabbing. */ + /* We can probably get rid of this and only allow Ctrl-Tabbing. */ pc_dyn = (event->type == WHEELDOWNMOUSE) ? pc_dyn->next : pc_dyn->prev; } else { diff --git a/source/blender/editors/interface/interface_region_menu_pie.c b/source/blender/editors/interface/interface_region_menu_pie.c index d047d5421d7..81c627816b9 100644 --- a/source/blender/editors/interface/interface_region_menu_pie.c +++ b/source/blender/editors/interface/interface_region_menu_pie.c @@ -392,7 +392,7 @@ void ui_pie_menu_level_create(uiBlock *block, EnumPropertyItem *remaining = MEM_mallocN(array_size + sizeof(EnumPropertyItem), "pie_level_item_array"); memcpy(remaining, items + totitem_parent, array_size); - /* a NULL terminating sentinal element is required */ + /* A NULL terminating sentinel element is required. */ memset(&remaining[totitem_remain], 0, sizeof(EnumPropertyItem)); /* yuk, static... issue is we can't reliably free this without doing dangerous changes */ diff --git a/source/blender/editors/interface/interface_region_popup.c b/source/blender/editors/interface/interface_region_popup.c index 62b8ce9d3eb..3228e9741bb 100644 --- a/source/blender/editors/interface/interface_region_popup.c +++ b/source/blender/editors/interface/interface_region_popup.c @@ -539,7 +539,7 @@ static void ui_popup_block_remove(bContext *C, uiPopupBlockHandle *handle) CTX_wm_window_set(C, win); ui_region_temp_remove(C, screen, handle->region); - /* Reset context (area and region were NULL'ed when chaning context window). */ + /* Reset context (area and region were NULL'ed when changing context window). */ CTX_wm_window_set(C, ctx_win); CTX_wm_area_set(C, ctx_area); CTX_wm_region_set(C, ctx_region); diff --git a/source/blender/editors/interface/interface_region_search.c b/source/blender/editors/interface/interface_region_search.c index d5a9a94b8ae..d1d4290bd11 100644 --- a/source/blender/editors/interface/interface_region_search.c +++ b/source/blender/editors/interface/interface_region_search.c @@ -289,7 +289,7 @@ int ui_searchbox_find_index(ARegion *region, const char *name) return UI_search_items_find_index(&data->items, name); } -/* x and y in screencoords */ +/* x and y in screen-coords. */ bool ui_searchbox_inside(ARegion *region, int x, int y) { uiSearchboxData *data = region->regiondata; @@ -1060,7 +1060,7 @@ void ui_but_search_refresh(uiButSearch *search_but) ui_searchbox_update_fn(but->block->evil_C, search_but, but->drawstr, items); - /* only redalert when we are sure of it, this can miss cases when >10 matches */ + /* Only red-alert when we are sure of it, this can miss cases when >10 matches. */ if (items->totitem == 0) { UI_but_flag_enable(but, UI_BUT_REDALERT); } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 8127a32b271..cf0c1444d4d 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -349,7 +349,7 @@ static bool id_search_allows_id(TemplateID *template_ui, const int flag, ID *id, } } - /* Hide dot-datablocks, but only if filter does not force them visible. */ + /* Hide dot prefixed data-blocks, but only if filter does not force them visible. */ if (U.uiflag & USER_HIDE_DOT) { if ((id->name[2] == '.') && (query[0] != '.')) { return false; @@ -923,7 +923,7 @@ static void template_ID(const bContext *C, idfrom = template_ui->ptr.owner_id; // lb = template_ui->idlb; - /* Allow opertators to take the ID from context. */ + /* Allow operators to take the ID from context. */ uiLayoutSetContextPointer(layout, "id", &idptr); block = uiLayoutGetBlock(layout); @@ -934,7 +934,7 @@ static void template_ID(const bContext *C, } if (text) { - /* Add label resepecting the separated layout property split state. */ + /* Add label respecting the separated layout property split state. */ uiItemL_respect_property_split(layout, text, ICON_NONE); } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 0c3448b987d..8b185f5dc20 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1311,7 +1311,7 @@ static void widgetbase_draw_ex(uiWidgetBase *wtb, tria_col[3] = wcol->item[3]; } - /* Draw everything in one drawcall */ + /* Draw everything in one draw-call. */ if (inner_col1[3] || inner_col2[3] || outline_col[3] || emboss_col[3] || tria_col[3] || show_alpha_checkers) { widgetbase_set_uniform_colors_ubv( @@ -2349,7 +2349,7 @@ static void widget_draw_text_icon(const uiFontStyle *fstyle, int icon_size = BLI_rcti_size_y(rect); int text_size = 0; - /* This is a bit britle, but avoids adding an 'UI_BUT_HAS_LABEL' flag to but... */ + /* This is a bit brittle, but avoids adding an 'UI_BUT_HAS_LABEL' flag to but... */ if (icon_size > BLI_rcti_size_x(rect)) { /* button is not square, it has extra height for label */ text_size = UI_UNIT_Y; @@ -3614,7 +3614,7 @@ static void widget_scroll( rect1.xmin = rect1.xmin + ceilf(fac * (value - but->softmin)); rect1.xmax = rect1.xmin + ceilf(fac * (but->a1 - but->softmin)); - /* ensure minimium size */ + /* Ensure minimum size. */ const float min = BLI_rcti_size_y(rect); if (BLI_rcti_size_x(&rect1) < min) { @@ -3631,7 +3631,7 @@ static void widget_scroll( rect1.ymax = rect1.ymax - ceilf(fac * (value - but->softmin)); rect1.ymin = rect1.ymax - ceilf(fac * (but->a1 - but->softmin)); - /* ensure minimium size */ + /* Ensure minimum size. */ const float min = BLI_rcti_size_x(rect); if (BLI_rcti_size_y(&rect1) < min) { @@ -3668,7 +3668,7 @@ static void widget_progressbar( const float offs = wcol->roundness * BLI_rcti_size_y(&rect_prog); float w = value * BLI_rcti_size_x(&rect_prog); - /* ensure minimium size */ + /* Ensure minimum size. */ w = MAX2(w, offs); rect_bar.xmax = rect_bar.xmin + w; diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 4e642137d2a..e234ab5dcdc 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -46,7 +46,7 @@ #include "UI_interface.h" #include "UI_view2d.h" -#include "PIL_time.h" /* USER_ZOOM_CONT */ +#include "PIL_time.h" /* USER_ZOOM_CONTINUE */ /* -------------------------------------------------------------------- */ /** \name Internal Utilities @@ -1108,7 +1108,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op) /* Check if the 'timer' is initialized, as zooming with the trackpad * never uses the "Continuous" zoom method, and the 'timer' is not initialized. */ - if ((U.viewzoom == USER_ZOOM_CONT) && vzd->timer) { /* XXX store this setting as RNA prop? */ + if ((U.viewzoom == USER_ZOOM_CONTINUE) && vzd->timer) { /* XXX store this setting as RNA prop? */ const double time = PIL_check_seconds_timer(); const float time_step = (float)(time - vzd->timer_lastdraw); @@ -1304,7 +1304,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even /* add temp handler */ WM_event_add_modal_handler(C, op); - if (U.viewzoom == USER_ZOOM_CONT) { + if (U.viewzoom == USER_ZOOM_CONTINUE) { /* needs a timer to continue redrawing */ vzd->timer = WM_event_add_timer(CTX_wm_manager(C), window, TIMER, 0.01f); vzd->timer_lastdraw = PIL_check_seconds_timer(); @@ -1363,7 +1363,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event dx *= BLI_rctf_size_x(&v2d->cur); dy *= BLI_rctf_size_y(&v2d->cur); } - else { /* USER_ZOOM_CONT or USER_ZOOM_DOLLY */ + else { /* USER_ZOOM_CONTINUE or USER_ZOOM_DOLLY */ float facx = zoomfac * (event->x - vzd->lastx); float facy = zoomfac * (event->y - vzd->lasty); @@ -1410,7 +1410,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event * - Continuous zoom only depends on distance of mouse * to starting point to determine rate of change. */ - if (U.viewzoom != USER_ZOOM_CONT) { /* XXX store this setting as RNA prop? */ + if (U.viewzoom != USER_ZOOM_CONTINUE) { /* XXX store this setting as RNA prop? */ vzd->lastx = event->x; vzd->lasty = event->y; } @@ -2224,7 +2224,7 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent * scroller_activate_init(C, op, event, in_scroller); v2dScrollerMove *vsm = (v2dScrollerMove *)op->customdata; - /* support for quick jump to location - gtk and qt do this on linux */ + /* Support for quick jump to location - GTK and QT do this on Linux. */ if (event->type == MIDDLEMOUSE) { switch (vsm->scroller) { case 'h': /* horizontal scroller - so only horizontal movement diff --git a/source/blender/editors/lattice/editlattice_undo.c b/source/blender/editors/lattice/editlattice_undo.c index 3a5734706f1..3ffbc3712fc 100644 --- a/source/blender/editors/lattice/editlattice_undo.c +++ b/source/blender/editors/lattice/editlattice_undo.c @@ -212,8 +212,11 @@ static bool lattice_undosys_step_encode(struct bContext *C, Main *bmain, UndoSte return true; } -static void lattice_undosys_step_decode( - struct bContext *C, struct Main *bmain, UndoStep *us_p, int UNUSED(dir), bool UNUSED(is_final)) +static void lattice_undosys_step_decode(struct bContext *C, + struct Main *bmain, + UndoStep *us_p, + const eUndoStepDir UNUSED(dir), + bool UNUSED(is_final)) { LatticeUndoStep *us = (LatticeUndoStep *)us_p; diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 89fd2fa9b62..d3fa0e93597 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -539,7 +539,7 @@ static void draw_spline_curve(const bContext *C, uint tot_feather_point; float(*feather_points)[2]; - diff_points = BKE_mask_spline_differentiate_with_resolution(spline, &tot_diff_point, resol); + diff_points = BKE_mask_spline_differentiate_with_resolution(spline, resol, &tot_diff_point); if (!diff_points) { return; @@ -550,7 +550,7 @@ static void draw_spline_curve(const bContext *C, } feather_points = BKE_mask_spline_feather_differentiated_points_with_resolution( - spline, &tot_feather_point, resol, (is_fill != false)); + spline, resol, (is_fill != false), &tot_feather_point); /* draw feather */ mask_spline_feather_color_get(mask_layer, spline, is_spline_sel, rgb_tmp); diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c index 8ea3c883433..644aa3903f6 100644 --- a/source/blender/editors/mesh/editmesh_bevel.c +++ b/source/blender/editors/mesh/editmesh_bevel.c @@ -575,7 +575,7 @@ static void edbm_bevel_mouse_set_value(wmOperator *op, const wmEvent *event) opdata->shift_value[vmode] = -1.0f; } - /* clamp accordingto value mode, and store value back */ + /* Clamp according to value mode, and store value back. */ CLAMP(value, value_clamp_min[vmode], value_clamp_max[vmode]); if (vmode == SEGMENTS_VALUE) { opdata->segments = value; diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 379140a821a..1f894ec0f1d 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -210,7 +210,7 @@ typedef struct KnifeTool_OpData { /* run by the UI or not */ bool is_interactive; - /* operatpr options */ + /* Operator options. */ bool cut_through; /* preference, can be modified at runtime (that feature may go) */ bool only_select; /* set on initialization */ bool select_result; /* set on initialization */ diff --git a/source/blender/editors/mesh/editmesh_mask_extract.c b/source/blender/editors/mesh/editmesh_mask_extract.c index 3e0bee3c4b8..7d849c096e7 100644 --- a/source/blender/editors/mesh/editmesh_mask_extract.c +++ b/source/blender/editors/mesh/editmesh_mask_extract.c @@ -81,7 +81,7 @@ typedef struct GeometryExtactParams { /* For extracting Mask. */ float mask_threshold; - /* Common paramenters. */ + /* Common parameters. */ bool add_boundary_loop; int num_smooth_iterations; bool apply_shrinkwrap; @@ -106,7 +106,7 @@ static int geometry_extract_apply(bContext *C, BKE_sculpt_mask_layers_ensure(ob, NULL); - /* Ensures that deformation from sculpt mode is taken into accunt before duplicating the mesh to + /* Ensures that deformation from sculpt mode is taken into account before duplicating the mesh to * extract the geometry. */ CTX_data_ensure_evaluated_depsgraph(C); @@ -385,7 +385,7 @@ static int face_set_extract_modal(bContext *C, wmOperator *op, const wmEvent *ev ED_workspace_status_text(C, NULL); /* This modal operator uses and eyedropper to pick a Face Set from the mesh. This ensures - * that the mouse clicked in a viewport region and its coordinates can be used to raycast + * that the mouse clicked in a viewport region and its coordinates can be used to ray-cast * the PBVH and update the active Face Set ID. */ bScreen *screen = CTX_wm_screen(C); ARegion *region = BKE_screen_find_main_region_at_xy( diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 0c68bb8f82b..c8449644dd0 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -2205,7 +2205,7 @@ void EDBM_selectmode_set(BMEditMesh *em) } } else if (em->selectmode & SCE_SELECT_FACE) { - /* deselect eges, and select again based on face select */ + /* Deselect edges, and select again based on face select. */ BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) { BM_edge_select_set(em->bm, eed, false); } @@ -2247,7 +2247,7 @@ void EDBM_selectmode_convert(BMEditMesh *em, /* first tag-to-select, then select --- this avoids a feedback loop */ - /* have to find out what the selectionmode was previously */ + /* Have to find out what the selection-mode was previously. */ if (selectmode_old == SCE_SELECT_VERTEX) { if (bm->totvertsel == 0) { /* pass */ diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 84f4e35cb0c..de37ddec885 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -3905,7 +3905,7 @@ static float bm_edge_seg_isect(const float sco_a[2], x12 = mouse_path[i][0]; y12 = mouse_path[i][1]; - /* Perp. Distance from point to line */ + /* Calculate the distance from point to line. */ if (m2 != MAXSLOPE) { /* sqrt(m2 * m2 + 1); Only looking for change in sign. Skip extra math .*/ dist = (y12 - m2 * x12 - b2); @@ -4010,7 +4010,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op) short numcuts = 1; const short mode = RNA_int_get(op->ptr, "type"); - /* allocd vars */ + /* Allocated variables. */ float(*screen_vert_coords)[2], (*sco)[2], (*mouse_path)[2]; /* edit-object needed for matrix, and region->regiondata for projections to work */ diff --git a/source/blender/editors/mesh/editmesh_undo.c b/source/blender/editors/mesh/editmesh_undo.c index 1cbbbccdfa9..d7f7cfa2888 100644 --- a/source/blender/editors/mesh/editmesh_undo.c +++ b/source/blender/editors/mesh/editmesh_undo.c @@ -171,7 +171,7 @@ static void um_arraystore_cd_compact(struct CustomData *cdata, else { bcd_reference_current = NULL; - /* do a full lookup when un-alligned */ + /* Do a full lookup when unaligned. */ if (bcd_reference) { const BArrayCustomData *bcd_iter = bcd_reference; while (bcd_iter) { @@ -744,8 +744,11 @@ static bool mesh_undosys_step_encode(struct bContext *C, struct Main *bmain, Und return true; } -static void mesh_undosys_step_decode( - struct bContext *C, struct Main *bmain, UndoStep *us_p, int UNUSED(dir), bool UNUSED(is_final)) +static void mesh_undosys_step_decode(struct bContext *C, + struct Main *bmain, + UndoStep *us_p, + const eUndoStepDir UNUSED(dir), + bool UNUSED(is_final)) { MeshUndoStep *us = (MeshUndoStep *)us_p; diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 3b5897de0b0..3450d61337c 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -145,7 +145,7 @@ static void join_mesh_single(Depsgraph *depsgraph, if (ob_src != ob_dst) { float cmat[4][4]; - /* watch this: switch matmul order really goes wrong */ + /* Watch this: switch matrix multiplication order really goes wrong. */ mul_m4_m4m4(cmat, imat, ob_src->obmat); /* transform vertex coordinates into new space */ @@ -733,7 +733,7 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op) BKE_key_sort(key); } - /* Due to dependnecy cycle some other object might access old derived data. */ + /* Due to dependency cycle some other object might access old derived data. */ BKE_object_free_derived_caches(ob); DEG_relations_tag_update(bmain); /* removed objects, need to rebuild dag */ diff --git a/source/blender/editors/metaball/editmball_undo.c b/source/blender/editors/metaball/editmball_undo.c index cbc60bcc031..b817bc3a718 100644 --- a/source/blender/editors/metaball/editmball_undo.c +++ b/source/blender/editors/metaball/editmball_undo.c @@ -187,8 +187,11 @@ static bool mball_undosys_step_encode(struct bContext *C, struct Main *bmain, Un return true; } -static void mball_undosys_step_decode( - struct bContext *C, struct Main *bmain, UndoStep *us_p, int UNUSED(dir), bool UNUSED(is_final)) +static void mball_undosys_step_decode(struct bContext *C, + struct Main *bmain, + UndoStep *us_p, + const eUndoStepDir UNUSED(dir), + bool UNUSED(is_final)) { MBallUndoStep *us = (MBallUndoStep *)us_p; diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 9ab5eafa84d..2d3505fa9d0 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1711,9 +1711,8 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op) Object *ob = ED_object_add_type(C, OB_SPEAKER, NULL, loc, rot, false, local_view_bits); const bool is_liboverride = ID_IS_OVERRIDE_LIBRARY(ob); - /* to make it easier to start using this immediately in NLA, a default sound clip is created - * ready to be moved around to retime the sound and/or make new sound clips - */ + /* To make it easier to start using this immediately in NLA, a default sound clip is created + * ready to be moved around to re-time the sound and/or make new sound clips. */ { /* create new data for NLA hierarchy */ AnimData *adt = BKE_animdata_add_id(&ob->id); diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c index db9e51a490d..b1ba856ff0f 100644 --- a/source/blender/editors/object/object_bake_api.c +++ b/source/blender/editors/object/object_bake_api.c @@ -1339,7 +1339,7 @@ static int bake(const BakeAPIRender *bkr, highpoly[i].ob_eval->base_flag |= (BASE_VISIBLE_DEPSGRAPH | BASE_ENABLED_RENDER); highpoly[i].me = BKE_mesh_new_from_object(NULL, highpoly[i].ob_eval, false); - /* lowpoly to highpoly transformation matrix */ + /* Low-poly to high-poly transformation matrix. */ copy_m4_m4(highpoly[i].obmat, highpoly[i].ob->obmat); invert_m4_m4(highpoly[i].imat, highpoly[i].obmat); diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c index 4cbb8858bf4..a80810cc734 100644 --- a/source/blender/editors/object/object_data_transfer.c +++ b/source/blender/editors/object/object_data_transfer.c @@ -65,7 +65,7 @@ static const EnumPropertyItem DT_layer_items[] = { 0, "Vertex Group(s)", "Transfer active or all vertex groups"}, -#if 0 /* XXX For now, would like to finish/merge work from 2014 gsoc first. */ +#if 0 /* XXX For now, would like to finish/merge work from 2014 GSOC first. */ {DT_TYPE_SHAPEKEY, "SHAPEKEYS", 0, "Shapekey(s)", "Transfer active or all shape keys"}, #endif /* XXX When SkinModifier is enabled, diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 6350ffb9c77..7e0e52d3874 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -3024,7 +3024,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op) i++; } - /* make a copy of ocean to use for baking - threadsafety */ + /* Make a copy of ocean to use for baking - thread-safety. */ struct Ocean *ocean = BKE_ocean_add(); BKE_ocean_init_from_modifier(ocean, omd, omd->resolution); diff --git a/source/blender/editors/object/object_remesh.c b/source/blender/editors/object/object_remesh.c index d560d347217..f55ce88b426 100644 --- a/source/blender/editors/object/object_remesh.c +++ b/source/blender/editors/object/object_remesh.c @@ -327,7 +327,7 @@ static void voxel_size_edit_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), const float total_len = len_v3v3(cd->preview_plane[0], cd->preview_plane[1]); const int tot_lines = (int)(total_len / cd->voxel_size); - /* Smoothstep to reduce the alpha of the grid as the line number increases. */ + /* Smooth-step to reduce the alpha of the grid as the line number increases. */ const float a = VOXEL_SIZE_EDIT_MAX_GRIDS_LINES * 0.1f; const float b = VOXEL_SIZE_EDIT_MAX_GRIDS_LINES; const float x = clamp_f((tot_lines - a) / (b - a), 0.0f, 1.0); @@ -738,7 +738,7 @@ static int quadriflow_break_job(void *customdata) return should_break; } -/* called by oceanbake, wmJob sends notifier */ +/** Called by ocean-bake, #wmJob sends notifier. */ static void quadriflow_update_job(void *customdata, float progress, int *cancel) { QuadriFlowJob *qj = customdata; @@ -982,7 +982,7 @@ static int quadriflow_remesh_exec(bContext *C, wmOperator *op) quadriflow_free_job(job); } else { - /* Non blocking call. For when the operator has been called from the gui */ + /* Non blocking call. For when the operator has been called from the GUI. */ job->is_nonblocking_job = true; wmJob *wm_job = WM_jobs_get(CTX_wm_manager(C), diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 50dac12ab57..1e6a7b9f14e 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -317,7 +317,7 @@ bool ED_object_jump_to_object(bContext *C, Object *ob, const bool UNUSED(reveal_ /** * Select and make the target object and bone active. * Switches to Pose mode if in Object mode so the selection is visible. - * Unhides the target bone and bone layer if necessary. + * Un-hides the target bone and bone layer if necessary. * * \returns false if object not in layer, bone not found, or other error */ diff --git a/source/blender/editors/object/object_warp.c b/source/blender/editors/object/object_warp.c index b36a8543d67..8f5a60ace2e 100644 --- a/source/blender/editors/object/object_warp.c +++ b/source/blender/editors/object/object_warp.c @@ -75,7 +75,7 @@ static void object_warp_transverts_minmax_x(TransVertStore *tvs, for (int i = 0; i < tvs->transverts_tot; i++, tv++) { float val; - /* convert objectspace->viewspace */ + /* Convert object-space to view-space. */ val = dot_m4_v3_row_x(mat_view, tv->loc); min = min_ff(min, val); @@ -123,7 +123,7 @@ static void object_warp_transverts(TransVertStore *tvs, float co[3], co_add[2]; float val, phi; - /* convert objectspace->viewspace */ + /* Convert object-space to view-space. */ mul_v3_m4v3(co, mat_view, tv->loc); sub_v2_v2(co, center_view); @@ -158,7 +158,7 @@ static void object_warp_transverts(TransVertStore *tvs, add_v2_v2(co, co_add); - /* convert viewspace->objectspace */ + /* Convert view-space to object-space. */ add_v2_v2(co, center_view); mul_v3_m4v3(tv->loc, imat_view, co); } @@ -187,7 +187,7 @@ static int object_warp_verts_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - /* get viewmatrix */ + /* Get view-matrix. */ { PropertyRNA *prop_viewmat = RNA_struct_find_property(op->ptr, "viewmat"); if (RNA_property_is_set(op->ptr, prop_viewmat)) { diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 3a6201fd418..d7e30f2b65c 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -2905,7 +2905,7 @@ static void remove_tagged_keys(Depsgraph *depsgraph, Object *ob, ParticleSystem } } -/************************ subdivide opertor *********************/ +/************************ subdivide operator *********************/ /* works like normal edit mode subdivide, inserts keys between neighboring selected keys */ static void subdivide_particle(PEData *data, int pa_index) @@ -3029,7 +3029,7 @@ void PARTICLE_OT_subdivide(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/************************ remove doubles opertor *********************/ +/************************ remove doubles operator *********************/ static int remove_doubles_exec(bContext *C, wmOperator *op) { @@ -4565,7 +4565,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) mval[0] = mouse[0]; mval[1] = mouse[1]; - /* disable locking temporatily for disconnected hair */ + /* Disable locking temporarily for disconnected hair. */ if (edit->psys && edit->psys->flag & PSYS_GLOBAL_HAIR) { pset->flag &= ~PE_LOCK_FIRST; } @@ -5003,7 +5003,7 @@ static int shape_cut_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; } - /* disable locking temporatily for disconnected hair */ + /* Disable locking temporarily for disconnected hair. */ if (edit->psys && edit->psys->flag & PSYS_GLOBAL_HAIR) { pset->flag &= ~PE_LOCK_FIRST; } diff --git a/source/blender/editors/physics/particle_edit_undo.c b/source/blender/editors/physics/particle_edit_undo.c index 77b8d410d81..5d2e0e5b6ef 100644 --- a/source/blender/editors/physics/particle_edit_undo.c +++ b/source/blender/editors/physics/particle_edit_undo.c @@ -247,7 +247,7 @@ static bool particle_undosys_step_encode(struct bContext *C, static void particle_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, - int UNUSED(dir), + const eUndoStepDir UNUSED(dir), bool UNUSED(is_final)) { Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 10cf4131584..4b84894c23d 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -1098,7 +1098,7 @@ void RENDER_OT_render(wmOperatorType *ot) ot->cancel = screen_render_cancel; ot->exec = screen_render_exec; - /* this isn't needed, causes failer in background mode */ + /* This isn't needed, causes failure in background mode. */ #if 0 ot->poll = ED_operator_screenactive; #endif diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index e30149fde73..4e766841c24 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -1184,7 +1184,7 @@ static void icon_copy_rect(ImBuf *ibuf, uint w, uint h, uint *rect) return; } - /* waste of cpu cyles... but the imbuf API has no other way to scale fast (ton) */ + /* Waste of cpu cycles... but the imbuf API has no other way to scale fast (ton). */ ima = IMB_dupImBuf(ibuf); if (!ima) { diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index 6432bdac1b1..1ea64c542f5 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -478,7 +478,7 @@ void ED_screen_draw_split_preview(ScrArea *area, const int dir, const float fac) uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - /* splitpoint */ + /* Split-point. */ GPU_blend(GPU_BLEND_ALPHA); immUniformColor4ub(255, 255, 255, 100); diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 0868d5a5fe9..c25b572d200 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1024,7 +1024,7 @@ void screen_change_update(bContext *C, wmWindow *win, bScreen *screen) WM_event_add_notifier(C, NC_WINDOW, NULL); WM_event_add_notifier(C, NC_SCREEN | ND_LAYOUTSET, layout); - /* makes button hilites work */ + /* Makes button highlights work. */ WM_event_add_mousemove(win); } @@ -1221,7 +1221,7 @@ void ED_screen_full_restore(bContext *C, ScrArea *area) } /** - * \param toggle_area: If this is set, its space data will be swapped with the one of the new emtpy + * \param toggle_area: If this is set, its space data will be swapped with the one of the new empty * area, when toggling back it can be swapped back again. * \return The newly created screen with the non-normal area. */ diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h index a03e65d8a9d..c51ff559786 100644 --- a/source/blender/editors/screen/screen_intern.h +++ b/source/blender/editors/screen/screen_intern.h @@ -29,10 +29,10 @@ struct bContextDataResult; /* internal exports only */ -#define AZONESPOTW UI_HEADER_OFFSET /* width of corner azone - max */ -#define AZONESPOTH (0.6f * U.widget_unit) /* height of corner azone */ -#define AZONEFADEIN (5.0f * U.widget_unit) /* when azone is totally visible */ -#define AZONEFADEOUT (6.5f * U.widget_unit) /* when we start seeing the azone */ +#define AZONESPOTW UI_HEADER_OFFSET /* width of corner #AZone - max */ +#define AZONESPOTH (0.6f * U.widget_unit) /* height of corner #AZone */ +#define AZONEFADEIN (5.0f * U.widget_unit) /* when #AZone is totally visible */ +#define AZONEFADEOUT (6.5f * U.widget_unit) /* when we start seeing the #AZone */ #define AREAJOINTOLERANCE (1.0f * U.widget_unit) /* Edges must be close to allow joining. */ diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index ca1c75be0a1..244d8c10e4e 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1637,7 +1637,7 @@ static int area_snap_calc_location(const bScreen *screen, /* Thirds. */ 1.0f / 3.0f, 2.0f / 3.0f, - /* Quaters. */ + /* Quarters. */ 1.0f / 4.0f, 3.0f / 4.0f, /* Eighth. */ diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 75699ed572a..44258d8dba2 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -1755,7 +1755,7 @@ static void paint_cursor_cursor_draw_3d_view_brush_cursor_active(PaintCursorCont else if (brush->cloth_force_falloff_type == BRUSH_CLOTH_FORCE_FALLOFF_RADIAL && brush->cloth_simulation_area_type == BRUSH_CLOTH_SIMULATION_AREA_LOCAL) { /* Display the simulation limits if sculpting outside them. */ - /* This does not makes much sense of plane falloff as the falloff is infinte or global. */ + /* This does not makes much sense of plane falloff as the falloff is infinite or global. */ if (len_v3v3(ss->cache->true_location, ss->cache->true_initial_location) > ss->cache->radius * (1.0f + brush->cloth_sim_limit)) { diff --git a/source/blender/editors/sculpt_paint/paint_curve_undo.c b/source/blender/editors/sculpt_paint/paint_curve_undo.c index a8e22f66734..dbe522bf304 100644 --- a/source/blender/editors/sculpt_paint/paint_curve_undo.c +++ b/source/blender/editors/sculpt_paint/paint_curve_undo.c @@ -126,7 +126,7 @@ static bool paintcurve_undosys_step_encode(struct bContext *C, static void paintcurve_undosys_step_decode(struct bContext *UNUSED(C), struct Main *UNUSED(bmain), UndoStep *us_p, - int UNUSED(dir), + const eUndoStepDir UNUSED(dir), bool UNUSED(is_final)) { PaintCurveUndoStep *us = (PaintCurveUndoStep *)us_p; diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 27726b8370e..7c13355c618 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -138,7 +138,7 @@ BLI_INLINE uchar f_to_char(const float val) #ifndef PROJ_DEBUG_NOSEAMBLEED /* projectFaceSeamFlags options */ -//#define PROJ_FACE_IGNORE (1<<0) /* When the face is hidden, backfacing or occluded */ +//#define PROJ_FACE_IGNORE (1<<0) /* When the face is hidden, back-facing or occluded. */ //#define PROJ_FACE_INIT (1<<1) /* When we have initialized the faces data */ /* If this face has a seam on any of its edges. */ @@ -150,7 +150,7 @@ BLI_INLINE uchar f_to_char(const float val) # define PROJ_FACE_NOSEAM1 (1 << 5) # define PROJ_FACE_NOSEAM2 (1 << 6) -/* If the seam is completely initialized, including adjecent seams. */ +/* If the seam is completely initialized, including adjacent seams. */ # define PROJ_FACE_SEAM_INIT0 (1 << 8) # define PROJ_FACE_SEAM_INIT1 (1 << 9) # define PROJ_FACE_SEAM_INIT2 (1 << 10) @@ -294,7 +294,7 @@ typedef struct ProjPaintState { /** verts projected into floating point screen space. */ float (*screenCoords)[4]; - /** 2D bounds for mesh verts on the screen's plane (screenspace). */ + /** 2D bounds for mesh verts on the screen's plane (screen-space). */ float screenMin[2]; float screenMax[2]; /** Calculated from screenMin & screenMax. */ @@ -310,10 +310,10 @@ typedef struct ProjPaintState { bool do_stencil_brush; bool do_material_slots; - /** Use raytraced occlusion? - ortherwise will paint right through to the back. */ + /** Use ray-traced occlusion? - otherwise will paint right through to the back. */ bool do_occlude; /** ignore faces with normals pointing away, - * skips a lot of raycasts if your normals are correctly flipped. */ + * skips a lot of ray-casts if your normals are correctly flipped. */ bool do_backfacecull; /** mask out pixels based on their normals. */ bool do_mask_normal; @@ -579,7 +579,7 @@ static Image *project_paint_face_clone_image(const ProjPaintState *ps, int tri_i /* fast projection bucket array lookup, use the safe version for bound checking */ static int project_bucket_offset(const ProjPaintState *ps, const float projCoSS[2]) { - /* If we were not dealing with screenspace 2D coords we could simple do... + /* If we were not dealing with screen-space 2D coords we could simple do... * ps->bucketRect[x + (y*ps->buckets_y)] */ /* please explain? @@ -887,8 +887,8 @@ static int project_paint_occlude_ptv_clip(const float pt[3], return -1; } -/* Check if a screenspace location is occluded by any other faces - * check, pixelScreenCo must be in screenspace, its Z-Depth only needs to be used for comparison +/* Check if a screen-space location is occluded by any other faces + * check, pixelScreenCo must be in screen-space, its Z-Depth only needs to be used for comparison * and doesn't need to be correct in relation to X and Y coords * (this is the case in perspective view) */ static bool project_bucket_point_occluded(const ProjPaintState *ps, @@ -1514,10 +1514,10 @@ static void project_face_seams_init(const ProjPaintState *ps, } #endif // PROJ_DEBUG_NOSEAMBLEED -/* Converts a UV location to a 3D screenspace location +/* Converts a UV location to a 3D screen-space location * Takes a 'uv' and 3 UV coords, and sets the values of pixelScreenCo * - * This is used for finding a pixels location in screenspace for painting */ + * This is used for finding a pixels location in screen-space for painting */ static void screen_px_from_ortho(const float uv[2], const float v1co[3], const float v2co[3], @@ -1537,7 +1537,7 @@ static void screen_px_from_ortho(const float uv[2], static void screen_px_from_persp(const float uv[2], const float v1co[4], const float v2co[4], - const float v3co[4], /* screenspace coords */ + const float v3co[4], /* screen-space coords */ const float uv1co[2], const float uv2co[2], const float uv3co[2], @@ -1923,7 +1923,7 @@ static ProjPixel *project_paint_uvpixel_init(const ProjPaintState *ps, projPixel->newColor.uint = 0; } - /* screenspace unclamped, we could keep its z and w values but don't need them at the moment */ + /* Screen-space unclamped, we could keep its z and w values but don't need them at the moment. */ if (ps->brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) { copy_v3_v3(projPixel->worldCoSS, world_spaceCo); } @@ -2304,14 +2304,14 @@ static bool project_bucket_isect_circle(const float cent[2], return false; } -/* Note for rect_to_uvspace_ortho() and rect_to_uvspace_persp() +/* Note for #rect_to_uvspace_ortho() and #rect_to_uvspace_persp() * in ortho view this function gives good results when bucket_bounds are outside the triangle * however in some cases, perspective view will mess up with faces - * that have minimal screenspace area (viewed from the side). + * that have minimal screen-space area (viewed from the side). * * for this reason its not reliable in this case so we'll use the Simple Barycentric' - * funcs that only account for points inside the triangle. - * however switching back to this for ortho is always an option */ + * functions that only account for points inside the triangle. + * however switching back to this for ortho is always an option. */ static void rect_to_uvspace_ortho(const rctf *bucket_bounds, const float *v1coSS, @@ -2517,8 +2517,8 @@ static void project_bucket_clip_face(const bool is_ortho, flip = (((line_point_side_v2(v1coSS, v2coSS, v3coSS) > 0.0f) != is_flip_object) != (line_point_side_v2(uv1co, uv2co, uv3co) > 0.0f)); - /* all screenspace points are inside the bucket bounding box, - * this means we don't need to clip and can simply return the UVs */ + /* All screen-space points are inside the bucket bounding box, + * this means we don't need to clip and can simply return the UVs. */ if (flip) { /* facing the back? */ copy_v2_v2(bucket_bounds_uv[0], uv3co); copy_v2_v2(bucket_bounds_uv[1], uv2co); @@ -2635,7 +2635,7 @@ static void project_bucket_clip_face(const bool is_ortho, (line_point_side_v2(uv1co, uv2co, uv3co) > 0.0f)); if (inside_face_flag == ISECT_ALL4) { - /* bucket is totally inside the screenspace face, we can safely use weights */ + /* Bucket is totally inside the screen-space face, we can safely use weights. */ if (is_ortho) { rect_to_uvspace_ortho( @@ -2656,7 +2656,7 @@ static void project_bucket_clip_face(const bool is_ortho, * The 2 cases above are where the face is inside the bucket * or the bucket is inside the face. * - * we need to make a convex polyline from the intersection between the screenspace face + * we need to make a convex poly-line from the intersection between the screen-space face * and the bucket bounds. * * There are a number of ways this could be done, currently it just collects all @@ -2997,7 +2997,7 @@ static void project_paint_face_init(const ProjPaintState *ps, /* vert co screen-space, these will be assigned to lt_vtri[0-2] */ const float *v1coSS, *v2coSS, *v3coSS; - /* vertex screenspace coords */ + /* Vertex screen-space coords. */ const float *vCo[3]; float w[3], wco[3]; @@ -3007,9 +3007,9 @@ static void project_paint_face_init(const ProjPaintState *ps, float pixelScreenCo[4]; bool do_3d_mapping = ps->brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D; - /* ispace bounds */ + /* Image-space bounds. */ rcti bounds_px; - /* vars for getting uvspace bounds */ + /* Variables for getting UV-space bounds. */ /* bucket bounds in UV space so we can init pixels only for this face, */ float lt_uv_pxoffset[3][2]; @@ -3207,10 +3207,10 @@ static void project_paint_face_init(const ProjPaintState *ps, /* inset face coords. NOTE!!! ScreenSace for ortho, Worldspace in perspective view */ float insetCos[3][3]; - /* vertex screenspace coords */ + /* Vertex screen-space coords. */ const float *vCoSS[3]; - /* Store the screenspace coords of the face, + /* Store the screen-space coords of the face, * clipped by the bucket's screen aligned rectangle. */ float bucket_clip_edges[2][2]; float edge_verts_inset_clip[2][3]; @@ -3419,7 +3419,7 @@ static void project_paint_face_init(const ProjPaintState *ps, } /** - * Takes floating point screenspace min/max and + * Takes floating point screen-space min/max and * returns int min/max to be used as indices for ps->bucketRect, ps->bucketFlags */ static void project_paint_bucket_bounds(const ProjPaintState *ps, @@ -3888,7 +3888,7 @@ static void proj_paint_state_cavity_init(ProjPaintState *ps) float no[3]; mul_v3_fl(edges[a], 1.0f / counter[a]); normal_short_to_float_v3(no, mv->no); - /* augment the diffe*/ + /* Augment the difference. */ cavities[a] = saacos(10.0f * dot_v3v3(no, edges[a])) * (float)M_1_PI; } else { @@ -4308,7 +4308,7 @@ static void project_paint_prepare_all_faces(ProjPaintState *ps, slot_last = slot; } - /* don't allow using the same inage for painting and stencilling */ + /* Don't allow using the same image for painting and stenciling. */ if (slot->ima == ps->stencil_ima) { /* Delay continuing the loop until after loop_uvs and bleed faces are initialized. * While this shouldn't be used, face-winding reads all polys. @@ -4338,7 +4338,6 @@ static void project_paint_prepare_all_faces(ProjPaintState *ps, continue; } - /* tfbase here should be non-null! */ BLI_assert(mloopuv_base != NULL); if (is_face_sel && tpage) { diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c index 8eb2ebd0f19..8fd5759d695 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c @@ -168,8 +168,11 @@ void PAINT_OT_weight_from_bones(wmOperatorType *ot) /** \name Sample Weight Operator * \{ */ -/* sets wp->weight to the closest weight value to vertex */ -/* note: we cant sample frontbuf, weight colors are interpolated too unpredictable */ +/** + * Sets wp->weight to the closest weight value to vertex. + * + * \note we can't sample front-buffer, weight colors are interpolated too unpredictable. + */ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *event) { Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); @@ -201,7 +204,7 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *even } else if (ED_mesh_pick_face( C, vc.obact, event->mval, ED_MESH_PICK_DEFAULT_FACE_DIST, &index)) { - /* this relies on knowning the internal worksings of ED_mesh_pick_face_vert() */ + /* This relies on knowing the internal workings of #ED_mesh_pick_face_vert() */ BKE_report( op->reports, RPT_WARNING, "The modifier used does not support deformed locations"); } @@ -604,7 +607,7 @@ static void gradientVert_update(WPGradient_userData *grad_data, int index) Mesh *me = grad_data->me; WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index]; - /* Optionally restrict to assigned verices only. */ + /* Optionally restrict to assigned vertices only. */ if (grad_data->use_vgroup_restrict && ((vs->flag & VGRAD_STORE_DW_EXIST) == 0)) { return; } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 6bfc10d086a..ae9d681f298 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -9523,7 +9523,7 @@ void SCULPT_fake_neighbors_ensure(Sculpt *sd, Object *ob, const float max_dist) for (int i = 0; i < totvert; i++) { const int from_v = i; - /* This vertex does not have a fake neighbor yet, seach one for it. */ + /* This vertex does not have a fake neighbor yet, search one for it. */ if (ss->fake_neighbors.fake_neighbor_index[from_v] == FAKE_NEIGHBOR_NONE) { const int to_v = SCULPT_fake_neighbor_search(sd, ob, from_v, max_dist); if (to_v != -1) { diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c b/source/blender/editors/sculpt_paint/sculpt_face_set.c index f8ceaab5d85..5842a47075e 100644 --- a/source/blender/editors/sculpt_paint/sculpt_face_set.c +++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c @@ -205,7 +205,7 @@ static void do_relax_face_sets_brush_task_cb_ex(void *__restrict userdata, ss, &test, data->brush->falloff_shape); const bool relax_face_sets = !(ss->cache->iteration_count % 3 == 0); - /* This operations needs a stregth tweak as the relax deformation is too weak by default. */ + /* This operations needs a strength tweak as the relax deformation is too weak by default. */ if (relax_face_sets) { bstrength *= 2.0f; } @@ -313,7 +313,7 @@ static int sculpt_face_set_create_exec(bContext *C, wmOperator *op) const int mode = RNA_enum_get(op->ptr, "mode"); - /* Dyntopo not suported. */ + /* Dyntopo not supported. */ if (BKE_pbvh_type(ss->pbvh) == PBVH_BMESH) { return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c index fa773406b4d..12a179ef0bb 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c +++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c @@ -604,7 +604,7 @@ static void mesh_filter_sharpen_init(SculptSession *ss, filter_cache->sharpen_factor[i] = 1.0f - pow2f(1.0f - filter_cache->sharpen_factor[i]); } - /* Smooth the calculated factors and directions to remove high frecuency detail. */ + /* Smooth the calculated factors and directions to remove high frequency detail. */ for (int smooth_iterations = 0; smooth_iterations < filter_cache->sharpen_curvature_smooth_iterations; smooth_iterations++) { diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index ade5ccb3907..f65efb9c79f 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -525,7 +525,7 @@ void SCULPT_boundary_edges_preview_draw(const uint gpuattr, const float outline_alpha); void SCULPT_boundary_pivot_line_preview_draw(const uint gpuattr, struct SculptSession *ss); -/* Multiplane Scrape Brush. */ +/* Multi-plane Scrape Brush. */ void SCULPT_do_multiplane_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode); void SCULPT_multiplane_scrape_preview_draw(const uint gpuattr, Brush *brush, diff --git a/source/blender/editors/sculpt_paint/sculpt_pose.c b/source/blender/editors/sculpt_paint/sculpt_pose.c index 1bf9ba60073..f9ccbbb849c 100644 --- a/source/blender/editors/sculpt_paint/sculpt_pose.c +++ b/source/blender/editors/sculpt_paint/sculpt_pose.c @@ -738,7 +738,7 @@ static SculptPoseIKChain *pose_ik_chain_init_topology(Sculpt *sd, * iteration an the current iteration. */ for (int j = 0; j < totvert; j++) { ik_chain->segments[i].weights[j] = pose_factor_grow[j] - pose_factor_grow_prev[j]; - /* Store the current grow factor status for the next interation. */ + /* Store the current grow factor status for the next iteration. */ pose_factor_grow_prev[j] = pose_factor_grow[j]; } } diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 938080b392d..ec103bd2b98 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -1527,9 +1527,14 @@ static void sculpt_undosys_step_decode_redo(struct bContext *C, } } -static void sculpt_undosys_step_decode( - struct bContext *C, struct Main *bmain, UndoStep *us_p, int dir, bool UNUSED(is_final)) +static void sculpt_undosys_step_decode(struct bContext *C, + struct Main *bmain, + UndoStep *us_p, + const eUndoStepDir dir, + bool UNUSED(is_final)) { + BLI_assert(dir != STEP_INVALID); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); /* Ensure sculpt mode. */ @@ -1568,10 +1573,10 @@ static void sculpt_undosys_step_decode( } SculptUndoStep *us = (SculptUndoStep *)us_p; - if (dir < 0) { + if (dir == STEP_UNDO) { sculpt_undosys_step_decode_undo(C, depsgraph, us); } - else { + else if (dir == STEP_REDO) { sculpt_undosys_step_decode_redo(C, depsgraph, us); } } diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 34617804888..391bc5dab45 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -877,7 +877,7 @@ static void SOUND_OT_unpack(wmOperatorType *ot) /* properties */ RNA_def_enum( ot->srna, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "Method", "How to unpack"); - /* XXX, weark!, will fail with library, name collisions */ + /* XXX: weak!, will fail with library, name collisions */ RNA_def_string( ot->srna, "id", NULL, MAX_ID_NAME - 2, "Sound Name", "Sound data-block name to unpack"); } diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index f731fe23b7c..f8389d40831 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -73,7 +73,7 @@ /* ************************************************************************** */ /* POSE MARKERS STUFF */ -/* *************************** Localise Markers ***************************** */ +/* *************************** Localize Markers ***************************** */ /* ensure that there is: * 1) an active action editor @@ -322,7 +322,7 @@ static bool actkeys_channels_get_selected_extents(bAnimContext *ac, float *min, bAnimListElem *ale; int filter; - /* NOTE: not bool, since we want prioritise individual channels over expanders */ + /* NOTE: not bool, since we want prioritize individual channels over expanders. */ short found = 0; /* get all items - we need to do it this way */ @@ -346,7 +346,7 @@ static bool actkeys_channels_get_selected_extents(bAnimContext *ac, float *min, found = acf->channel_role; /* only stop our search when we've found an actual channel - * - datablock expanders get less priority so that we don't abort prematurely + * - data-block expanders get less priority so that we don't abort prematurely */ if (found == ACHANNEL_ROLE_CHANNEL) { break; diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index 01e57eab7c2..817760615df 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -287,7 +287,7 @@ static void xxx_free(SpaceLink *UNUSED(sl)) { } -/* spacetype; init callback for usage, should be redoable */ +/* spacetype; init callback for usage, should be re-doable. */ static void xxx_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(area)) { diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index ea2dd0cb7aa..38a05eef6e3 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -569,7 +569,7 @@ static void view_zoom_init(bContext *C, wmOperator *op, const wmEvent *event) WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); } - if (U.viewzoom == USER_ZOOM_CONT) { + if (U.viewzoom == USER_ZOOM_CONTINUE) { /* needs a timer to continue redrawing */ vpd->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f); vpd->timer_lastdraw = PIL_check_seconds_timer(); @@ -662,7 +662,7 @@ static void view_zoom_apply( delta = -delta; } - if (U.viewzoom == USER_ZOOM_CONT) { + if (U.viewzoom == USER_ZOOM_CONTINUE) { SpaceClip *sclip = CTX_wm_space_clip(C); double time = PIL_check_seconds_timer(); float time_step = (float)(time - vpd->timer_lastdraw); diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 77f1111624d..05595e0b393 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -18,7 +18,7 @@ * \ingroup spconsole */ -#include /* ispunct */ +#include /* #ispunct */ #include #include #include @@ -749,7 +749,7 @@ static int console_clear_exec(bContext *C, wmOperator *op) /*ConsoleLine *ci = */ console_history_verify(C); - if (scrollback) { /* last item in mistory */ + if (scrollback) { /* Last item in history. */ while (sc->scrollback.first) { console_scrollback_free(sc, sc->scrollback.first); } diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 6265cbdd920..790ea379e54 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -216,7 +216,7 @@ static void console_main_region_draw(const bContext *C, ARegion *region) /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); - /* worlks best with no view2d matrix set */ + /* Works best with no view2d matrix set. */ UI_view2d_view_ortho(v2d); /* data... */ diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index a12c9633798..537d8849372 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -473,7 +473,7 @@ static void file_draw_preview(uiBlock *block, but = uiDefBut(block, UI_BTYPE_LABEL, 0, "", xco, yco, ex, ey, NULL, 0.0, 0.0, 0, 0, NULL); - /* dragregion */ + /* Drag-region. */ if (drag) { ID *id; diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 6b74b344375..6e5791cad52 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -460,7 +460,7 @@ bool ED_fileselect_is_asset_browser(const SpaceFile *sfile) void ED_fileselect_window_params_get(const wmWindow *win, int win_size[2], bool *is_maximized) { - /* Get DPI/pixelsize independent size to be stored in preferences. */ + /* Get DPI/pixel-size independent size to be stored in preferences. */ WM_window_set_dpi(win); /* Ensure the DPI is taken from the right window. */ win_size[0] = WM_window_pixels_x(win) / UI_DPI_FAC; diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index fac38ef7b91..31f606e515d 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -178,7 +178,7 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode) x = (float)CFRA; } - /* Normalise units of cursor's value. */ + /* Normalize units of cursor's value. */ if (sipo) { y = (sipo->cursorVal / unit_scale) - offset; } @@ -2263,7 +2263,7 @@ static void snap_graph_keys(bAnimContext *ac, short mode) for (ale = anim_data.first; ale; ale = ale->next) { AnimData *adt = ANIM_nla_mapping_get(ac, ale); - /* Normalise cursor value (for normalised F-Curves display). */ + /* Normalize cursor value (for normalized F-Curves display). */ if (mode == GRAPHKEYS_SNAP_VALUE) { short mapping_flag = ANIM_get_normalization_flags(ac); float offset; diff --git a/source/blender/editors/space_graph/graph_slider_ops.c b/source/blender/editors/space_graph/graph_slider_ops.c index 0818ebe9c0a..3e52dc7377b 100644 --- a/source/blender/editors/space_graph/graph_slider_ops.c +++ b/source/blender/editors/space_graph/graph_slider_ops.c @@ -380,7 +380,7 @@ static int graphkeys_decimate_modal(bContext *C, wmOperator *op, const wmEvent * break; } - /* Unhandled event - maybe it was some view manip? */ + /* Unhandled event - maybe it was some view manipulation? */ /* Allow to pass through. */ return OPERATOR_RUNNING_MODAL | OPERATOR_PASS_THROUGH; } diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 63e5ae64a8c..67d5055ec65 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -466,7 +466,7 @@ static void sima_draw_zbuf_pixels( { const float red[4] = {1.0f, 0.0f, 0.0f, 0.0f}; - /* Slowwww */ + /* Very slow! */ float *rectf = MEM_mallocN(rectx * recty * sizeof(float), "temp"); for (int a = rectx * recty - 1; a >= 0; a--) { /* zbuffer values are signed, so we need to shift color range */ @@ -874,7 +874,7 @@ void draw_image_main(const bContext *C, ARegion *region) if (show_stereo3d) { if (show_multilayer) { - /* update multiindex and pass for the current eye */ + /* Update multi-index and pass for the current eye. */ BKE_image_multilayer_index(ima->rr, &sima->iuser); } else { diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h index 100556ad29a..0044c6072a4 100644 --- a/source/blender/editors/space_image/image_intern.h +++ b/source/blender/editors/space_image/image_intern.h @@ -71,6 +71,7 @@ void IMAGE_OT_save_all_modified(struct wmOperatorType *ot); void IMAGE_OT_pack(struct wmOperatorType *ot); void IMAGE_OT_unpack(struct wmOperatorType *ot); +void IMAGE_OT_flip(struct wmOperatorType *ot); void IMAGE_OT_invert(struct wmOperatorType *ot); void IMAGE_OT_resize(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 097e304c893..e7f468f2f26 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -467,7 +467,7 @@ static void image_view_zoom_init(bContext *C, wmOperator *op, const wmEvent *eve UI_view2d_region_to_view( ®ion->v2d, event->mval[0], event->mval[1], &vpd->location[0], &vpd->location[1]); - if (U.viewzoom == USER_ZOOM_CONT) { + if (U.viewzoom == USER_ZOOM_CONTINUE) { /* needs a timer to continue redrawing */ vpd->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f); vpd->timer_lastdraw = PIL_check_seconds_timer(); @@ -579,12 +579,10 @@ static void image_zoom_apply(ViewZoomData *vpd, delta = -delta; } - if (viewzoom == USER_ZOOM_CONT) { + if (viewzoom == USER_ZOOM_CONTINUE) { double time = PIL_check_seconds_timer(); float time_step = (float)(time - vpd->timer_lastdraw); float zfac; - - /* oldstyle zoom */ zfac = 1.0f + ((delta / 20.0f) * time_step); vpd->timer_lastdraw = time; /* this is the final zoom, but instead make it into a factor */ @@ -2662,6 +2660,126 @@ void IMAGE_OT_new(wmOperatorType *ot) /** \} */ +/* -------------------------------------------------------------------- */ +/** \name Flip Operator + * \{ */ + +static int image_flip_exec(bContext *C, wmOperator *op) +{ + Image *ima = image_from_context(C); + ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL); + SpaceImage *sima = CTX_wm_space_image(C); + const bool is_paint = ((sima != NULL) && (sima->mode == SI_MODE_PAINT)); + + if (ibuf == NULL) { + /* TODO: this should actually never happen, but does for render-results -> cleanup. */ + return OPERATOR_CANCELLED; + } + + const bool flip_horizontal = RNA_boolean_get(op->ptr, "use_flip_horizontal"); + const bool flip_vertical = RNA_boolean_get(op->ptr, "use_flip_vertical"); + + if (!flip_horizontal && !flip_vertical) { + BKE_image_release_ibuf(ima, ibuf, NULL); + return OPERATOR_FINISHED; + } + + ED_image_undo_push_begin_with_image(op->type->name, ima, ibuf, &sima->iuser); + + if (is_paint) { + ED_imapaint_clear_partial_redraw(); + } + + const int size_x = ibuf->x; + const int size_y = ibuf->y; + + if (ibuf->rect_float) { + float *float_pixels = (float *)ibuf->rect_float; + + float *orig_float_pixels = MEM_dupallocN(float_pixels); + for (int x = 0; x < size_x; x++) { + for (int y = 0; y < size_y; y++) { + const int source_pixel_x = flip_horizontal ? size_x - x - 1 : x; + const int source_pixel_y = flip_vertical ? size_y - y - 1 : y; + + float *source_pixel = &orig_float_pixels[4 * (source_pixel_x + source_pixel_y * size_x)]; + float *target_pixel = &float_pixels[4 * (x + y * size_x)]; + + copy_v4_v4(target_pixel, source_pixel); + } + } + MEM_freeN(orig_float_pixels); + + if (ibuf->rect) { + IMB_rect_from_float(ibuf); + } + } + else if (ibuf->rect) { + char *char_pixels = (char *)ibuf->rect; + char *orig_char_pixels = MEM_dupallocN(char_pixels); + for (int x = 0; x < size_x; x++) { + for (int y = 0; y < size_y; y++) { + const int source_pixel_x = flip_horizontal ? size_x - x - 1 : x; + const int source_pixel_y = flip_vertical ? size_y - y - 1 : y; + + char *source_pixel = &orig_char_pixels[4 * (source_pixel_x + source_pixel_y * size_x)]; + char *target_pixel = &char_pixels[4 * (x + y * size_x)]; + + copy_v4_v4_char(target_pixel, source_pixel); + } + } + MEM_freeN(orig_char_pixels); + } + else { + BKE_image_release_ibuf(ima, ibuf, NULL); + return OPERATOR_CANCELLED; + } + + ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID; + BKE_image_mark_dirty(ima, ibuf); + + if (ibuf->mipmap[0]) { + ibuf->userflags |= IB_MIPMAP_INVALID; + } + + ED_image_undo_push_end(); + + /* force GPU reupload, all image is invalid. */ + BKE_image_free_gputextures(ima); + + WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima); + + BKE_image_release_ibuf(ima, ibuf, NULL); + + return OPERATOR_FINISHED; +} + +void IMAGE_OT_flip(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Flip Image"; + ot->idname = "IMAGE_OT_flip"; + ot->description = "Flip the image"; + + /* api callbacks */ + ot->exec = image_flip_exec; + ot->poll = image_from_context_has_data_poll_no_image_user; + + /* properties */ + PropertyRNA *prop; + prop = RNA_def_boolean( + ot->srna, "use_flip_horizontal", false, "Horizontal", "Flip the image horizontally"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + prop = RNA_def_boolean( + ot->srna, "use_flip_vertical", false, "Vertical", "Flip the image vertically"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + + /* flags */ + ot->flag = OPTYPE_REGISTER; +} + +/** \} */ + /* -------------------------------------------------------------------- */ /** \name Invert Operators * \{ */ @@ -2747,7 +2865,7 @@ static int image_invert_exec(bContext *C, wmOperator *op) ED_image_undo_push_end(); - /* force GPU reupload, all image is invalid */ + /* Force GPU re-upload, all image is invalid. */ BKE_image_free_gputextures(ima); WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima); @@ -2838,7 +2956,7 @@ static int image_scale_exec(bContext *C, wmOperator *op) ED_image_undo_push_end(); - /* force GPU reupload, all image is invalid */ + /* Force GPU re-upload, all image is invalid. */ BKE_image_free_gputextures(ima); DEG_id_tag_update(&ima->id, 0); diff --git a/source/blender/editors/space_image/image_undo.c b/source/blender/editors/space_image/image_undo.c index 1d5725033e0..391c68f4231 100644 --- a/source/blender/editors/space_image/image_undo.c +++ b/source/blender/editors/space_image/image_undo.c @@ -947,13 +947,15 @@ static void image_undosys_step_decode_redo(ImageUndoStep *us) } static void image_undosys_step_decode( - struct bContext *C, struct Main *bmain, UndoStep *us_p, int dir, bool is_final) + struct bContext *C, struct Main *bmain, UndoStep *us_p, const eUndoStepDir dir, bool is_final) { + BLI_assert(dir != STEP_INVALID); + ImageUndoStep *us = (ImageUndoStep *)us_p; - if (dir < 0) { + if (dir == STEP_UNDO) { image_undosys_step_decode_undo(us, is_final); } - else { + else if (dir == STEP_REDO) { image_undosys_step_decode_redo(us); } diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index b0571d47736..0dd99824dcd 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -234,6 +234,7 @@ static void image_operatortypes(void) WM_operatortype_append(IMAGE_OT_pack); WM_operatortype_append(IMAGE_OT_unpack); + WM_operatortype_append(IMAGE_OT_flip); WM_operatortype_append(IMAGE_OT_invert); WM_operatortype_append(IMAGE_OT_resize); diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c index 414bce29502..dc926587367 100644 --- a/source/blender/editors/space_info/info_draw.c +++ b/source/blender/editors/space_info/info_draw.c @@ -56,7 +56,7 @@ static enum eTextViewContext_LineFlag report_line_data(TextViewContext *tvc, int shade = (tvc->iter_tmp % 2) ? 4 : -4; UI_GetThemeColorShade4ubv(bg_id, shade, bg); - /* Icon color and backgound depend of report type. */ + /* Icon color and background depend of report type. */ int icon_fg_id; int icon_bg_id; diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index 5e44db4c791..e2ab139aa07 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -150,7 +150,7 @@ static void info_main_region_draw(const bContext *C, ARegion *region) info_textview_update_rect(C, region); - /* worlks best with no view2d matrix set */ + /* Works best with no view2d matrix set. */ UI_view2d_view_ortho(v2d); info_textview_main(sinfo, region, CTX_wm_reports(C)); diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index d7bf6c324ac..031cf7c6376 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -215,7 +215,7 @@ bool nlaedit_disable_tweakmode(bAnimContext *ac, bool do_solo) return false; } - /* for each AnimData block with NLA-data, try exitting tweak-mode */ + /* For each AnimData block with NLA-data, try exiting tweak-mode. */ for (ale = anim_data.first; ale; ale = ale->next) { AnimData *adt = ale->data; @@ -418,7 +418,7 @@ static bool nla_channels_get_selected_extents(bAnimContext *ac, float *min, floa int filter; SpaceNla *snla = (SpaceNla *)ac->sl; - /* NOTE: not bool, since we want prioritise individual channels over expanders */ + /* NOTE: not bool, since we want prioritize individual channels over expanders. */ short found = 0; /* get all items - we need to do it this way */ @@ -442,7 +442,7 @@ static bool nla_channels_get_selected_extents(bAnimContext *ac, float *min, floa found = acf->channel_role; /* only stop our search when we've found an actual channel - * - datablock expanders get less priority so that we don't abort prematurely + * - data-block expanders get less priority so that we don't abort prematurely */ if (found == ACHANNEL_ROLE_CHANNEL) { break; @@ -1532,11 +1532,11 @@ static int nlaedit_swap_exec(bContext *C, wmOperator *op) const bool is_liboverride = ID_IS_OVERRIDE_LIBRARY(ale->id); if (BKE_nlatrack_is_nonlocal_in_liboverride(ale->id, nlt)) { - /* No re-ordering of strips whithin non-local tracks of override data. */ + /* No re-ordering of strips within non-local tracks of override data. */ continue; } - /* make temporary metastrips so that entire islands of selections can be moved around */ + /* Make temporary meta-strips so that entire islands of selections can be moved around. */ BKE_nlastrips_make_metas(&nlt->strips, 1); /* special case: if there is only 1 island diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 1d66119d569..132dcd8a9fb 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -190,7 +190,7 @@ static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA cumap->flag &= ~CUMA_DRAW_SAMPLE; } - /* "Tone" (Standard/Filmlike) only used in the Compositor. */ + /* "Tone" (Standard/Film-like) only used in the Compositor. */ bNodeTree *ntree = (bNodeTree *)ptr->owner_id; uiTemplateCurveMapping( layout, ptr, "mapping", 'c', false, false, false, (ntree->type == NTREE_COMPOSIT)); @@ -559,7 +559,7 @@ static void node_draw_reroute(const bContext *C, if (node->flag & SELECT) { GPU_blend(GPU_BLEND_ALPHA); GPU_line_smooth(true); - /* using different shades of TH_TEXT_HI for the empasis, like triangle */ + /* Using different shades of #TH_TEXT_HI for the emphasis, like triangle. */ if (node->flag & NODE_ACTIVE) { UI_GetThemeColorShadeAlpha4fv(TH_TEXT_HI, 0, -40, debug_color); } @@ -3336,6 +3336,7 @@ static void node_geometry_buts_align_rotation_to_vector(uiLayout *layout, PointerRNA *ptr) { uiItemR(layout, ptr, "axis", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(layout, ptr, "pivot_axis", DEFAULT_FLAGS, IFACE_("Pivot"), ICON_NONE); uiLayout *col = uiLayoutColumn(layout, false); uiItemR(col, ptr, "input_type_factor", DEFAULT_FLAGS, IFACE_("Factor"), ICON_NONE); uiItemR(col, ptr, "input_type_vector", DEFAULT_FLAGS, IFACE_("Vector"), ICON_NONE); @@ -3381,6 +3382,22 @@ static void node_geometry_buts_collection_info(uiLayout *layout, uiItemR(layout, ptr, "transform_space", UI_ITEM_R_EXPAND, NULL, ICON_NONE); } +static void node_geometry_buts_attribute_proximity(uiLayout *layout, + bContext *UNUSED(C), + PointerRNA *ptr) +{ + uiItemR(layout, ptr, "target_geometry_element", DEFAULT_FLAGS, "", ICON_NONE); +} + +static void node_geometry_buts_volume_to_mesh(uiLayout *layout, + bContext *UNUSED(C), + PointerRNA *ptr) +{ + uiLayoutSetPropSep(layout, true); + uiLayoutSetPropDecorate(layout, false); + uiItemR(layout, ptr, "resolution_mode", DEFAULT_FLAGS, IFACE_("Resolution"), ICON_NONE); +} + static void node_geometry_set_butfunc(bNodeType *ntype) { switch (ntype->type) { @@ -3444,6 +3461,12 @@ static void node_geometry_set_butfunc(bNodeType *ntype) case GEO_NODE_COLLECTION_INFO: ntype->draw_buttons = node_geometry_buts_collection_info; break; + case GEO_NODE_ATTRIBUTE_PROXIMITY: + ntype->draw_buttons = node_geometry_buts_attribute_proximity; + break; + case GEO_NODE_VOLUME_TO_MESH: + ntype->draw_buttons = node_geometry_buts_volume_to_mesh; + break; } } diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 037587809b0..4dd945c4cf1 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -1871,7 +1871,7 @@ void node_draw_space(const bContext *C, ARegion *region) if (snode->treepath.last) { if (snode->flag & SNODE_SHOW_GPENCIL) { - /* draw grease-pencil (screen strokes, and also paintbuffer) */ + /* Draw grease-pencil (screen strokes, and also paint-buffer). */ ED_annotation_draw_view2d(C, false); } } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index ced81401874..c006889f0f7 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -770,7 +770,7 @@ void ED_node_post_apply_transform(bContext *UNUSED(C), bNodeTree *UNUSED(ntree)) * which only exists during actual drawing. Can we rely on valid totr rects? */ /* make sure nodes have correct bounding boxes after transform */ - /* node_update_nodetree(C, ntree, 0.0f, 0.0f); */ + // node_update_nodetree(C, ntree, 0.0f, 0.0f); } /* ***************** generic operator functions for nodes ***************** */ @@ -1199,7 +1199,7 @@ static int node_duplicate_exec(bContext *C, wmOperator *op) if (node->flag & SELECT) { BKE_node_copy_store_new_pointers(ntree, node, LIB_ID_COPY_DEFAULT); - /* to ensure redraws or rerenders happen */ + /* To ensure redraws or re-renders happen. */ ED_node_tag_update_id(snode->id); } diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c index f2abe272f48..7f530408ec7 100644 --- a/source/blender/editors/space_node/node_group.c +++ b/source/blender/editors/space_node/node_group.c @@ -1039,7 +1039,7 @@ static int node_group_make_exec(bContext *C, wmOperator *op) snode_notify(C, snode); snode_dag_update(C, snode); - /* We broke relations in node tree, need to rebuild them in the grahes. */ + /* We broke relations in node tree, need to rebuild them in the graphs. */ DEG_relations_tag_update(bmain); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index 1754f84c374..f3ce60bbcd9 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -736,7 +736,7 @@ static void node_link_find_socket(bContext *C, wmOperator *op, float cursor[2]) } } -/* loop that adds a nodelink, called by function below */ +/* Loop that adds a node-link, called by function below. */ /* in_out = starting socket */ static int node_link_modal(bContext *C, wmOperator *op, const wmEvent *event) { @@ -1543,7 +1543,7 @@ void ED_node_link_intersect_test(ScrArea *area, int test) /* loop over link coords to find shortest dist to * upper left node edge of a intersected line segment */ for (int i = 0; i < NODE_LINK_RESOL; i++) { - /* check if the node rect intersetcts the line from this point to next one */ + /* Check if the node rectangle intersects the line from this point to next one. */ if (BLI_rctf_isect_segment(&select->totr, coord_array[i], coord_array[i + 1])) { /* store the shortest distance to the upper left edge * of all intersections found so far */ diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c index 467802d181b..70aeef76234 100644 --- a/source/blender/editors/space_outliner/outliner_dragdrop.c +++ b/source/blender/editors/space_outliner/outliner_dragdrop.c @@ -140,7 +140,7 @@ static TreeElement *outliner_drop_insert_find(bContext *C, TreeElement *te_hovered; float view_mval[2]; - /* Emtpy tree, e.g. while filtered. */ + /* Empty tree, e.g. while filtered. */ if (BLI_listbase_is_empty(&space_outliner->tree)) { return NULL; } diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index d424bb2319a..35756ea5ac7 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -3059,7 +3059,7 @@ static void outliner_draw_tree_element(bContext *C, } else { active = tree_element_type_active(C, tvc, space_outliner, te, tselem, OL_SETSEL_NONE, false); - /* active collection*/ + /* Active collection. */ } /* active circle */ @@ -3079,7 +3079,7 @@ static void outliner_draw_tree_element(bContext *C, } else if (te->subtree.first || (tselem->type == 0 && te->idcode == ID_SCE) || (te->flag & TE_LAZY_CLOSED)) { - /* open/close icon, only when sublevels, except for scene */ + /* Open/close icon, only when sub-levels, except for scene. */ int icon_x = startx; /* Icons a bit higher. */ @@ -3517,7 +3517,7 @@ static void outliner_draw_tree(bContext *C, GPU_scissor(0, 0, mask_x, region->winy); } - /* Draw hierarhcy lines for collections and object children. */ + /* Draw hierarchy lines for collections and object children. */ starty = (int)region->v2d.tot.ymax - OL_Y_OFFSET; startx = mode_column_offset + UI_UNIT_X / 2 - (U.pixelsize + 1) / 2; outliner_draw_hierarchy_lines(space_outliner, &space_outliner->tree, startx, &starty); diff --git a/source/blender/editors/space_outliner/outliner_sync.c b/source/blender/editors/space_outliner/outliner_sync.c index 0b2d1ce34ec..81b8974fba4 100644 --- a/source/blender/editors/space_outliner/outliner_sync.c +++ b/source/blender/editors/space_outliner/outliner_sync.c @@ -378,7 +378,7 @@ void ED_outliner_select_sync_from_outliner(bContext *C, SpaceOutliner *space_out selected_items_free(&selected_items); - /* Tag for updates and clear dirty flag toprevent a sync to the outliner on draw */ + /* Tag for updates and clear dirty flag to prevent a sync to the outliner on draw. */ if (sync_types.object) { space_outliner->sync_select_dirty &= ~WM_OUTLINER_SYNC_SELECT_FROM_OBJECT; DEG_id_tag_update(&scene->id, ID_RECALC_SELECT); @@ -545,7 +545,7 @@ static void get_sync_select_active_data(const bContext *C, SyncSelectActiveData active_data->sequence = SEQ_select_active_get(scene); } -/* If outliner is dirty sync selection from view layer and sequwncer */ +/* If outliner is dirty sync selection from view layer and sequencer. */ void outliner_sync_selection(const bContext *C, SpaceOutliner *space_outliner) { /* Set which types of data to sync from sync dirty flag and outliner display mode */ diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index fa485dc6b4b..8b522d41af8 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -794,7 +794,7 @@ static void id_override_library_create_fn(bContext *C, id_root->tag |= LIB_TAG_DOIT; - /* For now, remapp all local usages of linked ID to local override one here. */ + /* For now, remap all local usages of linked ID to local override one here. */ ID *id_iter; FOREACH_MAIN_ID_BEGIN (bmain, id_iter) { if (ID_IS_LINKED(id_iter)) { diff --git a/source/blender/editors/space_outliner/outliner_utils.c b/source/blender/editors/space_outliner/outliner_utils.c index e0d63dfcf81..92178cfdfc9 100644 --- a/source/blender/editors/space_outliner/outliner_utils.c +++ b/source/blender/editors/space_outliner/outliner_utils.c @@ -169,7 +169,7 @@ TreeElement *outliner_find_item_at_x_in_row(const SpaceOutliner *space_outliner, return te; } -/* Find specific item from the treestore */ +/* Find specific item from the trees-tore. */ TreeElement *outliner_find_tree_element(ListBase *lb, const TreeStoreElem *store_elem) { LISTBASE_FOREACH (TreeElement *, te, lb) { diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 3b476fefe47..ffcb3d35d5a 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -26,6 +26,7 @@ #include #include "BLI_blenlib.h" +#include "BLI_ghash.h" #include "BLI_math.h" #include "BLI_utildefines.h" @@ -771,69 +772,83 @@ void SEQUENCER_OT_select(wmOperatorType *ot) * \{ */ /* Run recursively to select linked. */ -static bool select_more_less_seq__internal(Scene *scene, bool sel, const bool linked) +static bool select_linked_internal(Scene *scene) { Editing *ed = SEQ_editing_get(scene, false); - Sequence *seq, *neighbor; - bool changed = false; - int isel; if (ed == NULL) { - return changed; + return false; } - if (sel) { - sel = SELECT; - isel = 0; - } - else { - sel = 0; - isel = SELECT; - } + bool changed = false; - if (!linked) { - /* If not linked we only want to touch each seq once, newseq. */ - for (seq = ed->seqbasep->first; seq; seq = seq->next) { - seq->tmp = NULL; + LISTBASE_FOREACH (Sequence *, seq, SEQ_active_seqbase_get(ed)) { + if ((seq->flag & SELECT) != 0) { + continue; + } + /* Only get unselected neighbors. */ + Sequence *neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_LEFT, 0); + if (neighbor) { + neighbor->flag |= SELECT; + recurs_sel_seq(neighbor); + changed = true; + } + neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_RIGHT, 0); + if (neighbor) { + neighbor->flag |= SELECT; + recurs_sel_seq(neighbor); + changed = true; } } - for (seq = ed->seqbasep->first; seq; seq = seq->next) { - if ((seq->flag & SELECT) == sel) { - if (linked || (seq->tmp == NULL)) { - /* Only get unselected neighbors. */ - neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_LEFT, isel); - if (neighbor) { - if (sel) { - neighbor->flag |= SELECT; - recurs_sel_seq(neighbor); - } - else { - neighbor->flag &= ~SELECT; - } - if (!linked) { - neighbor->tmp = (Sequence *)1; - } - changed = true; - } - neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_RIGHT, isel); - if (neighbor) { - if (sel) { - neighbor->flag |= SELECT; - recurs_sel_seq(neighbor); - } - else { - neighbor->flag &= ~SELECT; - } - if (!linked) { - neighbor->tmp = (Sequence *)1; - } - changed = true; - } - } + return changed; +} + +/* Select only one linked strip on each side. */ +static bool select_more_less_seq__internal(Scene *scene, bool select_more) +{ + Editing *ed = SEQ_editing_get(scene, false); + + if (ed == NULL) { + return false; + } + + GSet *neighbors = BLI_gset_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "Linked strips"); + const int neighbor_selection_filter = select_more ? 0 : SELECT; + const int selection_filter = select_more ? SELECT : 0; + + LISTBASE_FOREACH (Sequence *, seq, SEQ_active_seqbase_get(ed)) { + if ((seq->flag & SELECT) != selection_filter) { + continue; + } + Sequence *neighbor = find_neighboring_sequence( + scene, seq, SEQ_SIDE_LEFT, neighbor_selection_filter); + if (neighbor) { + BLI_gset_add(neighbors, neighbor); + } + neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_RIGHT, neighbor_selection_filter); + if (neighbor) { + BLI_gset_add(neighbors, neighbor); } } + bool changed = false; + GSetIterator gsi; + BLI_gsetIterator_init(&gsi, neighbors); + while (!BLI_gsetIterator_done(&gsi)) { + Sequence *neighbor = BLI_gsetIterator_getKey(&gsi); + if (select_more) { + neighbor->flag |= SELECT; + recurs_sel_seq(neighbor); + } + else { + neighbor->flag &= ~SELECT; + } + changed = true; + BLI_gsetIterator_step(&gsi); + } + + BLI_gset_free(neighbors, NULL); return changed; } @@ -841,7 +856,7 @@ static int sequencer_select_more_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); - if (!select_more_less_seq__internal(scene, true, false)) { + if (!select_more_less_seq__internal(scene, true)) { return OPERATOR_CANCELLED; } @@ -877,7 +892,7 @@ static int sequencer_select_less_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); - if (!select_more_less_seq__internal(scene, false, false)) { + if (!select_more_less_seq__internal(scene, false)) { return OPERATOR_CANCELLED; } @@ -934,7 +949,7 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, cons selected = 1; while (selected) { - selected = select_more_less_seq__internal(scene, 1, 1); + selected = select_linked_internal(scene); } ED_outliner_select_sync_from_sequence_tag(C); @@ -975,7 +990,7 @@ static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op)) selected = true; while (selected) { - selected = select_more_less_seq__internal(scene, true, true); + selected = select_linked_internal(scene); } ED_outliner_select_sync_from_sequence_tag(C); diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 51c2d3ebdf1..d7937725705 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -954,7 +954,7 @@ void ED_spacetype_sequencer(void) art->listener = sequencer_main_region_listener; BLI_addhead(&st->regiontypes, art); - /* Hud. */ + /* HUD. */ art = ED_area_type_hud(st->spaceid); BLI_addhead(&st->regiontypes, art); diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index b38f92402b3..883556948e2 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -722,7 +722,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *region) void text_drawcache_tag_update(SpaceText *st, int full) { - /* this happens if text editor ops are caled from python */ + /* This happens if text editor ops are called from Python. */ if (st == NULL) { return; } diff --git a/source/blender/editors/space_text/text_format.c b/source/blender/editors/space_text/text_format.c index d099f2a20d8..66765206fa6 100644 --- a/source/blender/editors/space_text/text_format.c +++ b/source/blender/editors/space_text/text_format.c @@ -237,7 +237,7 @@ bool ED_text_is_syntax_highlight_supported(Text *text) const char *text_ext = BLI_path_extension(text->id.name + 2); if (text_ext == NULL) { - /* Extensionless datablocks are considered highlightable as Python. */ + /* Extensionless data-blocks are considered highlightable as Python. */ return true; } text_ext++; /* skip the '.' */ diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 932bacfb8a0..526285c076a 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -3832,7 +3832,7 @@ static int text_resolve_conflict_invoke(bContext *C, wmOperator *op, const wmEve switch (BKE_text_file_modified_check(text)) { case 1: if (text->flags & TXT_ISDIRTY) { - /* modified locally and externally, ahhh. offer more possibilities. */ + /* Modified locally and externally, ah. offer more possibilities. */ pup = UI_popup_menu_begin( C, IFACE_("File Modified Outside and Inside Blender"), ICON_NONE); layout = UI_popup_menu_layout(pup); diff --git a/source/blender/editors/space_text/text_undo.c b/source/blender/editors/space_text/text_undo.c index 61b786b2b13..f55db8c3cc9 100644 --- a/source/blender/editors/space_text/text_undo.c +++ b/source/blender/editors/space_text/text_undo.c @@ -196,14 +196,19 @@ static bool text_undosys_step_encode(struct bContext *C, return true; } -static void text_undosys_step_decode( - struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int dir, bool is_final) +static void text_undosys_step_decode(struct bContext *C, + struct Main *UNUSED(bmain), + UndoStep *us_p, + const eUndoStepDir dir, + bool is_final) { + BLI_assert(dir != STEP_INVALID); + TextUndoStep *us = (TextUndoStep *)us_p; Text *text = us->text_ref.ptr; TextState *state; - if ((us->states[0].buf_array_state != NULL) && (dir == -1) && !is_final) { + if ((us->states[0].buf_array_state != NULL) && (dir == STEP_UNDO) && !is_final) { state = &us->states[0]; } else { diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 3c970781448..aa4922372c8 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -165,7 +165,7 @@ void ED_view3d_update_viewmat(Depsgraph *depsgraph, rv3d->viewcamtexcofac[2] = rv3d->viewcamtexcofac[3] = 0.0f; } - /* calculate pixelsize factor once, is used for lights and obcenters */ + /* Calculate pixel-size factor once, this is used for lights and object-centers. */ { /* note: '1.0f / len_v3(v1)' replaced 'len_v3(rv3d->viewmat[0])' * because of float point precision problems at large values T23908. */ @@ -2335,7 +2335,7 @@ void ED_view3d_depth_update(ARegion *region) } } -/* Utility function to find the closest Z value, use for autodepth. */ +/* Utility function to find the closest Z value, use for auto-depth. */ float view3d_depth_near(ViewDepths *d) { /* Convert to float for comparisons. */ diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index ab4e7be88fe..2f8cd5a7517 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2025,7 +2025,7 @@ static float viewzoom_scale_value(const rcti *winrct, { float zfac; - if (viewzoom == USER_ZOOM_CONT) { + if (viewzoom == USER_ZOOM_CONTINUE) { double time = PIL_check_seconds_timer(); float time_step = (float)(time - *r_timer_lastdraw); float fac; @@ -2043,7 +2043,6 @@ static float viewzoom_scale_value(const rcti *winrct, fac = -fac; } - /* oldstyle zoom */ zfac = 1.0f + ((fac / 20.0f) * time_step); *r_timer_lastdraw = time; } @@ -2405,7 +2404,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_FINISHED; } - if (U.viewzoom == USER_ZOOM_CONT) { + if (U.viewzoom == USER_ZOOM_CONTINUE) { /* needs a timer to continue redrawing */ vod->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f); vod->prev.time = PIL_check_seconds_timer(); @@ -2888,7 +2887,7 @@ static void view3d_from_minmax(bContext *C, }); } - /* smooth view does viewlock RV3D_BOXVIEW copy */ + /* Smooth-view does view-lock #RV3D_BOXVIEW copy. */ } /** @@ -3021,7 +3020,6 @@ void VIEW3D_OT_view_all(wmOperatorType *ot) * Move & Zoom the view to fit selected contents. * \{ */ -/* like a localview without local!, was centerview() in 2.4x */ static int viewselected_exec(bContext *C, wmOperator *op) { ARegion *region = CTX_wm_region(C); @@ -3282,7 +3280,7 @@ static int viewcenter_cursor_exec(bContext *C, wmOperator *op) ED_view3d_smooth_view( C, v3d, region, smooth_viewtx, &(const V3D_SmoothParams){.ofs = new_ofs}); - /* smooth view does viewlock RV3D_BOXVIEW copy */ + /* Smooth view does view-lock #RV3D_BOXVIEW copy. */ } return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 6824c526888..2d499cf85c7 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -48,7 +48,7 @@ #include "ED_screen.h" #include "ED_space_api.h" -#include "PIL_time.h" /* smoothview */ +#include "PIL_time.h" /* Smooth-view. */ #include "UI_interface.h" #include "UI_resources.h" @@ -84,7 +84,7 @@ enum { FLY_MODAL_PRECISION_DISABLE, FLY_MODAL_FREELOOK_ENABLE, FLY_MODAL_FREELOOK_DISABLE, - FLY_MODAL_SPEED, /* mousepan typically */ + FLY_MODAL_SPEED, /* mouse-pan typically. */ }; /* relative view axis locking - xlock, zlock */ @@ -537,7 +537,7 @@ static void flyEvent(FlyInfo *fly, const wmEvent *event) fly->state = FLY_CONFIRM; break; - /* speed adjusting with mousepan (trackpad) */ + /* Speed adjusting with mouse-pan (track-pad). */ case FLY_MODAL_SPEED: { float fac = 0.02f * (event->prevy - event->y); @@ -768,7 +768,7 @@ static int flyApply(bContext *C, FlyInfo *fly, bool is_confirm) /* this is the direction that's added to the view offset per redraw */ float dvec[3] = {0, 0, 0}; - /* Camera Uprighting variables */ + /* Camera Up-righting variables. */ float moffset[2]; /* mouse offset from the views center */ float tmp_quat[4]; /* used for rotating the view */ @@ -950,7 +950,7 @@ static int flyApply(bContext *C, FlyInfo *fly, bool is_confirm) } } - /* only apply xcorrect when mouse isn't applying x rot */ + /* Only apply X-axis correction when mouse isn't applying x rotation. */ if (fly->xlock == FLY_AXISLOCK_STATE_ACTIVE && moffset[1] == 0) { float upvec[3]; copy_v3_fl3(upvec, 0.0f, 0.0f, 1.0f); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 9ee6e44f825..0605ea30806 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -596,7 +596,7 @@ static bool do_lasso_select_objects(ViewContext *vc, } for (base = vc->view_layer->object_bases.first; base; base = base->next) { - if (BASE_SELECTABLE(v3d, base)) { /* use this to avoid un-needed lasso lookups */ + if (BASE_SELECTABLE(v3d, base)) { /* Use this to avoid unnecessary lasso look-ups. */ const bool is_select = base->flag & BASE_SELECTED; const bool is_inside = ((ED_view3d_project_base(vc->region, base) == V3D_PROJ_RET_OK) && BLI_lasso_is_point_inside( @@ -1447,7 +1447,7 @@ static const EnumPropertyItem *object_select_menu_enum_itemf(bContext *C, int totitem = 0; int i = 0; - /* don't need context but avoid docgen using this */ + /* Don't need context but avoid API doc-generation using this. */ if (C == NULL || object_mouse_select_menu_data[i].idname[0] == '\0') { return DummyRNA_NULL_items; } @@ -2494,7 +2494,7 @@ static int view3d_select_exec(bContext *C, wmOperator *op) } /* Pass-through allows tweaks - * FINISHED to signal one operator worked. */ + * FINISHED to signal one operator worked */ if (retval) { WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); return OPERATOR_PASS_THROUGH | OPERATOR_FINISHED; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 9d947384bf0..5c0ca1582a6 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -142,7 +142,7 @@ void ED_view3d_smooth_view_ex( /* initialize sms */ view3d_smooth_view_state_backup(&sms.dst, v3d, rv3d); view3d_smooth_view_state_backup(&sms.src, v3d, rv3d); - /* if smoothview runs multiple times... */ + /* If smooth-view runs multiple times. */ if (rv3d->sms == NULL) { view3d_smooth_view_state_backup(&sms.org, v3d, rv3d); } @@ -396,7 +396,7 @@ static void view3d_smoothview_apply(bContext *C, View3D *v3d, ARegion *region, b /* note: this doesn't work right because the v3d->lens is now used in ortho mode r51636, * when switching camera in quad-view the other ortho views would zoom & reset. * - * For now only redraw all regions when smoothview finishes. + * For now only redraw all regions when smooth-view finishes. */ if (step >= 1.0f) { WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d); @@ -423,7 +423,7 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), const w } /** - * Apply the smoothview immediately, use when we need to start a new view operation. + * Apply the smooth-view immediately, use when we need to start a new view operation. * (so we don't end up half-applying a view operation when pressing keys quickly). */ void ED_view3d_smooth_view_force_finish(bContext *C, View3D *v3d, ARegion *region) diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 5b42f221c80..cbd65e3175d 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -48,7 +48,7 @@ #include "ED_space_api.h" #include "ED_transform_snap_object_context.h" -#include "PIL_time.h" /* smoothview */ +#include "PIL_time.h" /* Smooth-view. */ #include "UI_interface.h" #include "UI_resources.h" @@ -872,7 +872,7 @@ static void walkEvent(bContext *C, WalkInfo *walk, const wmEvent *event) /* delta time */ t = (float)(PIL_check_seconds_timer() - walk->teleport.initial_time); - /* reduce the veolocity, if JUMP wasn't hold for long enough */ + /* Reduce the velocity, if JUMP wasn't hold for long enough. */ t = min_ff(t, JUMP_TIME_MAX); walk->speed_jump = JUMP_SPEED_MIN + t * (JUMP_SPEED_MAX - JUMP_SPEED_MIN) / JUMP_TIME_MAX; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 2a7c247ff2b..86a35949d1d 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -135,7 +135,7 @@ void setTransformViewAspect(TransInfo *t, float r_aspect[3]) } } else if (t->spacetype == SPACE_GRAPH) { - /* depemds on context of usage */ + /* Depends on context of usage. */ } } @@ -471,7 +471,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t) } else if (t->spacetype == SPACE_SEQ) { WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, NULL); - /* Keyframes on strips has been moved, so make sure related editos are informed. */ + /* Key-frames on strips has been moved, so make sure related editors are informed. */ WM_event_add_notifier(C, NC_ANIMATION, NULL); } else if (t->spacetype == SPACE_IMAGE) { @@ -1249,7 +1249,7 @@ bool calculateTransformCenter(bContext *C, int centerMode, float cent3d[3], floa createTransData(C, t); /* make TransData structs from selection */ - t->around = centerMode; /* override userdefined mode */ + t->around = centerMode; /* override user-defined mode. */ if (t->data_len_all == 0) { success = false; diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c index fb365da6b43..96a9690d891 100644 --- a/source/blender/editors/transform/transform_convert.c +++ b/source/blender/editors/transform/transform_convert.c @@ -1047,7 +1047,7 @@ void createTransData(bContext *C, TransInfo *t) else if (t->spacetype == SPACE_SEQ) { t->flag |= T_POINTS | T_2D_EDIT; t->obedit_type = -1; - t->num.flag |= NUM_NO_FRACTION; /* sequencer has no use for floating point trasnform */ + t->num.flag |= NUM_NO_FRACTION; /* sequencer has no use for floating point transform. */ convert_type = TC_SEQ_DATA; } else if (t->spacetype == SPACE_GRAPH) { diff --git a/source/blender/editors/transform/transform_convert.h b/source/blender/editors/transform/transform_convert.h index be4322b42e2..a1c7a6a39a6 100644 --- a/source/blender/editors/transform/transform_convert.h +++ b/source/blender/editors/transform/transform_convert.h @@ -49,7 +49,7 @@ void mesh_customdatacorrect_init(TransInfo *t); /* transform_convert_sequencer.c */ int transform_convert_sequencer_get_snap_bound(TransInfo *t); - +void transform_convert_sequencer_channel_clamp(TransInfo *t); /********************* intern **********************/ typedef enum eTransConvertType { diff --git a/source/blender/editors/transform/transform_convert_armature.c b/source/blender/editors/transform/transform_convert_armature.c index e9b2273b343..7994d97581f 100644 --- a/source/blender/editors/transform/transform_convert_armature.c +++ b/source/blender/editors/transform/transform_convert_armature.c @@ -444,7 +444,7 @@ static short pose_grab_with_ik(Main *bmain, Object *ob) for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { if (pchan->bone->layer & arm->layer) { if (pchan->bone->flag & (BONE_SELECTED | BONE_TRANSFORM_MIRROR)) { - /* Rule: no IK for solitatry (unconnected) bones */ + /* Rule: no IK for solitary (unconnected) bones. */ for (bonec = pchan->bone->childbase.first; bonec; bonec = bonec->next) { if (bonec->flag & BONE_CONNECTED) { break; @@ -1354,7 +1354,7 @@ static void pose_transform_mirror_update(TransInfo *t, TransDataContainer *tc, O } mul_v3_m4v3(data->grabtarget, flip_mtx, td->loc); if (pid) { - /* TODO(germano): Realitve Mirror support */ + /* TODO(germano): Relative Mirror support. */ } data->flag |= CONSTRAINT_IK_AUTO; /* Add a temporary auto IK constraint here, as we will only temporarily active this diff --git a/source/blender/editors/transform/transform_convert_curve.c b/source/blender/editors/transform/transform_convert_curve.c index 445253d5446..3c01c716123 100644 --- a/source/blender/editors/transform/transform_convert_curve.c +++ b/source/blender/editors/transform/transform_convert_curve.c @@ -298,7 +298,7 @@ void createTransCurveVerts(TransInfo *t) } if ((bezt_tx & SEL_F1) == 0 && (bezt_tx & SEL_F3) == 0) { - /* If the middle is selected but the sides arnt, this is needed */ + /* If the middle is selected but the sides aren't, this is needed. */ if (hdata == NULL) { /* if the handle was not saved by the previous handle */ hdata = initTransDataCurveHandles(td, bezt); diff --git a/source/blender/editors/transform/transform_convert_nla.c b/source/blender/editors/transform/transform_convert_nla.c index 51802a1e769..5eb3f68787a 100644 --- a/source/blender/editors/transform/transform_convert_nla.c +++ b/source/blender/editors/transform/transform_convert_nla.c @@ -574,7 +574,7 @@ void special_aftertrans_update__nla(bContext *C, TransInfo *UNUSED(t)) /* free temp memory */ ANIM_animdata_freelist(&anim_data); - /* perform after-transfrom validation */ + /* Perform after-transform validation. */ ED_nla_postop_refresh(&ac); } } diff --git a/source/blender/editors/transform/transform_convert_sequencer.c b/source/blender/editors/transform/transform_convert_sequencer.c index ebb0b6823a3..7ec793f24bd 100644 --- a/source/blender/editors/transform/transform_convert_sequencer.c +++ b/source/blender/editors/transform/transform_convert_sequencer.c @@ -25,6 +25,7 @@ #include "MEM_guardedalloc.h" +#include "BLI_listbase.h" #include "BLI_math.h" #include "BKE_context.h" @@ -64,6 +65,8 @@ typedef struct TransSeq { int min; int max; bool snap_left; + int selection_channel_range_min; + int selection_channel_range_max; } TransSeq; /* -------------------------------------------------------------------- */ @@ -623,6 +626,14 @@ void createTransSeqData(TransInfo *t) } } + ts->selection_channel_range_min = MAXSEQ + 1; + LISTBASE_FOREACH (Sequence *, seq, SEQ_active_seqbase_get(ed)) { + if ((seq->flag & SELECT) != 0) { + ts->selection_channel_range_min = min_ii(ts->selection_channel_range_min, seq->machine); + ts->selection_channel_range_max = max_ii(ts->selection_channel_range_max, seq->machine); + } + } + #undef XXX_DURIAN_ANIM_TX_HACK } @@ -850,6 +861,21 @@ void special_aftertrans_update__sequencer(bContext *UNUSED(C), TransInfo *t) } } +void transform_convert_sequencer_channel_clamp(TransInfo *t) +{ + const TransSeq *ts = (TransSeq *)TRANS_DATA_CONTAINER_FIRST_SINGLE(t)->custom.type.data; + const int channel_offset = round_fl_to_int(t->values[1]); + const int min_channel_after_transform = ts->selection_channel_range_min + channel_offset; + const int max_channel_after_transform = ts->selection_channel_range_max + channel_offset; + + if (max_channel_after_transform > MAXSEQ) { + t->values[1] -= max_channel_after_transform - MAXSEQ; + } + if (min_channel_after_transform < 1) { + t->values[1] -= min_channel_after_transform - 1; + } +} + int transform_convert_sequencer_get_snap_bound(TransInfo *t) { TransSeq *ts = TRANS_DATA_CONTAINER_FIRST_SINGLE(t)->custom.type.data; diff --git a/source/blender/editors/transform/transform_convert_tracking.c b/source/blender/editors/transform/transform_convert_tracking.c index b25af709981..5f5f06e388f 100644 --- a/source/blender/editors/transform/transform_convert_tracking.c +++ b/source/blender/editors/transform/transform_convert_tracking.c @@ -358,7 +358,7 @@ static void createTransTrackingTracksData(bContext *C, TransInfo *t) init_context.t = t; init_context.tc = tc; - /* Count required tranformation data. */ + /* Count required transformation data. */ tc->data_len = 0; diff --git a/source/blender/editors/transform/transform_data.h b/source/blender/editors/transform/transform_data.h index b59197fcd39..5b01433c96b 100644 --- a/source/blender/editors/transform/transform_data.h +++ b/source/blender/editors/transform/transform_data.h @@ -122,11 +122,11 @@ typedef struct TransDataCurveHandleFlags { typedef struct TransData { TRANSDATABASIC; - /** Distance needed to affect element (for Proportionnal Editing). */ + /** Distance needed to affect element (for Proportional Editing). */ float dist; - /** Distance to the nearest element (for Proportionnal Editing). */ + /** Distance to the nearest element (for Proportional Editing). */ float rdist; - /** Factor of the transformation (for Proportionnal Editing). */ + /** Factor of the transformation (for Proportional Editing). */ float factor; /** Value pointer for special transforms. */ float *val; @@ -141,11 +141,11 @@ typedef struct TransData { struct Object *ob; /** For objects/bones, the first constraint in its constraint stack. */ struct bConstraint *con; - /** For objects, poses. 1 single malloc per TransInfo! */ + /** For objects, poses. 1 single allocation per #TransInfo! */ TransDataExtension *ext; /** for curves, stores handle flags for modification/cancel. */ TransDataCurveHandleFlags *hdata; - /** If set, copy of Object or PoseChannel protection. */ + /** If set, copy of Object or #bPoseChannel protection. */ short protectflag; } TransData; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index b092b3e3e0b..e181593d28a 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1193,7 +1193,7 @@ void calculateCenter(TransInfo *t) calculateCenter2D(t); - /* for panning from cameraview */ + /* For panning from the camera-view. */ if ((t->flag & T_OBJECT) && (t->flag & T_OVERRIDE_CENTER) == 0) { if (t->spacetype == SPACE_VIEW3D && t->region && t->region->regiontype == RGN_TYPE_WINDOW) { @@ -1416,7 +1416,7 @@ void transform_data_ext_rotate(TransData *td, float mat[3][3], bool use_drot) if (td->ext->rotOrder == ROT_MODE_QUAT) { float quat[4]; - /* calculate the total rotatation */ + /* Calculate the total rotation. */ quat_to_mat3(obmat, td->ext->iquat); if (use_drot) { mul_m3_m3m3(obmat, dmat, obmat); @@ -1437,7 +1437,7 @@ void transform_data_ext_rotate(TransData *td, float mat[3][3], bool use_drot) else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) { float axis[3], angle; - /* calculate the total rotatation */ + /* Calculate the total rotation. */ axis_angle_to_mat3(obmat, td->ext->irotAxis, td->ext->irotAngle); if (use_drot) { mul_m3_m3m3(obmat, dmat, obmat); @@ -1459,7 +1459,7 @@ void transform_data_ext_rotate(TransData *td, float mat[3][3], bool use_drot) else { float eul[3]; - /* calculate the total rotatation */ + /* Calculate the total rotation. */ eulO_to_mat3(obmat, td->ext->irot, td->ext->rotOrder); if (use_drot) { mul_m3_m3m3(obmat, dmat, obmat); diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index eec0ce42f3c..27df29afd8d 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -532,7 +532,7 @@ static void protectflag_to_drawflags_ebone(RegionView3D *rv3d, const EditBone *e /* could move into BLI_math however this is only useful for display/editing purposes */ static void axis_angle_to_gimbal_axis(float gmat[3][3], const float axis[3], const float angle) { - /* X/Y are arbitrary axies, most importantly Z is the axis of rotation */ + /* X/Y are arbitrary axes, most importantly Z is the axis of rotation. */ float cross_vec[3]; float quat[4]; diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index 70ef5fcde7a..ec84eab27a9 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -508,7 +508,7 @@ eRedrawFlag handleMouseInput(TransInfo *t, MouseInput *mi, const wmEvent *event) case EVT_RIGHTSHIFTKEY: if (event->val == KM_PRESS) { t->modifiers |= MOD_PRECISION; - /* shift is modifier for higher precision transforn */ + /* Shift is modifier for higher precision transform. */ mi->precision = 1; redraw = TREDRAW_HARD; } diff --git a/source/blender/editors/transform/transform_mode.c b/source/blender/editors/transform/transform_mode.c index a4d999b868d..be4f3daa3d2 100644 --- a/source/blender/editors/transform/transform_mode.c +++ b/source/blender/editors/transform/transform_mode.c @@ -513,7 +513,7 @@ void constraintSizeLim(TransInfo *t, TransData *td) return; } - /* extrace scale from matrix and apply back sign */ + /* Extract scale from matrix and apply back sign. */ mat4_to_size(td->ext->size, cob.matrix); mul_v3_v3(td->ext->size, size_sign); } @@ -705,7 +705,7 @@ void ElementRotation_ex(TransInfo *t, mul_m3_m3m3(totmat, mat, td->ext->r_mtx); mul_m3_m3m3(smat, td->ext->r_smtx, totmat); - /* calculate the total rotatation in eulers */ + /* Calculate the total rotation in eulers. */ copy_v3_v3(eul, td->ext->irot); eulO_to_mat3(eulmat, eul, td->ext->rotOrder); @@ -778,7 +778,7 @@ void ElementRotation_ex(TransInfo *t, mul_m3_m3m3(totmat, mat, td->mtx); mul_m3_m3m3(smat, td->smtx, totmat); - /* calculate the total rotatation in eulers */ + /* Calculate the total rotation in eulers. */ add_v3_v3v3(eul, td->ext->irot, td->ext->drot); /* correct for delta rot */ eulO_to_mat3(obmat, eul, td->ext->rotOrder); /* mat = transform, obmat = object rotation */ @@ -902,7 +902,7 @@ static void TransMat3ToSize(const float mat[3][3], const float smat[3][3], float mat3_to_rot_size(rmat, size, mat); - /* first tried with dotproduct... but the sign flip is crucial */ + /* First tried with dot-product... but the sign flip is crucial. */ if (dot_v3v3(rmat[0], smat[0]) < 0.0f) { size[0] = -size[0]; } diff --git a/source/blender/editors/transform/transform_mode_edge_seq_slide.c b/source/blender/editors/transform/transform_mode_edge_seq_slide.c index dd212af7caf..4330d5e79be 100644 --- a/source/blender/editors/transform/transform_mode_edge_seq_slide.c +++ b/source/blender/editors/transform/transform_mode_edge_seq_slide.c @@ -35,10 +35,12 @@ #include "WM_types.h" #include "UI_interface.h" +#include "UI_view2d.h" #include "BLT_translation.h" #include "transform.h" +#include "transform_convert.h" #include "transform_mode.h" #include "transform_snap.h" @@ -51,7 +53,7 @@ static eRedrawFlag seq_slide_handleEvent(struct TransInfo *t, const wmEvent *eve BLI_assert(t->mode == TFM_SEQ_SLIDE); const wmKeyMapItem *kmi = t->custom.mode.data; if (kmi && event->type == kmi->type && event->val == kmi->val) { - /* Allows the 'Expand to fit' effect to be enabled as a toogle. */ + /* Allows the "Expand to Fit" effect to be enabled as a toggle. */ t->flag ^= T_ALT_TRANSFORM; return TREDRAW_HARD; } @@ -106,6 +108,7 @@ static void applySeqSlide(TransInfo *t, const int mval[2]) float values_final[3] = {0.0f}; snapSequenceBounds(t, mval); + transform_convert_sequencer_channel_clamp(t); if (applyNumInput(&t->num, values_final)) { if (t->con.mode & CON_APPLY) { if (t->con.mode & CON_AXIS0) { diff --git a/source/blender/editors/transform/transform_mode_edge_slide.c b/source/blender/editors/transform/transform_mode_edge_slide.c index dae3fe6f7b4..dff9ded6b29 100644 --- a/source/blender/editors/transform/transform_mode_edge_slide.c +++ b/source/blender/editors/transform/transform_mode_edge_slide.c @@ -143,7 +143,7 @@ static BMEdge *get_other_edge(BMVert *v, BMEdge *e) return NULL; } -/* interpoaltes along a line made up of 2 segments (used for edge slide) */ +/* Interpolates along a line made up of 2 segments (used for edge slide). */ static void interp_line_v3_v3v3v3( float p[3], const float v1[3], const float v2[3], const float v3[3], float t) { diff --git a/source/blender/editors/transform/transform_mode_resize.c b/source/blender/editors/transform/transform_mode_resize.c index 62a4fbd6f04..4d0bb7fbe9c 100644 --- a/source/blender/editors/transform/transform_mode_resize.c +++ b/source/blender/editors/transform/transform_mode_resize.c @@ -132,7 +132,7 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2])) } } - /* evil hack - redo resize if cliping needed */ + /* Evil hack - redo resize if clipping needed. */ if (t->flag & T_CLIP_UV && clipUVTransform(t, t->values_final, 1)) { size_to_mat3(mat, t->values_final); diff --git a/source/blender/editors/transform/transform_mode_shrink_fatten.c b/source/blender/editors/transform/transform_mode_shrink_fatten.c index bccf4db66af..dd89f4fd983 100644 --- a/source/blender/editors/transform/transform_mode_shrink_fatten.c +++ b/source/blender/editors/transform/transform_mode_shrink_fatten.c @@ -51,7 +51,7 @@ static eRedrawFlag shrinkfatten_handleEvent(struct TransInfo *t, const wmEvent * BLI_assert(t->mode == TFM_SHRINKFATTEN); const wmKeyMapItem *kmi = t->custom.mode.data; if (kmi && event->type == kmi->type && event->val == kmi->val) { - /* Allows the 'Even Thickness' effect to be enabled as a toogle. */ + /* Allows the "Even Thickness" effect to be enabled as a toggle. */ t->flag ^= T_ALT_TRANSFORM; return TREDRAW_HARD; } diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 15c215c426d..5b366e7f5fd 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -432,7 +432,7 @@ static int transform_modal(bContext *C, wmOperator *op, const wmEvent *event) * since we're not reading from 'td->center' in this case. see: T40241 */ if (t->tsnap.target == SCE_SNAP_TARGET_ACTIVE) { /* In camera view, tsnap callback is not set - * (see initSnappingMode() in transfrom_snap.c, and T40348). */ + * (see #initSnappingMode() in transform_snap.c, and T40348). */ if (t->tsnap.targetSnap && ((t->tsnap.status & TARGET_INIT) == 0)) { t->tsnap.targetSnap(t); } @@ -444,7 +444,7 @@ static int transform_modal(bContext *C, wmOperator *op, const wmEvent *event) if ((exit_code & OPERATOR_RUNNING_MODAL) == 0) { transformops_exit(C, op); - exit_code &= ~OPERATOR_PASS_THROUGH; /* preventively remove passthrough */ + exit_code &= ~OPERATOR_PASS_THROUGH; /* Preventively remove pass-through. */ } else { if (mode_prev != t->mode) { diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 508189c5d77..575c736cf51 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -235,7 +235,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) } else if (t->spacetype == SPACE_IMAGE) { if (validSnap(t)) { - /* This will not draw, and Im nor sure why - campbell */ + /* This will not draw, and I'm nor sure why - campbell */ /* TODO: see 2.7x for non-working code */ } } @@ -383,7 +383,7 @@ void applyProject(TransInfo *t) } } -#if 0 /* TODO: sipport this? */ +#if 0 /* TODO: support this? */ constraintTransLim(t, td); #endif } diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index b610369f82d..58198f21ba2 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -1959,7 +1959,7 @@ static short snapCurve(SnapData *snapdata, int clip_plane_len = snapdata->clip_plane_len; if (snapdata->has_occlusion_plane) { - /* We snap to vertices even if coccluded. */ + /* We snap to vertices even if occluded. */ clip_planes++; clip_plane_len--; } diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c index 0771d0254e8..baa178a6a94 100644 --- a/source/blender/editors/undo/ed_undo.c +++ b/source/blender/editors/undo/ed_undo.c @@ -70,15 +70,6 @@ /** We only need this locally. */ static CLG_LogRef LOG = {"ed.undo"}; -/** - * \warning Values are used in #ED_undo_gpencil_step, - * which should eventually be replaced with the undo-system. - */ -enum eUndoStepDir { - STEP_REDO = 1, - STEP_UNDO = -1, -}; - /* -------------------------------------------------------------------- */ /** \name Generic Undo System Access * @@ -276,7 +267,7 @@ static int ed_undo_step_direction(bContext *C, enum eUndoStepDir step, ReportLis * FIXME: However, it seems to never be used in current code (`ED_gpencil_session_active` seems * to always return false). */ if (ED_gpencil_session_active()) { - return ED_undo_gpencil_step(C, (int)step); + return ED_undo_gpencil_step(C, step); } wmWindowManager *wm = CTX_wm_manager(C); diff --git a/source/blender/editors/undo/memfile_undo.c b/source/blender/editors/undo/memfile_undo.c index eea0f29d295..51859b6a555 100644 --- a/source/blender/editors/undo/memfile_undo.c +++ b/source/blender/editors/undo/memfile_undo.c @@ -145,19 +145,18 @@ static int memfile_undosys_step_id_reused_cb(LibraryIDLinkCallbackData *cb_data) static void memfile_undosys_step_decode(struct bContext *C, struct Main *bmain, UndoStep *us_p, - int undo_direction, + const eUndoStepDir undo_direction, bool UNUSED(is_final)) { - BLI_assert(undo_direction != 0); + BLI_assert(undo_direction != STEP_INVALID); bool use_old_bmain_data = true; if (USER_EXPERIMENTAL_TEST(&U, use_undo_legacy)) { use_old_bmain_data = false; } - else if (undo_direction > 0) { - /* Redo case. - * The only time we should have to force a complete redo is when current step is tagged as a + else if (undo_direction == STEP_REDO) { + /* The only time we should have to force a complete redo is when current step is tagged as a * redo barrier. * If previous step was not a memfile one should not matter here, current data in old bmain * should still always be valid for unchanged data-blocks. */ @@ -165,9 +164,8 @@ static void memfile_undosys_step_decode(struct bContext *C, use_old_bmain_data = false; } } - else { - /* Undo case. - * Here we do not care whether current step is an undo barrier, since we are coming from + else if (undo_direction == STEP_UNDO) { + /* Here we do not care whether current step is an undo barrier, since we are coming from * 'the future' we can still re-use old data. However, if *next* undo step * (i.e. the one immediately in the future, the one we are coming from) * is a barrier, then we have to force a complete undo. diff --git a/source/blender/editors/util/ed_transverts.c b/source/blender/editors/util/ed_transverts.c index 1075f256a09..d0234dee856 100644 --- a/source/blender/editors/util/ed_transverts.c +++ b/source/blender/editors/util/ed_transverts.c @@ -495,8 +495,8 @@ void ED_transverts_create_from_obedit(TransVertStore *tvs, Object *obedit, const } if (!tvs->transverts_tot && tvs->transverts) { - /* prevent memory leak. happens for curves/latticies due to */ - /* difficult condition of adding points to trans data */ + /* Prevent memory leak. happens for curves/lattices due to + * difficult condition of adding points to trans data. */ MEM_freeN(tvs->transverts); tvs->transverts = NULL; } diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c index ba22bcca0e1..91ec8546225 100644 --- a/source/blender/editors/util/numinput.c +++ b/source/blender/editors/util/numinput.c @@ -508,7 +508,7 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event) #endif case EVT_CKEY: if (event->ctrl) { - /* Copy current str to the copypaste buffer. */ + /* Copy current `str` to the copy/paste buffer. */ WM_clipboard_text_set(n->str, 0); updated = true; } diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index ed9e5053f10..e94aaa49839 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -978,7 +978,7 @@ static int p_connect_pairs(PHandle *handle, PBool topology_from_uvs) PChart *chart = handle->construction_chart; int ncharts = 0; - /* connect pairs, count edges, set vertex-edge pointer to a pairless edge */ + /* Connect pairs, count edges, set vertex-edge pointer to a pair-less edge. */ for (first = chart->faces; first; first = first->nextlink) { if (first->flag & PFACE_CONNECTED) { continue; @@ -1974,7 +1974,7 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair) b[1] = p_vec_angle(v2->co, v1->co, keepv->co); b[2] = M_PI - b[0] - b[1]; - /* abf criterion 1: avoid sharp and obtuse angles */ + /* ABF criterion 1: avoid sharp and obtuse angles. */ minangle = 15.0f * M_PI / 180.0f; maxangle = M_PI - minangle; @@ -1991,7 +1991,7 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair) } while (e && (e != oldv->edge)); if (p_vert_interior(oldv)) { - /* hlscm criterion: angular defect smaller than threshold */ + /* HLSCM criterion: angular defect smaller than threshold. */ if (fabsf(angulardefect) > (float)(M_PI * 30.0 / 180.0)) { return P_FALSE; } @@ -2000,12 +2000,12 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair) PVert *v1 = p_boundary_edge_next(oldv->edge)->vert; PVert *v2 = p_boundary_edge_prev(oldv->edge)->vert; - /* abf++ criterion 2: avoid collapsing verts inwards */ + /* ABF++ criterion 2: avoid collapsing verts inwards. */ if (p_vert_interior(keepv)) { return P_FALSE; } - /* don't collapse significant boundary changes */ + /* Don't collapse significant boundary changes. */ angle = p_vec_angle(v1->co, oldv->co, v2->co); if (angle < (M_PI * 160.0 / 180.0)) { return P_FALSE; @@ -3837,7 +3837,7 @@ static void p_chart_rotate_fit_aabb(PChart *chart) /* Area Smoothing */ -/* 2d bsp tree for inverse mapping - that's a bit silly */ +/* 2d BSP tree for inverse mapping - that's a bit silly. */ typedef struct SmoothTriangle { float co1[2], co2[2], co3[2]; @@ -4288,7 +4288,7 @@ static void p_smooth(PChart *chart) MEM_freeN(hedges); MEM_freeN(vedges); - /* create bsp */ + /* Create BSP. */ t = triangles = MEM_mallocN(sizeof(SmoothTriangle) * esize * 2, "PSmoothTris"); trip = tri = MEM_mallocN(sizeof(SmoothTriangle *) * esize * 2, "PSmoothTriP"); diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 7b27bb570cc..5c4dc90f112 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -224,13 +224,13 @@ enum StitchModes { STITCH_EDGE, }; -/* UvElement identification. */ +/** #UvElement identification. */ typedef struct UvElementID { int faceIndex; int elementIndex; } UvElementID; -/* StitchState initializition. */ +/** #StitchState initialization. */ typedef struct StitchStateInit { int uv_selected_count; UvElementID *to_select; @@ -2050,7 +2050,7 @@ static StitchState *stitch_init(bContext *C, BLI_ghash_free(edge_hash, NULL, NULL); - /* refill an edge hash to create edge connnectivity data */ + /* Refill an edge hash to create edge connectivity data. */ state->edge_hash = edge_hash = BLI_ghash_new(uv_edge_hash, uv_edge_compare, "stitch_edge_hash"); for (i = 0; i < total_edges; i++) { BLI_ghash_insert(edge_hash, edges + i, edges + i); diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp index ddd11729e67..9c675c93a2e 100644 --- a/source/blender/freestyle/intern/application/Controller.cpp +++ b/source/blender/freestyle/intern/application/Controller.cpp @@ -580,7 +580,7 @@ void Controller::ComputeViewMap() vmBuilder.setRenderMonitor(_pRenderMonitor); #if 0 - // Builds a tesselated form of the silhouette for display purpose: + // Builds a tessellated form of the silhouette for display purpose: //--------------------------------------------------------------- ViewMapTesselator3D sTesselator3d; ViewMapTesselator2D sTesselator2d; diff --git a/source/blender/gpu/GPU_batch.h b/source/blender/gpu/GPU_batch.h index 85981ac8043..be418c15060 100644 --- a/source/blender/gpu/GPU_batch.h +++ b/source/blender/gpu/GPU_batch.h @@ -84,7 +84,7 @@ typedef struct GPUBatch { GPUVertBuf *inst[GPU_BATCH_INST_VBO_MAX_LEN]; /** NULL if element list not needed */ GPUIndexBuf *elem; - /** Bookeeping. */ + /** Bookkeeping. */ eGPUBatchFlag flag; /** Type of geometry to draw. */ GPUPrimType prim_type; diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h index c0f91756bf6..8c6592adf6d 100644 --- a/source/blender/gpu/GPU_framebuffer.h +++ b/source/blender/gpu/GPU_framebuffer.h @@ -20,7 +20,7 @@ /** \file * \ingroup gpu * - * GPU Framebuffer + * GPU Frame-buffer * - this is a wrapper for an OpenGL framebuffer object (FBO). in practice * multiple FBO's may be created. * - actual FBO creation & config is deferred until GPU_framebuffer_bind or @@ -79,7 +79,7 @@ GPUFrameBuffer *GPU_framebuffer_back_get(void); } \ } while (0) -/* Framebuffer setup : You need to call GPU_framebuffer_bind for these +/* Frame-buffer setup: You need to call #GPU_framebuffer_bind for these * to be effective. */ void GPU_framebuffer_texture_attach_ex(GPUFrameBuffer *gpu_fb, GPUAttachment attachment, int slot); @@ -154,7 +154,7 @@ void GPU_framebuffer_texture_layer_attach( void GPU_framebuffer_texture_cubeface_attach( GPUFrameBuffer *fb, GPUTexture *tex, int slot, int face, int mip); -/* Framebuffer operations */ +/* Frame-buffer operations. */ void GPU_framebuffer_viewport_set(GPUFrameBuffer *fb, int x, int y, int w, int h); void GPU_framebuffer_viewport_get(GPUFrameBuffer *fb, int r_viewport[4]); diff --git a/source/blender/gpu/GPU_index_buffer.h b/source/blender/gpu/GPU_index_buffer.h index 0c71dd539a6..76aab3c196b 100644 --- a/source/blender/gpu/GPU_index_buffer.h +++ b/source/blender/gpu/GPU_index_buffer.h @@ -70,7 +70,7 @@ void GPU_indexbuf_set_tri_restart(GPUIndexBufBuilder *builder, uint elem); GPUIndexBuf *GPU_indexbuf_build(GPUIndexBufBuilder *); void GPU_indexbuf_build_in_place(GPUIndexBufBuilder *, GPUIndexBuf *); -/* Create a subrange of an existing indexbuffer. */ +/* Create a sub-range of an existing index-buffer. */ GPUIndexBuf *GPU_indexbuf_create_subrange(GPUIndexBuf *elem_src, uint start, uint length); void GPU_indexbuf_create_subrange_in_place(GPUIndexBuf *elem, GPUIndexBuf *elem_src, diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h index 55716b584c3..9824c7016dc 100644 --- a/source/blender/gpu/GPU_shader.h +++ b/source/blender/gpu/GPU_shader.h @@ -29,7 +29,7 @@ extern "C" { struct GPUVertBuf; -/** Opaque type hidding blender::gpu::Shader */ +/** Opaque type hiding #blender::gpu::Shader */ typedef struct GPUShader GPUShader; typedef enum eGPUShaderTFBType { diff --git a/source/blender/gpu/GPU_state.h b/source/blender/gpu/GPU_state.h index f5a1ccbc40b..0687f271670 100644 --- a/source/blender/gpu/GPU_state.h +++ b/source/blender/gpu/GPU_state.h @@ -46,7 +46,7 @@ ENUM_OPERATORS(eGPUBarrier, GPU_BARRIER_TEXTURE_FETCH) /** * Defines the fixed pipeline blending equation. * SRC is the output color from the shader. - * DST is the color from the framebuffer. + * DST is the color from the frame-buffer. * The blending equation is : * (SRC * A) + (DST * B). * The blend mode will modify the A and B parameters. @@ -64,7 +64,7 @@ typedef enum eGPUBlend { * NOTE: Does not modify alpha. */ GPU_BLEND_INVERT, /** Order independent transparency. - * NOTE: Cannot be used as is. Needs special setup (framebuffer, shader ...). */ + * NOTE: Cannot be used as is. Needs special setup (frame-buffer, shader ...). */ GPU_BLEND_OIT, /** Special blend to add color under and multiply dst color by src alpha. */ GPU_BLEND_BACKGROUND, diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h index 91119bd05a1..da2d2639440 100644 --- a/source/blender/gpu/GPU_texture.h +++ b/source/blender/gpu/GPU_texture.h @@ -77,12 +77,12 @@ void GPU_samplers_update(void); */ /* Wrapper to supported OpenGL/Vulkan texture internal storage - * If you need a type just uncomment it. Be aware that some formats - * are not supported by renderbuffers. All of the following formats + * If you need a type just un-comment it. Be aware that some formats + * are not supported by render-buffers. All of the following formats * are part of the OpenGL 3.3 core * specification. */ typedef enum eGPUTextureFormat { - /* Formats texture & renderbuffer */ + /* Formats texture & render-buffer. */ GPU_RGBA8UI, GPU_RGBA8I, GPU_RGBA8, diff --git a/source/blender/gpu/GPU_vertex_buffer.h b/source/blender/gpu/GPU_vertex_buffer.h index eeaebd3fae5..aae58de533b 100644 --- a/source/blender/gpu/GPU_vertex_buffer.h +++ b/source/blender/gpu/GPU_vertex_buffer.h @@ -34,7 +34,7 @@ typedef enum { GPU_VERTBUF_INVALID = 0, /** Was init with a vertex format. */ GPU_VERTBUF_INIT = (1 << 0), - /** Data has been touched and need to be reuploaded. */ + /** Data has been touched and need to be re-uploaded. */ GPU_VERTBUF_DATA_DIRTY = (1 << 1), /** The buffer has been created inside GPU memory. */ GPU_VERTBUF_DATA_UPLOADED = (1 << 2), diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 84da95f6fee..a2072e504fd 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -109,7 +109,7 @@ static GPUPass *gpu_pass_cache_resolve_collision(GPUPass *pass, uint32_t hash) { BLI_spin_lock(&pass_cache_spin); - /* Collision, need to strcmp the whole shader. */ + /* Collision, need to `strcmp` the whole shader. */ for (; pass && (pass->hash == hash); pass = pass->next) { if ((defs != NULL) && (!STREQ(pass->defines, defs))) { /* Pass */ } diff --git a/source/blender/gpu/intern/gpu_context_private.hh b/source/blender/gpu/intern/gpu_context_private.hh index ffa7a38faa6..82753b44c51 100644 --- a/source/blender/gpu/intern/gpu_context_private.hh +++ b/source/blender/gpu/intern/gpu_context_private.hh @@ -93,7 +93,7 @@ class Context { bool is_active_on_thread(void); }; -/* Syntacting suggar. */ +/* Syntactic sugar. */ static inline GPUContext *wrap(Context *ctx) { return reinterpret_cast(ctx); diff --git a/source/blender/gpu/intern/gpu_drawlist_private.hh b/source/blender/gpu/intern/gpu_drawlist_private.hh index 98603299d62..393307e6ee5 100644 --- a/source/blender/gpu/intern/gpu_drawlist_private.hh +++ b/source/blender/gpu/intern/gpu_drawlist_private.hh @@ -42,7 +42,7 @@ class DrawList { virtual void submit() = 0; }; -/* Syntacting suggar. */ +/* Syntactic sugar. */ static inline GPUDrawList *wrap(DrawList *vert) { return reinterpret_cast(vert); diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc index d5d7994a154..2e183f52eea 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.cc +++ b/source/blender/gpu/intern/gpu_framebuffer.cc @@ -359,7 +359,7 @@ void GPU_framebuffer_viewport_reset(GPUFrameBuffer *gpu_fb) unwrap(gpu_fb)->viewport_reset(); } -/* ---------- Framebuffer Operations ----------- */ +/* ---------- Frame-buffer Operations ----------- */ void GPU_framebuffer_clear(GPUFrameBuffer *gpu_fb, eGPUFrameBufferBits buffers, diff --git a/source/blender/gpu/intern/gpu_framebuffer_private.hh b/source/blender/gpu/intern/gpu_framebuffer_private.hh index 7afa56bfe3d..d63d72cf4f7 100644 --- a/source/blender/gpu/intern/gpu_framebuffer_private.hh +++ b/source/blender/gpu/intern/gpu_framebuffer_private.hh @@ -20,12 +20,7 @@ /** \file * \ingroup gpu * - * GPU Framebuffer - * - this is a wrapper for an OpenGL framebuffer object (FBO). in practice - * multiple FBO's may be created. - * - actual FBO creation & config is deferred until GPU_framebuffer_bind or - * GPU_framebuffer_check_valid to allow creation & config while another - * opengl context is bound (since FBOs are not shared between ogl contexts). + * Private frame buffer API. */ #pragma once @@ -210,7 +205,7 @@ class FrameBuffer { }; }; -/* Syntacting suggar. */ +/* Syntactic sugar. */ static inline GPUFrameBuffer *wrap(FrameBuffer *vert) { return reinterpret_cast(vert); diff --git a/source/blender/gpu/intern/gpu_immediate_private.hh b/source/blender/gpu/intern/gpu_immediate_private.hh index 9fcbe2bdc0b..98399897ea9 100644 --- a/source/blender/gpu/intern/gpu_immediate_private.hh +++ b/source/blender/gpu/intern/gpu_immediate_private.hh @@ -34,7 +34,7 @@ namespace blender::gpu { class Immediate { public: - /** Pointer to the mapped buffer data for the currect vertex. */ + /** Pointer to the mapped buffer data for the current vertex. */ uchar *vertex_data = NULL; /** Current vertex index. */ uint vertex_idx = 0; @@ -49,10 +49,10 @@ class Immediate { GPUPrimType prim_type = GPU_PRIM_NONE; GPUVertFormat vertex_format = {}; GPUShader *shader = NULL; - /** Enforce strict vertex count (disabled when using immBeginAtMost). */ + /** Enforce strict vertex count (disabled when using #immBeginAtMost). */ bool strict_vertex_len = true; - /** Batch in construction when using immBeginBatch. */ + /** Batch in construction when using #immBeginBatch. */ GPUBatch *batch = NULL; /** Wide Line workaround. */ @@ -61,7 +61,7 @@ class Immediate { GPUShader *prev_shader = NULL; /** Builtin shader index. Used to test if the workaround can be done. */ eGPUBuiltinShader builtin_shader_bound = GPU_SHADER_TEXT; - /** Uniform color: Kept here to update the wideline shader just before immBegin. */ + /** Uniform color: Kept here to update the wide-line shader just before #immBegin. */ float uniform_color[4]; public: diff --git a/source/blender/gpu/intern/gpu_index_buffer_private.hh b/source/blender/gpu/intern/gpu_index_buffer_private.hh index 7054360d07f..2405db8664a 100644 --- a/source/blender/gpu/intern/gpu_index_buffer_private.hh +++ b/source/blender/gpu/intern/gpu_index_buffer_private.hh @@ -57,7 +57,7 @@ class IndexBuf { uint32_t index_len_ = 0; /** Base index: Added to all indices after fetching. Allows index compression. */ uint32_t index_base_ = 0; - /** Bookeeping. */ + /** Bookkeeping. */ bool is_init_ = false; /** Is this object only a reference to a subrange of another IndexBuf. */ bool is_subrange_ = false; @@ -96,7 +96,7 @@ class IndexBuf { inline uint index_range(uint *r_min, uint *r_max); }; -/* Syntacting suggar. */ +/* Syntactic sugar. */ static inline GPUIndexBuf *wrap(IndexBuf *indexbuf) { return reinterpret_cast(indexbuf); diff --git a/source/blender/gpu/intern/gpu_node_graph.c b/source/blender/gpu/intern/gpu_node_graph.c index 08da49c3475..bf91a5bbb4d 100644 --- a/source/blender/gpu/intern/gpu_node_graph.c +++ b/source/blender/gpu/intern/gpu_node_graph.c @@ -132,7 +132,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const eGPUType case GPU_NODE_LINK_ATTR: input->source = GPU_SOURCE_ATTR; input->attr = link->attr; - /* Failsafe handling if the same attribute is used with different datatypes for + /* Fail-safe handling if the same attribute is used with different data-types for * some reason (only really makes sense with float/vec2/vec3/vec4 though). This * can happen if mixing the generic Attribute node with specialized ones. */ CLAMP_MIN(input->attr->gputype, type); diff --git a/source/blender/gpu/intern/gpu_select_pick.c b/source/blender/gpu/intern/gpu_select_pick.c index 66748b4146a..6cda7888712 100644 --- a/source/blender/gpu/intern/gpu_select_pick.c +++ b/source/blender/gpu/intern/gpu_select_pick.c @@ -269,7 +269,7 @@ typedef struct GPUPickState { ListBase bufs; } cache; - /* Pickign methods */ + /* Picking methods. */ union { /* GPU_SELECT_PICK_ALL */ struct { diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc index d47ad5e0100..97673e92bcf 100644 --- a/source/blender/gpu/intern/gpu_shader.cc +++ b/source/blender/gpu/intern/gpu_shader.cc @@ -106,7 +106,7 @@ void Shader::print_log(Span sources, char *log, const char *stage, error_line = error_char = -1; if (log_line[0] >= '0' && log_line[0] <= '9') { error_line = (int)strtol(log_line, &error_line_number_end, 10); - /* Try to fetch the error caracter (not always available). */ + /* Try to fetch the error character (not always available). */ if (ELEM(error_line_number_end[0], '(', ':') && error_line_number_end[1] != ' ') { error_char = (int)strtol(error_line_number_end + 1, &log_line, 10); } diff --git a/source/blender/gpu/intern/gpu_shader_interface.hh b/source/blender/gpu/intern/gpu_shader_interface.hh index 62513ffb8a7..942be84caae 100644 --- a/source/blender/gpu/intern/gpu_shader_interface.hh +++ b/source/blender/gpu/intern/gpu_shader_interface.hh @@ -41,7 +41,7 @@ typedef struct ShaderInput { uint32_t name_offset; uint32_t name_hash; int32_t location; - /** Defined at interface creation or in shader. Only for Samplers, UBOs and Vertex Attribs. */ + /** Defined at interface creation or in shader. Only for Samplers, UBOs and Vertex Attributes. */ int32_t binding; } ShaderInput; @@ -226,7 +226,7 @@ inline const ShaderInput *ShaderInterface::input_lookup(const ShaderInput *const for (int i = inputs_len - 1; i >= 0; i--) { if (inputs[i].name_hash == name_hash) { if ((i > 0) && UNLIKELY(inputs[i - 1].name_hash == name_hash)) { - /* Hash colision resolve. */ + /* Hash collision resolve. */ for (; i >= 0 && inputs[i].name_hash == name_hash; i--) { if (STREQ(name, name_buffer_ + inputs[i].name_offset)) { return inputs + i; /* not found */ diff --git a/source/blender/gpu/intern/gpu_shader_private.hh b/source/blender/gpu/intern/gpu_shader_private.hh index 85427372559..d9327bbc0f4 100644 --- a/source/blender/gpu/intern/gpu_shader_private.hh +++ b/source/blender/gpu/intern/gpu_shader_private.hh @@ -76,7 +76,7 @@ class Shader { void print_log(Span sources, char *log, const char *stage, const bool error); }; -/* Syntacting suggar. */ +/* Syntactic sugar. */ static inline GPUShader *wrap(Shader *vert) { return reinterpret_cast(vert); diff --git a/source/blender/gpu/intern/gpu_state_private.hh b/source/blender/gpu/intern/gpu_state_private.hh index cda1b591bb1..b79350a6506 100644 --- a/source/blender/gpu/intern/gpu_state_private.hh +++ b/source/blender/gpu/intern/gpu_state_private.hh @@ -101,16 +101,16 @@ union GPUStateMutable { /** Positive if using program point size. */ /* TODO(fclem): should be passed as uniform to all shaders. */ float point_size; - /** Not supported on every platform. Prefer using wideline shader. */ + /** Not supported on every platform. Prefer using wide-line shader. */ float line_width; /** Mutable stencil states. */ uint8_t stencil_write_mask; uint8_t stencil_compare_mask; uint8_t stencil_reference; uint8_t _pad0; - /* IMPORTANT: ensure x64 stuct alignment. */ + /* IMPORTANT: ensure x64 struct alignment. */ }; - /* Here to allow fast bitwise ops. */ + /* Here to allow fast bit-wise ops. */ uint64_t data[9]; }; diff --git a/source/blender/gpu/intern/gpu_texture_private.hh b/source/blender/gpu/intern/gpu_texture_private.hh index 4197d5c55fc..400a36559da 100644 --- a/source/blender/gpu/intern/gpu_texture_private.hh +++ b/source/blender/gpu/intern/gpu_texture_private.hh @@ -83,11 +83,11 @@ class Texture { protected: /* ---- Texture format (immutable after init). ---- */ - /** Width & Height & Depth. For cubemap arrays, d is number of facelayers. */ + /** Width & Height & Depth. For cube-map arrays, d is number of face-layers. */ int w_, h_, d_; /** Internal data format. */ eGPUTextureFormat format_; - /** Format caracteristics. */ + /** Format characteristics. */ eGPUTextureFormatFlag format_flag_; /** Texture type. */ eGPUTextureType type_; @@ -101,7 +101,7 @@ class Texture { /** For debugging */ char name_[DEBUG_NAME_LEN]; - /** Framebuffer references to update on deletion. */ + /** Frame-buffer references to update on deletion. */ GPUAttachmentType fb_attachment_[GPU_TEX_MAX_FBO_ATTACHED]; FrameBuffer *fb_[GPU_TEX_MAX_FBO_ATTACHED]; @@ -245,7 +245,7 @@ class Texture { virtual bool init_internal(GPUVertBuf *vbo) = 0; }; -/* Syntacting suggar. */ +/* Syntactic sugar. */ static inline GPUTexture *wrap(Texture *vert) { return reinterpret_cast(vert); diff --git a/source/blender/gpu/intern/gpu_uniform_buffer_private.hh b/source/blender/gpu/intern/gpu_uniform_buffer_private.hh index 826bdd9f8d5..e8fc1343eaf 100644 --- a/source/blender/gpu/intern/gpu_uniform_buffer_private.hh +++ b/source/blender/gpu/intern/gpu_uniform_buffer_private.hh @@ -65,7 +65,7 @@ class UniformBuf { } }; -/* Syntacting suggar. */ +/* Syntactic sugar. */ static inline GPUUniformBuf *wrap(UniformBuf *vert) { return reinterpret_cast(vert); diff --git a/source/blender/gpu/intern/gpu_vertex_buffer_private.hh b/source/blender/gpu/intern/gpu_vertex_buffer_private.hh index da8b02c5c66..67a09f6f83c 100644 --- a/source/blender/gpu/intern/gpu_vertex_buffer_private.hh +++ b/source/blender/gpu/intern/gpu_vertex_buffer_private.hh @@ -62,7 +62,7 @@ class VertBuf { void init(const GPUVertFormat *format, GPUUsageType usage); void clear(void); - /* Data manament */ + /* Data management. */ void allocate(uint vert_len); void resize(uint vert_len); void upload(void); @@ -105,7 +105,7 @@ class VertBuf { virtual void duplicate_data(VertBuf *dst) = 0; }; -/* Syntacting suggar. */ +/* Syntactic sugar. */ static inline GPUVertBuf *wrap(VertBuf *vert) { return reinterpret_cast(vert); diff --git a/source/blender/gpu/intern/gpu_vertex_format.cc b/source/blender/gpu/intern/gpu_vertex_format.cc index 625ad604b7c..8498da11507 100644 --- a/source/blender/gpu/intern/gpu_vertex_format.cc +++ b/source/blender/gpu/intern/gpu_vertex_format.cc @@ -105,7 +105,7 @@ uint vertex_buffer_size(const GPUVertFormat *format, uint vertex_len) static uchar copy_attr_name(GPUVertFormat *format, const char *name) { - /* strncpy does 110% of what we need; let's do exactly 100% */ + /* `strncpy` does 110% of what we need; let's do exactly 100% */ uchar name_offset = format->name_offset; char *name_copy = format->names + name_offset; uint available = GPU_VERT_ATTR_NAMES_BUF_LEN - name_offset; @@ -162,7 +162,7 @@ uint GPU_vertformat_attr_add(GPUVertFormat *format, assert(comp_len != 8 && comp_len != 12 && comp_len != 16); } #endif - format->name_len++; /* multiname support */ + format->name_len++; /* Multi-name support. */ const uint attr_id = format->attr_len++; GPUVertAttr *attr = &format->attrs[attr_id]; @@ -186,7 +186,7 @@ void GPU_vertformat_alias_add(GPUVertFormat *format, const char *alias) assert(format->name_len < GPU_VERT_FORMAT_MAX_NAMES); /* there's room for more */ assert(attr->name_len < GPU_VERT_ATTR_MAX_NAMES); #endif - format->name_len++; /* multiname support */ + format->name_len++; /* Multi-name support. */ attr->names[attr->name_len++] = copy_attr_name(format, alias); } diff --git a/source/blender/gpu/intern/gpu_viewport.c b/source/blender/gpu/intern/gpu_viewport.c index 205ba1d06d6..c118145ebd6 100644 --- a/source/blender/gpu/intern/gpu_viewport.c +++ b/source/blender/gpu/intern/gpu_viewport.c @@ -86,10 +86,10 @@ struct GPUViewport { int size[2]; int flag; - /* Set the active view (for stereoscoptic viewport rendering). */ + /* Set the active view (for stereoscopic viewport rendering). */ int active_view; - /* If engine_handles mismatch we free all ViewportEngineData in this viewport. */ + /* If engine_handles mismatch we free all #ViewportEngineData in this viewport. */ struct { void *handle; ViewportEngineData *data; @@ -589,7 +589,7 @@ void GPU_viewport_colorspace_set(GPUViewport *viewport, /* Restore. */ view_settings->curve_mapping = tmp_curve_mapping; viewport->view_settings.curve_mapping = tmp_curve_mapping_vp; - /* Only copy curvemapping if needed. Avoid uneeded OCIO cache miss. */ + /* Only copy curve-mapping if needed. Avoid unneeded OCIO cache miss. */ if (tmp_curve_mapping && viewport->view_settings.curve_mapping == NULL) { BKE_color_managed_view_settings_free(&viewport->view_settings); viewport->view_settings.curve_mapping = BKE_curvemapping_copy(tmp_curve_mapping); @@ -820,7 +820,7 @@ void GPU_viewport_draw_to_screen_ex(GPUViewport *viewport, const float w = (float)GPU_texture_width(color); const float h = (float)GPU_texture_height(color); - /* We allow rects with min/max swapped, but we also need coorectly assigned coordinates. */ + /* We allow rects with min/max swapped, but we also need correctly assigned coordinates. */ rcti sanitized_rect = *rect; BLI_rcti_sanitize(&sanitized_rect); @@ -974,7 +974,7 @@ static void gpu_viewport_passes_free(PassList *psl, int psl_len) memset(psl->passes, 0, sizeof(*psl->passes) * psl_len); } -/* Must be executed inside Drawmanager Opengl Context. */ +/* Must be executed inside Draw-manager OpenGL Context. */ void GPU_viewport_free(GPUViewport *viewport) { gpu_viewport_engines_data_free(viewport); diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc index 573ae654af4..a1b7aba1140 100644 --- a/source/blender/gpu/opengl/gl_backend.cc +++ b/source/blender/gpu/opengl/gl_backend.cc @@ -367,14 +367,14 @@ static void detect_workarounds() } } - /* Some Intel drivers have issues with using mips as framebuffer targets if - * GL_TEXTURE_MAX_LEVEL is higher than the target mip. + /* Some Intel drivers have issues with using mips as frame-buffer targets if + * GL_TEXTURE_MAX_LEVEL is higher than the target MIP. * Only check at the end after all other workarounds because this uses the drawing code. * Also after device/driver flags to avoid the check that causes pre GCN Radeon to crash. */ if (GCaps.mip_render_workaround == false) { GCaps.mip_render_workaround = detect_mip_render_workaround(); } - /* Disable multidraw if the base instance cannot be read. */ + /* Disable multi-draw if the base instance cannot be read. */ if (GLContext::shader_draw_parameters_support == false) { GLContext::multi_draw_indirect_support = false; } diff --git a/source/blender/gpu/opengl/gl_batch.hh b/source/blender/gpu/opengl/gl_batch.hh index 0fadde7a70d..218b9ffe4b7 100644 --- a/source/blender/gpu/opengl/gl_batch.hh +++ b/source/blender/gpu/opengl/gl_batch.hh @@ -52,9 +52,9 @@ class GLVaoCache { GLContext *context_ = NULL; /** Last interface this batch was drawn with. */ GLShaderInterface *interface_ = NULL; - /** Cached vao for the last interface. */ + /** Cached VAO for the last interface. */ GLuint vao_id_ = 0; - /** Used whend arb_base_instance is not supported. */ + /** Used when arb_base_instance is not supported. */ GLuint vao_base_instance_ = 0; int base_instance_ = 0; diff --git a/source/blender/gpu/opengl/gl_context.cc b/source/blender/gpu/opengl/gl_context.cc index d766e6f0828..6c9c6e10774 100644 --- a/source/blender/gpu/opengl/gl_context.cc +++ b/source/blender/gpu/opengl/gl_context.cc @@ -108,7 +108,7 @@ GLContext::~GLContext() BLI_assert(orphaned_vertarrays_.is_empty()); /* For now don't allow GPUFrameBuffers to be reuse in another context. */ BLI_assert(framebuffers_.is_empty()); - /* Delete vaos so the batch can be reused in another context. */ + /* Delete VAO's so the batch can be reused in another context. */ for (GLVaoCache *cache : vao_caches_) { cache->clear(); } @@ -312,7 +312,7 @@ void GLContext::memory_statistics_get(int *r_total_mem, int *r_free_mem) { /* TODO(merwin): use Apple's platform API to get this info. */ if (GLEW_NVX_gpu_memory_info) { - /* Teturned value in Kb. */ + /* Returned value in Kb. */ glGetIntegerv(GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, r_total_mem); glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, r_free_mem); } diff --git a/source/blender/gpu/opengl/gl_context.hh b/source/blender/gpu/opengl/gl_context.hh index 66a3fdd3355..b8d979e8f0e 100644 --- a/source/blender/gpu/opengl/gl_context.hh +++ b/source/blender/gpu/opengl/gl_context.hh @@ -87,7 +87,7 @@ class GLContext : public Context { private: /** - * GPUBatch & GPUFramebuffer have references to the context they are from, in the case the + * #GPUBatch & #GPUFramebuffer have references to the context they are from, in the case the * context is destroyed, we need to remove any reference to it. */ Set vao_caches_; @@ -97,7 +97,7 @@ class GLContext : public Context { /** VertexArrays and framebuffers are not shared across context. */ Vector orphaned_vertarrays_; Vector orphaned_framebuffers_; - /** GLBackend onws this data. */ + /** #GLBackend owns this data. */ GLSharedOrphanLists &shared_orphan_list_; public: diff --git a/source/blender/gpu/opengl/gl_debug.cc b/source/blender/gpu/opengl/gl_debug.cc index 0914c117241..ac42a950945 100644 --- a/source/blender/gpu/opengl/gl_debug.cc +++ b/source/blender/gpu/opengl/gl_debug.cc @@ -363,7 +363,7 @@ namespace blender::gpu { void GLContext::debug_group_begin(const char *name, int index) { if ((G.debug & G_DEBUG_GPU) && (GLEW_VERSION_4_3 || GLEW_KHR_debug)) { - /* Add 10 to avoid conlision with other indices from other possible callback layers. */ + /* Add 10 to avoid collision with other indices from other possible callback layers. */ index += 10; glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, index, -1, name); } diff --git a/source/blender/gpu/opengl/gl_framebuffer.hh b/source/blender/gpu/opengl/gl_framebuffer.hh index 95e67f5973c..7b2c73d7042 100644 --- a/source/blender/gpu/opengl/gl_framebuffer.hh +++ b/source/blender/gpu/opengl/gl_framebuffer.hh @@ -20,7 +20,7 @@ /** \file * \ingroup gpu * - * Encapsulation of Framebuffer states (attached textures, viewport, scissors). + * Encapsulation of Frame-buffer states (attached textures, viewport, scissors). */ #pragma once @@ -45,22 +45,22 @@ class GLFrameBuffer : public FrameBuffer { private: /** OpenGL handle. */ GLuint fbo_id_ = 0; - /** Context the handle is from. Framebuffers are not shared accros contexts. */ + /** Context the handle is from. Frame-buffers are not shared across contexts. */ GLContext *context_ = NULL; /** State Manager of the same contexts. */ GLStateManager *state_manager_ = NULL; /** Copy of the GL state. Contains ONLY color attachments enums for slot binding. */ GLenum gl_attachments_[GPU_FB_MAX_COLOR_ATTACHMENT]; - /** Internal framebuffers are immutable. */ + /** Internal frame-buffers are immutable. */ bool immutable_; - /** True is the framebuffer has its first color target using the GPU_SRGB8_A8 format. */ + /** True is the frame-buffer has its first color target using the GPU_SRGB8_A8 format. */ bool srgb_; - /** True is the framebuffer has been bound using the GL_FRAMEBUFFER_SRGB feature. */ + /** True is the frame-buffer has been bound using the GL_FRAMEBUFFER_SRGB feature. */ bool enabled_srgb_ = false; public: /** - * Create a conventional framebuffer to attach texture to. + * Create a conventional frame-buffer to attach texture to. */ GLFrameBuffer(const char *name); diff --git a/source/blender/gpu/opengl/gl_primitive.hh b/source/blender/gpu/opengl/gl_primitive.hh index 7cd0654bc2c..05a15017c66 100644 --- a/source/blender/gpu/opengl/gl_primitive.hh +++ b/source/blender/gpu/opengl/gl_primitive.hh @@ -20,7 +20,7 @@ /** \file * \ingroup gpu * - * Encapsulation of Framebuffer states (attached textures, viewport, scissors). + * Encapsulation of Frame-buffer states (attached textures, viewport, scissors). */ #pragma once diff --git a/source/blender/gpu/opengl/gl_shader_interface.cc b/source/blender/gpu/opengl/gl_shader_interface.cc index 9533639b133..5870c645bf4 100644 --- a/source/blender/gpu/opengl/gl_shader_interface.cc +++ b/source/blender/gpu/opengl/gl_shader_interface.cc @@ -51,7 +51,7 @@ static inline int sampler_binding(int32_t program, int32_t uniform_location, int *sampler_len) { - /* Identify sampler uniforms and asign sampler units to them. */ + /* Identify sampler uniforms and assign sampler units to them. */ GLint type; glGetActiveUniformsiv(program, 1, &uniform_index, GL_UNIFORM_TYPE, &type); @@ -106,7 +106,7 @@ static inline int image_binding(int32_t program, int32_t uniform_location, int *image_len) { - /* Identify image uniforms and asign image units to them. */ + /* Identify image uniforms and assign image units to them. */ GLint type; glGetActiveUniformsiv(program, 1, &uniform_index, GL_UNIFORM_TYPE, &type); @@ -133,7 +133,7 @@ static inline int image_binding(int32_t program, GLShaderInterface::GLShaderInterface(GLuint program) { - /* Necessary to make glUniform works. */ + /* Necessary to make #glUniform works. */ glUseProgram(program); GLint max_attr_name_len = 0, attr_len = 0; diff --git a/source/blender/gpu/opengl/gl_state.hh b/source/blender/gpu/opengl/gl_state.hh index 643e46acc2d..651c3c22afa 100644 --- a/source/blender/gpu/opengl/gl_state.hh +++ b/source/blender/gpu/opengl/gl_state.hh @@ -42,7 +42,7 @@ class GLTexture; */ class GLStateManager : public StateManager { public: - /** Anothter reference to the active framebuffer. */ + /** Another reference to the active frame-buffer. */ GLFrameBuffer *active_fb = nullptr; private: diff --git a/source/blender/gpu/opengl/gl_texture.cc b/source/blender/gpu/opengl/gl_texture.cc index 2e8d9dd6e1c..ef38e964c7b 100644 --- a/source/blender/gpu/opengl/gl_texture.cc +++ b/source/blender/gpu/opengl/gl_texture.cc @@ -32,7 +32,7 @@ #include "gl_backend.hh" #include "gl_debug.hh" #include "gl_state.hh" -#include "gpu_vertex_buffer_private.hh" /* TODO shoud be gl_vertex_buffer.hh */ +#include "gpu_vertex_buffer_private.hh" /* TODO should be `gl_vertex_buffer.hh` */ #include "gl_texture.hh" diff --git a/source/blender/gpu/opengl/gl_texture.hh b/source/blender/gpu/opengl/gl_texture.hh index e686a7defca..65a211e12a3 100644 --- a/source/blender/gpu/opengl/gl_texture.hh +++ b/source/blender/gpu/opengl/gl_texture.hh @@ -1,4 +1,3 @@ - /* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -20,13 +19,6 @@ /** \file * \ingroup gpu - * - * GPU Framebuffer - * - this is a wrapper for an OpenGL framebuffer object (FBO). in practice - * multiple FBO's may be created. - * - actual FBO creation & config is deferred until GPU_framebuffer_bind or - * GPU_framebuffer_check_valid to allow creation & config while another - * opengl context is bound (since FBOs are not shared between ogl contexts). */ #pragma once diff --git a/source/blender/imbuf/IMB_metadata.h b/source/blender/imbuf/IMB_metadata.h index 501bf9dfba1..652ce913ee5 100644 --- a/source/blender/imbuf/IMB_metadata.h +++ b/source/blender/imbuf/IMB_metadata.h @@ -35,7 +35,7 @@ struct anim; * The metadata is a list of key/value pairs (both char *) that can me * saved in the header of several image formats. * Apart from some common keys like - * 'Software' and 'Description' (png standard) we'll use keys within the + * 'Software' and 'Description' (PNG standard) we'll use keys within the * Blender namespace, so should be called 'Blender::StampInfo' or 'Blender::FrameNum' * etc... * diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index bfb7bc93ac7..90c863878ff 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -197,7 +197,7 @@ void IMB_freezbuffloatImBuf(ImBuf *ibuf) ibuf->mall &= ~IB_zbuffloat; } -/** Free all pixel data (assosiated with image size). */ +/** Free all pixel data (associated with image size). */ void imb_freerectImbuf_all(ImBuf *ibuf) { imb_freerectImBuf(ibuf); diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index c40e65b1c5c..3a7570cd320 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -1050,7 +1050,7 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, IMB_Timecode_Typ int64_t pts_to_search = 0; double frame_rate; double pts_time_base; - long long st_time; + int64_t st_time; struct anim_index *tc_index = 0; AVStream *v_st; int new_frame_index = 0; /* To quiet gcc barking... */ @@ -1121,7 +1121,7 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, IMB_Timecode_Typ ffmpeg_decode_video_frame_scan(anim, pts_to_search); } else if (position != anim->curposition + 1) { - long long pos; + int64_t pos; int ret; if (tc_index) { @@ -1145,7 +1145,7 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, IMB_Timecode_Typ } } else { - pos = (long long)(position - anim->preseek) * AV_TIME_BASE / frame_rate; + pos = (int64_t)(position - anim->preseek) * AV_TIME_BASE / frame_rate; av_log(anim->pFormatCtx, AV_LOG_DEBUG, diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp index 00fa0111d1c..3b1b970fb3c 100644 --- a/source/blender/imbuf/intern/dds/ColorBlock.cpp +++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp @@ -400,7 +400,7 @@ void ColorBlock::boundsRangeAlpha(Color32 *start, Color32 *end) const #endif #if 0 -/** Sort colors by abosolute value in their 16 bit representation. */ +/** Sort colors by absolute value in their 16 bit representation. */ void ColorBlock::sortColorsByAbsoluteValue() { /* Dummy selection sort. */ diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c index f8029c08bad..7ada0130059 100644 --- a/source/blender/imbuf/intern/imageprocess.c +++ b/source/blender/imbuf/intern/imageprocess.c @@ -115,7 +115,7 @@ void bicubic_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, in return; } - /* gcc warns these could be uninitialized, but its ok. */ + /* GCC warns these could be uninitialized, but its ok. */ pixel_from_buffer(out, &outI, &outF, xout, yout); bicubic_interpolation_color(in, outI, outF, u, v); diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index fb8c361d94b..cf27557d043 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -476,7 +476,7 @@ static ImBuf *imb_load_jp2_stream(opj_stream_t *stream, r = image->comps[0].data; a = (use_alpha) ? image->comps[1].data : NULL; - /* grayscale 12bits+ */ + /* Gray-scale 12bits+ */ if (use_alpha) { a = image->comps[1].data; PIXEL_LOOPER_BEGIN (rect_float) { @@ -500,7 +500,7 @@ static ImBuf *imb_load_jp2_stream(opj_stream_t *stream, g = image->comps[1].data; b = image->comps[2].data; - /* rgb or rgba 12bits+ */ + /* RGB or RGBA 12bits+ */ if (use_alpha) { a = image->comps[3].data; PIXEL_LOOPER_BEGIN (rect_float) { @@ -551,7 +551,7 @@ static ImBuf *imb_load_jp2_stream(opj_stream_t *stream, g = image->comps[1].data; b = image->comps[2].data; - /* 8bit rgb or rgba */ + /* 8bit RGB or RGBA */ if (use_alpha) { a = image->comps[3].data; PIXEL_LOOPER_BEGIN (rect_uchar) { diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 979e7703e81..2a9cb9af891 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -1108,7 +1108,7 @@ void IMB_exr_write_channels(void *handle) const size_t num_pixels = ((size_t)data->width) * data->height; half *rect_half = nullptr, *current_rect_half = nullptr; - /* We allocate teporary storage for half pixels for all the channels at once. */ + /* We allocate temporary storage for half pixels for all the channels at once. */ if (data->num_half_channels != 0) { rect_half = (half *)MEM_mallocN(sizeof(half) * data->num_half_channels * num_pixels, __func__); @@ -1235,7 +1235,7 @@ void IMB_exr_read_channels(void *handle) Header header = in.header(); Box2i dw = header.dataWindow(); - /* Insert all matching channel into framebuffer. */ + /* Insert all matching channel into frame-buffer. */ FrameBuffer frameBuffer; ExrChannel *echan; diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index a9833623250..d7cefbbd077 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -713,7 +713,7 @@ ImBuf *imb_loadtarga(const unsigned char *mem, return ibuf; } - if (!ELEM(tga.imgtyp, 1, 9)) { /* happens sometimes (beuh) */ + if (!ELEM(tga.imgtyp, 1, 9)) { /* happens sometimes (ugh) */ if (cmap) { MEM_freeN(cmap); cmap = NULL; diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 038c9950968..0d2080b5f0a 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -63,7 +63,7 @@ * because 'near' is disabled through BLI_windstuff */ # include "BLI_winstuff.h" # include "utfconv.h" -# include /* chdir */ +# include /* #chdir */ # include #endif diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 587d6ad9e7e..2fb14e40d9d 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -512,7 +512,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image) } if (success) { - /* Code seems to be not needed for 16 bits tif, on PPC G5 OSX (ton) */ + /* Code seems to be not needed for 16 bits TIFF, on PPC G5 OSX (ton) */ if (bitspersample < 16) { if (ENDIAN_ORDER == B_ENDIAN) { IMB_convert_rgba_to_abgr(tmpibuf); @@ -806,7 +806,7 @@ bool imb_savetiff(ImBuf *ibuf, const char *filepath, int flags) /* open TIFF file for writing */ if (flags & IB_mem) { - /* bork at the creation of a TIFF in memory */ + /* Failed to allocate TIFF in memory. */ fprintf(stderr, "imb_savetiff: creation of in-memory TIFF files is " "not yet supported.\n"); diff --git a/source/blender/io/alembic/exporter/abc_writer_mesh.h b/source/blender/io/alembic/exporter/abc_writer_mesh.h index fdf2d3cc1e3..ed4fb4e4514 100644 --- a/source/blender/io/alembic/exporter/abc_writer_mesh.h +++ b/source/blender/io/alembic/exporter/abc_writer_mesh.h @@ -32,7 +32,7 @@ namespace blender::io::alembic { /* Writer for Alembic geometry. Does not assume the object is a mesh object. */ class ABCGenericMeshWriter : public ABCAbstractWriter { private: - /* Either polymesh or subd is used, depending on is_subd_. + /* Either poly-mesh or subdivision-surface is used, depending on is_subd_. * References to the schema must be kept, or Alembic will not properly write. */ Alembic::AbcGeom::OPolyMesh abc_poly_mesh_; Alembic::AbcGeom::OPolyMeshSchema abc_poly_mesh_schema_; diff --git a/source/blender/io/alembic/exporter/abc_writer_transform.cc b/source/blender/io/alembic/exporter/abc_writer_transform.cc index 7fe9fd933c5..eff042d036d 100644 --- a/source/blender/io/alembic/exporter/abc_writer_transform.cc +++ b/source/blender/io/alembic/exporter/abc_writer_transform.cc @@ -94,7 +94,7 @@ void ABCTransformWriter::do_write(HierarchyContext &context) scale_mat[3][3] = args_.export_params->global_scale; /* also scale translation */ mul_m4_m4m4(parent_relative_matrix, parent_relative_matrix, scale_mat); parent_relative_matrix[3][3] /= - args_.export_params->global_scale; /* normalise the homogeneous component */ + args_.export_params->global_scale; /* Normalize the homogeneous component. */ } XformSample xform_sample; diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc index 0b9636ffb70..8133f615080 100644 --- a/source/blender/io/alembic/intern/abc_reader_mesh.cc +++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc @@ -521,7 +521,7 @@ static bool has_animated_geom_params(const ICompoundProperty arbGeomParams) return false; } -/* Specialisation of has_animations() as defined in abc_reader_object.h. */ +/* Specialization of #has_animations() as defined in abc_reader_object.h. */ template<> bool has_animations(Alembic::AbcGeom::IPolyMeshSchema &schema, ImportSettings *settings) { if (settings->is_sequence || !schema.isConstant()) { diff --git a/source/blender/io/alembic/intern/abc_util.cc b/source/blender/io/alembic/intern/abc_util.cc index aa7beb37dc5..3d3ba0347c5 100644 --- a/source/blender/io/alembic/intern/abc_util.cc +++ b/source/blender/io/alembic/intern/abc_util.cc @@ -135,7 +135,7 @@ bool has_property(const Alembic::Abc::ICompoundProperty &prop, const std::string return prop.getPropertyHeader(name) != nullptr; } -typedef std::pair index_time_pair_t; +using index_time_pair_t = std::pair; float get_weight_and_index(float time, const Alembic::AbcCoreAbstract::TimeSamplingPtr &time_sampling, diff --git a/source/blender/io/collada/AnimationImporter.cpp b/source/blender/io/collada/AnimationImporter.cpp index 9f54bf2aa28..49f28325257 100644 --- a/source/blender/io/collada/AnimationImporter.cpp +++ b/source/blender/io/collada/AnimationImporter.cpp @@ -120,12 +120,12 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) COLLADAFW::FloatOrDoubleArray &intan = curve->getInTangentValues(); COLLADAFW::FloatOrDoubleArray &outtan = curve->getOutTangentValues(); - /* intangent */ + /* In-tangent. */ unsigned int index = 2 * (j * dim + i); bez.vec[0][0] = bc_get_float_value(intan, index) * fps; bez.vec[0][1] = bc_get_float_value(intan, index + 1); - /* outtangent */ + /* Out-tangent. */ bez.vec[2][0] = bc_get_float_value(outtan, index) * fps; bez.vec[2][1] = bc_get_float_value(outtan, index + 1); if (curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER) { diff --git a/source/blender/io/collada/ArmatureExporter.cpp b/source/blender/io/collada/ArmatureExporter.cpp index 9bf1a4ae830..28f5f9d40bc 100644 --- a/source/blender/io/collada/ArmatureExporter.cpp +++ b/source/blender/io/collada/ArmatureExporter.cpp @@ -197,7 +197,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, add_bone_transform(ob_arm, bone, node); - /* Write nodes of childobjects, remove written objects from list */ + /* Write nodes of child-objects, remove written objects from list. */ std::vector::iterator iter = child_objects.begin(); while (iter != child_objects.end()) { @@ -219,7 +219,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, * single matrix the tweak must be applied * to the result. */ if (export_settings.get_open_sim()) { - /* Tweak objects parentinverse to match compatibility. */ + /* Tweak objects parent-inverse to match compatibility. */ float temp[4][4]; copy_m4_m4(temp, bone->arm_mat); diff --git a/source/blender/io/collada/ArmatureImporter.cpp b/source/blender/io/collada/ArmatureImporter.cpp index 7eef5c3f5fb..5c3d6be589a 100644 --- a/source/blender/io/collada/ArmatureImporter.cpp +++ b/source/blender/io/collada/ArmatureImporter.cpp @@ -1108,7 +1108,7 @@ BoneExtended &ArmatureImporter::add_bone_extended(EditBone *bone, } if (!has_connect && this->import_settings->auto_connect) { - /* auto connect only whyen parent has exactly one child*/ + /* Auto connect only when parent has exactly one child. */ connect_type = sibcount == 1; } diff --git a/source/blender/io/collada/BCAnimationCurve.h b/source/blender/io/collada/BCAnimationCurve.h index 27856dd55f4..a1597cd47be 100644 --- a/source/blender/io/collada/BCAnimationCurve.h +++ b/source/blender/io/collada/BCAnimationCurve.h @@ -133,7 +133,7 @@ class BCAnimationCurve { void get_frames(BCFrames &frames) const; - /* Curve edit functions create a copy of the underlaying FCurve */ + /* Curve edit functions create a copy of the underlying #FCurve. */ FCurve *get_edit_fcurve(); bool add_value_from_rna(const int frame); bool add_value_from_matrix(const BCSample &sample, const int frame); diff --git a/source/blender/io/collada/BCAnimationSampler.cpp b/source/blender/io/collada/BCAnimationSampler.cpp index a6ee0b8bee6..b2a9027380e 100644 --- a/source/blender/io/collada/BCAnimationSampler.cpp +++ b/source/blender/io/collada/BCAnimationSampler.cpp @@ -536,7 +536,7 @@ const BCMatrix *BCSampleFrame::get_sample_matrix(Object *ob) const return &sample->get_matrix(); } -/* Get the matrix for the given Bone, returns Unity when the Objewct is not sampled */ +/* Get the matrix for the given Bone, returns Unity when the Object is not sampled. */ const BCMatrix *BCSampleFrame::get_sample_matrix(Object *ob, Bone *bone) const { BCSampleMap::const_iterator it = sampleMap.find(ob); diff --git a/source/blender/io/collada/DocumentImporter.cpp b/source/blender/io/collada/DocumentImporter.cpp index 10c1a90576c..259bf901091 100644 --- a/source/blender/io/collada/DocumentImporter.cpp +++ b/source/blender/io/collada/DocumentImporter.cpp @@ -275,15 +275,15 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW::Node *par = nullptr, Object *parob = nullptr) { - /* The split in T29246, rootmap must point at actual root when + /* The split in T29246, root_map must point at actual root when * calculating bones in apply_curves_as_matrix. - actual root is the root node. * This has to do with inverse bind poses being world space - * (the sources for skinned bones' restposes) and the way - * non-skinning nodes have their "restpose" recursively calculated. + * (the sources for skinned bones' rest-poses) and the way + * non-skinning nodes have their "rest-pose" recursively calculated. * XXX TODO: design issue, how to support unrelated joints taking * part in skinning. */ if (par) { // && par->getType() == COLLADAFW::Node::JOINT) { - /* par is root if there's no corresp. key in root_map */ + /* If par is root if there's no corresponding key in root_map. */ if (root_map.find(par->getUniqueId()) == root_map.end()) { root_map[node->getUniqueId()] = node; } @@ -942,7 +942,7 @@ bool DocumentImporter::writeCamera(const COLLADAFW::Camera *camera) case CAM_PERSP: default: { double x = camera->getXFov().getValue(); - /* x is in degrees, cam->lens is in millimiters */ + /* X is in degrees, cam->lens is in millimeters. */ cam->lens = fov_to_focallength(DEG2RADF(x), cam->sensor_x); } break; } @@ -955,7 +955,7 @@ bool DocumentImporter::writeCamera(const COLLADAFW::Camera *camera) case CAM_PERSP: default: { double yfov = camera->getYFov().getValue(); - /* yfov is in degrees, cam->lens is in millimiters */ + /* yfov is in degrees, cam->lens is in millimeters. */ cam->lens = fov_to_focallength(DEG2RADF(yfov), cam->sensor_x); } break; } diff --git a/source/blender/io/collada/DocumentImporter.h b/source/blender/io/collada/DocumentImporter.h index a23e983940e..a6ed014a33c 100644 --- a/source/blender/io/collada/DocumentImporter.h +++ b/source/blender/io/collada/DocumentImporter.h @@ -125,7 +125,7 @@ class DocumentImporter : COLLADAFW::IWriter { /** Add element and data for UniqueId */ bool addExtraTags(const COLLADAFW::UniqueId &uid, ExtraTags *extra_tags); - /** Get an extisting ExtraTags for uid */ + /** Get an existing #ExtraTags for uid */ ExtraTags *getExtraTags(const COLLADAFW::UniqueId &uid); bool is_armature(COLLADAFW::Node *node); diff --git a/source/blender/io/collada/MeshImporter.cpp b/source/blender/io/collada/MeshImporter.cpp index 2934ea1caa6..172f9a468b4 100644 --- a/source/blender/io/collada/MeshImporter.cpp +++ b/source/blender/io/collada/MeshImporter.cpp @@ -693,7 +693,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me) set_poly_indices(mpoly, mloop, loop_index, triangle_vertex_indices, 3); if (mp_has_normals) { /* vertex normals, same implementation as for the triangles */ - /* the same for vertces normals */ + /* The same for vertices normals. */ unsigned int vertex_normal_indices[3] = { first_normal, normal_indices[1], normal_indices[2]}; if (!is_flat_face(vertex_normal_indices, nor, 3)) { diff --git a/source/blender/io/common/intern/abstract_hierarchy_iterator.cc b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc index eaa4d2fdde7..a33d636500f 100644 --- a/source/blender/io/common/intern/abstract_hierarchy_iterator.cc +++ b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc @@ -400,7 +400,7 @@ static bool remove_weak_subtrees(const HierarchyContext *context, void AbstractHierarchyIterator::export_graph_prune() { - /* Take a copy of the map so that we can modify while recursing. */ + /* Take a copy of the map so that we can modify while recusing. */ ExportGraph unpruned_export_graph = export_graph_; remove_weak_subtrees(HierarchyContext::root(), export_graph_, unpruned_export_graph); } diff --git a/source/blender/io/common/intern/object_identifier_test.cc b/source/blender/io/common/intern/object_identifier_test.cc index 30e1e43d076..8d0800ce2cb 100644 --- a/source/blender/io/common/intern/object_identifier_test.cc +++ b/source/blender/io/common/intern/object_identifier_test.cc @@ -129,7 +129,7 @@ TEST_F(ObjectIdentifierOrderTest, duplicated_objects) EXPECT_FALSE(id_different_dupli_b < id_dupli_b); } -TEST_F(ObjectIdentifierOrderTest, behaviour_as_map_keys) +TEST_F(ObjectIdentifierOrderTest, behavior_as_map_keys) { ObjectIdentifier id_root = ObjectIdentifier::for_graph_root(); ObjectIdentifier id_another_root = ObjectIdentifier::for_graph_root(); diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index a69af18ded2..e8748e28776 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -1148,12 +1148,12 @@ typedef struct NodeGeometryRotatePoints { typedef struct NodeGeometryAlignRotationToVector { /* GeometryNodeAlignRotationToVectorAxis */ uint8_t axis; + /* GeometryNodeAlignRotationToVectorPivotAxis */ + uint8_t pivot_axis; /* GeometryNodeAttributeInputMode */ uint8_t input_type_factor; uint8_t input_type_vector; - - char _pad[5]; } NodeGeometryAlignRotationToVector; typedef struct NodeGeometryPointScale { @@ -1202,6 +1202,20 @@ typedef struct NodeGeometryCollectionInfo { char _pad[7]; } NodeGeometryCollectionInfo; +typedef struct NodeGeometryAttributeProximity { + /* GeometryNodeAttributeProximityTargetGeometryElement. */ + uint8_t target_geometry_element; + + char _pad[7]; +} NodeGeometryAttributeProximity; + +typedef struct NodeGeometryVolumeToMesh { + /* VolumeToMeshResolutionMode */ + uint8_t resolution_mode; + + char _pad[7]; +} NodeGeometryVolumeToMesh; + /* script node mode */ #define NODE_SCRIPT_INTERNAL 0 #define NODE_SCRIPT_EXTERNAL 1 @@ -1589,6 +1603,12 @@ typedef enum NodeShaderOutputTarget { /* Geometry Nodes */ +typedef enum GeometryNodeAttributeProximityTargetGeometryElement { + GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_POINTS = 0, + GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_EDGES = 1, + GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_FACES = 2, +} GeometryNodeAttributeProximityTargetGeometryElement; + /* Boolean Node */ typedef enum GeometryNodeBooleanOperation { GEO_NODE_BOOLEAN_INTERSECT = 0, @@ -1647,6 +1667,13 @@ typedef enum GeometryNodeAlignRotationToVectorAxis { GEO_NODE_ALIGN_ROTATION_TO_VECTOR_AXIS_Z = 2, } GeometryNodeAlignRotationToVectorAxis; +typedef enum GeometryNodeAlignRotationToVectorPivotAxis { + GEO_NODE_ALIGN_ROTATION_TO_VECTOR_PIVOT_AXIS_AUTO = 0, + GEO_NODE_ALIGN_ROTATION_TO_VECTOR_PIVOT_AXIS_X = 1, + GEO_NODE_ALIGN_ROTATION_TO_VECTOR_PIVOT_AXIS_Y = 2, + GEO_NODE_ALIGN_ROTATION_TO_VECTOR_PIVOT_AXIS_Z = 3, +} GeometryNodeAlignRotationToVectorPivotAxis; + typedef enum GeometryNodeTransformSpace { GEO_NODE_TRANSFORM_SPACE_ORIGINAL = 0, GEO_NODE_TRANSFORM_SPACE_RELATIVE = 1, diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 790f3423eef..0e31ec3494e 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -1013,8 +1013,11 @@ typedef enum ePathCompare_Flag { /** #UserDef.viewzoom */ typedef enum eViewZoom_Style { - USER_ZOOM_CONT = 0, + /** Update zoom continuously with a timer while dragging the cursor. */ + USER_ZOOM_CONTINUE = 0, + /** Map changes in distance from the view center to zoom. */ USER_ZOOM_SCALE = 1, + /** Map horizontal/vertical motion to zoom. */ USER_ZOOM_DOLLY = 2, } eViewZoom_Style; diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 843e6935416..7624649bf78 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -1074,7 +1074,7 @@ static int calculate_struct_sizes(int firststruct, FILE *file_verify, const char } } - if (size_native % 4) { + if (size_native % 4 && !ELEM(size_native, 1, 2)) { fprintf(stderr, "Sizeerror 4 in struct: %s (add %d bytes)\n", types[structtype], diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index ae23e0b9109..d8c91cb2923 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -3704,7 +3704,7 @@ void RNA_property_pointer_set(PointerRNA *ptr, } } else { - /* Assigning to an IDProperty desguised as RNA one. */ + /* Assigning to an IDProperty disguised as RNA one. */ if (ptr_value.type != NULL && !RNA_struct_is_a(ptr_value.type, &RNA_ID)) { BKE_reportf(reports, RPT_ERROR, @@ -3741,7 +3741,7 @@ void RNA_property_pointer_set(PointerRNA *ptr, pprop->set(ptr, ptr_value, reports); } } - /* IDProperty desguised as RNA property (and not yet defined in ptr). */ + /* IDProperty disguised as RNA property (and not yet defined in ptr). */ else if (prop->flag & PROP_EDITABLE) { IDPropertyTemplate val = {0}; IDProperty *group; @@ -6174,7 +6174,7 @@ char *RNA_path_full_property_py_ex( } else { if (use_fallback) { - /* fuzzy fallback. be explicit in our ignoranc. */ + /* Fuzzy fallback. Be explicit in our ignorance. */ data_path = RNA_property_identifier(prop); data_delim = " ... "; } diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c index 06215e16965..8e95388fe2b 100644 --- a/source/blender/makesrna/intern/rna_animviz.c +++ b/source/blender/makesrna/intern/rna_animviz.c @@ -61,7 +61,7 @@ static void rna_AnimViz_path_start_frame_set(PointerRNA *ptr, int value) { bAnimVizSettings *data = (bAnimVizSettings *)ptr->data; - /* XXX: watchit! Path Start > MAXFRAME/2 could be a problem... */ + /* XXX: Watch it! Path Start > MAXFRAME/2 could be a problem. */ data->path_sf = value; FRAMENUMBER_MIN_CLAMP(data->path_sf); diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 2762f36e557..274edc9e48b 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -1306,7 +1306,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); - /* Randomnes factor for pressure */ + /* Randomness factor for pressure */ prop = RNA_def_property(srna, "random_pressure", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "draw_random_press"); RNA_def_property_range(prop, 0.0f, 1.0f); @@ -1315,7 +1315,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); - /* Randomnes factor for strength */ + /* Randomness factor for strength */ prop = RNA_def_property(srna, "random_strength", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "draw_random_strength"); RNA_def_property_range(prop, 0.0f, 1.0f); @@ -1448,7 +1448,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); - /* fill threshold for transparence */ + /* Fill threshold for transparency. */ prop = RNA_def_property(srna, "fill_threshold", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "fill_threshold"); RNA_def_property_range(prop, 0.0f, 1.0f); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 4f5828311d8..843cb326be2 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -3032,7 +3032,7 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna) prop, "Use Original Scale", "Apply volume preservation over the original scaling"); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - /* volume presevation for "volumetric" scale mode */ + /* Volume preservation for "volumetric" scale mode. */ prop = RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0, 100.0f); RNA_def_property_ui_text( diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index da04ac63ee3..df3bd0cca29 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -1298,7 +1298,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, dcont = rna_find_container_def(cont); - /* XXX - toto, detect supertype collisions */ + /* TODO: detect super-type collisions. */ if (rna_findlink(&dcont->properties, identifier)) { CLOG_ERROR(&LOG, "duplicate identifier \"%s.%s\"", CONTAINER_RNA_ID(cont), identifier); DefRNA.error = true; diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c index cbb642577e1..aab81b2bd1f 100644 --- a/source/blender/makesrna/intern/rna_depsgraph.c +++ b/source/blender/makesrna/intern/rna_depsgraph.c @@ -684,7 +684,7 @@ static void rna_def_depsgraph(BlenderRNA *brna) "This invalidates all references to evaluated data-blocks from this dependency graph."); RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS); - /* Queries for original datablockls (the ones depsgraph is built for). */ + /* Queries for original data-blocks (the ones depsgraph is built for). */ prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Scene"); @@ -699,7 +699,7 @@ static void rna_def_depsgraph(BlenderRNA *brna) RNA_def_property_ui_text( prop, "View Layer", "Original view layer dependency graph is built for"); - /* Queries for evaluated datablockls (the ones depsgraph is evaluating). */ + /* Queries for evaluated data-blocks (the ones depsgraph is evaluating). */ func = RNA_def_function(srna, "id_eval_get", "rna_Depsgraph_id_eval_get"); parm = RNA_def_pointer( diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 7c4762aa3a3..83df997b3d4 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -625,7 +625,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT1); RNA_def_property_ui_text(prop, "Use Output", "Save this output layer"); - /* output for secondary sufrace data */ + /* Output for secondary surface data. */ prop = RNA_def_property(srna, "output_name_b", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "output_name2"); RNA_def_property_ui_text(prop, "Output Name", "Name used to save output from this surface"); diff --git a/source/blender/makesrna/intern/rna_fluid.c b/source/blender/makesrna/intern/rna_fluid.c index 3ea98d610f4..a34c3c7b536 100644 --- a/source/blender/makesrna/intern/rna_fluid.c +++ b/source/blender/makesrna/intern/rna_fluid.c @@ -1964,7 +1964,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Tension", - "Surface tension of liquid (higher value results in greater hydrophobic behaviour)"); + "Surface tension of liquid (higher value results in greater hydrophobic behavior)"); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset"); prop = RNA_def_property(srna, "viscosity_base", PROP_FLOAT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 209dc21d386..4d9c53df013 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -816,6 +816,21 @@ static void rna_GPencil_stroke_point_pop(ID *id, WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); } +static void rna_GPencil_stroke_point_update(ID *id, bGPDstroke *stroke) +{ + bGPdata *gpd = (bGPdata *)id; + + /* Calc geometry data. */ + if (stroke) { + BKE_gpencil_stroke_geometry_update(gpd, stroke); + + DEG_id_tag_update(&gpd->id, + ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE); + + WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); + } +} + static bGPDstroke *rna_GPencil_stroke_new(bGPDframe *frame) { bGPDstroke *stroke = BKE_gpencil_stroke_new(0, 0, 1.0f); @@ -1274,6 +1289,10 @@ static void rna_def_gpencil_stroke_points_api(BlenderRNA *brna, PropertyRNA *cpr RNA_def_function_ui_description(func, "Remove a grease pencil stroke point"); RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID); RNA_def_int(func, "index", -1, INT_MIN, INT_MAX, "Index", "point index", INT_MIN, INT_MAX); + + func = RNA_def_function(srna, "update", "rna_GPencil_stroke_point_update"); + RNA_def_function_ui_description(func, "Recalculate internal triangulation data"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID); } /* This information is read only and it can be used by add-ons */ diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index 25472ce9520..319aeb69a2b 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -132,12 +132,12 @@ static void rna_Lattice_update_size(Main *bmain, Scene *scene, PointerRNA *ptr) Object *ob; int newu, newv, neww; - /* we don't modify the actual pnts, but go through opnts instead */ + /* We don't modify the actual `pnts`, but go through `opnts` instead. */ newu = (lt->opntsu > 0) ? lt->opntsu : lt->pntsu; newv = (lt->opntsv > 0) ? lt->opntsv : lt->pntsv; neww = (lt->opntsw > 0) ? lt->opntsw : lt->pntsw; - /* BKE_lattice_resize needs an object, any object will have the same result */ + /* #BKE_lattice_resize needs an object, any object will have the same result */ for (ob = bmain->objects.first; ob; ob = ob->id.next) { if (ob->data == lt) { BKE_lattice_resize(lt, newu, newv, neww, ob); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index c13f592f7fb..7209d17735a 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -681,7 +681,7 @@ static void rna_Modifier_is_active_set(PointerRNA *ptr, bool value) ModifierData *md = ptr->data; if (value) { - /* Disable the active flag of all other modif-iers. */ + /* Disable the active flag of all other modifiers. */ for (ModifierData *prev_md = md->prev; prev_md != NULL; prev_md = prev_md->prev) { prev_md->flag &= ~eModifierFlag_Active; } diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index ab6d4fa985c..5dbc574d073 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -29,6 +29,7 @@ #include "DNA_material_types.h" #include "DNA_mesh_types.h" +#include "DNA_modifier_types.h" #include "DNA_node_types.h" #include "DNA_object_types.h" #include "DNA_particle_types.h" @@ -8793,6 +8794,30 @@ static void def_geo_align_rotation_to_vector(StructRNA *srna) {0, NULL, 0, NULL, NULL}, }; + static const EnumPropertyItem pivot_axis_items[] = { + {GEO_NODE_ALIGN_ROTATION_TO_VECTOR_PIVOT_AXIS_AUTO, + "AUTO", + ICON_NONE, + "Auto", + "Automatically detect the best rotation axis to rotate towards the vector"}, + {GEO_NODE_ALIGN_ROTATION_TO_VECTOR_PIVOT_AXIS_X, + "X", + ICON_NONE, + "X", + "Rotate around the local X axis"}, + {GEO_NODE_ALIGN_ROTATION_TO_VECTOR_PIVOT_AXIS_Y, + "Y", + ICON_NONE, + "Y", + "Rotate around the local Y axis"}, + {GEO_NODE_ALIGN_ROTATION_TO_VECTOR_PIVOT_AXIS_Z, + "Z", + ICON_NONE, + "Z", + "Rotate around the local Z axis"}, + {0, NULL, 0, NULL, NULL}, + }; + PropertyRNA *prop; RNA_def_struct_sdna_from(srna, "NodeGeometryAlignRotationToVector", "storage"); @@ -8802,6 +8827,11 @@ static void def_geo_align_rotation_to_vector(StructRNA *srna) RNA_def_property_ui_text(prop, "Axis", "Axis to align to the vector"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + prop = RNA_def_property(srna, "pivot_axis", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, pivot_axis_items); + RNA_def_property_ui_text(prop, "Pivot Axis", "Axis to rotate around"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + prop = RNA_def_property(srna, "input_type_factor", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_float); RNA_def_property_ui_text(prop, "Input Type Factor", ""); @@ -8938,6 +8968,70 @@ static void def_geo_collection_info(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } +static void def_geo_attribute_proximity(StructRNA *srna) +{ + static const EnumPropertyItem target_geometry_element[] = { + {GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_POINTS, + "POINTS", + ICON_NONE, + "Points", + "Calculate proximity to the target's points (usually faster than the other two modes)"}, + {GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_EDGES, + "EDGES", + ICON_NONE, + "Edges", + "Calculate proximity to the target's edges"}, + {GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_FACES, + "FACES", + ICON_NONE, + "Faces", + "Calculate proximity to the target's faces"}, + {0, NULL, 0, NULL, NULL}, + }; + + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeGeometryAttributeProximity", "storage"); + + prop = RNA_def_property(srna, "target_geometry_element", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, target_geometry_element); + RNA_def_property_enum_default(prop, GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_FACES); + RNA_def_property_ui_text( + prop, "Target Geometry", "Element of the target geometry to calculate the distance from"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); +} + +static void def_geo_volume_to_mesh(StructRNA *srna) +{ + PropertyRNA *prop; + + static EnumPropertyItem resolution_mode_items[] = { + {VOLUME_TO_MESH_RESOLUTION_MODE_GRID, + "GRID", + 0, + "Grid", + "Use resolution of the volume grid"}, + {VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_AMOUNT, + "VOXEL_AMOUNT", + 0, + "Voxel Amount", + "Desired number of voxels along one axis"}, + {VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_SIZE, + "VOXEL_SIZE", + 0, + "Voxel Size", + "Desired voxel side length"}, + {0, NULL, 0, NULL, NULL}, + }; + + RNA_def_struct_sdna_from(srna, "NodeGeometryVolumeToMesh", "storage"); + + prop = RNA_def_property(srna, "resolution_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, resolution_mode_items); + RNA_def_property_ui_text(prop, "Resolution Mode", "How the voxel size is specified"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); +} + /* -------------------------------------------------------------------------- */ static void rna_def_shader_node(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index c418c8eb4dc..bcdc38a1a3b 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1304,11 +1304,13 @@ static void rna_MaterialSlot_link_set(PointerRNA *ptr, int value) if (value) { ob->matbits[index] = 1; - /* ob->colbits |= (1 << index); */ /* DEPRECATED */ + /* DEPRECATED */ + // ob->colbits |= (1 << index); } else { ob->matbits[index] = 0; - /* ob->colbits &= ~(1 << index); */ /* DEPRECATED */ + /* DEPRECATED */ + // ob->colbits &= ~(1 << index); } } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index af31f16f4e0..58a89b7ffdc 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1495,7 +1495,7 @@ static const EnumPropertyItem *rna_ImageFormatSettings_exr_codec_itemf(bContext int i = 1, totitem = 0; if (imf->depth == 16) { - return rna_enum_exr_codec_items; /* All compression types are defined for halfs */ + return rna_enum_exr_codec_items; /* All compression types are defined for half-float. */ } for (i = 0; i < R_IMF_EXR_CODEC_MAX; i++) { @@ -2102,7 +2102,7 @@ static char *rna_TransformOrientationSlot_path(PointerRNA *ptr) } } - /* Should not happen, but in case, just return defqult path. */ + /* Should not happen, but in case, just return default path. */ BLI_assert(0); return BLI_strdup("transform_orientation_slots[0]"); } @@ -7712,7 +7712,7 @@ void RNA_def_scene(BlenderRNA *brna) prop, "Preview Range End Frame", "Alternative end frame for UI playback"); RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL); - /* Subframe for moblur debug. */ + /* Sub-frame for motion-blur debug. */ prop = RNA_def_property(srna, "show_subframe", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_boolean_sdna(prop, NULL, "r.flag", SCER_SHOW_SUBFRAME); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 2cd34d243ec..60456df38d8 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -936,7 +936,7 @@ static void rna_def_gp_paint(BlenderRNA *brna) RNA_def_struct_path_func(srna, "rna_GpPaint_path"); RNA_def_struct_ui_text(srna, "Grease Pencil Paint", ""); - /* Use vertex color (main swith). */ + /* Use vertex color (main switch). */ prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "mode"); RNA_def_property_enum_items(prop, rna_enum_gpencil_paint_mode); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 06757e533a2..e4d2536eb91 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2478,7 +2478,7 @@ static void rna_FileSelectPrams_filter_glob_set(PointerRNA *ptr, const char *val BLI_strncpy(params->filter_glob, value, sizeof(params->filter_glob)); - /* Remove stupi things like last group being a wildcard-only one... */ + /* Remove stupid things like last group being a wildcard-only one. */ BLI_path_extension_glob_validate(params->filter_glob); } @@ -4658,7 +4658,7 @@ static void rna_def_space_view3d(BlenderRNA *brna) } } - /* Heper for drawing the icon. */ + /* Helper for drawing the icon. */ prop = RNA_def_property(srna, "icon_from_show_object_viewport", PROP_INT, PROP_NONE); RNA_def_property_int_funcs( prop, "rna_SpaceView3D_icon_from_show_object_viewport_get", NULL, NULL); @@ -5702,13 +5702,13 @@ static void rna_def_space_graph(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL); - /* dopesheet */ + /* Dope-sheet. */ prop = RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "DopeSheet"); RNA_def_property_pointer_sdna(prop, NULL, "ads"); RNA_def_property_ui_text(prop, "Dope Sheet", "Settings for filtering animation data"); - /* autosnap */ + /* Auto-snap. */ prop = RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "autosnap"); RNA_def_property_enum_items(prop, autosnap_items); @@ -5716,14 +5716,14 @@ static void rna_def_space_graph(BlenderRNA *brna) prop, "Auto Snap", "Automatic time snapping settings for transformations"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL); - /* readonly state info */ + /* Read-only state info. */ prop = RNA_def_property(srna, "has_ghost_curves", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_SpaceGraphEditor_has_ghost_curves_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text( prop, "Has Ghost Curves", "Graph Editor instance has some ghost curves stored"); - /* nromalize curves */ + /* Normalize curves. */ prop = RNA_def_property(srna, "use_normalization", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_NORMALIZE); RNA_def_property_ui_text(prop, diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index cfcd9aff759..1d3a7750c39 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -649,7 +649,7 @@ static StructRNA *rna_UIList_register(Main *bmain, uiList dummyuilist = {NULL}; PointerRNA dummyul_ptr; int have_function[3]; - size_t over_alloc = 0; /* warning, if this becomes a bess, we better do another alloc */ + size_t over_alloc = 0; /* Warning, if this becomes a mess, we better do another allocation. */ /* setup dummy menu & menu type to store static properties in */ dummyuilist.type = &dummyult; @@ -669,7 +669,7 @@ static StructRNA *rna_UIList_register(Main *bmain, return NULL; } - /* check if we have registered this uilist type before, and remove it */ + /* Check if we have registered this UI-list type before, and remove it. */ ult = WM_uilisttype_find(dummyult.idname, true); if (ult && ult->rna_ext.srna) { rna_UIList_unregister(bmain, ult->rna_ext.srna); @@ -904,7 +904,7 @@ static StructRNA *rna_Menu_register(Main *bmain, Menu dummymenu = {NULL}; PointerRNA dummymtr; int have_function[2]; - size_t over_alloc = 0; /* warning, if this becomes a bess, we better do another alloc */ + size_t over_alloc = 0; /* Warning, if this becomes a mess, we better do another allocation. */ size_t description_size = 0; char _menu_descr[RNA_DYN_DESCR_MAX]; diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 447f5b4210b..f128719db19 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -595,7 +595,7 @@ static const char *rna_ui_get_enum_name(bContext *C, const char *identifier) { PropertyRNA *prop = NULL; - const EnumPropertyItem *items = NULL, *item; + const EnumPropertyItem *items = NULL; bool free; const char *name = ""; @@ -609,11 +609,9 @@ static const char *rna_ui_get_enum_name(bContext *C, RNA_property_enum_items_gettexted(C, ptr, prop, &items, NULL, &free); if (items) { - for (item = items; item->identifier; item++) { - if (item->identifier[0] && STREQ(item->identifier, identifier)) { - name = item->name; - break; - } + const int index = RNA_enum_from_identifier(items, identifier); + if (index != -1) { + name = items[index].name; } if (free) { MEM_freeN((void *)items); @@ -629,7 +627,7 @@ static const char *rna_ui_get_enum_description(bContext *C, const char *identifier) { PropertyRNA *prop = NULL; - const EnumPropertyItem *items = NULL, *item; + const EnumPropertyItem *items = NULL; bool free; const char *desc = ""; @@ -643,11 +641,9 @@ static const char *rna_ui_get_enum_description(bContext *C, RNA_property_enum_items_gettexted(C, ptr, prop, &items, NULL, &free); if (items) { - for (item = items; item->identifier; item++) { - if (item->identifier[0] && STREQ(item->identifier, identifier)) { - desc = item->description; - break; - } + const int index = RNA_enum_from_identifier(items, identifier); + if (index != -1) { + desc = items[index].description; } if (free) { MEM_freeN((void *)items); @@ -663,7 +659,7 @@ static int rna_ui_get_enum_icon(bContext *C, const char *identifier) { PropertyRNA *prop = NULL; - const EnumPropertyItem *items = NULL, *item; + const EnumPropertyItem *items = NULL; bool free; int icon = ICON_NONE; @@ -677,11 +673,9 @@ static int rna_ui_get_enum_icon(bContext *C, RNA_property_enum_items(C, ptr, prop, &items, NULL, &free); if (items) { - for (item = items; item->identifier; item++) { - if (item->identifier[0] && STREQ(item->identifier, identifier)) { - icon = item->icon; - break; - } + const int index = RNA_enum_from_identifier(items, identifier); + if (index != -1) { + icon = items[index].icon; } if (free) { MEM_freeN((void *)items); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 952054a6c53..269a242f074 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -243,7 +243,7 @@ void rna_userdef_is_dirty_update(Main *UNUSED(bmain), rna_userdef_is_dirty_update_impl(); } -/** Take care not to use this if we expet 'is_dirty' to be tagged. */ +/** Take care not to use this if we expect 'is_dirty' to be tagged. */ static void rna_userdef_ui_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) @@ -863,7 +863,7 @@ static StructRNA *rna_AddonPref_register(Main *bmain, PointerRNA dummy_ptr; // int have_function[1]; - /* setup dummy addon-pref & addon-pref type to store static properties in */ + /* Setup dummy add-on preference and it's type to store static properties in. */ RNA_pointer_create(NULL, &RNA_AddonPreferences, &dummy_addon, &dummy_ptr); /* validate the python class */ @@ -881,13 +881,13 @@ static StructRNA *rna_AddonPref_register(Main *bmain, return NULL; } - /* check if we have registered this addon-pref type before, and remove it */ + /* Check if we have registered this add-on preference type before, and remove it. */ apt = BKE_addon_pref_type_find(dummy_addon.module, true); if (apt && apt->rna_ext.srna) { rna_AddonPref_unregister(bmain, apt->rna_ext.srna); } - /* create a new addon-pref type */ + /* Create a new add-on preference type. */ apt = MEM_mallocN(sizeof(bAddonPrefType), "addonpreftype"); memcpy(apt, &dummy_apt, sizeof(dummy_apt)); BKE_addon_pref_type_add(apt); @@ -5654,7 +5654,7 @@ static void rna_def_userdef_input(BlenderRNA *brna) }; static const EnumPropertyItem view_zoom_styles[] = { - {USER_ZOOM_CONT, + {USER_ZOOM_CONTINUE, "CONTINUE", 0, "Continue", diff --git a/source/blender/makesrna/intern/rna_vfont.c b/source/blender/makesrna/intern/rna_vfont.c index a98a52c2252..214a32372dd 100644 --- a/source/blender/makesrna/intern/rna_vfont.c +++ b/source/blender/makesrna/intern/rna_vfont.c @@ -37,7 +37,7 @@ # include "WM_api.h" -/* matching fnction in rna_ID.c */ +/* Matching function in rna_ID.c */ static int rna_VectorFont_filepath_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { VFont *vfont = (VFont *)ptr->owner_id; diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 5541fe3053f..6b96562b3f8 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -162,7 +162,7 @@ static void rna_gizmo_group_type_unlink_delayed(ReportList *reports, const char } } -/* placeholder data for final implementation of a true progressbar */ +/* Placeholder data for final implementation of a true progress-bar. */ static struct wmStaticProgress { float min; float max; diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c index 00d832e2eef..e61482c91e2 100644 --- a/source/blender/makesrna/intern/rna_wm_gizmo.c +++ b/source/blender/makesrna/intern/rna_wm_gizmo.c @@ -260,7 +260,7 @@ static wmGizmo *rna_GizmoProperties_find_operator(PointerRNA *ptr) wmWindowManager *wm = (wmWindowManager *)ptr->owner_id; # endif - /* We could try workaruond this lookup, but not trivial. */ + /* We could try workaround this lookup, but not trivial. */ for (bScreen *screen = G_MAIN->screens.first; screen; screen = screen->id.next) { IDProperty *properties = ptr->data; LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { @@ -1089,7 +1089,7 @@ static void rna_def_gizmo(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_pointer(func, "event", "Event", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); - /* TODO, shuold be a enum-flag */ + /* TODO, should be a enum-flag */ parm = RNA_def_enum_flag(func, "tweak", tweak_actions, 0, "Tweak", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_enum_flag( diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 3a7addcba94..c19782df44b 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -185,7 +185,7 @@ endif() if(WITH_OPENVDB) list(APPEND INC - ../../../intern/openvdb + ../../../intern/openvdb ) list(APPEND INC_SYS ${OPENVDB_INCLUDE_DIRS} diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 412d6b87d82..b48bf722526 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -68,7 +68,8 @@ static void initData(ModifierData *md) MEMCPY_STRUCT_AFTER(amd, DNA_struct_default_get(ArrayModifierData), modifier); - /* Open the first subpanel by default, it corresspnds to Relative offset which is enabled too. */ + /* Open the first sub-panel by default, + * it corresponds to Relative offset which is enabled too. */ md->ui_expand_flag = UI_PANEL_DATA_EXPAND_ROOT | UI_SUBPANEL_DATA_EXPAND_1; } diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 04b68a7a800..e72e0279263 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -222,7 +222,7 @@ static void deformVerts(ModifierData *md, } } - /* happens on file load (ONLY when i decomment changes in readfile.c) */ + /* Happens on file load (ONLY when I un-comment changes in readfile.c) */ if (!collmd->bvhtree) { collmd->bvhtree = bvhtree_build_from_mvert( collmd->current_x, collmd->tri, collmd->tri_num, ob->pd->pdef_sboft); diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c index 15c4e8af6ce..001c7d8d098 100644 --- a/source/blender/modifiers/intern/MOD_correctivesmooth.c +++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c @@ -423,11 +423,11 @@ static void calc_tangent_ortho(float ts[3][3]) cross_v3_v3v3(ts[1], ts[2], v_tan_a); mul_v3_fl(ts[1], dot_v3v3(ts[1], v_tan_b) < 0.0f ? -1.0f : 1.0f); - /* orthognalise tangent */ + /* Orthogonalize tangent. */ mul_v3_v3fl(t_vec_a, ts[2], dot_v3v3(ts[2], v_tan_a)); sub_v3_v3v3(ts[0], v_tan_a, t_vec_a); - /* orthognalise bitangent */ + /* Orthogonalize bi-tangent. */ mul_v3_v3fl(t_vec_a, ts[2], dot_v3v3(ts[2], ts[1])); mul_v3_v3fl(t_vec_b, ts[0], dot_v3v3(ts[0], ts[1]) / dot_v3v3(v_tan_a, v_tan_a)); sub_v3_v3(ts[1], t_vec_a); diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index f967fa5ea2f..23bfe76a5c3 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -518,7 +518,7 @@ class GeometryNodesEvaluator { * TODO(Hans): Codify this with some sort of table or refactor IDProperty use in RNA_access.c. */ struct SocketPropertyType { - /* Create the actual propery used to store the data for the modifier. */ + /* Create the actual property used to store the data for the modifier. */ IDProperty *(*create_prop)(const bNodeSocket &socket, const char *name); /* Reused to build the "soft_min" property too. */ IDProperty *(*create_min_ui_prop)(const bNodeSocket &socket, const char *name); diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index b59907cc1e9..84360caa345 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -778,7 +778,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * * use edge connectivity work this out */ if (SV_IS_VALID(vc->v[0])) { if (SV_IS_VALID(vc->v[1])) { - /* 2 edges connedted */ + /* 2 edges connected. */ /* make 2 connecting vert locations relative to the middle vert */ sub_v3_v3v3(tmp_vec1, mvert_new[vc->v[0]].co, mvert_new[i].co); sub_v3_v3v3(tmp_vec2, mvert_new[vc->v[1]].co, mvert_new[i].co); diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index e41e70864dc..ea31bdc6e31 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -256,7 +256,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, smd->limit[0] = min_ff(smd->limit[0], smd->limit[1]); /* Upper limit >= than lower limit */ - /* Calculate matrixs do convert between coordinate spaces */ + /* Calculate matrix to convert between coordinate spaces. */ if (smd->origin != NULL) { transf = &tmp_transf; BLI_SPACE_TRANSFORM_SETUP(transf, ob, smd->origin); @@ -314,7 +314,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, simpleDeform_callback = simpleDeform_stretch; break; default: - return; /* No simpledeform mode? */ + return; /* No simple-deform mode? */ } if (smd->mode == MOD_SIMPLEDEFORM_MODE_BEND) { diff --git a/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c b/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c index f62980ec4fd..0f8503eddde 100644 --- a/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c +++ b/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c @@ -2434,9 +2434,9 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md, vm[orig_mloop[loopstart + j].v]); BLI_assert(flip || vm[orig_medge[new_edge->old_edge].v1] == vm[orig_mloop[loopstart + j].v]); - /* The vert thats in the current loop. */ + /* The vert that's in the current loop. */ const uint new_v1 = new_edge->link_edge_groups[flip]->new_vert; - /* The vert thats in the next loop. */ + /* The vert that's in the next loop. */ const uint new_v2 = new_edge->link_edge_groups[1 - flip]->new_vert; if (k == 0 || face_verts[k - 1] != new_v1) { face_loops[k] = loopstart + j; diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c index 008e258dc7a..357cfb562a7 100644 --- a/source/blender/modifiers/intern/MOD_surfacedeform.c +++ b/source/blender/modifiers/intern/MOD_surfacedeform.c @@ -104,7 +104,7 @@ typedef struct SDefBindCalcData { * needed once when running bind, so optimizing this structure isn't a priority. */ typedef struct SDefBindPoly { - /** Coordinates copied directly from the modifiers inptut. */ + /** Coordinates copied directly from the modifiers input. */ float (*coords)[3]; /** Coordinates projected into 2D space using `normal`. */ float (*coords_v2)[2]; diff --git a/source/blender/modifiers/intern/MOD_volume_to_mesh.cc b/source/blender/modifiers/intern/MOD_volume_to_mesh.cc index 941bc8409f7..41ed7ae983a 100644 --- a/source/blender/modifiers/intern/MOD_volume_to_mesh.cc +++ b/source/blender/modifiers/intern/MOD_volume_to_mesh.cc @@ -24,6 +24,7 @@ #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_volume.h" +#include "BKE_volume_to_mesh.hh" #include "MOD_modifiertypes.h" #include "MOD_ui_common.h" @@ -128,139 +129,6 @@ static void panelRegister(ARegionType *region_type) modifier_panel_register(region_type, eModifierType_VolumeToMesh, panel_draw); } -#ifdef WITH_OPENVDB - -struct VolumeToMeshOp { - const openvdb::GridBase &base_grid; - VolumeToMeshModifierData &vmmd; - const ModifierEvalContext &ctx; - std::vector verts; - std::vector tris; - std::vector quads; - - template bool operator()() - { - if constexpr (std::is_scalar_v) { - this->generate_mesh_data(); - return true; - } - else { - return false; - } - } - - template void generate_mesh_data() - { - /* Make a new transform from the index space into the mesh object space. */ - openvdb::math::Transform::Ptr transform = this->base_grid.transform().copy(); - transform->postMult(openvdb::Mat4d((float *)vmmd.object->obmat)); - openvdb::Mat4d imat = openvdb::Mat4d((float *)ctx.object->imat); - /* `imat` had floating point issues and wasn't affine. */ - imat.setCol(3, openvdb::Vec4d(0, 0, 0, 1)); - transform->postMult(imat); - - /* Create a new grid with a different transform. The underlying tree is shared. */ - typename GridType::ConstPtr grid = openvdb::gridConstPtrCast( - this->base_grid.copyGridReplacingTransform(transform)); - - if (this->vmmd.resolution_mode == VOLUME_TO_MESH_RESOLUTION_MODE_GRID) { - this->grid_to_mesh(*grid); - return; - } - - const float resolution_factor = this->compute_resolution_factor(*grid); - typename GridType::Ptr temp_grid = this->create_grid_with_changed_resolution( - *grid, resolution_factor); - this->grid_to_mesh(*temp_grid); - } - - template - typename GridType::Ptr create_grid_with_changed_resolution(const GridType &old_grid, - const float resolution_factor) - { - BLI_assert(resolution_factor > 0.0f); - - openvdb::Mat4R xform; - xform.setToScale(openvdb::Vec3d(resolution_factor)); - openvdb::tools::GridTransformer transformer{xform}; - - typename GridType::Ptr new_grid = GridType::create(); - transformer.transformGrid(old_grid, *new_grid); - new_grid->transform() = old_grid.transform(); - new_grid->transform().preScale(1.0f / resolution_factor); - return new_grid; - } - - float compute_resolution_factor(const openvdb::GridBase &grid) const - { - const openvdb::Vec3s voxel_size{grid.voxelSize()}; - const float current_voxel_size = std::max({voxel_size[0], voxel_size[1], voxel_size[2]}); - const float desired_voxel_size = this->compute_desired_voxel_size(grid); - return current_voxel_size / desired_voxel_size; - } - - float compute_desired_voxel_size(const openvdb::GridBase &grid) const - { - if (this->vmmd.resolution_mode == VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_SIZE) { - return this->vmmd.voxel_size; - } - const openvdb::CoordBBox coord_bbox = base_grid.evalActiveVoxelBoundingBox(); - const openvdb::BBoxd bbox = grid.transform().indexToWorld(coord_bbox); - const float max_extent = bbox.extents()[bbox.maxExtent()]; - const float voxel_size = max_extent / this->vmmd.voxel_amount; - return voxel_size; - } - - template void grid_to_mesh(const GridType &grid) - { - openvdb::tools::volumeToMesh( - grid, this->verts, this->tris, this->quads, this->vmmd.threshold, this->vmmd.adaptivity); - } -}; - -static Mesh *new_mesh_from_openvdb_data(Span verts, - Span tris, - Span quads) -{ - const int tot_loops = 3 * tris.size() + 4 * quads.size(); - const int tot_polys = tris.size() + quads.size(); - - Mesh *mesh = BKE_mesh_new_nomain(verts.size(), 0, 0, tot_loops, tot_polys); - - /* Write vertices. */ - for (const int i : verts.index_range()) { - const blender::float3 co = blender::float3(verts[i].asV()); - copy_v3_v3(mesh->mvert[i].co, co); - } - - /* Write triangles. */ - for (const int i : tris.index_range()) { - mesh->mpoly[i].loopstart = 3 * i; - mesh->mpoly[i].totloop = 3; - for (int j = 0; j < 3; j++) { - /* Reverse vertex order to get correct normals. */ - mesh->mloop[3 * i + j].v = tris[i][2 - j]; - } - } - - /* Write quads. */ - const int poly_offset = tris.size(); - const int loop_offset = tris.size() * 3; - for (const int i : quads.index_range()) { - mesh->mpoly[poly_offset + i].loopstart = loop_offset + 4 * i; - mesh->mpoly[poly_offset + i].totloop = 4; - for (int j = 0; j < 4; j++) { - /* Reverse vertex order to get correct normals. */ - mesh->mloop[loop_offset + 4 * i + j].v = quads[i][3 - j]; - } - } - - BKE_mesh_calc_edges(mesh, false, false); - BKE_mesh_calc_normals(mesh); - return mesh; -} -#endif - static Mesh *create_empty_mesh(const Mesh *input_mesh) { Mesh *new_mesh = BKE_mesh_new_nomain(0, 0, 0, 0, 0); @@ -296,16 +164,35 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * return create_empty_mesh(input_mesh); } - const openvdb::GridBase::ConstPtr grid = BKE_volume_grid_openvdb_for_read(volume, volume_grid); + const openvdb::GridBase::ConstPtr local_grid = BKE_volume_grid_openvdb_for_read(volume, + volume_grid); - const VolumeGridType grid_type = BKE_volume_grid_type(volume_grid); - VolumeToMeshOp to_mesh_op{*grid, *vmmd, *ctx}; - if (!BKE_volume_grid_type_operation(grid_type, to_mesh_op)) { - BKE_modifier_set_error(ctx->object, md, "Expected a scalar grid"); + openvdb::math::Transform::Ptr transform = local_grid->transform().copy(); + transform->postMult(openvdb::Mat4d(((float *)vmmd->object->obmat))); + openvdb::Mat4d imat = openvdb::Mat4d((float *)ctx->object->imat); + /* `imat` had floating point issues and wasn't affine. */ + imat.setCol(3, openvdb::Vec4d(0, 0, 0, 1)); + transform->postMult(imat); + + /* Create a temporary transformed grid. The underlying tree is shared. */ + openvdb::GridBase::ConstPtr transformed_grid = local_grid->copyGridReplacingTransform(transform); + + blender::bke::VolumeToMeshResolution resolution; + resolution.mode = (VolumeToMeshResolutionMode)vmmd->resolution_mode; + if (resolution.mode == VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_AMOUNT) { + resolution.settings.voxel_amount = vmmd->voxel_amount; + } + if (resolution.mode == VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_SIZE) { + resolution.settings.voxel_size = vmmd->voxel_size; + } + + Mesh *mesh = blender::bke::volume_to_mesh( + *transformed_grid, resolution, vmmd->threshold, vmmd->adaptivity); + if (mesh == nullptr) { + BKE_modifier_set_error(ctx->object, md, "Could not generate mesh from grid"); return create_empty_mesh(input_mesh); } - Mesh *mesh = new_mesh_from_openvdb_data(to_mesh_op.verts, to_mesh_op.tris, to_mesh_op.quads); BKE_mesh_copy_settings(mesh, input_mesh); if (vmmd->flag & VOLUME_TO_MESH_USE_SMOOTH_SHADE) { BKE_mesh_smooth_flag_set(mesh, true); diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index aedca4b34fb..a209faa5d17 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -147,6 +147,7 @@ set(SRC geometry/nodes/node_geo_attribute_math.cc geometry/nodes/node_geo_attribute_mix.cc geometry/nodes/node_geo_attribute_sample_texture.cc + geometry/nodes/node_geo_attribute_proximity.cc geometry/nodes/node_geo_attribute_randomize.cc geometry/nodes/node_geo_attribute_vector_math.cc geometry/nodes/node_geo_boolean.cc @@ -166,6 +167,7 @@ set(SRC geometry/nodes/node_geo_subdivision_surface.cc geometry/nodes/node_geo_transform.cc geometry/nodes/node_geo_triangulate.cc + geometry/nodes/node_geo_volume_to_mesh.cc geometry/node_geometry_exec.cc geometry/node_geometry_tree.cc geometry/node_geometry_util.cc @@ -351,6 +353,10 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +if(WITH_TBB) + add_definitions(-DWITH_TBB) +endif() + if(WITH_IMAGE_OPENEXR) add_definitions(-DWITH_OPENEXR) endif() diff --git a/source/blender/nodes/NOD_geometry.h b/source/blender/nodes/NOD_geometry.h index 9b391ab7981..d4d137c8fc5 100644 --- a/source/blender/nodes/NOD_geometry.h +++ b/source/blender/nodes/NOD_geometry.h @@ -28,6 +28,7 @@ void register_node_type_geo_group(void); void register_node_type_geo_attribute_fill(void); void register_node_type_geo_attribute_vector_math(void); +void register_node_type_geo_attribute_proximity(void); void register_node_type_geo_boolean(void); void register_node_type_geo_edge_split(void); void register_node_type_geo_transform(void); @@ -51,6 +52,7 @@ void register_node_type_geo_sample_texture(void); void register_node_type_geo_points_to_volume(void); void register_node_type_geo_collection_info(void); void register_node_type_geo_is_viewport(void); +void register_node_type_geo_volume_to_mesh(void); #ifdef __cplusplus } diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h index f9730af0c08..980790af766 100644 --- a/source/blender/nodes/NOD_static_types.h +++ b/source/blender/nodes/NOD_static_types.h @@ -293,6 +293,8 @@ DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_SAMPLE_TEXTURE, def_geo_attribute_sampl DefNode(GeometryNode, GEO_NODE_POINTS_TO_VOLUME, def_geo_points_to_volume, "POINTS_TO_VOLUME", PointsToVolume, "Points to Volume", "") DefNode(GeometryNode, GEO_NODE_COLLECTION_INFO, def_geo_collection_info, "COLLECTION_INFO", CollectionInfo, "Collection Info", "") DefNode(GeometryNode, GEO_NODE_IS_VIEWPORT, 0, "IS_VIEWPORT", IsViewport, "Is Viewport", "") +DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_PROXIMITY, def_geo_attribute_proximity, "ATTRIBUTE_PROXIMITY", AttributeProximity, "Attribute Proximity", "") +DefNode(GeometryNode, GEO_NODE_VOLUME_TO_MESH, def_geo_volume_to_mesh, "VOLUME_TO_MESH", VolumeToMesh, "Volume to Mesh", "") /* undefine macros */ #undef DefNode diff --git a/source/blender/nodes/geometry/nodes/node_geo_align_rotation_to_vector.cc b/source/blender/nodes/geometry/nodes/node_geo_align_rotation_to_vector.cc index eac77b25bd6..bdec3599bfa 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_align_rotation_to_vector.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_align_rotation_to_vector.cc @@ -34,6 +34,84 @@ static bNodeSocketTemplate geo_node_align_rotation_to_vector_out[] = { namespace blender::nodes { +static void align_rotations_auto_pivot(const Float3ReadAttribute &vectors, + const FloatReadAttribute &factors, + const float3 local_main_axis, + MutableSpan rotations) +{ + for (const int i : IndexRange(vectors.size())) { + const float3 vector = vectors[i]; + if (is_zero_v3(vector)) { + continue; + } + + float old_rotation[3][3]; + eul_to_mat3(old_rotation, rotations[i]); + float3 old_axis; + mul_v3_m3v3(old_axis, old_rotation, local_main_axis); + + const float3 new_axis = vector.normalized(); + const float3 rotation_axis = float3::cross_high_precision(old_axis, new_axis); + const float full_angle = angle_normalized_v3v3(old_axis, new_axis); + const float angle = factors[i] * full_angle; + + float rotation[3][3]; + axis_angle_to_mat3(rotation, rotation_axis, angle); + + float new_rotation_matrix[3][3]; + mul_m3_m3m3(new_rotation_matrix, rotation, old_rotation); + + float3 new_rotation; + mat3_to_eul(new_rotation, new_rotation_matrix); + + rotations[i] = new_rotation; + } +} + +static void align_rotations_fixed_pivot(const Float3ReadAttribute &vectors, + const FloatReadAttribute &factors, + const float3 local_main_axis, + const float3 local_pivot_axis, + MutableSpan rotations) +{ + if (local_main_axis == local_pivot_axis) { + /* Can't compute any meaningful rotation angle in this case. */ + return; + } + + for (const int i : IndexRange(vectors.size())) { + const float3 vector = vectors[i]; + if (is_zero_v3(vector)) { + continue; + } + + float old_rotation[3][3]; + eul_to_mat3(old_rotation, rotations[i]); + float3 old_axis; + mul_v3_m3v3(old_axis, old_rotation, local_main_axis); + float3 pivot_axis; + mul_v3_m3v3(pivot_axis, old_rotation, local_pivot_axis); + + float full_angle = angle_signed_on_axis_v3v3_v3(vector, old_axis, pivot_axis); + if (full_angle > M_PI) { + /* Make sure the point is rotated as little as possible. */ + full_angle -= 2.0f * M_PI; + } + const float angle = factors[i] * full_angle; + + float rotation[3][3]; + axis_angle_to_mat3(rotation, pivot_axis, angle); + + float new_rotation_matrix[3][3]; + mul_m3_m3m3(new_rotation_matrix, rotation, old_rotation); + + float3 new_rotation; + mat3_to_eul(new_rotation, new_rotation_matrix); + + rotations[i] = new_rotation; + } +} + static void align_rotations_on_component(GeometryComponent &component, const GeoNodeExecParams ¶ms) { @@ -53,36 +131,15 @@ static void align_rotations_on_component(GeometryComponent &component, Float3ReadAttribute vectors = params.get_input_attribute( "Vector", component, ATTR_DOMAIN_POINT, {0, 0, 1}); - float3 main_axis{0, 0, 0}; - main_axis[storage.axis] = 1; - - const int domain_size = component.attribute_domain_size(ATTR_DOMAIN_POINT); - for (const int i : IndexRange(domain_size)) { - const float3 vector = vectors[i]; - if (is_zero_v3(vector)) { - continue; - } - - float old_rotation[3][3]; - eul_to_mat3(old_rotation, rotations[i]); - float3 old_axis; - mul_v3_m3v3(old_axis, old_rotation, main_axis); - - const float3 new_axis = vector.normalized(); - const float3 rotation_axis = float3::cross_high_precision(old_axis, new_axis); - const float full_angle = angle_normalized_v3v3(old_axis, new_axis); - const float angle = factors[i] * full_angle; - - float rotation[3][3]; - axis_angle_to_mat3(rotation, rotation_axis, angle); - - float new_rotation_matrix[3][3]; - mul_m3_m3m3(new_rotation_matrix, rotation, old_rotation); - - float3 new_rotation; - mat3_to_eul(new_rotation, new_rotation_matrix); - - rotations[i] = new_rotation; + float3 local_main_axis{0, 0, 0}; + local_main_axis[storage.axis] = 1; + if (storage.pivot_axis == GEO_NODE_ALIGN_ROTATION_TO_VECTOR_PIVOT_AXIS_AUTO) { + align_rotations_auto_pivot(vectors, factors, local_main_axis, rotations); + } + else { + float3 local_pivot_axis{0, 0, 0}; + local_pivot_axis[storage.pivot_axis - 1] = 1; + align_rotations_fixed_pivot(vectors, factors, local_main_axis, local_pivot_axis, rotations); } rotation_attribute.apply_span_and_save(); diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_proximity.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_proximity.cc new file mode 100644 index 00000000000..14b1c4e3a59 --- /dev/null +++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_proximity.cc @@ -0,0 +1,224 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "BLI_kdtree.h" +#include "BLI_task.hh" + +#include "BKE_bvhutils.h" +#include "BLI_kdopbvh.h" + +#include "node_geometry_util.hh" + +#include "BLI_timeit.hh" +#include "DNA_mesh_types.h" + +static bNodeSocketTemplate geo_node_attribute_proximity_in[] = { + {SOCK_GEOMETRY, N_("Geometry")}, + {SOCK_GEOMETRY, N_("Target")}, + {SOCK_STRING, N_("Result")}, + {-1, ""}, +}; + +static bNodeSocketTemplate geo_node_attribute_proximity_out[] = { + {SOCK_GEOMETRY, N_("Geometry")}, + {-1, ""}, +}; + +static void geo_attribute_proximity_init(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeGeometryAttributeProximity *node_storage = (NodeGeometryAttributeProximity *)MEM_callocN( + sizeof(NodeGeometryAttributeProximity), __func__); + + node_storage->target_geometry_element = + GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_FACES; + node->storage = node_storage; +} + +namespace blender::nodes { + +static void proximity_calc(MutableSpan distance_span, + Span positions, + BVHTreeFromMesh &tree_data_mesh, + BVHTreeFromPointCloud &tree_data_pointcloud, + const bool bvh_mesh_success, + const bool bvh_pointcloud_success) +{ + + IndexRange range = positions.index_range(); + parallel_for(range, 512, [&](IndexRange range) { + BVHTreeNearest nearest; + + if (bvh_mesh_success) { + copy_v3_fl(nearest.co, FLT_MAX); + nearest.index = -1; + + for (int i : range) { + nearest.dist_sq = len_squared_v3v3(nearest.co, positions[i]); + BLI_bvhtree_find_nearest(tree_data_mesh.tree, + positions[i], + &nearest, + tree_data_mesh.nearest_callback, + &tree_data_mesh); + distance_span[i] = sqrtf(nearest.dist_sq); + } + } + + /* The next loop(s) use the values already in the span. */ + if (!bvh_mesh_success) { + distance_span.fill(FLT_MAX); + } + + if (bvh_pointcloud_success) { + copy_v3_fl(nearest.co, FLT_MAX); + nearest.index = -1; + + for (int i : range) { + /* Use the distance to the last found point as upper bound to speedup the bvh lookup. */ + nearest.dist_sq = len_squared_v3v3(nearest.co, positions[i]); + BLI_bvhtree_find_nearest(tree_data_pointcloud.tree, + positions[i], + &nearest, + tree_data_pointcloud.nearest_callback, + &tree_data_pointcloud); + distance_span[i] = std::min(distance_span[i], sqrtf(nearest.dist_sq)); + } + } + }); +} + +static bool bvh_from_mesh(const Mesh *target_mesh, + int target_geometry_element, + BVHTreeFromMesh &r_tree_data_mesh) +{ + BVHCacheType bvh_type = BVHTREE_FROM_LOOPTRI; + switch (target_geometry_element) { + case GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_POINTS: + bvh_type = BVHTREE_FROM_VERTS; + break; + case GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_EDGES: + bvh_type = BVHTREE_FROM_EDGES; + break; + case GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_FACES: + bvh_type = BVHTREE_FROM_LOOPTRI; + break; + } + + /* This only updates a cache and can be considered to be logically const. */ + BKE_bvhtree_from_mesh_get(&r_tree_data_mesh, const_cast(target_mesh), bvh_type, 2); + if (r_tree_data_mesh.tree == nullptr) { + return false; + } + return true; +} + +static bool bvh_from_pointcloud(const PointCloud *target_pointcloud, + BVHTreeFromPointCloud &r_tree_data_pointcloud) +{ + BKE_bvhtree_from_pointcloud_get(&r_tree_data_pointcloud, target_pointcloud, 2); + if (r_tree_data_pointcloud.tree == nullptr) { + return false; + } + return true; +} + +static void attribute_calc_proximity(GeometryComponent &component, + GeometrySet &geometry_set_target, + GeoNodeExecParams ¶ms) +{ + const std::string result_attribute_name = params.get_input("Result"); + OutputAttributePtr distance_attribute = component.attribute_try_get_for_output( + result_attribute_name, ATTR_DOMAIN_POINT, CD_PROP_FLOAT); + + ReadAttributePtr position_attribute = component.attribute_try_get_for_read("position"); + BLI_assert(position_attribute->custom_data_type() == CD_PROP_FLOAT3); + + if (!distance_attribute || !position_attribute) { + return; + } + + const bNode &node = params.node(); + const NodeGeometryAttributeProximity &storage = *(const NodeGeometryAttributeProximity *) + node.storage; + + BVHTreeFromMesh tree_data_mesh; + BVHTreeFromPointCloud tree_data_pointcloud; + bool bvh_mesh_success = false; + bool bvh_pointcloud_success = false; + + if (geometry_set_target.has_mesh()) { + bvh_mesh_success = bvh_from_mesh( + geometry_set_target.get_mesh_for_read(), storage.target_geometry_element, tree_data_mesh); + } + + if (geometry_set_target.has_pointcloud() && + storage.target_geometry_element == + GEO_NODE_ATTRIBUTE_PROXIMITY_TARGET_GEOMETRY_ELEMENT_POINTS) { + bvh_pointcloud_success = bvh_from_pointcloud(geometry_set_target.get_pointcloud_for_read(), + tree_data_pointcloud); + } + + proximity_calc(distance_attribute->get_span_for_write_only(), + position_attribute->get_span(), + tree_data_mesh, + tree_data_pointcloud, + bvh_mesh_success, + bvh_pointcloud_success); + + if (bvh_mesh_success) { + free_bvhtree_from_mesh(&tree_data_mesh); + } + if (bvh_pointcloud_success) { + free_bvhtree_from_pointcloud(&tree_data_pointcloud); + } + + distance_attribute.apply_span_and_save(); +} + +static void geo_node_attribute_proximity_exec(GeoNodeExecParams params) +{ + GeometrySet geometry_set = params.extract_input("Geometry"); + GeometrySet geometry_set_target = params.extract_input("Target"); + + if (geometry_set.has()) { + attribute_calc_proximity( + geometry_set.get_component_for_write(), geometry_set_target, params); + } + if (geometry_set.has()) { + attribute_calc_proximity( + geometry_set.get_component_for_write(), geometry_set_target, params); + } + + params.set_output("Geometry", geometry_set); +} + +} // namespace blender::nodes + +void register_node_type_geo_attribute_proximity() +{ + static bNodeType ntype; + + geo_node_type_base( + &ntype, GEO_NODE_ATTRIBUTE_PROXIMITY, "Attribute Proximity", NODE_CLASS_ATTRIBUTE, 0); + node_type_socket_templates( + &ntype, geo_node_attribute_proximity_in, geo_node_attribute_proximity_out); + node_type_init(&ntype, geo_attribute_proximity_init); + node_type_storage(&ntype, + "NodeGeometryAttributeProximity", + node_free_standard_storage, + node_copy_standard_storage); + ntype.geometry_node_execute = blender::nodes::geo_node_attribute_proximity_exec; + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc new file mode 100644 index 00000000000..b1d1430bccd --- /dev/null +++ b/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc @@ -0,0 +1,160 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "DEG_depsgraph_query.h" +#ifdef WITH_OPENVDB +# include +# include +#endif + +#include "node_geometry_util.hh" + +#include "BKE_lib_id.h" +#include "BKE_mesh.h" +#include "BKE_mesh_runtime.h" +#include "BKE_volume.h" +#include "BKE_volume_to_mesh.hh" + +#include "DNA_mesh_types.h" +#include "DNA_meshdata_types.h" + +static bNodeSocketTemplate geo_node_volume_to_mesh_in[] = { + {SOCK_GEOMETRY, N_("Geometry")}, + {SOCK_STRING, N_("Grid")}, + {SOCK_FLOAT, N_("Voxel Size"), 0.3f, 0.0f, 0.0f, 0.0f, 0.01f, FLT_MAX}, + {SOCK_FLOAT, N_("Voxel Amount"), 64.0f, 0.0f, 0.0f, 0.0f, 0.0f, FLT_MAX}, + {SOCK_FLOAT, N_("Threshold"), 0.1f, 0.0f, 0.0f, 0.0f, 0.0f, FLT_MAX}, + {SOCK_FLOAT, N_("Adaptivity"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + {-1, ""}, +}; + +static bNodeSocketTemplate geo_node_volume_to_mesh_out[] = { + {SOCK_GEOMETRY, N_("Geometry")}, + {-1, ""}, +}; + +namespace blender::nodes { + +static void geo_node_volume_to_mesh_init(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeGeometryVolumeToMesh *data = (NodeGeometryVolumeToMesh *)MEM_callocN( + sizeof(NodeGeometryVolumeToMesh), __func__); + data->resolution_mode = VOLUME_TO_MESH_RESOLUTION_MODE_GRID; + + bNodeSocket *grid_socket = nodeFindSocket(node, SOCK_IN, "Grid"); + bNodeSocketValueString *grid_socket_value = (bNodeSocketValueString *)grid_socket->default_value; + STRNCPY(grid_socket_value->value, "density"); + + node->storage = data; +} + +static void geo_node_volume_to_mesh_update(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeGeometryVolumeToMesh *data = (NodeGeometryVolumeToMesh *)node->storage; + + bNodeSocket *voxel_size_socket = nodeFindSocket(node, SOCK_IN, "Voxel Size"); + bNodeSocket *voxel_amount_socket = nodeFindSocket(node, SOCK_IN, "Voxel Amount"); + nodeSetSocketAvailability(voxel_amount_socket, + data->resolution_mode == VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_AMOUNT); + nodeSetSocketAvailability(voxel_size_socket, + data->resolution_mode == VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_SIZE); +} + +#ifdef WITH_OPENVDB + +static void create_mesh_from_volume(GeometrySet &geometry_set_in, + GeometrySet &geometry_set_out, + GeoNodeExecParams ¶ms) +{ + if (!geometry_set_in.has()) { + return; + } + + const NodeGeometryVolumeToMesh &storage = + *(const NodeGeometryVolumeToMesh *)params.node().storage; + + bke::VolumeToMeshResolution resolution; + resolution.mode = (VolumeToMeshResolutionMode)storage.resolution_mode; + if (resolution.mode == VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_AMOUNT) { + resolution.settings.voxel_amount = params.get_input("Voxel Amount"); + if (resolution.settings.voxel_amount <= 0.0f) { + return; + } + } + else if (resolution.mode == VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_SIZE) { + resolution.settings.voxel_size = params.get_input("Voxel Size"); + if (resolution.settings.voxel_size <= 0.0f) { + return; + } + } + + const VolumeComponent *component = geometry_set_in.get_component_for_read(); + const Volume *volume = component->get_for_read(); + if (volume == nullptr) { + return; + } + + Main *bmain = DEG_get_bmain(params.depsgraph()); + BKE_volume_load(const_cast(volume), bmain); + + const std::string grid_name = params.get_input("Grid"); + VolumeGrid *volume_grid = BKE_volume_grid_find(volume, grid_name.c_str()); + if (volume_grid == nullptr) { + return; + } + + float threshold = params.get_input("Threshold"); + float adaptivity = params.get_input("Adaptivity"); + + const openvdb::GridBase::ConstPtr grid = BKE_volume_grid_openvdb_for_read(volume, volume_grid); + Mesh *mesh = bke::volume_to_mesh(*grid, resolution, threshold, adaptivity); + if (mesh == nullptr) { + return; + } + MeshComponent &dst_component = geometry_set_out.get_component_for_write(); + dst_component.replace(mesh); +} + +#endif /* WITH_OPENVDB */ + +static void geo_node_volume_to_mesh_exec(GeoNodeExecParams params) +{ + GeometrySet geometry_set_in = params.extract_input("Geometry"); + GeometrySet geometry_set_out; + +#ifdef WITH_OPENVDB + create_mesh_from_volume(geometry_set_in, geometry_set_out, params); +#endif + + params.set_output("Geometry", geometry_set_out); +} + +} // namespace blender::nodes + +void register_node_type_geo_volume_to_mesh() +{ + static bNodeType ntype; + + geo_node_type_base(&ntype, GEO_NODE_VOLUME_TO_MESH, "Volume to Mesh", NODE_CLASS_GEOMETRY, 0); + node_type_socket_templates(&ntype, geo_node_volume_to_mesh_in, geo_node_volume_to_mesh_out); + node_type_storage( + &ntype, "NodeGeometryVolumeToMesh", node_free_standard_storage, node_copy_standard_storage); + node_type_size(&ntype, 200, 120, 700); + node_type_init(&ntype, blender::nodes::geo_node_volume_to_mesh_init); + node_type_update(&ntype, blender::nodes::geo_node_volume_to_mesh_update); + ntype.geometry_node_execute = blender::nodes::geo_node_volume_to_mesh_exec; + nodeRegisterType(&ntype); +} diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index d944cb435d0..ec6b8c54ac0 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -865,11 +865,11 @@ bool PyC_NameSpace_ImportArray(PyObject *py_dict, const char *imports[]) } /* restore MUST be called after this */ -void PyC_MainModule_Backup(PyObject **main_mod) +void PyC_MainModule_Backup(PyObject **r_main_mod) { PyObject *modules = PyImport_GetModuleDict(); - *main_mod = PyDict_GetItemString(modules, "__main__"); - Py_XINCREF(*main_mod); /* don't free */ + *r_main_mod = PyDict_GetItemString(modules, "__main__"); + Py_XINCREF(*r_main_mod); /* don't free */ } void PyC_MainModule_Restore(PyObject *main_mod) diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h index f0875b82c3c..358123657c7 100644 --- a/source/blender/python/generic/py_capi_utils.h +++ b/source/blender/python/generic/py_capi_utils.h @@ -85,7 +85,7 @@ PyObject *PyC_DefaultNameSpace(const char *filename); void PyC_RunQuicky(const char *filepath, int n, ...); bool PyC_NameSpace_ImportArray(PyObject *py_dict, const char *imports[]); -void PyC_MainModule_Backup(PyObject **main_mod); +void PyC_MainModule_Backup(PyObject **r_main_mod); void PyC_MainModule_Restore(PyObject *main_mod); void PyC_SetHomePath(const char *py_path_bundle); diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index 1e81621246e..8ecee9b3f2e 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -286,7 +286,7 @@ void BPY_app_handlers_reset(const short do_all) } else { /* remove */ - /* PySequence_DelItem(ls, i); */ /* more obvious buw slower */ + /* PySequence_DelItem(ls, i); */ /* more obvious but slower */ PyList_SetSlice(ls, i, i + 1, NULL); } } diff --git a/source/blender/python/intern/bpy_interface_atexit.c b/source/blender/python/intern/bpy_interface_atexit.c index 8e5a6dc530b..03d51b2fd59 100644 --- a/source/blender/python/intern/bpy_interface_atexit.c +++ b/source/blender/python/intern/bpy_interface_atexit.c @@ -42,7 +42,7 @@ static PyObject *bpy_atexit(PyObject *UNUSED(self), PyObject *UNUSED(args), PyOb } static PyMethodDef meth_bpy_atexit = {"bpy_atexit", (PyCFunction)bpy_atexit, METH_NOARGS, NULL}; -static PyObject *func_bpy_atregister = NULL; /* borrowed referebce, atexit holds */ +static PyObject *func_bpy_atregister = NULL; /* borrowed reference, `atexit` holds. */ static void atexit_func_call(const char *func_name, PyObject *atexit_func_arg) { diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 2242cecab20..39ba8448795 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -605,7 +605,7 @@ static short pyrna_rotation_euler_order_get(PointerRNA *ptr, if (*r_prop_eul_order) { const short order = RNA_property_enum_get(ptr, *r_prop_eul_order); - /* Could be quat or axisangle. */ + /* Could be quaternion or axis-angle. */ if (order >= EULER_ORDER_XYZ && order <= EULER_ORDER_ZYX) { return order; } @@ -5051,7 +5051,7 @@ static PyObject *pyrna_prop_collection_find(BPy_PropertyRNA *self, PyObject *key { Py_ssize_t key_len_ssize_t; const char *key = _PyUnicode_AsStringAndSize(key_ob, &key_len_ssize_t); - const int key_len = (int)key_len_ssize_t; /* Comare with same type. */ + const int key_len = (int)key_len_ssize_t; /* Compare with same type. */ char name[256], *nameptr; int namelen; @@ -5094,7 +5094,7 @@ static bool foreach_attr_type(BPy_PropertyRNA *self, *r_attr_tot = 0; *r_attr_signed = false; - /* Note: this is fail with zero length lists, so don't let this get caled in that case. */ + /* NOTE: this is fail with zero length lists, so don't let this get called in that case. */ RNA_PROP_BEGIN (&self->ptr, itemptr, self->prop) { prop = RNA_struct_find_property(&itemptr, attr); if (prop) { diff --git a/source/blender/render/RE_multires_bake.h b/source/blender/render/RE_multires_bake.h index fd200e85719..42ee2c57fbb 100644 --- a/source/blender/render/RE_multires_bake.h +++ b/source/blender/render/RE_multires_bake.h @@ -53,7 +53,7 @@ typedef struct MultiresBakeRender { int baked_objects, baked_faces; int raytrace_structure; /* Optimization structure to be used for AO baking */ - int octree_resolution; /* Reslution of octotree when using octotree optimization structure */ + int octree_resolution; /* Resolution of octree when using octree optimization structure */ int threads; /* Number of threads to be used for baking */ float user_scale; /* User scale used to scale displacement when baking derivative map. */ diff --git a/source/blender/render/RE_pipeline.h b/source/blender/render/RE_pipeline.h index c0b87f4246a..688709d55f3 100644 --- a/source/blender/render/RE_pipeline.h +++ b/source/blender/render/RE_pipeline.h @@ -256,7 +256,7 @@ void RE_SetCamera(struct Render *re, struct Object *cam_ob); /* get current view and window transform */ void RE_GetViewPlane(struct Render *re, rctf *r_viewplane, rcti *r_disprect); -/* set the render threads based on the command-line and autothreads setting */ +/* Set the render threads based on the command-line and auto-threads setting. */ void RE_init_threadcount(Render *re); bool RE_WriteRenderViewsImage(struct ReportList *reports, diff --git a/source/blender/render/intern/initrender.c b/source/blender/render/intern/initrender.c index 80f6badb924..3494aa06833 100644 --- a/source/blender/render/intern/initrender.c +++ b/source/blender/render/intern/initrender.c @@ -177,8 +177,11 @@ void RE_SetOverrideCamera(Render *re, Object *cam_ob) re->camera_override = cam_ob; } -/* call this after InitState() */ -/* per render, there's one persistent viewplane. Parts will set their own viewplanes */ +/** + * Per render, there's one persistent view-plane. Parts will set their own view-planes. + * + * \note call this after #RE_InitState(). + */ void RE_SetCamera(Render *re, Object *cam_ob) { CameraParams params; diff --git a/source/blender/render/intern/pipeline.c b/source/blender/render/intern/pipeline.c index d9515bca2d5..6e15066575c 100644 --- a/source/blender/render/intern/pipeline.c +++ b/source/blender/render/intern/pipeline.c @@ -2337,7 +2337,7 @@ static int do_write_image_or_movie(Render *re, printf(" (Saving: %s)\n", name); fputc('\n', stdout); - fflush(stdout); /* needed for renderd !! (not anymore... (ton)) */ + fflush(stdout); return ok; } @@ -2737,7 +2737,7 @@ void RE_init_threadcount(Render *re) void RE_layer_load_from_file( RenderLayer *layer, ReportList *reports, const char *filename, int x, int y) { - /* OCIO_TODO: assume layer was saved in defaule color space */ + /* OCIO_TODO: assume layer was saved in default color space */ ImBuf *ibuf = IMB_loadiffname(filename, IB_rect, NULL); RenderPass *rpass = NULL; diff --git a/source/blender/render/intern/render_result.c b/source/blender/render/intern/render_result.c index f135adc9f05..f73a200f3c6 100644 --- a/source/blender/render/intern/render_result.c +++ b/source/blender/render/intern/render_result.c @@ -443,7 +443,7 @@ RenderResult *render_result_new( } FOREACH_VIEW_LAYER_TO_RENDER_END; - /* previewrender doesn't do layers, so we make a default one */ + /* Preview-render doesn't do layers, so we make a default one. */ if (BLI_listbase_is_empty(&rr->layers) && !(layername && layername[0])) { rl = MEM_callocN(sizeof(RenderLayer), "new render layer"); BLI_addtail(&rr->layers, rl); diff --git a/source/blender/render/intern/render_types.h b/source/blender/render/intern/render_types.h index 6be5fb4792c..7a4374dcf7c 100644 --- a/source/blender/render/intern/render_types.h +++ b/source/blender/render/intern/render_types.h @@ -103,7 +103,7 @@ struct Render { /* Camera transform, only used by Freestyle. */ float winmat[4][4]; - /* clippping */ + /* Clipping. */ float clip_start; float clip_end; diff --git a/source/blender/render/intern/texture_procedural.c b/source/blender/render/intern/texture_procedural.c index a98f29a705d..b0ab20de10d 100644 --- a/source/blender/render/intern/texture_procedural.c +++ b/source/blender/render/intern/texture_procedural.c @@ -77,7 +77,7 @@ void RE_texture_rng_exit(void) /* ------------------------------------------------------------------------- */ -/* this allows colorbanded textures to control normals as well */ +/* This allows color-banded textures to control normals as well. */ static void tex_normal_derivate(const Tex *tex, TexResult *texres) { if (tex->flag & TEX_COLORBAND) { @@ -167,7 +167,7 @@ static int blend(const Tex *tex, const float texvec[3], TexResult *texres) /* ------------------------------------------------------------------------- */ /* ************************************************************************* */ -/* newnoise: all noisebased types now have different noisebases to choose from */ +/* newnoise: all noise-based types now have different noise-bases to choose from. */ static int clouds(const Tex *tex, const float texvec[3], TexResult *texres) { @@ -1059,7 +1059,7 @@ static void do_2d_mapping( dyt[2] *= 0.5f; } - /* if area, then reacalculate dxt[] and dyt[] */ + /* If area, then recalculate `dxt[]` and `dyt[]` */ if (areaflag) { fx = area[0]; fy = area[1]; diff --git a/source/blender/render/intern/zbuf.c b/source/blender/render/intern/zbuf.c index d74ab330dc2..33af3bbaf29 100644 --- a/source/blender/render/intern/zbuf.c +++ b/source/blender/render/intern/zbuf.c @@ -166,7 +166,7 @@ static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2]) } for (y = my2; y >= my0; y--, xs0 += dx0) { - /* xs0 is the xcoord! */ + /* xs0 is the X-coordinate! */ span[y] = xs0; } } diff --git a/source/blender/sequencer/SEQ_select.h b/source/blender/sequencer/SEQ_select.h index 5a65f9c0d8c..abd56ef3af7 100644 --- a/source/blender/sequencer/SEQ_select.h +++ b/source/blender/sequencer/SEQ_select.h @@ -32,8 +32,8 @@ struct Sequence; struct Sequence *SEQ_select_active_get(struct Scene *scene); int SEQ_select_active_get_pair(struct Scene *scene, - struct Sequence **seq_act, - struct Sequence **seq_other); + struct Sequence **r_seq_act, + struct Sequence **r_seq_other); void SEQ_select_active_set(struct Scene *scene, struct Sequence *seq); #ifdef __cplusplus diff --git a/source/blender/sequencer/intern/iterator.c b/source/blender/sequencer/intern/iterator.c index bb4982d1468..f99667dea04 100644 --- a/source/blender/sequencer/intern/iterator.c +++ b/source/blender/sequencer/intern/iterator.c @@ -75,31 +75,31 @@ static void seq_build_array(ListBase *seqbase, Sequence ***array, int depth) } static void seq_array(Editing *ed, - Sequence ***seqarray, - int *tot, - const bool use_current_sequences) + const bool use_current_sequences, + Sequence ***r_seqarray, + int *r_seqarray_len) { Sequence **array; - *seqarray = NULL; - *tot = 0; + *r_seqarray = NULL; + *r_seqarray_len = 0; if (ed == NULL) { return; } if (use_current_sequences) { - seq_count(ed->seqbasep, tot); + seq_count(ed->seqbasep, r_seqarray_len); } else { - seq_count(&ed->seqbase, tot); + seq_count(&ed->seqbase, r_seqarray_len); } - if (*tot == 0) { + if (*r_seqarray_len == 0) { return; } - *seqarray = array = MEM_mallocN(sizeof(Sequence *) * (*tot), "SeqArray"); + *r_seqarray = array = MEM_mallocN(sizeof(Sequence *) * (*r_seqarray_len), "SeqArray"); if (use_current_sequences) { seq_build_array(ed->seqbasep, &array, 0); } @@ -111,7 +111,7 @@ static void seq_array(Editing *ed, void SEQ_iterator_begin(Editing *ed, SeqIterator *iter, const bool use_current_sequences) { memset(iter, 0, sizeof(*iter)); - seq_array(ed, &iter->array, &iter->tot, use_current_sequences); + seq_array(ed, use_current_sequences, &iter->array, &iter->tot); if (iter->tot) { iter->cur = 0; diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c index b564ecd3f36..e9de73bc093 100644 --- a/source/blender/sequencer/intern/render.c +++ b/source/blender/sequencer/intern/render.c @@ -599,10 +599,12 @@ static void multibuf(ImBuf *ibuf, const float fmul) } } -/* Effect, mask and scene in strip input strips are rendered in preview resolution. They are - * already downscaled. input_preprocess() does not expect this to happen. Other strip types are - * rendered with original media resolution, unless proxies are enabled for them. With proxies - * is_proxy_image will be set correctly to true.*/ +/** + * Effect, mask and scene in strip input strips are rendered in preview resolution. + * They are already down-scaled. #input_preprocess() does not expect this to happen. + * Other strip types are rendered with original media resolution, unless proxies are + * enabled for them. With proxies `is_proxy_image` will be set correctly to true. + */ static bool seq_need_scale_to_render_size(const Sequence *seq, bool is_proxy_image) { if (is_proxy_image) { diff --git a/source/blender/sequencer/intern/strip_select.c b/source/blender/sequencer/intern/strip_select.c index 58ae281ead1..7cdd756e2d9 100644 --- a/source/blender/sequencer/intern/strip_select.c +++ b/source/blender/sequencer/intern/strip_select.c @@ -54,29 +54,29 @@ void SEQ_select_active_set(Scene *scene, Sequence *seq) ed->act_seq = seq; } -int SEQ_select_active_get_pair(Scene *scene, Sequence **seq_act, Sequence **seq_other) +int SEQ_select_active_get_pair(Scene *scene, Sequence **r_seq_act, Sequence **r_seq_other) { Editing *ed = SEQ_editing_get(scene, false); - *seq_act = SEQ_select_active_get(scene); + *r_seq_act = SEQ_select_active_get(scene); - if (*seq_act == NULL) { + if (*r_seq_act == NULL) { return 0; } Sequence *seq; - *seq_other = NULL; + *r_seq_other = NULL; for (seq = ed->seqbasep->first; seq; seq = seq->next) { - if (seq->flag & SELECT && (seq != (*seq_act))) { - if (*seq_other) { + if (seq->flag & SELECT && (seq != (*r_seq_act))) { + if (*r_seq_other) { return 0; } - *seq_other = seq; + *r_seq_other = seq; } } - return (*seq_other != NULL); + return (*r_seq_other != NULL); } diff --git a/source/blender/simulation/intern/implicit_blender.c b/source/blender/simulation/intern/implicit_blender.c index 4c4d3e8a821..cf092d7716a 100644 --- a/source/blender/simulation/intern/implicit_blender.c +++ b/source/blender/simulation/intern/implicit_blender.c @@ -1693,7 +1693,7 @@ BLI_INLINE void dfdx_damp(float to[3][3], BLI_INLINE void dfdv_damp(float to[3][3], const float dir[3], float damping) { - /* derivative of force wrt velocity */ + /* Derivative of force with regards to velocity. */ outerproduct(to, dir, dir); mul_m3_fl(to, -damping); } @@ -1727,7 +1727,7 @@ BLI_INLINE float fbstar(float length, float L, float kb, float cb) return tempfb_fl; } -/* function to calculae bending spring force (taken from Choi & Co) */ +/* Function to calculate bending spring force (taken from Choi & Co). */ BLI_INLINE float fbstar_jacobi(float length, float L, float kb, float cb) { float tempfb_fl = kb * fb(length, L); diff --git a/source/blender/simulation/intern/implicit_eigen.cpp b/source/blender/simulation/intern/implicit_eigen.cpp index ea1729589d6..8eb227d38ab 100644 --- a/source/blender/simulation/intern/implicit_eigen.cpp +++ b/source/blender/simulation/intern/implicit_eigen.cpp @@ -904,7 +904,7 @@ BLI_INLINE void dfdx_damp(float to[3][3], BLI_INLINE void dfdv_damp(float to[3][3], const float dir[3], float damping) { - /* derivative of force wrt velocity */ + /* Derivative of force with regards to velocity. */ outerproduct(to, dir, dir); mul_m3_fl(to, -damping); } @@ -936,7 +936,7 @@ BLI_INLINE float fbstar(float length, float L, float kb, float cb) } } -/* function to calculae bending spring force (taken from Choi & Co) */ +/* Function to calculate bending spring force (taken from Choi & Co). */ BLI_INLINE float fbstar_jacobi(float length, float L, float kb, float cb) { float tempfb_fl = kb * fb(length, L); diff --git a/source/blender/windowmanager/xr/intern/wm_xr_draw.c b/source/blender/windowmanager/xr/intern/wm_xr_draw.c index 499ec136e03..cc4a7e41e82 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_draw.c +++ b/source/blender/windowmanager/xr/intern/wm_xr_draw.c @@ -129,7 +129,7 @@ void wm_xr_draw_view(const GHOST_XrDrawViewInfo *draw_view, void *customdata) /* Some systems have drawing glitches without this. */ GPU_clear_depth(1.0f); - /* Draws the view into the surface_data->viewport's framebuffers */ + /* Draws the view into the surface_data->viewport's frame-buffers. */ ED_view3d_draw_offscreen_simple(draw_data->depsgraph, draw_data->scene, &settings->shading, diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 7db936b3e51..8018ab3f46d 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -764,7 +764,7 @@ elseif(WIN32) PATTERN "*.pyo" EXCLUDE # * any cache * ) - install( + install( DIRECTORY ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/lib DESTINATION ${BLENDER_VERSION}/python/ CONFIGURATIONS Debug @@ -772,7 +772,6 @@ elseif(WIN32) PATTERN "__pycache__" EXCLUDE # * any cache * PATTERN "*.pyc" EXCLUDE # * any cache * PATTERN "*.pyo" EXCLUDE # * any cache *) - ) install( diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index b75a6a624d5..98a8a7aa189 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -1160,7 +1160,7 @@ static int arg_handle_env_system_set(int argc, const char **argv, void *UNUSED(d } for (; *ch_src; ch_src++, ch_dst++) { - *ch_dst = (*ch_src == '-') ? '_' : (*ch_src) - 32; /* toupper() */ + *ch_dst = (*ch_src == '-') ? '_' : (*ch_src) - 32; /* Inline #toupper() */ } *ch_dst = '\0'; @@ -1958,7 +1958,7 @@ static int arg_handle_load_file(int UNUSED(argc), const char **argv, void *data) if (success) { if (G.background) { - /* ensuer we use 'C->data.scene' for background render */ + /* Ensure we use 'C->data.scene' for background render. */ CTX_wm_window_set(C, NULL); } } diff --git a/tests/gtests/runner/CMakeLists.txt b/tests/gtests/runner/CMakeLists.txt index b1b9cf98d68..1fe8cf21810 100644 --- a/tests/gtests/runner/CMakeLists.txt +++ b/tests/gtests/runner/CMakeLists.txt @@ -72,7 +72,7 @@ elseif(APPLE) set(_test_libs_dependencies) foreach(_lib ${_test_libs}) get_target_property(_interface_libs ${_lib} INTERFACE_LINK_LIBRARIES) - if (_interface_libs) + if(_interface_libs) list(APPEND _test_libs_dependencies ${_interface_libs}) endif() unset(_interface_libs)
Legend