diff options
author | Sam Kottler <dev@samkottler.net> | 2020-08-13 17:58:33 +0300 |
---|---|---|
committer | Sam Kottler <dev@samkottler.net> | 2020-08-13 17:58:33 +0300 |
commit | 7c38d008de5ebdcb96ebdd67b8dc459d5551702f (patch) | |
tree | 8fb22f60bc31019e3fe8f5b2bf35159c2e32cda9 | |
parent | cc86e03fd52cd68e66b817590aac80ec2a358d3e (diff) | |
parent | 4e103101f7a20eaa2a61306a1070a04b63a69958 (diff) |
Merge branch 'blender-v2.90-release' into soc-2020-production-ready-light-tree-2
1874 files changed, 10054 insertions, 9607 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index cc0e5a2491f..bc4d4e032af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) endif() endif() -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.10) # Prever LEGACY OpenGL to eb compatible with all the existing releases and # platforms which don't hare GLVND yet. Only do it if preference was not set diff --git a/build_files/buildbot/buildbot_utils.py b/build_files/buildbot/buildbot_utils.py index e8adf5ba810..a0c33155da1 100644 --- a/build_files/buildbot/buildbot_utils.py +++ b/build_files/buildbot/buildbot_utils.py @@ -33,10 +33,11 @@ def is_tool(name): return which(name) is not None class Builder: - def __init__(self, name, branch): + def __init__(self, name, branch, codesign): self.name = name self.branch = branch self.is_release_branch = re.match("^blender-v(.*)-release$", branch) is not None + self.codesign = codesign # Buildbot runs from build/ directory self.blender_dir = os.path.abspath(os.path.join('..', 'blender.git')) @@ -67,8 +68,9 @@ def create_builder_from_arguments(): parser = argparse.ArgumentParser() parser.add_argument('builder_name') parser.add_argument('branch', default='master', nargs='?') + parser.add_argument("--codesign", action="store_true") args = parser.parse_args() - return Builder(args.builder_name, args.branch) + return Builder(args.builder_name, args.branch, args.codesign) class VersionInfo: diff --git a/build_files/buildbot/worker_bundle_dmg.py b/build_files/buildbot/worker_bundle_dmg.py index cd3da85e12a..56e0d7da88e 100755 --- a/build_files/buildbot/worker_bundle_dmg.py +++ b/build_files/buildbot/worker_bundle_dmg.py @@ -82,6 +82,10 @@ def create_argument_parser(): type=Path, help="Optional path to applescript to set up folder looks of DMG." "If not provided default Blender's one is used.") + parser.add_argument( + '--codesign', + action="store_true", + help="Code sign and notarize DMG contents.") return parser @@ -395,7 +399,8 @@ def create_final_dmg(app_bundles: List[Path], dmg_filepath: Path, background_image_filepath: Path, volume_name: str, - applescript: Path) -> None: + applescript: Path, + codesign: bool) -> None: """ Create DMG with all app bundles @@ -421,7 +426,8 @@ def create_final_dmg(app_bundles: List[Path], # # This allows to recurs into the content of bundles without worrying about # possible interfereice of Application symlink. - codesign_app_bundles_in_dmg(mount_directory) + if codesign: + codesign_app_bundles_in_dmg(mount_directory) copy_background_if_needed(background_image_filepath, mount_directory) create_applications_link(mount_directory) @@ -434,7 +440,8 @@ def create_final_dmg(app_bundles: List[Path], compress_dmg(writable_dmg_filepath, dmg_filepath) writable_dmg_filepath.unlink() - codesign_and_notarize_dmg(dmg_filepath) + if codesign: + codesign_and_notarize_dmg(dmg_filepath) def ensure_dmg_extension(filepath: Path) -> Path: @@ -521,6 +528,7 @@ def main(): source_dir = args.source_dir.absolute() background_image_filepath = get_background_image(args.background_image) applescript = get_applescript(args.applescript) + codesign = args.codesign app_bundles = collect_and_log_app_bundles(source_dir) if not app_bundles: @@ -535,7 +543,8 @@ def main(): dmg_filepath, background_image_filepath, volume_name, - applescript) + applescript, + codesign) if __name__ == "__main__": diff --git a/build_files/buildbot/worker_compile.py b/build_files/buildbot/worker_compile.py index f1357e1864f..8e19c9436f8 100644 --- a/build_files/buildbot/worker_compile.py +++ b/build_files/buildbot/worker_compile.py @@ -24,7 +24,7 @@ import shutil import buildbot_utils def get_cmake_options(builder): - post_install_script = os.path.join( + codesign_script = os.path.join( builder.blender_dir, 'build_files', 'buildbot', 'worker_codesign.cmake') config_file = "build_files/cmake/config/blender_release.cmake" @@ -36,7 +36,8 @@ def get_cmake_options(builder): options.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9') elif builder.platform == 'win': options.extend(['-G', 'Visual Studio 16 2019', '-A', 'x64']) - options.extend(['-DPOSTINSTALL_SCRIPT:PATH=' + post_install_script]) + if builder.codesign: + options.extend(['-DPOSTINSTALL_SCRIPT:PATH=' + codesign_script]) elif builder.platform == 'linux': config_file = "build_files/buildbot/config/blender_linux.cmake" diff --git a/build_files/buildbot/worker_pack.py b/build_files/buildbot/worker_pack.py index 87ee49c87d8..96c8db8e6c8 100644 --- a/build_files/buildbot/worker_pack.py +++ b/build_files/buildbot/worker_pack.py @@ -117,6 +117,8 @@ def pack_mac(builder): if info.is_development_build: background_image = os.path.join(release_dir, 'buildbot', 'background.tif') command += ['--background-image', background_image] + if builder.codesign: + command += ['--codesign'] command += [builder.install_dir] buildbot_utils.call(command) @@ -150,7 +152,8 @@ def pack_win(builder): package_filename = package_name + '.msi' package_filepath = os.path.join(builder.build_dir, package_filename) - sign_file_or_directory(package_filepath) + if builder.codesign: + sign_file_or_directory(package_filepath) package_files += [(package_filepath, package_filename)] diff --git a/build_files/cmake/Modules/FindAlembic.cmake b/build_files/cmake/Modules/FindAlembic.cmake index 2d69613ad84..257b63b1728 100644 --- a/build_files/cmake/Modules/FindAlembic.cmake +++ b/build_files/cmake/Modules/FindAlembic.cmake @@ -12,12 +12,8 @@ #============================================================================= # Copyright 2016 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If ALEMBIC_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindAudaspace.cmake b/build_files/cmake/Modules/FindAudaspace.cmake index eeef49af60f..9bf15e05272 100644 --- a/build_files/cmake/Modules/FindAudaspace.cmake +++ b/build_files/cmake/Modules/FindAudaspace.cmake @@ -11,6 +11,13 @@ # AUDASPACE_PY_INCLUDE_DIRS - the audaspace's python binding include directories # AUDASPACE_PY_LIBRARIES - link these to use audaspace's python binding +#============================================================================= +# Copyright 2014 Blender Foundation. +# +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. +#============================================================================= + IF(NOT AUDASPACE_ROOT_DIR AND NOT $ENV{AUDASPACE_ROOT_DIR} STREQUAL "") SET(AUDASPACE_ROOT_DIR $ENV{AUDASPACE_ROOT_DIR}) ENDIF() diff --git a/build_files/cmake/Modules/FindBlosc.cmake b/build_files/cmake/Modules/FindBlosc.cmake index bec934ad7c3..6c4798fc481 100644 --- a/build_files/cmake/Modules/FindBlosc.cmake +++ b/build_files/cmake/Modules/FindBlosc.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2018 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If BLOSC_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindClangTidy.cmake b/build_files/cmake/Modules/FindClangTidy.cmake index f556d05a0b9..d576ad8f100 100644 --- a/build_files/cmake/Modules/FindClangTidy.cmake +++ b/build_files/cmake/Modules/FindClangTidy.cmake @@ -17,12 +17,8 @@ #============================================================================= # Copyright 2020 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If CLANG_TIDY_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindEigen3.cmake b/build_files/cmake/Modules/FindEigen3.cmake index 82261294df2..735f44a04db 100644 --- a/build_files/cmake/Modules/FindEigen3.cmake +++ b/build_files/cmake/Modules/FindEigen3.cmake @@ -10,12 +10,8 @@ #============================================================================= # Copyright 2015 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If EIGEN3_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindEmbree.cmake b/build_files/cmake/Modules/FindEmbree.cmake index fa613f62308..0c8def9ad22 100644 --- a/build_files/cmake/Modules/FindEmbree.cmake +++ b/build_files/cmake/Modules/FindEmbree.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2018 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If EMBREE_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindFftw3.cmake b/build_files/cmake/Modules/FindFftw3.cmake index 3da19290b0d..df69c0c2ed4 100644 --- a/build_files/cmake/Modules/FindFftw3.cmake +++ b/build_files/cmake/Modules/FindFftw3.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2011 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If FFTW3_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindGLEW.cmake b/build_files/cmake/Modules/FindGLEW.cmake index 652b0835807..3aa585af982 100644 --- a/build_files/cmake/Modules/FindGLEW.cmake +++ b/build_files/cmake/Modules/FindGLEW.cmake @@ -13,12 +13,8 @@ #============================================================================= # Copyright 2014 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If GLEW_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindIcuLinux.cmake b/build_files/cmake/Modules/FindIcuLinux.cmake index 9a467fa0115..e1aaa434533 100644 --- a/build_files/cmake/Modules/FindIcuLinux.cmake +++ b/build_files/cmake/Modules/FindIcuLinux.cmake @@ -12,12 +12,8 @@ #============================================================================= # Copyright 2012 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If ICU_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindJack.cmake b/build_files/cmake/Modules/FindJack.cmake index 7643e586cad..a790c127c09 100644 --- a/build_files/cmake/Modules/FindJack.cmake +++ b/build_files/cmake/Modules/FindJack.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2011 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If JACK_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindJeMalloc.cmake b/build_files/cmake/Modules/FindJeMalloc.cmake index e042e7fe43e..72a0bed6f22 100644 --- a/build_files/cmake/Modules/FindJeMalloc.cmake +++ b/build_files/cmake/Modules/FindJeMalloc.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2011 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If JEMALLOC_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindLLVM.cmake b/build_files/cmake/Modules/FindLLVM.cmake index 141a91c0508..d7269a4281f 100644 --- a/build_files/cmake/Modules/FindLLVM.cmake +++ b/build_files/cmake/Modules/FindLLVM.cmake @@ -13,12 +13,8 @@ #============================================================================= # Copyright 2015 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= if(LLVM_ROOT_DIR) diff --git a/build_files/cmake/Modules/FindLZO.cmake b/build_files/cmake/Modules/FindLZO.cmake index 4db5d0f5441..81f8792a803 100644 --- a/build_files/cmake/Modules/FindLZO.cmake +++ b/build_files/cmake/Modules/FindLZO.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2015 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If LZO_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindOpenCOLLADA.cmake b/build_files/cmake/Modules/FindOpenCOLLADA.cmake index acf9e9ed9ce..347993c6c19 100644 --- a/build_files/cmake/Modules/FindOpenCOLLADA.cmake +++ b/build_files/cmake/Modules/FindOpenCOLLADA.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2011 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # note about include paths, there are 2 ways includes are set diff --git a/build_files/cmake/Modules/FindOpenColorIO.cmake b/build_files/cmake/Modules/FindOpenColorIO.cmake index 090032e06ec..559ccaba865 100644 --- a/build_files/cmake/Modules/FindOpenColorIO.cmake +++ b/build_files/cmake/Modules/FindOpenColorIO.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2012 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If OPENCOLORIO_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindOpenEXR.cmake b/build_files/cmake/Modules/FindOpenEXR.cmake index 3cf559a5da1..090f80b8df7 100644 --- a/build_files/cmake/Modules/FindOpenEXR.cmake +++ b/build_files/cmake/Modules/FindOpenEXR.cmake @@ -21,12 +21,8 @@ #============================================================================= # Copyright 2011 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If OPENEXR_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindOpenGLES.cmake b/build_files/cmake/Modules/FindOpenGLES.cmake index daf6db61050..d01d32b71bc 100644 --- a/build_files/cmake/Modules/FindOpenGLES.cmake +++ b/build_files/cmake/Modules/FindOpenGLES.cmake @@ -10,6 +10,13 @@ # OPENGLES_LIBRARIES - all libraries needed for OpenGLES # OPENGLES_INCLUDES - all includes needed for OpenGLES +#============================================================================= +# Copyright 2014 Blender Foundation. +# +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. +#============================================================================= + # If OPENGLES_ROOT_DIR was defined in the environment, use it. IF(NOT OPENGLES_ROOT_DIR AND NOT $ENV{OPENGLES_ROOT_DIR} STREQUAL "") SET(OPENGLES_ROOT_DIR $ENV{OPENGLES_ROOT_DIR}) diff --git a/build_files/cmake/Modules/FindOpenImageDenoise.cmake b/build_files/cmake/Modules/FindOpenImageDenoise.cmake index c7215d30e8a..3facadbb9be 100644 --- a/build_files/cmake/Modules/FindOpenImageDenoise.cmake +++ b/build_files/cmake/Modules/FindOpenImageDenoise.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2019 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If OPENIMAGEDENOISE_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindOpenImageIO.cmake b/build_files/cmake/Modules/FindOpenImageIO.cmake index 3570c982961..aac5b5ce0a8 100644 --- a/build_files/cmake/Modules/FindOpenImageIO.cmake +++ b/build_files/cmake/Modules/FindOpenImageIO.cmake @@ -16,12 +16,8 @@ #============================================================================= # Copyright 2011 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If OPENIMAGEIO_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindOpenJPEG.cmake b/build_files/cmake/Modules/FindOpenJPEG.cmake index 5774ac2182a..ddd98237dd0 100644 --- a/build_files/cmake/Modules/FindOpenJPEG.cmake +++ b/build_files/cmake/Modules/FindOpenJPEG.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2011 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If OPENJPEG_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindOpenShadingLanguage.cmake b/build_files/cmake/Modules/FindOpenShadingLanguage.cmake index 07ed2c86e19..f22fe32c994 100644 --- a/build_files/cmake/Modules/FindOpenShadingLanguage.cmake +++ b/build_files/cmake/Modules/FindOpenShadingLanguage.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2014 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If OSL_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindOpenSubdiv.cmake b/build_files/cmake/Modules/FindOpenSubdiv.cmake index d7a8567a399..d78ffc11382 100644 --- a/build_files/cmake/Modules/FindOpenSubdiv.cmake +++ b/build_files/cmake/Modules/FindOpenSubdiv.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2013 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If OPENSUBDIV_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindOpenVDB.cmake b/build_files/cmake/Modules/FindOpenVDB.cmake index 2a1378e3a2b..f409802c0e4 100644 --- a/build_files/cmake/Modules/FindOpenVDB.cmake +++ b/build_files/cmake/Modules/FindOpenVDB.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2015 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If OPENVDB_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindOptiX.cmake b/build_files/cmake/Modules/FindOptiX.cmake index 5b606afea27..2cb1ce09e46 100644 --- a/build_files/cmake/Modules/FindOptiX.cmake +++ b/build_files/cmake/Modules/FindOptiX.cmake @@ -10,12 +10,8 @@ #============================================================================= # Copyright 2019 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If OPTIX_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindPCRE.cmake b/build_files/cmake/Modules/FindPCRE.cmake index dfe721920fd..678826e4ab1 100644 --- a/build_files/cmake/Modules/FindPCRE.cmake +++ b/build_files/cmake/Modules/FindPCRE.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2011 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If PCRE_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindPugiXML.cmake b/build_files/cmake/Modules/FindPugiXML.cmake index 73d7b9ef92c..5dced1c6df8 100644 --- a/build_files/cmake/Modules/FindPugiXML.cmake +++ b/build_files/cmake/Modules/FindPugiXML.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2014 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If PUGIXML_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindPythonLibsUnix.cmake b/build_files/cmake/Modules/FindPythonLibsUnix.cmake index 0e3ecac14f0..5b3f2e52256 100644 --- a/build_files/cmake/Modules/FindPythonLibsUnix.cmake +++ b/build_files/cmake/Modules/FindPythonLibsUnix.cmake @@ -25,12 +25,8 @@ #============================================================================= # Copyright 2011 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If PYTHON_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindSDL2.cmake b/build_files/cmake/Modules/FindSDL2.cmake index ba89a6e3fce..7ef9a84dab0 100644 --- a/build_files/cmake/Modules/FindSDL2.cmake +++ b/build_files/cmake/Modules/FindSDL2.cmake @@ -13,12 +13,8 @@ #============================================================================= # Copyright 2015 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If SDL2_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindSndFile.cmake b/build_files/cmake/Modules/FindSndFile.cmake index 0d66b4785e2..aae5b692228 100644 --- a/build_files/cmake/Modules/FindSndFile.cmake +++ b/build_files/cmake/Modules/FindSndFile.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2011 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If LIBSNDFILE_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindSpacenav.cmake b/build_files/cmake/Modules/FindSpacenav.cmake index 353b05f90b5..b7c8c01dc32 100644 --- a/build_files/cmake/Modules/FindSpacenav.cmake +++ b/build_files/cmake/Modules/FindSpacenav.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2011 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If SPACENAV_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindTBB.cmake b/build_files/cmake/Modules/FindTBB.cmake index de7db09ddb5..5a0d5a7d42d 100644 --- a/build_files/cmake/Modules/FindTBB.cmake +++ b/build_files/cmake/Modules/FindTBB.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2016 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If TBB_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindUSD.cmake b/build_files/cmake/Modules/FindUSD.cmake index 043a10ffa98..d0e772038a7 100644 --- a/build_files/cmake/Modules/FindUSD.cmake +++ b/build_files/cmake/Modules/FindUSD.cmake @@ -12,12 +12,8 @@ #============================================================================= # Copyright 2019 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If USD_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindXML2.cmake b/build_files/cmake/Modules/FindXML2.cmake index c16ab4468cc..d313150f7a0 100644 --- a/build_files/cmake/Modules/FindXML2.cmake +++ b/build_files/cmake/Modules/FindXML2.cmake @@ -14,12 +14,8 @@ #============================================================================= # Copyright 2011 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If XML2_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/FindXR-OpenXR-SDK.cmake b/build_files/cmake/Modules/FindXR-OpenXR-SDK.cmake index 71b40ec1bde..c1ecea89460 100644 --- a/build_files/cmake/Modules/FindXR-OpenXR-SDK.cmake +++ b/build_files/cmake/Modules/FindXR-OpenXR-SDK.cmake @@ -20,12 +20,8 @@ # XR_OPENXR_SDK_LOADER_LIBRARY, where to find the OpenXR-SDK loader library. #============================================================================= -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. #============================================================================= # If XR_OPENXR_SDK_ROOT_DIR was defined in the environment, use it. diff --git a/build_files/cmake/Modules/GTestTesting.cmake b/build_files/cmake/Modules/GTestTesting.cmake index ea9a1edeb43..a744f4202da 100644 --- a/build_files/cmake/Modules/GTestTesting.cmake +++ b/build_files/cmake/Modules/GTestTesting.cmake @@ -1,12 +1,8 @@ #============================================================================= # Copyright 2014 Blender Foundation. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. # # Inspired on the Testing.cmake from Libmv # diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 708efc3d2f7..77959f2cf5f 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -397,7 +397,7 @@ function(setup_heavy_lib_pool) list(APPEND _HEAVY_LIBS "cycles_device" "cycles_kernel") endif() if(WITH_LIBMV) - list(APPEND _HEAVY_LIBS "bf_intern_libmv") + list(APPEND _HEAVY_LIBS "extern_ceres" "bf_intern_libmv") endif() if(WITH_OPENVDB) list(APPEND _HEAVY_LIBS "bf_intern_openvdb") diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index 96244b65f21..c5e8893424b 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -36,6 +36,11 @@ if(NOT DEFINED LIBDIR) elseif(EXISTS ${LIBDIR_CENTOS7_ABI}) set(LIBDIR ${LIBDIR_CENTOS7_ABI}) set(WITH_CXX11_ABI OFF) + + if(CMAKE_COMPILER_IS_GNUCC AND + CMAKE_C_COMPILER_VERSION VERSION_LESS 9.3) + message(FATAL_ERROR "GCC version must be at least 9.3 for precompiled libraries, found ${CMAKE_C_COMPILER_VERSION}") + endif() endif() # Avoid namespace pollustion. diff --git a/doc/license/BSD-3-Clause-license.txt b/doc/license/BSD-3-Clause-license.txt new file mode 100644 index 00000000000..3879237a0a9 --- /dev/null +++ b/doc/license/BSD-3-Clause-license.txt @@ -0,0 +1,26 @@ +BSD 3-Clause License + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/doc/python_api/examples/gpu.7.py b/doc/python_api/examples/gpu.7.py index 56cbb93c61a..d6055898807 100644 --- a/doc/python_api/examples/gpu.7.py +++ b/doc/python_api/examples/gpu.7.py @@ -20,6 +20,7 @@ from gpu_extras.presets import draw_circle_2d offscreen = gpu.types.GPUOffScreen(512, 512) with offscreen.bind(): + bgl.glClearColor(0.0, 0.0, 0.0, 0.0) bgl.glClear(bgl.GL_COLOR_BUFFER_BIT) with gpu.matrix.push_pop(): # reset matrices -> use normalized device coordinates [-1, 1] diff --git a/doc/python_api/examples/gpu.8.py b/doc/python_api/examples/gpu.8.py index 470bd8a2dad..e67c601def9 100644 --- a/doc/python_api/examples/gpu.8.py +++ b/doc/python_api/examples/gpu.8.py @@ -25,6 +25,7 @@ RING_AMOUNT = 10 offscreen = gpu.types.GPUOffScreen(WIDTH, HEIGHT) with offscreen.bind(): + bgl.glClearColor(0.0, 0.0, 0.0, 0.0) bgl.glClear(bgl.GL_COLOR_BUFFER_BIT) with gpu.matrix.push_pop(): # reset matrices -> use normalized device coordinates [-1, 1] diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 8ad96a6e4f5..2c9445dce97 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -696,13 +696,11 @@ def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier): doc = undocumented_message(module_name, type_name, identifier) if type(descr) == GetSetDescriptorType: - fw(ident + ".. attribute:: %s\n" % identifier) - fw(ident + " :noindex:\n\n") + fw(ident + ".. attribute:: %s\n\n" % identifier) write_indented_lines(ident + " ", fw, doc, False) fw("\n") elif type(descr) == MemberDescriptorType: # same as above but use 'data' - fw(ident + ".. data:: %s\n" % identifier) - fw(ident + " :noindex:\n\n") + fw(ident + ".. data:: %s\n\n" % identifier) write_indented_lines(ident + " ", fw, doc, False) fw("\n") elif type(descr) in {MethodDescriptorType, ClassMethodDescriptorType}: @@ -742,14 +740,11 @@ def pyprop2sphinx(ident, fw, identifier, py_prop): ''' # readonly properties use "data" directive, variables use "attribute" directive if py_prop.fset is None: - fw(ident + ".. data:: %s\n" % identifier) - fw(ident + " :noindex:\n\n") + fw(ident + ".. data:: %s\n\n" % identifier) else: - fw(ident + ".. attribute:: %s\n" % identifier) - fw(ident + " :noindex:\n\n") + fw(ident + ".. attribute:: %s\n\n" % identifier) write_indented_lines(ident + " ", fw, py_prop.__doc__) if py_prop.fset is None: - fw("\n") fw(ident + " (readonly)\n\n") else: fw("\n") @@ -915,8 +910,7 @@ def pymodule2sphinx(basepath, module_name, module, title): elif issubclass(value_type, (bool, int, float, str, tuple)): # constant, not much fun we can do here except to list it. # TODO, figure out some way to document these! - fw(".. data:: %s\n" % attribute) - fw(" :noindex:\n\n") + fw(".. data:: %s\n\n" % attribute) write_indented_lines(" ", fw, "constant value %s" % repr(value), False) fw("\n") else: @@ -1126,8 +1120,7 @@ def pycontext2sphinx(basepath): type_descr = prop.get_type_description( class_fmt=":class:`bpy.types.%s`", collection_id=_BPY_PROP_COLLECTION_ID) - fw(".. data:: %s\n" % prop.identifier) - fw(" :noindex:\n\n") + fw(".. data:: %s\n\n" % prop.identifier) if prop.description: fw(" %s\n\n" % prop.description) @@ -1172,8 +1165,7 @@ def pycontext2sphinx(basepath): i = 0 while char_array[i] is not None: member = ctypes.string_at(char_array[i]).decode(encoding="ascii") - fw(".. data:: %s\n" % member) - fw(" :noindex:\n\n") + fw(".. data:: %s\n\n" % member) member_type, is_seq = context_type_map[member] fw(" :type: %s :class:`bpy.types.%s`\n\n" % ("sequence of " if is_seq else "", member_type)) unique.add(member) @@ -1379,11 +1371,9 @@ def pyrna2sphinx(basepath): type_descr = prop.get_type_description(class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID) # readonly properties use "data" directive, variables properties use "attribute" directive if 'readonly' in type_descr: - fw(" .. data:: %s\n" % prop.identifier) - fw(" :noindex:\n\n") + fw(" .. data:: %s\n\n" % prop.identifier) else: - fw(" .. attribute:: %s\n" % prop.identifier) - fw(" :noindex:\n\n") + fw(" .. attribute:: %s\n\n" % prop.identifier) if prop.description: fw(" %s\n\n" % prop.description) diff --git a/extern/audaspace/bindings/python/PySound.cpp b/extern/audaspace/bindings/python/PySound.cpp index 62ee3435e82..f2debccfd33 100644 --- a/extern/audaspace/bindings/python/PySound.cpp +++ b/extern/audaspace/bindings/python/PySound.cpp @@ -1395,9 +1395,9 @@ PyDoc_STRVAR(M_aud_Sound_threshold_doc, " all between to 0.\n\n" " :arg threshold: Threshold value over which an amplitude counts\n" " non-zero.\n\n" - ":type threshold: float\n" - ":return: The created :class:`Sound` object.\n" - ":rtype: :class:`Sound`"); + " :type threshold: float\n" + " :return: The created :class:`Sound` object.\n" + " :rtype: :class:`Sound`"); static PyObject * Sound_threshold(Sound* self, PyObject* args) diff --git a/extern/audaspace/src/respec/JOSResampleReader.cpp b/extern/audaspace/src/respec/JOSResampleReader.cpp index 6753a2e8b6b..378986fee28 100644 --- a/extern/audaspace/src/respec/JOSResampleReader.cpp +++ b/extern/audaspace/src/respec/JOSResampleReader.cpp @@ -119,8 +119,8 @@ void JOSResampleReader::updateBuffer(int size, double factor, int samplesize) P = int_to_fp(m_L) - P;\ \ end = std::floor((m_len - 1) / double(m_L) + m_P) - 1;\ - if(m_cache_valid - m_n - 2 < end)\ - end = m_cache_valid - m_n - 2;\ + if(m_cache_valid - int(m_n) - 2 < end)\ + end = m_cache_valid - int(m_n) - 2;\ \ data = buf + (m_n + 2 + end) * m_channels - 1;\ l = fp_to_int(P);\ @@ -166,8 +166,8 @@ void JOSResampleReader::updateBuffer(int size, double factor, int samplesize) P = 0 - P;\ \ end = (int_to_fp(m_len) - P) / P_increment - 1;\ - if(m_cache_valid - m_n - 2 < end)\ - end = m_cache_valid - m_n - 2;\ + if(m_cache_valid - int(m_n) - 2 < end)\ + end = m_cache_valid - int(m_n) - 2;\ \ P += P_increment * end;\ data = buf + (m_n + 2 + end) * m_channels - 1;\ diff --git a/extern/mantaflow/preprocessed/fileio/ioparticles.cpp b/extern/mantaflow/preprocessed/fileio/ioparticles.cpp index 84283a25b07..36e10aa1644 100644 --- a/extern/mantaflow/preprocessed/fileio/ioparticles.cpp +++ b/extern/mantaflow/preprocessed/fileio/ioparticles.cpp @@ -322,6 +322,7 @@ template<class T> int readPdataUni(const std::string &name, ParticleDataImpl<T> UniPartHeader head; assertMsg(gzread(gzf, &head, sizeof(UniPartHeader)) == sizeof(UniPartHeader), "can't read file, no header present"); + pdata->getParticleSys()->resize(head.dim); // ensure that parent particle system has same size pdata->resize(head.dim); assertMsg(head.dim == pdata->size(), "pdata size doesn't match"); diff --git a/extern/mantaflow/preprocessed/gitinfo.h b/extern/mantaflow/preprocessed/gitinfo.h index 3271a858911..e87c8739cf4 100644 --- a/extern/mantaflow/preprocessed/gitinfo.h +++ b/extern/mantaflow/preprocessed/gitinfo.h @@ -1,3 +1,3 @@ -#define MANTA_GIT_VERSION "commit 3370c2014ad7192041cb4fbed19ed74ae9725fb5" +#define MANTA_GIT_VERSION "commit e2f6e59e3679f88e5100ae2145410cca4971b9df" diff --git a/extern/mantaflow/preprocessed/grid.h b/extern/mantaflow/preprocessed/grid.h index a7aac80891a..9bd4e5d72d9 100644 --- a/extern/mantaflow/preprocessed/grid.h +++ b/extern/mantaflow/preprocessed/grid.h @@ -355,6 +355,38 @@ class GridBase : public PbClass { return isInBounds(Vec3i(i, j, k), bnd); } +#ifdef BLENDER + //! expose name field to Python for Blender + void setName(const std::string &name) + { + mName = name; + } + static PyObject *_W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + { + try { + PbArgs _args(_linargs, _kwds); + GridBase *pbo = dynamic_cast<GridBase *>(Pb::objFromPy(_self)); + bool noTiming = _args.getOpt<bool>("notiming", -1, 0); + pbPreparePlugin(pbo->getParent(), "GridBase::setName", !noTiming); + PyObject *_retval = 0; + { + ArgLocker _lock; + const std::string &name = _args.get<std::string>("name", 0, &_lock); + pbo->_args.copy(_args); + _retval = getPyNone(); + pbo->setName(name); + pbo->_args.check(); + } + pbFinalizePlugin(pbo->getParent(), "GridBase::setName", !noTiming); + return _retval; + } + catch (std::exception &e) { + pbSetError("GridBase::setName", e.what()); + return 0; + } + } + +#endif protected: GridType mType; Vec3i mSize; @@ -373,7 +405,7 @@ template<class T> class Grid : public GridBase { public: //! init new grid, values are set to zero Grid(FluidSolver *parent, bool show = true); - static int _W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static int _W_10(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { PbClass *obj = Pb::objFromPy(_self); if (obj) @@ -410,7 +442,7 @@ template<class T> class Grid : public GridBase { typedef GridBase BASETYPE_GRID; int save(std::string name); - static PyObject *_W_10(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_11(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -435,7 +467,7 @@ template<class T> class Grid : public GridBase { } int load(std::string name); - static PyObject *_W_11(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_12(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -461,7 +493,7 @@ template<class T> class Grid : public GridBase { //! set all cells to zero void clear(); - static PyObject *_W_12(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_13(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -588,7 +620,7 @@ template<class T> class Grid : public GridBase { // Grid<T>& operator=(const Grid<T>& a); //! copy content from other grid (use this one instead of operator= !) Grid<T> ©From(const Grid<T> &a, bool copyType = true); - static PyObject *_W_13(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_14(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -618,7 +650,7 @@ template<class T> class Grid : public GridBase { //! get grid type int getGridType(); - static PyObject *_W_14(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_15(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -643,7 +675,7 @@ template<class T> class Grid : public GridBase { //! add/subtract other grid void add(const Grid<T> &a); - static PyObject *_W_15(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_16(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -669,7 +701,7 @@ template<class T> class Grid : public GridBase { } void sub(const Grid<T> &a); - static PyObject *_W_16(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_17(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -696,7 +728,7 @@ template<class T> class Grid : public GridBase { //! set all cells to constant value void setConst(T s); - static PyObject *_W_17(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -723,7 +755,7 @@ template<class T> class Grid : public GridBase { //! add constant to all grid cells void addConst(T s); - static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_19(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -750,7 +782,7 @@ template<class T> class Grid : public GridBase { //! add scaled other grid to current one (note, only "Real" factor, "T" type not supported here!) void addScaled(const Grid<T> &a, const T &factor); - static PyObject *_W_19(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_20(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -778,7 +810,7 @@ template<class T> class Grid : public GridBase { //! multiply contents of grid void mult(const Grid<T> &a); - static PyObject *_W_20(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_21(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -805,7 +837,7 @@ template<class T> class Grid : public GridBase { //! multiply each cell by a constant scalar value void multConst(T s); - static PyObject *_W_21(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_22(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -832,7 +864,7 @@ template<class T> class Grid : public GridBase { //! safely divide contents of grid (with zero check) Grid<T> &safeDivide(const Grid<T> &a); - static PyObject *_W_22(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_23(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -858,7 +890,7 @@ template<class T> class Grid : public GridBase { //! clamp content to range (for vec3, clamps each component separately) void clamp(Real min, Real max); - static PyObject *_W_23(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_24(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -886,7 +918,7 @@ template<class T> class Grid : public GridBase { //! reduce small values to zero void stomp(const T &threshold); - static PyObject *_W_24(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_25(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -913,7 +945,7 @@ template<class T> class Grid : public GridBase { //! permute grid axes, e.g. switch y with z (0,2,1) void permuteAxes(int axis0, int axis1, int axis2); - static PyObject *_W_25(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_26(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -942,7 +974,7 @@ template<class T> class Grid : public GridBase { //! permute grid axes, e.g. switch y with z (0,2,1) void permuteAxesCopyToGrid(int axis0, int axis1, int axis2, Grid<T> &out); - static PyObject *_W_26(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_27(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -972,7 +1004,7 @@ template<class T> class Grid : public GridBase { //! join other grid by either keeping min or max value at cell void join(const Grid<T> &a, bool keepMax = true); - static PyObject *_W_27(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_28(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1001,7 +1033,7 @@ template<class T> class Grid : public GridBase { // common compound operators //! get absolute max value in grid Real getMaxAbs() const; - static PyObject *_W_28(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_29(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1026,7 +1058,7 @@ template<class T> class Grid : public GridBase { //! get max value in grid Real getMax() const; - static PyObject *_W_29(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_30(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1051,7 +1083,7 @@ template<class T> class Grid : public GridBase { //! get min value in grid Real getMin() const; - static PyObject *_W_30(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_31(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1076,7 +1108,7 @@ template<class T> class Grid : public GridBase { //! calculate L1 norm of grid content Real getL1(int bnd = 0); - static PyObject *_W_31(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_32(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1102,7 +1134,7 @@ template<class T> class Grid : public GridBase { //! calculate L2 norm of grid content Real getL2(int bnd = 0); - static PyObject *_W_32(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_33(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1128,7 +1160,7 @@ template<class T> class Grid : public GridBase { //! set all boundary cells to constant value (Dirichlet) void setBound(T value, int boundaryWidth = 1); - static PyObject *_W_33(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_34(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1156,7 +1188,7 @@ template<class T> class Grid : public GridBase { //! set all boundary cells to last inner value (Neumann) void setBoundNeumann(int boundaryWidth = 1); - static PyObject *_W_34(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_35(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1183,7 +1215,7 @@ template<class T> class Grid : public GridBase { //! get data pointer of grid std::string getDataPointer(); - static PyObject *_W_35(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_36(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1208,7 +1240,7 @@ template<class T> class Grid : public GridBase { //! debugging helper, print grid from python. skip boundary of width bnd void printGrid(int zSlice = -1, bool printIndex = false, int bnd = 1); - static PyObject *_W_36(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_37(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1276,7 +1308,7 @@ class MACGrid : public Grid<Vec3> { { mType = (GridType)(TypeMAC | TypeVec3); } - static int _W_37(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static int _W_38(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { PbClass *obj = Pb::objFromPy(_self); if (obj) @@ -1358,7 +1390,7 @@ class MACGrid : public Grid<Vec3> { //! set all boundary cells of a MAC grid to certain value (Dirchlet). Respects staggered grid //! locations optionally, only set normal components void setBoundMAC(Vec3 value, int boundaryWidth, bool normalOnly = false); - static PyObject *_W_38(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_39(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1399,7 +1431,7 @@ class FlagGrid : public Grid<int> { { mType = (GridType)(TypeFlags | TypeInt); } - static int _W_39(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static int _W_40(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { PbClass *obj = Pb::objFromPy(_self); if (obj) @@ -1579,7 +1611,7 @@ class FlagGrid : public Grid<int> { const std::string &inflow = " ", const std::string &outflow = " ", Grid<Real> *phiWalls = 0x00); - static PyObject *_W_40(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_41(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1613,7 +1645,7 @@ class FlagGrid : public Grid<int> { //! set fluid flags inside levelset (liquids) void updateFromLevelset(LevelsetGrid &levelset); - static PyObject *_W_41(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_42(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1640,7 +1672,7 @@ class FlagGrid : public Grid<int> { //! set all cells (except obs/in/outflow) to type (fluid by default) void fillGrid(int type = TypeFluid); - static PyObject *_W_42(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_43(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1669,7 +1701,7 @@ class FlagGrid : public Grid<int> { //! warning for large grids! only regular int returned (due to python interface) //! optionally creates mask in RealGrid (1 where flag matches, 0 otherwise) int countCells(int flag, int bnd = 0, Grid<Real> *mask = NULL); - static PyObject *_W_43(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_44(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); diff --git a/extern/mantaflow/preprocessed/grid.h.reg.cpp b/extern/mantaflow/preprocessed/grid.h.reg.cpp index 9fe3e7298fa..2c95c002dad 100644 --- a/extern/mantaflow/preprocessed/grid.h.reg.cpp +++ b/extern/mantaflow/preprocessed/grid.h.reg.cpp @@ -8,103 +8,103 @@ namespace Manta { #ifdef _C_FlagGrid static const Pb::Register _R_26("FlagGrid", "FlagGrid", "Grid<int>"); template<> const char *Namify<FlagGrid>::S = "FlagGrid"; -static const Pb::Register _R_27("FlagGrid", "FlagGrid", FlagGrid::_W_39); -static const Pb::Register _R_28("FlagGrid", "initDomain", FlagGrid::_W_40); -static const Pb::Register _R_29("FlagGrid", "updateFromLevelset", FlagGrid::_W_41); -static const Pb::Register _R_30("FlagGrid", "fillGrid", FlagGrid::_W_42); -static const Pb::Register _R_31("FlagGrid", "countCells", FlagGrid::_W_43); +static const Pb::Register _R_27("FlagGrid", "FlagGrid", FlagGrid::_W_40); +static const Pb::Register _R_28("FlagGrid", "initDomain", FlagGrid::_W_41); +static const Pb::Register _R_29("FlagGrid", "updateFromLevelset", FlagGrid::_W_42); +static const Pb::Register _R_30("FlagGrid", "fillGrid", FlagGrid::_W_43); +static const Pb::Register _R_31("FlagGrid", "countCells", FlagGrid::_W_44); #endif #ifdef _C_Grid static const Pb::Register _R_32("Grid<int>", "Grid<int>", "GridBase"); template<> const char *Namify<Grid<int>>::S = "Grid<int>"; -static const Pb::Register _R_33("Grid<int>", "Grid", Grid<int>::_W_9); -static const Pb::Register _R_34("Grid<int>", "save", Grid<int>::_W_10); -static const Pb::Register _R_35("Grid<int>", "load", Grid<int>::_W_11); -static const Pb::Register _R_36("Grid<int>", "clear", Grid<int>::_W_12); -static const Pb::Register _R_37("Grid<int>", "copyFrom", Grid<int>::_W_13); -static const Pb::Register _R_38("Grid<int>", "getGridType", Grid<int>::_W_14); -static const Pb::Register _R_39("Grid<int>", "add", Grid<int>::_W_15); -static const Pb::Register _R_40("Grid<int>", "sub", Grid<int>::_W_16); -static const Pb::Register _R_41("Grid<int>", "setConst", Grid<int>::_W_17); -static const Pb::Register _R_42("Grid<int>", "addConst", Grid<int>::_W_18); -static const Pb::Register _R_43("Grid<int>", "addScaled", Grid<int>::_W_19); -static const Pb::Register _R_44("Grid<int>", "mult", Grid<int>::_W_20); -static const Pb::Register _R_45("Grid<int>", "multConst", Grid<int>::_W_21); -static const Pb::Register _R_46("Grid<int>", "safeDivide", Grid<int>::_W_22); -static const Pb::Register _R_47("Grid<int>", "clamp", Grid<int>::_W_23); -static const Pb::Register _R_48("Grid<int>", "stomp", Grid<int>::_W_24); -static const Pb::Register _R_49("Grid<int>", "permuteAxes", Grid<int>::_W_25); -static const Pb::Register _R_50("Grid<int>", "permuteAxesCopyToGrid", Grid<int>::_W_26); -static const Pb::Register _R_51("Grid<int>", "join", Grid<int>::_W_27); -static const Pb::Register _R_52("Grid<int>", "getMaxAbs", Grid<int>::_W_28); -static const Pb::Register _R_53("Grid<int>", "getMax", Grid<int>::_W_29); -static const Pb::Register _R_54("Grid<int>", "getMin", Grid<int>::_W_30); -static const Pb::Register _R_55("Grid<int>", "getL1", Grid<int>::_W_31); -static const Pb::Register _R_56("Grid<int>", "getL2", Grid<int>::_W_32); -static const Pb::Register _R_57("Grid<int>", "setBound", Grid<int>::_W_33); -static const Pb::Register _R_58("Grid<int>", "setBoundNeumann", Grid<int>::_W_34); -static const Pb::Register _R_59("Grid<int>", "getDataPointer", Grid<int>::_W_35); -static const Pb::Register _R_60("Grid<int>", "printGrid", Grid<int>::_W_36); +static const Pb::Register _R_33("Grid<int>", "Grid", Grid<int>::_W_10); +static const Pb::Register _R_34("Grid<int>", "save", Grid<int>::_W_11); +static const Pb::Register _R_35("Grid<int>", "load", Grid<int>::_W_12); +static const Pb::Register _R_36("Grid<int>", "clear", Grid<int>::_W_13); +static const Pb::Register _R_37("Grid<int>", "copyFrom", Grid<int>::_W_14); +static const Pb::Register _R_38("Grid<int>", "getGridType", Grid<int>::_W_15); +static const Pb::Register _R_39("Grid<int>", "add", Grid<int>::_W_16); +static const Pb::Register _R_40("Grid<int>", "sub", Grid<int>::_W_17); +static const Pb::Register _R_41("Grid<int>", "setConst", Grid<int>::_W_18); +static const Pb::Register _R_42("Grid<int>", "addConst", Grid<int>::_W_19); +static const Pb::Register _R_43("Grid<int>", "addScaled", Grid<int>::_W_20); +static const Pb::Register _R_44("Grid<int>", "mult", Grid<int>::_W_21); +static const Pb::Register _R_45("Grid<int>", "multConst", Grid<int>::_W_22); +static const Pb::Register _R_46("Grid<int>", "safeDivide", Grid<int>::_W_23); +static const Pb::Register _R_47("Grid<int>", "clamp", Grid<int>::_W_24); +static const Pb::Register _R_48("Grid<int>", "stomp", Grid<int>::_W_25); +static const Pb::Register _R_49("Grid<int>", "permuteAxes", Grid<int>::_W_26); +static const Pb::Register _R_50("Grid<int>", "permuteAxesCopyToGrid", Grid<int>::_W_27); +static const Pb::Register _R_51("Grid<int>", "join", Grid<int>::_W_28); +static const Pb::Register _R_52("Grid<int>", "getMaxAbs", Grid<int>::_W_29); +static const Pb::Register _R_53("Grid<int>", "getMax", Grid<int>::_W_30); +static const Pb::Register _R_54("Grid<int>", "getMin", Grid<int>::_W_31); +static const Pb::Register _R_55("Grid<int>", "getL1", Grid<int>::_W_32); +static const Pb::Register _R_56("Grid<int>", "getL2", Grid<int>::_W_33); +static const Pb::Register _R_57("Grid<int>", "setBound", Grid<int>::_W_34); +static const Pb::Register _R_58("Grid<int>", "setBoundNeumann", Grid<int>::_W_35); +static const Pb::Register _R_59("Grid<int>", "getDataPointer", Grid<int>::_W_36); +static const Pb::Register _R_60("Grid<int>", "printGrid", Grid<int>::_W_37); static const Pb::Register _R_61("Grid<Real>", "Grid<Real>", "GridBase"); template<> const char *Namify<Grid<Real>>::S = "Grid<Real>"; -static const Pb::Register _R_62("Grid<Real>", "Grid", Grid<Real>::_W_9); -static const Pb::Register _R_63("Grid<Real>", "save", Grid<Real>::_W_10); -static const Pb::Register _R_64("Grid<Real>", "load", Grid<Real>::_W_11); -static const Pb::Register _R_65("Grid<Real>", "clear", Grid<Real>::_W_12); -static const Pb::Register _R_66("Grid<Real>", "copyFrom", Grid<Real>::_W_13); -static const Pb::Register _R_67("Grid<Real>", "getGridType", Grid<Real>::_W_14); -static const Pb::Register _R_68("Grid<Real>", "add", Grid<Real>::_W_15); -static const Pb::Register _R_69("Grid<Real>", "sub", Grid<Real>::_W_16); -static const Pb::Register _R_70("Grid<Real>", "setConst", Grid<Real>::_W_17); -static const Pb::Register _R_71("Grid<Real>", "addConst", Grid<Real>::_W_18); -static const Pb::Register _R_72("Grid<Real>", "addScaled", Grid<Real>::_W_19); -static const Pb::Register _R_73("Grid<Real>", "mult", Grid<Real>::_W_20); -static const Pb::Register _R_74("Grid<Real>", "multConst", Grid<Real>::_W_21); -static const Pb::Register _R_75("Grid<Real>", "safeDivide", Grid<Real>::_W_22); -static const Pb::Register _R_76("Grid<Real>", "clamp", Grid<Real>::_W_23); -static const Pb::Register _R_77("Grid<Real>", "stomp", Grid<Real>::_W_24); -static const Pb::Register _R_78("Grid<Real>", "permuteAxes", Grid<Real>::_W_25); -static const Pb::Register _R_79("Grid<Real>", "permuteAxesCopyToGrid", Grid<Real>::_W_26); -static const Pb::Register _R_80("Grid<Real>", "join", Grid<Real>::_W_27); -static const Pb::Register _R_81("Grid<Real>", "getMaxAbs", Grid<Real>::_W_28); -static const Pb::Register _R_82("Grid<Real>", "getMax", Grid<Real>::_W_29); -static const Pb::Register _R_83("Grid<Real>", "getMin", Grid<Real>::_W_30); -static const Pb::Register _R_84("Grid<Real>", "getL1", Grid<Real>::_W_31); -static const Pb::Register _R_85("Grid<Real>", "getL2", Grid<Real>::_W_32); -static const Pb::Register _R_86("Grid<Real>", "setBound", Grid<Real>::_W_33); -static const Pb::Register _R_87("Grid<Real>", "setBoundNeumann", Grid<Real>::_W_34); -static const Pb::Register _R_88("Grid<Real>", "getDataPointer", Grid<Real>::_W_35); -static const Pb::Register _R_89("Grid<Real>", "printGrid", Grid<Real>::_W_36); +static const Pb::Register _R_62("Grid<Real>", "Grid", Grid<Real>::_W_10); +static const Pb::Register _R_63("Grid<Real>", "save", Grid<Real>::_W_11); +static const Pb::Register _R_64("Grid<Real>", "load", Grid<Real>::_W_12); +static const Pb::Register _R_65("Grid<Real>", "clear", Grid<Real>::_W_13); +static const Pb::Register _R_66("Grid<Real>", "copyFrom", Grid<Real>::_W_14); +static const Pb::Register _R_67("Grid<Real>", "getGridType", Grid<Real>::_W_15); +static const Pb::Register _R_68("Grid<Real>", "add", Grid<Real>::_W_16); +static const Pb::Register _R_69("Grid<Real>", "sub", Grid<Real>::_W_17); +static const Pb::Register _R_70("Grid<Real>", "setConst", Grid<Real>::_W_18); +static const Pb::Register _R_71("Grid<Real>", "addConst", Grid<Real>::_W_19); +static const Pb::Register _R_72("Grid<Real>", "addScaled", Grid<Real>::_W_20); +static const Pb::Register _R_73("Grid<Real>", "mult", Grid<Real>::_W_21); +static const Pb::Register _R_74("Grid<Real>", "multConst", Grid<Real>::_W_22); +static const Pb::Register _R_75("Grid<Real>", "safeDivide", Grid<Real>::_W_23); +static const Pb::Register _R_76("Grid<Real>", "clamp", Grid<Real>::_W_24); +static const Pb::Register _R_77("Grid<Real>", "stomp", Grid<Real>::_W_25); +static const Pb::Register _R_78("Grid<Real>", "permuteAxes", Grid<Real>::_W_26); +static const Pb::Register _R_79("Grid<Real>", "permuteAxesCopyToGrid", Grid<Real>::_W_27); +static const Pb::Register _R_80("Grid<Real>", "join", Grid<Real>::_W_28); +static const Pb::Register _R_81("Grid<Real>", "getMaxAbs", Grid<Real>::_W_29); +static const Pb::Register _R_82("Grid<Real>", "getMax", Grid<Real>::_W_30); +static const Pb::Register _R_83("Grid<Real>", "getMin", Grid<Real>::_W_31); +static const Pb::Register _R_84("Grid<Real>", "getL1", Grid<Real>::_W_32); +static const Pb::Register _R_85("Grid<Real>", "getL2", Grid<Real>::_W_33); +static const Pb::Register _R_86("Grid<Real>", "setBound", Grid<Real>::_W_34); +static const Pb::Register _R_87("Grid<Real>", "setBoundNeumann", Grid<Real>::_W_35); +static const Pb::Register _R_88("Grid<Real>", "getDataPointer", Grid<Real>::_W_36); +static const Pb::Register _R_89("Grid<Real>", "printGrid", Grid<Real>::_W_37); static const Pb::Register _R_90("Grid<Vec3>", "Grid<Vec3>", "GridBase"); template<> const char *Namify<Grid<Vec3>>::S = "Grid<Vec3>"; -static const Pb::Register _R_91("Grid<Vec3>", "Grid", Grid<Vec3>::_W_9); -static const Pb::Register _R_92("Grid<Vec3>", "save", Grid<Vec3>::_W_10); -static const Pb::Register _R_93("Grid<Vec3>", "load", Grid<Vec3>::_W_11); -static const Pb::Register _R_94("Grid<Vec3>", "clear", Grid<Vec3>::_W_12); -static const Pb::Register _R_95("Grid<Vec3>", "copyFrom", Grid<Vec3>::_W_13); -static const Pb::Register _R_96("Grid<Vec3>", "getGridType", Grid<Vec3>::_W_14); -static const Pb::Register _R_97("Grid<Vec3>", "add", Grid<Vec3>::_W_15); -static const Pb::Register _R_98("Grid<Vec3>", "sub", Grid<Vec3>::_W_16); -static const Pb::Register _R_99("Grid<Vec3>", "setConst", Grid<Vec3>::_W_17); -static const Pb::Register _R_100("Grid<Vec3>", "addConst", Grid<Vec3>::_W_18); -static const Pb::Register _R_101("Grid<Vec3>", "addScaled", Grid<Vec3>::_W_19); -static const Pb::Register _R_102("Grid<Vec3>", "mult", Grid<Vec3>::_W_20); -static const Pb::Register _R_103("Grid<Vec3>", "multConst", Grid<Vec3>::_W_21); -static const Pb::Register _R_104("Grid<Vec3>", "safeDivide", Grid<Vec3>::_W_22); -static const Pb::Register _R_105("Grid<Vec3>", "clamp", Grid<Vec3>::_W_23); -static const Pb::Register _R_106("Grid<Vec3>", "stomp", Grid<Vec3>::_W_24); -static const Pb::Register _R_107("Grid<Vec3>", "permuteAxes", Grid<Vec3>::_W_25); -static const Pb::Register _R_108("Grid<Vec3>", "permuteAxesCopyToGrid", Grid<Vec3>::_W_26); -static const Pb::Register _R_109("Grid<Vec3>", "join", Grid<Vec3>::_W_27); -static const Pb::Register _R_110("Grid<Vec3>", "getMaxAbs", Grid<Vec3>::_W_28); -static const Pb::Register _R_111("Grid<Vec3>", "getMax", Grid<Vec3>::_W_29); -static const Pb::Register _R_112("Grid<Vec3>", "getMin", Grid<Vec3>::_W_30); -static const Pb::Register _R_113("Grid<Vec3>", "getL1", Grid<Vec3>::_W_31); -static const Pb::Register _R_114("Grid<Vec3>", "getL2", Grid<Vec3>::_W_32); -static const Pb::Register _R_115("Grid<Vec3>", "setBound", Grid<Vec3>::_W_33); -static const Pb::Register _R_116("Grid<Vec3>", "setBoundNeumann", Grid<Vec3>::_W_34); -static const Pb::Register _R_117("Grid<Vec3>", "getDataPointer", Grid<Vec3>::_W_35); -static const Pb::Register _R_118("Grid<Vec3>", "printGrid", Grid<Vec3>::_W_36); +static const Pb::Register _R_91("Grid<Vec3>", "Grid", Grid<Vec3>::_W_10); +static const Pb::Register _R_92("Grid<Vec3>", "save", Grid<Vec3>::_W_11); +static const Pb::Register _R_93("Grid<Vec3>", "load", Grid<Vec3>::_W_12); +static const Pb::Register _R_94("Grid<Vec3>", "clear", Grid<Vec3>::_W_13); +static const Pb::Register _R_95("Grid<Vec3>", "copyFrom", Grid<Vec3>::_W_14); +static const Pb::Register _R_96("Grid<Vec3>", "getGridType", Grid<Vec3>::_W_15); +static const Pb::Register _R_97("Grid<Vec3>", "add", Grid<Vec3>::_W_16); +static const Pb::Register _R_98("Grid<Vec3>", "sub", Grid<Vec3>::_W_17); +static const Pb::Register _R_99("Grid<Vec3>", "setConst", Grid<Vec3>::_W_18); +static const Pb::Register _R_100("Grid<Vec3>", "addConst", Grid<Vec3>::_W_19); +static const Pb::Register _R_101("Grid<Vec3>", "addScaled", Grid<Vec3>::_W_20); +static const Pb::Register _R_102("Grid<Vec3>", "mult", Grid<Vec3>::_W_21); +static const Pb::Register _R_103("Grid<Vec3>", "multConst", Grid<Vec3>::_W_22); +static const Pb::Register _R_104("Grid<Vec3>", "safeDivide", Grid<Vec3>::_W_23); +static const Pb::Register _R_105("Grid<Vec3>", "clamp", Grid<Vec3>::_W_24); +static const Pb::Register _R_106("Grid<Vec3>", "stomp", Grid<Vec3>::_W_25); +static const Pb::Register _R_107("Grid<Vec3>", "permuteAxes", Grid<Vec3>::_W_26); +static const Pb::Register _R_108("Grid<Vec3>", "permuteAxesCopyToGrid", Grid<Vec3>::_W_27); +static const Pb::Register _R_109("Grid<Vec3>", "join", Grid<Vec3>::_W_28); +static const Pb::Register _R_110("Grid<Vec3>", "getMaxAbs", Grid<Vec3>::_W_29); +static const Pb::Register _R_111("Grid<Vec3>", "getMax", Grid<Vec3>::_W_30); +static const Pb::Register _R_112("Grid<Vec3>", "getMin", Grid<Vec3>::_W_31); +static const Pb::Register _R_113("Grid<Vec3>", "getL1", Grid<Vec3>::_W_32); +static const Pb::Register _R_114("Grid<Vec3>", "getL2", Grid<Vec3>::_W_33); +static const Pb::Register _R_115("Grid<Vec3>", "setBound", Grid<Vec3>::_W_34); +static const Pb::Register _R_116("Grid<Vec3>", "setBoundNeumann", Grid<Vec3>::_W_35); +static const Pb::Register _R_117("Grid<Vec3>", "getDataPointer", Grid<Vec3>::_W_36); +static const Pb::Register _R_118("Grid<Vec3>", "printGrid", Grid<Vec3>::_W_37); #endif #ifdef _C_GridBase static const Pb::Register _R_119("GridBase", "GridBase", "PbClass"); @@ -118,12 +118,13 @@ static const Pb::Register _R_125("GridBase", "is3D", GridBase::_W_5); static const Pb::Register _R_126("GridBase", "is4D", GridBase::_W_6); static const Pb::Register _R_127("GridBase", "getSizeT", GridBase::_W_7); static const Pb::Register _R_128("GridBase", "getStrideT", GridBase::_W_8); +static const Pb::Register _R_129("GridBase", "setName", GridBase::_W_9); #endif #ifdef _C_MACGrid -static const Pb::Register _R_129("MACGrid", "MACGrid", "Grid<Vec3>"); +static const Pb::Register _R_130("MACGrid", "MACGrid", "Grid<Vec3>"); template<> const char *Namify<MACGrid>::S = "MACGrid"; -static const Pb::Register _R_130("MACGrid", "MACGrid", MACGrid::_W_37); -static const Pb::Register _R_131("MACGrid", "setBoundMAC", MACGrid::_W_38); +static const Pb::Register _R_131("MACGrid", "MACGrid", MACGrid::_W_38); +static const Pb::Register _R_132("MACGrid", "setBoundMAC", MACGrid::_W_39); #endif static const Pb::Register _R_7("GridType_TypeNone", 0); static const Pb::Register _R_8("GridType_TypeReal", 1); @@ -253,6 +254,7 @@ void PbRegister_file_7() KEEP_UNUSED(_R_129); KEEP_UNUSED(_R_130); KEEP_UNUSED(_R_131); + KEEP_UNUSED(_R_132); } } } // namespace Manta
\ No newline at end of file diff --git a/extern/mantaflow/preprocessed/particle.cpp b/extern/mantaflow/preprocessed/particle.cpp index 6e1ef2fa5d8..8c26156358d 100644 --- a/extern/mantaflow/preprocessed/particle.cpp +++ b/extern/mantaflow/preprocessed/particle.cpp @@ -29,7 +29,7 @@ using namespace std; namespace Manta { ParticleBase::ParticleBase(FluidSolver *parent) - : PbClass(parent), mAllowCompress(true), mFreePdata(false) + : PbClass(parent), mMaxParticles(0), mAllowCompress(true), mFreePdata(false) { } diff --git a/extern/mantaflow/preprocessed/particle.h b/extern/mantaflow/preprocessed/particle.h index 0be141ed26f..da6733b6845 100644 --- a/extern/mantaflow/preprocessed/particle.h +++ b/extern/mantaflow/preprocessed/particle.h @@ -100,6 +100,17 @@ class ParticleBase : public PbClass { //! threads) inline void addBuffered(const Vec3 &pos, int flag = 0); + virtual void resize(IndexInt size) + { + assertMsg(false, "Dont use, override..."); + return; + } + virtual void resizeAll(IndexInt size) + { + assertMsg(false, "Dont use, override..."); + return; + } + //! particle data functions //! create a particle data object @@ -152,6 +163,20 @@ class ParticleBase : public PbClass { return mPartData[i]; } + //! expose maximum number of particles to python + int mMaxParticles; + static PyObject *_GET_mMaxParticles(PyObject *self, void *cl) + { + ParticleBase *pbo = dynamic_cast<ParticleBase *>(Pb::objFromPy(self)); + return toPy(pbo->mMaxParticles); + } + static int _SET_mMaxParticles(PyObject *self, PyObject *val, void *cl) + { + ParticleBase *pbo = dynamic_cast<ParticleBase *>(Pb::objFromPy(self)); + pbo->mMaxParticles = fromPy<int>(val); + return 0; + } + protected: //! new particle candidates std::vector<Vec3> mNewBufferPos; @@ -431,8 +456,14 @@ template<class S> class ParticleSystem : public ParticleBase { } //! insert buffered positions as new particles, update additional particle data void insertBufferedParticles(); + //! resize only the data vector, only use if you know what you're doing, otherwise use + //! resizeAll() + virtual void resize(IndexInt size) + { + mData.resize(size); + } //! resize data vector, and all pdata fields - void resizeAll(IndexInt newsize); + virtual void resizeAll(IndexInt size); //! adding and deleting inline void kill(IndexInt idx); @@ -877,11 +908,6 @@ class ParticleIndexSystem : public ParticleSystem<ParticleIndexData> { return -1; } }; - //! we only need a resize function... - void resize(IndexInt size) - { - mData.resize(size); - } public: PbArgs _args; } @@ -2479,28 +2505,66 @@ template<class S> void ParticleSystem<S>::insertBufferedParticles() for (IndexInt i = 0; i < (IndexInt)mData.size(); ++i) mData[i].flag &= ~PNEW; - if (mNewBufferPos.size() == 0) + if (mNewBufferPos.empty()) return; - IndexInt newCnt = mData.size(); - resizeAll(newCnt + mNewBufferPos.size()); - - for (IndexInt i = 0; i < (IndexInt)mNewBufferPos.size(); ++i) { - int flag = (mNewBufferFlag.size() > 0) ? mNewBufferFlag[i] : 0; - // note, other fields are not initialized here... - mData[newCnt].pos = mNewBufferPos[i]; - mData[newCnt].flag = PNEW | flag; + IndexInt bufferSize = mNewBufferPos.size(); + IndexInt partsSize = mData.size(); + + if (mMaxParticles > 0) + assertMsg(mMaxParticles >= partsSize, + "Particle system cannot contain more particles that the maximum allowed number"); + + // max number of new particles that can be inserted, adjusted buffer size when using maxParticles + // field + IndexInt numNewParts = (mMaxParticles > 0) ? mMaxParticles - mData.size() : bufferSize; + if (numNewParts > bufferSize) + numNewParts = bufferSize; // upper clamp + + assertMsg(numNewParts >= 0, "Must not have negative number of new particles"); + + // new size of particle system + IndexInt newSize = mData.size() + numNewParts; + if (mMaxParticles > 0) + assertMsg(newSize <= mMaxParticles, + "Particle system cannot contain more particles that the maximum allowed number"); + resizeAll(newSize); + + int insertFlag; + Vec3 insertPos; + static RandomStream mRand(9832); + for (IndexInt i = 0; i < numNewParts; ++i) { + + // get random index in newBuffer vector + // we are inserting particles randomly so that they are sampled uniformly in the fluid region + // otherwise, regions of fluid can remain completely empty once mData.size() == maxParticles is + // reached. + int randIndex = floor(mRand.getReal() * mNewBufferPos.size()); + + // get elements from new buffers with random index + std::swap(mNewBufferPos[randIndex], mNewBufferPos.back()); + insertPos = mNewBufferPos.back(); + mNewBufferPos.pop_back(); + + insertFlag = 0; + if (!mNewBufferFlag.empty()) { + std::swap(mNewBufferFlag[randIndex], mNewBufferFlag.back()); + insertFlag = mNewBufferFlag.back(); + mNewBufferFlag.pop_back(); + } + + mData[partsSize].pos = insertPos; + mData[partsSize].flag = PNEW | insertFlag; + // now init pdata fields from associated grids... for (IndexInt pd = 0; pd < (IndexInt)mPdataReal.size(); ++pd) - mPdataReal[pd]->initNewValue(newCnt, mNewBufferPos[i]); + mPdataReal[pd]->initNewValue(partsSize, insertPos); for (IndexInt pd = 0; pd < (IndexInt)mPdataVec3.size(); ++pd) - mPdataVec3[pd]->initNewValue(newCnt, mNewBufferPos[i]); + mPdataVec3[pd]->initNewValue(partsSize, insertPos); for (IndexInt pd = 0; pd < (IndexInt)mPdataInt.size(); ++pd) - mPdataInt[pd]->initNewValue(newCnt, mNewBufferPos[i]); - newCnt++; + mPdataInt[pd]->initNewValue(partsSize, insertPos); + partsSize++; } - if (mNewBufferPos.size() > 0) - debMsg("Added & initialized " << (IndexInt)mNewBufferPos.size() << " particles", - 2); // debug info + debMsg("Added & initialized " << numNewParts << " particles", 2); // debug info mNewBufferPos.clear(); mNewBufferFlag.clear(); } diff --git a/extern/mantaflow/preprocessed/particle.h.reg.cpp b/extern/mantaflow/preprocessed/particle.h.reg.cpp index 6e0466d0203..e9e538ad097 100644 --- a/extern/mantaflow/preprocessed/particle.h.reg.cpp +++ b/extern/mantaflow/preprocessed/particle.h.reg.cpp @@ -29,279 +29,283 @@ static const Pb::Register _R_21("ParticleBase", "ParticleBase", "PbClass"); template<> const char *Namify<ParticleBase>::S = "ParticleBase"; static const Pb::Register _R_22("ParticleBase", "ParticleBase", ParticleBase::_W_0); static const Pb::Register _R_23("ParticleBase", "create", ParticleBase::_W_1); +static const Pb::Register _R_24("ParticleBase", + "maxParticles", + ParticleBase::_GET_mMaxParticles, + ParticleBase::_SET_mMaxParticles); #endif #ifdef _C_ParticleDataBase -static const Pb::Register _R_24("ParticleDataBase", "ParticleDataBase", "PbClass"); +static const Pb::Register _R_25("ParticleDataBase", "ParticleDataBase", "PbClass"); template<> const char *Namify<ParticleDataBase>::S = "ParticleDataBase"; -static const Pb::Register _R_25("ParticleDataBase", "ParticleDataBase", ParticleDataBase::_W_21); +static const Pb::Register _R_26("ParticleDataBase", "ParticleDataBase", ParticleDataBase::_W_21); #endif #ifdef _C_ParticleDataImpl -static const Pb::Register _R_26("ParticleDataImpl<int>", +static const Pb::Register _R_27("ParticleDataImpl<int>", "ParticleDataImpl<int>", "ParticleDataBase"); template<> const char *Namify<ParticleDataImpl<int>>::S = "ParticleDataImpl<int>"; -static const Pb::Register _R_27("ParticleDataImpl<int>", +static const Pb::Register _R_28("ParticleDataImpl<int>", "ParticleDataImpl", ParticleDataImpl<int>::_W_22); -static const Pb::Register _R_28("ParticleDataImpl<int>", "clear", ParticleDataImpl<int>::_W_23); -static const Pb::Register _R_29("ParticleDataImpl<int>", +static const Pb::Register _R_29("ParticleDataImpl<int>", "clear", ParticleDataImpl<int>::_W_23); +static const Pb::Register _R_30("ParticleDataImpl<int>", "setSource", ParticleDataImpl<int>::_W_24); -static const Pb::Register _R_30("ParticleDataImpl<int>", "copyFrom", ParticleDataImpl<int>::_W_25); -static const Pb::Register _R_31("ParticleDataImpl<int>", "setConst", ParticleDataImpl<int>::_W_26); -static const Pb::Register _R_32("ParticleDataImpl<int>", +static const Pb::Register _R_31("ParticleDataImpl<int>", "copyFrom", ParticleDataImpl<int>::_W_25); +static const Pb::Register _R_32("ParticleDataImpl<int>", "setConst", ParticleDataImpl<int>::_W_26); +static const Pb::Register _R_33("ParticleDataImpl<int>", "setConstRange", ParticleDataImpl<int>::_W_27); -static const Pb::Register _R_33("ParticleDataImpl<int>", "add", ParticleDataImpl<int>::_W_28); -static const Pb::Register _R_34("ParticleDataImpl<int>", "sub", ParticleDataImpl<int>::_W_29); -static const Pb::Register _R_35("ParticleDataImpl<int>", "addConst", ParticleDataImpl<int>::_W_30); -static const Pb::Register _R_36("ParticleDataImpl<int>", +static const Pb::Register _R_34("ParticleDataImpl<int>", "add", ParticleDataImpl<int>::_W_28); +static const Pb::Register _R_35("ParticleDataImpl<int>", "sub", ParticleDataImpl<int>::_W_29); +static const Pb::Register _R_36("ParticleDataImpl<int>", "addConst", ParticleDataImpl<int>::_W_30); +static const Pb::Register _R_37("ParticleDataImpl<int>", "addScaled", ParticleDataImpl<int>::_W_31); -static const Pb::Register _R_37("ParticleDataImpl<int>", "mult", ParticleDataImpl<int>::_W_32); -static const Pb::Register _R_38("ParticleDataImpl<int>", +static const Pb::Register _R_38("ParticleDataImpl<int>", "mult", ParticleDataImpl<int>::_W_32); +static const Pb::Register _R_39("ParticleDataImpl<int>", "multConst", ParticleDataImpl<int>::_W_33); -static const Pb::Register _R_39("ParticleDataImpl<int>", "safeDiv", ParticleDataImpl<int>::_W_34); -static const Pb::Register _R_40("ParticleDataImpl<int>", "clamp", ParticleDataImpl<int>::_W_35); -static const Pb::Register _R_41("ParticleDataImpl<int>", "clampMin", ParticleDataImpl<int>::_W_36); -static const Pb::Register _R_42("ParticleDataImpl<int>", "clampMax", ParticleDataImpl<int>::_W_37); -static const Pb::Register _R_43("ParticleDataImpl<int>", +static const Pb::Register _R_40("ParticleDataImpl<int>", "safeDiv", ParticleDataImpl<int>::_W_34); +static const Pb::Register _R_41("ParticleDataImpl<int>", "clamp", ParticleDataImpl<int>::_W_35); +static const Pb::Register _R_42("ParticleDataImpl<int>", "clampMin", ParticleDataImpl<int>::_W_36); +static const Pb::Register _R_43("ParticleDataImpl<int>", "clampMax", ParticleDataImpl<int>::_W_37); +static const Pb::Register _R_44("ParticleDataImpl<int>", "getMaxAbs", ParticleDataImpl<int>::_W_38); -static const Pb::Register _R_44("ParticleDataImpl<int>", "getMax", ParticleDataImpl<int>::_W_39); -static const Pb::Register _R_45("ParticleDataImpl<int>", "getMin", ParticleDataImpl<int>::_W_40); -static const Pb::Register _R_46("ParticleDataImpl<int>", "sum", ParticleDataImpl<int>::_W_41); -static const Pb::Register _R_47("ParticleDataImpl<int>", +static const Pb::Register _R_45("ParticleDataImpl<int>", "getMax", ParticleDataImpl<int>::_W_39); +static const Pb::Register _R_46("ParticleDataImpl<int>", "getMin", ParticleDataImpl<int>::_W_40); +static const Pb::Register _R_47("ParticleDataImpl<int>", "sum", ParticleDataImpl<int>::_W_41); +static const Pb::Register _R_48("ParticleDataImpl<int>", "sumSquare", ParticleDataImpl<int>::_W_42); -static const Pb::Register _R_48("ParticleDataImpl<int>", +static const Pb::Register _R_49("ParticleDataImpl<int>", "sumMagnitude", ParticleDataImpl<int>::_W_43); -static const Pb::Register _R_49("ParticleDataImpl<int>", +static const Pb::Register _R_50("ParticleDataImpl<int>", "setConstIntFlag", ParticleDataImpl<int>::_W_44); -static const Pb::Register _R_50("ParticleDataImpl<int>", +static const Pb::Register _R_51("ParticleDataImpl<int>", "printPdata", ParticleDataImpl<int>::_W_45); -static const Pb::Register _R_51("ParticleDataImpl<int>", "save", ParticleDataImpl<int>::_W_46); -static const Pb::Register _R_52("ParticleDataImpl<int>", "load", ParticleDataImpl<int>::_W_47); -static const Pb::Register _R_53("ParticleDataImpl<int>", +static const Pb::Register _R_52("ParticleDataImpl<int>", "save", ParticleDataImpl<int>::_W_46); +static const Pb::Register _R_53("ParticleDataImpl<int>", "load", ParticleDataImpl<int>::_W_47); +static const Pb::Register _R_54("ParticleDataImpl<int>", "getDataPointer", ParticleDataImpl<int>::_W_48); -static const Pb::Register _R_54("ParticleDataImpl<Real>", +static const Pb::Register _R_55("ParticleDataImpl<Real>", "ParticleDataImpl<Real>", "ParticleDataBase"); template<> const char *Namify<ParticleDataImpl<Real>>::S = "ParticleDataImpl<Real>"; -static const Pb::Register _R_55("ParticleDataImpl<Real>", +static const Pb::Register _R_56("ParticleDataImpl<Real>", "ParticleDataImpl", ParticleDataImpl<Real>::_W_22); -static const Pb::Register _R_56("ParticleDataImpl<Real>", "clear", ParticleDataImpl<Real>::_W_23); -static const Pb::Register _R_57("ParticleDataImpl<Real>", +static const Pb::Register _R_57("ParticleDataImpl<Real>", "clear", ParticleDataImpl<Real>::_W_23); +static const Pb::Register _R_58("ParticleDataImpl<Real>", "setSource", ParticleDataImpl<Real>::_W_24); -static const Pb::Register _R_58("ParticleDataImpl<Real>", +static const Pb::Register _R_59("ParticleDataImpl<Real>", "copyFrom", ParticleDataImpl<Real>::_W_25); -static const Pb::Register _R_59("ParticleDataImpl<Real>", +static const Pb::Register _R_60("ParticleDataImpl<Real>", "setConst", ParticleDataImpl<Real>::_W_26); -static const Pb::Register _R_60("ParticleDataImpl<Real>", +static const Pb::Register _R_61("ParticleDataImpl<Real>", "setConstRange", ParticleDataImpl<Real>::_W_27); -static const Pb::Register _R_61("ParticleDataImpl<Real>", "add", ParticleDataImpl<Real>::_W_28); -static const Pb::Register _R_62("ParticleDataImpl<Real>", "sub", ParticleDataImpl<Real>::_W_29); -static const Pb::Register _R_63("ParticleDataImpl<Real>", +static const Pb::Register _R_62("ParticleDataImpl<Real>", "add", ParticleDataImpl<Real>::_W_28); +static const Pb::Register _R_63("ParticleDataImpl<Real>", "sub", ParticleDataImpl<Real>::_W_29); +static const Pb::Register _R_64("ParticleDataImpl<Real>", "addConst", ParticleDataImpl<Real>::_W_30); -static const Pb::Register _R_64("ParticleDataImpl<Real>", +static const Pb::Register _R_65("ParticleDataImpl<Real>", "addScaled", ParticleDataImpl<Real>::_W_31); -static const Pb::Register _R_65("ParticleDataImpl<Real>", "mult", ParticleDataImpl<Real>::_W_32); -static const Pb::Register _R_66("ParticleDataImpl<Real>", +static const Pb::Register _R_66("ParticleDataImpl<Real>", "mult", ParticleDataImpl<Real>::_W_32); +static const Pb::Register _R_67("ParticleDataImpl<Real>", "multConst", ParticleDataImpl<Real>::_W_33); -static const Pb::Register _R_67("ParticleDataImpl<Real>", +static const Pb::Register _R_68("ParticleDataImpl<Real>", "safeDiv", ParticleDataImpl<Real>::_W_34); -static const Pb::Register _R_68("ParticleDataImpl<Real>", "clamp", ParticleDataImpl<Real>::_W_35); -static const Pb::Register _R_69("ParticleDataImpl<Real>", +static const Pb::Register _R_69("ParticleDataImpl<Real>", "clamp", ParticleDataImpl<Real>::_W_35); +static const Pb::Register _R_70("ParticleDataImpl<Real>", "clampMin", ParticleDataImpl<Real>::_W_36); -static const Pb::Register _R_70("ParticleDataImpl<Real>", +static const Pb::Register _R_71("ParticleDataImpl<Real>", "clampMax", ParticleDataImpl<Real>::_W_37); -static const Pb::Register _R_71("ParticleDataImpl<Real>", +static const Pb::Register _R_72("ParticleDataImpl<Real>", "getMaxAbs", ParticleDataImpl<Real>::_W_38); -static const Pb::Register _R_72("ParticleDataImpl<Real>", "getMax", ParticleDataImpl<Real>::_W_39); -static const Pb::Register _R_73("ParticleDataImpl<Real>", "getMin", ParticleDataImpl<Real>::_W_40); -static const Pb::Register _R_74("ParticleDataImpl<Real>", "sum", ParticleDataImpl<Real>::_W_41); -static const Pb::Register _R_75("ParticleDataImpl<Real>", +static const Pb::Register _R_73("ParticleDataImpl<Real>", "getMax", ParticleDataImpl<Real>::_W_39); +static const Pb::Register _R_74("ParticleDataImpl<Real>", "getMin", ParticleDataImpl<Real>::_W_40); +static const Pb::Register _R_75("ParticleDataImpl<Real>", "sum", ParticleDataImpl<Real>::_W_41); +static const Pb::Register _R_76("ParticleDataImpl<Real>", "sumSquare", ParticleDataImpl<Real>::_W_42); -static const Pb::Register _R_76("ParticleDataImpl<Real>", +static const Pb::Register _R_77("ParticleDataImpl<Real>", "sumMagnitude", ParticleDataImpl<Real>::_W_43); -static const Pb::Register _R_77("ParticleDataImpl<Real>", +static const Pb::Register _R_78("ParticleDataImpl<Real>", "setConstIntFlag", ParticleDataImpl<Real>::_W_44); -static const Pb::Register _R_78("ParticleDataImpl<Real>", +static const Pb::Register _R_79("ParticleDataImpl<Real>", "printPdata", ParticleDataImpl<Real>::_W_45); -static const Pb::Register _R_79("ParticleDataImpl<Real>", "save", ParticleDataImpl<Real>::_W_46); -static const Pb::Register _R_80("ParticleDataImpl<Real>", "load", ParticleDataImpl<Real>::_W_47); -static const Pb::Register _R_81("ParticleDataImpl<Real>", +static const Pb::Register _R_80("ParticleDataImpl<Real>", "save", ParticleDataImpl<Real>::_W_46); +static const Pb::Register _R_81("ParticleDataImpl<Real>", "load", ParticleDataImpl<Real>::_W_47); +static const Pb::Register _R_82("ParticleDataImpl<Real>", "getDataPointer", ParticleDataImpl<Real>::_W_48); -static const Pb::Register _R_82("ParticleDataImpl<Vec3>", +static const Pb::Register _R_83("ParticleDataImpl<Vec3>", "ParticleDataImpl<Vec3>", "ParticleDataBase"); template<> const char *Namify<ParticleDataImpl<Vec3>>::S = "ParticleDataImpl<Vec3>"; -static const Pb::Register _R_83("ParticleDataImpl<Vec3>", +static const Pb::Register _R_84("ParticleDataImpl<Vec3>", "ParticleDataImpl", ParticleDataImpl<Vec3>::_W_22); -static const Pb::Register _R_84("ParticleDataImpl<Vec3>", "clear", ParticleDataImpl<Vec3>::_W_23); -static const Pb::Register _R_85("ParticleDataImpl<Vec3>", +static const Pb::Register _R_85("ParticleDataImpl<Vec3>", "clear", ParticleDataImpl<Vec3>::_W_23); +static const Pb::Register _R_86("ParticleDataImpl<Vec3>", "setSource", ParticleDataImpl<Vec3>::_W_24); -static const Pb::Register _R_86("ParticleDataImpl<Vec3>", +static const Pb::Register _R_87("ParticleDataImpl<Vec3>", "copyFrom", ParticleDataImpl<Vec3>::_W_25); -static const Pb::Register _R_87("ParticleDataImpl<Vec3>", +static const Pb::Register _R_88("ParticleDataImpl<Vec3>", "setConst", ParticleDataImpl<Vec3>::_W_26); -static const Pb::Register _R_88("ParticleDataImpl<Vec3>", +static const Pb::Register _R_89("ParticleDataImpl<Vec3>", "setConstRange", ParticleDataImpl<Vec3>::_W_27); -static const Pb::Register _R_89("ParticleDataImpl<Vec3>", "add", ParticleDataImpl<Vec3>::_W_28); -static const Pb::Register _R_90("ParticleDataImpl<Vec3>", "sub", ParticleDataImpl<Vec3>::_W_29); -static const Pb::Register _R_91("ParticleDataImpl<Vec3>", +static const Pb::Register _R_90("ParticleDataImpl<Vec3>", "add", ParticleDataImpl<Vec3>::_W_28); +static const Pb::Register _R_91("ParticleDataImpl<Vec3>", "sub", ParticleDataImpl<Vec3>::_W_29); +static const Pb::Register _R_92("ParticleDataImpl<Vec3>", "addConst", ParticleDataImpl<Vec3>::_W_30); -static const Pb::Register _R_92("ParticleDataImpl<Vec3>", +static const Pb::Register _R_93("ParticleDataImpl<Vec3>", "addScaled", ParticleDataImpl<Vec3>::_W_31); -static const Pb::Register _R_93("ParticleDataImpl<Vec3>", "mult", ParticleDataImpl<Vec3>::_W_32); -static const Pb::Register _R_94("ParticleDataImpl<Vec3>", +static const Pb::Register _R_94("ParticleDataImpl<Vec3>", "mult", ParticleDataImpl<Vec3>::_W_32); +static const Pb::Register _R_95("ParticleDataImpl<Vec3>", "multConst", ParticleDataImpl<Vec3>::_W_33); -static const Pb::Register _R_95("ParticleDataImpl<Vec3>", +static const Pb::Register _R_96("ParticleDataImpl<Vec3>", "safeDiv", ParticleDataImpl<Vec3>::_W_34); -static const Pb::Register _R_96("ParticleDataImpl<Vec3>", "clamp", ParticleDataImpl<Vec3>::_W_35); -static const Pb::Register _R_97("ParticleDataImpl<Vec3>", +static const Pb::Register _R_97("ParticleDataImpl<Vec3>", "clamp", ParticleDataImpl<Vec3>::_W_35); +static const Pb::Register _R_98("ParticleDataImpl<Vec3>", "clampMin", ParticleDataImpl<Vec3>::_W_36); -static const Pb::Register _R_98("ParticleDataImpl<Vec3>", +static const Pb::Register _R_99("ParticleDataImpl<Vec3>", "clampMax", ParticleDataImpl<Vec3>::_W_37); -static const Pb::Register _R_99("ParticleDataImpl<Vec3>", - "getMaxAbs", - ParticleDataImpl<Vec3>::_W_38); static const Pb::Register _R_100("ParticleDataImpl<Vec3>", + "getMaxAbs", + ParticleDataImpl<Vec3>::_W_38); +static const Pb::Register _R_101("ParticleDataImpl<Vec3>", "getMax", ParticleDataImpl<Vec3>::_W_39); -static const Pb::Register _R_101("ParticleDataImpl<Vec3>", +static const Pb::Register _R_102("ParticleDataImpl<Vec3>", "getMin", ParticleDataImpl<Vec3>::_W_40); -static const Pb::Register _R_102("ParticleDataImpl<Vec3>", "sum", ParticleDataImpl<Vec3>::_W_41); -static const Pb::Register _R_103("ParticleDataImpl<Vec3>", +static const Pb::Register _R_103("ParticleDataImpl<Vec3>", "sum", ParticleDataImpl<Vec3>::_W_41); +static const Pb::Register _R_104("ParticleDataImpl<Vec3>", "sumSquare", ParticleDataImpl<Vec3>::_W_42); -static const Pb::Register _R_104("ParticleDataImpl<Vec3>", +static const Pb::Register _R_105("ParticleDataImpl<Vec3>", "sumMagnitude", ParticleDataImpl<Vec3>::_W_43); -static const Pb::Register _R_105("ParticleDataImpl<Vec3>", +static const Pb::Register _R_106("ParticleDataImpl<Vec3>", "setConstIntFlag", ParticleDataImpl<Vec3>::_W_44); -static const Pb::Register _R_106("ParticleDataImpl<Vec3>", +static const Pb::Register _R_107("ParticleDataImpl<Vec3>", "printPdata", ParticleDataImpl<Vec3>::_W_45); -static const Pb::Register _R_107("ParticleDataImpl<Vec3>", "save", ParticleDataImpl<Vec3>::_W_46); -static const Pb::Register _R_108("ParticleDataImpl<Vec3>", "load", ParticleDataImpl<Vec3>::_W_47); -static const Pb::Register _R_109("ParticleDataImpl<Vec3>", +static const Pb::Register _R_108("ParticleDataImpl<Vec3>", "save", ParticleDataImpl<Vec3>::_W_46); +static const Pb::Register _R_109("ParticleDataImpl<Vec3>", "load", ParticleDataImpl<Vec3>::_W_47); +static const Pb::Register _R_110("ParticleDataImpl<Vec3>", "getDataPointer", ParticleDataImpl<Vec3>::_W_48); #endif #ifdef _C_ParticleIndexSystem -static const Pb::Register _R_110("ParticleIndexSystem", +static const Pb::Register _R_111("ParticleIndexSystem", "ParticleIndexSystem", "ParticleSystem<ParticleIndexData>"); template<> const char *Namify<ParticleIndexSystem>::S = "ParticleIndexSystem"; -static const Pb::Register _R_111("ParticleIndexSystem", +static const Pb::Register _R_112("ParticleIndexSystem", "ParticleIndexSystem", ParticleIndexSystem::_W_19); #endif #ifdef _C_ParticleSystem -static const Pb::Register _R_112("ParticleSystem<BasicParticleData>", +static const Pb::Register _R_113("ParticleSystem<BasicParticleData>", "ParticleSystem<BasicParticleData>", "ParticleBase"); template<> const char *Namify<ParticleSystem<BasicParticleData>>::S = "ParticleSystem<BasicParticleData>"; -static const Pb::Register _R_113("ParticleSystem<BasicParticleData>", +static const Pb::Register _R_114("ParticleSystem<BasicParticleData>", "ParticleSystem", ParticleSystem<BasicParticleData>::_W_2); -static const Pb::Register _R_114("ParticleSystem<BasicParticleData>", +static const Pb::Register _R_115("ParticleSystem<BasicParticleData>", "pySize", ParticleSystem<BasicParticleData>::_W_3); -static const Pb::Register _R_115("ParticleSystem<BasicParticleData>", +static const Pb::Register _R_116("ParticleSystem<BasicParticleData>", "setPos", ParticleSystem<BasicParticleData>::_W_4); -static const Pb::Register _R_116("ParticleSystem<BasicParticleData>", +static const Pb::Register _R_117("ParticleSystem<BasicParticleData>", "getPos", ParticleSystem<BasicParticleData>::_W_5); -static const Pb::Register _R_117("ParticleSystem<BasicParticleData>", +static const Pb::Register _R_118("ParticleSystem<BasicParticleData>", "getPosPdata", ParticleSystem<BasicParticleData>::_W_6); -static const Pb::Register _R_118("ParticleSystem<BasicParticleData>", +static const Pb::Register _R_119("ParticleSystem<BasicParticleData>", "setPosPdata", ParticleSystem<BasicParticleData>::_W_7); -static const Pb::Register _R_119("ParticleSystem<BasicParticleData>", +static const Pb::Register _R_120("ParticleSystem<BasicParticleData>", "clear", ParticleSystem<BasicParticleData>::_W_8); -static const Pb::Register _R_120("ParticleSystem<BasicParticleData>", +static const Pb::Register _R_121("ParticleSystem<BasicParticleData>", "advectInGrid", ParticleSystem<BasicParticleData>::_W_9); -static const Pb::Register _R_121("ParticleSystem<BasicParticleData>", +static const Pb::Register _R_122("ParticleSystem<BasicParticleData>", "projectOutside", ParticleSystem<BasicParticleData>::_W_10); -static const Pb::Register _R_122("ParticleSystem<BasicParticleData>", +static const Pb::Register _R_123("ParticleSystem<BasicParticleData>", "projectOutOfBnd", ParticleSystem<BasicParticleData>::_W_11); -static const Pb::Register _R_123("ParticleSystem<ParticleIndexData>", +static const Pb::Register _R_124("ParticleSystem<ParticleIndexData>", "ParticleSystem<ParticleIndexData>", "ParticleBase"); template<> const char *Namify<ParticleSystem<ParticleIndexData>>::S = "ParticleSystem<ParticleIndexData>"; -static const Pb::Register _R_124("ParticleSystem<ParticleIndexData>", +static const Pb::Register _R_125("ParticleSystem<ParticleIndexData>", "ParticleSystem", ParticleSystem<ParticleIndexData>::_W_2); -static const Pb::Register _R_125("ParticleSystem<ParticleIndexData>", +static const Pb::Register _R_126("ParticleSystem<ParticleIndexData>", "pySize", ParticleSystem<ParticleIndexData>::_W_3); -static const Pb::Register _R_126("ParticleSystem<ParticleIndexData>", +static const Pb::Register _R_127("ParticleSystem<ParticleIndexData>", "setPos", ParticleSystem<ParticleIndexData>::_W_4); -static const Pb::Register _R_127("ParticleSystem<ParticleIndexData>", +static const Pb::Register _R_128("ParticleSystem<ParticleIndexData>", "getPos", ParticleSystem<ParticleIndexData>::_W_5); -static const Pb::Register _R_128("ParticleSystem<ParticleIndexData>", +static const Pb::Register _R_129("ParticleSystem<ParticleIndexData>", "getPosPdata", ParticleSystem<ParticleIndexData>::_W_6); -static const Pb::Register _R_129("ParticleSystem<ParticleIndexData>", +static const Pb::Register _R_130("ParticleSystem<ParticleIndexData>", "setPosPdata", ParticleSystem<ParticleIndexData>::_W_7); -static const Pb::Register _R_130("ParticleSystem<ParticleIndexData>", +static const Pb::Register _R_131("ParticleSystem<ParticleIndexData>", "clear", ParticleSystem<ParticleIndexData>::_W_8); -static const Pb::Register _R_131("ParticleSystem<ParticleIndexData>", +static const Pb::Register _R_132("ParticleSystem<ParticleIndexData>", "advectInGrid", ParticleSystem<ParticleIndexData>::_W_9); -static const Pb::Register _R_132("ParticleSystem<ParticleIndexData>", +static const Pb::Register _R_133("ParticleSystem<ParticleIndexData>", "projectOutside", ParticleSystem<ParticleIndexData>::_W_10); -static const Pb::Register _R_133("ParticleSystem<ParticleIndexData>", +static const Pb::Register _R_134("ParticleSystem<ParticleIndexData>", "projectOutOfBnd", ParticleSystem<ParticleIndexData>::_W_11); #endif @@ -432,6 +436,7 @@ void PbRegister_file_10() KEEP_UNUSED(_R_131); KEEP_UNUSED(_R_132); KEEP_UNUSED(_R_133); + KEEP_UNUSED(_R_134); } } } // namespace Manta
\ No newline at end of file diff --git a/intern/clog/clog.c b/intern/clog/clog.c index 921ee17a672..d384b9a89e6 100644 --- a/intern/clog/clog.c +++ b/intern/clog/clog.c @@ -153,7 +153,6 @@ static void clg_str_reserve(CLogStringBuf *cstr, const uint len) cstr->data = data; cstr->is_alloc = true; } - cstr->len_alloc = len; } } @@ -179,26 +178,34 @@ static void clg_str_vappendf(CLogStringBuf *cstr, const char *fmt, va_list args) { /* Use limit because windows may use '-1' for a formatting error. */ const uint len_max = 65535; - uint len_avail = (cstr->len_alloc - cstr->len); - if (len_avail == 0) { - len_avail = CLOG_BUF_LEN_INIT; - clg_str_reserve(cstr, len_avail); - } while (true) { + uint len_avail = cstr->len_alloc - cstr->len; + va_list args_cpy; va_copy(args_cpy, args); int retval = vsnprintf(cstr->data + cstr->len, len_avail, fmt, args_cpy); va_end(args_cpy); - if (retval != -1) { - cstr->len += retval; + + if (retval < 0) { + /* Some encoding error happened, not much we can do here, besides skipping/cancelling this + * message. */ + break; + } + else if ((uint)retval <= len_avail) { + /* Copy was successful. */ + cstr->len += (uint)retval; break; } else { - len_avail *= 2; - if (len_avail >= len_max) { + /* vsnprintf was not successful, due to lack of allocated space, retval contains expected + * length of the formated string, use it to allocate required amount of memory. */ + uint len_alloc = cstr->len + (uint)retval; + if (len_alloc >= len_max) { + /* Safe upper-limit, just in case... */ break; } - clg_str_reserve(cstr, len_avail); + clg_str_reserve(cstr, len_alloc); + len_avail = cstr->len_alloc - cstr->len; } } } diff --git a/intern/cycles/blender/blender_camera.cpp b/intern/cycles/blender/blender_camera.cpp index 592a69585de..e1ab3b3fbc1 100644 --- a/intern/cycles/blender/blender_camera.cpp +++ b/intern/cycles/blender/blender_camera.cpp @@ -76,6 +76,9 @@ struct BlenderCamera { int full_width; int full_height; + int render_width; + int render_height; + BoundBox2D border; BoundBox2D pano_viewplane; BoundBox2D viewport_camera_border; @@ -126,8 +129,10 @@ static void blender_camera_init(BlenderCamera *bcam, BL::RenderSettings &b_rende bcam->matrix = transform_identity(); /* render resolution */ - bcam->full_width = render_resolution_x(b_render); - bcam->full_height = render_resolution_y(b_render); + bcam->render_width = render_resolution_x(b_render); + bcam->render_height = render_resolution_y(b_render); + bcam->full_width = bcam->render_width; + bcam->full_height = bcam->render_height; } static float blender_camera_focal_distance(BL::RenderEngine &b_engine, @@ -398,8 +403,8 @@ static void blender_camera_sync(Camera *cam, /* panorama sensor */ if (bcam->type == CAMERA_PANORAMA && bcam->panorama_type == PANORAMA_FISHEYE_EQUISOLID) { - float fit_xratio = (float)bcam->full_width * bcam->pixelaspect.x; - float fit_yratio = (float)bcam->full_height * bcam->pixelaspect.y; + float fit_xratio = (float)bcam->render_width * bcam->pixelaspect.x; + float fit_yratio = (float)bcam->render_height * bcam->pixelaspect.y; bool horizontal_fit; float sensor_size; diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index 391a1b8f473..a06030c8b7d 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -59,6 +59,7 @@ BlenderSession::BlenderSession(BL::RenderEngine &b_engine, BL::BlendData &b_data, bool preview_osl) : session(NULL), + scene(NULL), sync(NULL), b_engine(b_engine), b_userpref(b_userpref), @@ -88,6 +89,7 @@ BlenderSession::BlenderSession(BL::RenderEngine &b_engine, int width, int height) : session(NULL), + scene(NULL), sync(NULL), b_engine(b_engine), b_userpref(b_userpref), @@ -492,27 +494,15 @@ void BlenderSession::render(BL::Depsgraph &b_depsgraph_) /* Update denoising parameters. */ session->set_denoising(session_params.denoising); - bool use_denoising = session_params.denoising.use; - bool store_denoising_passes = session_params.denoising.store_passes; - - buffer_params.denoising_data_pass = use_denoising || store_denoising_passes; - buffer_params.denoising_clean_pass = (scene->film->denoising_flags & DENOISING_CLEAN_ALL_PASSES); - buffer_params.denoising_prefiltered_pass = store_denoising_passes && - session_params.denoising.type == DENOISER_NLM; - - scene->film->denoising_data_pass = buffer_params.denoising_data_pass; - scene->film->denoising_clean_pass = buffer_params.denoising_clean_pass; - scene->film->denoising_prefiltered_pass = buffer_params.denoising_prefiltered_pass; - - /* Add passes */ + /* Compute render passes and film settings. */ vector<Pass> passes = sync->sync_render_passes( b_rlay, b_view_layer, session_params.adaptive_sampling, session_params.denoising); - buffer_params.passes = passes; - scene->film->pass_alpha_threshold = b_view_layer.pass_alpha_threshold(); - scene->film->tag_passes_update(scene, passes); - scene->film->tag_update(scene); - scene->integrator->tag_update(scene); + /* Set buffer params, using film settings from sync_render_passes. */ + buffer_params.passes = passes; + buffer_params.denoising_data_pass = scene->film->denoising_data_pass; + buffer_params.denoising_clean_pass = scene->film->denoising_clean_pass; + buffer_params.denoising_prefiltered_pass = scene->film->denoising_prefiltered_pass; BL::RenderResult::views_iterator b_view_iter; @@ -982,7 +972,8 @@ void BlenderSession::update_status_progress() remaining_time = (1.0 - (double)progress) * (render_time / (double)progress); if (background) { - scene_status += " | " + scene->name; + if (scene) + scene_status += " | " + scene->name; if (b_rlay_name != "") scene_status += ", " + b_rlay_name; diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index 33e73b5a4b9..ae681432a43 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -678,7 +678,7 @@ static ShaderNode *add_node(Scene *scene, * builtin names for packed images and movies */ int scene_frame = b_scene.frame_current(); - int image_frame = image_user_frame_number(b_image_user, scene_frame); + int image_frame = image_user_frame_number(b_image_user, b_image, scene_frame); image->handle = scene->image_manager->add_image( new BlenderImageLoader(b_image, image_frame), image->image_params()); } @@ -713,7 +713,7 @@ static ShaderNode *add_node(Scene *scene, if (is_builtin) { int scene_frame = b_scene.frame_current(); - int image_frame = image_user_frame_number(b_image_user, scene_frame); + int image_frame = image_user_frame_number(b_image_user, b_image, scene_frame); env->handle = scene->image_manager->add_image(new BlenderImageLoader(b_image, image_frame), env->image_params()); } diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index ee90b4dfbfe..f806569c389 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -709,6 +709,16 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay, } RNA_END; + scene->film->denoising_data_pass = denoising.use || denoising.store_passes; + scene->film->denoising_clean_pass = (scene->film->denoising_flags & DENOISING_CLEAN_ALL_PASSES); + scene->film->denoising_prefiltered_pass = denoising.store_passes && + denoising.type == DENOISER_NLM; + + scene->film->pass_alpha_threshold = b_view_layer.pass_alpha_threshold(); + scene->film->tag_passes_update(scene, passes); + scene->film->tag_update(scene); + scene->integrator->tag_update(scene); + return passes; } diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index ad90a5f8d52..1ea34b41aa2 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -238,7 +238,7 @@ static inline string image_user_file_path(BL::ImageUser &iuser, { char filepath[1024]; iuser.tile(0); - BKE_image_user_frame_calc(NULL, iuser.ptr.data, cfra); + BKE_image_user_frame_calc(ima.ptr.data, iuser.ptr.data, cfra); BKE_image_user_file_path(iuser.ptr.data, ima.ptr.data, filepath); string filepath_str = string(filepath); @@ -248,9 +248,9 @@ static inline string image_user_file_path(BL::ImageUser &iuser, return filepath_str; } -static inline int image_user_frame_number(BL::ImageUser &iuser, int cfra) +static inline int image_user_frame_number(BL::ImageUser &iuser, BL::Image &ima, int cfra) { - BKE_image_user_frame_calc(NULL, iuser.ptr.data, cfra); + BKE_image_user_frame_calc(ima.ptr.data, iuser.ptr.data, cfra); return iuser.frame_current(); } diff --git a/intern/cycles/blender/blender_volume.cpp b/intern/cycles/blender/blender_volume.cpp index 80591e0eec8..d0e1e4d6131 100644 --- a/intern/cycles/blender/blender_volume.cpp +++ b/intern/cycles/blender/blender_volume.cpp @@ -217,43 +217,29 @@ static void sync_smoke_volume(Scene *scene, BL::Object &b_ob, Mesh *mesh, float class BlenderVolumeLoader : public VDBImageLoader { public: BlenderVolumeLoader(BL::BlendData &b_data, BL::Volume &b_volume, const string &grid_name) - : VDBImageLoader(grid_name), b_data(b_data), b_volume(b_volume), unload(false) - { - } - - bool load_metadata(ImageMetaData &metadata) override + : VDBImageLoader(grid_name), b_volume(b_volume) { b_volume.grids.load(b_data.ptr.data); - BL::VolumeGrid b_volume_grid = find_grid(); - - if (!b_volume_grid) { - return false; - } - - unload = !b_volume_grid.is_loaded(); #ifdef WITH_OPENVDB - Volume *volume = (Volume *)b_volume.ptr.data; - VolumeGrid *volume_grid = (VolumeGrid *)b_volume_grid.ptr.data; - grid = BKE_volume_grid_openvdb_for_read(volume, volume_grid); -#endif + BL::Volume::grids_iterator b_grid_iter; + for (b_volume.grids.begin(b_grid_iter); b_grid_iter != b_volume.grids.end(); ++b_grid_iter) { + BL::VolumeGrid b_volume_grid(*b_grid_iter); + if (b_volume_grid.name() == grid_name) { + const bool unload = !b_volume_grid.is_loaded(); - return VDBImageLoader::load_metadata(metadata); - } + Volume *volume = (Volume *)b_volume.ptr.data; + VolumeGrid *volume_grid = (VolumeGrid *)b_volume_grid.ptr.data; + grid = BKE_volume_grid_openvdb_for_read(volume, volume_grid); - bool load_pixels(const ImageMetaData &metadata, - void *pixels, - const size_t pixel_size, - const bool associate_alpha) override - { - b_volume.grids.load(b_data.ptr.data); - BL::VolumeGrid b_volume_grid = find_grid(); + if (unload) { + b_volume_grid.unload(); + } - if (!b_volume_grid) { - return false; + break; + } } - - return VDBImageLoader::load_pixels(metadata, pixels, pixel_size, associate_alpha); +#endif } bool equals(const ImageLoader &other) const override @@ -263,36 +249,7 @@ class BlenderVolumeLoader : public VDBImageLoader { return b_volume == other_loader.b_volume && grid_name == other_loader.grid_name; } - void cleanup() override - { - VDBImageLoader::cleanup(); - - BL::VolumeGrid b_volume_grid = find_grid(); - if (b_volume_grid && unload) { - b_volume_grid.unload(); - } - } - - /* Find grid with matching name. Grid point not stored in the class since - * grids may be unloaded before we load the pixels, for example for motion - * blur where we move between frames. */ - BL::VolumeGrid find_grid() - { -#ifdef WITH_OPENVDB - BL::Volume::grids_iterator b_grid_iter; - for (b_volume.grids.begin(b_grid_iter); b_grid_iter != b_volume.grids.end(); ++b_grid_iter) { - if (b_grid_iter->name() == grid_name) { - return *b_grid_iter; - } - } -#endif - - return BL::VolumeGrid(PointerRNA_NULL); - } - - BL::BlendData b_data; BL::Volume b_volume; - bool unload; }; static void sync_volume_object(BL::BlendData &b_data, BL::Object &b_ob, Scene *scene, Mesh *mesh) @@ -342,7 +299,7 @@ static void sync_volume_object(BL::BlendData &b_data, BL::Object &b_ob, Scene *s ImageParams params; params.frame = b_volume.grids.frame(); - attr->data_voxel() = scene->image_manager->add_image(loader, params); + attr->data_voxel() = scene->image_manager->add_image(loader, params, false); } } } diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt index 5533eeb006d..db146226dc7 100644 --- a/intern/cycles/kernel/CMakeLists.txt +++ b/intern/cycles/kernel/CMakeLists.txt @@ -539,7 +539,7 @@ if(WITH_CYCLES_DEVICE_OPTIX AND WITH_CYCLES_CUDA_BINARIES) ${SRC_UTIL_HEADERS} COMMAND ${CUBIN_CC_ENV} "$<TARGET_FILE:cycles_cubin_cc>" - -target 52 + -target 50 -ptx -i ${CMAKE_CURRENT_SOURCE_DIR}/${input} ${cuda_flags} @@ -563,7 +563,7 @@ if(WITH_CYCLES_DEVICE_OPTIX AND WITH_CYCLES_CUDA_BINARIES) COMMAND ${CUDA_NVCC_EXECUTABLE} --ptx - -arch=sm_52 + -arch=sm_50 ${cuda_flags} ${input} WORKING_DIRECTORY diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index 15cf2e02fdd..2ba3b1c4fdc 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -695,11 +695,9 @@ ccl_device void kernel_path_trace( kernel_path_trace_setup(kg, sample, x, y, &rng_hash, &ray); -# ifndef __KERNEL_OPTIX__ if (ray.t == 0.0f) { return; } -# endif /* Initialize state. */ float3 throughput = make_float3(1.0f, 1.0f, 1.0f); diff --git a/intern/cycles/render/geometry.cpp b/intern/cycles/render/geometry.cpp index 3d1b6e1d865..145b1fa492c 100644 --- a/intern/cycles/render/geometry.cpp +++ b/intern/cycles/render/geometry.cpp @@ -1201,9 +1201,13 @@ void GeometryManager::device_update_volume_images(Device *device, Scene *scene, } ImageHandle &handle = attr.data_voxel(); - const int slot = handle.svm_slot(); - if (slot != -1) { - volume_images.insert(slot); + /* We can build directly from OpenVDB data structures, no need to + * load such images early. */ + if (!handle.vdb_loader()) { + const int slot = handle.svm_slot(); + if (slot != -1) { + volume_images.insert(slot); + } } } } diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index 8d187814d64..a5dfcf60d61 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -18,6 +18,7 @@ #include "device/device.h" #include "render/colorspace.h" #include "render/image_oiio.h" +#include "render/image_vdb.h" #include "render/scene.h" #include "render/stats.h" @@ -172,6 +173,31 @@ device_texture *ImageHandle::image_memory(const int tile_index) const return img ? img->mem : NULL; } +VDBImageLoader *ImageHandle::vdb_loader(const int tile_index) const +{ + if (tile_index >= tile_slots.size()) { + return NULL; + } + + ImageManager::Image *img = manager->images[tile_slots[tile_index]]; + + if (img == NULL) { + return NULL; + } + + ImageLoader *loader = img->loader; + + if (loader == NULL) { + return NULL; + } + + if (loader->is_vdb_loader()) { + return dynamic_cast<VDBImageLoader *>(loader); + } + + return NULL; +} + bool ImageHandle::operator==(const ImageHandle &other) const { return manager == other.manager && tile_slots == other.tile_slots; @@ -258,6 +284,11 @@ bool ImageLoader::equals(const ImageLoader *a, const ImageLoader *b) } } +bool ImageLoader::is_vdb_loader() const +{ + return false; +} + /* Image Manager */ ImageManager::ImageManager(const DeviceInfo &info) @@ -362,9 +393,11 @@ ImageHandle ImageManager::add_image(const string &filename, return handle; } -ImageHandle ImageManager::add_image(ImageLoader *loader, const ImageParams ¶ms) +ImageHandle ImageManager::add_image(ImageLoader *loader, + const ImageParams ¶ms, + const bool builtin) { - const int slot = add_image_slot(loader, params, true); + const int slot = add_image_slot(loader, params, builtin); ImageHandle handle; handle.tile_slots.push_back(slot); diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h index fffe7c5152a..cb059256ce3 100644 --- a/intern/cycles/render/image.h +++ b/intern/cycles/render/image.h @@ -39,6 +39,7 @@ class Progress; class RenderStats; class Scene; class ColorSpaceProcessor; +class VDBImageLoader; /* Image Parameters */ class ImageParams { @@ -124,6 +125,8 @@ class ImageLoader { virtual bool equals(const ImageLoader &other) const = 0; static bool equals(const ImageLoader *a, const ImageLoader *b); + virtual bool is_vdb_loader() const; + /* Work around for no RTTI. */ }; @@ -149,6 +152,8 @@ class ImageHandle { int svm_slot(const int tile_index = 0) const; device_texture *image_memory(const int tile_index = 0) const; + VDBImageLoader *vdb_loader(const int tile_index = 0) const; + protected: vector<int> tile_slots; ImageManager *manager; @@ -169,7 +174,7 @@ class ImageManager { ImageHandle add_image(const string &filename, const ImageParams ¶ms, const vector<int> &tiles); - ImageHandle add_image(ImageLoader *loader, const ImageParams ¶ms); + ImageHandle add_image(ImageLoader *loader, const ImageParams ¶ms, const bool builtin = true); void device_update(Device *device, Scene *scene, Progress &progress); void device_update_slot(Device *device, Scene *scene, int slot, Progress *progress); diff --git a/intern/cycles/render/image_vdb.cpp b/intern/cycles/render/image_vdb.cpp index 500131c2d84..3f7dd45ee88 100644 --- a/intern/cycles/render/image_vdb.cpp +++ b/intern/cycles/render/image_vdb.cpp @@ -185,4 +185,16 @@ void VDBImageLoader::cleanup() #endif } +bool VDBImageLoader::is_vdb_loader() const +{ + return true; +} + +#ifdef WITH_OPENVDB +openvdb::GridBase::ConstPtr VDBImageLoader::get_grid() +{ + return grid; +} +#endif + CCL_NAMESPACE_END diff --git a/intern/cycles/render/image_vdb.h b/intern/cycles/render/image_vdb.h index 7dec63b11e6..4500cfbfb88 100644 --- a/intern/cycles/render/image_vdb.h +++ b/intern/cycles/render/image_vdb.h @@ -43,6 +43,12 @@ class VDBImageLoader : public ImageLoader { virtual void cleanup() override; + virtual bool is_vdb_loader() const override; + +#ifdef WITH_OPENVDB + openvdb::GridBase::ConstPtr get_grid(); +#endif + protected: string grid_name; #ifdef WITH_OPENVDB diff --git a/intern/cycles/render/mesh_volume.cpp b/intern/cycles/render/mesh_volume.cpp index 607363d01c6..70189ea4812 100644 --- a/intern/cycles/render/mesh_volume.cpp +++ b/intern/cycles/render/mesh_volume.cpp @@ -15,34 +15,25 @@ */ #include "render/attribute.h" +#include "render/image_vdb.h" #include "render/mesh.h" #include "render/scene.h" +#ifdef WITH_OPENVDB +# include <openvdb/tools/Dense.h> +# include <openvdb/tools/GridTransformer.h> +# include <openvdb/tools/Morphology.h> +#endif + #include "util/util_foreach.h" #include "util/util_hash.h" #include "util/util_logging.h" +#include "util/util_openvdb.h" #include "util/util_progress.h" #include "util/util_types.h" CCL_NAMESPACE_BEGIN -const int64_t VOXEL_INDEX_NONE = -1; - -static int64_t compute_voxel_index(const int3 &resolution, int64_t x, int64_t y, int64_t z) -{ - if (x < 0 || x >= resolution.x) { - return VOXEL_INDEX_NONE; - } - else if (y < 0 || y >= resolution.y) { - return VOXEL_INDEX_NONE; - } - else if (z < 0 || z >= resolution.z) { - return VOXEL_INDEX_NONE; - } - - return x + y * resolution.x + z * resolution.x * resolution.y; -} - struct QuadData { int v0, v1, v2, v3; @@ -123,122 +114,146 @@ static void create_quad(int3 corners[8], quads.push_back(quad); } -struct VolumeParams { - int3 resolution; - float3 cell_size; - float3 start_point; - int pad_size; -}; - -static const int CUBE_SIZE = 8; - /* Create a mesh from a volume. * * The way the algorithm works is as follows: * - * - The coordinates of active voxels from a dense volume (or 3d image) are - * gathered inside an auxiliary volume. - * - Each set of coordinates of an CUBE_SIZE cube are mapped to the same - * coordinate of the auxiliary volume. - * - Quads are created between active and non-active voxels in the auxiliary - * volume to generate a tight mesh around the volume. + * - The topologies of input OpenVDB grids are merged into a temporary grid. + * - Voxels of the temporary grid are dilated to account for the padding necessary for volume + * sampling. + * - Quads are created on the boundary between active and inactive leaf nodes of the temporary + * grid. */ class VolumeMeshBuilder { - /* Auxiliary volume that is used to check if a node already added. */ - vector<char> grid; - - /* The resolution of the auxiliary volume, set to be equal to 1/CUBE_SIZE - * of the original volume on each axis. */ - int3 res; - - size_t number_of_nodes; - - /* Offset due to padding in the original grid. Padding will transform the - * coordinates of the original grid from 0...res to -padding...res+padding, - * so some coordinates are negative, and we need to properly account for - * them. */ - int3 pad_offset; - - VolumeParams *params; - public: - VolumeMeshBuilder(VolumeParams *volume_params); +#ifdef WITH_OPENVDB + /* use a MaskGrid to store the topology to save memory */ + openvdb::MaskGrid::Ptr topology_grid; + openvdb::CoordBBox bbox; +#endif + bool first_grid; - void add_node(int x, int y, int z); + VolumeMeshBuilder(); - void add_node_with_padding(int x, int y, int z); +#ifdef WITH_OPENVDB + void add_grid(openvdb::GridBase::ConstPtr grid, bool do_clipping, float volume_clipping); +#endif - void create_mesh(vector<float3> &vertices, vector<int> &indices, vector<float3> &face_normals); + void add_padding(int pad_size); + + void create_mesh(vector<float3> &vertices, + vector<int> &indices, + vector<float3> &face_normals, + const float face_overlap_avoidance); - private: void generate_vertices_and_quads(vector<int3> &vertices_is, vector<QuadData> &quads); - void convert_object_space(const vector<int3> &vertices, vector<float3> &out_vertices); + void convert_object_space(const vector<int3> &vertices, + vector<float3> &out_vertices, + const float face_overlap_avoidance); void convert_quads_to_tris(const vector<QuadData> &quads, vector<int> &tris, vector<float3> &face_normals); -}; -VolumeMeshBuilder::VolumeMeshBuilder(VolumeParams *volume_params) -{ - params = volume_params; - number_of_nodes = 0; + bool empty_grid() const; - const int64_t x = divide_up(params->resolution.x, CUBE_SIZE); - const int64_t y = divide_up(params->resolution.y, CUBE_SIZE); - const int64_t z = divide_up(params->resolution.z, CUBE_SIZE); +#ifdef WITH_OPENVDB + template <typename GridType> + void merge_grid(openvdb::GridBase::ConstPtr grid, bool do_clipping, float volume_clipping) + { + typename GridType::ConstPtr typed_grid = openvdb::gridConstPtrCast<GridType>(grid); - /* Adding 2*pad_size since we pad in both positive and negative directions - * along the axis. */ - const int64_t px = divide_up(params->resolution.x + 2 * params->pad_size, CUBE_SIZE); - const int64_t py = divide_up(params->resolution.y + 2 * params->pad_size, CUBE_SIZE); - const int64_t pz = divide_up(params->resolution.z + 2 * params->pad_size, CUBE_SIZE); + if (do_clipping) { + using ValueType = typename GridType::ValueType; + typename GridType::Ptr copy = typed_grid->deepCopy(); + typename GridType::ValueOnIter iter = copy->beginValueOn(); - res = make_int3(px, py, pz); - pad_offset = make_int3(px - x, py - y, pz - z); + for (; iter; ++iter) { + if (iter.getValue() < ValueType(volume_clipping)) { + iter.setValueOff(); + } + } - grid.resize(px * py * pz, 0); -} + typed_grid = copy; + } -void VolumeMeshBuilder::add_node(int x, int y, int z) -{ - /* Map coordinates to index space. */ - const int index_x = (x / CUBE_SIZE) + pad_offset.x; - const int index_y = (y / CUBE_SIZE) + pad_offset.y; - const int index_z = (z / CUBE_SIZE) + pad_offset.z; + topology_grid->topologyUnion(*typed_grid); + } +#endif +}; - assert((index_x >= 0) && (index_y >= 0) && (index_z >= 0)); +VolumeMeshBuilder::VolumeMeshBuilder() +{ + first_grid = true; +} - const int64_t index = compute_voxel_index(res, index_x, index_y, index_z); - if (index == VOXEL_INDEX_NONE) { - return; +#ifdef WITH_OPENVDB +void VolumeMeshBuilder::add_grid(openvdb::GridBase::ConstPtr grid, bool do_clipping, float volume_clipping) +{ + /* set the transform of our grid from the first one */ + if (first_grid) { + topology_grid = openvdb::MaskGrid::create(); + topology_grid->setTransform(grid->transform().copy()); + first_grid = false; } - - /* We already have a node here. */ - if (grid[index] == 1) { - return; + /* if the transforms do not match, we need to resample one of the grids so that + * its index space registers with that of the other, here we resample our mask + * grid so memory usage is kept low */ + else if (topology_grid->transform() != grid->transform()) { + openvdb::MaskGrid::Ptr temp_grid = topology_grid->copyWithNewTree(); + temp_grid->setTransform(grid->transform().copy()); + openvdb::tools::resampleToMatch<openvdb::tools::BoxSampler>(*topology_grid, *temp_grid); + topology_grid = temp_grid; + topology_grid->setTransform(grid->transform().copy()); } - ++number_of_nodes; - - grid[index] = 1; + if (grid->isType<openvdb::FloatGrid>()) { + merge_grid<openvdb::FloatGrid>(grid, do_clipping, volume_clipping); + } + else if (grid->isType<openvdb::Vec3fGrid>()) { + merge_grid<openvdb::Vec3fGrid>(grid, do_clipping, volume_clipping); + } + else if (grid->isType<openvdb::Vec4fGrid>()) { + merge_grid<openvdb::Vec4fGrid>(grid, do_clipping, volume_clipping); + } + else if (grid->isType<openvdb::BoolGrid>()) { + merge_grid<openvdb::BoolGrid>(grid, do_clipping, volume_clipping); + } + else if (grid->isType<openvdb::DoubleGrid>()) { + merge_grid<openvdb::DoubleGrid>(grid, do_clipping, volume_clipping); + } + else if (grid->isType<openvdb::Int32Grid>()) { + merge_grid<openvdb::Int32Grid>(grid, do_clipping, volume_clipping); + } + else if (grid->isType<openvdb::Int64Grid>()) { + merge_grid<openvdb::Int64Grid>(grid, do_clipping, volume_clipping); + } + else if (grid->isType<openvdb::Vec3IGrid>()) { + merge_grid<openvdb::Vec3IGrid>(grid, do_clipping, volume_clipping); + } + else if (grid->isType<openvdb::Vec3dGrid>()) { + merge_grid<openvdb::Vec3dGrid>(grid, do_clipping, volume_clipping); + } + else if (grid->isType<openvdb::MaskGrid>()) { + topology_grid->topologyUnion(*openvdb::gridConstPtrCast<openvdb::MaskGrid>(grid)); + } } +#endif -void VolumeMeshBuilder::add_node_with_padding(int x, int y, int z) +void VolumeMeshBuilder::add_padding(int pad_size) { - for (int px = x - params->pad_size; px < x + params->pad_size; ++px) { - for (int py = y - params->pad_size; py < y + params->pad_size; ++py) { - for (int pz = z - params->pad_size; pz < z + params->pad_size; ++pz) { - add_node(px, py, pz); - } - } - } +#ifdef WITH_OPENVDB + openvdb::tools::dilateVoxels(topology_grid->tree(), pad_size); +#else + (void)pad_size; +#endif } void VolumeMeshBuilder::create_mesh(vector<float3> &vertices, vector<int> &indices, - vector<float3> &face_normals) + vector<float3> &face_normals, + const float face_overlap_avoidance) { /* We create vertices in index space (is), and only convert them to object * space when done. */ @@ -247,7 +262,7 @@ void VolumeMeshBuilder::create_mesh(vector<float3> &vertices, generate_vertices_and_quads(vertices_is, quads); - convert_object_space(vertices_is, vertices); + convert_object_space(vertices_is, vertices, face_overlap_avoidance); convert_quads_to_tris(quads, indices, face_normals); } @@ -255,85 +270,97 @@ void VolumeMeshBuilder::create_mesh(vector<float3> &vertices, void VolumeMeshBuilder::generate_vertices_and_quads(vector<ccl::int3> &vertices_is, vector<QuadData> &quads) { - unordered_map<size_t, int> used_verts; +#ifdef WITH_OPENVDB + const openvdb::MaskGrid::TreeType &tree = topology_grid->tree(); + tree.evalLeafBoundingBox(bbox); - for (int z = 0; z < res.z; ++z) { - for (int y = 0; y < res.y; ++y) { - for (int x = 0; x < res.x; ++x) { - int64_t voxel_index = compute_voxel_index(res, x, y, z); - if (grid[voxel_index] == 0) { - continue; - } + const int3 resolution = make_int3(bbox.dim().x(), bbox.dim().y(), bbox.dim().z()); - /* Compute min and max coords of the node in index space. */ - int3 min = make_int3((x - pad_offset.x) * CUBE_SIZE, - (y - pad_offset.y) * CUBE_SIZE, - (z - pad_offset.z) * CUBE_SIZE); - - /* Maximum is just CUBE_SIZE voxels away from minimum on each axis. */ - int3 max = make_int3(min.x + CUBE_SIZE, min.y + CUBE_SIZE, min.z + CUBE_SIZE); - - int3 corners[8] = { - make_int3(min[0], min[1], min[2]), - make_int3(max[0], min[1], min[2]), - make_int3(max[0], max[1], min[2]), - make_int3(min[0], max[1], min[2]), - make_int3(min[0], min[1], max[2]), - make_int3(max[0], min[1], max[2]), - make_int3(max[0], max[1], max[2]), - make_int3(min[0], max[1], max[2]), - }; - - /* Only create a quad if on the border between an active and - * an inactive node. - */ - - voxel_index = compute_voxel_index(res, x - 1, y, z); - if (voxel_index == VOXEL_INDEX_NONE || grid[voxel_index] == 0) { - create_quad(corners, vertices_is, quads, res, used_verts, QUAD_X_MIN); - } + unordered_map<size_t, int> used_verts; - voxel_index = compute_voxel_index(res, x + 1, y, z); - if (voxel_index == VOXEL_INDEX_NONE || grid[voxel_index] == 0) { - create_quad(corners, vertices_is, quads, res, used_verts, QUAD_X_MAX); - } + for (auto iter = tree.cbeginLeaf(); iter; ++iter) { + openvdb::CoordBBox leaf_bbox = iter->getNodeBoundingBox(); + /* +1 to convert from exclusive to include bounds. */ + leaf_bbox.max() = leaf_bbox.max().offsetBy(1); + + int3 min = make_int3(leaf_bbox.min().x(), leaf_bbox.min().y(), leaf_bbox.min().z()); + int3 max = make_int3(leaf_bbox.max().x(), leaf_bbox.max().y(), leaf_bbox.max().z()); + + int3 corners[8] = { + make_int3(min[0], min[1], min[2]), + make_int3(max[0], min[1], min[2]), + make_int3(max[0], max[1], min[2]), + make_int3(min[0], max[1], min[2]), + make_int3(min[0], min[1], max[2]), + make_int3(max[0], min[1], max[2]), + make_int3(max[0], max[1], max[2]), + make_int3(min[0], max[1], max[2]), + }; + + /* Only create a quad if on the border between an active and an inactive leaf. + * + * We verify that a leaf exists by probing a coordinate that is at its center, + * to do so we compute the center of the current leaf and offset this coordinate + * by the size of a leaf in each direction. + */ + static const int LEAF_DIM = openvdb::MaskGrid::TreeType::LeafNodeType::DIM; + auto center = leaf_bbox.min() + openvdb::Coord(LEAF_DIM / 2); + + if (!tree.probeLeaf(openvdb::Coord(center.x() - LEAF_DIM, center.y(), center.z()))) { + create_quad(corners, vertices_is, quads, resolution, used_verts, QUAD_X_MIN); + } - voxel_index = compute_voxel_index(res, x, y - 1, z); - if (voxel_index == VOXEL_INDEX_NONE || grid[voxel_index] == 0) { - create_quad(corners, vertices_is, quads, res, used_verts, QUAD_Y_MIN); - } + if (!tree.probeLeaf(openvdb::Coord(center.x() + LEAF_DIM, center.y(), center.z()))) { + create_quad(corners, vertices_is, quads, resolution, used_verts, QUAD_X_MAX); + } - voxel_index = compute_voxel_index(res, x, y + 1, z); - if (voxel_index == VOXEL_INDEX_NONE || grid[voxel_index] == 0) { - create_quad(corners, vertices_is, quads, res, used_verts, QUAD_Y_MAX); - } + if (!tree.probeLeaf(openvdb::Coord(center.x(), center.y() - LEAF_DIM, center.z()))) { + create_quad(corners, vertices_is, quads, resolution, used_verts, QUAD_Y_MIN); + } - voxel_index = compute_voxel_index(res, x, y, z - 1); - if (voxel_index == VOXEL_INDEX_NONE || grid[voxel_index] == 0) { - create_quad(corners, vertices_is, quads, res, used_verts, QUAD_Z_MIN); - } + if (!tree.probeLeaf(openvdb::Coord(center.x(), center.y() + LEAF_DIM, center.z()))) { + create_quad(corners, vertices_is, quads, resolution, used_verts, QUAD_Y_MAX); + } - voxel_index = compute_voxel_index(res, x, y, z + 1); - if (voxel_index == VOXEL_INDEX_NONE || grid[voxel_index] == 0) { - create_quad(corners, vertices_is, quads, res, used_verts, QUAD_Z_MAX); - } - } + if (!tree.probeLeaf(openvdb::Coord(center.x(), center.y(), center.z() - LEAF_DIM))) { + create_quad(corners, vertices_is, quads, resolution, used_verts, QUAD_Z_MIN); + } + + if (!tree.probeLeaf(openvdb::Coord(center.x(), center.y(), center.z() + LEAF_DIM))) { + create_quad(corners, vertices_is, quads, resolution, used_verts, QUAD_Z_MAX); } } +#else + (void)vertices_is; + (void)quads; +#endif } void VolumeMeshBuilder::convert_object_space(const vector<int3> &vertices, - vector<float3> &out_vertices) + vector<float3> &out_vertices, + const float face_overlap_avoidance) { +#ifdef WITH_OPENVDB + /* compute the offset for the face overlap avoidance */ + bbox = topology_grid->evalActiveVoxelBoundingBox(); + openvdb::Coord dim = bbox.dim(); + + float3 cell_size = make_float3(1.0f / dim.x(), 1.0f / dim.y(), 1.0f / dim.z()); + float3 point_offset = cell_size * face_overlap_avoidance; + out_vertices.reserve(vertices.size()); for (size_t i = 0; i < vertices.size(); ++i) { - float3 vertex = make_float3(vertices[i].x, vertices[i].y, vertices[i].z); - vertex *= params->cell_size; - vertex += params->start_point; - - out_vertices.push_back(vertex); + openvdb::math::Vec3d p = topology_grid->indexToWorld( + openvdb::math::Vec3d(vertices[i].x, vertices[i].y, vertices[i].z)); + float3 vertex = make_float3((float)p.x(), (float)p.y(), (float)p.z()); + out_vertices.push_back(vertex + point_offset); } +#else + (void)vertices; + (void)out_vertices; + (void)face_overlap_avoidance; +#endif } void VolumeMeshBuilder::convert_quads_to_tris(const vector<QuadData> &quads, @@ -359,57 +386,115 @@ void VolumeMeshBuilder::convert_quads_to_tris(const vector<QuadData> &quads, } } -/* ************************************************************************** */ +bool VolumeMeshBuilder::empty_grid() const +{ +#ifdef WITH_OPENVDB + return !topology_grid || topology_grid->tree().leafCount() == 0; +#else + return true; +#endif +} -struct VoxelAttributeGrid { - float *data; - int channels; -}; +#ifdef WITH_OPENVDB +template<typename GridType> +static openvdb::GridBase::ConstPtr openvdb_grid_from_device_texture(device_texture *image_memory, + float volume_clipping, + Transform transform_3d) +{ + using ValueType = typename GridType::ValueType; + + openvdb::CoordBBox dense_bbox(0, + 0, + 0, + image_memory->data_width - 1, + image_memory->data_height - 1, + image_memory->data_depth - 1); + openvdb::tools::Dense<ValueType, openvdb::tools::MemoryLayout::LayoutXYZ> dense( + dense_bbox, static_cast<ValueType *>(image_memory->host_pointer)); + + typename GridType::Ptr sparse = GridType::create(ValueType(0.0f)); + openvdb::tools::copyFromDense(dense, *sparse, ValueType(volume_clipping)); + + /* copyFromDense will remove any leaf node that contains constant data and replace it with a tile, + * however, we need to preserve the leaves in order to generate the mesh, so revoxelize the leaves + * that were pruned. This should not affect areas that were skipped due to the volume_clipping parameter. */ + sparse->tree().voxelizeActiveTiles(); + + /* Compute index to world matrix. */ + float3 voxel_size = make_float3(1.0f / image_memory->data_width, 1.0f / image_memory->data_height, 1.0f / image_memory->data_depth); + + transform_3d = transform_inverse(transform_3d); + + openvdb::Mat4R index_to_world_mat((double)(voxel_size.x * transform_3d[0][0]), 0.0, 0.0, 0.0, + 0.0, (double)(voxel_size.y * transform_3d[1][1]), 0.0, 0.0, + 0.0, 0.0, (double)(voxel_size.z * transform_3d[2][2]), 0.0, + (double)transform_3d[0][3], (double)transform_3d[1][3], (double)transform_3d[2][3], 1.0); + + openvdb::math::Transform::Ptr index_to_world_tfm = openvdb::math::Transform::createLinearTransform(index_to_world_mat); + + sparse->setTransform(index_to_world_tfm); + + return sparse; +} +#endif + +/* ************************************************************************** */ void GeometryManager::create_volume_mesh(Mesh *mesh, Progress &progress) { string msg = string_printf("Computing Volume Mesh %s", mesh->name.c_str()); progress.set_status("Updating Mesh", msg); - vector<VoxelAttributeGrid> voxel_grids; - - /* Compute volume parameters. */ - VolumeParams volume_params; - volume_params.resolution = make_int3(0, 0, 0); - - Transform transform = transform_identity(); + VolumeMeshBuilder builder; +#ifdef WITH_OPENVDB foreach (Attribute &attr, mesh->attributes.attributes) { if (attr.element != ATTR_ELEMENT_VOXEL) { continue; } + bool do_clipping = false; + ImageHandle &handle = attr.data_voxel(); - device_texture *image_memory = handle.image_memory(); - int3 resolution = make_int3( - image_memory->data_width, image_memory->data_height, image_memory->data_depth); - if (volume_params.resolution == make_int3(0, 0, 0)) { - volume_params.resolution = resolution; - } - else if (volume_params.resolution != resolution) { - /* TODO: support this as it's common for OpenVDB. */ - VLOG(1) << "Can't create accurate volume mesh, all voxel grid resolutions must be equal\n"; - continue; + /* Try building from OpenVDB grid directly. */ + VDBImageLoader *vdb_loader = handle.vdb_loader(); + openvdb::GridBase::ConstPtr grid; + if (vdb_loader) { + grid = vdb_loader->get_grid(); + + /* If building from an OpenVDB grid, we need to manually clip the values. */ + do_clipping = true; } - VoxelAttributeGrid voxel_grid; - voxel_grid.data = static_cast<float *>(image_memory->host_pointer); - voxel_grid.channels = image_memory->data_elements; - voxel_grids.push_back(voxel_grid); + /* Else fall back to creating an OpenVDB grid from the dense volume data. */ + if (!grid) { + device_texture *image_memory = handle.image_memory(); - /* TODO: support multiple transforms. */ - if (image_memory->info.use_transform_3d) { - transform = image_memory->info.transform_3d; + if (image_memory->data_elements == 1) { + grid = openvdb_grid_from_device_texture<openvdb::FloatGrid>(image_memory, + mesh->volume_clipping, + handle.metadata().transform_3d); + } + else if (image_memory->data_elements == 3) { + grid = openvdb_grid_from_device_texture<openvdb::Vec3fGrid>(image_memory, + mesh->volume_clipping, + handle.metadata().transform_3d); + } + else if (image_memory->data_elements == 4) { + grid = openvdb_grid_from_device_texture<openvdb::Vec4fGrid>(image_memory, + mesh->volume_clipping, + handle.metadata().transform_3d); + } + } + + if (grid) { + builder.add_grid(grid, do_clipping, mesh->volume_clipping); } } +#endif - if (voxel_grids.empty()) { + if (builder.empty_grid()) { return; } @@ -438,56 +523,19 @@ void GeometryManager::create_volume_mesh(Mesh *mesh, Progress &progress) return; } - /* Compute start point and cell size from transform. */ - const int3 resolution = volume_params.resolution; - float3 start_point = make_float3(0.0f, 0.0f, 0.0f); - float3 cell_size = make_float3(1.0f / resolution.x, 1.0f / resolution.y, 1.0f / resolution.z); - - /* TODO: support arbitrary transforms, not just scale + translate. */ - const Transform itfm = transform_inverse(transform); - start_point = transform_point(&itfm, start_point); - cell_size = transform_direction(&itfm, cell_size); + builder.add_padding(pad_size); /* Slightly offset vertex coordinates to avoid overlapping faces with other * volumes or meshes. The proper solution would be to improve intersection in * the kernel to support robust handling of multiple overlapping faces or use * an all-hit intersection similar to shadows. */ - const float3 face_overlap_avoidance = cell_size * 0.1f * - hash_uint_to_float(hash_string(mesh->name.c_str())); - - volume_params.start_point = start_point + face_overlap_avoidance; - volume_params.cell_size = cell_size; - volume_params.pad_size = pad_size; - - /* Build bounding mesh around non-empty volume cells. */ - VolumeMeshBuilder builder(&volume_params); - const float clipping = mesh->volume_clipping; - - for (int z = 0; z < resolution.z; ++z) { - for (int y = 0; y < resolution.y; ++y) { - for (int x = 0; x < resolution.x; ++x) { - int64_t voxel_index = compute_voxel_index(resolution, x, y, z); - - for (size_t i = 0; i < voxel_grids.size(); ++i) { - const VoxelAttributeGrid &voxel_grid = voxel_grids[i]; - const int channels = voxel_grid.channels; - - for (int c = 0; c < channels; c++) { - if (voxel_grid.data[voxel_index * channels + c] >= clipping) { - builder.add_node_with_padding(x, y, z); - break; - } - } - } - } - } - } + const float face_overlap_avoidance = 0.1f * hash_uint_to_float(hash_string(mesh->name.c_str())); /* Create mesh. */ vector<float3> vertices; vector<int> indices; vector<float3> face_normals; - builder.create_mesh(vertices, indices, face_normals); + builder.create_mesh(vertices, indices, face_normals, face_overlap_avoidance); mesh->clear(true); mesh->reserve_mesh(vertices.size(), indices.size() / 3); @@ -514,10 +562,6 @@ void GeometryManager::create_volume_mesh(Mesh *mesh, Progress &progress) indices.size() * sizeof(int)) / (1024.0 * 1024.0) << "Mb."; - - VLOG(1) << "Memory usage volume grid: " - << (resolution.x * resolution.y * resolution.z * sizeof(float)) / (1024.0 * 1024.0) - << "Mb."; } CCL_NAMESPACE_END diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp index c5033359c6b..70c4214c684 100644 --- a/intern/cycles/render/session.cpp +++ b/intern/cycles/render/session.cpp @@ -945,8 +945,14 @@ void Session::set_pause(bool pause_) } } - if (notify) - pause_cond.notify_all(); + if (session_thread) { + if (notify) { + pause_cond.notify_all(); + } + } + else if (pause_) { + update_status_time(pause_); + } } void Session::set_denoising(const DenoiseParams &denoising) @@ -1150,8 +1156,15 @@ bool Session::render_need_denoise(bool &delayed) return false; } + /* Immediately denoise when we reach the start sample or last sample. */ + const int num_samples_finished = tile_manager.state.sample + 1; + if (num_samples_finished == params.denoising.start_sample || + num_samples_finished == params.samples) { + return true; + } + /* Do not denoise until the sample at which denoising should start is reached. */ - if (tile_manager.state.sample < min(params.denoising.start_sample, params.samples - 1)) { + if (num_samples_finished < params.denoising.start_sample) { return false; } diff --git a/intern/cycles/test/CMakeLists.txt b/intern/cycles/test/CMakeLists.txt index 6dcc7f7b3dd..07b345baff8 100644 --- a/intern/cycles/test/CMakeLists.txt +++ b/intern/cycles/test/CMakeLists.txt @@ -112,3 +112,4 @@ set_source_files_properties(util_avxf_avx_test.cpp PROPERTIES COMPILE_FLAGS "${C CYCLES_TEST(util_avxf_avx "cycles_util;bf_intern_numaapi;${OPENIMAGEIO_LIBRARIES};${BOOST_LIBRARIES}") set_source_files_properties(util_avxf_avx2_test.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX2_KERNEL_FLAGS}") CYCLES_TEST(util_avxf_avx2 "cycles_util;bf_intern_numaapi;${OPENIMAGEIO_LIBRARIES};${BOOST_LIBRARIES}") +CYCLES_TEST(util_transform "cycles_util;${OPENIMAGEIO_LIBRARIES};${BOOST_LIBRARIES}") diff --git a/intern/cycles/test/util_transform_test.cpp b/intern/cycles/test/util_transform_test.cpp new file mode 100644 index 00000000000..58ce0fdfee4 --- /dev/null +++ b/intern/cycles/test/util_transform_test.cpp @@ -0,0 +1,53 @@ +/* + * Copyright 2011-2020 Blender Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "testing/testing.h" + +#include "util/util_transform.h" +#include "util/util_vector.h" + +CCL_NAMESPACE_BEGIN + +TEST(transform_motion_decompose, Degenerated) +{ + // Simple case: single degenerated matrix. + { + vector<Transform> motion = {transform_scale(0.0f, 0.0f, 0.0f)}; + vector<DecomposedTransform> decomp(motion.size()); + transform_motion_decompose(decomp.data(), motion.data(), motion.size()); + EXPECT_TRUE(transform_decomposed_isfinite_safe(&decomp[0])); + } + + // Copy from previous to current. + { + vector<Transform> motion = {transform_rotate(M_PI_4_F, make_float3(1.0f, 1.0f, 1.0f)), + transform_scale(0.0f, 0.0f, 0.0f)}; + vector<DecomposedTransform> decomp(motion.size()); + transform_motion_decompose(decomp.data(), motion.data(), motion.size()); + EXPECT_NEAR(len(decomp[1].x - decomp[0].x), 0.0f, 1e-6f); + } + + // Copy from next to current. + { + vector<Transform> motion = {transform_scale(0.0f, 0.0f, 0.0f), + transform_rotate(M_PI_4_F, make_float3(1.0f, 1.0f, 1.0f))}; + vector<DecomposedTransform> decomp(motion.size()); + transform_motion_decompose(decomp.data(), motion.data(), motion.size()); + EXPECT_NEAR(len(decomp[0].x - decomp[1].x), 0.0f, 1e-6f); + } +} + +CCL_NAMESPACE_END diff --git a/intern/cycles/util/CMakeLists.txt b/intern/cycles/util/CMakeLists.txt index f5e488d1bd2..a35ec6c7e29 100644 --- a/intern/cycles/util/CMakeLists.txt +++ b/intern/cycles/util/CMakeLists.txt @@ -88,6 +88,7 @@ set(SRC_HEADERS util_murmurhash.h util_openimagedenoise.h util_opengl.h + util_openvdb.h util_optimization.h util_param.h util_path.h diff --git a/intern/cycles/util/util_math_fast.h b/intern/cycles/util/util_math_fast.h index e979bd9e0c0..07b0878e3d5 100644 --- a/intern/cycles/util/util_math_fast.h +++ b/intern/cycles/util/util_math_fast.h @@ -87,7 +87,7 @@ ccl_device_inline int fast_rint(float x) /* Single roundps instruction on SSE4.1+ (for gcc/clang at least). */ return float_to_int(rintf(x)); #else - /* emulate rounding by adding/substracting 0.5. */ + /* emulate rounding by adding/subtracting 0.5. */ return float_to_int(x + copysignf(0.5f, x)); #endif } @@ -445,12 +445,10 @@ ccl_device_inline float fast_expf(float x) return fast_exp2f(x / M_LN2_F); } -#ifndef __KERNEL_GPU__ -/* MSVC seems to have a code-gen bug here in at least SSE41/AVX - * see T78047 for details. */ -# ifdef _MSC_VER -# pragma optimize("", off) -# endif +#if defined(__KERNEL_CPU__) && !defined(_MSC_VER) +/* MSVC seems to have a code-gen bug here in at least SSE41/AVX, see + * T78047 and T78869 for details. Just disable for now, it only makes + * a small difference in denoising performance. */ ccl_device float4 fast_exp2f4(float4 x) { const float4 one = make_float4(1.0f); @@ -466,14 +464,16 @@ ccl_device float4 fast_exp2f4(float4 x) r = madd4(x, r, make_float4(1.0f)); return __int4_as_float4(__float4_as_int4(r) + (m << 23)); } -# ifdef _MSC_VER -# pragma optimize("", on) -# endif ccl_device_inline float4 fast_expf4(float4 x) { return fast_exp2f4(x / M_LN2_F); } +#else +ccl_device_inline float4 fast_expf4(float4 x) +{ + return make_float4(fast_expf(x.x), fast_expf(x.y), fast_expf(x.z), fast_expf(x.w)); +} #endif ccl_device_inline float fast_exp10(float x) diff --git a/intern/cycles/util/util_math_float4.h b/intern/cycles/util/util_math_float4.h index cd4b3e3b74c..ec5328adb31 100644 --- a/intern/cycles/util/util_math_float4.h +++ b/intern/cycles/util/util_math_float4.h @@ -477,6 +477,24 @@ ccl_device_inline float4 safe_divide_float4_float(const float4 a, const float b) return (b != 0.0f) ? a / b : make_float4(0.0f, 0.0f, 0.0f, 0.0f); } +ccl_device_inline bool isfinite4_safe(float4 v) +{ + return isfinite_safe(v.x) && isfinite_safe(v.y) && isfinite_safe(v.z) && isfinite_safe(v.w); +} + +ccl_device_inline float4 ensure_finite4(float4 v) +{ + if (!isfinite_safe(v.x)) + v.x = 0.0f; + if (!isfinite_safe(v.y)) + v.y = 0.0f; + if (!isfinite_safe(v.z)) + v.z = 0.0f; + if (!isfinite_safe(v.w)) + v.w = 0.0f; + return v; +} + CCL_NAMESPACE_END #endif /* __UTIL_MATH_FLOAT4_H__ */ diff --git a/intern/cycles/util/util_openvdb.h b/intern/cycles/util/util_openvdb.h new file mode 100644 index 00000000000..a3ebb03e5a4 --- /dev/null +++ b/intern/cycles/util/util_openvdb.h @@ -0,0 +1,32 @@ +/* + * Copyright 2011-2020 Blender Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __UTIL_OPENVDB_H__ +#define __UTIL_OPENVDB_H__ + +#ifdef WITH_OPENVDB +# include <openvdb/openvdb.h> + +namespace openvdb { + +using Vec4fTree = tree::Tree4<Vec4f, 5, 4, 3>::Type; +using Vec4fGrid = Grid<Vec4fTree>; + +}; // namespace openvdb + +#endif + +#endif /* __UTIL_OPENVDB_H__ */ diff --git a/intern/cycles/util/util_transform.cpp b/intern/cycles/util/util_transform.cpp index 101122740d7..6417752f704 100644 --- a/intern/cycles/util/util_transform.cpp +++ b/intern/cycles/util/util_transform.cpp @@ -269,17 +269,17 @@ static void transform_decompose(DecomposedTransform *decomp, const Transform *tf /* extract scale and shear first */ float3 scale, shear; scale.x = len(colx); - colx /= scale.x; + colx = safe_divide_float3_float(colx, scale.x); shear.z = dot(colx, coly); coly -= shear.z * colx; scale.y = len(coly); - coly /= scale.y; + coly = safe_divide_float3_float(coly, scale.y); shear.y = dot(colx, colz); colz -= shear.y * colx; shear.x = dot(coly, colz); colz -= shear.x * coly; scale.z = len(colz); - colz /= scale.z; + colz = safe_divide_float3_float(colz, scale.z); transform_set_column(&M, 0, colx); transform_set_column(&M, 1, coly); @@ -300,6 +300,7 @@ static void transform_decompose(DecomposedTransform *decomp, const Transform *tf void transform_motion_decompose(DecomposedTransform *decomp, const Transform *motion, size_t size) { + /* Decompose and correct rotation. */ for (size_t i = 0; i < size; i++) { transform_decompose(decomp + i, motion + i); @@ -310,6 +311,27 @@ void transform_motion_decompose(DecomposedTransform *decomp, const Transform *mo decomp[i].x = -decomp[i].x; } } + + /* Copy rotation to decomposed transform where scale is degenerate. This avoids weird object + * rotation interpolation when the scale goes to 0 for a time step. + * + * Note that this is very simple and naive implementation, which only deals with degenerated + * scale happening only on one frame. It is possible to improve it further by interpolating + * rotation into s degenerated range using rotation from timesteps from adjacent non-degenerated + * time steps. */ + for (size_t i = 0; i < size; i++) { + const float3 scale = make_float3(decomp[i].y.w, decomp[i].z.w, decomp[i].w.w); + if (!is_zero(scale)) { + continue; + } + + if (i > 0) { + decomp[i].x = decomp[i - 1].x; + } + else if (i < size - 1) { + decomp[i].x = decomp[i + 1].x; + } + } } Transform transform_from_viewplane(BoundBox2D &viewplane) diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h index d0a6264d5cf..d8bbd389aa6 100644 --- a/intern/cycles/util/util_transform.h +++ b/intern/cycles/util/util_transform.h @@ -466,6 +466,17 @@ ccl_device void transform_motion_array_interpolate(Transform *tfm, transform_compose(tfm, &decomp); } +ccl_device_inline bool transform_isfinite_safe(Transform *tfm) +{ + return isfinite4_safe(tfm->x) && isfinite4_safe(tfm->y) && isfinite4_safe(tfm->z); +} + +ccl_device_inline bool transform_decomposed_isfinite_safe(DecomposedTransform *decomp) +{ + return isfinite4_safe(decomp->x) && isfinite4_safe(decomp->y) && isfinite4_safe(decomp->z) && + isfinite4_safe(decomp->w); +} + #ifndef __KERNEL_GPU__ class BoundBox2D; diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index 92061f55128..f23742a9166 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -21,8 +21,7 @@ * \brief GHOST C-API function and type declarations. */ -#ifndef __GHOST_C_API_H__ -#define __GHOST_C_API_H__ +#pragma once #include "GHOST_Types.h" @@ -1072,5 +1071,3 @@ GHOST_TSuccess GHOST_XrEventsHandle(GHOST_XrContextHandle xr_context); #ifdef __cplusplus } #endif - -#endif diff --git a/intern/ghost/GHOST_IContext.h b/intern/ghost/GHOST_IContext.h index 8c24261644a..c6316e90ce4 100644 --- a/intern/ghost/GHOST_IContext.h +++ b/intern/ghost/GHOST_IContext.h @@ -22,8 +22,7 @@ * Declaration of GHOST_IContext interface class. */ -#ifndef __GHOST_IContext_H__ -#define __GHOST_IContext_H__ +#pragma once #include "GHOST_Types.h" @@ -63,5 +62,3 @@ class GHOST_IContext { MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_IContext") #endif }; - -#endif // __GHOST_IContext_H__ diff --git a/intern/ghost/GHOST_IEvent.h b/intern/ghost/GHOST_IEvent.h index 0d9bfb2c4de..c63064c123a 100644 --- a/intern/ghost/GHOST_IEvent.h +++ b/intern/ghost/GHOST_IEvent.h @@ -22,8 +22,7 @@ * Declaration of GHOST_IEvent interface class. */ -#ifndef __GHOST_IEVENT_H__ -#define __GHOST_IEVENT_H__ +#pragma once #include "GHOST_Types.h" #include <stddef.h> @@ -78,5 +77,3 @@ class GHOST_IEvent { MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_IEvent") #endif }; - -#endif // __GHOST_IEVENT_H__ diff --git a/intern/ghost/GHOST_IEventConsumer.h b/intern/ghost/GHOST_IEventConsumer.h index d677a632a4b..b5975068da0 100644 --- a/intern/ghost/GHOST_IEventConsumer.h +++ b/intern/ghost/GHOST_IEventConsumer.h @@ -22,8 +22,7 @@ * Declaration of GHOST_IEventConsumer interface class. */ -#ifndef __GHOST_IEVENTCONSUMER_H__ -#define __GHOST_IEVENTCONSUMER_H__ +#pragma once #include "GHOST_IEvent.h" @@ -56,5 +55,3 @@ class GHOST_IEventConsumer { MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_IEventConsumer") #endif }; - -#endif /* __GHOST_IEVENTCONSUMER_H__ */ diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h index 33600fd1219..04e9d5e4e14 100644 --- a/intern/ghost/GHOST_ISystem.h +++ b/intern/ghost/GHOST_ISystem.h @@ -24,8 +24,7 @@ * Contains the doxygen documentation main page. */ -#ifndef __GHOST_ISYSTEM_H__ -#define __GHOST_ISYSTEM_H__ +#pragma once #include <stdlib.h> @@ -494,5 +493,3 @@ class GHOST_ISystem { MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_ISystem") #endif }; - -#endif // __GHOST_ISYSTEM_H__ diff --git a/intern/ghost/GHOST_ISystemPaths.h b/intern/ghost/GHOST_ISystemPaths.h index 297f6333a77..b47d14984d8 100644 --- a/intern/ghost/GHOST_ISystemPaths.h +++ b/intern/ghost/GHOST_ISystemPaths.h @@ -21,8 +21,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_ISYSTEMPATHS_H__ -#define __GHOST_ISYSTEMPATHS_H__ +#pragma once #include "GHOST_Types.h" @@ -97,5 +96,3 @@ class GHOST_ISystemPaths { MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_ISystemPaths") #endif }; - -#endif diff --git a/intern/ghost/GHOST_ITimerTask.h b/intern/ghost/GHOST_ITimerTask.h index 46f4fdbc303..0f4ac74c466 100644 --- a/intern/ghost/GHOST_ITimerTask.h +++ b/intern/ghost/GHOST_ITimerTask.h @@ -22,8 +22,7 @@ * Declaration of GHOST_ITimerTask interface class. */ -#ifndef __GHOST_ITIMERTASK_H__ -#define __GHOST_ITIMERTASK_H__ +#pragma once #include "GHOST_Types.h" @@ -76,5 +75,3 @@ class GHOST_ITimerTask { MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_ITimerTask") #endif }; - -#endif // __GHOST_ITIMERTASK_H__ diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h index 9c72b6f07f9..6e8b61ae5a1 100644 --- a/intern/ghost/GHOST_IWindow.h +++ b/intern/ghost/GHOST_IWindow.h @@ -22,8 +22,7 @@ * Declaration of GHOST_IWindow interface class. */ -#ifndef __GHOST_IWINDOW_H__ -#define __GHOST_IWINDOW_H__ +#pragma once #include "GHOST_Rect.h" #include "GHOST_Types.h" @@ -363,5 +362,3 @@ class GHOST_IWindow { MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_IWindow") #endif }; - -#endif // __GHOST_IWINDOW_H__ diff --git a/intern/ghost/GHOST_IXrContext.h b/intern/ghost/GHOST_IXrContext.h index 3076de96690..dd266a3b6ae 100644 --- a/intern/ghost/GHOST_IXrContext.h +++ b/intern/ghost/GHOST_IXrContext.h @@ -18,8 +18,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_IXRCONTEXT_H__ -#define __GHOST_IXRCONTEXT_H__ +#pragma once #include "GHOST_Types.h" @@ -40,5 +39,3 @@ class GHOST_IXrContext { virtual bool needsUpsideDownDrawing() const = 0; }; - -#endif // __GHOST_IXRCONTEXT_H__ diff --git a/intern/ghost/GHOST_Path-api.h b/intern/ghost/GHOST_Path-api.h index 53abdf68bb4..4cc232be6b6 100644 --- a/intern/ghost/GHOST_Path-api.h +++ b/intern/ghost/GHOST_Path-api.h @@ -21,8 +21,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_PATH_API_H__ -#define __GHOST_PATH_API_H__ +#pragma once #include "GHOST_Types.h" @@ -71,5 +70,3 @@ extern void GHOST_addToSystemRecentFiles(const char *filename); #ifdef __cplusplus } #endif - -#endif diff --git a/intern/ghost/GHOST_Rect.h b/intern/ghost/GHOST_Rect.h index 13632a1c03b..fcc9da20197 100644 --- a/intern/ghost/GHOST_Rect.h +++ b/intern/ghost/GHOST_Rect.h @@ -22,8 +22,7 @@ * Macro's used in GHOST debug target. */ -#ifndef __GHOST_RECT_H__ -#define __GHOST_RECT_H__ +#pragma once #include "GHOST_Types.h" @@ -263,5 +262,3 @@ inline bool GHOST_Rect::isInside(GHOST_TInt32 x, GHOST_TInt32 y) const { return (x >= m_l) && (x <= m_r) && (y >= m_t) && (y <= m_b); } - -#endif // __GHOST_RECT_H__ diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h index b8de31df6c6..5f0516ae121 100644 --- a/intern/ghost/GHOST_Types.h +++ b/intern/ghost/GHOST_Types.h @@ -21,8 +21,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_TYPES_H__ -#define __GHOST_TYPES_H__ +#pragma once #ifdef WITH_CXX_GUARDEDALLOC # include "MEM_guardedalloc.h" @@ -677,5 +676,3 @@ typedef struct GHOST_XrError { } GHOST_XrError; #endif - -#endif // __GHOST_TYPES_H__ diff --git a/intern/ghost/intern/GHOST_Buttons.h b/intern/ghost/intern/GHOST_Buttons.h index 0b824739950..e28fae8870c 100644 --- a/intern/ghost/intern/GHOST_Buttons.h +++ b/intern/ghost/intern/GHOST_Buttons.h @@ -22,8 +22,7 @@ * Declaration of GHOST_Buttons struct. */ -#ifndef __GHOST_BUTTONS_H__ -#define __GHOST_BUTTONS_H__ +#pragma once #include "GHOST_Types.h" @@ -62,5 +61,3 @@ struct GHOST_Buttons { GHOST_TUns8 m_ButtonMiddle : 1; GHOST_TUns8 m_ButtonRight : 1; }; - -#endif // __GHOST_BUTTONS_H__ diff --git a/intern/ghost/intern/GHOST_CallbackEventConsumer.h b/intern/ghost/intern/GHOST_CallbackEventConsumer.h index 9c3fc642209..a1664e77717 100644 --- a/intern/ghost/intern/GHOST_CallbackEventConsumer.h +++ b/intern/ghost/intern/GHOST_CallbackEventConsumer.h @@ -22,8 +22,7 @@ * Declaration of GHOST_CallbackEventConsumer class. */ -#ifndef __GHOST_CALLBACKEVENTCONSUMER_H__ -#define __GHOST_CALLBACKEVENTCONSUMER_H__ +#pragma once #include "GHOST_C-api.h" #include "GHOST_IEventConsumer.h" @@ -66,5 +65,3 @@ class GHOST_CallbackEventConsumer : public GHOST_IEventConsumer { MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_CallbackEventConsumer") #endif }; - -#endif // __GHOST_CALLBACKEVENTCONSUMER_H__ diff --git a/intern/ghost/intern/GHOST_Context.h b/intern/ghost/intern/GHOST_Context.h index 411a7de5c79..33eeacbb203 100644 --- a/intern/ghost/intern/GHOST_Context.h +++ b/intern/ghost/intern/GHOST_Context.h @@ -22,8 +22,7 @@ * Declaration of GHOST_Context class. */ -#ifndef __GHOST_CONTEXT_H__ -#define __GHOST_CONTEXT_H__ +#pragma once #include "GHOST_IContext.h" #include "GHOST_Types.h" @@ -160,5 +159,3 @@ bool win32_silent_chk(bool result); # define WIN32_CHK_SILENT(x, silent) ((silent) ? win32_silent_chk(x) : WIN32_CHK(x)) #endif /* _WIN32 */ - -#endif // __GHOST_CONTEXT_H__ diff --git a/intern/ghost/intern/GHOST_ContextCGL.h b/intern/ghost/intern/GHOST_ContextCGL.h index 37c1ac34299..7b1e186dede 100644 --- a/intern/ghost/intern/GHOST_ContextCGL.h +++ b/intern/ghost/intern/GHOST_ContextCGL.h @@ -21,8 +21,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_CONTEXTCGL_H__ -#define __GHOST_CONTEXTCGL_H__ +#pragma once #include "GHOST_Context.h" @@ -137,5 +136,3 @@ class GHOST_ContextCGL : public GHOST_Context { void metalUpdateFramebuffer(); void metalSwapBuffers(); }; - -#endif // __GHOST_CONTEXTCGL_H__ diff --git a/intern/ghost/intern/GHOST_ContextD3D.h b/intern/ghost/intern/GHOST_ContextD3D.h index c482992a6e2..e85516838fc 100644 --- a/intern/ghost/intern/GHOST_ContextD3D.h +++ b/intern/ghost/intern/GHOST_ContextD3D.h @@ -18,8 +18,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_CONTEXTD3D_H__ -#define __GHOST_CONTEXTD3D_H__ +#pragma once #ifndef WIN32 # error WIN32 only! @@ -132,5 +131,3 @@ class GHOST_ContextD3D : public GHOST_Context { ID3D11Device *m_device; ID3D11DeviceContext *m_device_ctx; }; - -#endif /* __GHOST_CONTEXTD3D_H__ */ diff --git a/intern/ghost/intern/GHOST_ContextEGL.h b/intern/ghost/intern/GHOST_ContextEGL.h index da5ca7ef93f..e5dae0d22a8 100644 --- a/intern/ghost/intern/GHOST_ContextEGL.h +++ b/intern/ghost/intern/GHOST_ContextEGL.h @@ -21,8 +21,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_CONTEXTEGL_H__ -#define __GHOST_CONTEXTEGL_H__ +#pragma once #include "GHOST_Context.h" @@ -137,5 +136,3 @@ class GHOST_ContextEGL : public GHOST_Context { static HMODULE s_d3dcompiler; #endif }; - -#endif // __GHOST_CONTEXTEGL_H__ diff --git a/intern/ghost/intern/GHOST_ContextGLX.h b/intern/ghost/intern/GHOST_ContextGLX.h index 07d2601cd17..e5654b1aed7 100644 --- a/intern/ghost/intern/GHOST_ContextGLX.h +++ b/intern/ghost/intern/GHOST_ContextGLX.h @@ -21,8 +21,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_CONTEXTGLX_H__ -#define __GHOST_CONTEXTGLX_H__ +#pragma once #include "GHOST_Context.h" @@ -128,5 +127,3 @@ class GHOST_ContextGLX : public GHOST_Context { /* used to get GLX info */ int GHOST_X11_GL_GetAttributes( int *attribs, int attribs_max, bool is_stereo_visual, bool need_alpha, bool for_fb_config); - -#endif // __GHOST_CONTEXTGLX_H__ diff --git a/intern/ghost/intern/GHOST_ContextNone.h b/intern/ghost/intern/GHOST_ContextNone.h index 2a3c08701b4..b1ac349e4a7 100644 --- a/intern/ghost/intern/GHOST_ContextNone.h +++ b/intern/ghost/intern/GHOST_ContextNone.h @@ -23,8 +23,7 @@ * Declaration of GHOST_Context class. */ -#ifndef __GHOST_CONTEXTNONE_H__ -#define __GHOST_CONTEXTNONE_H__ +#pragma once #include "GHOST_Context.h" @@ -86,5 +85,3 @@ class GHOST_ContextNone : public GHOST_Context { private: int m_swapInterval; }; - -#endif // __GHOST_CONTEXTNONE_H__ diff --git a/intern/ghost/intern/GHOST_ContextSDL.h b/intern/ghost/intern/GHOST_ContextSDL.h index 670d930e1e7..ead2e91181c 100644 --- a/intern/ghost/intern/GHOST_ContextSDL.h +++ b/intern/ghost/intern/GHOST_ContextSDL.h @@ -21,8 +21,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_CONTEXTSDL_H__ -#define __GHOST_CONTEXTSDL_H__ +#pragma once #include "GHOST_Context.h" @@ -121,5 +120,3 @@ class GHOST_ContextSDL : public GHOST_Context { static SDL_GLContext s_sharedContext; static int s_sharedCount; }; - -#endif // __GHOST_CONTEXTSDL_H__ diff --git a/intern/ghost/intern/GHOST_ContextWGL.h b/intern/ghost/intern/GHOST_ContextWGL.h index a8d2c18b463..087fca100e4 100644 --- a/intern/ghost/intern/GHOST_ContextWGL.h +++ b/intern/ghost/intern/GHOST_ContextWGL.h @@ -21,8 +21,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_CONTEXTWGL_H__ -#define __GHOST_CONTEXTWGL_H__ +#pragma once //#define WIN32_COMPOSITING @@ -130,5 +129,3 @@ class GHOST_ContextWGL : public GHOST_Context { static HGLRC s_sharedHGLRC; static int s_sharedCount; }; - -#endif // __GHOST_CONTEXTWGL_H__ diff --git a/intern/ghost/intern/GHOST_Debug.h b/intern/ghost/intern/GHOST_Debug.h index 5b5c2688297..424f95aa573 100644 --- a/intern/ghost/intern/GHOST_Debug.h +++ b/intern/ghost/intern/GHOST_Debug.h @@ -22,8 +22,7 @@ * Macro's used in GHOST debug target. */ -#ifndef __GHOST_DEBUG_H__ -#define __GHOST_DEBUG_H__ +#pragma once #ifdef _MSC_VER # ifdef DEBUG @@ -79,5 +78,3 @@ #else // WITH_GHOST_DEBUG # define GHOST_ASSERT(x, info) ((void)0) #endif // WITH_GHOST_DEBUG - -#endif // __GHOST_DEBUG_H__ diff --git a/intern/ghost/intern/GHOST_DisplayManager.h b/intern/ghost/intern/GHOST_DisplayManager.h index 58b36c0035b..67b9aada55f 100644 --- a/intern/ghost/intern/GHOST_DisplayManager.h +++ b/intern/ghost/intern/GHOST_DisplayManager.h @@ -22,8 +22,7 @@ * Declaration of GHOST_DisplayManager class. */ -#ifndef __GHOST_DISPLAYMANAGER_H__ -#define __GHOST_DISPLAYMANAGER_H__ +#pragma once #include "GHOST_Types.h" @@ -127,5 +126,3 @@ class GHOST_DisplayManager { MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_DisplayManager") #endif }; - -#endif // __GHOST_DISPLAYMANAGER_H__ diff --git a/intern/ghost/intern/GHOST_DisplayManagerCocoa.h b/intern/ghost/intern/GHOST_DisplayManagerCocoa.h index c99e93279f7..5edd555a78b 100644 --- a/intern/ghost/intern/GHOST_DisplayManagerCocoa.h +++ b/intern/ghost/intern/GHOST_DisplayManagerCocoa.h @@ -22,8 +22,7 @@ * Declaration of GHOST_DisplayManagerCocoa class. */ -#ifndef __GHOST_DISPLAYMANAGERCOCOA_H__ -#define __GHOST_DISPLAYMANAGERCOCOA_H__ +#pragma once #ifndef __APPLE__ # error Apple only! @@ -93,5 +92,3 @@ class GHOST_DisplayManagerCocoa : public GHOST_DisplayManager { /** Cached display id's for each display. */ // CGDirectDisplayID* m_displayIDs; }; - -#endif // __GHOST_DISPLAYMANAGERCOCOA_H__ diff --git a/intern/ghost/intern/GHOST_DisplayManagerNULL.h b/intern/ghost/intern/GHOST_DisplayManagerNULL.h index 266a3e9a699..4ca06faec12 100644 --- a/intern/ghost/intern/GHOST_DisplayManagerNULL.h +++ b/intern/ghost/intern/GHOST_DisplayManagerNULL.h @@ -19,8 +19,7 @@ * Declaration of GHOST_DisplayManagerNULL class. */ -#ifndef __GHOST_DISPLAYMANAGERNULL_H__ -#define __GHOST_DISPLAYMANAGERNULL_H__ +#pragma once #include "GHOST_DisplayManager.h" #include "GHOST_SystemNULL.h" @@ -58,5 +57,3 @@ class GHOST_DisplayManagerNULL : public GHOST_DisplayManager { private: GHOST_SystemNULL *m_system; }; - -#endif /* __GHOST_DISPLAYMANAGERNULL_H__ */ diff --git a/intern/ghost/intern/GHOST_DisplayManagerSDL.h b/intern/ghost/intern/GHOST_DisplayManagerSDL.h index f7704d57ab0..9a79a842057 100644 --- a/intern/ghost/intern/GHOST_DisplayManagerSDL.h +++ b/intern/ghost/intern/GHOST_DisplayManagerSDL.h @@ -19,8 +19,7 @@ * Declaration of GHOST_DisplayManagerSDL class. */ -#ifndef __GHOST_DISPLAYMANAGERSDL_H__ -#define __GHOST_DISPLAYMANAGERSDL_H__ +#pragma once #include "GHOST_DisplayManager.h" @@ -58,5 +57,3 @@ class GHOST_DisplayManagerSDL : public GHOST_DisplayManager { GHOST_SystemSDL *m_system; SDL_DisplayMode m_mode; }; - -#endif /* __GHOST_DISPLAYMANAGERSDL_H__ */ diff --git a/intern/ghost/intern/GHOST_DisplayManagerWin32.h b/intern/ghost/intern/GHOST_DisplayManagerWin32.h index c4ad90b1de7..3392d515c16 100644 --- a/intern/ghost/intern/GHOST_DisplayManagerWin32.h +++ b/intern/ghost/intern/GHOST_DisplayManagerWin32.h @@ -22,8 +22,7 @@ * Declaration of GHOST_DisplayManagerWin32 class. */ -#ifndef __GHOST_DISPLAYMANAGERWIN32_H__ -#define __GHOST_DISPLAYMANAGERWIN32_H__ +#pragma once #ifndef WIN32 # error WIN32 only! @@ -87,5 +86,3 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager { protected: }; - -#endif // __GHOST_DISPLAYMANAGERWIN32_H__ diff --git a/intern/ghost/intern/GHOST_DisplayManagerX11.h b/intern/ghost/intern/GHOST_DisplayManagerX11.h index 941152aa034..a36ff8d49f1 100644 --- a/intern/ghost/intern/GHOST_DisplayManagerX11.h +++ b/intern/ghost/intern/GHOST_DisplayManagerX11.h @@ -22,8 +22,7 @@ * Declaration of GHOST_DisplayManagerX11 class. */ -#ifndef __GHOST_DISPLAYMANAGERX11_H__ -#define __GHOST_DISPLAYMANAGERX11_H__ +#pragma once #include "GHOST_DisplayManager.h" @@ -86,5 +85,3 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager { private: GHOST_SystemX11 *m_system; }; - -#endif // diff --git a/intern/ghost/intern/GHOST_DropTargetWin32.h b/intern/ghost/intern/GHOST_DropTargetWin32.h index ee75c017981..ecce3a68835 100644 --- a/intern/ghost/intern/GHOST_DropTargetWin32.h +++ b/intern/ghost/intern/GHOST_DropTargetWin32.h @@ -21,8 +21,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_DROPTARGETWIN32_H__ -#define __GHOST_DROPTARGETWIN32_H__ +#pragma once #include "GHOST_SystemWin32.h" #include "GHOST_WindowWin32.h" @@ -150,5 +149,3 @@ class GHOST_DropTargetWin32 : public IDropTarget { MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_DropTargetWin32") #endif }; - -#endif // __GHOST_DROPTARGETWIN32_H__ diff --git a/intern/ghost/intern/GHOST_DropTargetX11.h b/intern/ghost/intern/GHOST_DropTargetX11.h index 9ca12442085..066f2f6bba2 100644 --- a/intern/ghost/intern/GHOST_DropTargetX11.h +++ b/intern/ghost/intern/GHOST_DropTargetX11.h @@ -21,8 +21,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_DROPTARGETX11_H__ -#define __GHOST_DROPTARGETX11_H__ +#pragma once #include "GHOST_SystemX11.h" #include "GHOST_WindowX11.h" @@ -126,5 +125,3 @@ class GHOST_DropTargetX11 { MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_DropTargetX11") #endif }; - -#endif // __GHOST_DROPTARGETX11_H__ diff --git a/intern/ghost/intern/GHOST_Event.h b/intern/ghost/intern/GHOST_Event.h index 2c14df7f243..845d62fa810 100644 --- a/intern/ghost/intern/GHOST_Event.h +++ b/intern/ghost/intern/GHOST_Event.h @@ -22,8 +22,7 @@ * Declaration of GHOST_Event class. */ -#ifndef __GHOST_EVENT_H__ -#define __GHOST_EVENT_H__ +#pragma once #include "GHOST_IEvent.h" @@ -90,5 +89,3 @@ class GHOST_Event : public GHOST_IEvent { /** Pointer to the event data. */ GHOST_TEventDataPtr m_data; }; - -#endif // __GHOST_EVENT_H__ diff --git a/intern/ghost/intern/GHOST_EventButton.h b/intern/ghost/intern/GHOST_EventButton.h index 4247ae150a4..7072e0c5409 100644 --- a/intern/ghost/intern/GHOST_EventButton.h +++ b/intern/ghost/intern/GHOST_EventButton.h @@ -22,8 +22,7 @@ * Declaration of GHOST_EventButton class. */ -#ifndef __GHOST_EVENTBUTTON_H__ -#define __GHOST_EVENTBUTTON_H__ +#pragma once #include "GHOST_Event.h" #include "GHOST_Window.h" @@ -57,5 +56,3 @@ class GHOST_EventButton : public GHOST_Event { /** The button event data. */ GHOST_TEventButtonData m_buttonEventData; }; - -#endif // __GHOST_EVENTBUTTON_H__ diff --git a/intern/ghost/intern/GHOST_EventCursor.h b/intern/ghost/intern/GHOST_EventCursor.h index 8ba657fd9fa..ba85cd74723 100644 --- a/intern/ghost/intern/GHOST_EventCursor.h +++ b/intern/ghost/intern/GHOST_EventCursor.h @@ -22,8 +22,7 @@ * Declaration of GHOST_EventCursor class. */ -#ifndef __GHOST_EVENTCURSOR_H__ -#define __GHOST_EVENTCURSOR_H__ +#pragma once #include "GHOST_Event.h" @@ -58,5 +57,3 @@ class GHOST_EventCursor : public GHOST_Event { /** The x,y-coordinates of the cursor position. */ GHOST_TEventCursorData m_cursorEventData; }; - -#endif // __GHOST_EVENTCURSOR_H__ diff --git a/intern/ghost/intern/GHOST_EventDragnDrop.h b/intern/ghost/intern/GHOST_EventDragnDrop.h index 36291e8a254..10975792993 100644 --- a/intern/ghost/intern/GHOST_EventDragnDrop.h +++ b/intern/ghost/intern/GHOST_EventDragnDrop.h @@ -21,8 +21,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_EVENTDRAGNDROP_H__ -#define __GHOST_EVENTDRAGNDROP_H__ +#pragma once #include "GHOST_Event.h" extern "C" { @@ -122,5 +121,3 @@ class GHOST_EventDragnDrop : public GHOST_Event { /** The x,y-coordinates of the cursor position. */ GHOST_TEventDragnDropData m_dragnDropEventData; }; - -#endif // __GHOST_EVENTDRAGNDROP_H__ diff --git a/intern/ghost/intern/GHOST_EventKey.h b/intern/ghost/intern/GHOST_EventKey.h index 8f59c555914..cb71b452d80 100644 --- a/intern/ghost/intern/GHOST_EventKey.h +++ b/intern/ghost/intern/GHOST_EventKey.h @@ -22,8 +22,7 @@ * Declaration of GHOST_EventKey class. */ -#ifndef __GHOST_EVENTKEY_H__ -#define __GHOST_EVENTKEY_H__ +#pragma once #include <string.h> @@ -84,5 +83,3 @@ class GHOST_EventKey : public GHOST_Event { /** The key event data. */ GHOST_TEventKeyData m_keyEventData; }; - -#endif // __GHOST_EVENTKEY_H__ diff --git a/intern/ghost/intern/GHOST_EventManager.h b/intern/ghost/intern/GHOST_EventManager.h index ada5abda89b..befbdc72a5c 100644 --- a/intern/ghost/intern/GHOST_EventManager.h +++ b/intern/ghost/intern/GHOST_EventManager.h @@ -22,8 +22,7 @@ * Declaration of GHOST_EventManager class. */ -#ifndef __GHOST_EVENTMANAGER_H__ -#define __GHOST_EVENTMANAGER_H__ +#pragma once #include <deque> #include <vector> @@ -140,5 +139,3 @@ class GHOST_EventManager { MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_EventManager") #endif }; - -#endif // __GHOST_EVENTMANAGER_H__ diff --git a/intern/ghost/intern/GHOST_EventNDOF.h b/intern/ghost/intern/GHOST_EventNDOF.h index 196d3868ccd..64e67434b74 100644 --- a/intern/ghost/intern/GHOST_EventNDOF.h +++ b/intern/ghost/intern/GHOST_EventNDOF.h @@ -18,8 +18,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_EVENTNDOF_H__ -#define __GHOST_EVENTNDOF_H__ +#pragma once #ifndef WITH_INPUT_NDOF # error NDOF code included in non-NDOF-enabled build @@ -50,5 +49,3 @@ class GHOST_EventNDOFButton : public GHOST_Event { m_data = &m_buttonData; } }; - -#endif // __GHOST_EVENTNDOF_H__ diff --git a/intern/ghost/intern/GHOST_EventPrinter.h b/intern/ghost/intern/GHOST_EventPrinter.h index ead16525ec6..42de4da5ee5 100644 --- a/intern/ghost/intern/GHOST_EventPrinter.h +++ b/intern/ghost/intern/GHOST_EventPrinter.h @@ -22,8 +22,7 @@ * Declaration of GHOST_EventPrinter class. */ -#ifndef __GHOST_EVENTPRINTER_H__ -#define __GHOST_EVENTPRINTER_H__ +#pragma once #include "GHOST_IEventConsumer.h" @@ -48,5 +47,3 @@ class GHOST_EventPrinter : public GHOST_IEventConsumer { */ void getKeyString(GHOST_TKey key, char str[32]) const; }; - -#endif // __GHOST_EVENTPRINTER_H__ diff --git a/intern/ghost/intern/GHOST_EventString.h b/intern/ghost/intern/GHOST_EventString.h index f0d3ffb9e91..8cd24a8a78b 100644 --- a/intern/ghost/intern/GHOST_EventString.h +++ b/intern/ghost/intern/GHOST_EventString.h @@ -22,8 +22,7 @@ * Declaration of GHOST_EventString class. */ -#ifndef __GHOST_EVENTSTRING_H__ -#define __GHOST_EVENTSTRING_H__ +#pragma once #include "GHOST_Event.h" @@ -54,5 +53,3 @@ class GHOST_EventString : public GHOST_Event { free(m_data); } }; - -#endif // __GHOST_EVENTSTRING_H__ diff --git a/intern/ghost/intern/GHOST_EventTrackpad.h b/intern/ghost/intern/GHOST_EventTrackpad.h index 795e969b16d..a22f8a34fad 100644 --- a/intern/ghost/intern/GHOST_EventTrackpad.h +++ b/intern/ghost/intern/GHOST_EventTrackpad.h @@ -22,8 +22,7 @@ * Declaration of GHOST_EventTrackpad class. */ -#ifndef __GHOST_EVENTTRACKPAD_H__ -#define __GHOST_EVENTTRACKPAD_H__ +#pragma once #include "GHOST_Event.h" @@ -61,5 +60,3 @@ class GHOST_EventTrackpad : public GHOST_Event { /** The mouse pan data */ GHOST_TEventTrackpadData m_trackpadEventData; }; - -#endif // _GHOST_EVENT_PAN_H_ diff --git a/intern/ghost/intern/GHOST_EventWheel.h b/intern/ghost/intern/GHOST_EventWheel.h index 4d3eeb9cd83..ea62e02d08d 100644 --- a/intern/ghost/intern/GHOST_EventWheel.h +++ b/intern/ghost/intern/GHOST_EventWheel.h @@ -22,8 +22,7 @@ * Declaration of GHOST_EventWheel class. */ -#ifndef __GHOST_EVENTWHEEL_H__ -#define __GHOST_EVENTWHEEL_H__ +#pragma once #include "GHOST_Event.h" @@ -51,5 +50,3 @@ class GHOST_EventWheel : public GHOST_Event { /** The z-displacement of the mouse wheel. */ GHOST_TEventWheelData m_wheelEventData; }; - -#endif // __GHOST_EVENTWHEEL_H__ diff --git a/intern/ghost/intern/GHOST_IXrGraphicsBinding.h b/intern/ghost/intern/GHOST_IXrGraphicsBinding.h index b199c5f9b28..de8bf9f1a5a 100644 --- a/intern/ghost/intern/GHOST_IXrGraphicsBinding.h +++ b/intern/ghost/intern/GHOST_IXrGraphicsBinding.h @@ -18,8 +18,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_IXRGRAPHICSBINDING_H__ -#define __GHOST_IXRGRAPHICSBINDING_H__ +#pragma once #include <memory> #include <string> @@ -71,5 +70,3 @@ class GHOST_IXrGraphicsBinding { std::unique_ptr<GHOST_IXrGraphicsBinding> GHOST_XrGraphicsBindingCreateFromType( GHOST_TXrGraphicsBinding type, GHOST_Context *ghost_ctx); - -#endif /* __GHOST_IXRGRAPHICSBINDING_H__ */ diff --git a/intern/ghost/intern/GHOST_IconX11.h b/intern/ghost/intern/GHOST_IconX11.h index c5bcf4bedeb..615a7dae6b5 100644 --- a/intern/ghost/intern/GHOST_IconX11.h +++ b/intern/ghost/intern/GHOST_IconX11.h @@ -22,8 +22,7 @@ * Icon image data for X11. */ -#ifndef __GHOST_ICONX11_H__ -#define __GHOST_ICONX11_H__ +#pragma once /* * import bpy @@ -1013,5 +1012,3 @@ static const unsigned long BLENDER_ICONS_WM_X11[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; - -#endif // __GHOST_ICONX11_H__ diff --git a/intern/ghost/intern/GHOST_ImeWin32.h b/intern/ghost/intern/GHOST_ImeWin32.h index 112217023a7..74698d50659 100644 --- a/intern/ghost/intern/GHOST_ImeWin32.h +++ b/intern/ghost/intern/GHOST_ImeWin32.h @@ -23,8 +23,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_IME_H__ -#define __GHOST_IME_H__ +#pragma once #ifdef WITH_INPUT_IME @@ -388,4 +387,3 @@ class GHOST_ImeWin32 { }; #endif // WITH_INPUT_IME -#endif // __GHOST_IME_H__ diff --git a/intern/ghost/intern/GHOST_ModifierKeys.h b/intern/ghost/intern/GHOST_ModifierKeys.h index 27ad4034068..c41ce8b7f39 100644 --- a/intern/ghost/intern/GHOST_ModifierKeys.h +++ b/intern/ghost/intern/GHOST_ModifierKeys.h @@ -22,8 +22,7 @@ * Declaration of GHOST_ModifierKeys struct. */ -#ifndef __GHOST_MODIFIERKEYS_H__ -#define __GHOST_MODIFIERKEYS_H__ +#pragma once #include "GHOST_Types.h" @@ -87,5 +86,3 @@ struct GHOST_ModifierKeys { /** Bitfield that stores the appropriate key state. */ GHOST_TUns8 m_OS : 1; }; - -#endif // __GHOST_MODIFIERKEYS_H__ diff --git a/intern/ghost/intern/GHOST_NDOFManager.h b/intern/ghost/intern/GHOST_NDOFManager.h index a190607ca66..d0b49bc13c2 100644 --- a/intern/ghost/intern/GHOST_NDOFManager.h +++ b/intern/ghost/intern/GHOST_NDOFManager.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __GHOST_NDOFMANAGER_H__ -#define __GHOST_NDOFMANAGER_H__ +#pragma once #ifndef WITH_INPUT_NDOF # error NDOF code included in non-NDOF-enabled build @@ -167,5 +166,3 @@ class GHOST_NDOFManager { bool m_motionEventPending; float m_deadZone; // discard motion with each component < this }; - -#endif diff --git a/intern/ghost/intern/GHOST_NDOFManagerCocoa.h b/intern/ghost/intern/GHOST_NDOFManagerCocoa.h index bd1e6903f94..f7c3599502e 100644 --- a/intern/ghost/intern/GHOST_NDOFManagerCocoa.h +++ b/intern/ghost/intern/GHOST_NDOFManagerCocoa.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __GHOST_NDOFMANAGERCOCOA_H__ -#define __GHOST_NDOFMANAGERCOCOA_H__ +#pragma once #include "GHOST_NDOFManager.h" @@ -29,5 +28,3 @@ class GHOST_NDOFManagerCocoa : public GHOST_NDOFManager { bool available(); }; - -#endif // #include guard diff --git a/intern/ghost/intern/GHOST_NDOFManagerUnix.h b/intern/ghost/intern/GHOST_NDOFManagerUnix.h index 75bd022631a..6dd4289ffac 100644 --- a/intern/ghost/intern/GHOST_NDOFManagerUnix.h +++ b/intern/ghost/intern/GHOST_NDOFManagerUnix.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __GHOST_NDOFMANAGERUNIX_H__ -#define __GHOST_NDOFMANAGERUNIX_H__ +#pragma once #include "GHOST_NDOFManager.h" @@ -32,5 +31,3 @@ class GHOST_NDOFManagerUnix : public GHOST_NDOFManager { private: bool m_available; }; - -#endif /* __GHOST_NDOFMANAGERUNIX_H__ */ diff --git a/intern/ghost/intern/GHOST_NDOFManagerWin32.h b/intern/ghost/intern/GHOST_NDOFManagerWin32.h index 9ed5e6ab978..62d9b9207dc 100644 --- a/intern/ghost/intern/GHOST_NDOFManagerWin32.h +++ b/intern/ghost/intern/GHOST_NDOFManagerWin32.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __GHOST_NDOFMANAGERWIN32_H__ -#define __GHOST_NDOFMANAGERWIN32_H__ +#pragma once #include "GHOST_NDOFManager.h" @@ -24,5 +23,3 @@ class GHOST_NDOFManagerWin32 : public GHOST_NDOFManager { GHOST_NDOFManagerWin32(GHOST_System &); bool available(); }; - -#endif // #include guard diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h index c2d712c11cd..e29a9ba0c29 100644 --- a/intern/ghost/intern/GHOST_System.h +++ b/intern/ghost/intern/GHOST_System.h @@ -22,8 +22,7 @@ * Declaration of GHOST_System class. */ -#ifndef __GHOST_SYSTEM_H__ -#define __GHOST_SYSTEM_H__ +#pragma once #include "GHOST_ISystem.h" @@ -424,5 +423,3 @@ inline GHOST_NDOFManager *GHOST_System::getNDOFManager() const return m_ndofManager; } #endif - -#endif // __GHOST_SYSTEM_H__ diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h index bbd6f1d8995..8e36cebb88a 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.h +++ b/intern/ghost/intern/GHOST_SystemCocoa.h @@ -22,8 +22,7 @@ * Declaration of GHOST_SystemCocoa class. */ -#ifndef __GHOST_SYSTEMCOCOA_H__ -#define __GHOST_SYSTEMCOCOA_H__ +#pragma once #ifndef __APPLE__ # error Apple OSX only! @@ -313,5 +312,3 @@ class GHOST_SystemCocoa : public GHOST_System { /** Is the scroll wheel event generated by a multitouch trackpad or mouse? */ bool m_multiTouchScroll; }; - -#endif // __GHOST_SYSTEMCOCOA_H__ diff --git a/intern/ghost/intern/GHOST_SystemNULL.h b/intern/ghost/intern/GHOST_SystemNULL.h index 186cb92d1aa..5becf110b15 100644 --- a/intern/ghost/intern/GHOST_SystemNULL.h +++ b/intern/ghost/intern/GHOST_SystemNULL.h @@ -19,8 +19,7 @@ * Declaration of GHOST_SystemNULL class. */ -#ifndef __GHOST_SYSTEMNULL_H__ -#define __GHOST_SYSTEMNULL_H__ +#pragma once #include "../GHOST_Types.h" #include "GHOST_DisplayManagerNULL.h" @@ -130,5 +129,3 @@ class GHOST_SystemNULL : public GHOST_System { ((glSettings.flags & GHOST_glStereoVisual) != 0)); } }; - -#endif /* __GHOST_SYSTEMNULL_H__ */ diff --git a/intern/ghost/intern/GHOST_SystemPaths.h b/intern/ghost/intern/GHOST_SystemPaths.h index 04180a143cb..ab53b2813cd 100644 --- a/intern/ghost/intern/GHOST_SystemPaths.h +++ b/intern/ghost/intern/GHOST_SystemPaths.h @@ -21,8 +21,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_SYSTEMPATHS_H__ -#define __GHOST_SYSTEMPATHS_H__ +#pragma once #include "GHOST_ISystemPaths.h" @@ -70,5 +69,3 @@ class GHOST_SystemPaths : public GHOST_ISystemPaths { */ virtual void addToSystemRecentFiles(const char *filename) const = 0; }; - -#endif diff --git a/intern/ghost/intern/GHOST_SystemPathsCocoa.h b/intern/ghost/intern/GHOST_SystemPathsCocoa.h index b66379649e7..188f6f02286 100644 --- a/intern/ghost/intern/GHOST_SystemPathsCocoa.h +++ b/intern/ghost/intern/GHOST_SystemPathsCocoa.h @@ -21,8 +21,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_SYSTEMPATHSCOCOA_H__ -#define __GHOST_SYSTEMPATHSCOCOA_H__ +#pragma once #ifndef __APPLE__ # error Apple OSX only! @@ -67,5 +66,3 @@ class GHOST_SystemPathsCocoa : public GHOST_SystemPaths { */ void addToSystemRecentFiles(const char *filename) const; }; - -#endif // __GHOST_SYSTEMPATHSCOCOA_H__ diff --git a/intern/ghost/intern/GHOST_SystemPathsUnix.h b/intern/ghost/intern/GHOST_SystemPathsUnix.h index f9f89f6e79b..8d2f26a28aa 100644 --- a/intern/ghost/intern/GHOST_SystemPathsUnix.h +++ b/intern/ghost/intern/GHOST_SystemPathsUnix.h @@ -21,8 +21,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_SYSTEMPATHSUNIX_H__ -#define __GHOST_SYSTEMPATHSUNIX_H__ +#pragma once #include "../GHOST_Types.h" #include "GHOST_SystemPaths.h" @@ -65,5 +64,3 @@ class GHOST_SystemPathsUnix : public GHOST_SystemPaths { */ void addToSystemRecentFiles(const char *filename) const; }; - -#endif /* __GHOST_SYSTEMPATHSUNIX_H__ */ diff --git a/intern/ghost/intern/GHOST_SystemPathsWin32.h b/intern/ghost/intern/GHOST_SystemPathsWin32.h index f1924ea51bc..1a1eab21bad 100644 --- a/intern/ghost/intern/GHOST_SystemPathsWin32.h +++ b/intern/ghost/intern/GHOST_SystemPathsWin32.h @@ -21,8 +21,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_SYSTEMPATHSWIN32_H__ -#define __GHOST_SYSTEMPATHSWIN32_H__ +#pragma once #ifndef WIN32 # error WIN32 only! @@ -74,5 +73,3 @@ class GHOST_SystemPathsWin32 : public GHOST_SystemPaths { */ void addToSystemRecentFiles(const char *filename) const; }; - -#endif // __GHOST_SYSTEMPATHSWIN32_H__ diff --git a/intern/ghost/intern/GHOST_SystemSDL.h b/intern/ghost/intern/GHOST_SystemSDL.h index 8feec9de61d..4b2c52f8282 100644 --- a/intern/ghost/intern/GHOST_SystemSDL.h +++ b/intern/ghost/intern/GHOST_SystemSDL.h @@ -19,8 +19,7 @@ * Declaration of GHOST_SystemSDL class. */ -#ifndef __GHOST_SYSTEMSDL_H__ -#define __GHOST_SYSTEMSDL_H__ +#pragma once #include "../GHOST_Types.h" #include "GHOST_DisplayManagerSDL.h" @@ -102,5 +101,3 @@ class GHOST_SystemSDL : public GHOST_System { /// The vector of windows that need to be updated. std::vector<GHOST_WindowSDL *> m_dirty_windows; }; - -#endif diff --git a/intern/ghost/intern/GHOST_SystemWayland.h b/intern/ghost/intern/GHOST_SystemWayland.h index 89cd3406b69..30ee7679287 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.h +++ b/intern/ghost/intern/GHOST_SystemWayland.h @@ -19,8 +19,7 @@ * Declaration of GHOST_SystemWayland class. */ -#ifndef __GHOST_SYSTEMWAYLAND_H__ -#define __GHOST_SYSTEMWAYLAND_H__ +#pragma once #include "../GHOST_Types.h" #include "GHOST_System.h" @@ -107,5 +106,3 @@ class GHOST_SystemWayland : public GHOST_System { struct display_t *d; std::string selection; }; - -#endif /* __GHOST_SYSTEMWAYLAND_H__ */ diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 849aa5a96f5..f59b106afd6 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -1143,10 +1143,16 @@ GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA BYTE state[256] = {0}; int r; GetKeyboardState((PBYTE)state); + bool ctrl_pressed = state[VK_CONTROL] & 0x80; + bool alt_pressed = state[VK_MENU] & 0x80; + /* No text with control key pressed (Alt can be used to insert special characters though!). */ + if (ctrl_pressed && !alt_pressed) { + utf8_char[0] = '\0'; + } // Don't call ToUnicodeEx on dead keys as it clears the buffer and so won't allow diacritical // composition. - if (MapVirtualKeyW(vk, 2) != 0) { + else if (MapVirtualKeyW(vk, 2) != 0) { // todo: ToUnicodeEx can respond with up to 4 utf16 chars (only 2 here). // Could be up to 24 utf8 bytes. if ((r = ToUnicodeEx( diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h index 6b7901c2ade..24925b9c403 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.h +++ b/intern/ghost/intern/GHOST_SystemWin32.h @@ -22,8 +22,7 @@ * Declaration of GHOST_SystemWin32 class. */ -#ifndef __GHOST_SYSTEMWIN32_H__ -#define __GHOST_SYSTEMWIN32_H__ +#pragma once #ifndef WIN32 # error WIN32 only! @@ -488,4 +487,3 @@ inline void GHOST_SystemWin32::handleKeyboardChange(void) } } } -#endif // __GHOST_SYSTEMWIN32_H__ diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h index 5888605ec95..ad58138d416 100644 --- a/intern/ghost/intern/GHOST_SystemX11.h +++ b/intern/ghost/intern/GHOST_SystemX11.h @@ -22,8 +22,7 @@ * Declaration of GHOST_SystemX11 class. */ -#ifndef __GHOST_SYSTEMX11_H__ -#define __GHOST_SYSTEMX11_H__ +#pragma once #include <X11/XKBlib.h> /* allow detectable autorepeate */ #include <X11/Xlib.h> @@ -392,5 +391,3 @@ class GHOST_SystemX11 : public GHOST_System { bool generateWindowExposeEvents(); }; - -#endif diff --git a/intern/ghost/intern/GHOST_TaskbarWin32.h b/intern/ghost/intern/GHOST_TaskbarWin32.h index 58641123c24..e6464f5e626 100644 --- a/intern/ghost/intern/GHOST_TaskbarWin32.h +++ b/intern/ghost/intern/GHOST_TaskbarWin32.h @@ -17,8 +17,7 @@ /** \file * \ingroup GHOST */ -#ifndef __GHOST_TASKBARWIN32_H__ -#define __GHOST_TASKBARWIN32_H__ +#pragma once #ifndef WIN32 # error WIN32 only! @@ -128,5 +127,3 @@ class ITaskbarList3 : public ITaskbarList2 { virtual HRESULT STDMETHODCALLTYPE SetThumbnailClip(HWND hwnd, RECT *prcClip) = 0; }; #endif /* ITaskbarList3 */ - -#endif /*__GHOST_TASKBARWIN32_H__*/ diff --git a/intern/ghost/intern/GHOST_TaskbarX11.h b/intern/ghost/intern/GHOST_TaskbarX11.h index cd00e25106c..25de5aa9511 100644 --- a/intern/ghost/intern/GHOST_TaskbarX11.h +++ b/intern/ghost/intern/GHOST_TaskbarX11.h @@ -17,8 +17,7 @@ /** \file * \ingroup GHOST */ -#ifndef __GHOST_TASKBARX11_H__ -#define __GHOST_TASKBARX11_H__ +#pragma once class GHOST_TaskBarX11 { public: @@ -34,5 +33,3 @@ class GHOST_TaskBarX11 { private: void *handle; }; - -#endif /*__GHOST_TASKBARX11_H__*/ diff --git a/intern/ghost/intern/GHOST_TimerManager.h b/intern/ghost/intern/GHOST_TimerManager.h index 039663a7a0e..2e0f5d42230 100644 --- a/intern/ghost/intern/GHOST_TimerManager.h +++ b/intern/ghost/intern/GHOST_TimerManager.h @@ -22,8 +22,7 @@ * Declaration of GHOST_TimerManager class. */ -#ifndef __GHOST_TIMERMANAGER_H__ -#define __GHOST_TIMERMANAGER_H__ +#pragma once #include <vector> @@ -112,5 +111,3 @@ class GHOST_TimerManager { MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_TimerManager") #endif }; - -#endif // __GHOST_TIMERMANAGER_H__ diff --git a/intern/ghost/intern/GHOST_TimerTask.h b/intern/ghost/intern/GHOST_TimerTask.h index 561d9b3e705..6dc0728e19b 100644 --- a/intern/ghost/intern/GHOST_TimerTask.h +++ b/intern/ghost/intern/GHOST_TimerTask.h @@ -22,8 +22,7 @@ * Declaration of GHOST_TimerTask class. */ -#ifndef __GHOST_TIMERTASK_H__ -#define __GHOST_TIMERTASK_H__ +#pragma once #include "GHOST_ITimerTask.h" @@ -179,5 +178,3 @@ class GHOST_TimerTask : public GHOST_ITimerTask { /** Auxiliary storage room. */ GHOST_TUns32 m_auxData; }; - -#endif // __GHOST_TIMERTASK_H__ diff --git a/intern/ghost/intern/GHOST_Window.h b/intern/ghost/intern/GHOST_Window.h index 7cfea5110c5..c8c21b2b08f 100644 --- a/intern/ghost/intern/GHOST_Window.h +++ b/intern/ghost/intern/GHOST_Window.h @@ -22,8 +22,7 @@ * Declaration of GHOST_Window class. */ -#ifndef __GHOST_WINDOW_H__ -#define __GHOST_WINDOW_H__ +#pragma once #include "GHOST_IWindow.h" @@ -456,5 +455,3 @@ inline GHOST_TStandardCursor GHOST_Window::getCursorShape() const { return m_cursorShape; } - -#endif // _GHOST_WINDOW_H diff --git a/intern/ghost/intern/GHOST_WindowCocoa.h b/intern/ghost/intern/GHOST_WindowCocoa.h index 15429eab5db..97486c9e77a 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.h +++ b/intern/ghost/intern/GHOST_WindowCocoa.h @@ -22,8 +22,7 @@ * Declaration of GHOST_WindowCocoa class. */ -#ifndef __GHOST_WINDOWCOCOA_H__ -#define __GHOST_WINDOWCOCOA_H__ +#pragma once #ifndef __APPLE__ # error Apple OSX only! @@ -327,5 +326,3 @@ class GHOST_WindowCocoa : public GHOST_Window { bool m_debug_context; // for debug messages during context setup bool m_is_dialog; }; - -#endif // __GHOST_WINDOWCOCOA_H__ diff --git a/intern/ghost/intern/GHOST_WindowManager.h b/intern/ghost/intern/GHOST_WindowManager.h index 661439191c5..34fdfd30f27 100644 --- a/intern/ghost/intern/GHOST_WindowManager.h +++ b/intern/ghost/intern/GHOST_WindowManager.h @@ -22,8 +22,7 @@ * Declaration of GHOST_WindowManager class. */ -#ifndef __GHOST_WINDOWMANAGER_H__ -#define __GHOST_WINDOWMANAGER_H__ +#pragma once #include <vector> @@ -149,5 +148,3 @@ class GHOST_WindowManager { MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_WindowManager") #endif }; - -#endif // __GHOST_WINDOWMANAGER_H__ diff --git a/intern/ghost/intern/GHOST_WindowNULL.h b/intern/ghost/intern/GHOST_WindowNULL.h index e1aa0cb7f13..0b5a7ee3450 100644 --- a/intern/ghost/intern/GHOST_WindowNULL.h +++ b/intern/ghost/intern/GHOST_WindowNULL.h @@ -19,8 +19,7 @@ * Declaration of GHOST_WindowNULL class. */ -#ifndef __GHOST_WINDOWNULL_H__ -#define __GHOST_WINDOWNULL_H__ +#pragma once #include "GHOST_Window.h" @@ -177,5 +176,3 @@ class GHOST_WindowNULL : public GHOST_Window { return NULL; } }; - -#endif // __GHOST_WINDOWNULL_H__ diff --git a/intern/ghost/intern/GHOST_WindowSDL.h b/intern/ghost/intern/GHOST_WindowSDL.h index 5039c742c9d..643c54c282e 100644 --- a/intern/ghost/intern/GHOST_WindowSDL.h +++ b/intern/ghost/intern/GHOST_WindowSDL.h @@ -19,8 +19,7 @@ * Declaration of GHOST_WindowSDL class. */ -#ifndef __GHOST_WINDOWSDL_H__ -#define __GHOST_WINDOWSDL_H__ +#pragma once #include "GHOST_SystemSDL.h" #include "GHOST_Window.h" @@ -149,5 +148,3 @@ class GHOST_WindowSDL : public GHOST_Window { GHOST_TUns16 getDPIHint(); }; - -#endif // __GHOST_WINDOWSDL_H__ diff --git a/intern/ghost/intern/GHOST_WindowWayland.h b/intern/ghost/intern/GHOST_WindowWayland.h index ff1eb60e154..1ee41f4d0f6 100644 --- a/intern/ghost/intern/GHOST_WindowWayland.h +++ b/intern/ghost/intern/GHOST_WindowWayland.h @@ -20,8 +20,7 @@ * Declaration of GHOST_WindowWayland class. */ -#ifndef __GHOST_WINDOWWAYLAND_H__ -#define __GHOST_WINDOWWAYLAND_H__ +#pragma once #include "GHOST_Window.h" @@ -124,5 +123,3 @@ class GHOST_WindowWayland : public GHOST_Window { */ GHOST_Context *newDrawingContext(GHOST_TDrawingContextType type) override; }; - -#endif // __GHOST_WINDOWWAYLAND_H__ diff --git a/intern/ghost/intern/GHOST_WindowWin32.h b/intern/ghost/intern/GHOST_WindowWin32.h index dbed7c5ee5f..224ff53bf7b 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.h +++ b/intern/ghost/intern/GHOST_WindowWin32.h @@ -22,8 +22,7 @@ * Declaration of GHOST_WindowWin32 class. */ -#ifndef __GHOST_WINDOWWIN32_H__ -#define __GHOST_WINDOWWIN32_H__ +#pragma once #ifndef WIN32 # error WIN32 only! @@ -586,5 +585,3 @@ class GHOST_WindowWin32 : public GHOST_Window { #endif bool m_debug_context; }; - -#endif // __GHOST_WINDOWWIN32_H__ diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h index 4232ff40b52..ef5d1755f1a 100644 --- a/intern/ghost/intern/GHOST_WindowX11.h +++ b/intern/ghost/intern/GHOST_WindowX11.h @@ -22,8 +22,7 @@ * Declaration of GHOST_WindowX11 class. */ -#ifndef __GHOST_WINDOWX11_H__ -#define __GHOST_WINDOWX11_H__ +#pragma once #include "GHOST_Window.h" #include <X11/Xlib.h> @@ -288,5 +287,3 @@ class GHOST_WindowX11 : public GHOST_Window { void motifFullScreen(bool set); bool motifIsFullScreen() const; }; - -#endif // __GHOST_WINDOWX11_H__ diff --git a/intern/ghost/intern/GHOST_XrContext.h b/intern/ghost/intern/GHOST_XrContext.h index 9be57cd90cc..d2edb40c080 100644 --- a/intern/ghost/intern/GHOST_XrContext.h +++ b/intern/ghost/intern/GHOST_XrContext.h @@ -18,8 +18,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_XRCONTEXT_H__ -#define __GHOST_XRCONTEXT_H__ +#pragma once #include <memory> #include <vector> @@ -131,5 +130,3 @@ class GHOST_XrContext : public GHOST_IXrContext { GHOST_TXrGraphicsBinding determineGraphicsBindingTypeToEnable( const GHOST_XrContextCreateInfo *create_info); }; - -#endif // __GHOST_XRCONTEXT_H__ diff --git a/intern/ghost/intern/GHOST_XrException.h b/intern/ghost/intern/GHOST_XrException.h index 9f779961e4f..30c33eaf98f 100644 --- a/intern/ghost/intern/GHOST_XrException.h +++ b/intern/ghost/intern/GHOST_XrException.h @@ -18,8 +18,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_XREXCEPTION_H__ -#define __GHOST_XREXCEPTION_H__ +#pragma once #include <exception> @@ -41,5 +40,3 @@ class GHOST_XrException : public std::exception { const char *m_msg; int m_result; }; - -#endif // __GHOST_XREXCEPTION_H__ diff --git a/intern/ghost/intern/GHOST_XrSession.h b/intern/ghost/intern/GHOST_XrSession.h index da0128b2851..74555c0c170 100644 --- a/intern/ghost/intern/GHOST_XrSession.h +++ b/intern/ghost/intern/GHOST_XrSession.h @@ -18,8 +18,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_XRSESSION_H__ -#define __GHOST_XRSESSION_H__ +#pragma once #include <map> #include <memory> @@ -84,5 +83,3 @@ class GHOST_XrSession { void beginFrameDrawing(); void endFrameDrawing(std::vector<XrCompositionLayerBaseHeader *> *layers); }; - -#endif /* GHOST_XRSESSION_H__ */ diff --git a/intern/ghost/intern/GHOST_XrSwapchain.h b/intern/ghost/intern/GHOST_XrSwapchain.h index 7a3e7fcea68..33a1c17b993 100644 --- a/intern/ghost/intern/GHOST_XrSwapchain.h +++ b/intern/ghost/intern/GHOST_XrSwapchain.h @@ -18,8 +18,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_XRSWAPCHAIN_H__ -#define __GHOST_XRSWAPCHAIN_H__ +#pragma once #include <memory> @@ -45,5 +44,3 @@ class GHOST_XrSwapchain { int32_t m_image_width, m_image_height; bool m_is_srgb_buffer = false; }; - -#endif // GHOST_XRSWAPCHAIN_H diff --git a/intern/ghost/intern/GHOST_Xr_intern.h b/intern/ghost/intern/GHOST_Xr_intern.h index d59ffd31940..137541c4528 100644 --- a/intern/ghost/intern/GHOST_Xr_intern.h +++ b/intern/ghost/intern/GHOST_Xr_intern.h @@ -18,8 +18,7 @@ * \ingroup GHOST */ -#ifndef __GHOST_XR_INTERN_H__ -#define __GHOST_XR_INTERN_H__ +#pragma once #include <memory> #include <vector> @@ -46,5 +45,3 @@ (void)_res; \ } \ (void)0 - -#endif /* __GHOST_XR_INTERN_H__ */ diff --git a/intern/ghost/intern/GHOST_Xr_openxr_includes.h b/intern/ghost/intern/GHOST_Xr_openxr_includes.h index 9cac43b1549..d1deaeb0d1a 100644 --- a/intern/ghost/intern/GHOST_Xr_openxr_includes.h +++ b/intern/ghost/intern/GHOST_Xr_openxr_includes.h @@ -22,8 +22,7 @@ * installed. */ -#ifndef __GHOST_XR_SYSTEM_INCLUDES_H__ -#define __GHOST_XR_SYSTEM_INCLUDES_H__ +#pragma once /* Platform headers */ #ifdef XR_USE_PLATFORM_WIN32 @@ -48,5 +47,3 @@ #include <openxr/openxr.h> #include <openxr/openxr_platform.h> - -#endif /* __GHOST_XR_SYSTEM_INCLUDES_H__ */ diff --git a/intern/guardedalloc/CMakeLists.txt b/intern/guardedalloc/CMakeLists.txt index cb24df65ba0..1ab365a376a 100644 --- a/intern/guardedalloc/CMakeLists.txt +++ b/intern/guardedalloc/CMakeLists.txt @@ -28,6 +28,7 @@ set(INC_SYS ) set(SRC + ./intern/leak_detector.cc ./intern/mallocn.c ./intern/mallocn_guarded_impl.c ./intern/mallocn_lockfree_impl.c diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index 1318aa10697..604330bd1d3 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -211,6 +211,10 @@ extern size_t (*MEM_get_peak_memory)(void) ATTR_WARN_UNUSED_RESULT; extern const char *(*MEM_name_ptr)(void *vmemh); #endif +/** This should be called as early as possible in the program. When it has been called, information + * about memory leaks will be printed on exit. */ +void MEM_initialize_memleak_detection(void); + /* Switch allocator to slower but fully guarded mode. */ void MEM_use_guarded_allocator(void); diff --git a/intern/guardedalloc/intern/leak_detector.cc b/intern/guardedalloc/intern/leak_detector.cc new file mode 100644 index 00000000000..4b2689ee28c --- /dev/null +++ b/intern/guardedalloc/intern/leak_detector.cc @@ -0,0 +1,61 @@ +/* + * 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. + */ + +/** \file + * \ingroup MEM + */ + +#include "MEM_guardedalloc.h" +#include "mallocn_intern.h" + +bool leak_detector_has_run = false; +char free_after_leak_detection_message[] = + "Freeing memory after the leak detector has run. This can happen when using " + "static variables in C++ that are defined outside of functions. To fix this " + "error, use the 'construct on first use' idiom."; + +namespace { +class MemLeakPrinter { + public: + ~MemLeakPrinter() + { + leak_detector_has_run = true; + const uint leaked_blocks = MEM_get_memory_blocks_in_use(); + if (leaked_blocks == 0) { + return; + } + const size_t mem_in_use = MEM_get_memory_in_use(); + printf("Error: Not freed memory blocks: %u, total unfreed memory %f MB\n", + leaked_blocks, + (double)mem_in_use / 1024 / 1024); + MEM_printmemlist(); + } +}; +} // namespace + +void MEM_initialize_memleak_detection(void) +{ + /** + * This variable is constructed when this function is first called. This should happen as soon as + * possible when the program starts. + * + * It is destructed when the program exits. During destruction, it will print information about + * leaked memory blocks. Static variables are destructed in reversed order of their + * construction. Therefore, all static variables that own memory have to be constructed after + * this function has been called. + */ + static MemLeakPrinter printer; +} diff --git a/intern/guardedalloc/intern/mallocn_guarded_impl.c b/intern/guardedalloc/intern/mallocn_guarded_impl.c index 5e523204020..2c207935e43 100644 --- a/intern/guardedalloc/intern/mallocn_guarded_impl.c +++ b/intern/guardedalloc/intern/mallocn_guarded_impl.c @@ -898,6 +898,10 @@ void MEM_guarded_freeN(void *vmemh) memt = (MemTail *)(((char *)memh) + sizeof(MemHead) + memh->len); if (memt->tag3 == MEMTAG3) { + if (leak_detector_has_run) { + MemorY_ErroR(memh->name, free_after_leak_detection_message); + } + memh->tag1 = MEMFREE; memh->tag2 = MEMFREE; memt->tag3 = MEMFREE; diff --git a/intern/guardedalloc/intern/mallocn_inline.h b/intern/guardedalloc/intern/mallocn_inline.h index f8bb7861fc9..4e73eb9bad6 100644 --- a/intern/guardedalloc/intern/mallocn_inline.h +++ b/intern/guardedalloc/intern/mallocn_inline.h @@ -33,6 +33,10 @@ #ifndef __MALLOCN_INLINE_H__ #define __MALLOCN_INLINE_H__ +#ifdef __cplusplus +extern "C" { +#endif + MEM_INLINE bool MEM_size_safe_multiply(size_t a, size_t b, size_t *result) { /* A size_t with its high-half bits all set to 1. */ @@ -52,4 +56,8 @@ MEM_INLINE bool MEM_size_safe_multiply(size_t a, size_t b, size_t *result) return ((high_bits & (a | b)) == 0 || (*result / b == a)); } +#ifdef __cplusplus +} +#endif + #endif /* __MALLOCN_INLINE_H__ */ diff --git a/intern/guardedalloc/intern/mallocn_intern.h b/intern/guardedalloc/intern/mallocn_intern.h index ef8845a66b3..8fc3e432157 100644 --- a/intern/guardedalloc/intern/mallocn_intern.h +++ b/intern/guardedalloc/intern/mallocn_intern.h @@ -100,11 +100,18 @@ size_t malloc_usable_size(void *ptr); #include "mallocn_inline.h" +#ifdef __cplusplus +extern "C" { +#endif + #define ALIGNED_MALLOC_MINIMUM_ALIGNMENT sizeof(void *) void *aligned_malloc(size_t size, size_t alignment); void aligned_free(void *ptr); +extern bool leak_detector_has_run; +extern char free_after_leak_detection_message[]; + /* Prototypes for counted allocator functions */ size_t MEM_lockfree_allocN_len(const void *vmemh) ATTR_WARN_UNUSED_RESULT; void MEM_lockfree_freeN(void *vmemh); @@ -191,4 +198,8 @@ size_t MEM_guarded_get_peak_memory(void) ATTR_WARN_UNUSED_RESULT; const char *MEM_guarded_name_ptr(void *vmemh); #endif +#ifdef __cplusplus +} +#endif + #endif /* __MALLOCN_INTERN_H__ */ diff --git a/intern/guardedalloc/intern/mallocn_lockfree_impl.c b/intern/guardedalloc/intern/mallocn_lockfree_impl.c index 205cc688d72..b71e2c963eb 100644 --- a/intern/guardedalloc/intern/mallocn_lockfree_impl.c +++ b/intern/guardedalloc/intern/mallocn_lockfree_impl.c @@ -101,6 +101,10 @@ size_t MEM_lockfree_allocN_len(const void *vmemh) void MEM_lockfree_freeN(void *vmemh) { + if (leak_detector_has_run) { + print_error("%s\n", free_after_leak_detection_message); + } + MemHead *memh = MEMHEAD_FROM_PTR(vmemh); size_t len = MEM_lockfree_allocN_len(vmemh); diff --git a/intern/itasc/Scene.cpp b/intern/itasc/Scene.cpp index 5438a005d7c..0d2486ceac7 100644 --- a/intern/itasc/Scene.cpp +++ b/intern/itasc/Scene.cpp @@ -16,532 +16,623 @@ namespace iTaSC { class SceneLock : public ControlledObject::JointLockCallback { -private: - Scene* m_scene; - Range m_qrange; - -public: - SceneLock(Scene* scene) : - m_scene(scene), m_qrange(0,0) {} - virtual ~SceneLock() {} - - void setRange(Range& range) - { - m_qrange = range; - } - // lock a joint, no need to update output - virtual void lockJoint(unsigned int q_nr, unsigned int ndof) - { - q_nr += m_qrange.start; - project(m_scene->m_Wq, Range(q_nr, ndof), m_qrange).setZero(); - } - // lock a joint and update output in view of reiteration - virtual void lockJoint(unsigned int q_nr, unsigned int ndof, double* qdot) - { - q_nr += m_qrange.start; - project(m_scene->m_Wq, Range(q_nr, ndof), m_qrange).setZero(); - // update the output vector so that the movement of this joint will be - // taken into account and we can put the joint back in its initial position - // which means that the jacobian doesn't need to be changed - for (unsigned int i=0 ;i<ndof ; ++i, ++q_nr) { - m_scene->m_ydot -= m_scene->m_A.col(q_nr)*qdot[i]; - } - } + private: + Scene *m_scene; + Range m_qrange; + + public: + SceneLock(Scene *scene) : m_scene(scene), m_qrange(0, 0) + { + } + virtual ~SceneLock() + { + } + + void setRange(Range &range) + { + m_qrange = range; + } + // lock a joint, no need to update output + virtual void lockJoint(unsigned int q_nr, unsigned int ndof) + { + q_nr += m_qrange.start; + project(m_scene->m_Wq, Range(q_nr, ndof), m_qrange).setZero(); + } + // lock a joint and update output in view of reiteration + virtual void lockJoint(unsigned int q_nr, unsigned int ndof, double *qdot) + { + q_nr += m_qrange.start; + project(m_scene->m_Wq, Range(q_nr, ndof), m_qrange).setZero(); + // update the output vector so that the movement of this joint will be + // taken into account and we can put the joint back in its initial position + // which means that the jacobian doesn't need to be changed + for (unsigned int i = 0; i < ndof; ++i, ++q_nr) { + m_scene->m_ydot -= m_scene->m_A.col(q_nr) * qdot[i]; + } + } }; -Scene::Scene(): - m_A(), m_B(), m_Atemp(), m_Wq(), m_Jf(), m_Jq(), m_Ju(), m_Cf(), m_Cq(), m_Jf_inv(), - m_Vf(),m_Uf(), m_Wy(), m_ydot(), m_qdot(), m_xdot(), m_Sf(),m_tempf(), - m_ncTotal(0),m_nqTotal(0),m_nuTotal(0),m_nsets(0), - m_solver(NULL),m_cache(NULL) +Scene::Scene() + : m_A(), + m_B(), + m_Atemp(), + m_Wq(), + m_Jf(), + m_Jq(), + m_Ju(), + m_Cf(), + m_Cq(), + m_Jf_inv(), + m_Vf(), + m_Uf(), + m_Wy(), + m_ydot(), + m_qdot(), + m_xdot(), + m_Sf(), + m_tempf(), + m_ncTotal(0), + m_nqTotal(0), + m_nuTotal(0), + m_nsets(0), + m_solver(NULL), + m_cache(NULL) { - m_minstep = 0.01; - m_maxstep = 0.06; + m_minstep = 0.01; + m_maxstep = 0.06; } -Scene::~Scene() +Scene::~Scene() { - ConstraintMap::iterator constraint_it; - while ((constraint_it = constraints.begin()) != constraints.end()) { - delete constraint_it->second; - constraints.erase(constraint_it); - } - ObjectMap::iterator object_it; - while ((object_it = objects.begin()) != objects.end()) { - delete object_it->second; - objects.erase(object_it); - } + ConstraintMap::iterator constraint_it; + while ((constraint_it = constraints.begin()) != constraints.end()) { + delete constraint_it->second; + constraints.erase(constraint_it); + } + ObjectMap::iterator object_it; + while ((object_it = objects.begin()) != objects.end()) { + delete object_it->second; + objects.erase(object_it); + } } bool Scene::setParam(SceneParam paramId, double value) { - switch (paramId) { - case MIN_TIMESTEP: - m_minstep = value; - break; - case MAX_TIMESTEP: - m_maxstep = value; - break; - default: - return false; - } - return true; + switch (paramId) { + case MIN_TIMESTEP: + m_minstep = value; + break; + case MAX_TIMESTEP: + m_maxstep = value; + break; + default: + return false; + } + return true; } -bool Scene::addObject(const std::string& name, Object* object, UncontrolledObject* base, const std::string& baseFrame) +bool Scene::addObject(const std::string &name, + Object *object, + UncontrolledObject *base, + const std::string &baseFrame) { - // finalize the object before adding - if (!object->finalize()) - return false; - //Check if Object is controlled or uncontrolled. - if(object->getType()==Object::Controlled){ - int baseFrameIndex = base->addEndEffector(baseFrame); - if (baseFrameIndex < 0) - return false; - std::pair<ObjectMap::iterator, bool> result; - if (base->getNrOfCoordinates() == 0) { - // base is fixed object, no coordinate range - result = objects.insert(ObjectMap::value_type( - name, new Object_struct(object,base,baseFrameIndex, - Range(m_nqTotal,object->getNrOfCoordinates()), - Range(m_ncTotal,((ControlledObject*)object)->getNrOfConstraints()), - Range(0,0)))); - } else { - // base is a moving object, must be in list already - ObjectMap::iterator base_it; - for (base_it=objects.begin(); base_it != objects.end(); base_it++) { - if (base_it->second->object == base) - break; - } - if (base_it == objects.end()) - return false; - result = objects.insert(ObjectMap::value_type( - name, new Object_struct(object,base,baseFrameIndex, - Range(m_nqTotal,object->getNrOfCoordinates()), - Range(m_ncTotal,((ControlledObject*)object)->getNrOfConstraints()), - base_it->second->coordinaterange))); - } - if (!result.second) { - return false; - } - m_nqTotal+=object->getNrOfCoordinates(); - m_ncTotal+=((ControlledObject*)object)->getNrOfConstraints(); - return true; + // finalize the object before adding + if (!object->finalize()) + return false; + // Check if Object is controlled or uncontrolled. + if (object->getType() == Object::Controlled) { + int baseFrameIndex = base->addEndEffector(baseFrame); + if (baseFrameIndex < 0) + return false; + std::pair<ObjectMap::iterator, bool> result; + if (base->getNrOfCoordinates() == 0) { + // base is fixed object, no coordinate range + result = objects.insert(ObjectMap::value_type( + name, + new Object_struct(object, + base, + baseFrameIndex, + Range(m_nqTotal, object->getNrOfCoordinates()), + Range(m_ncTotal, ((ControlledObject *)object)->getNrOfConstraints()), + Range(0, 0)))); + } + else { + // base is a moving object, must be in list already + ObjectMap::iterator base_it; + for (base_it = objects.begin(); base_it != objects.end(); base_it++) { + if (base_it->second->object == base) + break; + } + if (base_it == objects.end()) + return false; + result = objects.insert(ObjectMap::value_type( + name, + new Object_struct(object, + base, + baseFrameIndex, + Range(m_nqTotal, object->getNrOfCoordinates()), + Range(m_ncTotal, ((ControlledObject *)object)->getNrOfConstraints()), + base_it->second->coordinaterange))); } - if(object->getType()==Object::UnControlled){ - if ((WorldObject*)base != &Object::world) - return false; - std::pair<ObjectMap::iterator,bool> result = objects.insert(ObjectMap::value_type( - name,new Object_struct(object,base,0, - Range(0,0), - Range(0,0), - Range(m_nuTotal,object->getNrOfCoordinates())))); - if(!result.second) - return false; - m_nuTotal+=object->getNrOfCoordinates(); - return true; + if (!result.second) { + return false; } - return false; + m_nqTotal += object->getNrOfCoordinates(); + m_ncTotal += ((ControlledObject *)object)->getNrOfConstraints(); + return true; + } + if (object->getType() == Object::UnControlled) { + if ((WorldObject *)base != &Object::world) + return false; + std::pair<ObjectMap::iterator, bool> result = objects.insert( + ObjectMap::value_type(name, + new Object_struct(object, + base, + 0, + Range(0, 0), + Range(0, 0), + Range(m_nuTotal, object->getNrOfCoordinates())))); + if (!result.second) + return false; + m_nuTotal += object->getNrOfCoordinates(); + return true; + } + return false; } -bool Scene::addConstraintSet(const std::string& name,ConstraintSet* task,const std::string& object1,const std::string& object2, const std::string& ee1, const std::string& ee2) +bool Scene::addConstraintSet(const std::string &name, + ConstraintSet *task, + const std::string &object1, + const std::string &object2, + const std::string &ee1, + const std::string &ee2) { - //Check if objects exist: - ObjectMap::iterator object1_it = objects.find(object1); - ObjectMap::iterator object2_it = objects.find(object2); - if(object1_it==objects.end()||object2_it==objects.end()) - return false; - int ee1_index = object1_it->second->object->addEndEffector(ee1); - int ee2_index = object2_it->second->object->addEndEffector(ee2); - if (ee1_index < 0 || ee2_index < 0) - return false; - std::pair<ConstraintMap::iterator,bool> result = - constraints.insert(ConstraintMap::value_type(name,new ConstraintSet_struct( - task,object1_it,ee1_index,object2_it,ee2_index, - Range(m_ncTotal,task->getNrOfConstraints()),Range(6*m_nsets,6)))); - if(!result.second) - return false; - m_ncTotal+=task->getNrOfConstraints(); - m_nsets+=1; - return true; + // Check if objects exist: + ObjectMap::iterator object1_it = objects.find(object1); + ObjectMap::iterator object2_it = objects.find(object2); + if (object1_it == objects.end() || object2_it == objects.end()) + return false; + int ee1_index = object1_it->second->object->addEndEffector(ee1); + int ee2_index = object2_it->second->object->addEndEffector(ee2); + if (ee1_index < 0 || ee2_index < 0) + return false; + std::pair<ConstraintMap::iterator, bool> result = constraints.insert(ConstraintMap::value_type( + name, + new ConstraintSet_struct(task, + object1_it, + ee1_index, + object2_it, + ee2_index, + Range(m_ncTotal, task->getNrOfConstraints()), + Range(6 * m_nsets, 6)))); + if (!result.second) + return false; + m_ncTotal += task->getNrOfConstraints(); + m_nsets += 1; + return true; } -bool Scene::addSolver(Solver* _solver){ - if(m_solver==NULL){ - m_solver=_solver; - return true; - } - else - return false; +bool Scene::addSolver(Solver *_solver) +{ + if (m_solver == NULL) { + m_solver = _solver; + return true; + } + else + return false; } -bool Scene::addCache(Cache* _cache){ - if(m_cache==NULL){ - m_cache=_cache; - return true; - } - else - return false; +bool Scene::addCache(Cache *_cache) +{ + if (m_cache == NULL) { + m_cache = _cache; + return true; + } + else + return false; } -bool Scene::initialize(){ - - //prepare all matrices: - if (m_ncTotal == 0 || m_nqTotal == 0 || m_nsets == 0) - return false; - - m_A = e_zero_matrix(m_ncTotal,m_nqTotal); - if (m_nuTotal > 0) { - m_B = e_zero_matrix(m_ncTotal,m_nuTotal); - m_xdot = e_zero_vector(m_nuTotal); - m_Ju = e_zero_matrix(6*m_nsets,m_nuTotal); - } - m_Atemp = e_zero_matrix(m_ncTotal,6*m_nsets); - m_ydot = e_zero_vector(m_ncTotal); - m_qdot = e_zero_vector(m_nqTotal); - m_Wq = e_zero_matrix(m_nqTotal,m_nqTotal); - m_Wy = e_zero_vector(m_ncTotal); - m_Jq = e_zero_matrix(6*m_nsets,m_nqTotal); - m_Jf = e_zero_matrix(6*m_nsets,6*m_nsets); - m_Jf_inv = m_Jf; - m_Cf = e_zero_matrix(m_ncTotal,m_Jf.rows()); - m_Cq = e_zero_matrix(m_ncTotal,m_nqTotal); - - bool result=true; - // finalize all objects - for (ObjectMap::iterator it=objects.begin(); it!=objects.end(); ++it) { - Object_struct* os = it->second; - - os->object->initCache(m_cache); - if (os->constraintrange.count > 0) - project(m_Cq,os->constraintrange,os->jointrange) = (((ControlledObject*)(os->object))->getCq()); - } - - m_ytask.resize(m_ncTotal); - bool toggle=true; - int cnt = 0; - //Initialize all ConstraintSets: - for(ConstraintMap::iterator it=constraints.begin();it!=constraints.end();++it){ - //Calculate the external pose: - ConstraintSet_struct* cs = it->second; - Frame external_pose; - getConstraintPose(cs->task, cs, external_pose); - result&=cs->task->initialise(external_pose); - cs->task->initCache(m_cache); - for (int i=0; i<cs->constraintrange.count; i++, cnt++) { - m_ytask[cnt] = toggle; - } - toggle = !toggle; - project(m_Cf,cs->constraintrange,cs->featurerange)=cs->task->getCf(); - } +bool Scene::initialize() +{ - if(m_solver!=NULL) - m_solver->init(m_nqTotal,m_ncTotal,m_ytask); - else - return false; + // prepare all matrices: + if (m_ncTotal == 0 || m_nqTotal == 0 || m_nsets == 0) + return false; + m_A = e_zero_matrix(m_ncTotal, m_nqTotal); + if (m_nuTotal > 0) { + m_B = e_zero_matrix(m_ncTotal, m_nuTotal); + m_xdot = e_zero_vector(m_nuTotal); + m_Ju = e_zero_matrix(6 * m_nsets, m_nuTotal); + } + m_Atemp = e_zero_matrix(m_ncTotal, 6 * m_nsets); + m_ydot = e_zero_vector(m_ncTotal); + m_qdot = e_zero_vector(m_nqTotal); + m_Wq = e_zero_matrix(m_nqTotal, m_nqTotal); + m_Wy = e_zero_vector(m_ncTotal); + m_Jq = e_zero_matrix(6 * m_nsets, m_nqTotal); + m_Jf = e_zero_matrix(6 * m_nsets, 6 * m_nsets); + m_Jf_inv = m_Jf; + m_Cf = e_zero_matrix(m_ncTotal, m_Jf.rows()); + m_Cq = e_zero_matrix(m_ncTotal, m_nqTotal); + + bool result = true; + // finalize all objects + for (ObjectMap::iterator it = objects.begin(); it != objects.end(); ++it) { + Object_struct *os = it->second; + + os->object->initCache(m_cache); + if (os->constraintrange.count > 0) + project(m_Cq, + os->constraintrange, + os->jointrange) = (((ControlledObject *)(os->object))->getCq()); + } + + m_ytask.resize(m_ncTotal); + bool toggle = true; + int cnt = 0; + // Initialize all ConstraintSets: + for (ConstraintMap::iterator it = constraints.begin(); it != constraints.end(); ++it) { + // Calculate the external pose: + ConstraintSet_struct *cs = it->second; + Frame external_pose; + getConstraintPose(cs->task, cs, external_pose); + result &= cs->task->initialise(external_pose); + cs->task->initCache(m_cache); + for (int i = 0; i < cs->constraintrange.count; i++, cnt++) { + m_ytask[cnt] = toggle; + } + toggle = !toggle; + project(m_Cf, cs->constraintrange, cs->featurerange) = cs->task->getCf(); + } - return result; + if (m_solver != NULL) + m_solver->init(m_nqTotal, m_ncTotal, m_ytask); + else + return false; + + return result; } -bool Scene::getConstraintPose(ConstraintSet* constraint, void *_param, KDL::Frame& _pose) +bool Scene::getConstraintPose(ConstraintSet *constraint, void *_param, KDL::Frame &_pose) { - // function called from constraint when they need to get the external pose - ConstraintSet_struct* cs = (ConstraintSet_struct*)_param; - // verification, the pointer MUST match - assert (constraint == cs->task); - Object_struct* ob1 = cs->object1->second; - Object_struct* ob2 = cs->object2->second; - //Calculate the external pose: - _pose=(ob1->base->getPose(ob1->baseFrameIndex)*ob1->object->getPose(cs->ee1index)).Inverse()*(ob2->base->getPose(ob2->baseFrameIndex)*ob2->object->getPose(cs->ee2index)); - return true; + // function called from constraint when they need to get the external pose + ConstraintSet_struct *cs = (ConstraintSet_struct *)_param; + // verification, the pointer MUST match + assert(constraint == cs->task); + Object_struct *ob1 = cs->object1->second; + Object_struct *ob2 = cs->object2->second; + // Calculate the external pose: + _pose = + (ob1->base->getPose(ob1->baseFrameIndex) * ob1->object->getPose(cs->ee1index)).Inverse() * + (ob2->base->getPose(ob2->baseFrameIndex) * ob2->object->getPose(cs->ee2index)); + return true; } -bool Scene::update(double timestamp, double timestep, unsigned int numsubstep, bool reiterate, bool cache, bool interpolate) +bool Scene::update(double timestamp, + double timestep, + unsigned int numsubstep, + bool reiterate, + bool cache, + bool interpolate) { - // we must have valid timestep and timestamp - if (timestamp < KDL::epsilon || timestep < 0.0) - return false; - Timestamp ts; - ts.realTimestamp = timestamp; - // initially we start with the full timestep to allow velocity estimation over the full interval - ts.realTimestep = timestep; - setCacheTimestamp(ts); - ts.substep = 0; - // for reiteration don't load cache - // reiteration=additional iteration with same timestamp if application finds the convergence not good enough - ts.reiterate = (reiterate) ? 1 : 0; - ts.interpolate = (interpolate) ? 1 : 0; - ts.cache = (cache) ? 1 : 0; - ts.update = 1; - ts.numstep = (numsubstep & 0xFF); - bool autosubstep = (numsubstep == 0) ? true : false; - if (numsubstep < 1) - numsubstep = 1; - double timesubstep = timestep/numsubstep; - double timeleft = timestep; - - if (timeleft == 0.0) { - // this special case correspond to a request to cache data - for(ObjectMap::iterator it=objects.begin();it!=objects.end();++it){ - it->second->object->pushCache(ts); - } - //Update the Constraints - for(ConstraintMap::iterator it=constraints.begin();it!=constraints.end();++it){ - it->second->task->pushCache(ts); - } - return true; - } - - // double maxqdot; // UNUSED - e_scalar nlcoef; - SceneLock lockCallback(this); - Frame external_pose; - bool locked; - - // initially we keep timestep unchanged so that update function compute the velocity over - while (numsubstep > 0) { - // get objects - for(ObjectMap::iterator it=objects.begin();it!=objects.end();++it) { - Object_struct* os = it->second; - if (os->object->getType()==Object::Controlled) { - ((ControlledObject*)(os->object))->updateControlOutput(ts); - if (os->constraintrange.count > 0) { - project(m_ydot, os->constraintrange) = ((ControlledObject*)(os->object))->getControlOutput(); - project(m_Wy, os->constraintrange) = ((ControlledObject*)(os->object))->getWy(); - // project(m_Cq,os->constraintrange,os->jointrange) = (((ControlledObject*)(os->object))->getCq()); - } - if (os->jointrange.count > 0) { - project(m_Wq,os->jointrange,os->jointrange) = ((ControlledObject*)(os->object))->getWq(); - } - } - if (os->object->getType()==Object::UnControlled && ((UncontrolledObject*)os->object)->getNrOfCoordinates() != 0) { - ((UncontrolledObject*)(os->object))->updateCoordinates(ts); - if (!ts.substep) { - // velocity of uncontrolled object remains constant during substepping - project(m_xdot,os->coordinaterange) = ((UncontrolledObject*)(os->object))->getXudot(); - } - } - } - - //get new Constraints values - for(ConstraintMap::iterator it=constraints.begin();it!=constraints.end();++it) { - ConstraintSet_struct* cs = it->second; - Object_struct* ob1 = cs->object1->second; - Object_struct* ob2 = cs->object2->second; - - if (ob1->base->updated() || ob1->object->updated() || ob2->base->updated() || ob2->object->updated()) { - // the object from which the constraint depends have changed position - // recompute the constraint pose - getConstraintPose(cs->task, cs, external_pose); - cs->task->initialise(external_pose); - } - cs->task->updateControlOutput(ts); - project(m_ydot,cs->constraintrange)=cs->task->getControlOutput(); - if (!ts.substep || cs->task->substep()) { - project(m_Wy,cs->constraintrange)=(cs->task)->getWy(); - //project(m_Cf,cs->constraintrange,cs->featurerange)=cs->task->getCf(); - } - - project(m_Jf,cs->featurerange,cs->featurerange)=cs->task->getJf(); - //std::cout << "Jf = " << Jf << std::endl; - //Transform the reference frame of this jacobian to the world reference frame - Eigen::Block<e_matrix> Jf_part = project(m_Jf,cs->featurerange,cs->featurerange); - changeBase(Jf_part,ob1->base->getPose(ob1->baseFrameIndex)*ob1->object->getPose(cs->ee1index)); - //std::cout << "Jf_w = " << Jf << std::endl; - - //calculate the inverse of Jf - KDL::svd_eigen_HH(project(m_Jf,cs->featurerange,cs->featurerange),m_Uf,m_Sf,m_Vf,m_tempf); - for(unsigned int i=0;i<6;++i) - if(m_Sf(i)<KDL::epsilon) - m_Uf.col(i).setConstant(0.0); - else - m_Uf.col(i)*=(1/m_Sf(i)); - project(m_Jf_inv,cs->featurerange,cs->featurerange).noalias()=m_Vf*m_Uf.transpose(); - - //Get the robotjacobian associated with this constraintset - //Each jacobian is expressed in robot base frame => convert to world reference - //and negate second robot because it is taken reversed when closing the loop: - if(ob1->object->getType()==Object::Controlled){ - project(m_Jq,cs->featurerange,ob1->jointrange) = (((ControlledObject*)(ob1->object))->getJq(cs->ee1index)); - //Transform the reference frame of this jacobian to the world reference frame: - Eigen::Block<e_matrix> Jq_part = project(m_Jq,cs->featurerange,ob1->jointrange); - changeBase(Jq_part,ob1->base->getPose(ob1->baseFrameIndex)); - // if the base of this object is moving, get the Ju part - if (ob1->base->getNrOfCoordinates() != 0) { - // Ju is already computed for world reference frame - project(m_Ju,cs->featurerange,ob1->coordinaterange)=ob1->base->getJu(ob1->baseFrameIndex); - } - } else if (ob1->object->getType() == Object::UnControlled && ((UncontrolledObject*)ob1->object)->getNrOfCoordinates() != 0) { - // object1 is uncontrolled moving object - project(m_Ju,cs->featurerange,ob1->coordinaterange)=((UncontrolledObject*)ob1->object)->getJu(cs->ee1index); - } - if(ob2->object->getType()==Object::Controlled){ - //Get the robotjacobian associated with this constraintset - // process a special case where object2 and object1 are equal but using different end effector - if (ob1->object == ob2->object) { - // we must create a temporary matrix - e_matrix JqTemp(((ControlledObject*)(ob2->object))->getJq(cs->ee2index)); - //Transform the reference frame of this jacobian to the world reference frame: - changeBase(JqTemp,ob2->base->getPose(ob2->baseFrameIndex)); - // substract in place - project(m_Jq,cs->featurerange,ob2->jointrange) -= JqTemp; - } else { - project(m_Jq,cs->featurerange,ob2->jointrange) = -(((ControlledObject*)(ob2->object))->getJq(cs->ee2index)); - //Transform the reference frame of this jacobian to the world reference frame: - Eigen::Block<e_matrix> Jq_part = project(m_Jq,cs->featurerange,ob2->jointrange); - changeBase(Jq_part,ob2->base->getPose(ob2->baseFrameIndex)); - } - if (ob2->base->getNrOfCoordinates() != 0) { - // if base is the same as first object or first object base, - // that portion of m_Ju has been set already => substract inplace - if (ob2->base == ob1->base || ob2->base == ob1->object) { - project(m_Ju,cs->featurerange,ob2->coordinaterange) -= ob2->base->getJu(ob2->baseFrameIndex); - } else { - project(m_Ju,cs->featurerange,ob2->coordinaterange) = -ob2->base->getJu(ob2->baseFrameIndex); - } - } - } else if (ob2->object->getType() == Object::UnControlled && ((UncontrolledObject*)ob2->object)->getNrOfCoordinates() != 0) { - if (ob2->object == ob1->base || ob2->object == ob1->object) { - project(m_Ju,cs->featurerange,ob2->coordinaterange) -= ((UncontrolledObject*)ob2->object)->getJu(cs->ee2index); - } else { - project(m_Ju,cs->featurerange,ob2->coordinaterange) = -((UncontrolledObject*)ob2->object)->getJu(cs->ee2index); - } - } - } - - //Calculate A - m_Atemp.noalias()=m_Cf*m_Jf_inv; - m_A.noalias() = m_Cq-(m_Atemp*m_Jq); - if (m_nuTotal > 0) { - m_B.noalias()=m_Atemp*m_Ju; - m_ydot.noalias() += m_B*m_xdot; - } - - //Call the solver with A, Wq, Wy, ydot to solver qdot: - if(!m_solver->solve(m_A,m_Wy,m_ydot,m_Wq,m_qdot,nlcoef)) - // this should never happen - return false; - //send result to the objects - for(ObjectMap::iterator it=objects.begin();it!=objects.end();++it) { - Object_struct* os = it->second; - if(os->object->getType()==Object::Controlled) - ((ControlledObject*)(os->object))->setJointVelocity(project(m_qdot,os->jointrange)); - } - // compute the constraint velocity - for(ConstraintMap::iterator it=constraints.begin();it!=constraints.end();++it){ - ConstraintSet_struct* cs = it->second; - Object_struct* ob1 = cs->object1->second; - Object_struct* ob2 = cs->object2->second; - //Calculate the twist of the world reference frame due to the robots (Jq*qdot+Ju*chiudot): - e_vector6 external_vel = e_zero_vector(6); - if (ob1->jointrange.count > 0) - external_vel.noalias() += (project(m_Jq,cs->featurerange,ob1->jointrange)*project(m_qdot,ob1->jointrange)); - if (ob2->jointrange.count > 0) - external_vel.noalias() += (project(m_Jq,cs->featurerange,ob2->jointrange)*project(m_qdot,ob2->jointrange)); - if (ob1->coordinaterange.count > 0) - external_vel.noalias() += (project(m_Ju,cs->featurerange,ob1->coordinaterange)*project(m_xdot,ob1->coordinaterange)); - if (ob2->coordinaterange.count > 0) - external_vel.noalias() += (project(m_Ju,cs->featurerange,ob2->coordinaterange)*project(m_xdot,ob2->coordinaterange)); - //the twist caused by the constraint must be opposite because of the closed loop - //estimate the velocity of the joints using the inverse jacobian - e_vector6 estimated_chidot = project(m_Jf_inv,cs->featurerange,cs->featurerange)*(-external_vel); - cs->task->setJointVelocity(estimated_chidot); - } - - if (autosubstep) { - // automatic computing of substep based on maximum joint change - // and joint limit gain variation - // We will pass the joint velocity to each object and they will recommend a maximum timestep - timesubstep = timeleft; - // get armature max joint velocity to estimate the maximum duration of integration - // maxqdot = m_qdot.cwise().abs().maxCoeff(); // UNUSED - double maxsubstep = nlcoef*m_maxstep; - if (maxsubstep < m_minstep) - maxsubstep = m_minstep; - if (timesubstep > maxsubstep) - timesubstep = maxsubstep; - for(ObjectMap::iterator it=objects.begin();it!=objects.end();++it){ - Object_struct* os = it->second; - if(os->object->getType()==Object::Controlled) - ((ControlledObject*)(os->object))->getMaxTimestep(timesubstep); - } - for(ConstraintMap::iterator it=constraints.begin();it!=constraints.end();++it){ - ConstraintSet_struct* cs = it->second; - cs->task->getMaxTimestep(timesubstep); - } - // use substep that are even dividers of timestep for more regularity - maxsubstep = 2.0*floor(timestep/2.0/timesubstep-0.66666); - timesubstep = (maxsubstep < 0.0) ? timestep : timestep/(2.0+maxsubstep); - if (timesubstep >= timeleft-(m_minstep/2.0)) { - timesubstep = timeleft; - numsubstep = 1; - timeleft = 0.; - } else { - numsubstep = 2; - timeleft -= timesubstep; - } - } - if (numsubstep > 1) { - ts.substep = 1; - } else { - // set substep to false for last iteration so that controlled output - // can be updated in updateKinematics() and model_update)() before next call to Secne::update() - ts.substep = 0; - } - // change timestep so that integration is done correctly - ts.realTimestep = timesubstep; - - do { - ObjectMap::iterator it; - Object_struct* os; - locked = false; - for(it=objects.begin();it!=objects.end();++it){ - os = it->second; - if (os->object->getType()==Object::Controlled) { - lockCallback.setRange(os->jointrange); - if (((ControlledObject*)os->object)->updateJoint(ts, lockCallback)) { - // this means one of the joint was locked and we must rerun - // the solver to update the remaining joints - locked = true; - break; - } - } - } - if (locked) { - // Some rows of m_Wq have been cleared so that the corresponding joint will not move - if(!m_solver->solve(m_A,m_Wy,m_ydot,m_Wq,m_qdot,nlcoef)) - // this should never happen - return false; - - //send result to the objects - for(it=objects.begin();it!=objects.end();++it) { - os = it->second; - if(os->object->getType()==Object::Controlled) - ((ControlledObject*)(os->object))->setJointVelocity(project(m_qdot,os->jointrange)); - } - } - } while (locked); - - //Update the Objects - for(ObjectMap::iterator it=objects.begin();it!=objects.end();++it){ - it->second->object->updateKinematics(ts); - // mark this object not updated since the constraint will be updated anyway - // this flag is only useful to detect external updates - it->second->object->updated(false); - } - //Update the Constraints - for(ConstraintMap::iterator it=constraints.begin();it!=constraints.end();++it){ - ConstraintSet_struct* cs = it->second; - //Calculate the external pose: - getConstraintPose(cs->task, cs, external_pose); - cs->task->modelUpdate(external_pose,ts); - // update the constraint output and cache - cs->task->updateKinematics(ts); - } - numsubstep--; - } - return true; -} + // we must have valid timestep and timestamp + if (timestamp < KDL::epsilon || timestep < 0.0) + return false; + Timestamp ts; + ts.realTimestamp = timestamp; + // initially we start with the full timestep to allow velocity estimation over the full interval + ts.realTimestep = timestep; + setCacheTimestamp(ts); + ts.substep = 0; + // for reiteration don't load cache + // reiteration=additional iteration with same timestamp if application finds the convergence not + // good enough + ts.reiterate = (reiterate) ? 1 : 0; + ts.interpolate = (interpolate) ? 1 : 0; + ts.cache = (cache) ? 1 : 0; + ts.update = 1; + ts.numstep = (numsubstep & 0xFF); + bool autosubstep = (numsubstep == 0) ? true : false; + if (numsubstep < 1) + numsubstep = 1; + double timesubstep = timestep / numsubstep; + double timeleft = timestep; + + if (timeleft == 0.0) { + // this special case correspond to a request to cache data + for (ObjectMap::iterator it = objects.begin(); it != objects.end(); ++it) { + it->second->object->pushCache(ts); + } + // Update the Constraints + for (ConstraintMap::iterator it = constraints.begin(); it != constraints.end(); ++it) { + it->second->task->pushCache(ts); + } + return true; + } + + // double maxqdot; // UNUSED + e_scalar nlcoef; + SceneLock lockCallback(this); + Frame external_pose; + bool locked; + + // initially we keep timestep unchanged so that update function compute the velocity over + while (numsubstep > 0) { + // get objects + for (ObjectMap::iterator it = objects.begin(); it != objects.end(); ++it) { + Object_struct *os = it->second; + if (os->object->getType() == Object::Controlled) { + ((ControlledObject *)(os->object))->updateControlOutput(ts); + if (os->constraintrange.count > 0) { + project(m_ydot, + os->constraintrange) = ((ControlledObject *)(os->object))->getControlOutput(); + project(m_Wy, os->constraintrange) = ((ControlledObject *)(os->object))->getWy(); + // project(m_Cq,os->constraintrange,os->jointrange) = + // (((ControlledObject*)(os->object))->getCq()); + } + if (os->jointrange.count > 0) { + project( + m_Wq, os->jointrange, os->jointrange) = ((ControlledObject *)(os->object))->getWq(); + } + } + if (os->object->getType() == Object::UnControlled && + ((UncontrolledObject *)os->object)->getNrOfCoordinates() != 0) { + ((UncontrolledObject *)(os->object))->updateCoordinates(ts); + if (!ts.substep) { + // velocity of uncontrolled object remains constant during substepping + project(m_xdot, os->coordinaterange) = ((UncontrolledObject *)(os->object))->getXudot(); + } + } + } + + // get new Constraints values + for (ConstraintMap::iterator it = constraints.begin(); it != constraints.end(); ++it) { + ConstraintSet_struct *cs = it->second; + Object_struct *ob1 = cs->object1->second; + Object_struct *ob2 = cs->object2->second; + + if (ob1->base->updated() || ob1->object->updated() || ob2->base->updated() || + ob2->object->updated()) { + // the object from which the constraint depends have changed position + // recompute the constraint pose + getConstraintPose(cs->task, cs, external_pose); + cs->task->initialise(external_pose); + } + cs->task->updateControlOutput(ts); + project(m_ydot, cs->constraintrange) = cs->task->getControlOutput(); + if (!ts.substep || cs->task->substep()) { + project(m_Wy, cs->constraintrange) = (cs->task)->getWy(); + // project(m_Cf,cs->constraintrange,cs->featurerange)=cs->task->getCf(); + } + + project(m_Jf, cs->featurerange, cs->featurerange) = cs->task->getJf(); + // std::cout << "Jf = " << Jf << std::endl; + // Transform the reference frame of this jacobian to the world reference frame + Eigen::Block<e_matrix> Jf_part = project(m_Jf, cs->featurerange, cs->featurerange); + changeBase(Jf_part, + ob1->base->getPose(ob1->baseFrameIndex) * ob1->object->getPose(cs->ee1index)); + // std::cout << "Jf_w = " << Jf << std::endl; + + // calculate the inverse of Jf + KDL::svd_eigen_HH( + project(m_Jf, cs->featurerange, cs->featurerange), m_Uf, m_Sf, m_Vf, m_tempf); + for (unsigned int i = 0; i < 6; ++i) + if (m_Sf(i) < KDL::epsilon) + m_Uf.col(i).setConstant(0.0); + else + m_Uf.col(i) *= (1 / m_Sf(i)); + project(m_Jf_inv, cs->featurerange, cs->featurerange).noalias() = m_Vf * m_Uf.transpose(); + + // Get the robotjacobian associated with this constraintset + // Each jacobian is expressed in robot base frame => convert to world reference + // and negate second robot because it is taken reversed when closing the loop: + if (ob1->object->getType() == Object::Controlled) { + project(m_Jq, + cs->featurerange, + ob1->jointrange) = (((ControlledObject *)(ob1->object))->getJq(cs->ee1index)); + // Transform the reference frame of this jacobian to the world reference frame: + Eigen::Block<e_matrix> Jq_part = project(m_Jq, cs->featurerange, ob1->jointrange); + changeBase(Jq_part, ob1->base->getPose(ob1->baseFrameIndex)); + // if the base of this object is moving, get the Ju part + if (ob1->base->getNrOfCoordinates() != 0) { + // Ju is already computed for world reference frame + project(m_Ju, cs->featurerange, ob1->coordinaterange) = ob1->base->getJu( + ob1->baseFrameIndex); + } + } + else if (ob1->object->getType() == Object::UnControlled && + ((UncontrolledObject *)ob1->object)->getNrOfCoordinates() != 0) { + // object1 is uncontrolled moving object + project(m_Ju, + cs->featurerange, + ob1->coordinaterange) = ((UncontrolledObject *)ob1->object)->getJu(cs->ee1index); + } + if (ob2->object->getType() == Object::Controlled) { + // Get the robotjacobian associated with this constraintset + // process a special case where object2 and object1 are equal but using different end + // effector + if (ob1->object == ob2->object) { + // we must create a temporary matrix + e_matrix JqTemp(((ControlledObject *)(ob2->object))->getJq(cs->ee2index)); + // Transform the reference frame of this jacobian to the world reference frame: + changeBase(JqTemp, ob2->base->getPose(ob2->baseFrameIndex)); + // subtract in place + project(m_Jq, cs->featurerange, ob2->jointrange) -= JqTemp; + } + else { + project(m_Jq, cs->featurerange, ob2->jointrange) = -( + ((ControlledObject *)(ob2->object))->getJq(cs->ee2index)); + // Transform the reference frame of this jacobian to the world reference frame: + Eigen::Block<e_matrix> Jq_part = project(m_Jq, cs->featurerange, ob2->jointrange); + changeBase(Jq_part, ob2->base->getPose(ob2->baseFrameIndex)); + } + if (ob2->base->getNrOfCoordinates() != 0) { + // if base is the same as first object or first object base, + // that portion of m_Ju has been set already => subtract inplace + if (ob2->base == ob1->base || ob2->base == ob1->object) { + project(m_Ju, cs->featurerange, ob2->coordinaterange) -= ob2->base->getJu( + ob2->baseFrameIndex); + } + else { + project(m_Ju, cs->featurerange, ob2->coordinaterange) = -ob2->base->getJu( + ob2->baseFrameIndex); + } + } + } + else if (ob2->object->getType() == Object::UnControlled && + ((UncontrolledObject *)ob2->object)->getNrOfCoordinates() != 0) { + if (ob2->object == ob1->base || ob2->object == ob1->object) { + project(m_Ju, cs->featurerange, ob2->coordinaterange) -= + ((UncontrolledObject *)ob2->object)->getJu(cs->ee2index); + } + else { + project(m_Ju, cs->featurerange, ob2->coordinaterange) = + -((UncontrolledObject *)ob2->object)->getJu(cs->ee2index); + } + } + } + + // Calculate A + m_Atemp.noalias() = m_Cf * m_Jf_inv; + m_A.noalias() = m_Cq - (m_Atemp * m_Jq); + if (m_nuTotal > 0) { + m_B.noalias() = m_Atemp * m_Ju; + m_ydot.noalias() += m_B * m_xdot; + } + // Call the solver with A, Wq, Wy, ydot to solver qdot: + if (!m_solver->solve(m_A, m_Wy, m_ydot, m_Wq, m_qdot, nlcoef)) + // this should never happen + return false; + // send result to the objects + for (ObjectMap::iterator it = objects.begin(); it != objects.end(); ++it) { + Object_struct *os = it->second; + if (os->object->getType() == Object::Controlled) + ((ControlledObject *)(os->object))->setJointVelocity(project(m_qdot, os->jointrange)); + } + // compute the constraint velocity + for (ConstraintMap::iterator it = constraints.begin(); it != constraints.end(); ++it) { + ConstraintSet_struct *cs = it->second; + Object_struct *ob1 = cs->object1->second; + Object_struct *ob2 = cs->object2->second; + // Calculate the twist of the world reference frame due to the robots (Jq*qdot+Ju*chiudot): + e_vector6 external_vel = e_zero_vector(6); + if (ob1->jointrange.count > 0) + external_vel.noalias() += (project(m_Jq, cs->featurerange, ob1->jointrange) * + project(m_qdot, ob1->jointrange)); + if (ob2->jointrange.count > 0) + external_vel.noalias() += (project(m_Jq, cs->featurerange, ob2->jointrange) * + project(m_qdot, ob2->jointrange)); + if (ob1->coordinaterange.count > 0) + external_vel.noalias() += (project(m_Ju, cs->featurerange, ob1->coordinaterange) * + project(m_xdot, ob1->coordinaterange)); + if (ob2->coordinaterange.count > 0) + external_vel.noalias() += (project(m_Ju, cs->featurerange, ob2->coordinaterange) * + project(m_xdot, ob2->coordinaterange)); + // the twist caused by the constraint must be opposite because of the closed loop + // estimate the velocity of the joints using the inverse jacobian + e_vector6 estimated_chidot = project(m_Jf_inv, cs->featurerange, cs->featurerange) * + (-external_vel); + cs->task->setJointVelocity(estimated_chidot); + } + + if (autosubstep) { + // automatic computing of substep based on maximum joint change + // and joint limit gain variation + // We will pass the joint velocity to each object and they will recommend a maximum timestep + timesubstep = timeleft; + // get armature max joint velocity to estimate the maximum duration of integration + // maxqdot = m_qdot.cwise().abs().maxCoeff(); // UNUSED + double maxsubstep = nlcoef * m_maxstep; + if (maxsubstep < m_minstep) + maxsubstep = m_minstep; + if (timesubstep > maxsubstep) + timesubstep = maxsubstep; + for (ObjectMap::iterator it = objects.begin(); it != objects.end(); ++it) { + Object_struct *os = it->second; + if (os->object->getType() == Object::Controlled) + ((ControlledObject *)(os->object))->getMaxTimestep(timesubstep); + } + for (ConstraintMap::iterator it = constraints.begin(); it != constraints.end(); ++it) { + ConstraintSet_struct *cs = it->second; + cs->task->getMaxTimestep(timesubstep); + } + // use substep that are even dividers of timestep for more regularity + maxsubstep = 2.0 * floor(timestep / 2.0 / timesubstep - 0.66666); + timesubstep = (maxsubstep < 0.0) ? timestep : timestep / (2.0 + maxsubstep); + if (timesubstep >= timeleft - (m_minstep / 2.0)) { + timesubstep = timeleft; + numsubstep = 1; + timeleft = 0.; + } + else { + numsubstep = 2; + timeleft -= timesubstep; + } + } + if (numsubstep > 1) { + ts.substep = 1; + } + else { + // set substep to false for last iteration so that controlled output + // can be updated in updateKinematics() and model_update)() before next call to + // Secne::update() + ts.substep = 0; + } + // change timestep so that integration is done correctly + ts.realTimestep = timesubstep; + + do { + ObjectMap::iterator it; + Object_struct *os; + locked = false; + for (it = objects.begin(); it != objects.end(); ++it) { + os = it->second; + if (os->object->getType() == Object::Controlled) { + lockCallback.setRange(os->jointrange); + if (((ControlledObject *)os->object)->updateJoint(ts, lockCallback)) { + // this means one of the joint was locked and we must rerun + // the solver to update the remaining joints + locked = true; + break; + } + } + } + if (locked) { + // Some rows of m_Wq have been cleared so that the corresponding joint will not move + if (!m_solver->solve(m_A, m_Wy, m_ydot, m_Wq, m_qdot, nlcoef)) + // this should never happen + return false; + + // send result to the objects + for (it = objects.begin(); it != objects.end(); ++it) { + os = it->second; + if (os->object->getType() == Object::Controlled) + ((ControlledObject *)(os->object))->setJointVelocity(project(m_qdot, os->jointrange)); + } + } + } while (locked); + + // Update the Objects + for (ObjectMap::iterator it = objects.begin(); it != objects.end(); ++it) { + it->second->object->updateKinematics(ts); + // mark this object not updated since the constraint will be updated anyway + // this flag is only useful to detect external updates + it->second->object->updated(false); + } + // Update the Constraints + for (ConstraintMap::iterator it = constraints.begin(); it != constraints.end(); ++it) { + ConstraintSet_struct *cs = it->second; + // Calculate the external pose: + getConstraintPose(cs->task, cs, external_pose); + cs->task->modelUpdate(external_pose, ts); + // update the constraint output and cache + cs->task->updateKinematics(ts); + } + numsubstep--; + } + return true; } + +} // namespace iTaSC diff --git a/intern/mantaflow/intern/MANTA_main.cpp b/intern/mantaflow/intern/MANTA_main.cpp index 676a2fd785e..6e6451be725 100644 --- a/intern/mantaflow/intern/MANTA_main.cpp +++ b/intern/mantaflow/intern/MANTA_main.cpp @@ -876,6 +876,7 @@ void MANTA::initializeRNAMap(FluidModifierData *fmd) mRNAMap["CACHE_DIR"] = cacheDirectory; mRNAMap["COMPRESSION_OPENVDB"] = vdbCompressionMethod; mRNAMap["PRECISION_OPENVDB"] = vdbPrecisionHalf; + mRNAMap["PP_PARTICLE_MAXIMUM"] = to_string(fds->sys_particle_maximum); /* Fluid object names. */ mRNAMap["NAME_FLAGS"] = FLUID_NAME_FLAGS; @@ -1013,7 +1014,7 @@ void MANTA::initializeRNAMap(FluidModifierData *fmd) mRNAMap["NAME_GUIDEVEL_X"] = FLUID_NAME_GUIDEVEL_X; mRNAMap["NAME_GUIDEVEL_Y"] = FLUID_NAME_GUIDEVEL_Y; mRNAMap["NAME_GUIDEVEL_Z"] = FLUID_NAME_GUIDEVEL_Z; - mRNAMap["NAME_GUIDEVEL"] = FLUID_NAME_GUIDEVEL; + mRNAMap["NAME_VELOCITY_GUIDE"] = FLUID_NAME_VELOCITY_GUIDE; /* Cache file names. */ mRNAMap["NAME_CONFIG"] = FLUID_NAME_CONFIG; @@ -1538,6 +1539,7 @@ bool MANTA::bakeGuiding(FluidModifierData *fmd, int framenr) cacheDirGuiding[0] = '\0'; string volume_format = getCacheFileEnding(fds->cache_data_format); + string resumable_cache = !(fds->flags & FLUID_DOMAIN_USE_RESUMABLE_CACHE) ? "False" : "True"; BLI_path_join(cacheDirGuiding, sizeof(cacheDirGuiding), @@ -1548,7 +1550,7 @@ bool MANTA::bakeGuiding(FluidModifierData *fmd, int framenr) ss.str(""); ss << "bake_guiding_" << mCurrentID << "('" << escapeSlashes(cacheDirGuiding) << "', " << framenr - << ", '" << volume_format << "')"; + << ", '" << volume_format << "', " << resumable_cache << ")"; pythonCommands.push_back(ss.str()); return runPythonString(pythonCommands); @@ -2189,9 +2191,16 @@ bool MANTA::hasParticles(FluidModifierData *fmd, int framenr) bool MANTA::hasGuiding(FluidModifierData *fmd, int framenr, bool sourceDomain) { string subdirectory = (sourceDomain) ? FLUID_DOMAIN_DIR_DATA : FLUID_DOMAIN_DIR_GUIDE; - string filename = (sourceDomain) ? FLUID_NAME_VELOCITY : FLUID_NAME_GUIDEVEL; + string filename = (sourceDomain) ? FLUID_NAME_DATA : FLUID_NAME_GUIDING; string extension = getCacheFileEnding(fmd->domain->cache_data_format); bool exists = BLI_exists(getFile(fmd, subdirectory, filename, extension, framenr).c_str()); + + /* Check old file naming. */ + if (!exists) { + filename = (sourceDomain) ? FLUID_NAME_VEL : FLUID_NAME_GUIDEVEL; + exists = BLI_exists(getFile(fmd, subdirectory, filename, extension, framenr).c_str()); + } + if (with_debug) cout << "Fluid: Has Guiding: " << exists << endl; diff --git a/intern/mantaflow/intern/strings/fluid_script.h b/intern/mantaflow/intern/strings/fluid_script.h index 4ee3ae59957..83ad201fcbd 100644 --- a/intern/mantaflow/intern/strings/fluid_script.h +++ b/intern/mantaflow/intern/strings/fluid_script.h @@ -329,7 +329,7 @@ y_guidevel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_GUIDEVEL_Y$')\n\ z_guidevel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_GUIDEVEL_Z$')\n\ \n\ # Final guide vel grid needs to have independent size\n\ -guidevel_sg$ID$ = sg$ID$.create(MACGrid, name='$NAME_GUIDEVEL$')\n\ +guidevel_sg$ID$ = sg$ID$.create(MACGrid, name='$NAME_VELOCITY_GUIDE$')\n\ \n\ # Keep track of important objects in dict to load them later on\n\ fluid_guiding_dict_s$ID$ = { 'guidevel' : guidevel_sg$ID$ }\n"; @@ -700,14 +700,16 @@ const std::string fluid_load_guiding = "\n\ def fluid_load_guiding_$ID$(path, framenr, file_format):\n\ mantaMsg('Fluid load guiding, frame ' + str(framenr))\n\ + guidevel_sg$ID$.setName('$NAME_VELOCITY_GUIDE$')\n\ fluid_file_import_s$ID$(dict=fluid_guiding_dict_s$ID$, path=path, framenr=framenr, file_format=file_format, file_name=file_guiding_s$ID$)\n"; const std::string fluid_load_vel = "\n\ def fluid_load_vel_$ID$(path, framenr, file_format):\n\ mantaMsg('Fluid load vel, frame ' + str(framenr))\n\ + guidevel_sg$ID$.setName('$NAME_VELOCITY$') # for loading data the guidevel grid will pretend to be the vel grid\n\ fluid_vel_dict_s$ID$ = { 'vel' : guidevel_sg$ID$ }\n\ - fluid_file_import_s$ID$(dict=fluid_vel_dict_s$ID$, path=path, framenr=framenr, file_format=file_format)\n"; + fluid_file_import_s$ID$(dict=fluid_vel_dict_s$ID$, path=path, framenr=framenr, file_format=file_format, file_name=file_data_s$ID$)\n"; ////////////////////////////////////////////////////////////////////// // EXPORT @@ -748,12 +750,13 @@ def fluid_file_export_s$ID$(framenr, file_format, path, dict, file_name=None, mo const std::string fluid_save_guiding = "\n\ -def fluid_save_guiding_$ID$(path, framenr, file_format):\n\ +def fluid_save_guiding_$ID$(path, framenr, file_format, resumable):\n\ mantaMsg('Fluid save guiding, frame ' + str(framenr))\n\ + dict = fluid_guiding_dict_s$ID$\n\ if not withMPSave or isWindows:\n\ - fluid_file_export_s$ID$(dict=fluid_guiding_dict_s$ID$, framenr=framenr, file_format=file_format, path=path, file_name=file_guiding_s$ID$)\n\ + fluid_file_export_s$ID$(dict=dict, framenr=framenr, file_format=file_format, path=path, file_name=file_guiding_s$ID$)\n\ else:\n\ - fluid_cache_multiprocessing_start_$ID$(function=fluid_file_export_s$ID$, file_name=file_guiding_s$ID$, framenr=framenr, format_data=file_format, path_data=path, dict=fluid_guiding_dict_s$ID$, do_join=False)\n"; + fluid_cache_multiprocessing_start_$ID$(function=fluid_file_export_s$ID$, file_name=file_guiding_s$ID$, framenr=framenr, format_data=file_format, path_data=path, dict=dict, do_join=False)\n"; ////////////////////////////////////////////////////////////////////// // STANDALONE MODE @@ -770,8 +773,6 @@ if (GUI):\n\ cache_resumable = $CACHE_RESUMABLE$\n\ cache_dir = '$CACHE_DIR$'\n\ file_format_data = '$CACHE_DATA_FORMAT$'\n\ -file_format_noise = '$CACHE_NOISE_FORMAT$'\n\ -file_format_particles = '$CACHE_PARTICLE_FORMAT$'\n\ file_format_mesh = '$CACHE_MESH_FORMAT$'\n\ \n\ # How many frame to load from cache\n\ diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h index 04505206601..08d8dcd7de3 100644 --- a/intern/mantaflow/intern/strings/liquid_script.h +++ b/intern/mantaflow/intern/strings/liquid_script.h @@ -48,7 +48,8 @@ meshRadiusFactor_s$ID$ = $MESH_PARTICLE_RADIUS$\n\ smoothenPos_s$ID$ = $MESH_SMOOTHEN_POS$\n\ smoothenNeg_s$ID$ = $MESH_SMOOTHEN_NEG$\n\ randomness_s$ID$ = $PARTICLE_RANDOMNESS$\n\ -surfaceTension_s$ID$ = $LIQUID_SURFACE_TENSION$\n"; +surfaceTension_s$ID$ = $LIQUID_SURFACE_TENSION$\n\ +maxSysParticles_s$ID$ = $PP_PARTICLE_MAXIMUM$\n"; const std::string liquid_variables_particles = "\n\ @@ -216,6 +217,7 @@ def liquid_adaptive_step_$ID$(framenr):\n\ else:\n\ pVel_pp$ID$.setSource(grid=None, isMAC=False)\n\ \n\ + pp_s$ID$.maxParticles = maxSysParticles_s$ID$ # remember, 0 means no particle cap\n\ sampleLevelsetWithParticles(phi=phiIn_s$ID$, flags=flags_s$ID$, parts=pp_s$ID$, discretization=particleNumber_s$ID$, randomness=randomness_s$ID$)\n\ flags_s$ID$.updateFromLevelset(phi_s$ID$)\n\ \n\ @@ -477,7 +479,7 @@ const std::string liquid_standalone = def load(frame, cache_resumable):\n\ liquid_load_data_$ID$(os.path.join(cache_dir, 'data'), frame, file_format_data, cache_resumable)\n\ if using_sndparts_s$ID$:\n\ - liquid_load_particles_$ID$(os.path.join(cache_dir, 'particles'), frame, file_format_particles, cache_resumable)\n\ + liquid_load_particles_$ID$(os.path.join(cache_dir, 'particles'), frame, file_format_data, cache_resumable)\n\ if using_mesh_s$ID$:\n\ liquid_load_mesh_$ID$(os.path.join(cache_dir, 'mesh'), frame, file_format_mesh)\n\ if using_guiding_s$ID$:\n\ diff --git a/intern/mantaflow/intern/strings/smoke_script.h b/intern/mantaflow/intern/strings/smoke_script.h index 332aa2342ee..f81259115c5 100644 --- a/intern/mantaflow/intern/strings/smoke_script.h +++ b/intern/mantaflow/intern/strings/smoke_script.h @@ -601,7 +601,7 @@ const std::string smoke_standalone = def load(frame, cache_resumable):\n\ smoke_load_data_$ID$(os.path.join(cache_dir, 'data'), frame, file_format_data, cache_resumable)\n\ if using_noise_s$ID$:\n\ - smoke_load_noise_$ID$(os.path.join(cache_dir, 'noise'), frame, file_format_noise, cache_resumable)\n\ + smoke_load_noise_$ID$(os.path.join(cache_dir, 'noise'), frame, file_format_data, cache_resumable)\n\ if using_guiding_s$ID$:\n\ fluid_load_guiding_$ID$(os.path.join(cache_dir, 'guiding'), frame, file_format_data)\n\ \n\ diff --git a/intern/sky/source/sky_model.cpp b/intern/sky/source/sky_model.cpp index 64cf14ec030..e835e04d164 100644 --- a/intern/sky/source/sky_model.cpp +++ b/intern/sky/source/sky_model.cpp @@ -178,8 +178,9 @@ static void ArHosekSkyModel_CookConfiguration(ArHosekSkyModel_Dataset dataset, pow(solar_elevation, 5.0) * elev_matrix[i + 45]); } - if (int_turbidity == 10) + if (int_turbidity == 10) { return; + } // alb 0 high turb elev_matrix = dataset + (9 * 6 * (int_turbidity)); @@ -243,8 +244,9 @@ static double ArHosekSkyModel_CookRadianceConfiguration(ArHosekSkyModel_Radiance 10.0 * pow(1.0 - solar_elevation, 2.0) * pow(solar_elevation, 3.0) * elev_matrix[3] + 5.0 * (1.0 - solar_elevation) * pow(solar_elevation, 4.0) * elev_matrix[4] + pow(solar_elevation, 5.0) * elev_matrix[5]); - if (int_turbidity == 10) + if (int_turbidity == 10) { return res; + } // alb 0 high turb elev_matrix = dataset + (6 * (int_turbidity)); @@ -298,16 +300,18 @@ double SKY_arhosekskymodel_radiance(SKY_ArHosekSkyModelState *state, { int low_wl = (int)((wavelength - 320.0) / 40.0); - if (low_wl < 0 || low_wl >= 11) + if (low_wl < 0 || low_wl >= 11) { return 0.0; + } double interp = fmod((wavelength - 320.0) / 40.0, 1.0); double val_low = ArHosekSkyModel_GetRadianceInternal(state->configs[low_wl], theta, gamma) * state->radiances[low_wl] * state->emission_correction_factor_sky[low_wl]; - if (interp < 1e-6) + if (interp < 1e-6) { return val_low; + } double result = (1.0 - interp) * val_low; diff --git a/release/datafiles/icons/ops.sculpt.cloth_filter.dat b/release/datafiles/icons/ops.sculpt.cloth_filter.dat Binary files differnew file mode 100644 index 00000000000..dc20c8f0bfd --- /dev/null +++ b/release/datafiles/icons/ops.sculpt.cloth_filter.dat diff --git a/release/datafiles/locale b/release/datafiles/locale -Subproject bc6623180aee561cba84ac11f5959b31016612e +Subproject 2b3c19f5f61fc72dba56a7edfdc4e55e2327dc1 diff --git a/release/scripts/addons b/release/scripts/addons -Subproject abeef11a77ab5b05f4ce2c71b65c341bdcb7303 +Subproject 49c39f59fbc464dd34388990123f271c39eacbf diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib -Subproject f2f4a8b3bfa36ee49f7bdb3a1acb40ef4b39ee3 +Subproject a52733b58d95ce60ecde95a9eca242e7319c285 diff --git a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py index aa80611ac6b..0ec3a322173 100644 --- a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py +++ b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py @@ -72,7 +72,7 @@ class SpellChecker: "wasn", # wasn't # Merged words - "antialiasing", + "antialiasing", "antialias", "arcsine", "arccosine", "arctangent", "autoclip", "autocomplete", @@ -241,7 +241,7 @@ class SpellChecker: "unsets", "unshadowed", "unspill", - "unstitchable", + "unstitchable", "unstitch", "unsubdivided", "unsubdivide", "untrusted", "vectorscope", @@ -421,6 +421,7 @@ class SpellChecker: "searchable", "spacebar", "subtractive", + "superellipse", "tooltip", "tooltips", "trackpad", "tuple", @@ -618,6 +619,7 @@ class SpellChecker: "musgrave", "nayar", "netravali", + "nishita", "ogawa", "oren", "peucker", # Ramer-Douglas-Peucker diff --git a/release/scripts/modules/bl_previews_utils/bl_previews_render.py b/release/scripts/modules/bl_previews_utils/bl_previews_render.py index 73004cee731..bcb2fe8324d 100644 --- a/release/scripts/modules/bl_previews_utils/bl_previews_render.py +++ b/release/scripts/modules/bl_previews_utils/bl_previews_render.py @@ -314,7 +314,7 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern): do_save = True if do_data_intern: - bpy.ops.wm.previews_clear(id_type='SHADING') + bpy.ops.wm.previews_clear(id_type={'SHADING'}) bpy.ops.wm.previews_ensure() render_contexts = {} @@ -439,7 +439,7 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern): def do_clear_previews(do_objects, do_collections, do_scenes, do_data_intern): if do_data_intern: - bpy.ops.wm.previews_clear(id_type='SHADING') + bpy.ops.wm.previews_clear(id_type={'SHADING'}) if do_objects: for ob in ids_nolib(bpy.data.objects): diff --git a/release/scripts/modules/rna_manual_reference.py b/release/scripts/modules/rna_manual_reference.py index 832f9c1f7a4..673b33a1e93 100644 --- a/release/scripts/modules/rna_manual_reference.py +++ b/release/scripts/modules/rna_manual_reference.py @@ -221,8 +221,11 @@ url_manual_mapping = ( ("bpy.types.fluidflowsettings.volume_density*", "physics/fluid/type/flow.html#bpy-types-fluidflowsettings-volume-density"), ("bpy.types.materialgpencilstyle.show_stroke*", "grease_pencil/materials/grease_pencil_shader.html#bpy-types-materialgpencilstyle-show-stroke"), ("bpy.types.posebone.use_ik_rotation_control*", "animation/armatures/posing/bone_constraints/inverse_kinematics/introduction.html#bpy-types-posebone-use-ik-rotation-control"), + ("bpy.types.spaceview3d.show_object_viewport*", "editors/3dview/display/visibility.html#bpy-types-spaceview3d-show-object-viewport"), ("bpy.ops.constraint.disable_keep_transform*", "animation/constraints/interface/common.html#bpy-ops-constraint-disable-keep-transform"), ("bpy.ops.object.vertex_group_normalize_all*", "sculpt_paint/weight_paint/editing.html#bpy-ops-object-vertex-group-normalize-all"), + ("bpy.ops.sculpt.face_set_change_visibility*", "sculpt_paint/sculpting/editing.html#bpy-ops-sculpt-face-set-change-visibility"), + ("bpy.ops.sculpt.face_sets_randomize_colors*", "sculpt_paint/sculpting/editing.html#bpy-ops-sculpt-face-sets-randomize-colors"), ("bpy.types.brush.surface_smooth_iterations*", "sculpt_paint/sculpting/tools/smooth.html#bpy-types-brush-surface-smooth-iterations"), ("bpy.types.brushgpencilsettings.pen_jitter*", "grease_pencil/modes/draw/tool_settings/brushes/draw_brush.html#bpy-types-brushgpencilsettings-pen-jitter"), ("bpy.types.fluiddomainsettings.domain_type*", "physics/fluid/type/domain/settings.html#bpy-types-fluiddomainsettings-domain-type"), @@ -273,7 +276,9 @@ url_manual_mapping = ( ("bpy.types.shadernodesubsurfacescattering*", "render/shader_nodes/shader/sss.html#bpy-types-shadernodesubsurfacescattering"), ("bpy.types.spacedopesheeteditor.auto_snap*", "editors/dope_sheet/editing.html#bpy-types-spacedopesheeteditor-auto-snap"), ("bpy.types.spacetexteditor.use_match_case*", "editors/text_editor.html#bpy-types-spacetexteditor-use-match-case"), + ("bpy.types.spaceview3d.show_object_select*", "editors/3dview/display/visibility.html#bpy-types-spaceview3d-show-object-select"), ("bpy.types.volumedisplay.wireframe_detail*", "modeling/volumes/properties.html#bpy-types-volumedisplay-wireframe-detail"), + ("bpy.ops.object.assign_property_defaults*", "animation/armatures/posing/editing/apply.html#bpy-ops-object-assign-property-defaults"), ("bpy.ops.object.vertex_group_limit_total*", "sculpt_paint/weight_paint/editing.html#bpy-ops-object-vertex-group-limit-total"), ("bpy.ops.object.vertex_group_remove_from*", "modeling/meshes/properties/vertex_groups/vertex_groups.html#bpy-ops-object-vertex-group-remove-from"), ("bpy.types.animdata.action_extrapolation*", "editors/nla/properties_modifiers.html#bpy-types-animdata-action-extrapolation"), @@ -297,6 +302,7 @@ url_manual_mapping = ( ("bpy.types.spacetexteditor.use_find_wrap*", "editors/text_editor.html#bpy-types-spacetexteditor-use-find-wrap"), ("bpy.types.spaceuveditor.pixel_snap_mode*", "modeling/meshes/uv/editing.html#bpy-types-spaceuveditor-pixel-snap-mode"), ("bpy.types.spaceuveditor.use_live_unwrap*", "modeling/meshes/uv/editing.html#bpy-types-spaceuveditor-use-live-unwrap"), + ("bpy.types.toolsettings.mesh_select_mode*", "modeling/meshes/selecting/introduction.html#bpy-types-toolsettings-mesh-select-mode"), ("bpy.types.vertexweightproximitymodifier*", "modeling/modifiers/modify/weight_proximity.html#bpy-types-vertexweightproximitymodifier"), ("bpy.ops.mesh.vertices_smooth_laplacian*", "modeling/meshes/editing/vertex/laplacian_smooth.html#bpy-ops-mesh-vertices-smooth-laplacian"), ("bpy.types.brush.pose_smooth_iterations*", "sculpt_paint/sculpting/tools/pose.html#bpy-types-brush-pose-smooth-iterations"), @@ -320,6 +326,7 @@ url_manual_mapping = ( ("bpy.types.volumedisplay.wireframe_type*", "modeling/volumes/properties.html#bpy-types-volumedisplay-wireframe-type"), ("bpy.ops.curve.normals_make_consistent*", "modeling/curves/editing/control_points.html#bpy-ops-curve-normals-make-consistent"), ("bpy.ops.gpencil.stroke_simplify_fixed*", "grease_pencil/modes/edit/stroke_menu.html#bpy-ops-gpencil-stroke-simplify-fixed"), + ("bpy.ops.mesh.faces_select_linked_flat*", "modeling/meshes/selecting/linked.html#bpy-ops-mesh-faces-select-linked-flat"), ("bpy.ops.object.gpencil_modifier_apply*", "grease_pencil/modifiers/introduction.html#bpy-ops-object-gpencil-modifier-apply"), ("bpy.ops.object.vertex_group_normalize*", "sculpt_paint/weight_paint/editing.html#bpy-ops-object-vertex-group-normalize"), ("bpy.ops.object.visual_transform_apply*", "scene_layout/object/editing/apply.html#bpy-ops-object-visual-transform-apply"), @@ -384,6 +391,7 @@ url_manual_mapping = ( ("bpy.ops.mesh.vert_connect_nonplanar*", "modeling/meshes/editing/mesh/cleanup.html#bpy-ops-mesh-vert-connect-nonplanar"), ("bpy.ops.object.duplicates_make_real*", "scene_layout/object/editing/apply.html#bpy-ops-object-duplicates-make-real"), ("bpy.ops.object.transforms_to_deltas*", "scene_layout/object/editing/apply.html#bpy-ops-object-transforms-to-deltas"), + ("bpy.ops.pose.visual_transform_apply*", "animation/armatures/posing/editing/apply.html#bpy-ops-pose-visual-transform-apply"), ("bpy.ops.sequencer.view_ghost_border*", "video_editing/preview/properties.html#bpy-ops-sequencer-view-ghost-border"), ("bpy.types.animdata.action_influence*", "editors/nla/properties_modifiers.html#bpy-types-animdata-action-influence"), ("bpy.types.brush.crease_pinch_factor*", "sculpt_paint/sculpting/tools/snake_hook.html#bpy-types-brush-crease-pinch-factor"), @@ -419,6 +427,8 @@ url_manual_mapping = ( ("bpy.ops.mesh.extrude_vertices_move*", "modeling/meshes/editing/vertex/extrude_vertices.html#bpy-ops-mesh-extrude-vertices-move"), ("bpy.ops.mesh.mod_weighted_strength*", "modeling/meshes/editing/mesh/normals.html#bpy-ops-mesh-mod-weighted-strength"), ("bpy.ops.mesh.quads_convert_to_tris*", "modeling/meshes/editing/face/triangulate_faces.html#bpy-ops-mesh-quads-convert-to-tris"), + ("bpy.ops.mesh.select_interior_faces*", "modeling/meshes/selecting/all_by_trait.html#bpy-ops-mesh-select-interior-faces"), + ("bpy.ops.mesh.select_similar_region*", "modeling/meshes/selecting/similar.html#bpy-ops-mesh-select-similar-region"), ("bpy.ops.mesh.tris_convert_to_quads*", "modeling/meshes/editing/face/triangles_quads.html#bpy-ops-mesh-tris-convert-to-quads"), ("bpy.ops.node.read_fullsamplelayers*", "interface/controls/nodes/editing.html#bpy-ops-node-read-fullsamplelayers"), ("bpy.ops.object.datalayout_transfer*", "scene_layout/object/editing/relations.html#bpy-ops-object-datalayout-transfer"), @@ -428,6 +438,7 @@ url_manual_mapping = ( ("bpy.ops.object.vertex_group_mirror*", "sculpt_paint/weight_paint/editing.html#bpy-ops-object-vertex-group-mirror"), ("bpy.ops.object.vertex_group_remove*", "modeling/meshes/properties/vertex_groups/vertex_groups.html#bpy-ops-object-vertex-group-remove"), ("bpy.ops.object.vertex_group_smooth*", "sculpt_paint/weight_paint/editing.html#bpy-ops-object-vertex-group-smooth"), + ("bpy.ops.pose.user_transforms_clear*", "animation/armatures/posing/editing/clear.html#bpy-ops-pose-user-transforms-clear"), ("bpy.ops.sculpt.set_persistent_base*", "sculpt_paint/sculpting/tools/layer.html#bpy-ops-sculpt-set-persistent-base"), ("bpy.ops.sequencer.crossfade_sounds*", "video_editing/sequencer/strips/transitions/cross.html#bpy-ops-sequencer-crossfade-sounds"), ("bpy.ops.sequencer.export_subtitles*", "video_editing/preview/introduction.html#bpy-ops-sequencer-export-subtitles"), @@ -467,6 +478,8 @@ url_manual_mapping = ( ("bpy.ops.curve.match_texture_space*", "modeling/meshes/uv/uv_texture_spaces.html#bpy-ops-curve-match-texture-space"), ("bpy.ops.font.text_paste_from_file*", "modeling/texts/editing.html#bpy-ops-font-text-paste-from-file"), ("bpy.ops.gpencil.frame_clean_loose*", "grease_pencil/modes/edit/grease_pencil_menu.html#bpy-ops-gpencil-frame-clean-loose"), + ("bpy.ops.mesh.select_face_by_sides*", "modeling/meshes/selecting/all_by_trait.html#bpy-ops-mesh-select-face-by-sides"), + ("bpy.ops.mesh.shortest_path_select*", "modeling/meshes/selecting/linked.html#bpy-ops-mesh-shortest-path-select"), ("bpy.ops.mesh.vert_connect_concave*", "modeling/meshes/editing/mesh/cleanup.html#bpy-ops-mesh-vert-connect-concave"), ("bpy.ops.object.vertex_group_clean*", "sculpt_paint/weight_paint/editing.html#bpy-ops-object-vertex-group-clean"), ("bpy.ops.render.play-rendered-anim*", "render/output/animation_player.html#bpy-ops-render-play-rendered-anim"), @@ -507,7 +520,7 @@ url_manual_mapping = ( ("bpy.types.simplifygpencilmodifier*", "grease_pencil/modifiers/generate/simplify.html#bpy-types-simplifygpencilmodifier"), ("bpy.types.spacegrapheditor.cursor*", "editors/graph_editor/introduction.html#bpy-types-spacegrapheditor-cursor"), ("bpy.types.vertexweightmixmodifier*", "modeling/modifiers/modify/weight_mix.html#bpy-types-vertexweightmixmodifier"), - ("bpy.types.viewlayer.use_freestyle*", "render/layers/layers.html#bpy-types-viewlayer-use-freestyle"), + ("bpy.types.viewlayer.use_freestyle*", "render/freestyle/view_layer.html#bpy-types-viewlayer-use-freestyle"), ("bpy.ops.gpencil.frame_clean_fill*", "grease_pencil/modes/edit/grease_pencil_menu.html#bpy-ops-gpencil-frame-clean-fill"), ("bpy.ops.gpencil.stroke_subdivide*", "grease_pencil/modes/edit/stroke_menu.html#bpy-ops-gpencil-stroke-subdivide"), ("bpy.ops.graph.interpolation_type*", "editors/graph_editor/fcurves/editing.html#bpy-ops-graph-interpolation-type"), @@ -515,6 +528,7 @@ url_manual_mapping = ( ("bpy.ops.mesh.face_split_by_edges*", "modeling/meshes/editing/face/weld_edges_faces.html#bpy-ops-mesh-face-split-by-edges"), ("bpy.ops.mesh.intersect_boolean()*", "modeling/meshes/editing/face/intersect_boolean.html#bpy-ops-mesh-intersect-boolean"), ("bpy.ops.mesh.mark_freestyle_face*", "modeling/meshes/editing/face/face_data.html#bpy-ops-mesh-mark-freestyle-face"), + ("bpy.ops.mesh.select_non_manifold*", "modeling/meshes/selecting/all_by_trait.html#bpy-ops-mesh-select-non-manifold"), ("bpy.ops.object.constraints_clear*", "animation/constraints/interface/adding_removing.html#bpy-ops-object-constraints-clear"), ("bpy.ops.object.quadriflow_remesh*", "modeling/meshes/retopology.html#bpy-ops-object-quadriflow-remesh"), ("bpy.ops.object.vertex_group_copy*", "modeling/meshes/properties/vertex_groups/vertex_groups.html#bpy-ops-object-vertex-group-copy"), @@ -561,8 +575,10 @@ url_manual_mapping = ( ("bpy.types.shadernodelightfalloff*", "render/shader_nodes/color/light_falloff.html#bpy-types-shadernodelightfalloff"), ("bpy.types.shadernodeparticleinfo*", "render/shader_nodes/input/particle_info.html#bpy-types-shadernodeparticleinfo"), ("bpy.types.shadernodevectorrotate*", "render/shader_nodes/vector/vector_rotate.html#bpy-types-shadernodevectorrotate"), + ("bpy.types.spaceview3d.show_gizmo*", "editors/3dview/display/gizmo.html#bpy-types-spaceview3d-show-gizmo"), ("bpy.types.volumerender.step_size*", "modeling/volumes/properties.html#bpy-types-volumerender-step-size"), ("bpy.types.weightednormalmodifier*", "modeling/modifiers/modify/weighted_normal.html#bpy-types-weightednormalmodifier"), + ("bpy.ops.armature.autoside_names*", "animation/armatures/bones/editing/naming.html#bpy-ops-armature-autoside-names"), ("bpy.ops.curve.spline_weight_set*", "modeling/curves/editing/other.html#bpy-ops-curve-spline-weight-set"), ("bpy.ops.gpencil.blank_frame_add*", "grease_pencil/animation/tools.html#bpy-ops-gpencil-blank-frame-add"), ("bpy.ops.gpencil.frame_duplicate*", "grease_pencil/animation/tools.html#bpy-ops-gpencil-frame-duplicate"), @@ -571,6 +587,7 @@ url_manual_mapping = ( ("bpy.ops.gpencil.stroke_simplify*", "grease_pencil/modes/edit/stroke_menu.html#bpy-ops-gpencil-stroke-simplify"), ("bpy.ops.mesh.extrude_edges_move*", "modeling/meshes/editing/edge/extrude_edges.html#bpy-ops-mesh-extrude-edges-move"), ("bpy.ops.mesh.extrude_faces_move*", "modeling/meshes/editing/face/extrude_individual_faces.html#bpy-ops-mesh-extrude-faces-move"), + ("bpy.ops.mesh.faces_shade_smooth*", "modeling/meshes/editing/face/shading.html#bpy-ops-mesh-faces-shade-smooth"), ("bpy.ops.mesh.subdivide_edgering*", "modeling/meshes/editing/edge/subdivide_edge_ring.html#bpy-ops-mesh-subdivide-edgering"), ("bpy.ops.object.constraints_copy*", "animation/constraints/interface/adding_removing.html#bpy-ops-object-constraints-copy"), ("bpy.ops.object.gpencil_modifier*", "grease_pencil/modifiers/index.html#bpy-ops-object-gpencil-modifier"), @@ -582,6 +599,7 @@ url_manual_mapping = ( ("bpy.ops.paint.weight_from_bones*", "sculpt_paint/weight_paint/editing.html#bpy-ops-paint-weight-from-bones"), ("bpy.ops.scene.view_layer_remove*", "render/layers/layers.html#bpy-ops-scene-view-layer-remove"), ("bpy.ops.screen.screen_full_area*", "interface/window_system/areas.html#bpy-ops-screen-screen-full-area"), + ("bpy.ops.sculpt.face_sets_create*", "sculpt_paint/sculpting/editing.html#bpy-ops-sculpt-face-sets-create"), ("bpy.ops.transform.rotate_normal*", "modeling/meshes/editing/mesh/normals.html#bpy-ops-transform-rotate-normal"), ("bpy.ops.transform.shrink_fatten*", "modeling/meshes/editing/mesh/transform/shrink-fatten.html#bpy-ops-transform-shrink-fatten"), ("bpy.ops.transform.vertex_random*", "modeling/meshes/editing/mesh/transform/randomize.html#bpy-ops-transform-vertex-random"), @@ -625,7 +643,6 @@ url_manual_mapping = ( ("bpy.types.smoothgpencilmodifier*", "grease_pencil/modifiers/deform/smooth.html#bpy-types-smoothgpencilmodifier"), ("bpy.types.spline.use_endpoint_u*", "modeling/curves/properties/active_spline.html#bpy-types-spline-use-endpoint-u"), ("bpy.types.surfacedeformmodifier*", "modeling/modifiers/deform/surface_deform.html#bpy-types-surfacedeformmodifier"), - ("bpy.types.viewlayer.use_volumes*", "render/layers/layers.html#bpy-types-viewlayer-use-volumes"), ("bpy.types.volume.frame_duration*", "modeling/volumes/properties.html#bpy-types-volume-frame-duration"), ("bpy.types.volumedisplay.density*", "modeling/volumes/properties.html#bpy-types-volumedisplay-density"), ("bpy.types.volumerender.clipping*", "modeling/volumes/properties.html#bpy-types-volumerender-clipping"), @@ -633,6 +650,7 @@ url_manual_mapping = ( ("bpy.ops.gpencil.duplicate_move*", "grease_pencil/modes/edit/grease_pencil_menu.html#bpy-ops-gpencil-duplicate-move"), ("bpy.ops.gpencil.stroke_arrange*", "grease_pencil/modes/edit/stroke_menu.html#bpy-ops-gpencil-stroke-arrange"), ("bpy.ops.mesh.bridge-edge-loops*", "modeling/meshes/editing/edge/bridge_edge_loops.html#bpy-ops-mesh-bridge-edge-loops"), + ("bpy.ops.mesh.loop_multi_select*", "modeling/meshes/selecting/loops.html#bpy-ops-mesh-loop-multi-select"), ("bpy.ops.mesh.vert_connect_path*", "modeling/meshes/editing/vertex/connect_vertex_path.html#bpy-ops-mesh-vert-connect-path"), ("bpy.ops.nla.action_sync_length*", "editors/nla/editing.html#bpy-ops-nla-action-sync-length"), ("bpy.ops.object.paths_calculate*", "animation/motion_paths.html#bpy-ops-object-paths-calculate"), @@ -699,13 +717,17 @@ url_manual_mapping = ( ("bpy.ops.mesh.blend_from_shape*", "modeling/meshes/editing/vertex/blend_shape.html#bpy-ops-mesh-blend-from-shape"), ("bpy.ops.mesh.dissolve_limited*", "modeling/meshes/editing/mesh/delete.html#bpy-ops-mesh-dissolve-limited"), ("bpy.ops.mesh.face_make_planar*", "modeling/meshes/editing/mesh/cleanup.html#bpy-ops-mesh-face-make-planar"), + ("bpy.ops.mesh.faces_shade_flat*", "modeling/meshes/editing/face/shading.html#bpy-ops-mesh-faces-shade-flat"), ("bpy.ops.mesh.paint_mask_slice*", "sculpt_paint/sculpting/hide_mask.html#bpy-ops-mesh-paint-mask-slice"), + ("bpy.ops.mesh.select_ungrouped*", "modeling/meshes/selecting/all_by_trait.html#bpy-ops-mesh-select-ungrouped"), ("bpy.ops.object.duplicate_move*", "scene_layout/object/editing/duplicate.html#bpy-ops-object-duplicate-move"), ("bpy.ops.object.hook_add_selob*", "modeling/meshes/editing/vertex/hooks.html#bpy-ops-object-hook-add-selob"), ("bpy.ops.object.select_by_type*", "scene_layout/object/selecting.html#bpy-ops-object-select-by-type"), ("bpy.ops.object.select_grouped*", "scene_layout/object/selecting.html#bpy-ops-object-select-grouped"), ("bpy.ops.object.select_pattern*", "scene_layout/object/selecting.html#bpy-ops-object-select-pattern"), ("bpy.ops.paint.mask_flood_fill*", "sculpt_paint/sculpting/hide_mask.html#bpy-ops-paint-mask-flood-fill"), + ("bpy.ops.pose.quaternions_flip*", "animation/armatures/posing/editing/flip_quats.html#bpy-ops-pose-quaternions-flip"), + ("bpy.ops.pose.transforms_clear*", "animation/armatures/posing/editing/clear.html#bpy-ops-pose-transforms-clear"), ("bpy.ops.screen.repeat_history*", "interface/undo_redo.html#bpy-ops-screen-repeat-history"), ("bpy.ops.sculpt.face_sets_init*", "sculpt_paint/sculpting/editing.html#bpy-ops-sculpt-face-sets-init"), ("bpy.ops.sequencer.change_path*", "video_editing/sequencer/editing.html#bpy-ops-sequencer-change-path"), @@ -715,7 +737,7 @@ url_manual_mapping = ( ("bpy.ops.text.resolve_conflict*", "editors/text_editor.html#bpy-ops-text-resolve-conflict"), ("bpy.ops.transform.edge_crease*", "modeling/meshes/editing/edge/edge_data.html#bpy-ops-transform-edge-crease"), ("bpy.ops.transform.skin_resize*", "modeling/meshes/editing/mesh/transform/skin_resize.html#bpy-ops-transform-skin-resize"), - ("bpy.ops.uv.seams_from_islands*", "modeling/meshes/uv/unwrapping/seams.html#bpy-ops-uv-seams-from-islands"), + ("bpy.ops.uv.seams_from_islands*", "modeling/meshes/uv/editing.html#bpy-ops-uv-seams-from-islands"), ("bpy.types.brush.icon_filepath*", "sculpt_paint/brush/brush.html#bpy-types-brush-icon-filepath"), ("bpy.types.brush.smooth_stroke*", "grease_pencil/modes/draw/tool_settings/brushes/draw_brush.html#bpy-types-brush-smooth-stroke"), ("bpy.types.brush.tip_roundness*", "sculpt_paint/sculpting/tools/clay_strips.html#bpy-types-brush-tip-roundness"), @@ -787,6 +809,7 @@ url_manual_mapping = ( ("bpy.ops.object.select_random*", "scene_layout/object/selecting.html#bpy-ops-object-select-random"), ("bpy.ops.paint.add_simple_uvs*", "sculpt_paint/texture_paint/tool_settings/texture_slots.html#bpy-ops-paint-add-simple-uvs"), ("bpy.ops.scene.view_layer_add*", "render/layers/layers.html#bpy-ops-scene-view-layer-add"), + ("bpy.ops.sculpt.face_set_edit*", "sculpt_paint/sculpting/editing.html#bpy-ops-sculpt-face-set-edit"), ("bpy.ops.sequencer.gap_insert*", "video_editing/sequencer/editing.html#bpy-ops-sequencer-gap-insert"), ("bpy.ops.sequencer.gap_remove*", "video_editing/sequencer/editing.html#bpy-ops-sequencer-gap-remove"), ("bpy.ops.sequencer.rendersize*", "video_editing/sequencer/editing.html#bpy-ops-sequencer-rendersize"), @@ -835,6 +858,7 @@ url_manual_mapping = ( ("bpy.types.shadernodetexmagic*", "render/shader_nodes/textures/magic.html#bpy-types-shadernodetexmagic"), ("bpy.types.shadernodetexnoise*", "render/shader_nodes/textures/noise.html#bpy-types-shadernodetexnoise"), ("bpy.types.shrinkwrapmodifier*", "modeling/modifiers/deform/shrinkwrap.html#bpy-types-shrinkwrapmodifier"), + ("bpy.types.simulationmodifier*", "modeling/modifiers/physics/simulation.html#bpy-types-simulationmodifier"), ("bpy.types.splineikconstraint*", "animation/constraints/tracking/spline_ik.html#bpy-types-splineikconstraint"), ("bpy.types.texturenodetexture*", "editors/texture_node/types/input/texture.html#bpy-types-texturenodetexture"), ("bpy.types.view3dshading.type*", "editors/3dview/display/shading.html#bpy-types-view3dshading-type"), @@ -842,6 +866,7 @@ url_manual_mapping = ( ("bpy.types.volume.is_sequence*", "modeling/volumes/properties.html#bpy-types-volume-is-sequence"), ("bpy.types.volumerender.space*", "modeling/volumes/properties.html#bpy-types-volumerender-space"), ("bpy.ops.anim.keyframe_clear*", "animation/keyframes/editing.html#bpy-ops-anim-keyframe-clear"), + ("bpy.ops.armature.flip_names*", "animation/armatures/bones/editing/naming.html#bpy-ops-armature-flip-names"), ("bpy.ops.curve.cyclic_toggle*", "modeling/curves/editing/curve.html#bpy-ops-curve-cyclic-toggle"), ("bpy.ops.curve.primitive*add*", "modeling/curves/primitives.html#bpy-ops-curve-primitive-add"), ("bpy.ops.curve.smooth_radius*", "modeling/curves/editing/control_points.html#bpy-ops-curve-smooth-radius"), @@ -856,13 +881,18 @@ url_manual_mapping = ( ("bpy.ops.mesh.dissolve_faces*", "modeling/meshes/editing/mesh/delete.html#bpy-ops-mesh-dissolve-faces"), ("bpy.ops.mesh.dissolve_verts*", "modeling/meshes/editing/mesh/delete.html#bpy-ops-mesh-dissolve-verts"), ("bpy.ops.mesh.duplicate_move*", "modeling/meshes/editing/mesh/duplicate.html#bpy-ops-mesh-duplicate-move"), + ("bpy.ops.mesh.extrude_region*", "modeling/meshes/tools/extrude_region.html#bpy-ops-mesh-extrude-region"), ("bpy.ops.mesh.extrude_repeat*", "modeling/meshes/editing/mesh/extrude.html#bpy-ops-mesh-extrude-repeat"), + ("bpy.ops.mesh.loop_to_region*", "modeling/meshes/selecting/loops.html#bpy-ops-mesh-loop-to-region"), + ("bpy.ops.mesh.region_to_loop*", "modeling/meshes/selecting/loops.html#bpy-ops-mesh-region-to-loop"), ("bpy.ops.mesh.remove_doubles*", "modeling/meshes/editing/mesh/cleanup.html#bpy-ops-mesh-remove-doubles"), + ("bpy.ops.mesh.select_similar*", "modeling/meshes/selecting/similar.html#bpy-ops-mesh-select-similar"), ("bpy.ops.mesh.smooth_normals*", "modeling/meshes/editing/mesh/normals.html#bpy-ops-mesh-smooth-normals"), ("bpy.ops.nla.tweakmode_enter*", "editors/nla/editing.html#bpy-ops-nla-tweakmode-enter"), ("bpy.ops.object.parent_clear*", "scene_layout/object/editing/parent.html#bpy-ops-object-parent-clear"), ("bpy.ops.object.shade_smooth*", "scene_layout/object/editing/shading.html#bpy-ops-object-shade-smooth"), ("bpy.ops.object.voxel_remesh*", "modeling/meshes/retopology.html#bpy-ops-object-voxel-remesh"), + ("bpy.ops.pose.armature_apply*", "animation/armatures/posing/editing/apply.html#bpy-ops-pose-armature-apply"), ("bpy.ops.sequencer.swap_data*", "video_editing/sequencer/editing.html#bpy-ops-sequencer-swap-data"), ("bpy.ops.transform.push_pull*", "modeling/meshes/editing/mesh/transform/push_pull.html#bpy-ops-transform-push-pull"), ("bpy.ops.transform.seq_slide*", "video_editing/sequencer/editing.html#bpy-ops-transform-seq-slide"), @@ -934,6 +964,8 @@ url_manual_mapping = ( ("bpy.ops.mesh.point_normals*", "modeling/meshes/editing/mesh/normals.html#bpy-ops-mesh-point-normals"), ("bpy.ops.mesh.primitive*add*", "modeling/meshes/primitives.html#bpy-ops-mesh-primitive-add"), ("bpy.ops.mesh.rip_edge_move*", "modeling/meshes/editing/vertex/rip_vertices_extend.html#bpy-ops-mesh-rip-edge-move"), + ("bpy.ops.mesh.select_linked*", "modeling/meshes/selecting/linked.html#bpy-ops-mesh-select-linked"), + ("bpy.ops.mesh.select_random*", "modeling/meshes/selecting/random.html#bpy-ops-mesh-select-random"), ("bpy.ops.mesh.sort_elements*", "modeling/meshes/editing/mesh/sort_elements.html#bpy-ops-mesh-sort-elements"), ("bpy.ops.mesh.split_normals*", "modeling/meshes/editing/mesh/normals.html#bpy-ops-mesh-split-normals"), ("bpy.ops.mesh.symmetry_snap*", "modeling/meshes/editing/mesh/snap_symmetry.html#bpy-ops-mesh-symmetry-snap"), @@ -984,6 +1016,7 @@ url_manual_mapping = ( ("bpy.types.spacegrapheditor*", "editors/graph_editor/index.html#bpy-types-spacegrapheditor"), ("bpy.types.spacepreferences*", "editors/preferences/index.html#bpy-types-spacepreferences"), ("bpy.types.spaceview3d.lock*", "editors/3dview/properties/sidebar.html#bpy-types-spaceview3d-lock"), + ("bpy.types.spaceview3d.show*", "editors/3dview/display/index.html#bpy-types-spaceview3d-show"), ("bpy.types.subtractsequence*", "video_editing/sequencer/strips/effects/subtract.html#bpy-types-subtractsequence"), ("bpy.types.text.indentation*", "editors/text_editor.html#bpy-types-text-indentation"), ("bpy.types.texturenodegroup*", "editors/texture_node/types/groups.html#bpy-types-texturenodegroup"), @@ -998,6 +1031,7 @@ url_manual_mapping = ( ("bpy.ops.graph.handle_type*", "editors/graph_editor/fcurves/editing.html#bpy-ops-graph-handle-type"), ("bpy.ops.mesh.delete_loose*", "modeling/meshes/editing/mesh/cleanup.html#bpy-ops-mesh-delete-loose"), ("bpy.ops.mesh.flip_normals*", "modeling/meshes/editing/mesh/normals.html#bpy-ops-mesh-flip-normals"), + ("bpy.ops.mesh.select_loose*", "modeling/meshes/selecting/all_by_trait.html#bpy-ops-mesh-select-loose"), ("bpy.ops.mesh.vert_connect*", "modeling/meshes/editing/vertex/connect_vertex_pairs.html#bpy-ops-mesh-vert-connect"), ("bpy.ops.nla.tracks_delete*", "editors/nla/editing.html#bpy-ops-nla-tracks-delete"), ("bpy.ops.object.lightprobe*", "render/eevee/light_probes/index.html#bpy-ops-object-lightprobe"), @@ -1062,6 +1096,7 @@ url_manual_mapping = ( ("bpy.ops.mesh.uvs_reverse*", "modeling/meshes/uv/editing.html#bpy-ops-mesh-uvs-reverse"), ("bpy.ops.object.hide_view*", "scene_layout/object/editing/show_hide.html#bpy-ops-object-hide-view"), ("bpy.ops.object.track_set*", "animation/constraints/interface/adding_removing.html#bpy-ops-object-track-set"), + ("bpy.ops.pose.scale_clear*", "animation/armatures/posing/editing/clear.html#bpy-ops-pose-scale-clear"), ("bpy.ops.scene.view_layer*", "render/layers/layers.html#bpy-ops-scene-view-layer"), ("bpy.ops.sequencer.delete*", "video_editing/sequencer/editing.html#bpy-ops-sequencer-delete"), ("bpy.ops.sequencer.reload*", "video_editing/sequencer/editing.html#bpy-ops-sequencer-reload"), @@ -1072,6 +1107,7 @@ url_manual_mapping = ( ("bpy.ops.transform.rotate*", "scene_layout/object/editing/transform/basics.html#bpy-ops-transform-rotate"), ("bpy.ops.uv.lightmap_pack*", "modeling/meshes/editing/uv.html#bpy-ops-uv-lightmap-pack"), ("bpy.ops.uv.smart_project*", "modeling/meshes/editing/uv.html#bpy-ops-uv-smart-project"), + ("bpy.ops.uv.snap_selected*", "modeling/meshes/uv/editing.html#bpy-ops-uv-snap-selected"), ("bpy.ops.view3d.localview*", "editors/3dview/navigate/local_view.html#bpy-ops-view3d-localview"), ("bpy.ops.view3d.view_axis*", "editors/3dview/navigate/viewpoint.html#bpy-ops-view3d-view-axis"), ("bpy.types.bone.show_wire*", "animation/armatures/bones/properties/display.html#bpy-types-bone-show-wire"), @@ -1116,6 +1152,7 @@ url_manual_mapping = ( ("bpy.ops.mesh.edge_split*", "modeling/meshes/editing/mesh/split.html#bpy-ops-mesh-edge-split"), ("bpy.ops.mesh.fill_holes*", "modeling/meshes/editing/mesh/cleanup.html#bpy-ops-mesh-fill-holes"), ("bpy.ops.mesh.mark_sharp*", "modeling/meshes/editing/edge/edge_data.html#bpy-ops-mesh-mark-sharp"), + ("bpy.ops.mesh.select_nth*", "modeling/meshes/selecting/checker_deselect.html#bpy-ops-mesh-select-nth"), ("bpy.ops.mesh.symmetrize*", "modeling/meshes/editing/mesh/symmetrize.html#bpy-ops-mesh-symmetrize"), ("bpy.ops.mesh.uvs_rotate*", "modeling/meshes/uv/editing.html#bpy-ops-mesh-uvs-rotate"), ("bpy.ops.nla.apply_scale*", "editors/nla/editing.html#bpy-ops-nla-apply-scale"), @@ -1123,11 +1160,14 @@ url_manual_mapping = ( ("bpy.ops.nla.mute_toggle*", "editors/nla/editing.html#bpy-ops-nla-mute-toggle"), ("bpy.ops.object.armature*", "animation/armatures/index.html#bpy-ops-object-armature"), ("bpy.ops.object.face_map*", "modeling/meshes/properties/object_data.html#bpy-ops-object-face-map"), + ("bpy.ops.pose.relax_rest*", "animation/armatures/posing/editing/in_betweens.html#bpy-ops-pose-relax-rest"), ("bpy.ops.rigidbody.world*", "physics/rigid_body/world.html#bpy-ops-rigidbody-world"), + ("bpy.ops.sculpt.optimize*", "sculpt_paint/sculpting/editing.html#bpy-ops-sculpt-optimize"), ("bpy.ops.sequencer.split*", "video_editing/sequencer/editing.html#bpy-ops-sequencer-split"), ("bpy.ops.transform.shear*", "modeling/meshes/editing/mesh/transform/shear.html#bpy-ops-transform-shear"), ("bpy.ops.uv.cube_project*", "modeling/meshes/editing/uv.html#bpy-ops-uv-cube-project"), ("bpy.ops.uv.pack_islands*", "modeling/meshes/uv/editing.html#bpy-ops-uv-pack-islands"), + ("bpy.ops.uv.select_split*", "modeling/meshes/uv/editing.html#bpy-ops-uv-select-split"), ("bpy.ops.wm.app_template*", "advanced/app_templates.html#bpy-ops-wm-app-template"), ("bpy.ops.wm.batch_rename*", "files/blend/rename.html#bpy-ops-wm-batch-rename"), ("bpy.ops.wm.redraw_timer*", "advanced/operators.html#bpy-ops-wm-redraw-timer"), @@ -1165,6 +1205,7 @@ url_manual_mapping = ( ("bpy.types.spaceoutliner*", "editors/outliner.html#bpy-types-spaceoutliner"), ("bpy.types.spacetimeline*", "editors/timeline.html#bpy-types-spacetimeline"), ("bpy.types.stuccitexture*", "render/materials/legacy_textures/types/stucci.html#bpy-types-stuccitexture"), + ("bpy.types.view3doverlay*", "editors/3dview/display/overlays.html#bpy-types-view3doverlay"), ("bpy.types.volumedisplay*", "modeling/volumes/properties.html#bpy-types-volumedisplay"), ("bpy.types.windowmanager*", "interface/index.html#bpy-types-windowmanager"), ("bpy.ops.*.select_lasso*", "interface/selecting.html#bpy-ops-select-lasso"), @@ -1184,6 +1225,11 @@ url_manual_mapping = ( ("bpy.ops.object.convert*", "scene_layout/object/editing/convert.html#bpy-ops-object-convert"), ("bpy.ops.object.gpencil*", "grease_pencil/index.html#bpy-ops-object-gpencil"), ("bpy.ops.object.speaker*", "render/output/audio/speaker.html#bpy-ops-object-speaker"), + ("bpy.ops.pose.breakdown*", "animation/armatures/posing/editing/in_betweens.html#bpy-ops-pose-breakdown"), + ("bpy.ops.pose.loc_clear*", "animation/armatures/posing/editing/clear.html#bpy-ops-pose-loc-clear"), + ("bpy.ops.pose.propagate*", "animation/armatures/posing/editing/propagate.html#bpy-ops-pose-propagate"), + ("bpy.ops.pose.push_rest*", "animation/armatures/posing/editing/in_betweens.html#bpy-ops-pose-push-rest"), + ("bpy.ops.pose.rot_clear*", "animation/armatures/posing/editing/clear.html#bpy-ops-pose-rot-clear"), ("bpy.ops.sequencer.lock*", "video_editing/sequencer/editing.html#bpy-ops-sequencer-lock"), ("bpy.ops.sequencer.mute*", "video_editing/sequencer/editing.html#bpy-ops-sequencer-mute"), ("bpy.ops.sequencer.slip*", "video_editing/sequencer/editing.html#bpy-ops-sequencer-slip"), @@ -1191,6 +1237,7 @@ url_manual_mapping = ( ("bpy.ops.sequencer.swap*", "video_editing/sequencer/editing.html#bpy-ops-sequencer-swap"), ("bpy.ops.transform.bend*", "modeling/meshes/editing/mesh/transform/bend.html#bpy-ops-transform-bend"), ("bpy.ops.transform.tilt*", "modeling/curves/editing/control_points.html#bpy-ops-transform-tilt"), + ("bpy.ops.uv.snap_cursor*", "modeling/meshes/uv/editing.html#bpy-ops-uv-snap-cursor"), ("bpy.ops.wm.search_menu*", "interface/controls/templates/operator_search.html#bpy-ops-wm-search-menu"), ("bpy.types.bakesettings*", "render/cycles/baking.html#bpy-types-bakesettings"), ("bpy.types.blendtexture*", "render/materials/legacy_textures/types/blend.html#bpy-types-blendtexture"), @@ -1334,6 +1381,8 @@ url_manual_mapping = ( ("bpy.ops.mesh.split*", "modeling/meshes/editing/mesh/split.html#bpy-ops-mesh-split"), ("bpy.ops.nla.delete*", "editors/nla/editing.html#bpy-ops-nla-delete"), ("bpy.ops.paint.mask*", "sculpt_paint/sculpting/hide_mask.html#bpy-ops-paint-mask"), + ("bpy.ops.pose.paste*", "animation/armatures/posing/editing/copy_paste.html#bpy-ops-pose-paste"), + ("bpy.ops.pose.relax*", "animation/armatures/posing/editing/in_betweens.html#bpy-ops-pose-relax"), ("bpy.ops.safe_areas*", "render/cameras.html#bpy-ops-safe-areas"), ("bpy.types.armature*", "animation/armatures/index.html#bpy-types-armature"), ("bpy.types.editbone*", "animation/armatures/bones/editing/index.html#bpy-types-editbone"), @@ -1356,6 +1405,8 @@ url_manual_mapping = ( ("bpy.ops.mesh.poke*", "modeling/meshes/editing/face/poke_faces.html#bpy-ops-mesh-poke"), ("bpy.ops.mesh.spin*", "modeling/meshes/tools/spin.html#bpy-ops-mesh-spin"), ("bpy.ops.nla.split*", "editors/nla/editing.html#bpy-ops-nla-split"), + ("bpy.ops.pose.copy*", "animation/armatures/posing/editing/copy_paste.html#bpy-ops-pose-copy"), + ("bpy.ops.pose.push*", "animation/armatures/posing/editing/in_betweens.html#bpy-ops-pose-push"), ("bpy.ops.rigidbody*", "physics/rigid_body/index.html#bpy-ops-rigidbody"), ("bpy.ops.sequencer*", "video_editing/index.html#bpy-ops-sequencer"), ("bpy.ops.text.find*", "editors/text_editor.html#bpy-ops-text-find"), diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index ef4e1a9f77b..dde718a45b4 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -1926,10 +1926,15 @@ def km_file_browser_main(params): items.extend([ ("file.execute", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, {"properties": [("need_active", True)]}), + # Both .execute and .select are needed here. The former only works if + # there's a file operator (i.e. not in regular editor mode) but is + # needed to load files. The latter makes selection work if there's no + # operator (i.e. in regular editor mode). + ("file.select", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, + {"properties": [("open", True), ("deselect_all", not params.legacy)]}), ("file.refresh", {"type": 'NUMPAD_PERIOD', "value": 'PRESS'}, None), - ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK'}, + ("file.select", {"type": 'LEFTMOUSE', "value": 'PRESS'}, {"properties": [("open", False), ("deselect_all", not params.legacy)]}), - ("file.select", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None), ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK', "ctrl": True}, {"properties": [("extend", True), ("open", False)]}), ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True}, @@ -4533,6 +4538,8 @@ def km_mesh(params): ("mesh.dissolve_mode", {"type": 'DEL', "value": 'PRESS', "ctrl": True}, None), ("mesh.knife_tool", {"type": 'K', "value": 'PRESS'}, {"properties": [("use_occlude_geometry", True), ("only_selected", False)]}), + ("mesh.knife_tool", {"type": 'K', "value": 'PRESS', "shift": True}, + {"properties": [("use_occlude_geometry", False), ("only_selected", True)]}), ("object.vertex_parent_set", {"type": 'P', "value": 'PRESS', "ctrl": True}, None), # Menus. op_menu("VIEW3D_MT_edit_mesh_faces", {"type": 'F', "value": 'PRESS', "ctrl": True}), @@ -4568,8 +4575,6 @@ def km_mesh(params): ("mesh.faces_select_linked_flat", {"type": 'F', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None), ("mesh.spin", {"type": 'R', "value": 'PRESS', "alt": True}, None), ("mesh.beautify_fill", {"type": 'F', "value": 'PRESS', "shift": True, "alt": True}, None), - ("mesh.knife_tool", {"type": 'K', "value": 'PRESS', "shift": True}, - {"properties": [("use_occlude_geometry", False), ("only_selected", True)]}), *_template_items_object_subdivision_set(), ]) diff --git a/release/scripts/startup/bl_operators/userpref.py b/release/scripts/startup/bl_operators/userpref.py index 2e14df1920f..1ac64f85cad 100644 --- a/release/scripts/startup/bl_operators/userpref.py +++ b/release/scripts/startup/bl_operators/userpref.py @@ -351,7 +351,7 @@ class PREFERENCES_OT_keyitem_restore(Operator): item_id: IntProperty( name="Item Identifier", - description="Identifier of the item to remove", + description="Identifier of the item to restore", ) @classmethod diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index 27df265d013..7ff2688f2a7 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -346,9 +346,11 @@ class DATA_PT_shape_keys(MeshButtonsPanel, Panel): enable_edit = ob.mode != 'EDIT' enable_edit_value = False + enable_pin = False - if ob.show_only_shape_key is False: - if enable_edit or (ob.type == 'MESH' and ob.use_shape_key_edit_mode): + if enable_edit or (ob.use_shape_key_edit_mode and ob.type == 'MESH'): + enable_pin = True + if ob.show_only_shape_key is False: enable_edit_value = True row = layout.row() @@ -386,7 +388,7 @@ class DATA_PT_shape_keys(MeshButtonsPanel, Panel): sub = row.row(align=True) sub.label() # XXX, for alignment only subsub = sub.row(align=True) - subsub.active = enable_edit_value + subsub.active = enable_pin subsub.prop(ob, "show_only_shape_key", text="") sub.prop(ob, "use_shape_key_edit_mode", text="") diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index 8ce53ed30eb..b142f6085fa 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -212,7 +212,6 @@ class OBJECT_PT_display(ObjectButtonsPanel, Panel): layout = self.layout layout.use_property_split = True - obj = context.object obj_type = obj.type is_geometry = (obj_type in {'MESH', 'CURVE', 'SURFACE', 'META', 'FONT', 'VOLUME', 'HAIR', 'POINTCLOUD'}) @@ -237,10 +236,11 @@ class OBJECT_PT_display(ObjectButtonsPanel, Panel): col.prop(obj, "show_in_front", text="In Front") # if obj_type == 'MESH' or is_empty_image: # col.prop(obj, "show_transparent", text="Transparency") + sub = layout.column() if is_wire: # wire objects only use the max. display type for duplis - col.active = is_dupli - col.prop(obj, "display_type", text="Display As") + sub.active = is_dupli + sub.prop(obj, "display_type", text="Display As") if is_geometry or is_dupli or is_empty_image or is_gpencil: # Only useful with object having faces/materials... diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index 13073d182d1..8dd5b935922 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -473,6 +473,7 @@ class PHYSICS_PT_liquid(PhysicButtonsPanel, Panel): col = flow.column() col.prop(domain, "simulation_method", expand=False) col.prop(domain, "flip_ratio", text="FLIP Ratio") + col.prop(domain, "sys_particle_maximum", text="System Maximum") col = col.column(align=True) col.prop(domain, "particle_radius", text="Particle Radius") col.prop(domain, "particle_number", text="Sampling") diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py index aa4d0b94b7f..5a54d4ca2d8 100644 --- a/release/scripts/startup/bl_ui/space_outliner.py +++ b/release/scripts/startup/bl_ui/space_outliner.py @@ -107,6 +107,14 @@ class OUTLINER_MT_editor_menus(Menu): class OUTLINER_MT_context_menu(Menu): bl_label = "Outliner Context Menu" + @staticmethod + def draw_common_operators(layout): + layout.menu("OUTLINER_MT_context_menu_view") + + layout.separator() + + layout.menu("INFO_MT_area") + def draw(self, context): space = context.space_data @@ -116,11 +124,7 @@ class OUTLINER_MT_context_menu(Menu): OUTLINER_MT_collection_new.draw_without_context_menu(context, layout) layout.separator() - layout.menu("OUTLINER_MT_context_menu_view") - - layout.separator() - - layout.menu("INFO_MT_area") + OUTLINER_MT_context_menu.draw_common_operators(layout) class OUTLINER_MT_context_menu_view(Menu): @@ -242,7 +246,7 @@ class OUTLINER_MT_collection(Menu): layout.separator() - OUTLINER_MT_context_menu.draw(self, context) + OUTLINER_MT_context_menu.draw_common_operators(layout) class OUTLINER_MT_collection_new(Menu): @@ -250,7 +254,7 @@ class OUTLINER_MT_collection_new(Menu): @staticmethod def draw_without_context_menu(context, layout): - layout.operator("outliner.collection_new", text="New Collection").nested = False + layout.operator("outliner.collection_new", text="New Collection").nested = True layout.operator("outliner.id_paste", text="Paste Data-Blocks", icon='PASTEDOWN') def draw(self, context): @@ -260,7 +264,7 @@ class OUTLINER_MT_collection_new(Menu): layout.separator() - OUTLINER_MT_context_menu.draw(self, context) + OUTLINER_MT_context_menu.draw_common_operators(layout) class OUTLINER_MT_object(Menu): @@ -303,11 +307,15 @@ class OUTLINER_MT_object(Menu): layout.operator("outliner.id_operation", text="Unlink").type = 'UNLINK' layout.separator() + layout.operator("outliner.collection_new", text="New Collection").nested = True + + layout.separator() + layout.operator_menu_enum("outliner.id_operation", "type", text="ID Data") layout.separator() - OUTLINER_MT_context_menu.draw(self, context) + OUTLINER_MT_context_menu.draw_common_operators(layout) class OUTLINER_PT_filter(Panel): diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index 83b3a27154a..e4cecf3378f 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -2385,8 +2385,9 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): 'OBJECT': [ *_tools_default, - None, - _tools_view3d_add, + # Disable for 2.90 release. + # None, + # _tools_view3d_add, ], 'POSE': [ *_tools_default, @@ -2414,8 +2415,9 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): ], 'EDIT_MESH': [ *_tools_default, - None, - _tools_view3d_add, + # Disable for 2.90 release. + # None, + # _tools_view3d_add, None, ( _defs_edit_mesh.extrude, diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 39e4ee2beac..6e31808d27d 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -208,6 +208,10 @@ class VIEW3D_PT_tools_meshedit_options(View3DPanel, Panel): row = layout.row(align=True, heading="Transform") row.prop(tool_settings, "use_transform_correct_face_attributes") + row = layout.row(align=True) + row.active = tool_settings.use_transform_correct_face_attributes + row.prop(tool_settings, "use_transform_correct_keep_connected") + row = layout.row(heading="Mirror") sub = row.row(align=True) sub.prop(mesh, "use_mirror_x", text="X", toggle=True) diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index 1d0cb2f524c..9013836fd1e 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -21,8 +21,7 @@ * \ingroup blf */ -#ifndef __BLF_API_H__ -#define __BLF_API_H__ +#pragma once #include "BLI_compiler_attrs.h" #include "BLI_sys_types.h" @@ -305,5 +304,3 @@ struct ResultBLF { #ifdef __cplusplus } #endif - -#endif /* __BLF_API_H__ */ diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h index 4ae592d323f..ba0873f4fd4 100644 --- a/source/blender/blenfont/intern/blf_internal.h +++ b/source/blender/blenfont/intern/blf_internal.h @@ -21,8 +21,7 @@ * \ingroup blf */ -#ifndef __BLF_INTERNAL_H__ -#define __BLF_INTERNAL_H__ +#pragma once struct FontBLF; struct GlyphBLF; @@ -151,5 +150,3 @@ extern FT_Error FT_New_Face__win32_compat(FT_Library library, FT_Face *aface); # endif #endif - -#endif /* __BLF_INTERNAL_H__ */ diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h index 34b674670fd..36bb8769306 100644 --- a/source/blender/blenfont/intern/blf_internal_types.h +++ b/source/blender/blenfont/intern/blf_internal_types.h @@ -21,8 +21,7 @@ * \ingroup blf */ -#ifndef __BLF_INTERNAL_TYPES_H__ -#define __BLF_INTERNAL_TYPES_H__ +#pragma once #include "GPU_texture.h" #include "GPU_vertex_buffer.h" @@ -258,5 +257,3 @@ typedef struct DirBLF { /* full path where search fonts. */ char *path; } DirBLF; - -#endif /* __BLF_INTERNAL_TYPES_H__ */ diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 9162ed56655..76c610fb5bd 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_DERIVEDMESH_H__ -#define __BKE_DERIVEDMESH_H__ +#pragma once /** \file * \ingroup bke @@ -382,7 +381,6 @@ void DM_calc_loop_tangents(DerivedMesh *dm, #ifndef NDEBUG char *DM_debug_info(DerivedMesh *dm); void DM_debug_print(DerivedMesh *dm); -void DM_debug_print_cdlayers(CustomData *cdata); bool DM_is_valid(DerivedMesh *dm); #endif @@ -390,5 +388,3 @@ bool DM_is_valid(DerivedMesh *dm); #ifdef __cplusplus } #endif - -#endif /* __BKE_DERIVEDMESH_H__ */ diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index b7904ce1879..e08604f02ad 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_ACTION_H__ -#define __BKE_ACTION_H__ +#pragma once /** \file * \ingroup bke @@ -129,6 +128,8 @@ void BKE_pose_channel_free(struct bPoseChannel *pchan); void BKE_pose_channel_free_ex(struct bPoseChannel *pchan, bool do_id_user); void BKE_pose_channel_runtime_reset(struct bPoseChannel_Runtime *runtime); +void BKE_pose_channel_runtime_reset_on_copy(struct bPoseChannel_Runtime *runtime); + void BKE_pose_channel_runtime_free(struct bPoseChannel_Runtime *runtime); void BKE_pose_channel_free_bbone_cache(struct bPoseChannel_Runtime *runtime); @@ -153,12 +154,15 @@ void BKE_pose_copy_data_ex(struct bPose **dst, const bool copy_constraints); void BKE_pose_copy_data(struct bPose **dst, const struct bPose *src, const bool copy_constraints); void BKE_pose_channel_copy_data(struct bPoseChannel *pchan, const struct bPoseChannel *pchan_from); +void BKE_pose_channel_session_uuid_generate(struct bPoseChannel *pchan); struct bPoseChannel *BKE_pose_channel_find_name(const struct bPose *pose, const char *name); struct bPoseChannel *BKE_pose_channel_active(struct Object *ob); struct bPoseChannel *BKE_pose_channel_active_or_first_selected(struct Object *ob); struct bPoseChannel *BKE_pose_channel_verify(struct bPose *pose, const char *name); struct bPoseChannel *BKE_pose_channel_get_mirrored(const struct bPose *pose, const char *name); +void BKE_pose_check_uuids_unique_and_report(const struct bPose *pose); + #ifndef NDEBUG bool BKE_pose_channels_is_valid(const struct bPose *pose); #endif @@ -218,5 +222,3 @@ void BKE_pose_tag_recalc(struct Main *bmain, struct bPose *pose); #ifdef __cplusplus }; #endif - -#endif diff --git a/source/blender/blenkernel/BKE_addon.h b/source/blender/blenkernel/BKE_addon.h index 741be17bb25..73e3f6e41dc 100644 --- a/source/blender/blenkernel/BKE_addon.h +++ b/source/blender/blenkernel/BKE_addon.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_ADDON_H__ -#define __BKE_ADDON_H__ +#pragma once /** \file * \ingroup bke @@ -56,5 +55,3 @@ void BKE_addon_free(struct bAddon *addon); #ifdef __cplusplus } #endif - -#endif /* __BKE_ADDON_H__ */ diff --git a/source/blender/blenkernel/BKE_anim_data.h b/source/blender/blenkernel/BKE_anim_data.h index 48e95740b9d..189e45f4fe5 100644 --- a/source/blender/blenkernel/BKE_anim_data.h +++ b/source/blender/blenkernel/BKE_anim_data.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_ANIM_DATA_H__ -#define __BKE_ANIM_DATA_H__ +#pragma once /** \file * \ingroup bke @@ -98,5 +97,3 @@ void BKE_animdata_merge_copy(struct Main *bmain, #ifdef __cplusplus } #endif - -#endif /* __BKE_ANIM_DATA_H__*/ diff --git a/source/blender/blenkernel/BKE_anim_path.h b/source/blender/blenkernel/BKE_anim_path.h index 4de853303ad..ae2d13530ed 100644 --- a/source/blender/blenkernel/BKE_anim_path.h +++ b/source/blender/blenkernel/BKE_anim_path.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_ANIM_PATH_H__ -#define __BKE_ANIM_PATH_H__ +#pragma once /** \file * \ingroup bke @@ -47,5 +46,3 @@ bool where_on_path(const struct Object *ob, #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_anim_visualization.h b/source/blender/blenkernel/BKE_anim_visualization.h index 5dcbfa0919e..fb7875a112e 100644 --- a/source/blender/blenkernel/BKE_anim_visualization.h +++ b/source/blender/blenkernel/BKE_anim_visualization.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_ANIM_VISUALIZATION_H__ -#define __BKE_ANIM_VISUALIZATION_H__ +#pragma once /** \file * \ingroup bke @@ -52,5 +51,3 @@ struct bMotionPath *animviz_verify_motionpaths(struct ReportList *reports, #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index ddfe6b61cfb..ef74bb61a7e 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_ANIMSYS_H__ -#define __BKE_ANIMSYS_H__ +#pragma once /** \file * \ingroup bke @@ -148,17 +147,18 @@ bool BKE_animdata_fix_paths_remove(struct ID *id, const char *path); /* -------------------------------------- */ +typedef struct AnimationBasePathChange { + struct AnimationBasePathChange *next, *prev; + const char *src_basepath; + const char *dst_basepath; +} AnimationBasePathChange; + /* Move animation data from src to destination if it's paths are based on basepaths */ -void BKE_animdata_separate_by_basepath(struct Main *bmain, +void BKE_animdata_transfer_by_basepath(struct Main *bmain, struct ID *srcID, struct ID *dstID, struct ListBase *basepaths); -/* Move F-Curves from src to destination if it's path is based on basepath */ -void action_move_fcurves_by_basepath(struct bAction *srcAct, - struct bAction *dstAct, - const char basepath[]); - char *BKE_animdata_driver_path_hack(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, @@ -275,5 +275,3 @@ void BKE_animsys_update_driver_array(struct ID *id); #ifdef __cplusplus } #endif - -#endif /* __BKE_ANIMSYS_H__*/ diff --git a/source/blender/blenkernel/BKE_appdir.h b/source/blender/blenkernel/BKE_appdir.h index e49fc260810..b8a4497c7be 100644 --- a/source/blender/blenkernel/BKE_appdir.h +++ b/source/blender/blenkernel/BKE_appdir.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_APPDIR_H__ -#define __BKE_APPDIR_H__ +#pragma once /** \file * \ingroup bli @@ -101,5 +100,3 @@ enum { #ifdef __cplusplus } #endif - -#endif /* __BKE_APPDIR_H__ */ diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index 6fb6675a05a..6d48397b1af 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_ARMATURE_H__ -#define __BKE_ARMATURE_H__ +#pragma once /** \file * \ingroup bke @@ -123,22 +122,24 @@ void get_objectspace_bone_matrix(struct Bone *bone, float M_accumulatedMatrix[4][4], int root, int posed); -void vec_roll_to_mat3(const float vec[3], const float roll, float mat[3][3]); -void vec_roll_to_mat3_normalized(const float nor[3], const float roll, float mat[3][3]); +void vec_roll_to_mat3(const float vec[3], const float roll, float r_mat[3][3]); +void vec_roll_to_mat3_normalized(const float nor[3], const float roll, float r_mat[3][3]); void mat3_to_vec_roll(const float mat[3][3], float r_vec[3], float *r_roll); void mat3_vec_to_roll(const float mat[3][3], const float vec[3], float *r_roll); /* Common Conversions Between Co-ordinate Spaces */ -void BKE_armature_mat_world_to_pose(struct Object *ob, float inmat[4][4], float outmat[4][4]); +void BKE_armature_mat_world_to_pose(struct Object *ob, + const float inmat[4][4], + float outmat[4][4]); void BKE_armature_loc_world_to_pose(struct Object *ob, const float inloc[3], float outloc[3]); void BKE_armature_mat_pose_to_bone(struct bPoseChannel *pchan, - float inmat[4][4], + const float inmat[4][4], float outmat[4][4]); void BKE_armature_loc_pose_to_bone(struct bPoseChannel *pchan, const float inloc[3], float outloc[3]); void BKE_armature_mat_bone_to_pose(struct bPoseChannel *pchan, - float inmat[4][4], + const float inmat[4][4], float outmat[4][4]); void BKE_armature_mat_pose_to_delta(float delta_mat[4][4], float pose_mat[4][4], @@ -147,13 +148,13 @@ void BKE_armature_mat_pose_to_delta(float delta_mat[4][4], void BKE_armature_mat_pose_to_bone_ex(struct Depsgraph *depsgraph, struct Object *ob, struct bPoseChannel *pchan, - float inmat[4][4], + const float inmat[4][4], float outmat[4][4]); -void BKE_pchan_mat3_to_rot(struct bPoseChannel *pchan, float mat[3][3], bool use_compat); -void BKE_pchan_rot_to_mat3(const struct bPoseChannel *pchan, float mat[3][3]); -void BKE_pchan_apply_mat4(struct bPoseChannel *pchan, float mat[4][4], bool use_comat); -void BKE_pchan_to_mat4(const struct bPoseChannel *pchan, float chan_mat[4][4]); +void BKE_pchan_mat3_to_rot(struct bPoseChannel *pchan, const float mat[3][3], bool use_compat); +void BKE_pchan_rot_to_mat3(const struct bPoseChannel *pchan, float r_mat[3][3]); +void BKE_pchan_apply_mat4(struct bPoseChannel *pchan, const float mat[4][4], bool use_comat); +void BKE_pchan_to_mat4(const struct bPoseChannel *pchan, float r_mat[4][4]); void BKE_pchan_calc_mat(struct bPoseChannel *pchan); /* Simple helper, computes the offset bone matrix. */ @@ -387,5 +388,3 @@ void BKE_armature_deform_coords_with_editmesh(const struct Object *ob_arm, #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_autoexec.h b/source/blender/blenkernel/BKE_autoexec.h index bb847d49a4b..84d83ae5d30 100644 --- a/source/blender/blenkernel/BKE_autoexec.h +++ b/source/blender/blenkernel/BKE_autoexec.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_AUTOEXEC_H__ -#define __BKE_AUTOEXEC_H__ +#pragma once /** \file * \ingroup bke @@ -29,5 +28,3 @@ bool BKE_autoexec_match(const char *path); #ifdef __cplusplus } #endif - -#endif /* __BKE_AUTOEXEC_H__ */ diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 3feba4b3a66..abc0ce1f092 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_BLENDER_H__ -#define __BKE_BLENDER_H__ +#pragma once /** \file * \ingroup bke @@ -54,5 +53,3 @@ void BKE_blender_atexit(void); #ifdef __cplusplus } #endif - -#endif /* __BKE_BLENDER_H__ */ diff --git a/source/blender/blenkernel/BKE_blender_copybuffer.h b/source/blender/blenkernel/BKE_blender_copybuffer.h index ca20d3d9bba..1dd6d495276 100644 --- a/source/blender/blenkernel/BKE_blender_copybuffer.h +++ b/source/blender/blenkernel/BKE_blender_copybuffer.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_BLENDER_COPYBUFFER_H__ -#define __BKE_BLENDER_COPYBUFFER_H__ +#pragma once /** \file * \ingroup bke @@ -48,5 +47,3 @@ int BKE_copybuffer_paste(struct bContext *C, #ifdef __cplusplus } #endif - -#endif /* __BKE_BLENDER_COPYBUFFER_H__ */ diff --git a/source/blender/blenkernel/BKE_blender_undo.h b/source/blender/blenkernel/BKE_blender_undo.h index 4ecedbbfc1e..e5ce91df3fb 100644 --- a/source/blender/blenkernel/BKE_blender_undo.h +++ b/source/blender/blenkernel/BKE_blender_undo.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_BLENDER_UNDO_H__ -#define __BKE_BLENDER_UNDO_H__ +#pragma once /** \file * \ingroup bke @@ -41,5 +40,3 @@ void BKE_memfile_undo_free(struct MemFileUndoData *mfu); #ifdef __cplusplus } #endif - -#endif /* __BKE_BLENDER_UNDO_H__ */ diff --git a/source/blender/blenkernel/BKE_blender_user_menu.h b/source/blender/blenkernel/BKE_blender_user_menu.h index 805a343b976..8d00cde488e 100644 --- a/source/blender/blenkernel/BKE_blender_user_menu.h +++ b/source/blender/blenkernel/BKE_blender_user_menu.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_BLENDER_USER_MENU_H__ -#define __BKE_BLENDER_USER_MENU_H__ +#pragma once /** \file * \ingroup bke @@ -43,5 +42,3 @@ void BKE_blender_user_menu_item_free_list(struct ListBase *lb); #ifdef __cplusplus } #endif - -#endif /* __BKE_BLENDER_USER_MENU_H__ */ diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index 77d2a973c50..3df09d08814 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_BLENDER_VERSION_H__ -#define __BKE_BLENDER_VERSION_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -45,7 +44,7 @@ extern "C" { /* Minimum Blender version that supports reading file written with the current * version. Older Blender versions will test this and show a warning if the file * was written with too new a version. */ -#define BLENDER_FILE_MIN_VERSION 280 +#define BLENDER_FILE_MIN_VERSION 290 #define BLENDER_FILE_MIN_SUBVERSION 0 /** User readable version string. */ @@ -54,5 +53,3 @@ const char *BKE_blender_version_string(void); #ifdef __cplusplus } #endif - -#endif /* __BKE_BLENDER_VERSION_H__ */ diff --git a/source/blender/blenkernel/BKE_blendfile.h b/source/blender/blenkernel/BKE_blendfile.h index e835137bfa1..94d203eeb2c 100644 --- a/source/blender/blenkernel/BKE_blendfile.h +++ b/source/blender/blenkernel/BKE_blendfile.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_BLENDFILE_H__ -#define __BKE_BLENDFILE_H__ +#pragma once /** \file * \ingroup bke @@ -81,5 +80,3 @@ void BKE_blendfile_write_partial_end(struct Main *bmain_src); #ifdef __cplusplus } #endif - -#endif /* __BKE_BLENDFILE_H__ */ diff --git a/source/blender/blenkernel/BKE_boids.h b/source/blender/blenkernel/BKE_boids.h index f9fd814b5f2..c9e6f0e7346 100644 --- a/source/blender/blenkernel/BKE_boids.h +++ b/source/blender/blenkernel/BKE_boids.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_BOIDS_H__ -#define __BKE_BOIDS_H__ +#pragma once /** \file * \ingroup bke @@ -62,5 +61,3 @@ BoidState *boid_get_current_state(BoidSettings *boids); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_bpath.h b/source/blender/blenkernel/BKE_bpath.h index cc8dd0d5b33..787dc4d1147 100644 --- a/source/blender/blenkernel/BKE_bpath.h +++ b/source/blender/blenkernel/BKE_bpath.h @@ -20,8 +20,7 @@ * so for BPath we don't need to malloc */ -#ifndef __BKE_BPATH_H__ -#define __BKE_BPATH_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -92,5 +91,3 @@ void BKE_bpath_absolute_convert(struct Main *bmain, #ifdef __cplusplus } #endif - -#endif /* __BKE_BPATH_H__ */ diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index 4e9430ab3e1..af299c917eb 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_BRUSH_H__ -#define __BKE_BRUSH_H__ +#pragma once /** \file * \ingroup bke @@ -157,5 +156,3 @@ void BKE_brush_debug_print_state(struct Brush *br); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_bvhutils.h b/source/blender/blenkernel/BKE_bvhutils.h index 5d7e8fe743e..e973bee9e20 100644 --- a/source/blender/blenkernel/BKE_bvhutils.h +++ b/source/blender/blenkernel/BKE_bvhutils.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2006 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_BVHUTILS_H__ -#define __BKE_BVHUTILS_H__ +#pragma once /** \file * \ingroup bke @@ -263,5 +262,3 @@ void bvhcache_free(struct BVHCache *bvh_cache); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_cachefile.h b/source/blender/blenkernel/BKE_cachefile.h index 596085f9c6f..9912b4e4b70 100644 --- a/source/blender/blenkernel/BKE_cachefile.h +++ b/source/blender/blenkernel/BKE_cachefile.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_CACHEFILE_H__ -#define __BKE_CACHEFILE_H__ +#pragma once /** \file * \ingroup bke @@ -66,5 +65,3 @@ void BKE_cachefile_reader_free(struct CacheFile *cache_file, struct CacheReader #ifdef __cplusplus } #endif - -#endif /* __BKE_CACHEFILE_H__ */ diff --git a/source/blender/blenkernel/BKE_callbacks.h b/source/blender/blenkernel/BKE_callbacks.h index 284948da634..fadba5644de 100644 --- a/source/blender/blenkernel/BKE_callbacks.h +++ b/source/blender/blenkernel/BKE_callbacks.h @@ -18,8 +18,7 @@ * \ingroup bke */ -#ifndef __BKE_CALLBACKS_H__ -#define __BKE_CALLBACKS_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -88,5 +87,3 @@ void BKE_callback_global_finalize(void); #ifdef __cplusplus } #endif - -#endif /* __BKE_CALLBACKS_H__ */ diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h index 812f5d520d7..533d5ae13cd 100644 --- a/source/blender/blenkernel/BKE_camera.h +++ b/source/blender/blenkernel/BKE_camera.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_CAMERA_H__ -#define __BKE_CAMERA_H__ +#pragma once /** \file * \ingroup bke @@ -167,5 +166,3 @@ void BKE_camera_background_image_clear(struct Camera *cam); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_ccg.h b/source/blender/blenkernel/BKE_ccg.h index ad1e05ee367..acdaa81da8d 100644 --- a/source/blender/blenkernel/BKE_ccg.h +++ b/source/blender/blenkernel/BKE_ccg.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_CCG_H__ -#define __BKE_CCG_H__ +#pragma once /** \file * \ingroup bke @@ -166,5 +165,3 @@ BLI_INLINE CCGElem *CCG_elem_next(const CCGKey *key, CCGElem *elem) #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h index dd7d20c0407..e997678001f 100644 --- a/source/blender/blenkernel/BKE_cdderivedmesh.h +++ b/source/blender/blenkernel/BKE_cdderivedmesh.h @@ -26,8 +26,7 @@ * \note This is deprecated & should eventually be removed. */ -#ifndef __BKE_CDDERIVEDMESH_H__ -#define __BKE_CDDERIVEDMESH_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -49,5 +48,3 @@ struct DerivedMesh *CDDM_copy(struct DerivedMesh *dm); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h index cd78746a3f0..5af37829577 100644 --- a/source/blender/blenkernel/BKE_cloth.h +++ b/source/blender/blenkernel/BKE_cloth.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) Blender Foundation. * All rights reserved. */ -#ifndef __BKE_CLOTH_H__ -#define __BKE_CLOTH_H__ +#pragma once /** \file * \ingroup bke @@ -307,5 +306,3 @@ void cloth_parallel_transport_hair_frame(float mat[3][3], #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h index 25bc2006ee3..f4393742dff 100644 --- a/source/blender/blenkernel/BKE_collection.h +++ b/source/blender/blenkernel/BKE_collection.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_COLLECTION_H__ -#define __BKE_COLLECTION_H__ +#pragma once /** \file * \ingroup bke @@ -255,5 +254,3 @@ void BKE_scene_objects_iterator_end(struct BLI_Iterator *iter); #ifdef __cplusplus } #endif - -#endif /* __BKE_COLLECTION_H__ */ diff --git a/source/blender/blenkernel/BKE_collision.h b/source/blender/blenkernel/BKE_collision.h index c3ecd0b7ed0..579adb61057 100644 --- a/source/blender/blenkernel/BKE_collision.h +++ b/source/blender/blenkernel/BKE_collision.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) Blender Foundation. * All rights reserved. */ -#ifndef __BKE_COLLISION_H__ -#define __BKE_COLLISION_H__ +#pragma once /** \file * \ingroup bke @@ -178,5 +177,3 @@ void BKE_collider_cache_free(struct ListBase **colliders); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_colorband.h b/source/blender/blenkernel/BKE_colorband.h index 355682671fe..6ac96a1ed36 100644 --- a/source/blender/blenkernel/BKE_colorband.h +++ b/source/blender/blenkernel/BKE_colorband.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_COLORBAND_H__ -#define __BKE_COLORBAND_H__ +#pragma once /** \file * \ingroup bke @@ -47,5 +46,3 @@ void BKE_colorband_update_sort(struct ColorBand *coba); #ifdef __cplusplus } #endif - -#endif /* __BKE_COLORBAND_H__ */ diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h index 0623e0e5395..5a68514a387 100644 --- a/source/blender/blenkernel/BKE_colortools.h +++ b/source/blender/blenkernel/BKE_colortools.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2006 Blender Foundation. * All rights reserved. */ -#ifndef __BKE_COLORTOOLS_H__ -#define __BKE_COLORTOOLS_H__ +#pragma once /** \file * \ingroup bke @@ -152,5 +151,3 @@ bool BKE_color_managed_colorspace_settings_equals( #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h index 8d7fe875c37..94349f4db22 100644 --- a/source/blender/blenkernel/BKE_constraint.h +++ b/source/blender/blenkernel/BKE_constraint.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_CONSTRAINT_H__ -#define __BKE_CONSTRAINT_H__ +#pragma once /** \file * \ingroup bke @@ -224,5 +223,3 @@ void BKE_constraints_solve(struct Depsgraph *depsgraph, #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index 7544789d864..eb26f1c3969 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_CONTEXT_H__ -#define __BKE_CONTEXT_H__ +#pragma once /** \file * \ingroup bke @@ -346,5 +345,3 @@ struct Depsgraph *CTX_data_depsgraph_on_load(const bContext *C); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_crazyspace.h b/source/blender/blenkernel/BKE_crazyspace.h index 6ac6b17d468..b95be70379f 100644 --- a/source/blender/blenkernel/BKE_crazyspace.h +++ b/source/blender/blenkernel/BKE_crazyspace.h @@ -21,8 +21,7 @@ * \ingroup bke */ -#ifndef __BKE_CRAZYSPACE_H__ -#define __BKE_CRAZYSPACE_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -65,5 +64,3 @@ void BKE_crazyspace_build_sculpt(struct Depsgraph *depsgraph, #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index ca41e51984b..0bd4e3a7582 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_CURVE_H__ -#define __BKE_CURVE_H__ +#pragma once /** \file * \ingroup bke @@ -98,15 +97,15 @@ bool BKE_curve_minmax(struct Curve *cu, bool use_radius, float min[3], float max bool BKE_curve_center_median(struct Curve *cu, float cent[3]); bool BKE_curve_center_bounds(struct Curve *cu, float cent[3]); void BKE_curve_transform_ex(struct Curve *cu, - float mat[4][4], + const float mat[4][4], const bool do_keys, const bool do_props, const float unit_scale); void BKE_curve_transform(struct Curve *cu, - float mat[4][4], + const float mat[4][4], const bool do_keys, const bool do_props); -void BKE_curve_translate(struct Curve *cu, float offset[3], const bool do_keys); +void BKE_curve_translate(struct Curve *cu, const float offset[3], const bool do_keys); void BKE_curve_material_index_remove(struct Curve *cu, int index); bool BKE_curve_material_index_used(struct Curve *cu, int index); void BKE_curve_material_index_clear(struct Curve *cu); @@ -339,5 +338,3 @@ void BKE_curve_deform_co(const struct Object *ob_curve, #ifdef __cplusplus } #endif - -#endif /* __BKE_CURVE_H__ */ diff --git a/source/blender/blenkernel/BKE_curveprofile.h b/source/blender/blenkernel/BKE_curveprofile.h index 877ab887138..84dbcd25b32 100644 --- a/source/blender/blenkernel/BKE_curveprofile.h +++ b/source/blender/blenkernel/BKE_curveprofile.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_CURVEPROFILE_H__ -#define __BKE_CURVEPROFILE_H__ +#pragma once /** \file * \ingroup bke @@ -101,5 +100,3 @@ void BKE_curveprofile_blend_read(struct BlendDataReader *reader, struct CurvePro #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index 42beda352f5..92bfa3a9490 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -22,8 +22,7 @@ * \brief CustomData interface, see also DNA_customdata_types.h. */ -#ifndef __BKE_CUSTOMDATA_H__ -#define __BKE_CUSTOMDATA_H__ +#pragma once #include "BLI_sys_types.h" #include "BLI_utildefines.h" @@ -455,6 +454,7 @@ bool CustomData_from_bmeshpoly_test(CustomData *fdata, CustomData *ldata, bool f bool CustomData_layer_validate(struct CustomDataLayer *layer, const uint totitems, const bool do_fixes); +void CustomData_layers__print(struct CustomData *data); /* External file storage */ @@ -574,5 +574,3 @@ void CustomData_data_transfer(const struct MeshPairRemap *me_remap, #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_customdata_file.h b/source/blender/blenkernel/BKE_customdata_file.h index 2be2f71a168..f9f02204bb9 100644 --- a/source/blender/blenkernel/BKE_customdata_file.h +++ b/source/blender/blenkernel/BKE_customdata_file.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_CUSTOMDATA_FILE_H__ -#define __BKE_CUSTOMDATA_FILE_H__ +#pragma once /** \file * \ingroup bke @@ -60,5 +59,3 @@ CDataFileLayer *cdf_layer_add(CDataFile *cdf, int type, const char *name, size_t #ifdef __cplusplus } #endif - -#endif /* __BKE_CUSTOMDATA_FILE_H__ */ diff --git a/source/blender/blenkernel/BKE_data_transfer.h b/source/blender/blenkernel/BKE_data_transfer.h index a723a9ed38c..d861baba14d 100644 --- a/source/blender/blenkernel/BKE_data_transfer.h +++ b/source/blender/blenkernel/BKE_data_transfer.h @@ -21,8 +21,7 @@ * \ingroup bke */ -#ifndef __BKE_DATA_TRANSFER_H__ -#define __BKE_DATA_TRANSFER_H__ +#pragma once #include "BKE_customdata.h" @@ -181,5 +180,3 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph, #ifdef __cplusplus } #endif - -#endif /* __BKE_DATA_TRANSFER_H__ */ diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h index f59e796c98c..35111d5240e 100644 --- a/source/blender/blenkernel/BKE_deform.h +++ b/source/blender/blenkernel/BKE_deform.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_DEFORM_H__ -#define __BKE_DEFORM_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -166,5 +165,3 @@ void BKE_defvert_weight_to_rgb(float r_rgb[3], const float weight); #ifdef __cplusplus } #endif - -#endif /* __BKE_DEFORM_H__ */ diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h index b7e4acdc636..7e1a6e54ede 100644 --- a/source/blender/blenkernel/BKE_displist.h +++ b/source/blender/blenkernel/BKE_displist.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_DISPLIST_H__ -#define __BKE_DISPLIST_H__ +#pragma once /** \file * \ingroup bke @@ -119,5 +118,3 @@ void BKE_displist_minmax(struct ListBase *dispbase, float min[3], float max[3]); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_displist_tangent.h b/source/blender/blenkernel/BKE_displist_tangent.h index 5e1c6ac8a21..c91c2c97dda 100644 --- a/source/blender/blenkernel/BKE_displist_tangent.h +++ b/source/blender/blenkernel/BKE_displist_tangent.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_DISPLIST_TANGENT_H__ -#define __BKE_DISPLIST_TANGENT_H__ +#pragma once /** \file * \ingroup bke @@ -30,5 +29,3 @@ void BKE_displist_tangent_calc(const DispList *dl, float (*fnormals)[3], float ( #ifdef __cplusplus } #endif - -#endif /* __BKE_DISPLIST_TANGENT_H__ */ diff --git a/source/blender/blenkernel/BKE_duplilist.h b/source/blender/blenkernel/BKE_duplilist.h index 13918dd4fb1..c142d5338d1 100644 --- a/source/blender/blenkernel/BKE_duplilist.h +++ b/source/blender/blenkernel/BKE_duplilist.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_DUPLILIST_H__ -#define __BKE_DUPLILIST_H__ +#pragma once /** \file * \ingroup bke @@ -64,5 +63,3 @@ typedef struct DupliObject { #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_dynamicpaint.h b/source/blender/blenkernel/BKE_dynamicpaint.h index 5e3603a8339..99b58b2f40a 100644 --- a/source/blender/blenkernel/BKE_dynamicpaint.h +++ b/source/blender/blenkernel/BKE_dynamicpaint.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_DYNAMICPAINT_H__ -#define __BKE_DYNAMICPAINT_H__ +#pragma once /** \file * \ingroup bke @@ -124,5 +123,3 @@ void dynamicPaint_outputSurfaceImage(struct DynamicPaintSurface *surface, #ifdef __cplusplus } #endif - -#endif /* __BKE_DYNAMICPAINT_H__ */ diff --git a/source/blender/blenkernel/BKE_editlattice.h b/source/blender/blenkernel/BKE_editlattice.h index c587ddb551b..be791487c27 100644 --- a/source/blender/blenkernel/BKE_editlattice.h +++ b/source/blender/blenkernel/BKE_editlattice.h @@ -18,8 +18,7 @@ * \ingroup bke */ -#ifndef __BKE_EDITLATTICE_H__ -#define __BKE_EDITLATTICE_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -34,5 +33,3 @@ void BKE_editlattice_load(struct Object *obedit); #ifdef __cplusplus } #endif - -#endif /* __BKE_EDITLATTICE_H__ */ diff --git a/source/blender/blenkernel/BKE_editmesh.h b/source/blender/blenkernel/BKE_editmesh.h index 9bd62858902..819e91b438e 100644 --- a/source/blender/blenkernel/BKE_editmesh.h +++ b/source/blender/blenkernel/BKE_editmesh.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_EDITMESH_H__ -#define __BKE_EDITMESH_H__ +#pragma once /** \file * \ingroup bke @@ -107,5 +106,3 @@ struct BoundBox *BKE_editmesh_cage_boundbox_get(BMEditMesh *em); #ifdef __cplusplus } #endif - -#endif /* __BKE_EDITMESH_H__ */ diff --git a/source/blender/blenkernel/BKE_editmesh_bvh.h b/source/blender/blenkernel/BKE_editmesh_bvh.h index b8d1e26fad2..8f8e573ee2f 100644 --- a/source/blender/blenkernel/BKE_editmesh_bvh.h +++ b/source/blender/blenkernel/BKE_editmesh_bvh.h @@ -21,8 +21,7 @@ * \ingroup bke */ -#ifndef __BKE_EDITMESH_BVH_H__ -#define __BKE_EDITMESH_BVH_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -104,5 +103,3 @@ enum { #ifdef __cplusplus } #endif - -#endif /* __BKE_EDITMESH_BVH_H__ */ diff --git a/source/blender/blenkernel/BKE_editmesh_cache.h b/source/blender/blenkernel/BKE_editmesh_cache.h index 6c812098b2e..bc2a70124fe 100644 --- a/source/blender/blenkernel/BKE_editmesh_cache.h +++ b/source/blender/blenkernel/BKE_editmesh_cache.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_EDITMESH_CACHE_H__ -#define __BKE_EDITMESH_CACHE_H__ +#pragma once /** \file * \ingroup bke @@ -41,5 +40,3 @@ bool BKE_editmesh_cache_calc_minmax(struct BMEditMesh *em, #ifdef __cplusplus } #endif - -#endif /* __BKE_EDITMESH_CACHE_H__ */ diff --git a/source/blender/blenkernel/BKE_editmesh_tangent.h b/source/blender/blenkernel/BKE_editmesh_tangent.h index 27f24438528..0e3f063ae44 100644 --- a/source/blender/blenkernel/BKE_editmesh_tangent.h +++ b/source/blender/blenkernel/BKE_editmesh_tangent.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_EDITMESH_TANGENT_H__ -#define __BKE_EDITMESH_TANGENT_H__ +#pragma once /** \file * \ingroup bke @@ -39,5 +38,3 @@ void BKE_editmesh_loop_tangent_calc(BMEditMesh *em, #ifdef __cplusplus } #endif - -#endif /* __BKE_EDITMESH_TANGENT_H__ */ diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h index 0518ce8ffa3..0585f67703c 100644 --- a/source/blender/blenkernel/BKE_effect.h +++ b/source/blender/blenkernel/BKE_effect.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_EFFECT_H__ -#define __BKE_EFFECT_H__ +#pragma once /** \file * \ingroup bke @@ -283,5 +282,3 @@ void BKE_sim_debug_data_clear_category(const char *category); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index b846e2e5b7b..3717eb0f282 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_FCURVE_H__ -#define __BKE_FCURVE_H__ +#pragma once /** \file * \ingroup bke @@ -315,5 +314,3 @@ void fcurve_store_samples( #ifdef __cplusplus } #endif - -#endif /* __BKE_FCURVE_H__*/ diff --git a/source/blender/blenkernel/BKE_fcurve_driver.h b/source/blender/blenkernel/BKE_fcurve_driver.h index 6803485f843..5b4da4a78a4 100644 --- a/source/blender/blenkernel/BKE_fcurve_driver.h +++ b/source/blender/blenkernel/BKE_fcurve_driver.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_FCURVE_DRIVER_H__ -#define __BKE_FCURVE_DRIVER_H__ +#pragma once /** \file * \ingroup bke @@ -103,5 +102,3 @@ float evaluate_driver(struct PathResolvedRNA *anim_rna, #ifdef __cplusplus } #endif - -#endif /* __BKE_FCURVE_DRIVER_H__*/ diff --git a/source/blender/blenkernel/BKE_fluid.h b/source/blender/blenkernel/BKE_fluid.h index 2392263181d..88a5492d85b 100644 --- a/source/blender/blenkernel/BKE_fluid.h +++ b/source/blender/blenkernel/BKE_fluid.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_FLUID_H__ -#define __BKE_FLUID_H__ +#pragma once /** \file * \ingroup bke @@ -101,5 +100,3 @@ void BKE_fluid_flow_behavior_set(struct Object *object, #ifdef __cplusplus } #endif - -#endif /* __BKE_FLUID_H__ */ diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h index 35f7d8b7d53..b23ccbe25ff 100644 --- a/source/blender/blenkernel/BKE_font.h +++ b/source/blender/blenkernel/BKE_font.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_FONT_H__ -#define __BKE_FONT_H__ +#pragma once /** \file * \ingroup bke @@ -102,5 +101,3 @@ void BKE_vfont_clipboard_get(char32_t **r_text_buf, #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_freestyle.h b/source/blender/blenkernel/BKE_freestyle.h index 888a3d96aa2..47f0b547d83 100644 --- a/source/blender/blenkernel/BKE_freestyle.h +++ b/source/blender/blenkernel/BKE_freestyle.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_FREESTYLE_H__ -#define __BKE_FREESTYLE_H__ +#pragma once /** \file * \ingroup bke @@ -66,5 +65,3 @@ void BKE_freestyle_lineset_unique_name(FreestyleConfig *config, FreestyleLineSet #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 61c270202f1..9ffd496616d 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_GLOBAL_H__ -#define __BKE_GLOBAL_H__ +#pragma once /** \file * \ingroup bke @@ -145,18 +144,19 @@ enum { G_DEBUG_DEPSGRAPH_TIME = (1 << 11), /* depsgraph timing statistics and messages */ G_DEBUG_DEPSGRAPH_NO_THREADS = (1 << 12), /* single threaded depsgraph */ G_DEBUG_DEPSGRAPH_PRETTY = (1 << 13), /* use pretty colors in depsgraph messages */ + G_DEBUG_DEPSGRAPH_UUID = (1 << 14), /* use pretty colors in depsgraph messages */ G_DEBUG_DEPSGRAPH = (G_DEBUG_DEPSGRAPH_BUILD | G_DEBUG_DEPSGRAPH_EVAL | G_DEBUG_DEPSGRAPH_TAG | - G_DEBUG_DEPSGRAPH_TIME), - G_DEBUG_SIMDATA = (1 << 14), /* sim debug data display */ - G_DEBUG_GPU_MEM = (1 << 15), /* gpu memory in status bar */ - G_DEBUG_GPU = (1 << 16), /* gpu debug */ - G_DEBUG_IO = (1 << 17), /* IO Debugging (for Collada, ...)*/ - G_DEBUG_GPU_SHADERS = (1 << 18), /* GLSL shaders */ - G_DEBUG_GPU_FORCE_WORKAROUNDS = (1 << 19), /* force gpu workarounds bypassing detections. */ - G_DEBUG_XR = (1 << 20), /* XR/OpenXR messages */ - G_DEBUG_XR_TIME = (1 << 21), /* XR/OpenXR timing messages */ - - G_DEBUG_GHOST = (1 << 20), /* Debug GHOST module. */ + G_DEBUG_DEPSGRAPH_TIME | G_DEBUG_DEPSGRAPH_UUID), + G_DEBUG_SIMDATA = (1 << 15), /* sim debug data display */ + G_DEBUG_GPU_MEM = (1 << 16), /* gpu memory in status bar */ + G_DEBUG_GPU = (1 << 17), /* gpu debug */ + G_DEBUG_IO = (1 << 18), /* IO Debugging (for Collada, ...)*/ + G_DEBUG_GPU_SHADERS = (1 << 19), /* GLSL shaders */ + G_DEBUG_GPU_FORCE_WORKAROUNDS = (1 << 20), /* force gpu workarounds bypassing detections. */ + G_DEBUG_XR = (1 << 21), /* XR/OpenXR messages */ + G_DEBUG_XR_TIME = (1 << 22), /* XR/OpenXR timing messages */ + + G_DEBUG_GHOST = (1 << 23), /* Debug GHOST module. */ }; #define G_DEBUG_ALL \ @@ -223,5 +223,3 @@ extern Global G; #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h index cd434566e43..6defc2ffd68 100644 --- a/source/blender/blenkernel/BKE_gpencil.h +++ b/source/blender/blenkernel/BKE_gpencil.h @@ -17,8 +17,7 @@ * This is a new part of Blender */ -#ifndef __BKE_GPENCIL_H__ -#define __BKE_GPENCIL_H__ +#pragma once /** \file * \ingroup bke @@ -280,5 +279,3 @@ void BKE_gpencil_update_layer_parent(const struct Depsgraph *depsgraph, struct O #ifdef __cplusplus } #endif - -#endif /* __BKE_GPENCIL_H__ */ diff --git a/source/blender/blenkernel/BKE_gpencil_curve.h b/source/blender/blenkernel/BKE_gpencil_curve.h index cf6f9074bda..3fbd0ce1a51 100644 --- a/source/blender/blenkernel/BKE_gpencil_curve.h +++ b/source/blender/blenkernel/BKE_gpencil_curve.h @@ -17,8 +17,7 @@ * This is a new part of Blender */ -#ifndef __BKE_GPENCIL_CURVE_H__ -#define __BKE_GPENCIL_CURVE_H__ +#pragma once /** \file * \ingroup bke @@ -43,5 +42,3 @@ void BKE_gpencil_convert_curve(struct Main *bmain, #ifdef __cplusplus } #endif - -#endif /* __BKE_GPENCIL_CURVE_H__ */ diff --git a/source/blender/blenkernel/BKE_gpencil_geom.h b/source/blender/blenkernel/BKE_gpencil_geom.h index 964764d99e7..0abd87d3d4e 100644 --- a/source/blender/blenkernel/BKE_gpencil_geom.h +++ b/source/blender/blenkernel/BKE_gpencil_geom.h @@ -17,8 +17,7 @@ * This is a new part of Blender */ -#ifndef __BKE_GPENCIL_GEOM_H__ -#define __BKE_GPENCIL_GEOM_H__ +#pragma once /** \file * \ingroup bke @@ -76,7 +75,7 @@ void BKE_gpencil_stroke_fill_triangulate(struct bGPDstroke *gps); void BKE_gpencil_stroke_geometry_update(struct bGPDstroke *gps); void BKE_gpencil_stroke_uv_update(struct bGPDstroke *gps); -void BKE_gpencil_transform(struct bGPdata *gpd, float mat[4][4]); +void BKE_gpencil_transform(struct bGPdata *gpd, const float mat[4][4]); typedef struct GPencilPointCoordinates { /* This is used when doing "move only origin" in object_data_transform.c. @@ -131,5 +130,3 @@ void BKE_gpencil_convert_mesh(struct Main *bmain, #ifdef __cplusplus } #endif - -#endif /* __BKE_GPENCIL_GEOM_H__ */ diff --git a/source/blender/blenkernel/BKE_gpencil_modifier.h b/source/blender/blenkernel/BKE_gpencil_modifier.h index ac5f4607838..8eafbe04a14 100644 --- a/source/blender/blenkernel/BKE_gpencil_modifier.h +++ b/source/blender/blenkernel/BKE_gpencil_modifier.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_GPENCIL_MODIFIER_H__ -#define __BKE_GPENCIL_MODIFIER_H__ +#pragma once /** \file * \ingroup bke @@ -316,5 +315,3 @@ struct bGPDframe *BKE_gpencil_frame_retime_get(struct Depsgraph *depsgraph, #ifdef __cplusplus } #endif - -#endif /* __BKE_GPENCIL_MODIFIER_H__ */ diff --git a/source/blender/blenkernel/BKE_hair.h b/source/blender/blenkernel/BKE_hair.h index ea515416b58..bf386e099e0 100644 --- a/source/blender/blenkernel/BKE_hair.h +++ b/source/blender/blenkernel/BKE_hair.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_HAIR_H__ -#define __BKE_HAIR_H__ +#pragma once /** \file * \ingroup bke @@ -61,5 +60,3 @@ extern void (*BKE_hair_batch_cache_free_cb)(struct Hair *hair); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_icons.h b/source/blender/blenkernel/BKE_icons.h index 56c50c22bf4..8a4fc78eb97 100644 --- a/source/blender/blenkernel/BKE_icons.h +++ b/source/blender/blenkernel/BKE_icons.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_ICONS_H__ -#define __BKE_ICONS_H__ +#pragma once /** \file * \ingroup bke @@ -173,5 +172,3 @@ int BKE_icon_ensure_studio_light(struct StudioLight *sl, int id_type); #ifdef __cplusplus } #endif - -#endif /* __BKE_ICONS_H__ */ diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h index dc01e8ea27b..58629cde6ec 100644 --- a/source/blender/blenkernel/BKE_idprop.h +++ b/source/blender/blenkernel/BKE_idprop.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_IDPROP_H__ -#define __BKE_IDPROP_H__ +#pragma once /** \file * \ingroup bke @@ -200,5 +199,3 @@ void IDP_print(const struct IDProperty *prop); #ifdef __cplusplus } #endif - -#endif /* __BKE_IDPROP_H__ */ diff --git a/source/blender/blenkernel/BKE_idtype.h b/source/blender/blenkernel/BKE_idtype.h index 38322427374..aefba9ef02a 100644 --- a/source/blender/blenkernel/BKE_idtype.h +++ b/source/blender/blenkernel/BKE_idtype.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_IDTYPE_H__ -#define __BKE_IDTYPE_H__ +#pragma once /** \file * \ingroup bke @@ -246,5 +245,3 @@ void BKE_idtype_id_foreach_cache(struct ID *id, #ifdef __cplusplus } #endif - -#endif /* __BKE_IDTYPE_H__ */ diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index 1e5573ab014..a18084f8bbd 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_IMAGE_H__ -#define __BKE_IMAGE_H__ +#pragma once /** \file * \ingroup bke @@ -370,5 +369,3 @@ bool BKE_image_clear_renderslot(struct Image *ima, struct ImageUser *iuser, int #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_image_save.h b/source/blender/blenkernel/BKE_image_save.h index 8dfece944ff..0620442d998 100644 --- a/source/blender/blenkernel/BKE_image_save.h +++ b/source/blender/blenkernel/BKE_image_save.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_IMAGE_SAVE_H__ -#define __BKE_IMAGE_SAVE_H__ +#pragma once #include "DNA_scene_types.h" @@ -62,5 +61,3 @@ bool BKE_image_save(struct ReportList *reports, #ifdef __cplusplus } #endif - -#endif /* __BKE_IMAGE_SAVE_H__ */ diff --git a/source/blender/blenkernel/BKE_ipo.h b/source/blender/blenkernel/BKE_ipo.h index ab5d2f66441..40b9f738bfd 100644 --- a/source/blender/blenkernel/BKE_ipo.h +++ b/source/blender/blenkernel/BKE_ipo.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_IPO_H__ -#define __BKE_IPO_H__ +#pragma once /** \file * \ingroup bke @@ -37,5 +36,3 @@ void do_versions_ipos_to_animato(struct Main *main); #ifdef __cplusplus }; #endif - -#endif diff --git a/source/blender/blenkernel/BKE_kelvinlet.h b/source/blender/blenkernel/BKE_kelvinlet.h index b8290730751..b3966d3ca4a 100644 --- a/source/blender/blenkernel/BKE_kelvinlet.h +++ b/source/blender/blenkernel/BKE_kelvinlet.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) Blender Foundation. * All rights reserved. */ -#ifndef __BKE_KELVINLET_H__ -#define __BKE_KELVINLET_H__ +#pragma once /** \file * \ingroup bke @@ -81,5 +80,3 @@ void BKE_kelvinlet_twist(float r_elem_disp[3], #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h index 6581891062c..e67df194431 100644 --- a/source/blender/blenkernel/BKE_key.h +++ b/source/blender/blenkernel/BKE_key.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_KEY_H__ -#define __BKE_KEY_H__ +#pragma once /** \file * \ingroup bke @@ -51,6 +50,12 @@ void key_curve_normal_weights(float t, float data[4], int type); float *BKE_key_evaluate_object_ex(struct Object *ob, int *r_totelem, float *arr, size_t arr_size); float *BKE_key_evaluate_object(struct Object *ob, int *r_totelem); +int BKE_keyblock_element_count_from_shape(const struct Key *key, const int shape_index); +int BKE_keyblock_element_count(const struct Key *key); + +size_t BKE_keyblock_element_calc_size_from_shape(const struct Key *key, const int shape_index); +size_t BKE_keyblock_element_calc_size(const struct Key *key); + bool BKE_key_idtype_support(const short id_type); struct Key **BKE_key_from_id_p(struct ID *id); @@ -74,6 +79,10 @@ void BKE_keyblock_convert_from_lattice(struct Lattice *lt, struct KeyBlock *kb); void BKE_keyblock_convert_to_lattice(struct KeyBlock *kb, struct Lattice *lt); int BKE_keyblock_curve_element_count(struct ListBase *nurb); +void BKE_keyblock_curve_data_transform(const struct ListBase *nurb, + const float mat[4][4], + const void *src, + void *dst); void BKE_keyblock_update_from_curve(struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb); void BKE_keyblock_convert_from_curve(struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb); void BKE_keyblock_convert_to_curve(struct KeyBlock *kb, struct Curve *cu, struct ListBase *nurb); @@ -104,8 +113,28 @@ bool BKE_keyblock_move(struct Object *ob, int org_index, int new_index); bool BKE_keyblock_is_basis(struct Key *key, const int index); +/* -------------------------------------------------------------------- */ +/** \name Key-Block Data Access + * \{ */ + +void BKE_keyblock_data_get_from_shape(const struct Key *key, + float (*arr)[3], + const int shape_index); +void BKE_keyblock_data_get(const struct Key *key, float (*arr)[3]); + +void BKE_keyblock_data_set_with_mat4(struct Key *key, + const int shape_index, + const float (*vertices)[3], + const float mat[4][4]); +void BKE_keyblock_curve_data_set_with_mat4(struct Key *key, + const struct ListBase *nurb, + const int shape_index, + const void *data, + const float mat[4][4]); +void BKE_keyblock_data_set(struct Key *key, const int shape_index, const void *data); + +/** \} */ + #ifdef __cplusplus }; #endif - -#endif /* __BKE_KEY_H__ */ diff --git a/source/blender/blenkernel/BKE_keyconfig.h b/source/blender/blenkernel/BKE_keyconfig.h index bc33cc2669e..ab42d5742ea 100644 --- a/source/blender/blenkernel/BKE_keyconfig.h +++ b/source/blender/blenkernel/BKE_keyconfig.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_KEYCONFIG_H__ -#define __BKE_KEYCONFIG_H__ +#pragma once /** \file * \ingroup bke @@ -76,5 +75,3 @@ void BKE_keyconfig_pref_filter_items(struct UserDef *userdef, #ifdef __cplusplus } #endif - -#endif /* __BKE_KEYCONFIG_H__ */ diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h index bb23ad63020..03c57d4caac 100644 --- a/source/blender/blenkernel/BKE_lattice.h +++ b/source/blender/blenkernel/BKE_lattice.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_LATTICE_H__ -#define __BKE_LATTICE_H__ +#pragma once /** \file * \ingroup bke @@ -67,8 +66,8 @@ void BKE_lattice_minmax_dl(struct Object *ob, struct Lattice *lt, float min[3], void BKE_lattice_minmax(struct Lattice *lt, float min[3], float max[3]); void BKE_lattice_center_median(struct Lattice *lt, float cent[3]); void BKE_lattice_center_bounds(struct Lattice *lt, float cent[3]); -void BKE_lattice_translate(struct Lattice *lt, float offset[3], bool do_keys); -void BKE_lattice_transform(struct Lattice *lt, float mat[4][4], bool do_keys); +void BKE_lattice_translate(struct Lattice *lt, const float offset[3], bool do_keys); +void BKE_lattice_transform(struct Lattice *lt, const float mat[4][4], bool do_keys); bool BKE_lattice_is_any_selected(const struct Lattice *lt); @@ -140,5 +139,3 @@ void BKE_lattice_deform_coords_with_editmesh(const struct Object *ob_lattice, #ifdef __cplusplus } #endif - -#endif /* __BKE_LATTICE_H__ */ diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h index 7a0252e6813..7fe932edf31 100644 --- a/source/blender/blenkernel/BKE_layer.h +++ b/source/blender/blenkernel/BKE_layer.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_LAYER_H__ -#define __BKE_LAYER_H__ +#pragma once /** \file * \ingroup bke @@ -416,5 +415,3 @@ bool BKE_view_layer_filter_edit_mesh_has_edges(struct Object *ob, void *user_dat #ifdef __cplusplus } #endif - -#endif /* __BKE_LAYER_H__ */ diff --git a/source/blender/blenkernel/BKE_lib_id.h b/source/blender/blenkernel/BKE_lib_id.h index 76bae6fa909..a2cbe537349 100644 --- a/source/blender/blenkernel/BKE_lib_id.h +++ b/source/blender/blenkernel/BKE_lib_id.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_LIB_ID_H__ -#define __BKE_LIB_ID_H__ +#pragma once /** \file * \ingroup bke @@ -267,7 +266,8 @@ void BKE_id_full_name_get(char name[MAX_ID_FULL_NAME], const struct ID *id, char void BKE_id_full_name_ui_prefix_get(char name[MAX_ID_FULL_NAME_UI], const struct ID *id, const bool add_lib_hint, - char separator_char); + char separator_char, + int *r_prefix_len); char *BKE_id_to_unique_string_key(const struct ID *id); @@ -290,5 +290,3 @@ void BKE_id_reorder(const struct ListBase *lb, struct ID *id, struct ID *relativ #ifdef __cplusplus } #endif - -#endif /* __BKE_LIB_ID_H__ */ diff --git a/source/blender/blenkernel/BKE_lib_override.h b/source/blender/blenkernel/BKE_lib_override.h index ba8f2eb3399..5af73a1579d 100644 --- a/source/blender/blenkernel/BKE_lib_override.h +++ b/source/blender/blenkernel/BKE_lib_override.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_LIB_OVERRIDE_H__ -#define __BKE_LIB_OVERRIDE_H__ +#pragma once /** \file * \ingroup bke @@ -119,6 +118,9 @@ bool BKE_lib_override_library_status_check_reference(struct Main *bmain, struct bool BKE_lib_override_library_operations_create(struct Main *bmain, struct ID *local); void BKE_lib_override_library_main_operations_create(struct Main *bmain, const bool force_auto); +void BKE_lib_override_library_id_reset(struct Main *bmain, struct ID *id_root); +void BKE_lib_override_library_id_hierarchy_reset(struct Main *bmain, struct ID *id_root); + void BKE_lib_override_library_operations_tag(struct IDOverrideLibraryProperty *override_property, const short tag, const bool do_set); @@ -148,5 +150,3 @@ void BKE_lib_override_library_operations_store_finalize(OverrideLibraryStorage * #ifdef __cplusplus } #endif - -#endif /* __BKE_LIB_OVERRIDE_H__ */ diff --git a/source/blender/blenkernel/BKE_lib_query.h b/source/blender/blenkernel/BKE_lib_query.h index c5a25e8e7af..b6abe0bf18c 100644 --- a/source/blender/blenkernel/BKE_lib_query.h +++ b/source/blender/blenkernel/BKE_lib_query.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2014 by Blender Foundation. * All rights reserved. */ -#ifndef __BKE_LIB_QUERY_H__ -#define __BKE_LIB_QUERY_H__ +#pragma once /** \file * \ingroup bke @@ -182,5 +181,3 @@ void BKE_library_indirectly_used_data_tag_clear(struct Main *bmain); #ifdef __cplusplus } #endif - -#endif /* __BKE_LIB_QUERY_H__ */ diff --git a/source/blender/blenkernel/BKE_lib_remap.h b/source/blender/blenkernel/BKE_lib_remap.h index 8129b9dbafb..fb14e340d8b 100644 --- a/source/blender/blenkernel/BKE_lib_remap.h +++ b/source/blender/blenkernel/BKE_lib_remap.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_LIB_REMAP_H__ -#define __BKE_LIB_REMAP_H__ +#pragma once /** \file * \ingroup bke @@ -113,5 +112,3 @@ void BKE_library_callback_remap_editor_id_reference_set( #ifdef __cplusplus } #endif - -#endif /* __BKE_LIB_REMAP_H__ */ diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index 7883d740b0a..3981a4c14ea 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_LIBRARY_H__ -#define __BKE_LIBRARY_H__ +#pragma once /** \file * \ingroup bke @@ -39,5 +38,3 @@ void BKE_library_filepath_set(struct Main *bmain, struct Library *lib, const cha #ifdef __cplusplus } #endif - -#endif /* __BKE_LIBRARY_H__ */ diff --git a/source/blender/blenkernel/BKE_light.h b/source/blender/blenkernel/BKE_light.h index ead27ec8002..026e5d1a13b 100644 --- a/source/blender/blenkernel/BKE_light.h +++ b/source/blender/blenkernel/BKE_light.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_LIGHT_H__ -#define __BKE_LIGHT_H__ +#pragma once /** \file * \ingroup bke @@ -44,5 +43,3 @@ void BKE_light_eval(struct Depsgraph *depsgraph, struct Light *la); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_lightprobe.h b/source/blender/blenkernel/BKE_lightprobe.h index 6304f61a1f4..e66d4ef75ca 100644 --- a/source/blender/blenkernel/BKE_lightprobe.h +++ b/source/blender/blenkernel/BKE_lightprobe.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_LIGHTPROBE_H__ -#define __BKE_LIGHTPROBE_H__ +#pragma once /** \file * \ingroup bke @@ -39,5 +38,3 @@ struct LightProbe *BKE_lightprobe_copy(struct Main *bmain, const struct LightPro #ifdef __cplusplus } #endif - -#endif /* __BKE_LIGHTPROBE_H__ */ diff --git a/source/blender/blenkernel/BKE_linestyle.h b/source/blender/blenkernel/BKE_linestyle.h index b086f244923..19238c4d090 100644 --- a/source/blender/blenkernel/BKE_linestyle.h +++ b/source/blender/blenkernel/BKE_linestyle.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_LINESTYLE_H__ -#define __BKE_LINESTYLE_H__ +#pragma once /** \file * \ingroup bke @@ -106,5 +105,3 @@ void BKE_linestyle_default_shader(const struct bContext *C, FreestyleLineStyle * #ifdef __cplusplus } #endif - -#endif /* __BKE_LINESTYLE_H__ */ diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index b7c70168a49..2187ab6b9f5 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_MAIN_H__ -#define __BKE_MAIN_H__ +#pragma once /** \file * \ingroup bke @@ -250,5 +249,3 @@ int set_listbasepointers(struct Main *main, struct ListBase *lb[MAX_LIBARRAY]); #ifdef __cplusplus } #endif - -#endif /* __BKE_MAIN_H__ */ diff --git a/source/blender/blenkernel/BKE_main_idmap.h b/source/blender/blenkernel/BKE_main_idmap.h index e392b7db60e..b89714cefa4 100644 --- a/source/blender/blenkernel/BKE_main_idmap.h +++ b/source/blender/blenkernel/BKE_main_idmap.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_MAIN_IDMAP_H__ -#define __BKE_MAIN_IDMAP_H__ +#pragma once /** \file * \ingroup bke @@ -69,5 +68,3 @@ struct ID *BKE_main_idmap_lookup_uuid(struct IDNameLib_Map *id_typemap, #ifdef __cplusplus } #endif - -#endif /* __BKE_MAIN_IDMAP_H__ */ diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h index dca677343ce..ab731c5e42f 100644 --- a/source/blender/blenkernel/BKE_mask.h +++ b/source/blender/blenkernel/BKE_mask.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_MASK_H__ -#define __BKE_MASK_H__ +#pragma once /** \file * \ingroup bke @@ -331,5 +330,3 @@ void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle, #ifdef __cplusplus } #endif - -#endif /* __BKE_MASK_H__ */ diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h index 225d966a51a..a30d7d55985 100644 --- a/source/blender/blenkernel/BKE_material.h +++ b/source/blender/blenkernel/BKE_material.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_MATERIAL_H__ -#define __BKE_MATERIAL_H__ +#pragma once /** \file * \ingroup bke @@ -84,7 +83,8 @@ void BKE_object_material_assign( void BKE_object_material_array_assign(struct Main *bmain, struct Object *ob, struct Material ***matar, - short totcol); + int totcol, + const bool to_object_only); short BKE_object_material_slot_find_index(struct Object *ob, struct Material *ma); bool BKE_object_material_slot_add(struct Main *bmain, struct Object *ob); @@ -135,5 +135,3 @@ void BKE_material_eval(struct Depsgraph *depsgraph, struct Material *material); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h index 5f51f528d14..f2ad23a35f1 100644 --- a/source/blender/blenkernel/BKE_mball.h +++ b/source/blender/blenkernel/BKE_mball.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_MBALL_H__ -#define __BKE_MBALL_H__ +#pragma once /** \file * \ingroup bke @@ -92,5 +91,3 @@ extern void (*BKE_mball_batch_cache_free_cb)(struct MetaBall *mb); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_mball_tessellate.h b/source/blender/blenkernel/BKE_mball_tessellate.h index 4e0649cf930..0ffbcf5bb05 100644 --- a/source/blender/blenkernel/BKE_mball_tessellate.h +++ b/source/blender/blenkernel/BKE_mball_tessellate.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_MBALL_TESSELLATE_H__ -#define __BKE_MBALL_TESSELLATE_H__ +#pragma once /** \file * \ingroup bke @@ -38,5 +37,3 @@ void BKE_mball_cubeTable_free(void); #ifdef __cplusplus } #endif - -#endif /* __BKE_MBALL_TESSELLATE_H__ */ diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index b2510be656e..045563f8e52 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_MESH_H__ -#define __BKE_MESH_H__ +#pragma once /** \file * \ingroup bke @@ -231,7 +230,7 @@ void BKE_mesh_nomain_to_meshkey(struct Mesh *mesh_src, struct Mesh *mesh_dst, st /* vertex level transformations & checks (no derived mesh) */ bool BKE_mesh_minmax(const struct Mesh *me, float r_min[3], float r_max[3]); -void BKE_mesh_transform(struct Mesh *me, float mat[4][4], bool do_keys); +void BKE_mesh_transform(struct Mesh *me, const float mat[4][4], bool do_keys); void BKE_mesh_translate(struct Mesh *me, const float offset[3], const bool do_keys); void BKE_mesh_ensure_navmesh(struct Mesh *me); @@ -707,5 +706,3 @@ BLI_INLINE int BKE_mesh_origindex_mface_mpoly(const int *index_mf_to_mpoly, #ifdef __cplusplus } #endif - -#endif /* __BKE_MESH_H__ */ diff --git a/source/blender/blenkernel/BKE_mesh_iterators.h b/source/blender/blenkernel/BKE_mesh_iterators.h index f7eaa7f69b8..103e7b5b78f 100644 --- a/source/blender/blenkernel/BKE_mesh_iterators.h +++ b/source/blender/blenkernel/BKE_mesh_iterators.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_MESH_ITERATORS_H__ -#define __BKE_MESH_ITERATORS_H__ +#pragma once /** \file * \ingroup bke @@ -70,5 +69,3 @@ void BKE_mesh_foreach_mapped_vert_coords_get(struct Mesh *me_eval, #ifdef __cplusplus } #endif - -#endif /* __BKE_MESH_ITERATORS_H__ */ diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h b/source/blender/blenkernel/BKE_mesh_mapping.h index 5ad5238bbb5..140a60dbdb7 100644 --- a/source/blender/blenkernel/BKE_mesh_mapping.h +++ b/source/blender/blenkernel/BKE_mesh_mapping.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_MESH_MAPPING_H__ -#define __BKE_MESH_MAPPING_H__ +#pragma once /** \file * \ingroup bke @@ -258,5 +257,3 @@ int *BKE_mesh_calc_smoothgroups(const struct MEdge *medge, #ifdef __cplusplus } #endif - -#endif /* __BKE_MESH_MAPPING_H__ */ diff --git a/source/blender/blenkernel/BKE_mesh_mirror.h b/source/blender/blenkernel/BKE_mesh_mirror.h index 0a68d028e35..2c6920a18bf 100644 --- a/source/blender/blenkernel/BKE_mesh_mirror.h +++ b/source/blender/blenkernel/BKE_mesh_mirror.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_MESH_MIRROR_H__ -#define __BKE_MESH_MIRROR_H__ +#pragma once /** \file * \ingroup bke @@ -49,5 +48,3 @@ struct Mesh *BKE_mesh_mirror_apply_mirror_on_axis(struct MirrorModifierData *mmd #ifdef __cplusplus } #endif - -#endif /* __BKE_MESH_MIRROR_H__ */ diff --git a/source/blender/blenkernel/BKE_mesh_remap.h b/source/blender/blenkernel/BKE_mesh_remap.h index fff89e50744..d9b6ab3813e 100644 --- a/source/blender/blenkernel/BKE_mesh_remap.h +++ b/source/blender/blenkernel/BKE_mesh_remap.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_MESH_REMAP_H__ -#define __BKE_MESH_REMAP_H__ +#pragma once /** \file * \ingroup bke @@ -234,5 +233,3 @@ void BKE_mesh_remap_calc_polys_from_mesh(const int mode, #ifdef __cplusplus } #endif - -#endif /* __BKE_MESH_REMAP_H__ */ diff --git a/source/blender/blenkernel/BKE_mesh_remesh_voxel.h b/source/blender/blenkernel/BKE_mesh_remesh_voxel.h index 24f95f7ed20..2265fa6e105 100644 --- a/source/blender/blenkernel/BKE_mesh_remesh_voxel.h +++ b/source/blender/blenkernel/BKE_mesh_remesh_voxel.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_MESH_REMESH_VOXEL_H__ -#define __BKE_MESH_REMESH_VOXEL_H__ +#pragma once /** \file * \ingroup bke @@ -66,5 +65,3 @@ void BKE_remesh_reproject_sculpt_face_sets(struct Mesh *target, struct Mesh *sou #ifdef __cplusplus } #endif - -#endif /* __BKE_MESH_REMESH_VOXEL_H__ */ diff --git a/source/blender/blenkernel/BKE_mesh_runtime.h b/source/blender/blenkernel/BKE_mesh_runtime.h index 468ec6a44cd..adb7c357049 100644 --- a/source/blender/blenkernel/BKE_mesh_runtime.h +++ b/source/blender/blenkernel/BKE_mesh_runtime.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_MESH_RUNTIME_H__ -#define __BKE_MESH_RUNTIME_H__ +#pragma once /** \file * \ingroup bke @@ -111,5 +110,3 @@ bool BKE_mesh_runtime_is_valid(struct Mesh *me_eval); #ifdef __cplusplus } #endif - -#endif /* __BKE_MESH_RUNTIME_H__ */ diff --git a/source/blender/blenkernel/BKE_mesh_tangent.h b/source/blender/blenkernel/BKE_mesh_tangent.h index 7b686f112aa..96eaa23ce71 100644 --- a/source/blender/blenkernel/BKE_mesh_tangent.h +++ b/source/blender/blenkernel/BKE_mesh_tangent.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_MESH_TANGENT_H__ -#define __BKE_MESH_TANGENT_H__ +#pragma once /** \file * \ingroup bke @@ -87,5 +86,3 @@ void BKE_mesh_calc_loop_tangent_step_0(const struct CustomData *loopData, #ifdef __cplusplus } #endif - -#endif /* __BKE_MESH_TANGENT_H__ */ diff --git a/source/blender/blenkernel/BKE_mesh_wrapper.h b/source/blender/blenkernel/BKE_mesh_wrapper.h index 00e2dd08726..2fe264fd0f7 100644 --- a/source/blender/blenkernel/BKE_mesh_wrapper.h +++ b/source/blender/blenkernel/BKE_mesh_wrapper.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_MESH_WRAPPER_H__ -#define __BKE_MESH_WRAPPER_H__ +#pragma once /** \file * \ingroup bke @@ -55,5 +54,3 @@ void BKE_mesh_wrapper_vert_coords_copy_with_mat4(const struct Mesh *me, #ifdef __cplusplus } #endif - -#endif /* __BKE_MESH_WRAPPER_H__ */ diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index e16a9284425..f9590696c2e 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_MODIFIER_H__ -#define __BKE_MODIFIER_H__ +#pragma once /** \file * \ingroup bke @@ -543,5 +542,3 @@ struct Mesh *BKE_modifier_get_evaluated_mesh_from_evaluated_object(struct Object #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h index dbd6eb15bf2..d1f6efc035b 100644 --- a/source/blender/blenkernel/BKE_movieclip.h +++ b/source/blender/blenkernel/BKE_movieclip.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_MOVIECLIP_H__ -#define __BKE_MOVIECLIP_H__ +#pragma once /** \file * \ingroup bke @@ -132,5 +131,3 @@ void BKE_movieclip_eval_selection_update(struct Depsgraph *depsgraph, struct Mov #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h index 15ba72ef5b5..db2dc7ec87f 100644 --- a/source/blender/blenkernel/BKE_multires.h +++ b/source/blender/blenkernel/BKE_multires.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_MULTIRES_H__ -#define __BKE_MULTIRES_H__ +#pragma once /** \file * \ingroup bke @@ -235,5 +234,3 @@ BLI_INLINE void BKE_multires_construct_tangent_matrix(float tangent_matrix[3][3] #endif #include "intern/multires_inline.h" - -#endif /* __BKE_MULTIRES_H__ */ diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h index 2be8d657bf4..8b3231e5302 100644 --- a/source/blender/blenkernel/BKE_nla.h +++ b/source/blender/blenkernel/BKE_nla.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_NLA_H__ -#define __BKE_NLA_H__ +#pragma once /** \file * \ingroup bke @@ -149,5 +148,3 @@ float BKE_nla_tweakedit_remap(struct AnimData *adt, float cframe, short mode); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 4c55488ecd5..b9e2531755b 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_NODE_H__ -#define __BKE_NODE_H__ +#pragma once /** \file * \ingroup bke @@ -1365,5 +1364,3 @@ extern struct bNodeSocketType NodeSocketTypeUndefined; #ifdef __cplusplus } #endif - -#endif /* __BKE_NODE_H__ */ diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index f2a022c84a3..215f4043e34 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_OBJECT_H__ -#define __BKE_OBJECT_H__ +#pragma once /** \file * \ingroup bke @@ -144,21 +143,21 @@ struct Object *BKE_object_duplicate(struct Main *bmain, void BKE_object_obdata_size_init(struct Object *ob, const float scale); -void BKE_object_scale_to_mat3(struct Object *ob, float mat[3][3]); -void BKE_object_rot_to_mat3(const struct Object *ob, float mat[3][3], bool use_drot); -void BKE_object_mat3_to_rot(struct Object *ob, float mat[3][3], bool use_compat); -void BKE_object_to_mat3(struct Object *ob, float mat[3][3]); -void BKE_object_to_mat4(struct Object *ob, float mat[4][4]); +void BKE_object_scale_to_mat3(struct Object *ob, float r_mat[3][3]); +void BKE_object_rot_to_mat3(const struct Object *ob, float r_mat[3][3], bool use_drot); +void BKE_object_mat3_to_rot(struct Object *ob, float r_mat[3][3], bool use_compat); +void BKE_object_to_mat3(struct Object *ob, float r_mat[3][3]); +void BKE_object_to_mat4(struct Object *ob, float r_mat[4][4]); void BKE_object_apply_mat4(struct Object *ob, - float mat[4][4], + const float mat[4][4], const bool use_compat, const bool use_parent); void BKE_object_apply_mat4_ex(struct Object *ob, - float mat[4][4], + const float mat[4][4], struct Object *parent, - float parentinv[4][4], + const float parentinv[4][4], const bool use_compat); -void BKE_object_matrix_local_get(struct Object *ob, float mat[4][4]); +void BKE_object_matrix_local_get(struct Object *ob, float r_mat[4][4]); bool BKE_object_pose_context_check(const struct Object *ob); struct Object *BKE_object_pose_armature_get(struct Object *ob); @@ -188,7 +187,7 @@ struct Base **BKE_object_pose_base_array_get(struct ViewLayer *view_layer, struct View3D *v3d, unsigned int *r_bases_len); -void BKE_object_get_parent_matrix(struct Object *ob, struct Object *par, float parentmat[4][4]); +void BKE_object_get_parent_matrix(struct Object *ob, struct Object *par, float r_parentmat[4][4]); void BKE_object_where_is_calc(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); void BKE_object_where_is_calc_ex(struct Depsgraph *depsgraph, struct Scene *scene, @@ -199,7 +198,7 @@ void BKE_object_where_is_calc_time(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float ctime); -void BKE_object_where_is_calc_mat4(struct Object *ob, float obmat[4][4]); +void BKE_object_where_is_calc_mat4(struct Object *ob, float r_obmat[4][4]); /* possibly belong in own moduke? */ struct BoundBox *BKE_boundbox_alloc_unit(void); @@ -207,12 +206,12 @@ void BKE_boundbox_init_from_minmax(struct BoundBox *bb, const float min[3], cons void BKE_boundbox_calc_center_aabb(const struct BoundBox *bb, float r_cent[3]); void BKE_boundbox_calc_size_aabb(const struct BoundBox *bb, float r_size[3]); void BKE_boundbox_minmax(const struct BoundBox *bb, - float obmat[4][4], + const float obmat[4][4], float r_min[3], float r_max[3]); struct BoundBox *BKE_object_boundbox_get(struct Object *ob); -void BKE_object_dimensions_get(struct Object *ob, float vec[3]); +void BKE_object_dimensions_get(struct Object *ob, float r_vec[3]); void BKE_object_dimensions_set_ex(struct Object *ob, const float value[3], int axis_mask, @@ -233,7 +232,7 @@ bool BKE_object_minmax_dupli(struct Depsgraph *depsgraph, /* sometimes min-max isn't enough, we need to loop over each point */ void BKE_object_foreach_display_point(struct Object *ob, - float obmat[4][4], + const float obmat[4][4], void (*func_cb)(const float[3], void *), void *user_data); void BKE_scene_foreach_display_point(struct Depsgraph *depsgraph, @@ -413,5 +412,3 @@ void BKE_object_to_mesh_clear(struct Object *object); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_object_deform.h b/source/blender/blenkernel/BKE_object_deform.h index e4813aa2288..a10158254c2 100644 --- a/source/blender/blenkernel/BKE_object_deform.h +++ b/source/blender/blenkernel/BKE_object_deform.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_OBJECT_DEFORM_H__ -#define __BKE_OBJECT_DEFORM_H__ +#pragma once /** \file * \ingroup bke @@ -95,5 +94,3 @@ void BKE_object_defgroup_mirror_selection(struct Object *ob, #ifdef __cplusplus } #endif - -#endif /* __BKE_OBJECT_DEFORM_H__ */ diff --git a/source/blender/blenkernel/BKE_object_facemap.h b/source/blender/blenkernel/BKE_object_facemap.h index 83780d8fad5..10cb4a54bde 100644 --- a/source/blender/blenkernel/BKE_object_facemap.h +++ b/source/blender/blenkernel/BKE_object_facemap.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_OBJECT_FACEMAP_H__ -#define __BKE_OBJECT_FACEMAP_H__ +#pragma once /** \file * \ingroup bke @@ -48,5 +47,3 @@ void BKE_object_facemap_index_map_apply(int *fmap, int fmap_len, const int *map, #ifdef __cplusplus } #endif - -#endif /* __BKE_OBJECT_FACEMAP_H__ */ diff --git a/source/blender/blenkernel/BKE_ocean.h b/source/blender/blenkernel/BKE_ocean.h index 6ce2e13cf18..6d488cc3142 100644 --- a/source/blender/blenkernel/BKE_ocean.h +++ b/source/blender/blenkernel/BKE_ocean.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_OCEAN_H__ -#define __BKE_OCEAN_H__ +#pragma once #include <stdbool.h> @@ -135,5 +134,3 @@ float BLI_ocean_spectrum_jonswap(const struct Ocean *oc, const float kx, const f #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_outliner_treehash.h b/source/blender/blenkernel/BKE_outliner_treehash.h index 9f4ebffdcf4..94bf0f622d6 100644 --- a/source/blender/blenkernel/BKE_outliner_treehash.h +++ b/source/blender/blenkernel/BKE_outliner_treehash.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_OUTLINER_TREEHASH_H__ -#define __BKE_OUTLINER_TREEHASH_H__ +#pragma once /** \file * \ingroup bke @@ -59,5 +58,3 @@ void BKE_outliner_treehash_free(void *treehash); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h index fb2578b81b0..1e8721045cd 100644 --- a/source/blender/blenkernel/BKE_packedFile.h +++ b/source/blender/blenkernel/BKE_packedFile.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_PACKEDFILE_H__ -#define __BKE_PACKEDFILE_H__ +#pragma once /** \file * \ingroup bke @@ -125,5 +124,3 @@ void BKE_packedfile_id_unpack(struct Main *bmain, #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index e3a6fb4ba2e..e2381bf68ac 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_PAINT_H__ -#define __BKE_PAINT_H__ +#pragma once /** \file * \ingroup bke @@ -451,6 +450,10 @@ void BKE_sculptsession_free_vwpaint_data(struct SculptSession *ss); void BKE_sculptsession_bm_to_me(struct Object *ob, bool reorder); void BKE_sculptsession_bm_to_me_for_render(struct Object *object); +/* Create new color layer on object if it doesn't have one and if experimental feature set has + * sculpt vertex color enabled. Returns truth if new layer has been added, false otherwise. */ +void BKE_sculpt_color_layer_create_if_needed(struct Object *object); + void BKE_sculpt_update_object_for_edit(struct Depsgraph *depsgraph, struct Object *ob_orig, bool need_pmap, @@ -467,6 +470,10 @@ struct PBVH *BKE_sculpt_object_pbvh_ensure(struct Depsgraph *depsgraph, struct O void BKE_sculpt_bvh_update_from_ccg(struct PBVH *pbvh, struct SubdivCCG *subdiv_ccg); +/* This ensure that all elements in the mesh (both vertices and grids) have their visibility + * updated according to the face sets. */ +void BKE_sculpt_sync_face_set_visibility(struct Mesh *mesh, struct SubdivCCG *subdiv_ccg); + bool BKE_sculptsession_use_pbvh_draw(const struct Object *ob, const struct View3D *v3d); enum { @@ -477,5 +484,3 @@ enum { #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index 7de588450d6..1e7a4ae75fb 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -20,8 +20,7 @@ * Copyright 2011-2012 AutoCRC */ -#ifndef __BKE_PARTICLE_H__ -#define __BKE_PARTICLE_H__ +#pragma once /** \file * \ingroup bke @@ -217,7 +216,7 @@ typedef struct ParticleCollision { /** Collision modifier for current object. */ struct CollisionModifierData *md; - /** Time factor of previous collision, needed for substracting face velocity. */ + /** Time factor of previous collision, needed for subtracting face velocity. */ float f; float fac1, fac2; @@ -631,5 +630,3 @@ extern void (*BKE_particle_batch_cache_free_cb)(struct ParticleSystem *psys); #ifdef __cplusplus } #endif - -#endif /* __BKE_PARTICLE_H__ */ diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index da9280148fd..9826dfaa4a5 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_PBVH_H__ -#define __BKE_PBVH_H__ +#pragma once /** \file * \ingroup bke @@ -489,5 +488,3 @@ void BKE_pbvh_node_color_buffer_free(PBVH *pbvh); #ifdef __cplusplus } #endif - -#endif /* __BKE_PBVH_H__ */ diff --git a/source/blender/blenkernel/BKE_persistent_data_handle.hh b/source/blender/blenkernel/BKE_persistent_data_handle.hh index 721132560e3..c8e02062f0b 100644 --- a/source/blender/blenkernel/BKE_persistent_data_handle.hh +++ b/source/blender/blenkernel/BKE_persistent_data_handle.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_PERSISTENT_DATA_HANDLE_H__ -#define __BKE_PERSISTENT_DATA_HANDLE_H__ +#pragma once /** \file * \ingroup bke @@ -128,5 +127,3 @@ class PersistentDataHandleMap { }; } // namespace blender::bke - -#endif /* __BKE_PERSISTENT_DATA_HANDLE_H__ */ diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index dc99ec7f56f..c5bf94cc0c8 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_POINTCACHE_H__ -#define __BKE_POINTCACHE_H__ +#pragma once /** \file * \ingroup bke @@ -387,5 +386,3 @@ void BKE_ptcache_invalidate(struct PointCache *cache); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_pointcloud.h b/source/blender/blenkernel/BKE_pointcloud.h index d641d3feb62..b2e7e1d23ee 100644 --- a/source/blender/blenkernel/BKE_pointcloud.h +++ b/source/blender/blenkernel/BKE_pointcloud.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_POINTCLOUD_H__ -#define __BKE_POINTCLOUD_H__ +#pragma once /** \file * \ingroup bke @@ -64,5 +63,3 @@ extern void (*BKE_pointcloud_batch_cache_free_cb)(struct PointCloud *pointcloud) #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_report.h b/source/blender/blenkernel/BKE_report.h index 063c0831a0d..5b22918e84c 100644 --- a/source/blender/blenkernel/BKE_report.h +++ b/source/blender/blenkernel/BKE_report.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_REPORT_H__ -#define __BKE_REPORT_H__ +#pragma once /** \file * \ingroup bke @@ -69,5 +68,3 @@ bool BKE_report_write_file(const char *filepath, ReportList *reports, const char #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_rigidbody.h b/source/blender/blenkernel/BKE_rigidbody.h index b4aa0ac2b93..c2059144388 100644 --- a/source/blender/blenkernel/BKE_rigidbody.h +++ b/source/blender/blenkernel/BKE_rigidbody.h @@ -22,8 +22,7 @@ * \brief API for Blender-side Rigid Body stuff */ -#ifndef __BKE_RIGIDBODY_H__ -#define __BKE_RIGIDBODY_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -162,5 +161,3 @@ void BKE_rigidbody_object_sync_transforms(struct Depsgraph *depsgraph, #ifdef __cplusplus } #endif - -#endif /* __BKE_RIGIDBODY_H__ */ diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 800370318c4..8cd86593873 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_SCENE_H__ -#define __BKE_SCENE_H__ +#pragma once /** \file * \ingroup bke @@ -260,5 +259,3 @@ void BKE_scene_eval_sequencer_sequences(struct Depsgraph *depsgraph, struct Scen #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index 13716ddb5c6..735d6dc6e89 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_SCREEN_H__ -#define __BKE_SCREEN_H__ +#pragma once /** \file * \ingroup bke @@ -436,5 +435,3 @@ void BKE_screen_header_alignment_reset(struct bScreen *screen); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 107a27b00ab..03f14be8772 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_SEQUENCER_H__ -#define __BKE_SEQUENCER_H__ +#pragma once /** \file * \ingroup bke @@ -527,6 +526,9 @@ typedef struct Sequence *(*SeqLoadFn)(struct bContext *, ListBase *, struct SeqL struct Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine, int type); +/* Generate new UUID for the given sequence. */ +void BKE_sequence_session_uuid_generate(struct Sequence *sequence); + void BKE_sequence_alpha_mode_from_extension(struct Sequence *seq); void BKE_sequence_init_colorspace(struct Sequence *seq); @@ -624,9 +626,12 @@ void BKE_sequencer_color_balance_apply(struct StripColorBalance *cb, void BKE_sequencer_all_free_anim_ibufs(struct Scene *scene, int cfra); bool BKE_sequencer_check_scene_recursion(struct Scene *scene, struct ReportList *reports); +bool BKE_sequencer_render_loop_check(struct Sequence *seq_main, struct Sequence *seq); + +/* A debug and development function which checks whether sequences have unique UUIDs. + * Errors will be reported to the console. */ +void BKE_sequencer_check_uuids_unique_and_report(const struct Scene *scene); #ifdef __cplusplus } #endif - -#endif /* __BKE_SEQUENCER_H__ */ diff --git a/source/blender/blenkernel/BKE_sequencer_offscreen.h b/source/blender/blenkernel/BKE_sequencer_offscreen.h index cc822e97270..90d3f80320a 100644 --- a/source/blender/blenkernel/BKE_sequencer_offscreen.h +++ b/source/blender/blenkernel/BKE_sequencer_offscreen.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_SEQUENCER_OFFSCREEN_H__ -#define __BKE_SEQUENCER_OFFSCREEN_H__ +#pragma once /** \file * \ingroup bke @@ -52,5 +51,3 @@ extern SequencerDrawView sequencer_view3d_fn; #ifdef __cplusplus } #endif - -#endif /* __BKE_SEQUENCER_H__ */ diff --git a/source/blender/blenkernel/BKE_shader_fx.h b/source/blender/blenkernel/BKE_shader_fx.h index 31e14c6c884..1eb52b389d1 100644 --- a/source/blender/blenkernel/BKE_shader_fx.h +++ b/source/blender/blenkernel/BKE_shader_fx.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_SHADER_FX_H__ -#define __BKE_SHADER_FX_H__ +#pragma once /** \file * \ingroup bke @@ -189,5 +188,3 @@ bool BKE_shaderfx_has_gpencil(struct Object *ob); #ifdef __cplusplus } #endif - -#endif /* __BKE_SHADER_FX_H__ */ diff --git a/source/blender/blenkernel/BKE_shrinkwrap.h b/source/blender/blenkernel/BKE_shrinkwrap.h index 83129bed5f7..bcf702ea797 100644 --- a/source/blender/blenkernel/BKE_shrinkwrap.h +++ b/source/blender/blenkernel/BKE_shrinkwrap.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) Blender Foundation. * All rights reserved. */ -#ifndef __BKE_SHRINKWRAP_H__ -#define __BKE_SHRINKWRAP_H__ +#pragma once /** \file * \ingroup bke @@ -192,5 +191,3 @@ void BKE_shrinkwrap_snap_point_to_surface(const struct ShrinkwrapTreeData *tree, #ifdef __cplusplus } #endif - -#endif /* __BKE_SHRINKWRAP_H__ */ diff --git a/source/blender/blenkernel/BKE_simulation.h b/source/blender/blenkernel/BKE_simulation.h index 5aa71b6381d..98d1cf1e9b5 100644 --- a/source/blender/blenkernel/BKE_simulation.h +++ b/source/blender/blenkernel/BKE_simulation.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_SIMULATION_H__ -#define __BKE_SIMULATION_H__ +#pragma once #include "DNA_simulation_types.h" @@ -55,5 +54,3 @@ void BKE_simulation_state_copy_data(const SimulationState *src_state, Simulation template<typename StateType> const char *BKE_simulation_get_state_type_name(); #endif - -#endif /* __BKE_SIMULATION_H__ */ diff --git a/source/blender/blenkernel/BKE_softbody.h b/source/blender/blenkernel/BKE_softbody.h index e4012094b74..28d299679ed 100644 --- a/source/blender/blenkernel/BKE_softbody.h +++ b/source/blender/blenkernel/BKE_softbody.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) Blender Foundation. * All rights reserved. */ -#ifndef __BKE_SOFTBODY_H__ -#define __BKE_SOFTBODY_H__ +#pragma once /** \file * \ingroup bke @@ -76,5 +75,3 @@ extern void SB_estimate_transform(Object *ob, float lloc[3], float lrot[3][3], f #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index b93591b7b60..57ce33a239f 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_SOUND_H__ -#define __BKE_SOUND_H__ +#pragma once /** \file * \ingroup bke @@ -194,5 +193,3 @@ void BKE_sound_evaluate(struct Depsgraph *depsgraph, struct Main *bmain, struct #ifdef __cplusplus } #endif - -#endif /* __BKE_SOUND_H__ */ diff --git a/source/blender/blenkernel/BKE_speaker.h b/source/blender/blenkernel/BKE_speaker.h index 54bb7274e4b..b01824dd794 100644 --- a/source/blender/blenkernel/BKE_speaker.h +++ b/source/blender/blenkernel/BKE_speaker.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_SPEAKER_H__ -#define __BKE_SPEAKER_H__ +#pragma once /** \file * \ingroup bke @@ -35,5 +34,3 @@ struct Speaker *BKE_speaker_copy(struct Main *bmain, const struct Speaker *spk); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_studiolight.h b/source/blender/blenkernel/BKE_studiolight.h index ff11f581cc4..32c571e5f91 100644 --- a/source/blender/blenkernel/BKE_studiolight.h +++ b/source/blender/blenkernel/BKE_studiolight.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_STUDIOLIGHT_H__ -#define __BKE_STUDIOLIGHT_H__ +#pragma once /** \file * \ingroup bke @@ -168,5 +167,3 @@ void BKE_studiolight_unset_icon_id(StudioLight *sl, int icon_id); #ifdef __cplusplus } #endif - -#endif /* __BKE_STUDIOLIGHT_H__ */ diff --git a/source/blender/blenkernel/BKE_subdiv.h b/source/blender/blenkernel/BKE_subdiv.h index 1323938e479..96a79d753cf 100644 --- a/source/blender/blenkernel/BKE_subdiv.h +++ b/source/blender/blenkernel/BKE_subdiv.h @@ -21,8 +21,7 @@ * \ingroup bke */ -#ifndef __BKE_SUBDIV_H__ -#define __BKE_SUBDIV_H__ +#pragma once #include "BLI_compiler_compat.h" #include "BLI_sys_types.h" @@ -302,5 +301,3 @@ BLI_INLINE float BKE_subdiv_edge_crease_to_sharpness_char(char edge_crease); #endif #include "intern/subdiv_inline.h" - -#endif /* __BKE_SUBDIV_H__ */ diff --git a/source/blender/blenkernel/BKE_subdiv_ccg.h b/source/blender/blenkernel/BKE_subdiv_ccg.h index 5808f223f32..2277eb27ef1 100644 --- a/source/blender/blenkernel/BKE_subdiv_ccg.h +++ b/source/blender/blenkernel/BKE_subdiv_ccg.h @@ -21,8 +21,7 @@ * \ingroup bke */ -#ifndef __BKE_SUBDIV_CCG_H__ -#define __BKE_SUBDIV_CCG_H__ +#pragma once #include "BKE_DerivedMesh.h" #include "BKE_customdata.h" @@ -338,8 +337,8 @@ SubdivCCGAdjacencyType BKE_subdiv_ccg_coarse_mesh_adjacency_info_get(const Subdi const int *BKE_subdiv_ccg_start_face_grid_index_ensure(SubdivCCG *subdiv_ccg); const int *BKE_subdiv_ccg_start_face_grid_index_get(const SubdivCCG *subdiv_ccg); +void BKE_subdiv_ccg_grid_hidden_ensure(SubdivCCG *subdiv_ccg, int grid_index); + #ifdef __cplusplus } #endif - -#endif /* __BKE_SUBDIV_CCG_H__ */ diff --git a/source/blender/blenkernel/BKE_subdiv_deform.h b/source/blender/blenkernel/BKE_subdiv_deform.h index 735cd20a6c8..1cdb8d2c794 100644 --- a/source/blender/blenkernel/BKE_subdiv_deform.h +++ b/source/blender/blenkernel/BKE_subdiv_deform.h @@ -21,8 +21,7 @@ * \ingroup bke */ -#ifndef __BKE_SUBDIV_DEFORM_H__ -#define __BKE_SUBDIV_DEFORM_H__ +#pragma once #include "BLI_sys_types.h" @@ -48,5 +47,3 @@ void BKE_subdiv_deform_coarse_vertices(struct Subdiv *subdiv, #ifdef __cplusplus } #endif - -#endif /* __BKE_SUBDIV_DEFORM_H__ */ diff --git a/source/blender/blenkernel/BKE_subdiv_eval.h b/source/blender/blenkernel/BKE_subdiv_eval.h index aa27df88be8..204e802da6e 100644 --- a/source/blender/blenkernel/BKE_subdiv_eval.h +++ b/source/blender/blenkernel/BKE_subdiv_eval.h @@ -21,8 +21,7 @@ * \ingroup bke */ -#ifndef __BKE_SUBDIV_EVAL_H__ -#define __BKE_SUBDIV_EVAL_H__ +#pragma once #include "BLI_sys_types.h" @@ -149,5 +148,3 @@ void BKE_subdiv_eval_limit_patch_resolution_point_and_short_normal(struct Subdiv #ifdef __cplusplus } #endif - -#endif /* __BKE_SUBDIV_EVAL_H__ */ diff --git a/source/blender/blenkernel/BKE_subdiv_foreach.h b/source/blender/blenkernel/BKE_subdiv_foreach.h index bef141b5ac5..a351b9a3d11 100644 --- a/source/blender/blenkernel/BKE_subdiv_foreach.h +++ b/source/blender/blenkernel/BKE_subdiv_foreach.h @@ -21,8 +21,7 @@ * \ingroup bke */ -#ifndef __BKE_SUBDIV_FOREACH_H__ -#define __BKE_SUBDIV_FOREACH_H__ +#pragma once #include "BLI_sys_types.h" @@ -178,5 +177,3 @@ bool BKE_subdiv_foreach_subdiv_geometry(struct Subdiv *subdiv, #ifdef __cplusplus } #endif - -#endif /* __BKE_SUBDIV_FOREACH_H__ */ diff --git a/source/blender/blenkernel/BKE_subdiv_mesh.h b/source/blender/blenkernel/BKE_subdiv_mesh.h index 9928c41a92b..73a3e8ed02e 100644 --- a/source/blender/blenkernel/BKE_subdiv_mesh.h +++ b/source/blender/blenkernel/BKE_subdiv_mesh.h @@ -21,8 +21,7 @@ * \ingroup bke */ -#ifndef __BKE_SUBDIV_MESH_H__ -#define __BKE_SUBDIV_MESH_H__ +#pragma once #include "BLI_sys_types.h" @@ -53,5 +52,3 @@ struct Mesh *BKE_subdiv_to_mesh(struct Subdiv *subdiv, #ifdef __cplusplus } #endif - -#endif /* __BKE_SUBDIV)MESH_H__ */ diff --git a/source/blender/blenkernel/BKE_subdiv_topology.h b/source/blender/blenkernel/BKE_subdiv_topology.h index cc32b4c03b3..42bd9392aa4 100644 --- a/source/blender/blenkernel/BKE_subdiv_topology.h +++ b/source/blender/blenkernel/BKE_subdiv_topology.h @@ -21,8 +21,7 @@ * \ingroup bke */ -#ifndef __BKE_SUBDIV_TOPOLOGY_H__ -#define __BKE_SUBDIV_TOPOLOGY_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -35,5 +34,3 @@ int BKE_subdiv_topology_num_fvar_layers_get(const struct Subdiv *subdiv); #ifdef __cplusplus } #endif - -#endif /* __BKE_SUBDIV_TOPOLOGY_H__ */ diff --git a/source/blender/blenkernel/BKE_subsurf.h b/source/blender/blenkernel/BKE_subsurf.h index 0ed58180ffa..07bbeafb1ae 100644 --- a/source/blender/blenkernel/BKE_subsurf.h +++ b/source/blender/blenkernel/BKE_subsurf.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_SUBSURF_H__ -#define __BKE_SUBSURF_H__ +#pragma once /** \file * \ingroup bke @@ -158,5 +157,3 @@ typedef struct CCGDerivedMesh { #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index 51d589e61c3..289ad351429 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_TEXT_H__ -#define __BKE_TEXT_H__ +#pragma once /** \file * \ingroup bke @@ -118,5 +117,3 @@ void txt_from_buf_for_undo(struct Text *text, const char *buf, int buf_len); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_text_suggestions.h b/source/blender/blenkernel/BKE_text_suggestions.h index d618fcd6d11..f54e45b6c2f 100644 --- a/source/blender/blenkernel/BKE_text_suggestions.h +++ b/source/blender/blenkernel/BKE_text_suggestions.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2008, Blender Foundation * All rights reserved. */ -#ifndef __BKE_TEXT_SUGGESTIONS_H__ -#define __BKE_TEXT_SUGGESTIONS_H__ +#pragma once /** \file * \ingroup bke @@ -85,5 +84,3 @@ void texttool_docs_clear(void); #ifdef __cplusplus } #endif - -#endif /* __BKE_TEXT_SUGGESTIONS_H__ */ diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h index 43ef2b1ba7f..c4c2498c2b1 100644 --- a/source/blender/blenkernel/BKE_texture.h +++ b/source/blender/blenkernel/BKE_texture.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_TEXTURE_H__ -#define __BKE_TEXTURE_H__ +#pragma once /** \file * \ingroup bke @@ -102,5 +101,3 @@ void BKE_texture_fetch_images_for_pool(struct Tex *texture, struct ImagePool *po #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h index bb88fbf863b..2d763132923 100644 --- a/source/blender/blenkernel/BKE_tracking.h +++ b/source/blender/blenkernel/BKE_tracking.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_TRACKING_H__ -#define __BKE_TRACKING_H__ +#pragma once /** \file * \ingroup bke @@ -493,5 +492,3 @@ void BKE_tracking_get_rna_path_prefix_for_plane_track( #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_undo_system.h b/source/blender/blenkernel/BKE_undo_system.h index b32c3e315ff..4f933ca7a87 100644 --- a/source/blender/blenkernel/BKE_undo_system.h +++ b/source/blender/blenkernel/BKE_undo_system.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_UNDO_SYSTEM_H__ -#define __BKE_UNDO_SYSTEM_H__ +#pragma once /** \file * \ingroup bke @@ -212,5 +211,3 @@ void BKE_undosys_print(UndoStack *ustack); #ifdef __cplusplus } #endif - -#endif /* __BKE_UNDO_SYSTEM_H__ */ diff --git a/source/blender/blenkernel/BKE_unit.h b/source/blender/blenkernel/BKE_unit.h index 4f9ff61c9a6..a797c5555ff 100644 --- a/source/blender/blenkernel/BKE_unit.h +++ b/source/blender/blenkernel/BKE_unit.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_UNIT_H__ -#define __BKE_UNIT_H__ +#pragma once /** \file * \ingroup bke @@ -93,5 +92,3 @@ enum { #ifdef __cplusplus } #endif - -#endif /* __BKE_UNIT_H__ */ diff --git a/source/blender/blenkernel/BKE_volume.h b/source/blender/blenkernel/BKE_volume.h index 224f3ede45d..b3437454f31 100644 --- a/source/blender/blenkernel/BKE_volume.h +++ b/source/blender/blenkernel/BKE_volume.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_VOLUME_H__ -#define __BKE_VOLUME_H__ +#pragma once /** \file * \ingroup bke @@ -159,5 +158,3 @@ openvdb::GridBase::Ptr BKE_volume_grid_openvdb_for_write(const struct Volume *vo struct VolumeGrid *grid, const bool clear); #endif - -#endif diff --git a/source/blender/blenkernel/BKE_volume_render.h b/source/blender/blenkernel/BKE_volume_render.h index 5c3cd0102cf..a42f24a5312 100644 --- a/source/blender/blenkernel/BKE_volume_render.h +++ b/source/blender/blenkernel/BKE_volume_render.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_VOLUME_RENDER_H__ -#define __BKE_VOLUME_RENDER_H__ +#pragma once /** \file * \ingroup bke @@ -66,5 +65,3 @@ float BKE_volume_density_scale(const struct Volume *volume, const float matrix[4 #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_workspace.h b/source/blender/blenkernel/BKE_workspace.h index 8a6afd8a753..5ff1ba2c6f5 100644 --- a/source/blender/blenkernel/BKE_workspace.h +++ b/source/blender/blenkernel/BKE_workspace.h @@ -18,8 +18,7 @@ * \ingroup bke */ -#ifndef __BKE_WORKSPACE_H__ -#define __BKE_WORKSPACE_H__ +#pragma once #include "BLI_compiler_attrs.h" @@ -112,5 +111,3 @@ void BKE_workspace_id_tag_all_visible(struct Main *bmain, int tag) ATTR_NONNULL( #ifdef __cplusplus } #endif - -#endif /* __BKE_WORKSPACE_H__ */ diff --git a/source/blender/blenkernel/BKE_world.h b/source/blender/blenkernel/BKE_world.h index 3c8f8547b46..82830facccc 100644 --- a/source/blender/blenkernel/BKE_world.h +++ b/source/blender/blenkernel/BKE_world.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BKE_WORLD_H__ -#define __BKE_WORLD_H__ +#pragma once /** \file * \ingroup bke @@ -39,5 +38,3 @@ void BKE_world_eval(struct Depsgraph *depsgraph, struct World *world); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_writeavi.h b/source/blender/blenkernel/BKE_writeavi.h index 79605e99306..97f998cc1c1 100644 --- a/source/blender/blenkernel/BKE_writeavi.h +++ b/source/blender/blenkernel/BKE_writeavi.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_WRITEAVI_H__ -#define __BKE_WRITEAVI_H__ +#pragma once /** \file * \ingroup bke @@ -73,5 +72,3 @@ void BKE_movie_filepath_get(char *string, #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/BKE_writeffmpeg.h b/source/blender/blenkernel/BKE_writeffmpeg.h index 467e6ab7242..4c966c55e41 100644 --- a/source/blender/blenkernel/BKE_writeffmpeg.h +++ b/source/blender/blenkernel/BKE_writeffmpeg.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BKE_WRITEFFMPEG_H__ -#define __BKE_WRITEFFMPEG_H__ +#pragma once /** \file * \ingroup bke @@ -100,5 +99,3 @@ void BKE_ffmpeg_context_free(void *context_v); # endif #endif - -#endif diff --git a/source/blender/blenkernel/intern/CCGSubSurf.h b/source/blender/blenkernel/intern/CCGSubSurf.h index 2e5100db6de..e1805a9c512 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.h +++ b/source/blender/blenkernel/intern/CCGSubSurf.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __CCGSUBSURF_H__ -#define __CCGSUBSURF_H__ +#pragma once /** \file * \ingroup bke @@ -210,5 +209,3 @@ void ccgEdgeIterator_next(CCGEdgeIterator *ei); CCGFace *ccgFaceIterator_getCurrent(CCGFaceIterator *fi); int ccgFaceIterator_isStopped(CCGFaceIterator *fi); void ccgFaceIterator_next(CCGFaceIterator *fi); - -#endif /* __CCGSUBSURF_H__ */ diff --git a/source/blender/blenkernel/intern/CCGSubSurf_inline.h b/source/blender/blenkernel/intern/CCGSubSurf_inline.h index 86012bd2a43..8aa1fede57d 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf_inline.h +++ b/source/blender/blenkernel/intern/CCGSubSurf_inline.h @@ -18,8 +18,7 @@ * \ingroup bke */ -#ifndef __CCGSUBSURF_INLINE_H__ -#define __CCGSUBSURF_INLINE_H__ +#pragma once BLI_INLINE int ccg_gridsize(int level) { @@ -274,5 +273,3 @@ BLI_INLINE void VertDataAvg4(float v[], v[i] = (a[i] + b[i] + c[i] + d[i]) * 0.25f; } } - -#endif /* __CCGSUBSURF_INLINE_H__ */ diff --git a/source/blender/blenkernel/intern/CCGSubSurf_intern.h b/source/blender/blenkernel/intern/CCGSubSurf_intern.h index 7c35d2ccfce..82ca22e193a 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf_intern.h +++ b/source/blender/blenkernel/intern/CCGSubSurf_intern.h @@ -18,8 +18,7 @@ * \ingroup bke */ -#ifndef __CCGSUBSURF_INTERN_H__ -#define __CCGSUBSURF_INTERN_H__ +#pragma once /** * Definitions which defines internal behavior of CCGSubSurf. @@ -286,5 +285,3 @@ void ccgSubSurf__dumpCoords(CCGSubSurf *ss); #endif #include "CCGSubSurf_inline.h" - -#endif /* __CCGSUBSURF_INTERN_H__ */ diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index b40cc4e8b9f..8031e3dadf8 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -2358,32 +2358,6 @@ void DM_debug_print(DerivedMesh *dm) MEM_freeN(str); } -void DM_debug_print_cdlayers(CustomData *data) -{ - int i; - const CustomDataLayer *layer; - - printf("{\n"); - - for (i = 0, layer = data->layers; i < data->totlayer; i++, layer++) { - - const char *name = CustomData_layertype_name(layer->type); - const int size = CustomData_sizeof(layer->type); - const char *structname; - int structnum; - CustomData_file_write_info(layer->type, &structname, &structnum); - printf(" dict(name='%s', struct='%s', type=%d, ptr='%p', elem=%d, length=%d),\n", - name, - structname, - layer->type, - (const void *)layer->data, - size, - (int)(MEM_allocN_len(layer->data) / size)); - } - - printf("}\n"); -} - bool DM_is_valid(DerivedMesh *dm) { const bool do_verbose = true; diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index fa7eee83a68..85ac2c693cb 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -37,6 +37,7 @@ #include "BLI_blenlib.h" #include "BLI_ghash.h" #include "BLI_math.h" +#include "BLI_session_uuid.h" #include "BLI_string_utils.h" #include "BLI_utildefines.h" @@ -482,6 +483,11 @@ void action_groups_clear_tempflags(bAction *act) /* *************** Pose channels *************** */ +void BKE_pose_channel_session_uuid_generate(bPoseChannel *pchan) +{ + pchan->runtime.session_uuid = BLI_session_uuid_generate(); +} + /** * Return a pointer to the pose channel of the given name * from this pose. @@ -524,6 +530,8 @@ bPoseChannel *BKE_pose_channel_verify(bPose *pose, const char *name) /* If not, create it and add it */ chan = MEM_callocN(sizeof(bPoseChannel), "verifyPoseChannel"); + BKE_pose_channel_session_uuid_generate(chan); + BLI_strncpy(chan->name, name, sizeof(chan->name)); chan->custom_scale = 1.0f; @@ -698,6 +706,10 @@ void BKE_pose_copy_data_ex(bPose **dst, id_us_plus((ID *)pchan->custom); } + if ((flag & LIB_ID_CREATE_NO_MAIN) == 0) { + BKE_pose_channel_session_uuid_generate(pchan); + } + /* warning, O(n2) here, if done without the hash, but these are rarely used features. */ if (pchan->custom_tx) { pchan->custom_tx = BKE_pose_channel_find_name(outPose, pchan->custom_tx->name); @@ -726,7 +738,7 @@ void BKE_pose_copy_data_ex(bPose **dst, pchan->draw_data = NULL; /* Drawing cache, no need to copy. */ /* Runtime data, no need to copy. */ - memset(&pchan->runtime, 0, sizeof(pchan->runtime)); + BKE_pose_channel_runtime_reset_on_copy(&pchan->runtime); } /* for now, duplicate Bone Groups too when doing this */ @@ -956,6 +968,14 @@ void BKE_pose_channel_runtime_reset(bPoseChannel_Runtime *runtime) memset(runtime, 0, sizeof(*runtime)); } +/* Reset all non-persistent fields. */ +void BKE_pose_channel_runtime_reset_on_copy(bPoseChannel_Runtime *runtime) +{ + const SessionUUID uuid = runtime->session_uuid; + memset(runtime, 0, sizeof(*runtime)); + runtime->session_uuid = uuid; +} + /** Deallocates runtime cache of a pose channel */ void BKE_pose_channel_runtime_free(bPoseChannel_Runtime *runtime) { @@ -1692,3 +1712,30 @@ void what_does_obaction(Object *ob, BKE_animsys_evaluate_animdata(&workob->id, &adt, anim_eval_context, ADT_RECALC_ANIM, false); } } + +void BKE_pose_check_uuids_unique_and_report(const bPose *pose) +{ + if (pose == NULL) { + return; + } + + struct GSet *used_uuids = BLI_gset_new( + BLI_session_uuid_ghash_hash, BLI_session_uuid_ghash_compare, "sequencer used uuids"); + + LISTBASE_FOREACH (bPoseChannel *, pchan, &pose->chanbase) { + const SessionUUID *session_uuid = &pchan->runtime.session_uuid; + if (!BLI_session_uuid_is_generated(session_uuid)) { + printf("Pose channel %s does not have UUID generated.\n", pchan->name); + continue; + } + + if (BLI_gset_lookup(used_uuids, session_uuid) != NULL) { + printf("Pose channel %s has duplicate UUID generated.\n", pchan->name); + continue; + } + + BLI_gset_insert(used_uuids, (void *)session_uuid); + } + + BLI_gset_free(used_uuids, NULL); +} diff --git a/source/blender/blenkernel/intern/anim_data.c b/source/blender/blenkernel/intern/anim_data.c index 61181278c60..038a0d14ddb 100644 --- a/source/blender/blenkernel/intern/anim_data.c +++ b/source/blender/blenkernel/intern/anim_data.c @@ -505,24 +505,43 @@ static bool animpath_matches_basepath(const char path[], const char basepath[]) return (path && basepath) && STRPREFIX(path, basepath); } +static void animpath_update_basepath(FCurve *fcu, + const char *old_basepath, + const char *new_basepath) +{ + BLI_assert(animpath_matches_basepath(fcu->rna_path, old_basepath)); + if (STREQ(old_basepath, new_basepath)) { + return; + } + + char *new_path = BLI_sprintfN("%s%s", new_basepath, fcu->rna_path + strlen(old_basepath)); + MEM_freeN(fcu->rna_path); + fcu->rna_path = new_path; +} + /* Move F-Curves in src action to dst action, setting up all the necessary groups * for this to happen, but only if the F-Curves being moved have the appropriate * "base path". * - This is used when data moves from one data-block to another, causing the * F-Curves to need to be moved over too */ -void action_move_fcurves_by_basepath(bAction *srcAct, bAction *dstAct, const char basepath[]) +static void action_move_fcurves_by_basepath(bAction *srcAct, + bAction *dstAct, + const char *src_basepath, + const char *dst_basepath) { FCurve *fcu, *fcn = NULL; /* sanity checks */ - if (ELEM(NULL, srcAct, dstAct, basepath)) { + if (ELEM(NULL, srcAct, dstAct, src_basepath, dst_basepath)) { if (G.debug & G_DEBUG) { CLOG_ERROR(&LOG, - "srcAct: %p, dstAct: %p, basepath: %p has insufficient info to work with", + "srcAct: %p, dstAct: %p, src_basepath: %p, dst_basepath: %p has insufficient " + "info to work with", (void *)srcAct, (void *)dstAct, - (void *)basepath); + (void *)src_basepath, + (void *)dst_basepath); } return; } @@ -540,7 +559,7 @@ void action_move_fcurves_by_basepath(bAction *srcAct, bAction *dstAct, const cha /* should F-Curve be moved over? * - we only need the start of the path to match basepath */ - if (animpath_matches_basepath(fcu->rna_path, basepath)) { + if (animpath_matches_basepath(fcu->rna_path, src_basepath)) { bActionGroup *agrp = NULL; /* if grouped... */ @@ -562,6 +581,8 @@ void action_move_fcurves_by_basepath(bAction *srcAct, bAction *dstAct, const cha /* perform the migration now */ action_groups_remove_channel(srcAct, fcu); + animpath_update_basepath(fcu, src_basepath, dst_basepath); + if (agrp) { action_groups_add_channel(dstAct, agrp, fcu); } @@ -594,14 +615,31 @@ void action_move_fcurves_by_basepath(bAction *srcAct, bAction *dstAct, const cha } } +static void animdata_move_drivers_by_basepath(AnimData *srcAdt, + AnimData *dstAdt, + const char *src_basepath, + const char *dst_basepath) +{ + LISTBASE_FOREACH_MUTABLE (FCurve *, fcu, &srcAdt->drivers) { + if (animpath_matches_basepath(fcu->rna_path, src_basepath)) { + animpath_update_basepath(fcu, src_basepath, dst_basepath); + BLI_remlink(&srcAdt->drivers, fcu); + BLI_addtail(&dstAdt->drivers, fcu); + + /* TODO: add depsgraph flushing calls? */ + } + } +} + /* Transfer the animation data from srcID to dstID where the srcID * animation data is based off "basepath", creating new AnimData and - * associated data as necessary + * associated data as necessary. + * + * basepaths is a list of AnimationBasePathChange. */ -void BKE_animdata_separate_by_basepath(Main *bmain, ID *srcID, ID *dstID, ListBase *basepaths) +void BKE_animdata_transfer_by_basepath(Main *bmain, ID *srcID, ID *dstID, ListBase *basepaths) { AnimData *srcAdt = NULL, *dstAdt = NULL; - LinkData *ld; /* sanity checks */ if (ELEM(NULL, srcID, dstID)) { @@ -643,35 +681,19 @@ void BKE_animdata_separate_by_basepath(Main *bmain, ID *srcID, ID *dstID, ListBa } /* loop over base paths, trying to fix for each one... */ - for (ld = basepaths->first; ld; ld = ld->next) { - const char *basepath = (const char *)ld->data; - action_move_fcurves_by_basepath(srcAdt->action, dstAdt->action, basepath); + LISTBASE_FOREACH (const AnimationBasePathChange *, basepath_change, basepaths) { + action_move_fcurves_by_basepath(srcAdt->action, + dstAdt->action, + basepath_change->src_basepath, + basepath_change->dst_basepath); } } /* drivers */ if (srcAdt->drivers.first) { - FCurve *fcu, *fcn = NULL; - - /* check each driver against all the base paths to see if any should go */ - for (fcu = srcAdt->drivers.first; fcu; fcu = fcn) { - fcn = fcu->next; - - /* try each basepath in turn, but stop on the first one which works */ - for (ld = basepaths->first; ld; ld = ld->next) { - const char *basepath = (const char *)ld->data; - - if (animpath_matches_basepath(fcu->rna_path, basepath)) { - /* just need to change lists */ - BLI_remlink(&srcAdt->drivers, fcu); - BLI_addtail(&dstAdt->drivers, fcu); - - /* TODO: add depsgraph flushing calls? */ - - /* can stop now, as moved already */ - break; - } - } + LISTBASE_FOREACH (const AnimationBasePathChange *, basepath_change, basepaths) { + animdata_move_drivers_by_basepath( + srcAdt, dstAdt, basepath_change->src_basepath, basepath_change->dst_basepath); } } } diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index bf04603aa46..985be4ac99f 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1382,7 +1382,7 @@ void get_objectspace_bone_matrix(struct Bone *bone, } /* Convert World-Space Matrix to Pose-Space Matrix */ -void BKE_armature_mat_world_to_pose(Object *ob, float inmat[4][4], float outmat[4][4]) +void BKE_armature_mat_world_to_pose(Object *ob, const float inmat[4][4], float outmat[4][4]) { float obmat[4][4]; @@ -1674,7 +1674,9 @@ void BKE_bone_parent_transform_apply(const struct BoneParentTransform *bpt, /* Convert Pose-Space Matrix to Bone-Space Matrix. * NOTE: this cannot be used to convert to pose-space transforms of the supplied * pose-channel into its local space (i.e. 'visual'-keyframing) */ -void BKE_armature_mat_pose_to_bone(bPoseChannel *pchan, float inmat[4][4], float outmat[4][4]) +void BKE_armature_mat_pose_to_bone(bPoseChannel *pchan, + const float inmat[4][4], + float outmat[4][4]) { BoneParentTransform bpt; @@ -1684,7 +1686,9 @@ void BKE_armature_mat_pose_to_bone(bPoseChannel *pchan, float inmat[4][4], float } /* Convert Bone-Space Matrix to Pose-Space Matrix. */ -void BKE_armature_mat_bone_to_pose(bPoseChannel *pchan, float inmat[4][4], float outmat[4][4]) +void BKE_armature_mat_bone_to_pose(bPoseChannel *pchan, + const float inmat[4][4], + float outmat[4][4]) { BoneParentTransform bpt; @@ -1720,7 +1724,7 @@ void BKE_armature_loc_pose_to_bone(bPoseChannel *pchan, const float inloc[3], fl void BKE_armature_mat_pose_to_bone_ex(struct Depsgraph *depsgraph, Object *ob, bPoseChannel *pchan, - float inmat[4][4], + const float inmat[4][4], float outmat[4][4]) { bPoseChannel work_pchan = *pchan; @@ -1741,7 +1745,7 @@ void BKE_armature_mat_pose_to_bone_ex(struct Depsgraph *depsgraph, /** * Same as #BKE_object_mat3_to_rot(). */ -void BKE_pchan_mat3_to_rot(bPoseChannel *pchan, float mat[3][3], bool use_compat) +void BKE_pchan_mat3_to_rot(bPoseChannel *pchan, const float mat[3][3], bool use_compat) { BLI_ASSERT_UNIT_M3(mat); @@ -1766,17 +1770,17 @@ void BKE_pchan_mat3_to_rot(bPoseChannel *pchan, float mat[3][3], bool use_compat /** * Same as #BKE_object_rot_to_mat3(). */ -void BKE_pchan_rot_to_mat3(const bPoseChannel *pchan, float mat[3][3]) +void BKE_pchan_rot_to_mat3(const bPoseChannel *pchan, float r_mat[3][3]) { /* rotations may either be quats, eulers (with various rotation orders), or axis-angle */ if (pchan->rotmode > 0) { /* euler rotations (will cause gimble lock, * but this can be alleviated a bit with rotation orders) */ - eulO_to_mat3(mat, pchan->eul, pchan->rotmode); + eulO_to_mat3(r_mat, pchan->eul, pchan->rotmode); } else if (pchan->rotmode == ROT_MODE_AXISANGLE) { /* axis-angle - not really that great for 3D-changing orientations */ - axis_angle_to_mat3(mat, pchan->rotAxis, pchan->rotAngle); + axis_angle_to_mat3(r_mat, pchan->rotAxis, pchan->rotAngle); } else { /* quats are normalized before use to eliminate scaling issues */ @@ -1786,7 +1790,7 @@ void BKE_pchan_rot_to_mat3(const bPoseChannel *pchan, float mat[3][3]) * since this was kindof evil in some cases but if this proves to be too problematic, * switch back to the old system of operating directly on the stored copy. */ normalize_qt_qt(quat, pchan->quat); - quat_to_mat3(mat, quat); + quat_to_mat3(r_mat, quat); } } @@ -1794,7 +1798,7 @@ void BKE_pchan_rot_to_mat3(const bPoseChannel *pchan, float mat[3][3]) * Apply a 4x4 matrix to the pose bone, * similar to #BKE_object_apply_mat4(). */ -void BKE_pchan_apply_mat4(bPoseChannel *pchan, float mat[4][4], bool use_compat) +void BKE_pchan_apply_mat4(bPoseChannel *pchan, const float mat[4][4], bool use_compat) { float rot[3][3]; mat4_to_loc_rot_size(pchan->loc, rot, pchan->size, mat); @@ -1998,7 +2002,7 @@ void mat3_vec_to_roll(const float mat[3][3], const float vec[3], float *r_roll) * â”” -2 * x * z, x^2 - z^2 ┘ * </pre> */ -void vec_roll_to_mat3_normalized(const float nor[3], const float roll, float mat[3][3]) +void vec_roll_to_mat3_normalized(const float nor[3], const float roll, float r_mat[3][3]) { #define THETA_THRESHOLD_NEGY 1.0e-9f #define THETA_THRESHOLD_NEGY_CLOSE 1.0e-5f @@ -2052,18 +2056,18 @@ void vec_roll_to_mat3_normalized(const float nor[3], const float roll, float mat axis_angle_normalized_to_mat3(rMatrix, nor, roll); /* Combine and output result */ - mul_m3_m3m3(mat, rMatrix, bMatrix); + mul_m3_m3m3(r_mat, rMatrix, bMatrix); #undef THETA_THRESHOLD_NEGY #undef THETA_THRESHOLD_NEGY_CLOSE } -void vec_roll_to_mat3(const float vec[3], const float roll, float mat[3][3]) +void vec_roll_to_mat3(const float vec[3], const float roll, float r_mat[3][3]) { float nor[3]; normalize_v3_v3(nor, vec); - vec_roll_to_mat3_normalized(nor, roll, mat); + vec_roll_to_mat3_normalized(nor, roll, r_mat); } /** \} */ @@ -2201,7 +2205,7 @@ static void pose_proxy_sync(Object *ob, Object *from, int layer_protected) pchan->mpath = NULL; /* Reset runtime data, we don't want to share that with the proxy. */ - BKE_pose_channel_runtime_reset(&pchanw.runtime); + BKE_pose_channel_runtime_reset_on_copy(&pchanw.runtime); /* this is freed so copy a copy, else undo crashes */ if (pchanw.prop) { @@ -2418,8 +2422,10 @@ void BKE_pose_rebuild(Main *bmain, Object *ob, bArmature *arm, const bool do_id_ /** \name Pose Solver * \{ */ -/* loc/rot/size to given mat4 */ -void BKE_pchan_to_mat4(const bPoseChannel *pchan, float chan_mat[4][4]) +/** + * Convert the loc/rot/size to \a r_chanmat (typically #bPoseChannel.chan_mat). + */ +void BKE_pchan_to_mat4(const bPoseChannel *pchan, float r_chanmat[4][4]) { float smat[3][3]; float rmat[3][3]; @@ -2433,12 +2439,12 @@ void BKE_pchan_to_mat4(const bPoseChannel *pchan, float chan_mat[4][4]) /* calculate matrix of bone (as 3x3 matrix, but then copy the 4x4) */ mul_m3_m3m3(tmat, rmat, smat); - copy_m4_m3(chan_mat, tmat); + copy_m4_m3(r_chanmat, tmat); /* prevent action channels breaking chains */ /* need to check for bone here, CONSTRAINT_TYPE_ACTION uses this call */ if ((pchan->bone == NULL) || !(pchan->bone->flag & BONE_CONNECTED)) { - copy_v3_v3(chan_mat[3], pchan->loc); + copy_v3_v3(r_chanmat[3], pchan->loc); } } diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c index e2d17f34992..1833ad5a748 100644 --- a/source/blender/blenkernel/intern/bpath.c +++ b/source/blender/blenkernel/intern/bpath.c @@ -165,7 +165,7 @@ void BKE_bpath_relative_rebase(Main *bmain, ReportList *reports) { BPathRebase_Data data = {NULL}; - const int flag = BKE_BPATH_TRAVERSE_SKIP_LIBRARY; + const int flag = (BKE_BPATH_TRAVERSE_SKIP_LIBRARY | BKE_BPATH_TRAVERSE_SKIP_MULTIFILE); BLI_assert(basedir_src[0] != '\0'); BLI_assert(basedir_dst[0] != '\0'); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 355bdfd10fd..7223187831e 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -503,7 +503,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE; brush->gpencil_settings->draw_strength = 0.4f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; brush->gpencil_settings->input_samples = 10; brush->gpencil_settings->active_smooth = ACTIVE_SMOOTH; @@ -686,7 +686,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->flag &= ~GP_BRUSH_USE_PRESSURE; brush->gpencil_settings->draw_strength = 1.0f; - brush->gpencil_settings->flag &= ~GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag &= ~GP_BRUSH_USE_STRENGTH_PRESSURE; brush->gpencil_settings->input_samples = 10; brush->gpencil_settings->active_smooth = ACTIVE_SMOOTH; @@ -717,7 +717,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE; brush->gpencil_settings->draw_strength = 0.4f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; brush->gpencil_settings->input_samples = 10; brush->gpencil_settings->active_smooth = ACTIVE_SMOOTH; @@ -760,7 +760,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE; brush->gpencil_settings->draw_strength = 0.6f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; brush->gpencil_settings->input_samples = 10; brush->gpencil_settings->active_smooth = ACTIVE_SMOOTH; @@ -812,7 +812,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->draw_strength = 0.5f; brush->gpencil_settings->flag |= GP_BRUSH_DEFAULT_ERASER; brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; brush->gpencil_settings->icon_id = GP_BRUSH_ICON_ERASE_SOFT; brush->gpencil_tool = GPAINT_TOOL_ERASE; brush->gpencil_settings->eraser_mode = GP_BRUSH_ERASER_SOFT; @@ -859,7 +859,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE; brush->gpencil_settings->draw_strength = 0.8f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; zero_v3(brush->secondary_rgb); break; @@ -872,7 +872,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE; brush->gpencil_settings->draw_strength = 0.8f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; zero_v3(brush->secondary_rgb); break; @@ -885,7 +885,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE; brush->gpencil_settings->draw_strength = 0.8f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; zero_v3(brush->secondary_rgb); break; @@ -898,7 +898,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE; brush->gpencil_settings->draw_strength = 0.8f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; zero_v3(brush->secondary_rgb); break; @@ -911,7 +911,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE; brush->gpencil_settings->draw_strength = 0.8f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; zero_v3(brush->secondary_rgb); break; @@ -924,7 +924,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE; brush->gpencil_settings->draw_strength = 0.8f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; zero_v3(brush->secondary_rgb); break; @@ -937,7 +937,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE; brush->gpencil_settings->draw_strength = 0.3f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; brush->gpencil_settings->sculpt_flag = GP_SCULPT_FLAG_SMOOTH_PRESSURE; brush->gpencil_settings->sculpt_mode_flag |= GP_SCULPT_FLAGMODE_APPLY_POSITION; @@ -951,7 +951,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE; brush->gpencil_settings->draw_strength = 0.3f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; brush->gpencil_settings->sculpt_flag = GP_SCULPT_FLAG_SMOOTH_PRESSURE; brush->gpencil_settings->sculpt_mode_flag |= GP_SCULPT_FLAGMODE_APPLY_POSITION; @@ -965,7 +965,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE; brush->gpencil_settings->draw_strength = 0.5f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; brush->gpencil_settings->sculpt_mode_flag |= GP_SCULPT_FLAGMODE_APPLY_POSITION; break; @@ -978,7 +978,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->size = 25.0f; brush->gpencil_settings->draw_strength = 0.3f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; brush->gpencil_settings->sculpt_mode_flag |= GP_SCULPT_FLAGMODE_APPLY_POSITION; break; @@ -991,7 +991,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE; brush->gpencil_settings->draw_strength = 0.3f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; brush->gpencil_settings->sculpt_mode_flag |= GP_SCULPT_FLAGMODE_APPLY_POSITION; break; @@ -1004,7 +1004,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE; brush->gpencil_settings->draw_strength = 0.3f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; brush->gpencil_settings->sculpt_mode_flag |= GP_SCULPT_FLAGMODE_APPLY_POSITION; break; @@ -1017,7 +1017,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE; brush->gpencil_settings->draw_strength = 0.5f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; brush->gpencil_settings->sculpt_mode_flag |= GP_SCULPT_FLAGMODE_APPLY_POSITION; break; @@ -1030,7 +1030,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE; brush->gpencil_settings->draw_strength = 0.5f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; brush->gpencil_settings->sculpt_mode_flag |= GP_SCULPT_FLAGMODE_APPLY_POSITION; break; @@ -1043,7 +1043,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->size = 25.0f; brush->gpencil_settings->draw_strength = 1.0f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; brush->gpencil_settings->sculpt_mode_flag |= GP_SCULPT_FLAGMODE_APPLY_POSITION; break; @@ -1056,7 +1056,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type) brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE; brush->gpencil_settings->draw_strength = 0.8f; - brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE; + brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE; brush->gpencil_settings->sculpt_mode_flag |= GP_SCULPT_FLAGMODE_APPLY_POSITION; break; diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index 93794eb9709..bea8fdd5719 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -717,11 +717,14 @@ BVHTree *bvhtree_from_mesh_verts_ex(BVHTreeFromMesh *data, /* printf("BVHTree built and saved on cache\n"); */ BVHCache *bvh_cache = *bvh_cache_p; bvhcache_insert(bvh_cache, tree, bvh_cache_type); - bvhcache_unlock(bvh_cache, lock_started); in_cache = true; } } + if (bvh_cache_p) { + bvhcache_unlock(*bvh_cache_p, lock_started); + } + /* Setup BVHTreeFromMesh */ bvhtree_from_mesh_verts_setup_data(data, tree, in_cache, vert, vert_allocated); @@ -929,11 +932,14 @@ BVHTree *bvhtree_from_mesh_edges_ex(BVHTreeFromMesh *data, /* Save on cache for later use */ /* printf("BVHTree built and saved on cache\n"); */ bvhcache_insert(bvh_cache, tree, bvh_cache_type); - bvhcache_unlock(bvh_cache, lock_started); in_cache = true; } } + if (bvh_cache_p) { + bvhcache_unlock(*bvh_cache_p, lock_started); + } + /* Setup BVHTreeFromMesh */ bvhtree_from_mesh_edges_setup_data( data, tree, in_cache, vert, vert_allocated, edge, edge_allocated); @@ -1058,11 +1064,14 @@ BVHTree *bvhtree_from_mesh_faces_ex(BVHTreeFromMesh *data, /* printf("BVHTree built and saved on cache\n"); */ BVHCache *bvh_cache = *bvh_cache_p; bvhcache_insert(bvh_cache, tree, bvh_cache_type); - bvhcache_unlock(bvh_cache, lock_started); in_cache = true; } } + if (bvh_cache_p) { + bvhcache_unlock(*bvh_cache_p, lock_started); + } + /* Setup BVHTreeFromMesh */ bvhtree_from_mesh_faces_setup_data( data, tree, in_cache, vert, vert_allocated, face, face_allocated); @@ -1298,11 +1307,14 @@ BVHTree *bvhtree_from_mesh_looptri_ex(BVHTreeFromMesh *data, if (bvh_cache_p) { BVHCache *bvh_cache = *bvh_cache_p; bvhcache_insert(bvh_cache, tree, bvh_cache_type); - bvhcache_unlock(bvh_cache, lock_started); in_cache = true; } } + if (bvh_cache_p) { + bvhcache_unlock(*bvh_cache_p, lock_started); + } + /* Setup BVHTreeFromMesh */ bvhtree_from_mesh_looptri_setup_data(data, tree, @@ -1428,8 +1440,6 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data, mesh->medge, mesh->totedge, mesh->mvert, verts_len, &loose_vert_len); } - /* TODO: a global mutex lock held during the expensive operation of - * building the BVH tree is really bad for performance. */ tree = bvhtree_from_mesh_verts_ex(data, mesh->mvert, verts_len, diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 6118325c231..5c618c8e9ce 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -408,9 +408,9 @@ static Collection *collection_duplicate_recursive(Main *bmain, } if (do_objects) { - /* We can loop on collection_old's objects, that list is currently identical the collection_new - * objects, and won't be changed here. */ - LISTBASE_FOREACH (CollectionObject *, cob, &collection_old->gobject) { + /* We can loop on collection_old's objects, but have to consider it mutable because with master + * collections collection_old and collection_new are the same data here. */ + LISTBASE_FOREACH_MUTABLE (CollectionObject *, cob, &collection_old->gobject) { Object *ob_old = cob->ob; Object *ob_new = (Object *)ob_old->id.newid; diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 31d49dd4508..f358355912b 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -212,7 +212,6 @@ static float compute_collision_point_tri_tri(const float a1[3], float dist = FLT_MAX; float tmp_co1[3], tmp_co2[3]; float isect_a[3], isect_b[3]; - int isect_count = 0; float tmp, tmp_vec[3]; float normal[3], cent[3]; bool backside = false; @@ -226,38 +225,16 @@ static float compute_collision_point_tri_tri(const float a1[3], copy_v3_v3(b[2], b3); /* Find intersections. */ - for (int i = 0; i < 3; i++) { - if (isect_line_segment_tri_v3(a[i], a[next_ind(i)], b[0], b[1], b[2], &tmp, NULL)) { - interp_v3_v3v3(isect_a, a[i], a[next_ind(i)], tmp); - isect_count++; - } - } - - if (isect_count == 0) { - for (int i = 0; i < 3; i++) { - if (isect_line_segment_tri_v3(b[i], b[next_ind(i)], a[0], a[1], a[2], &tmp, NULL)) { - isect_count++; - } - } - } - else if (isect_count == 1) { - for (int i = 0; i < 3; i++) { - if (isect_line_segment_tri_v3(b[i], b[next_ind(i)], a[0], a[1], a[2], &tmp, NULL)) { - interp_v3_v3v3(isect_b, b[i], b[next_ind(i)], tmp); - break; - } - } - } + int tri_a_edge_isect_count; + const bool is_intersecting = isect_tri_tri_v3_ex( + a, b, isect_a, isect_b, &tri_a_edge_isect_count); /* Determine collision side. */ if (culling) { normal_tri_v3(normal, b[0], b[1], b[2]); mid_v3_v3v3v3(cent, b[0], b[1], b[2]); - if (isect_count == 2) { - backside = true; - } - else if (isect_count == 0) { + if (!is_intersecting) { for (int i = 0; i < 3; i++) { sub_v3_v3v3(tmp_vec, a[i], cent); if (dot_v3v3(tmp_vec, normal) < 0.0f) { @@ -266,12 +243,16 @@ static float compute_collision_point_tri_tri(const float a1[3], } } } + else if (tri_a_edge_isect_count != 1) { + /* It is not Edge intersection. */ + backside = true; + } } else if (use_normal) { normal_tri_v3(normal, b[0], b[1], b[2]); } - if (isect_count == 1) { + if (tri_a_edge_isect_count == 1) { /* Edge intersection. */ copy_v3_v3(r_a, isect_a); copy_v3_v3(r_b, isect_b); @@ -383,7 +364,7 @@ static float compute_collision_point_tri_tri(const float a1[3], } /* Closest edge. */ - if (isect_count == 0) { + if (!is_intersecting) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { isect_seg_seg_v3(a[i], a[next_ind(i)], b[j], b[next_ind(j)], tmp_co1, tmp_co2); @@ -398,7 +379,7 @@ static float compute_collision_point_tri_tri(const float a1[3], } } - if (isect_count == 0) { + if (!is_intersecting) { sub_v3_v3v3(r_vec, r_a, r_b); dist = sqrtf(dist); } diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index d242337d5a7..0627d2005d5 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -3112,8 +3112,9 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render) if (bl->poly > 0) { BevPoint *bevp; - min = 300000.0; bevp = bl->bevpoints; + bevp1 = bl->bevpoints; + min = bevp1->vec[0]; nr = bl->nr; while (nr--) { if (min > bevp->vec[0]) { @@ -5308,8 +5309,11 @@ bool BKE_curve_center_bounds(Curve *cu, float cent[3]) return false; } -void BKE_curve_transform_ex( - Curve *cu, float mat[4][4], const bool do_keys, const bool do_props, const float unit_scale) +void BKE_curve_transform_ex(Curve *cu, + const float mat[4][4], + const bool do_keys, + const bool do_props, + const float unit_scale) { Nurb *nu; BPoint *bp; @@ -5372,13 +5376,13 @@ void BKE_curve_transform_ex( } } -void BKE_curve_transform(Curve *cu, float mat[4][4], const bool do_keys, const bool do_props) +void BKE_curve_transform(Curve *cu, const float mat[4][4], const bool do_keys, const bool do_props) { float unit_scale = mat4_to_scale(mat); BKE_curve_transform_ex(cu, mat, do_keys, do_props, unit_scale); } -void BKE_curve_translate(Curve *cu, float offset[3], const bool do_keys) +void BKE_curve_translate(Curve *cu, const float offset[3], const bool do_keys) { ListBase *nurb_lb = BKE_curve_nurbs_get(cu); Nurb *nu; diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 22d4af6fa39..707db46a856 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -4569,6 +4569,32 @@ bool CustomData_layer_validate(CustomDataLayer *layer, const uint totitems, cons return false; } +void CustomData_layers__print(CustomData *data) +{ + int i; + const CustomDataLayer *layer; + + printf("{\n"); + + for (i = 0, layer = data->layers; i < data->totlayer; i++, layer++) { + + const char *name = CustomData_layertype_name(layer->type); + const int size = CustomData_sizeof(layer->type); + const char *structname; + int structnum; + CustomData_file_write_info(layer->type, &structname, &structnum); + printf(" dict(name='%s', struct='%s', type=%d, ptr='%p', elem=%d, length=%d),\n", + name, + structname, + layer->type, + (const void *)layer->data, + size, + (int)(MEM_allocN_len(layer->data) / size)); + } + + printf("}\n"); +} + /****************************** External Files *******************************/ static void customdata_external_filename(char filename[FILE_MAX], diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c index 9bdd80fd668..8ca26e559b4 100644 --- a/source/blender/blenkernel/intern/data_transfer.c +++ b/source/blender/blenkernel/intern/data_transfer.c @@ -43,6 +43,7 @@ #include "BKE_mesh_mapping.h" #include "BKE_mesh_remap.h" #include "BKE_mesh_runtime.h" +#include "BKE_mesh_wrapper.h" #include "BKE_modifier.h" #include "BKE_object.h" #include "BKE_object_deform.h" @@ -1467,6 +1468,7 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph, if (!me_src) { return changed; } + BKE_mesh_wrapper_ensure_mdata(me_src); if (auto_transform) { if (space_transform == NULL) { @@ -1573,7 +1575,7 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph, space_transform)) { CustomDataTransferLayerMap *lay_mapit; - changed = (lay_map.first != NULL); + changed |= (lay_map.first != NULL); for (lay_mapit = lay_map.first; lay_mapit; lay_mapit = lay_mapit->next) { CustomData_data_transfer(&geom_map[VDATA], lay_mapit); @@ -1651,7 +1653,7 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph, space_transform)) { CustomDataTransferLayerMap *lay_mapit; - changed = (lay_map.first != NULL); + changed |= (lay_map.first != NULL); for (lay_mapit = lay_map.first; lay_mapit; lay_mapit = lay_mapit->next) { CustomData_data_transfer(&geom_map[EDATA], lay_mapit); @@ -1747,7 +1749,7 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph, space_transform)) { CustomDataTransferLayerMap *lay_mapit; - changed = (lay_map.first != NULL); + changed |= (lay_map.first != NULL); for (lay_mapit = lay_map.first; lay_mapit; lay_mapit = lay_mapit->next) { CustomData_data_transfer(&geom_map[LDATA], lay_mapit); @@ -1838,7 +1840,7 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph, space_transform)) { CustomDataTransferLayerMap *lay_mapit; - changed = (lay_map.first != NULL); + changed |= (lay_map.first != NULL); for (lay_mapit = lay_map.first; lay_mapit; lay_mapit = lay_mapit->next) { CustomData_data_transfer(&geom_map[PDATA], lay_mapit); diff --git a/source/blender/blenkernel/intern/data_transfer_intern.h b/source/blender/blenkernel/intern/data_transfer_intern.h index 68ded6e2bc4..c5d7dd42cb8 100644 --- a/source/blender/blenkernel/intern/data_transfer_intern.h +++ b/source/blender/blenkernel/intern/data_transfer_intern.h @@ -21,8 +21,7 @@ * \ingroup bke */ -#ifndef __DATA_TRANSFER_INTERN_H__ -#define __DATA_TRANSFER_INTERN_H__ +#pragma once #include "BKE_customdata.h" /* For cd_datatransfer_interp */ @@ -75,5 +74,3 @@ void customdata_data_transfer_interp_normal_normals(const CustomDataTransferLaye const float *weights, const int count, const float mix_factor); - -#endif /* __DATA_TRANSFER_INTERN_H__ */ diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index b9279ace39f..7b7b7ceb84b 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -4203,7 +4203,7 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex( brushVelocity[v3].v, weights); - /* substract canvas point velocity */ + /* subtract canvas point velocity */ if (bData->velocity) { sub_v3_v3v3(velocity, brushPointVelocity, bData->velocity[index].v); } @@ -4548,7 +4548,7 @@ static void dynamic_paint_paint_particle_cell_point_cb_ex( ParticleData *pa = psys->particles + part_index; mul_v3_v3fl(velocity, pa->state.vel, particle_timestep); - /* substract canvas point velocity */ + /* subtract canvas point velocity */ if (bData->velocity) { sub_v3_v3(velocity, bData->velocity[index].v); } @@ -4739,7 +4739,7 @@ static void dynamic_paint_paint_single_point_cb_ex(void *__restrict userdata, if (brush->flags & MOD_DPAINT_USES_VELOCITY) { float velocity[3]; - /* substract canvas point velocity */ + /* subtract canvas point velocity */ if (bData->velocity) { sub_v3_v3v3(velocity, brushVelocity->v, bData->velocity[index].v); } diff --git a/source/blender/blenkernel/intern/editmesh_bvh.c b/source/blender/blenkernel/intern/editmesh_bvh.c index 72793919570..dc194f0077c 100644 --- a/source/blender/blenkernel/intern/editmesh_bvh.c +++ b/source/blender/blenkernel/intern/editmesh_bvh.c @@ -563,8 +563,7 @@ static bool bmbvh_overlap_cb(void *userdata, int index_a, int index_b, int UNUSE } } - return (isect_tri_tri_epsilon_v3( - UNPACK3(tri_a_co), UNPACK3(tri_b_co), ix_pair[0], ix_pair[1], data->epsilon) && + return (isect_tri_tri_v3(UNPACK3(tri_a_co), UNPACK3(tri_b_co), ix_pair[0], ix_pair[1]) && /* if we share a vertex, check the intersection isn't a 'point' */ ((verts_shared == 0) || (len_squared_v3v3(ix_pair[0], ix_pair[1]) > data->epsilon))); } diff --git a/source/blender/blenkernel/intern/fcurve_test.cc b/source/blender/blenkernel/intern/fcurve_test.cc index 2248cce37e5..a6f65a7c9b3 100644 --- a/source/blender/blenkernel/intern/fcurve_test.cc +++ b/source/blender/blenkernel/intern/fcurve_test.cc @@ -19,13 +19,11 @@ #include "MEM_guardedalloc.h" -extern "C" { #include "BKE_fcurve.h" #include "ED_keyframing.h" #include "DNA_anim_types.h" -} namespace blender::bke::tests { diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c index 286da4977e3..079b436a3ea 100644 --- a/source/blender/blenkernel/intern/fluid.c +++ b/source/blender/blenkernel/intern/fluid.c @@ -4856,6 +4856,7 @@ void BKE_fluid_modifier_create_type_data(struct FluidModifierData *fmd) fmd->domain->particle_radius = 1.0f; fmd->domain->particle_band_width = 3.0f; fmd->domain->fractions_threshold = 0.05f; + fmd->domain->sys_particle_maximum = 0; /* diffusion options*/ fmd->domain->surface_tension = 0.0f; @@ -5100,6 +5101,7 @@ void BKE_fluid_modifier_copy(const struct FluidModifierData *fmd, tfds->particle_radius = fds->particle_radius; tfds->particle_band_width = fds->particle_band_width; tfds->fractions_threshold = fds->fractions_threshold; + tfds->sys_particle_maximum = fds->sys_particle_maximum; /* diffusion options*/ tfds->surface_tension = fds->surface_tension; diff --git a/source/blender/blenkernel/intern/gpencil_curve.c b/source/blender/blenkernel/intern/gpencil_curve.c index 66e9e2184c1..a7adbed6c4b 100644 --- a/source/blender/blenkernel/intern/gpencil_curve.c +++ b/source/blender/blenkernel/intern/gpencil_curve.c @@ -363,7 +363,7 @@ static void gpencil_convert_spline(Main *bmain, BKE_nurb_makeCurve(nu, coord_array, NULL, NULL, NULL, resolu, sizeof(float[3])); /* Allocate memory for storage points. */ - gps->totpoints = nurb_points - 1; + gps->totpoints = nurb_points; gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points"); /* Add points. */ diff --git a/source/blender/blenkernel/intern/gpencil_geom.c b/source/blender/blenkernel/intern/gpencil_geom.c index 5b7753428f7..579ebc9b9b3 100644 --- a/source/blender/blenkernel/intern/gpencil_geom.c +++ b/source/blender/blenkernel/intern/gpencil_geom.c @@ -2427,7 +2427,7 @@ void BKE_gpencil_convert_mesh(Main *bmain, * \param gpd: Grease pencil data-block * \param mat: Transformation matrix */ -void BKE_gpencil_transform(bGPdata *gpd, float mat[4][4]) +void BKE_gpencil_transform(bGPdata *gpd, const float mat[4][4]) { if (gpd == NULL) { return; diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 46a41df0391..a71b9cc2a1d 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1547,6 +1547,134 @@ float *BKE_key_evaluate_object(Object *ob, int *r_totelem) return BKE_key_evaluate_object_ex(ob, r_totelem, NULL, 0); } +/** + * \param shape_index: The index to use or all (when -1). + */ +int BKE_keyblock_element_count_from_shape(const Key *key, const int shape_index) +{ + int result = 0; + int index = 0; + for (const KeyBlock *kb = key->block.first; kb; kb = kb->next, index++) { + if ((shape_index == -1) || (index == shape_index)) { + result += kb->totelem; + } + } + return result; +} + +int BKE_keyblock_element_count(const Key *key) +{ + return BKE_keyblock_element_count_from_shape(key, -1); +} + +/** + * \param shape_index: The index to use or all (when -1). + */ +size_t BKE_keyblock_element_calc_size_from_shape(const Key *key, const int shape_index) +{ + return (size_t)BKE_keyblock_element_count_from_shape(key, shape_index) * key->elemsize; +} + +size_t BKE_keyblock_element_calc_size(const Key *key) +{ + return BKE_keyblock_element_calc_size_from_shape(key, -1); +} + +/* -------------------------------------------------------------------- */ +/** \name Key-Block Data Access + * + * Utilities for getting/setting key data as a single array, + * use #BKE_keyblock_element_calc_size to allocate the size of the data needed. + * \{ */ + +/** + * \param shape_index: The index to use or all (when -1). + */ +void BKE_keyblock_data_get_from_shape(const Key *key, float (*arr)[3], const int shape_index) +{ + uint8_t *elements = (uint8_t *)arr; + int index = 0; + for (const KeyBlock *kb = key->block.first; kb; kb = kb->next, index++) { + if ((shape_index == -1) || (index == shape_index)) { + const int block_elem_len = kb->totelem * key->elemsize; + memcpy(elements, kb->data, block_elem_len); + elements += block_elem_len; + } + } +} + +void BKE_keyblock_data_get(const Key *key, float (*arr)[3]) +{ + BKE_keyblock_data_get_from_shape(key, arr, -1); +} + +/** + * Set the data to all key-blocks (or shape_index if != -1). + */ +void BKE_keyblock_data_set_with_mat4(Key *key, + const int shape_index, + const float (*coords)[3], + const float mat[4][4]) +{ + if (key->elemsize != sizeof(float[3])) { + BLI_assert(!"Invalid elemsize"); + return; + } + + const float(*elements)[3] = coords; + + int index = 0; + for (KeyBlock *kb = key->block.first; kb; kb = kb->next, index++) { + if ((shape_index == -1) || (index == shape_index)) { + const int block_elem_len = kb->totelem; + float(*block_data)[3] = (float(*)[3])kb->data; + for (int data_offset = 0; data_offset < block_elem_len; ++data_offset) { + const float *src_data = (const float *)(elements + data_offset); + float *dst_data = (float *)(block_data + data_offset); + mul_v3_m4v3(dst_data, mat, src_data); + } + elements += block_elem_len; + } + } +} + +/** + * Set the data for all key-blocks (or shape_index if != -1), + * transforming by \a mat. + */ +void BKE_keyblock_curve_data_set_with_mat4( + Key *key, const ListBase *nurb, const int shape_index, const void *data, const float mat[4][4]) +{ + const uint8_t *elements = data; + + int index = 0; + for (KeyBlock *kb = key->block.first; kb; kb = kb->next, index++) { + if ((shape_index == -1) || (index == shape_index)) { + const int block_elem_size = kb->totelem * key->elemsize; + BKE_keyblock_curve_data_transform(nurb, mat, elements, kb->data); + elements += block_elem_size; + } + } +} + +/** + * Set the data for all key-blocks (or shape_index if != -1). + */ +void BKE_keyblock_data_set(Key *key, const int shape_index, const void *data) +{ + const uint8_t *elements = data; + int index = 0; + for (KeyBlock *kb = key->block.first; kb; kb = kb->next, index++) { + if ((shape_index == -1) || (index == shape_index)) { + const int block_elem_size = kb->totelem * key->elemsize; + memcpy(kb->data, elements, block_elem_size); + elements += block_elem_size; + } + } +} + +/** \} */ + bool BKE_key_idtype_support(const short id_type) { switch (id_type) { @@ -1903,6 +2031,37 @@ void BKE_keyblock_update_from_curve(Curve *UNUSED(cu), KeyBlock *kb, ListBase *n } } +void BKE_keyblock_curve_data_transform(const ListBase *nurb, + const float mat[4][4], + const void *src_data, + void *dst_data) +{ + const float *src = src_data; + float *dst = dst_data; + for (Nurb *nu = nurb->first; nu; nu = nu->next) { + if (nu->bezt) { + for (int a = nu->pntsu; a; a--) { + for (int i = 0; i < 3; i++) { + mul_v3_m4v3(&dst[i * 3], mat, &src[i * 3]); + } + dst[9] = src[9]; + dst[10] = src[10]; + src += KEYELEM_FLOAT_LEN_BEZTRIPLE; + dst += KEYELEM_FLOAT_LEN_BEZTRIPLE; + } + } + else { + for (int a = nu->pntsu * nu->pntsv; a; a--) { + mul_v3_m4v3(dst, mat, src); + dst[3] = src[3]; + dst[4] = src[4]; + src += KEYELEM_FLOAT_LEN_BPOINT; + dst += KEYELEM_FLOAT_LEN_BPOINT; + } + } + } +} + void BKE_keyblock_convert_from_curve(Curve *cu, KeyBlock *kb, ListBase *nurb) { int tot; diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 8820434cbcf..4d523ffa2e0 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -672,7 +672,7 @@ void BKE_lattice_center_bounds(Lattice *lt, float cent[3]) mid_v3_v3v3(cent, min, max); } -void BKE_lattice_transform(Lattice *lt, float mat[4][4], bool do_keys) +void BKE_lattice_transform(Lattice *lt, const float mat[4][4], bool do_keys) { BPoint *bp = lt->def; int i = lt->pntsu * lt->pntsv * lt->pntsw; @@ -694,7 +694,7 @@ void BKE_lattice_transform(Lattice *lt, float mat[4][4], bool do_keys) } } -void BKE_lattice_translate(Lattice *lt, float offset[3], bool do_keys) +void BKE_lattice_translate(Lattice *lt, const float offset[3], bool do_keys) { int i, numVerts; diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index eb440de1a6f..a64e550579d 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -2161,7 +2161,7 @@ void BKE_id_full_name_get(char name[MAX_ID_FULL_NAME], const ID *id, char separa /** * Generate full name of the data-block (without ID code, but with library if any), - * with a 3-character prefix prepended indicating whether it comes from a library, + * with a 2 to 3 character prefix prepended indicating whether it comes from a library, * is overriding, has a fake or no user, etc. * * \note Result is unique to a given ID type in a given Main database. @@ -2170,11 +2170,13 @@ void BKE_id_full_name_get(char name[MAX_ID_FULL_NAME], const ID *id, char separa * will be filled with generated string. * \param separator_char: Character to use for separating name and library name. Can be 0 to use * default (' '). + * \param r_prefix_len: The length of the prefix added. */ void BKE_id_full_name_ui_prefix_get(char name[MAX_ID_FULL_NAME_UI], const ID *id, const bool add_lib_hint, - char separator_char) + char separator_char, + int *r_prefix_len) { int i = 0; @@ -2185,6 +2187,10 @@ void BKE_id_full_name_ui_prefix_get(char name[MAX_ID_FULL_NAME_UI], name[i++] = ' '; BKE_id_full_name_get(name + i, id, separator_char); + + if (r_prefix_len) { + *r_prefix_len = i; + } } /** diff --git a/source/blender/blenkernel/intern/lib_intern.h b/source/blender/blenkernel/intern/lib_intern.h index 9cc5db64d17..7305785573b 100644 --- a/source/blender/blenkernel/intern/lib_intern.h +++ b/source/blender/blenkernel/intern/lib_intern.h @@ -21,11 +21,8 @@ * \ingroup bke */ -#ifndef __LIB_INTERN_H__ -#define __LIB_INTERN_H__ +#pragma once extern BKE_library_free_notifier_reference_cb free_notifier_reference_cb; extern BKE_library_remap_editor_id_reference_cb remap_editor_id_reference_cb; - -#endif /* __LIB_INTERN_H__ */ diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c index 8e662892d30..2989c910c45 100644 --- a/source/blender/blenkernel/intern/lib_override.c +++ b/source/blender/blenkernel/intern/lib_override.c @@ -155,8 +155,8 @@ void BKE_lib_override_library_clear(IDOverrideLibrary *override, const bool do_i { BLI_assert(override != NULL); - if (override->runtime != NULL) { - BLI_ghash_clear(override->runtime, NULL, NULL); + if (!ELEM(NULL, override->runtime, override->runtime->rna_path_to_override_properties)) { + BLI_ghash_clear(override->runtime->rna_path_to_override_properties, NULL, NULL); } LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &override->properties) { @@ -176,8 +176,10 @@ void BKE_lib_override_library_free(struct IDOverrideLibrary **override, const bo BLI_assert(*override != NULL); if ((*override)->runtime != NULL) { - BLI_ghash_free((*override)->runtime, NULL, NULL); - (*override)->runtime = NULL; + if ((*override)->runtime->rna_path_to_override_properties != NULL) { + BLI_ghash_free((*override)->runtime->rna_path_to_override_properties, NULL, NULL); + } + MEM_SAFE_FREE((*override)->runtime); } BKE_lib_override_library_clear(*override, do_id_user); @@ -362,7 +364,11 @@ bool BKE_lib_override_library_create_from_tag(Main *bmain) static bool lib_override_hierarchy_recursive_tag(Main *bmain, ID *id, const uint tag) { - MainIDRelationsEntry *entry = BLI_ghash_lookup(bmain->relations->id_user_to_used, id); + void **entry_vp = BLI_ghash_lookup_p(bmain->relations->id_user_to_used, id); + if (entry_vp == NULL) { + /* Already processed. */ + return (id->tag & tag) != 0; + } /* This way we won't process again that ID should we encounter it again through another * relationship hierarchy. @@ -370,7 +376,12 @@ static bool lib_override_hierarchy_recursive_tag(Main *bmain, ID *id, const uint */ BKE_main_relations_ID_remove(bmain, id); - for (; entry != NULL; entry = entry->next) { + for (MainIDRelationsEntry *entry = *entry_vp; entry != NULL; entry = entry->next) { + if ((entry->usage_flag & IDWALK_CB_LOOPBACK) != 0) { + /* Never consider 'loop back' relationships ('from', 'parents', 'owner' etc. pointers) as + * actual dependencies. */ + continue; + } /* We only consider IDs from the same library. */ if (entry->id_pointer != NULL && (*entry->id_pointer)->lib == id->lib) { if (lib_override_hierarchy_recursive_tag(bmain, *entry->id_pointer, tag)) { @@ -383,7 +394,8 @@ static bool lib_override_hierarchy_recursive_tag(Main *bmain, ID *id, const uint } /** - * Tag all IDs in given \a bmain that use (depends on) given \a id_root ID. + * Tag all IDs in given \a bmain that are being used by given \a id_root ID or its dependencies, + * recursively. * * This will include all local IDs, and all IDs from the same library as the \a id_root. * @@ -606,19 +618,28 @@ bool BKE_lib_override_library_create( return success; } -/* We only build override GHash on request. */ -BLI_INLINE IDOverrideLibraryRuntime *override_library_rna_path_mapping_ensure( +BLI_INLINE IDOverrideLibraryRuntime *override_library_rna_path_runtime_ensure( IDOverrideLibrary *override) { if (override->runtime == NULL) { - override->runtime = BLI_ghash_new( + override->runtime = MEM_callocN(sizeof(*override->runtime), __func__); + } + return override->runtime; +} + +/* We only build override GHash on request. */ +BLI_INLINE GHash *override_library_rna_path_mapping_ensure(IDOverrideLibrary *override) +{ + IDOverrideLibraryRuntime *override_runtime = override_library_rna_path_runtime_ensure(override); + if (override_runtime->rna_path_to_override_properties == NULL) { + override_runtime->rna_path_to_override_properties = BLI_ghash_new( BLI_ghashutil_strhash_p_murmur, BLI_ghashutil_strcmp, __func__); for (IDOverrideLibraryProperty *op = override->properties.first; op != NULL; op = op->next) { - BLI_ghash_insert(override->runtime, op->rna_path, op); + BLI_ghash_insert(override_runtime->rna_path_to_override_properties, op->rna_path, op); } } - return override->runtime; + return override_runtime->rna_path_to_override_properties; } /** @@ -627,7 +648,7 @@ BLI_INLINE IDOverrideLibraryRuntime *override_library_rna_path_mapping_ensure( IDOverrideLibraryProperty *BKE_lib_override_library_property_find(IDOverrideLibrary *override, const char *rna_path) { - IDOverrideLibraryRuntime *override_runtime = override_library_rna_path_mapping_ensure(override); + GHash *override_runtime = override_library_rna_path_mapping_ensure(override); return BLI_ghash_lookup(override_runtime, rna_path); } @@ -645,8 +666,7 @@ IDOverrideLibraryProperty *BKE_lib_override_library_property_get(IDOverrideLibra op->rna_path = BLI_strdup(rna_path); BLI_addtail(&override->properties, op); - IDOverrideLibraryRuntime *override_runtime = override_library_rna_path_mapping_ensure( - override); + GHash *override_runtime = override_library_rna_path_mapping_ensure(override); BLI_ghash_insert(override_runtime, op->rna_path, op); if (r_created) { @@ -692,8 +712,11 @@ void lib_override_library_property_clear(IDOverrideLibraryProperty *op) void BKE_lib_override_library_property_delete(IDOverrideLibrary *override, IDOverrideLibraryProperty *override_property) { - if (override->runtime != NULL) { - BLI_ghash_remove(override->runtime, override_property->rna_path, NULL, NULL); + if (!ELEM(NULL, override->runtime, override->runtime->rna_path_to_override_properties)) { + BLI_ghash_remove(override->runtime->rna_path_to_override_properties, + override_property->rna_path, + NULL, + NULL); } lib_override_library_property_clear(override_property); BLI_freelinkN(&override->properties, override_property); @@ -1143,6 +1166,137 @@ void BKE_lib_override_library_main_operations_create(Main *bmain, const bool for #endif } +static bool lib_override_library_id_reset_do(Main *bmain, ID *id_root) +{ + bool was_op_deleted = false; + + LISTBASE_FOREACH_MUTABLE ( + IDOverrideLibraryProperty *, op, &id_root->override_library->properties) { + bool do_op_delete = true; + const bool is_collection = op->rna_prop_type == PROP_COLLECTION; + if (is_collection || op->rna_prop_type == PROP_POINTER) { + PointerRNA ptr_root, ptr_root_lib, ptr, ptr_lib; + PropertyRNA *prop, *prop_lib; + + RNA_pointer_create(id_root, &RNA_ID, id_root, &ptr_root); + RNA_pointer_create(id_root->override_library->reference, + &RNA_ID, + id_root->override_library->reference, + &ptr_root_lib); + + bool prop_exists = RNA_path_resolve_property(&ptr_root, op->rna_path, &ptr, &prop); + BLI_assert(prop_exists); + prop_exists = RNA_path_resolve_property(&ptr_root_lib, op->rna_path, &ptr_lib, &prop_lib); + + if (prop_exists) { + BLI_assert(ELEM(RNA_property_type(prop), PROP_POINTER, PROP_COLLECTION)); + BLI_assert(RNA_property_type(prop) == RNA_property_type(prop_lib)); + if (is_collection) { + ptr.type = RNA_property_pointer_type(&ptr, prop); + ptr_lib.type = RNA_property_pointer_type(&ptr_lib, prop_lib); + } + else { + ptr = RNA_property_pointer_get(&ptr, prop); + ptr_lib = RNA_property_pointer_get(&ptr_lib, prop_lib); + } + if (ptr.owner_id != NULL && ptr_lib.owner_id != NULL) { + BLI_assert(ptr.type == ptr_lib.type); + do_op_delete = !(RNA_struct_is_ID(ptr.type) && ptr.owner_id->override_library != NULL && + ptr.owner_id->override_library->reference == ptr_lib.owner_id); + } + } + } + + if (do_op_delete) { + BKE_lib_override_library_property_delete(id_root->override_library, op); + was_op_deleted = true; + } + } + + if (was_op_deleted) { + DEG_id_tag_update_ex(bmain, id_root, ID_RECALC_COPY_ON_WRITE); + IDOverrideLibraryRuntime *override_runtime = override_library_rna_path_runtime_ensure( + id_root->override_library); + override_runtime->tag |= IDOVERRIDE_LIBRARY_RUNTIME_TAG_NEEDS_RELOAD; + } + + return was_op_deleted; +} + +/** Reset all overrides in given \a id_root, while preserving ID relations. */ +void BKE_lib_override_library_id_reset(Main *bmain, ID *id_root) +{ + if (!ID_IS_OVERRIDE_LIBRARY_REAL(id_root)) { + return; + } + + if (lib_override_library_id_reset_do(bmain, id_root)) { + if (id_root->override_library->runtime != NULL && + (id_root->override_library->runtime->tag & IDOVERRIDE_LIBRARY_RUNTIME_TAG_NEEDS_RELOAD) != + 0) { + BKE_lib_override_library_update(bmain, id_root); + id_root->override_library->runtime->tag &= ~IDOVERRIDE_LIBRARY_RUNTIME_TAG_NEEDS_RELOAD; + } + } +} + +static void lib_override_library_id_hierarchy_recursive_reset(Main *bmain, ID *id_root) +{ + if (!ID_IS_OVERRIDE_LIBRARY_REAL(id_root)) { + return; + } + + void **entry_pp = BLI_ghash_lookup(bmain->relations->id_user_to_used, id_root); + if (entry_pp == NULL) { + /* Already processed. */ + return; + } + + lib_override_library_id_reset_do(bmain, id_root); + + /* This way we won't process again that ID should we encounter it again through another + * relationship hierarchy. + * Note that this does not free any memory from relations, so we can still use the entries. + */ + BKE_main_relations_ID_remove(bmain, id_root); + + for (MainIDRelationsEntry *entry = *entry_pp; entry != NULL; entry = entry->next) { + if ((entry->usage_flag & IDWALK_CB_LOOPBACK) != 0) { + /* Never consider 'loop back' relationships ('from', 'parents', 'owner' etc. pointers) as + * actual dependencies. */ + continue; + } + /* We only consider IDs from the same library. */ + if (entry->id_pointer != NULL) { + ID *id_entry = *entry->id_pointer; + if (id_entry->override_library != NULL) { + lib_override_library_id_hierarchy_recursive_reset(bmain, id_entry); + } + } + } +} + +/** Reset all overrides in given \a id_root and its dependencies, while preserving ID relations. */ +void BKE_lib_override_library_id_hierarchy_reset(Main *bmain, ID *id_root) +{ + BKE_main_relations_create(bmain, 0); + + lib_override_library_id_hierarchy_recursive_reset(bmain, id_root); + + BKE_main_relations_free(bmain); + + ID *id; + FOREACH_MAIN_ID_BEGIN (bmain, id) { + if (!ID_IS_OVERRIDE_LIBRARY_REAL(id) || id->override_library->runtime == NULL || + (id->override_library->runtime->tag & IDOVERRIDE_LIBRARY_RUNTIME_TAG_NEEDS_RELOAD) == 0) { + continue; + } + BKE_lib_override_library_update(bmain, id); + id->override_library->runtime->tag &= ~IDOVERRIDE_LIBRARY_RUNTIME_TAG_NEEDS_RELOAD; + } + FOREACH_MAIN_ID_END; +} + /** Set or clear given tag in all operations as unused in that override property data. */ void BKE_lib_override_library_operations_tag(struct IDOverrideLibraryProperty *override_property, const short tag, @@ -1300,6 +1454,12 @@ void BKE_lib_override_library_update(Main *bmain, ID *local) /* This is some kind of hard-coded 'always enforced override'... */ BKE_lib_id_swap(bmain, &local_key->id, &tmp_key->id); tmp_key->id.flag |= (local_key->id.flag & LIB_EMBEDDED_DATA_LIB_OVERRIDE); + /* The swap of local and tmp_id inverted those pointers, we need to redefine proper + * relationships. */ + *BKE_key_from_id_p(local) = local_key; + *BKE_key_from_id_p(tmp_id) = tmp_key; + local_key->from = local; + tmp_key->from = tmp_id; } /* Again, horribly inn-efficient in our case, we need something off-Main @@ -1320,6 +1480,7 @@ void BKE_lib_override_library_update(Main *bmain, ID *local) /* Full rebuild of Depsgraph! */ /* Note: this is really brute force, in theory updates from RNA should have handle this already, * but for now let's play it safe. */ + DEG_id_tag_update_ex(bmain, local, ID_RECALC_ALL); DEG_relations_tag_update(bmain); } diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 0e2d8fcf4c7..b0b542f6000 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -955,7 +955,8 @@ void BKE_object_material_remap_calc(Object *ob_dst, Object *ob_src, short *remap void BKE_object_material_array_assign(Main *bmain, struct Object *ob, struct Material ***matar, - short totcol) + int totcol, + const bool to_object_only) { int actcol_orig = ob->actcol; short i; @@ -966,7 +967,15 @@ void BKE_object_material_array_assign(Main *bmain, /* now we have the right number of slots */ for (i = 0; i < totcol; i++) { - BKE_object_material_assign(bmain, ob, (*matar)[i], i + 1, BKE_MAT_ASSIGN_USERPREF); + if (to_object_only && ob->matbits[i] == 0) { + /* If we only assign to object, and that slot uses obdata material, do nothing. */ + continue; + } + BKE_object_material_assign(bmain, + ob, + (*matar)[i], + i + 1, + to_object_only ? BKE_MAT_ASSIGN_OBJECT : BKE_MAT_ASSIGN_USERPREF); } if (actcol_orig > ob->totcol) { @@ -1710,6 +1719,29 @@ static void material_default_volume_init(Material *ma) nodeSetActive(ntree, output); } +static void material_default_holdout_init(Material *ma) +{ + bNodeTree *ntree = ntreeAddTree(NULL, "Shader Nodetree", ntreeType_Shader->idname); + ma->nodetree = ntree; + ma->use_nodes = true; + + bNode *holdout = nodeAddStaticNode(NULL, ntree, SH_NODE_HOLDOUT); + bNode *output = nodeAddStaticNode(NULL, ntree, SH_NODE_OUTPUT_MATERIAL); + + nodeAddLink(ntree, + holdout, + nodeFindSocket(holdout, SOCK_OUT, "Holdout"), + output, + nodeFindSocket(output, SOCK_IN, "Surface")); + + holdout->locx = 10.0f; + holdout->locy = 300.0f; + output->locx = 300.0f; + output->locy = 300.0f; + + nodeSetActive(ntree, output); +} + Material *BKE_material_default_empty(void) { return &default_material_empty; @@ -1755,6 +1787,7 @@ void BKE_materials_init(void) material_default_surface_init(&default_material_surface); material_default_volume_init(&default_material_volume); + material_default_holdout_init(&default_material_holdout); material_default_gpencil_init(&default_material_gpencil); } diff --git a/source/blender/blenkernel/intern/mball_tessellate.c b/source/blender/blenkernel/intern/mball_tessellate.c index ad178e76ef6..72b99bea0f4 100644 --- a/source/blender/blenkernel/intern/mball_tessellate.c +++ b/source/blender/blenkernel/intern/mball_tessellate.c @@ -315,7 +315,7 @@ static float densfunc(const MetaElem *ball, float x, float y, float z) float dist2; float dvec[3] = {x, y, z}; - mul_m4_v3((float(*)[4])ball->imat, dvec); + mul_m4_v3((const float(*)[4])ball->imat, dvec); switch (ball->type) { case MB_BALL: diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 48baedadd73..4822df3f063 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -95,7 +95,15 @@ static void mesh_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int /* This is a direct copy of a main mesh, so for now it has the same topology. */ mesh_dst->runtime.deformed_only = true; } - /* XXX WHAT? Why? Comment, please! And pretty sure this is not valid for regular Mesh copying? */ + /* This option is set for run-time meshes that have been copied from the current objects mode. + * Currently this is used for edit-mesh although it could be used for sculpt or other + * kinds of data specific to an objects mode. + * + * The flag signals that the mesh hasn't been modified from the data that generated it, + * allowing us to use the object-mode data for drawing. + * + * While this could be the callers responsibility, keep here since it's + * highly unlikely we want to create a duplicate and not use it for drawing. */ mesh_dst->runtime.is_original = false; /* Only do tessface if we have no polys. */ @@ -1305,7 +1313,7 @@ bool BKE_mesh_minmax(const Mesh *me, float r_min[3], float r_max[3]) return (me->totvert != 0); } -void BKE_mesh_transform(Mesh *me, float mat[4][4], bool do_keys) +void BKE_mesh_transform(Mesh *me, const float mat[4][4], bool do_keys) { int i; MVert *mvert = me->mvert; diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c index 9e5565d744a..a0f3bc9e74d 100644 --- a/source/blender/blenkernel/intern/mesh_convert.c +++ b/source/blender/blenkernel/intern/mesh_convert.c @@ -286,12 +286,14 @@ int BKE_mesh_nurbs_displist_to_mdata(Object *ob, } } else if (dl->type == DL_SURF) { - int tot; - totvert += dl->parts * dl->nr; - tot = (dl->parts - 1 + ((dl->flag & DL_CYCL_V) == 2)) * - (dl->nr - 1 + (dl->flag & DL_CYCL_U)); - totpoly += tot; - totloop += tot * 4; + if (dl->parts != 0) { + int tot; + totvert += dl->parts * dl->nr; + tot = (((dl->flag & DL_CYCL_U) ? 1 : 0) + (dl->nr - 1)) * + (((dl->flag & DL_CYCL_V) ? 1 : 0) + (dl->parts - 1)); + totpoly += tot; + totloop += tot * 4; + } } else if (dl->type == DL_INDEX3) { int tot; diff --git a/source/blender/blenkernel/intern/mesh_runtime.c b/source/blender/blenkernel/intern/mesh_runtime.c index 932423bc445..b9eb3876dde 100644 --- a/source/blender/blenkernel/intern/mesh_runtime.c +++ b/source/blender/blenkernel/intern/mesh_runtime.c @@ -43,8 +43,6 @@ /** \name Mesh Runtime Struct Utils * \{ */ -static ThreadRWMutex loops_cache_lock = PTHREAD_RWLOCK_INITIALIZER; - /** * Default values defined at read time. */ @@ -159,23 +157,21 @@ const MLoopTri *BKE_mesh_runtime_looptri_ensure(Mesh *mesh) { MLoopTri *looptri; - BLI_rw_mutex_lock(&loops_cache_lock, THREAD_LOCK_READ); + ThreadMutex *mesh_eval_mutex = (ThreadMutex *)mesh->runtime.eval_mutex; + BLI_mutex_lock(mesh_eval_mutex); + looptri = mesh->runtime.looptris.array; - BLI_rw_mutex_unlock(&loops_cache_lock); if (looptri != NULL) { BLI_assert(BKE_mesh_runtime_looptri_len(mesh) == mesh->runtime.looptris.len); } else { - BLI_rw_mutex_lock(&loops_cache_lock, THREAD_LOCK_WRITE); - /* We need to ensure array is still NULL inside mutex-protected code, - * some other thread might have already recomputed those looptris. */ - if (mesh->runtime.looptris.array == NULL) { - BKE_mesh_runtime_looptri_recalc(mesh); - } + BKE_mesh_runtime_looptri_recalc(mesh); looptri = mesh->runtime.looptris.array; - BLI_rw_mutex_unlock(&loops_cache_lock); } + + BLI_mutex_unlock(mesh_eval_mutex); + return looptri; } diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index f64ed609d18..4d8c0568eb6 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -547,6 +547,16 @@ bool BKE_mesh_validate_arrays(Mesh *mesh, for (i = 0, mp = mpolys; i < totpoly; i++, mp++, sp++) { sp->index = i; + /* Material index, isolated from other tests here. While large indices are clamped, + * negative indices aren't supported by drawing, exporters etc. + * To check the indices are in range, use #BKE_mesh_validate_material_indices */ + if (mp->mat_nr < 0) { + PRINT_ERR("\tPoly %u has invalid material (%d)", sp->index, mp->mat_nr); + if (do_fixes) { + mp->mat_nr = 0; + } + } + if (mp->loopstart < 0 || mp->totloop < 3) { /* Invalid loop data. */ PRINT_ERR("\tPoly %u is invalid (loopstart: %d, totloop: %d)", @@ -1133,14 +1143,15 @@ bool BKE_mesh_is_valid(Mesh *me) */ bool BKE_mesh_validate_material_indices(Mesh *me) { + /* Cast to unsigned to catch negative indices too. */ + const uint16_t mat_nr_max = max_ii(0, me->totcol - 1); MPoly *mp; - const int max_idx = max_ii(0, me->totcol - 1); const int totpoly = me->totpoly; int i; bool is_valid = true; for (mp = me->mpoly, i = 0; i < totpoly; i++, mp++) { - if (mp->mat_nr > max_idx) { + if ((uint16_t)mp->mat_nr > mat_nr_max) { mp->mat_nr = 0; is_valid = false; } diff --git a/source/blender/blenkernel/intern/mesh_wrapper.c b/source/blender/blenkernel/intern/mesh_wrapper.c index 6a8bc698b11..acd272ac305 100644 --- a/source/blender/blenkernel/intern/mesh_wrapper.c +++ b/source/blender/blenkernel/intern/mesh_wrapper.c @@ -40,6 +40,7 @@ #include "BLI_ghash.h" #include "BLI_math.h" +#include "BLI_threads.h" #include "BLI_utildefines.h" #include "BKE_editmesh.h" @@ -96,9 +97,14 @@ Mesh *BKE_mesh_wrapper_from_editmesh(BMEditMesh *em, void BKE_mesh_wrapper_ensure_mdata(Mesh *me) { + ThreadMutex *mesh_eval_mutex = (ThreadMutex *)me->runtime.eval_mutex; + BLI_mutex_lock(mesh_eval_mutex); + if (me->runtime.wrapper_type == ME_WRAPPER_TYPE_MDATA) { + BLI_mutex_unlock(mesh_eval_mutex); return; } + const eMeshWrapperType geom_type_orig = me->runtime.wrapper_type; me->runtime.wrapper_type = ME_WRAPPER_TYPE_MDATA; @@ -130,6 +136,8 @@ void BKE_mesh_wrapper_ensure_mdata(Mesh *me) if (me->runtime.wrapper_type_finalize) { BKE_mesh_wrapper_deferred_finalize(me, &me->runtime.cd_mask_extra); } + + BLI_mutex_unlock(mesh_eval_mutex); } bool BKE_mesh_wrapper_minmax(const Mesh *me, float min[3], float max[3]) diff --git a/source/blender/blenkernel/intern/multires_inline.h b/source/blender/blenkernel/intern/multires_inline.h index 3d00101ec29..49329698b3a 100644 --- a/source/blender/blenkernel/intern/multires_inline.h +++ b/source/blender/blenkernel/intern/multires_inline.h @@ -21,8 +21,7 @@ * \ingroup bke */ -#ifndef __MULTIRES_INLINE_H__ -#define __MULTIRES_INLINE_H__ +#pragma once #include "BKE_multires.h" #include "BLI_math_vector.h" @@ -57,5 +56,3 @@ BLI_INLINE void BKE_multires_construct_tangent_matrix(float tangent_matrix[3][3] normalize_v3(tangent_matrix[1]); normalize_v3(tangent_matrix[2]); } - -#endif /* __MULTIRES_INLINE_H__ */ diff --git a/source/blender/blenkernel/intern/multires_reshape.h b/source/blender/blenkernel/intern/multires_reshape.h index 12816a455ee..d6c1d79dfd7 100644 --- a/source/blender/blenkernel/intern/multires_reshape.h +++ b/source/blender/blenkernel/intern/multires_reshape.h @@ -21,8 +21,7 @@ * \ingroup bke */ -#ifndef __BKE_INTERN_MULTIRES_RESHAPE_H__ -#define __BKE_INTERN_MULTIRES_RESHAPE_H__ +#pragma once #include "BLI_sys_types.h" @@ -331,4 +330,3 @@ void multires_reshape_apply_base_refine_from_base(MultiresReshapeContext *reshap * * NOTE: Will re-evaluate all leading modifiers, so it's not cheap. */ void multires_reshape_apply_base_refine_from_deform(MultiresReshapeContext *reshape_context); -#endif /* __BKE_INTERN_MULTIRES_RESHAPE_H__ */ diff --git a/source/blender/blenkernel/intern/multires_unsubdivide.h b/source/blender/blenkernel/intern/multires_unsubdivide.h index e00a1ae6d8b..39c6da0b6c8 100644 --- a/source/blender/blenkernel/intern/multires_unsubdivide.h +++ b/source/blender/blenkernel/intern/multires_unsubdivide.h @@ -21,8 +21,7 @@ * \ingroup bke */ -#ifndef __BKE_INTERN_MULTIRES_UNSUBDIVIDE_H__ -#define __BKE_INTERN_MULTIRES_UNSUBDIVIDE_H__ +#pragma once #include "BLI_sys_types.h" @@ -90,5 +89,3 @@ void multires_unsubdivide_context_free(MultiresUnsubdivideContext *context); /* Rebuilds all subdivision to the level 0 base mesh. */ bool multires_unsubdivide_to_basemesh(MultiresUnsubdivideContext *context); - -#endif /* __BKE_INTERN_MULTIRES_UNSUBDIVIDE_H__ */ diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 33c5343e410..ecb2256d080 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2344,7 +2344,7 @@ void BKE_object_tfm_copy(Object *object_dst, const Object *object_src) #undef TFMCPY4D } -void BKE_object_to_mat3(Object *ob, float mat[3][3]) /* no parent */ +void BKE_object_to_mat3(Object *ob, float r_mat[3][3]) /* no parent */ { float smat[3][3]; float rmat[3][3]; @@ -2355,38 +2355,38 @@ void BKE_object_to_mat3(Object *ob, float mat[3][3]) /* no parent */ /* rot */ BKE_object_rot_to_mat3(ob, rmat, true); - mul_m3_m3m3(mat, rmat, smat); + mul_m3_m3m3(r_mat, rmat, smat); } -void BKE_object_to_mat4(Object *ob, float mat[4][4]) +void BKE_object_to_mat4(Object *ob, float r_mat[4][4]) { float tmat[3][3]; BKE_object_to_mat3(ob, tmat); - copy_m4_m3(mat, tmat); + copy_m4_m3(r_mat, tmat); - add_v3_v3v3(mat[3], ob->loc, ob->dloc); + add_v3_v3v3(r_mat[3], ob->loc, ob->dloc); } -void BKE_object_matrix_local_get(struct Object *ob, float mat[4][4]) +void BKE_object_matrix_local_get(struct Object *ob, float r_mat[4][4]) { if (ob->parent) { float par_imat[4][4]; BKE_object_get_parent_matrix(ob, ob->parent, par_imat); invert_m4(par_imat); - mul_m4_m4m4(mat, par_imat, ob->obmat); + mul_m4_m4m4(r_mat, par_imat, ob->obmat); } else { - copy_m4_m4(mat, ob->obmat); + copy_m4_m4(r_mat, ob->obmat); } } /** * \return success if \a mat is set. */ -static bool ob_parcurve(Object *ob, Object *par, float mat[4][4]) +static bool ob_parcurve(Object *ob, Object *par, float r_mat[4][4]) { Curve *cu = par->data; float vec[4], dir[3], quat[4], radius, ctime; @@ -2420,34 +2420,34 @@ static bool ob_parcurve(Object *ob, Object *par, float mat[4][4]) } CLAMP(ctime, 0.0f, 1.0f); - unit_m4(mat); + unit_m4(r_mat); /* vec: 4 items! */ if (where_on_path(par, ctime, vec, dir, (cu->flag & CU_FOLLOW) ? quat : NULL, &radius, NULL)) { if (cu->flag & CU_FOLLOW) { quat_apply_track(quat, ob->trackflag, ob->upflag); normalize_qt(quat); - quat_to_mat4(mat, quat); + quat_to_mat4(r_mat, quat); } if (cu->flag & CU_PATH_RADIUS) { float tmat[4][4], rmat[4][4]; scale_m4_fl(tmat, radius); - mul_m4_m4m4(rmat, tmat, mat); - copy_m4_m4(mat, rmat); + mul_m4_m4m4(rmat, tmat, r_mat); + copy_m4_m4(r_mat, rmat); } - copy_v3_v3(mat[3], vec); + copy_v3_v3(r_mat[3], vec); } return true; } -static void ob_parbone(Object *ob, Object *par, float mat[4][4]) +static void ob_parbone(Object *ob, Object *par, float r_mat[4][4]) { bPoseChannel *pchan; float vec[3]; if (par->type != OB_ARMATURE) { - unit_m4(mat); + unit_m4(r_mat); return; } @@ -2456,7 +2456,7 @@ static void ob_parbone(Object *ob, Object *par, float mat[4][4]) if (!pchan || !pchan->bone) { CLOG_ERROR( &LOG, "Object %s with Bone parent: bone %s doesn't exist", ob->id.name + 2, ob->parsubstr); - unit_m4(mat); + unit_m4(r_mat); return; } @@ -2464,15 +2464,15 @@ static void ob_parbone(Object *ob, Object *par, float mat[4][4]) if (pchan->bone->flag & BONE_RELATIVE_PARENTING) { /* the new option uses the root - expected behavior, but differs from old... */ /* XXX check on version patching? */ - copy_m4_m4(mat, pchan->chan_mat); + copy_m4_m4(r_mat, pchan->chan_mat); } else { - copy_m4_m4(mat, pchan->pose_mat); + copy_m4_m4(r_mat, pchan->pose_mat); /* but for backwards compatibility, the child has to move to the tail */ - copy_v3_v3(vec, mat[1]); + copy_v3_v3(vec, r_mat[1]); mul_v3_fl(vec, pchan->bone->length); - add_v3_v3(mat[3], vec); + add_v3_v3(r_mat[3], vec); } } @@ -2594,7 +2594,7 @@ static void give_parvert(Object *par, int nr, float vec[3]) } } -static void ob_parvert3(Object *ob, Object *par, float mat[4][4]) +static void ob_parvert3(Object *ob, Object *par, float r_mat[4][4]) { /* in local ob space */ @@ -2607,16 +2607,16 @@ static void ob_parvert3(Object *ob, Object *par, float mat[4][4]) tri_to_quat(q, v1, v2, v3); quat_to_mat3(cmat, q); - copy_m4_m3(mat, cmat); + copy_m4_m3(r_mat, cmat); - mid_v3_v3v3v3(mat[3], v1, v2, v3); + mid_v3_v3v3v3(r_mat[3], v1, v2, v3); } else { - unit_m4(mat); + unit_m4(r_mat); } } -void BKE_object_get_parent_matrix(Object *ob, Object *par, float parentmat[4][4]) +void BKE_object_get_parent_matrix(Object *ob, Object *par, float r_parentmat[4][4]) { float tmat[4][4]; float vec[3]; @@ -2632,31 +2632,31 @@ void BKE_object_get_parent_matrix(Object *ob, Object *par, float parentmat[4][4] } if (ok) { - mul_m4_m4m4(parentmat, par->obmat, tmat); + mul_m4_m4m4(r_parentmat, par->obmat, tmat); } else { - copy_m4_m4(parentmat, par->obmat); + copy_m4_m4(r_parentmat, par->obmat); } break; case PARBONE: ob_parbone(ob, par, tmat); - mul_m4_m4m4(parentmat, par->obmat, tmat); + mul_m4_m4m4(r_parentmat, par->obmat, tmat); break; case PARVERT1: - unit_m4(parentmat); + unit_m4(r_parentmat); give_parvert(par, ob->par1, vec); - mul_v3_m4v3(parentmat[3], par->obmat, vec); + mul_v3_m4v3(r_parentmat[3], par->obmat, vec); break; case PARVERT3: ob_parvert3(ob, par, tmat); - mul_m4_m4m4(parentmat, par->obmat, tmat); + mul_m4_m4m4(r_parentmat, par->obmat, tmat); break; case PARSKEL: - copy_m4_m4(parentmat, par->obmat); + copy_m4_m4(r_parentmat, par->obmat); break; } } @@ -2672,7 +2672,7 @@ void BKE_object_get_parent_matrix(Object *ob, Object *par, float parentmat[4][4] * (without its own matrix applied) */ static void solve_parenting( - Object *ob, Object *par, float obmat[4][4], float r_originmat[3][3], const bool set_origin) + Object *ob, Object *par, const bool set_origin, float r_obmat[4][4], float r_originmat[3][3]) { float totmat[4][4]; float tmat[4][4]; @@ -2684,7 +2684,7 @@ static void solve_parenting( /* total */ mul_m4_m4m4(tmat, totmat, ob->parentinv); - mul_m4_m4m4(obmat, tmat, locmat); + mul_m4_m4m4(r_obmat, tmat, locmat); if (r_originmat) { /* usable originmat */ @@ -2714,7 +2714,7 @@ static void object_where_is_calc_ex(Depsgraph *depsgraph, Object *par = ob->parent; /* calculate parent matrix */ - solve_parenting(ob, par, ob->obmat, r_originmat, true); + solve_parenting(ob, par, true, ob->obmat, r_originmat); } else { BKE_object_to_mat4(ob, ob->obmat); @@ -2757,14 +2757,14 @@ void BKE_object_where_is_calc_time(Depsgraph *depsgraph, Scene *scene, Object *o * constraints -- assume dependencies are already solved by depsgraph. * no changes to object and it's parent would be done. * used for bundles orientation in 3d space relative to parented blender camera */ -void BKE_object_where_is_calc_mat4(Object *ob, float obmat[4][4]) +void BKE_object_where_is_calc_mat4(Object *ob, float r_obmat[4][4]) { if (ob->parent) { Object *par = ob->parent; - solve_parenting(ob, par, obmat, NULL, false); + solve_parenting(ob, par, false, r_obmat, NULL); } else { - BKE_object_to_mat4(ob, obmat); + BKE_object_to_mat4(ob, r_obmat); } } @@ -2825,8 +2825,11 @@ void BKE_object_workob_calc_parent(Depsgraph *depsgraph, Scene *scene, Object *o * \param use_compat: true to ensure that rotations are set using the * min difference between the old and new orientation. */ -void BKE_object_apply_mat4_ex( - Object *ob, float mat[4][4], Object *parent, float parentinv[4][4], const bool use_compat) +void BKE_object_apply_mat4_ex(Object *ob, + const float mat[4][4], + Object *parent, + const float parentinv[4][4], + const bool use_compat) { /* see BKE_pchan_apply_mat4() for the equivalent 'pchan' function */ @@ -2867,7 +2870,7 @@ void BKE_object_apply_mat4_ex( /* XXX: should be removed after COW operators port to use BKE_object_apply_mat4_ex directly */ void BKE_object_apply_mat4(Object *ob, - float mat[4][4], + const float mat[4][4], const bool use_compat, const bool use_parent) { @@ -2917,7 +2920,10 @@ void BKE_boundbox_calc_size_aabb(const BoundBox *bb, float r_size[3]) r_size[2] = 0.5f * fabsf(bb->vec[0][2] - bb->vec[1][2]); } -void BKE_boundbox_minmax(const BoundBox *bb, float obmat[4][4], float r_min[3], float r_max[3]) +void BKE_boundbox_minmax(const BoundBox *bb, + const float obmat[4][4], + float r_min[3], + float r_max[3]) { int i; for (i = 0; i < 8; i++) { @@ -3009,7 +3015,7 @@ void BKE_object_boundbox_calc_from_mesh(struct Object *ob, struct Mesh *me_eval) * \warning Setting dimensions is prone to feedback loops in evaluation. * \{ */ -void BKE_object_dimensions_get(Object *ob, float vec[3]) +void BKE_object_dimensions_get(Object *ob, float r_vec[3]) { BoundBox *bb = NULL; @@ -3019,12 +3025,12 @@ void BKE_object_dimensions_get(Object *ob, float vec[3]) mat4_to_size(scale, ob->obmat); - vec[0] = fabsf(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]); - vec[1] = fabsf(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]); - vec[2] = fabsf(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]); + r_vec[0] = fabsf(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]); + r_vec[1] = fabsf(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]); + r_vec[2] = fabsf(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]); } else { - zero_v3(vec); + zero_v3(r_vec); } } @@ -3062,9 +3068,9 @@ void BKE_object_dimensions_set_ex(Object *ob, } } - if (len[i] > 0.0f) { - - ob->scale[i] = copysignf(value[i] / len[i], ob->scale[i]); + const float scale = copysignf(value[i] / len[i], ob->scale[i]); + if (isfinite(scale)) { + ob->scale[i] = scale; } } } @@ -3293,7 +3299,7 @@ bool BKE_object_minmax_dupli(Depsgraph *depsgraph, } void BKE_object_foreach_display_point(Object *ob, - float obmat[4][4], + const float obmat[4][4], void (*func_cb)(const float[3], void *), void *user_data) { diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index f498e147110..fa2ea0a8e8f 100644 --- a/source/blender/blenkernel/intern/object_dupli.c +++ b/source/blender/blenkernel/intern/object_dupli.c @@ -30,6 +30,7 @@ #include "BLI_listbase.h" #include "BLI_string_utf8.h" +#include "BLI_alloca.h" #include "BLI_math.h" #include "BLI_rand.h" @@ -43,6 +44,7 @@ #include "BKE_collection.h" #include "BKE_duplilist.h" #include "BKE_editmesh.h" +#include "BKE_editmesh_cache.h" #include "BKE_font.h" #include "BKE_global.h" #include "BKE_idprop.h" @@ -61,7 +63,9 @@ #include "BLI_hash.h" #include "BLI_strict_flags.h" -/* Dupli-Geometry */ +/* -------------------------------------------------------------------- */ +/** \name Internal Duplicate Context + * \{ */ typedef struct DupliContext { Depsgraph *depsgraph; @@ -81,17 +85,19 @@ typedef struct DupliContext { const struct DupliGenerator *gen; /** Result containers. */ - ListBase *duplilist; /* legacy doubly-linked list */ + ListBase *duplilist; /* Legacy doubly-linked list. */ } DupliContext; typedef struct DupliGenerator { - short type; /* dupli type */ + short type; /* Dupli Type, see members of #OB_DUPLI. */ void (*make_duplis)(const DupliContext *ctx); } DupliGenerator; static const DupliGenerator *get_dupli_generator(const DupliContext *ctx); -/* create initial context for root object */ +/** + * Create initial context for root object. + */ static void init_context(DupliContext *r_ctx, Depsgraph *depsgraph, Scene *scene, @@ -118,7 +124,9 @@ static void init_context(DupliContext *r_ctx, r_ctx->duplilist = NULL; } -/* create sub-context for recursive duplis */ +/** + * Create sub-context for recursive duplis. + */ static void copy_dupli_context( DupliContext *r_ctx, const DupliContext *ctx, Object *ob, const float mat[4][4], int index) { @@ -140,15 +148,20 @@ static void copy_dupli_context( r_ctx->gen = get_dupli_generator(r_ctx); } -/* generate a dupli instance - * mat is transform of the object relative to current context (including object obmat) +/** + * Generate a dupli instance. + * + * \param mat: is transform of the object relative to current context (including #Object.obmat). */ -static DupliObject *make_dupli(const DupliContext *ctx, Object *ob, float mat[4][4], int index) +static DupliObject *make_dupli(const DupliContext *ctx, + Object *ob, + const float mat[4][4], + int index) { DupliObject *dob; int i; - /* add a DupliObject instance to the result container */ + /* Add a #DupliObject instance to the result container. */ if (ctx->duplilist) { dob = MEM_callocN(sizeof(DupliObject), "dupli object"); BLI_addtail(ctx->duplilist, dob); @@ -161,28 +174,28 @@ static DupliObject *make_dupli(const DupliContext *ctx, Object *ob, float mat[4] mul_m4_m4m4(dob->mat, (float(*)[4])ctx->space_mat, mat); dob->type = ctx->gen->type; - /* set persistent id, which is an array with a persistent index for each level + /* Set persistent id, which is an array with a persistent index for each level * (particle number, vertex number, ..). by comparing this we can find the same - * dupli object between frames, which is needed for motion blur. last level - * goes first in the array. */ + * dupli-object between frames, which is needed for motion blur. + * The last level is ordered first in the array. */ dob->persistent_id[0] = index; for (i = 1; i < ctx->level + 1; i++) { dob->persistent_id[i] = ctx->persistent_id[ctx->level - i]; } - /* fill rest of values with INT_MAX which index will never have as value */ + /* Fill rest of values with #INT_MAX which index will never have as value. */ for (; i < MAX_DUPLI_RECUR; i++) { dob->persistent_id[i] = INT_MAX; } - /* metaballs never draw in duplis, they are instead merged into one by the basis - * mball outside of the group. this does mean that if that mball is not in the + /* Meta-balls never draw in duplis, they are instead merged into one by the basis + * meta-ball outside of the group. this does mean that if that meta-ball is not in the * scene, they will not show up at all, limitation that should be solved once. */ if (ob->type == OB_MBALL) { dob->no_draw = true; } - /* random number */ - /* the logic here is designed to match Cycles */ + /* Random number. + * The logic here is designed to match Cycles. */ dob->random_id = BLI_hash_string(dob->ob->id.name + 2); if (dob->persistent_id[0] != INT_MAX) { @@ -201,15 +214,17 @@ static DupliObject *make_dupli(const DupliContext *ctx, Object *ob, float mat[4] return dob; } -/* recursive dupli objects - * space_mat is the local dupli space (excluding dupli object obmat!) +/** + * Recursive dupli-objects. + * + * \param space_mat: is the local dupli-space (excluding dupli #Object.obmat). */ static void make_recursive_duplis(const DupliContext *ctx, Object *ob, const float space_mat[4][4], int index) { - /* simple preventing of too deep nested collections with MAX_DUPLI_RECUR */ + /* Simple preventing of too deep nested collections with #MAX_DUPLI_RECUR. */ if (ctx->level < MAX_DUPLI_RECUR) { DupliContext rctx; copy_dupli_context(&rctx, ctx, ob, space_mat, index); @@ -219,7 +234,11 @@ static void make_recursive_duplis(const DupliContext *ctx, } } -/* ---- Child Duplis ---- */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Internal Child Duplicates (Used by Other Functions) + * \{ */ typedef void (*MakeChildDuplisFunc)(const DupliContext *ctx, void *userdata, Object *child); @@ -235,7 +254,9 @@ static bool is_child(const Object *ob, const Object *parent) return false; } -/* create duplis from every child in scene or collection */ +/** + * Create duplis from every child in scene or collection. + */ static void make_child_duplis(const DupliContext *ctx, void *userdata, MakeChildDuplisFunc make_child_duplis_cb) @@ -249,9 +270,9 @@ static void make_child_duplis(const DupliContext *ctx, DupliContext pctx; copy_dupli_context(&pctx, ctx, ctx->object, NULL, _base_id); - /* metaballs have a different dupli handling */ + /* Meta-balls have a different dupli handling. */ if (ob->type != OB_MBALL) { - ob->flag |= OB_DONE; /* doesn't render */ + ob->flag |= OB_DONE; /* Doesn't render. */ } make_child_duplis_cb(&pctx, userdata, ob); } @@ -267,9 +288,9 @@ static void make_child_duplis(const DupliContext *ctx, DupliContext pctx; copy_dupli_context(&pctx, ctx, ctx->object, NULL, baseid); - /* metaballs have a different dupli handling */ + /* Meta-balls have a different dupli-handling. */ if (ob->type != OB_MBALL) { - ob->flag |= OB_DONE; /* doesn't render */ + ob->flag |= OB_DONE; /* Doesn't render. */ } make_child_duplis_cb(&pctx, userdata, ob); @@ -278,9 +299,63 @@ static void make_child_duplis(const DupliContext *ctx, } } -/*---- Implementations ----*/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Internal Data Access Utilities + * \{ */ + +static Mesh *mesh_data_from_duplicator_object(Object *ob, + BMEditMesh **r_em, + const float (**r_vert_coords)[3], + const float (**r_vert_normals)[3]) +{ + /* Gather mesh info. */ + BMEditMesh *em = BKE_editmesh_from_object(ob); + Mesh *me_eval; + + *r_em = NULL; + *r_vert_coords = NULL; + if (r_vert_normals != NULL) { + *r_vert_normals = NULL; + } + + /* We do not need any render-specific handling anymore, depsgraph takes care of that. */ + /* NOTE: Do direct access to the evaluated mesh: this function is used + * during meta balls evaluation. But even without those all the objects + * which are needed for correct instancing are already evaluated. */ + if (em != NULL) { + /* Note that this will only show deformation if #eModifierMode_OnCage is enabled. + * We could change this but it matches 2.7x behavior. */ + me_eval = em->mesh_eval_cage; + if ((me_eval == NULL) || (me_eval->runtime.wrapper_type == ME_WRAPPER_TYPE_BMESH)) { + EditMeshData *emd = me_eval ? me_eval->runtime.edit_data : NULL; + + /* Only assign edit-mesh in the case we can't use `me_eval`. */ + *r_em = em; + me_eval = NULL; + + if ((emd != NULL) && (emd->vertexCos != NULL)) { + *r_vert_coords = emd->vertexCos; + if (r_vert_normals != NULL) { + BKE_editmesh_cache_ensure_vert_normals(em, emd); + *r_vert_normals = emd->vertexNos; + } + } + } + } + else { + me_eval = BKE_object_get_evaluated_mesh(ob); + } + return me_eval; +} + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Dupli-Collection Implementation (#OB_DUPLICOLLECTION) + * \{ */ -/* OB_DUPLICOLLECTION */ static void make_duplis_collection(const DupliContext *ctx) { Object *ob = ctx->object; @@ -292,23 +367,23 @@ static void make_duplis_collection(const DupliContext *ctx) } collection = ob->instance_collection; - /* combine collection offset and obmat */ + /* Combine collection offset and `obmat`. */ unit_m4(collection_mat); sub_v3_v3(collection_mat[3], collection->instance_offset); mul_m4_m4m4(collection_mat, ob->obmat, collection_mat); - /* don't access 'ob->obmat' from now on. */ + /* Don't access 'ob->obmat' from now on. */ eEvaluationMode mode = DEG_get_mode(ctx->depsgraph); FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN (collection, cob, mode) { if (cob != ob) { float mat[4][4]; - /* collection dupli offset, should apply after everything else */ + /* Collection dupli-offset, should apply after everything else. */ mul_m4_m4m4(mat, collection_mat, cob->obmat); make_dupli(ctx, cob, mat, _base_id); - /* recursion */ + /* Recursion. */ make_recursive_duplis(ctx, cob, collection_mat, _base_id); } } @@ -320,125 +395,213 @@ static const DupliGenerator gen_dupli_collection = { make_duplis_collection /* make_duplis */ }; -/* OB_DUPLIVERTS */ -typedef struct VertexDupliData { - Mesh *me_eval; - BMEditMesh *edit_mesh; - int totvert; - float (*orco)[3]; - bool use_rotation; +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Dupli-Vertices Implementation (#OB_DUPLIVERTS for Geometry) + * \{ */ +/** Values shared between different mesh types. */ +typedef struct VertexDupliData_Params { + /** + * It's important we use this context instead of the `ctx` passed into #make_child_duplis + * since these won't match in the case of recursion. + */ const DupliContext *ctx; - Object *inst_ob; /* object to instantiate (argument for vertex map callback) */ - float child_imat[4][4]; -} VertexDupliData; + bool use_rotation; +} VertexDupliData_Params; + +typedef struct VertexDupliData_Mesh { + VertexDupliData_Params params; + + int totvert; + const MVert *mvert; + + const float (*orco)[3]; +} VertexDupliData_Mesh; + +typedef struct VertexDupliData_EditMesh { + VertexDupliData_Params params; + + BMEditMesh *em; + + /* Can be NULL. */ + const float (*vert_coords)[3]; + const float (*vert_normals)[3]; + + /** + * \note The edit-mesh may assign #DupliObject.orco in cases when a regular mesh wouldn't. + * For edit-meshes we only check for deformation, for regular meshes we check if #CD_ORCO exists. + * + * At the moment this isn't a meaningful difference since requesting #CD_ORCO causes the + * edit-mesh to be converted into a mesh. + */ + bool has_orco; +} VertexDupliData_EditMesh; + +/** + * \param no: The direction, + * currently this is copied from a `short[3]` normal without division. + * Can be null when \a use_rotation is false. + */ static void get_duplivert_transform(const float co[3], - const short no[3], - bool use_rotation, - short axis, - short upflag, - float mat[4][4]) + const float no[3], + const bool use_rotation, + const short axis, + const short upflag, + float r_mat[4][4]) { float quat[4]; const float size[3] = {1.0f, 1.0f, 1.0f}; if (use_rotation) { - /* construct rotation matrix from normals */ - float nor_f[3]; - nor_f[0] = (float)-no[0]; - nor_f[1] = (float)-no[1]; - nor_f[2] = (float)-no[2]; - vec_to_quat(quat, nor_f, axis, upflag); + /* Construct rotation matrix from normals. */ + float no_flip[3]; + negate_v3_v3(no_flip, no); + vec_to_quat(quat, no_flip, axis, upflag); } else { unit_qt(quat); } - loc_quat_size_to_mat4(mat, co, quat, size); + loc_quat_size_to_mat4(r_mat, co, quat, size); } -static void vertex_dupli(const VertexDupliData *vdd, - int index, - const float co[3], - const short no[3]) +static DupliObject *vertex_dupli(const DupliContext *ctx, + Object *inst_ob, + const float child_imat[4][4], + int index, + const float co[3], + const float no[3], + const bool use_rotation) { - Object *inst_ob = vdd->inst_ob; - DupliObject *dob; - float obmat[4][4], space_mat[4][4]; + /* `obmat` is transform to vertex. */ + float obmat[4][4]; + get_duplivert_transform(co, no, use_rotation, inst_ob->trackflag, inst_ob->upflag, obmat); + + float space_mat[4][4]; - /* obmat is transform to vertex */ - get_duplivert_transform(co, no, vdd->use_rotation, inst_ob->trackflag, inst_ob->upflag, obmat); - /* make offset relative to inst_ob using relative child transform */ - mul_mat3_m4_v3((float(*)[4])vdd->child_imat, obmat[3]); - /* apply obmat _after_ the local vertex transform */ + /* Make offset relative to inst_ob using relative child transform. */ + mul_mat3_m4_v3(child_imat, obmat[3]); + /* Apply `obmat` _after_ the local vertex transform. */ mul_m4_m4m4(obmat, inst_ob->obmat, obmat); - /* space matrix is constructed by removing obmat transform, - * this yields the worldspace transform for recursive duplis - */ + /* Space matrix is constructed by removing `obmat` transform, + * this yields the world-space transform for recursive duplis. */ mul_m4_m4m4(space_mat, obmat, inst_ob->imat); - dob = make_dupli(vdd->ctx, vdd->inst_ob, obmat, index); + DupliObject *dob = make_dupli(ctx, inst_ob, obmat, index); - if (vdd->orco) { - copy_v3_v3(dob->orco, vdd->orco[index]); - } + /* Recursion. */ + make_recursive_duplis(ctx, inst_ob, space_mat, index); - /* recursion */ - make_recursive_duplis(vdd->ctx, vdd->inst_ob, space_mat, index); + return dob; } -static void make_child_duplis_verts(const DupliContext *ctx, void *userdata, Object *child) +static void make_child_duplis_verts_from_mesh(const DupliContext *ctx, + void *userdata, + Object *inst_ob) { - VertexDupliData *vdd = userdata; - Mesh *me_eval = vdd->me_eval; + VertexDupliData_Mesh *vdd = userdata; + const bool use_rotation = vdd->params.use_rotation; - vdd->inst_ob = child; - invert_m4_m4(child->imat, child->obmat); - /* relative transform from parent to child space */ - mul_m4_m4m4(vdd->child_imat, child->imat, ctx->object->obmat); + const MVert *mvert = vdd->mvert; + const int totvert = vdd->totvert; - const MVert *mvert = me_eval->mvert; - for (int i = 0; i < me_eval->totvert; i++) { - vertex_dupli(vdd, i, mvert[i].co, mvert[i].no); + invert_m4_m4(inst_ob->imat, inst_ob->obmat); + /* Relative transform from parent to child space. */ + float child_imat[4][4]; + mul_m4_m4m4(child_imat, inst_ob->imat, ctx->object->obmat); + + const MVert *mv = mvert; + for (int i = 0; i < totvert; i++, mv++) { + const float *co = mv->co; + const float no[3] = {UNPACK3(mv->no)}; + DupliObject *dob = vertex_dupli(vdd->params.ctx, inst_ob, child_imat, i, co, no, use_rotation); + if (vdd->orco) { + copy_v3_v3(dob->orco, vdd->orco[i]); + } } } -static void make_duplis_verts(const DupliContext *ctx) +static void make_child_duplis_verts_from_editmesh(const DupliContext *ctx, + void *userdata, + Object *inst_ob) { - Object *parent = ctx->object; - VertexDupliData vdd; + VertexDupliData_EditMesh *vdd = userdata; + BMEditMesh *em = vdd->em; + const bool use_rotation = vdd->params.use_rotation; - vdd.ctx = ctx; - vdd.use_rotation = parent->transflag & OB_DUPLIROT; + invert_m4_m4(inst_ob->imat, inst_ob->obmat); + /* Relative transform from parent to child space. */ + float child_imat[4][4]; + mul_m4_m4m4(child_imat, inst_ob->imat, ctx->object->obmat); - /* gather mesh info */ - { - vdd.edit_mesh = BKE_editmesh_from_object(parent); - - /* We do not need any render-specific handling anymore, depsgraph takes care of that. */ - /* NOTE: Do direct access to the evaluated mesh: this function is used - * during meta balls evaluation. But even without those all the objects - * which are needed for correct instancing are already evaluated. */ - if (vdd.edit_mesh != NULL) { - vdd.me_eval = vdd.edit_mesh->mesh_eval_cage; + BMVert *v; + BMIter iter; + int i; + + const float(*vert_coords)[3] = vdd->vert_coords; + const float(*vert_normals)[3] = vdd->vert_normals; + + BM_ITER_MESH_INDEX (v, &iter, em->bm, BM_VERTS_OF_MESH, i) { + const float *co, *no; + if (vert_coords != NULL) { + co = vert_coords[i]; + no = vert_normals ? vert_normals[i] : NULL; } else { - vdd.me_eval = BKE_object_get_evaluated_mesh(parent); + co = v->co; + no = v->no; } - if (vdd.me_eval == NULL) { - return; + DupliObject *dob = vertex_dupli(vdd->params.ctx, inst_ob, child_imat, i, co, no, use_rotation); + if (vdd->has_orco) { + copy_v3_v3(dob->orco, v->co); } - - vdd.orco = CustomData_get_layer(&vdd.me_eval->vdata, CD_ORCO); - vdd.totvert = vdd.me_eval->totvert; } +} - make_child_duplis(ctx, &vdd, make_child_duplis_verts); +static void make_duplis_verts(const DupliContext *ctx) +{ + Object *parent = ctx->object; + const bool use_rotation = parent->transflag & OB_DUPLIROT; + + /* Gather mesh info. */ + BMEditMesh *em = NULL; + const float(*vert_coords)[3] = NULL; + const float(*vert_normals)[3] = NULL; + Mesh *me_eval = mesh_data_from_duplicator_object( + parent, &em, &vert_coords, use_rotation ? &vert_normals : NULL); + if (em == NULL && me_eval == NULL) { + return; + } - vdd.me_eval = NULL; + VertexDupliData_Params vdd_params = { + .ctx = ctx, + .use_rotation = use_rotation, + }; + + if (em != NULL) { + VertexDupliData_EditMesh vdd = { + .params = vdd_params, + .em = em, + .vert_coords = vert_coords, + .vert_normals = vert_normals, + .has_orco = (vert_coords != NULL), + }; + make_child_duplis(ctx, &vdd, make_child_duplis_verts_from_editmesh); + } + else { + VertexDupliData_Mesh vdd = { + .params = vdd_params, + .totvert = me_eval->totvert, + .mvert = me_eval->mvert, + .orco = CustomData_get_layer(&me_eval->vdata, CD_ORCO), + }; + make_child_duplis(ctx, &vdd, make_child_duplis_verts_from_mesh); + } } static const DupliGenerator gen_dupli_verts = { @@ -446,7 +609,12 @@ static const DupliGenerator gen_dupli_verts = { make_duplis_verts /* make_duplis */ }; -/* OB_DUPLIVERTS - FONT */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Dupli-Vertices Implementation (#OB_DUPLIVERTS for 3D Text) + * \{ */ + static Object *find_family_object( Main *bmain, const char *family, size_t family_len, unsigned int ch, GHash *family_gh) { @@ -463,7 +631,7 @@ static Object *find_family_object( ch_utf8_len = BLI_str_utf8_from_unicode(ch, ch_utf8); ch_utf8[ch_utf8_len] = '\0'; - ch_utf8_len += 1; /* compare with null terminator */ + ch_utf8_len += 1; /* Compare with null terminator. */ for (ob = bmain->objects.first; ob; ob = ob->id.next) { if (STREQLEN(ob->id.name + 2 + family_len, ch_utf8, ch_utf8_len)) { @@ -473,7 +641,7 @@ static Object *find_family_object( } } - /* inserted value can be NULL, just to save searches in future */ + /* Inserted value can be NULL, just to save searches in future. */ BLI_ghash_insert(family_gh, ch_key, ob); } @@ -493,14 +661,14 @@ static void make_duplis_font(const DupliContext *ctx) const char32_t *text = NULL; bool text_free = false; - /* font dupliverts not supported inside collections */ + /* Font dupli-verts not supported inside collections. */ if (ctx->collection) { return; } copy_m4_m4(pmat, par->obmat); - /* in par the family name is stored, use this to find the other objects */ + /* In `par` the family name is stored, use this to find the other objects. */ BKE_vfont_to_curve_ex( par, par->data, FO_DUPLI, NULL, &text, &text_len, &text_free, &chartransdata); @@ -516,19 +684,19 @@ static void make_duplis_font(const DupliContext *ctx) ct = chartransdata; - /* cache result */ + /* Cache result. */ family_len = strlen(cu->family); family_gh = BLI_ghash_int_new_ex(__func__, 256); /* Safety check even if it might fail badly when called for original object. */ const bool is_eval_curve = DEG_is_evaluated_id(&cu->id); - /* advance matching BLI_strncpy_wchar_from_utf8 */ + /* Advance matching BLI_str_utf8_as_utf32. */ for (a = 0; a < text_len; a++, ct++) { - /* XXX That G.main is *really* ugly, but not sure what to do here... - * Definitively don't think it would be safe to put back Main *bmain pointer - * in DupliContext as done in 2.7x? */ + /* XXX That G.main is *really* ugly, but not sure what to do here. + * Definitively don't think it would be safe to put back `Main *bmain` pointer + * in #DupliContext as done in 2.7x? */ ob = find_family_object(G.main, cu->family, family_len, (unsigned int)text[a], family_gh); if (is_eval_curve) { @@ -573,38 +741,71 @@ static const DupliGenerator gen_dupli_verts_font = { make_duplis_font /* make_duplis */ }; -/* OB_DUPLIFACES */ -typedef struct FaceDupliData { - Mesh *me_eval; - int totface; - MPoly *mpoly; - MLoop *mloop; - MVert *mvert; - float (*orco)[3]; - MLoopUV *mloopuv; +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Dupli-Faces Implementation (#OB_DUPLIFACES) + * \{ */ + +/** Values shared between different mesh types. */ +typedef struct FaceDupliData_Params { + /** + * It's important we use this context instead of the `ctx` passed into #make_child_duplis + * since these won't match in the case of recursion. + */ + const DupliContext *ctx; + bool use_scale; -} FaceDupliData; +} FaceDupliData_Params; -static void get_dupliface_transform( - MPoly *mpoly, MLoop *mloop, MVert *mvert, bool use_scale, float scale_fac, float mat[4][4]) +typedef struct FaceDupliData_Mesh { + FaceDupliData_Params params; + + int totface; + const MPoly *mpoly; + const MLoop *mloop; + const MVert *mvert; + const float (*orco)[3]; + const MLoopUV *mloopuv; +} FaceDupliData_Mesh; + +typedef struct FaceDupliData_EditMesh { + FaceDupliData_Params params; + + BMEditMesh *em; + + bool has_orco, has_uvs; + int cd_loop_uv_offset; + /* Can be NULL. */ + const float (*vert_coords)[3]; +} FaceDupliData_EditMesh; + +static void get_dupliface_transform_from_coords(const float coords[][3], + const int coords_len, + const bool use_scale, + const float scale_fac, + float r_mat[4][4]) { float loc[3], quat[4], scale, size[3]; - float f_no[3]; - /* location */ - BKE_mesh_calc_poly_center(mpoly, mloop, mvert, loc); - /* rotation */ + /* Location. */ + { + const float w = 1.0f / (float)coords_len; + zero_v3(loc); + for (int i = 0; i < coords_len; i++) { + madd_v3_v3fl(loc, coords[i], w); + } + } + /* Rotation. */ { - const float *v1, *v2, *v3; - BKE_mesh_calc_poly_normal(mpoly, mloop, mvert, f_no); - v1 = mvert[mloop[0].v].co; - v2 = mvert[mloop[1].v].co; - v3 = mvert[mloop[2].v].co; - tri_to_quat_ex(quat, v1, v2, v3, f_no); + float f_no[3]; + cross_poly_v3(f_no, coords, (uint)coords_len); + normalize_v3(f_no); + tri_to_quat_ex(quat, coords[0], coords[1], coords[2], f_no); } - /* scale */ + /* Scale. */ if (use_scale) { - float area = BKE_mesh_calc_poly_area(mpoly, mloop, mvert); + const float area = area_poly_v3(coords, (uint)coords_len); scale = sqrtf(area) * scale_fac; } else { @@ -612,58 +813,131 @@ static void get_dupliface_transform( } size[0] = size[1] = size[2] = scale; - loc_quat_size_to_mat4(mat, loc, quat, size); + loc_quat_size_to_mat4(r_mat, loc, quat, size); } -static void make_child_duplis_faces(const DupliContext *ctx, void *userdata, Object *inst_ob) +static DupliObject *face_dupli(const DupliContext *ctx, + Object *inst_ob, + const float child_imat[4][4], + const int index, + const bool use_scale, + const float scale_fac, + const float (*coords)[3], + const int coords_len) { - FaceDupliData *fdd = userdata; - MPoly *mpoly = fdd->mpoly, *mp; - MLoop *mloop = fdd->mloop; - MVert *mvert = fdd->mvert; - float(*orco)[3] = fdd->orco; - MLoopUV *mloopuv = fdd->mloopuv; - int a, totface = fdd->totface; - float child_imat[4][4]; - DupliObject *dob; + float obmat[4][4]; + float space_mat[4][4]; - invert_m4_m4(inst_ob->imat, inst_ob->obmat); - /* relative transform from parent to child space */ - mul_m4_m4m4(child_imat, inst_ob->imat, ctx->object->obmat); + /* `obmat` is transform to face. */ + get_dupliface_transform_from_coords(coords, coords_len, use_scale, scale_fac, obmat); - for (a = 0, mp = mpoly; a < totface; a++, mp++) { - MLoop *loopstart = mloop + mp->loopstart; - float space_mat[4][4], obmat[4][4]; + /* Make offset relative to inst_ob using relative child transform. */ + mul_mat3_m4_v3(child_imat, obmat[3]); - if (UNLIKELY(mp->totloop < 3)) { - continue; - } + /* XXX ugly hack to ensure same behavior as in master. + * This should not be needed, #Object.parentinv is not consistent outside of parenting. */ + { + float imat[3][3]; + copy_m3_m4(imat, inst_ob->parentinv); + mul_m4_m3m4(obmat, imat, obmat); + } - /* obmat is transform to face */ - get_dupliface_transform( - mp, loopstart, mvert, fdd->use_scale, ctx->object->instance_faces_scale, obmat); - /* make offset relative to inst_ob using relative child transform */ - mul_mat3_m4_v3(child_imat, obmat[3]); - - /* XXX ugly hack to ensure same behavior as in master - * this should not be needed, parentinv is not consistent - * outside of parenting. - */ - { - float imat[3][3]; - copy_m3_m4(imat, inst_ob->parentinv); - mul_m4_m3m4(obmat, imat, obmat); - } + /* Apply `obmat` _after_ the local face transform. */ + mul_m4_m4m4(obmat, inst_ob->obmat, obmat); + + /* Space matrix is constructed by removing `obmat` transform, + * this yields the world-space transform for recursive duplis. */ + mul_m4_m4m4(space_mat, obmat, inst_ob->imat); + + DupliObject *dob = make_dupli(ctx, inst_ob, obmat, index); + + /* Recursion. */ + make_recursive_duplis(ctx, inst_ob, space_mat, index); + + return dob; +} + +/** Wrap #face_dupli, needed since we can't #alloca in a loop. */ +static DupliObject *face_dupli_from_mesh(const DupliContext *ctx, + Object *inst_ob, + const float child_imat[4][4], + const int index, + const bool use_scale, + const float scale_fac, + + /* Mesh variables. */ + const MPoly *mpoly, + const MLoop *mloopstart, + const MVert *mvert) +{ + const int coords_len = mpoly->totloop; + float(*coords)[3] = BLI_array_alloca(coords, (size_t)coords_len); + + const MLoop *ml = mloopstart; + for (int i = 0; i < coords_len; i++, ml++) { + copy_v3_v3(coords[i], mvert[ml->v].co); + } + + return face_dupli(ctx, inst_ob, child_imat, index, use_scale, scale_fac, coords, coords_len); +} + +/** Wrap #face_dupli, needed since we can't #alloca in a loop. */ +static DupliObject *face_dupli_from_editmesh(const DupliContext *ctx, + Object *inst_ob, + const float child_imat[4][4], + const int index, + const bool use_scale, + const float scale_fac, + + /* Mesh variables. */ + BMFace *f, + const float (*vert_coords)[3]) +{ + const int coords_len = f->len; + float(*coords)[3] = BLI_array_alloca(coords, (size_t)coords_len); + + BMLoop *l_first, *l_iter; + int i = 0; + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + if (vert_coords != NULL) { + do { + copy_v3_v3(coords[i++], vert_coords[BM_elem_index_get(l_iter->v)]); + } while ((l_iter = l_iter->next) != l_first); + } + else { + do { + copy_v3_v3(coords[i++], l_iter->v->co); + } while ((l_iter = l_iter->next) != l_first); + } + + return face_dupli(ctx, inst_ob, child_imat, index, use_scale, scale_fac, coords, coords_len); +} + +static void make_child_duplis_faces_from_mesh(const DupliContext *ctx, + void *userdata, + Object *inst_ob) +{ + FaceDupliData_Mesh *fdd = userdata; + const MPoly *mpoly = fdd->mpoly, *mp; + const MLoop *mloop = fdd->mloop; + const MVert *mvert = fdd->mvert; + const float(*orco)[3] = fdd->orco; + const MLoopUV *mloopuv = fdd->mloopuv; + const int totface = fdd->totface; + const bool use_scale = fdd->params.use_scale; + int a; - /* apply obmat _after_ the local face transform */ - mul_m4_m4m4(obmat, inst_ob->obmat, obmat); + float child_imat[4][4]; - /* space matrix is constructed by removing obmat transform, - * this yields the worldspace transform for recursive duplis - */ - mul_m4_m4m4(space_mat, obmat, inst_ob->imat); + invert_m4_m4(inst_ob->imat, inst_ob->obmat); + /* Relative transform from parent to child space. */ + mul_m4_m4m4(child_imat, inst_ob->imat, ctx->object->obmat); + const float scale_fac = ctx->object->instance_faces_scale; - dob = make_dupli(ctx, inst_ob, obmat, a); + for (a = 0, mp = mpoly; a < totface; a++, mp++) { + const MLoop *loopstart = mloop + mp->loopstart; + DupliObject *dob = face_dupli_from_mesh( + fdd->params.ctx, inst_ob, child_imat, a, use_scale, scale_fac, mp, loopstart, mvert); const float w = 1.0f / (float)mp->totloop; if (orco) { @@ -676,51 +950,90 @@ static void make_child_duplis_faces(const DupliContext *ctx, void *userdata, Obj madd_v2_v2fl(dob->uv, mloopuv[mp->loopstart + j].uv, w); } } - - /* recursion */ - make_recursive_duplis(ctx, inst_ob, space_mat, a); } } -static void make_duplis_faces(const DupliContext *ctx) +static void make_child_duplis_faces_from_editmesh(const DupliContext *ctx, + void *userdata, + Object *inst_ob) { - Object *parent = ctx->object; - FaceDupliData fdd; + FaceDupliData_EditMesh *fdd = userdata; + BMEditMesh *em = fdd->em; + float child_imat[4][4]; + int a; + BMFace *f; + BMIter iter; + const bool use_scale = fdd->params.use_scale; - fdd.use_scale = ((parent->transflag & OB_DUPLIFACES_SCALE) != 0); + const float(*vert_coords)[3] = fdd->vert_coords; - /* gather mesh info */ - { - BMEditMesh *em = BKE_editmesh_from_object(parent); - - /* We do not need any render-smecific handling anymore, depsgraph takes care of that. */ - /* NOTE: Do direct access to the evaluated mesh: this function is used - * during meta balls evaluation. But even without those all the objects - * which are needed for correct instancing are already evaluated. */ - if (em != NULL) { - fdd.me_eval = em->mesh_eval_cage; - } - else { - fdd.me_eval = BKE_object_get_evaluated_mesh(parent); - } + BLI_assert((vert_coords == NULL) || (em->bm->elem_index_dirty & BM_VERT) == 0); - if (fdd.me_eval == NULL) { - return; + invert_m4_m4(inst_ob->imat, inst_ob->obmat); + /* Relative transform from parent to child space. */ + mul_m4_m4m4(child_imat, inst_ob->imat, ctx->object->obmat); + const float scale_fac = ctx->object->instance_faces_scale; + + BM_ITER_MESH_INDEX (f, &iter, em->bm, BM_FACES_OF_MESH, a) { + DupliObject *dob = face_dupli_from_editmesh( + fdd->params.ctx, inst_ob, child_imat, a, use_scale, scale_fac, f, vert_coords); + + if (fdd->has_orco) { + const float w = 1.0f / (float)f->len; + BMLoop *l_first, *l_iter; + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + madd_v3_v3fl(dob->orco, l_iter->v->co, w); + } while ((l_iter = l_iter->next) != l_first); + } + if (fdd->has_uvs) { + BM_face_uv_calc_center_median(f, fdd->cd_loop_uv_offset, dob->uv); } + } +} - fdd.orco = CustomData_get_layer(&fdd.me_eval->vdata, CD_ORCO); - const int uv_idx = CustomData_get_render_layer(&fdd.me_eval->ldata, CD_MLOOPUV); - fdd.mloopuv = CustomData_get_layer_n(&fdd.me_eval->ldata, CD_MLOOPUV, uv_idx); +static void make_duplis_faces(const DupliContext *ctx) +{ + Object *parent = ctx->object; - fdd.totface = fdd.me_eval->totpoly; - fdd.mpoly = fdd.me_eval->mpoly; - fdd.mloop = fdd.me_eval->mloop; - fdd.mvert = fdd.me_eval->mvert; + /* Gather mesh info. */ + BMEditMesh *em = NULL; + const float(*vert_coords)[3] = NULL; + Mesh *me_eval = mesh_data_from_duplicator_object(parent, &em, &vert_coords, NULL); + if (em == NULL && me_eval == NULL) { + return; } - make_child_duplis(ctx, &fdd, make_child_duplis_faces); - - fdd.me_eval = NULL; + FaceDupliData_Params fdd_params = { + .ctx = ctx, + .use_scale = parent->transflag & OB_DUPLIFACES_SCALE, + }; + + if (em != NULL) { + const int uv_idx = CustomData_get_render_layer(&em->bm->ldata, CD_MLOOPUV); + FaceDupliData_EditMesh fdd = { + .params = fdd_params, + .em = em, + .vert_coords = vert_coords, + .has_orco = (vert_coords != NULL), + .has_uvs = (uv_idx != -1), + .cd_loop_uv_offset = CustomData_get_n_offset(&em->bm->ldata, CD_MLOOPUV, uv_idx), + }; + make_child_duplis(ctx, &fdd, make_child_duplis_faces_from_editmesh); + } + else { + const int uv_idx = CustomData_get_render_layer(&me_eval->ldata, CD_MLOOPUV); + FaceDupliData_Mesh fdd = { + .params = fdd_params, + .totface = me_eval->totpoly, + .mpoly = me_eval->mpoly, + .mloop = me_eval->mloop, + .mvert = me_eval->mvert, + .mloopuv = CustomData_get_layer_n(&me_eval->ldata, CD_MLOOPUV, uv_idx), + .orco = CustomData_get_layer(&me_eval->vdata, CD_ORCO), + }; + make_child_duplis(ctx, &fdd, make_child_duplis_faces_from_mesh); + } } static const DupliGenerator gen_dupli_faces = { @@ -728,7 +1041,12 @@ static const DupliGenerator gen_dupli_faces = { make_duplis_faces /* make_duplis */ }; -/* OB_DUPLIPARTS */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Dupli-Particles Implementation (#OB_DUPLIPARTS) + * \{ */ + static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem *psys) { Scene *scene = ctx->scene; @@ -769,7 +1087,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem no_draw_flag |= PARS_NO_DISP; } - /* NOTE: in old animsys, used parent object's timeoffset... */ + /* NOTE: in old animation system, used parent object's time-offset. */ ctime = DEG_get_ctime(ctx->depsgraph); totpart = psys->totpart; @@ -783,16 +1101,16 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem sim.ob = par; sim.psys = psys; sim.psmd = psys_get_modifier(par, psys); - /* make sure emitter imat is in global coordinates instead of render view coordinates */ + /* Make sure emitter `imat` is in global coordinates instead of render view coordinates. */ invert_m4_m4(par->imat, par->obmat); - /* first check for loops (particle system object used as dupli object) */ + /* First check for loops (particle system object used as dupli-object). */ if (part->ren_as == PART_DRAW_OB) { if (ELEM(part->instance_object, NULL, par)) { return; } } - else { /*PART_DRAW_GR */ + else { /* #PART_DRAW_GR. */ if (part->instance_collection == NULL) { return; } @@ -808,7 +1126,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem } } - /* if we have a hair particle system, use the path cache */ + /* If we have a hair particle system, use the path cache. */ if (part->type == PART_HAIR) { if (psys->flag & PSYS_HAIR_DONE) { hair = (totchild == 0 || psys->childcache) && psys->pathcache; @@ -817,7 +1135,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem return; } - /* we use cache, update totchild according to cached data */ + /* We use cache, update `totchild` according to cached data. */ totchild = psys->totchildcache; totpart = psys->totcached; } @@ -826,7 +1144,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem psys->lattice_deform_data = psys_create_lattice_deform_data(&sim); - /* gather list of objects or single object */ + /* Gather list of objects or single object. */ int totcollection = 0; const bool use_whole_collection = part->draw & PART_DRAW_WHOLE_GR; @@ -895,23 +1213,27 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem for (pa = psys->particles; a < totpart + totchild; a++, pa++) { if (a < totpart) { - /* handle parent particle */ + /* Handle parent particle. */ if (pa->flag & no_draw_flag) { continue; } - /* pa_num = pa->num; */ /* UNUSED */ +#if 0 /* UNUSED */ + pa_num = pa->num; +#endif size = pa->size; } else { - /* handle child particle */ + /* Handle child particle. */ cpa = &psys->child[a - totpart]; - /* pa_num = a; */ /* UNUSED */ +#if 0 /* UNUSED */ + pa_num = a; +#endif size = psys_get_child_size(psys, cpa, ctime, NULL); } - /* some hair paths might be non-existent so they can't be used for duplication */ + /* Some hair paths might be non-existent so they can't be used for duplication. */ if (hair && psys->pathcache && ((a < totpart && psys->pathcache[a]->segments < 0) || (a >= totpart && psys->childcache[a - totpart]->segments < 0))) { @@ -919,12 +1241,12 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem } if (part->ren_as == PART_DRAW_GR) { - /* prevent divide by zero below [#28336] */ + /* Prevent divide by zero below T28336. */ if (totcollection == 0) { continue; } - /* for collections, pick the object based on settings */ + /* For collections, pick the object based on settings. */ if (part->draw & PART_DRAW_RAND_GR && !use_whole_collection) { b = BLI_rng_get_int(rng) % totcollection; } @@ -936,7 +1258,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem } if (hair) { - /* hair we handle separate and compute transform based on hair keys */ + /* Hair we handle separate and compute transform based on hair keys. */ if (a < totpart) { cache = psys->pathcache[a]; psys_get_dupli_path_transform(&sim, pa, NULL, cache, pamat, &scale); @@ -950,7 +1272,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem pamat[3][3] = 1.0f; } else { - /* first key */ + /* First key. */ state.time = ctime; if (psys_get_particle_state(&sim, a, &state, 0) == 0) { continue; @@ -970,16 +1292,16 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem part->instance_collection, object, mode) { copy_m4_m4(tmat, oblist[b]->obmat); - /* apply particle scale */ + /* Apply particle scale. */ mul_mat3_m4_fl(tmat, size * scale); mul_v3_fl(tmat[3], size * scale); - /* collection dupli offset, should apply after everything else */ + /* Collection dupli-offset, should apply after everything else. */ if (!is_zero_v3(part->instance_collection->instance_offset)) { sub_v3_v3(tmat[3], part->instance_collection->instance_offset); } - /* individual particle transform */ + /* Individual particle transform. */ mul_m4_m4m4(mat, pamat, tmat); dob = make_dupli(ctx, object, mat, a); @@ -1013,13 +1335,13 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem quat_to_mat4(obmat, q); obmat[3][3] = 1.0f; - /* add scaling if requested */ + /* Add scaling if requested. */ if ((part->draw & PART_DRAW_NO_SCALE_OB) == 0) { mul_m4_m4m4(obmat, obmat, size_mat); } } else if (part->draw & PART_DRAW_NO_SCALE_OB) { - /* remove scaling */ + /* Remove scaling. */ float size_mat[4][4], original_size[3]; mat4_to_size(original_size, obmat); @@ -1047,7 +1369,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem BLI_rng_free(rng); } - /* clean up */ + /* Clean up. */ if (oblist) { MEM_freeN(oblist); } @@ -1063,9 +1385,9 @@ static void make_duplis_particles(const DupliContext *ctx) ParticleSystem *psys; int psysid; - /* particle system take up one level in id, the particles another */ + /* Particle system take up one level in id, the particles another. */ for (psys = ctx->object->particlesystem.first, psysid = 0; psys; psys = psys->next, psysid++) { - /* particles create one more level for persistent psys index */ + /* Particles create one more level for persistent `psys` index. */ DupliContext pctx; copy_dupli_context(&pctx, ctx, ctx->object, NULL, psysid); make_duplis_particle_system(&pctx, psys); @@ -1077,9 +1399,12 @@ static const DupliGenerator gen_dupli_particles = { make_duplis_particles /* make_duplis */ }; -/* ------------- */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Dupli-Generator Selector For The Given Context + * \{ */ -/* select dupli generator from given context */ static const DupliGenerator *get_dupli_generator(const DupliContext *ctx) { int transflag = ctx->object->transflag; @@ -1089,7 +1414,7 @@ static const DupliGenerator *get_dupli_generator(const DupliContext *ctx) return NULL; } - /* Should the dupli's be generated for this object? - Respect restrict flags */ + /* Should the dupli's be generated for this object? - Respect restrict flags. */ if (DEG_get_mode(ctx->depsgraph) == DAG_EVAL_RENDER ? (restrictflag & OB_RESTRICT_RENDER) : (restrictflag & OB_RESTRICT_VIEWPORT)) { return NULL; @@ -1118,9 +1443,15 @@ static const DupliGenerator *get_dupli_generator(const DupliContext *ctx) return NULL; } -/* ---- ListBase dupli container implementation ---- */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Dupli-Container Implementation + * \{ */ -/* Returns a list of DupliObject */ +/** + * \return a #ListBase of #DupliObject. + */ ListBase *object_duplilist(Depsgraph *depsgraph, Scene *sce, Object *ob) { ListBase *duplilist = MEM_callocN(sizeof(ListBase), "duplilist"); @@ -1139,3 +1470,5 @@ void free_object_duplilist(ListBase *lb) BLI_freelistN(lb); MEM_freeN(lb); } + +/** \} */ diff --git a/source/blender/blenkernel/intern/ocean_intern.h b/source/blender/blenkernel/intern/ocean_intern.h index 7da88419219..39ce0db09d6 100644 --- a/source/blender/blenkernel/intern/ocean_intern.h +++ b/source/blender/blenkernel/intern/ocean_intern.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BKE_OCEAN_INTERN_H__ -#define __BKE_OCEAN_INTERN_H__ +#pragma once /** \file * \ingroup bli @@ -133,5 +132,3 @@ typedef struct Ocean { #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 50feb8e99c8..0ba5ec43318 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -1314,6 +1314,13 @@ static void sculptsession_free_pbvh(Object *object) MEM_SAFE_FREE(ss->preview_vert_index_list); ss->preview_vert_index_count = 0; + + MEM_SAFE_FREE(ss->preview_vert_index_list); + + MEM_SAFE_FREE(ss->vertex_info.connected_component); + MEM_SAFE_FREE(ss->vertex_info.boundary); + + MEM_SAFE_FREE(ss->fake_neighbors.fake_neighbor_index); } void BKE_sculptsession_bm_to_me_for_render(Object *object) @@ -1366,13 +1373,6 @@ void BKE_sculptsession_free(Object *ob) MEM_SAFE_FREE(ss->deform_cos); MEM_SAFE_FREE(ss->deform_imats); - MEM_SAFE_FREE(ss->preview_vert_index_list); - - MEM_SAFE_FREE(ss->vertex_info.connected_component); - MEM_SAFE_FREE(ss->vertex_info.boundary); - - MEM_SAFE_FREE(ss->fake_neighbors.fake_neighbor_index); - if (ss->pose_ik_chain_preview) { for (int i = 0; i < ss->pose_ik_chain_preview->tot_segments; i++) { MEM_SAFE_FREE(ss->pose_ik_chain_preview->segments[i].weights); @@ -1484,7 +1484,7 @@ static void sculpt_update_object(Depsgraph *depsgraph, Mesh *me_eval, bool need_pmap, bool need_mask, - bool need_colors) + bool UNUSED(need_colors)) { Scene *scene = DEG_get_input_scene(depsgraph); Sculpt *sd = scene->toolsettings->sculpt; @@ -1514,16 +1514,6 @@ static void sculpt_update_object(Depsgraph *depsgraph, } } - /* Add a color layer if a color tool is used. */ - Mesh *orig_me = BKE_object_get_original_mesh(ob); - if (need_colors && U.experimental.use_sculpt_vertex_colors) { - if (!CustomData_has_layer(&orig_me->vdata, CD_PROP_COLOR)) { - CustomData_add_layer(&orig_me->vdata, CD_PROP_COLOR, CD_DEFAULT, NULL, orig_me->totvert); - BKE_mesh_update_customdata_pointers(orig_me, true); - DEG_id_tag_update(&orig_me->id, ID_RECALC_GEOMETRY); - } - } - /* tessfaces aren't used and will become invalid */ BKE_mesh_tessface_clear(me); @@ -1684,10 +1674,26 @@ void BKE_sculpt_update_object_after_eval(Depsgraph *depsgraph, Object *ob_eval) Mesh *me_eval = BKE_object_get_evaluated_mesh(ob_eval); BLI_assert(me_eval != NULL); - sculpt_update_object(depsgraph, ob_orig, me_eval, false, false, false); } +void BKE_sculpt_color_layer_create_if_needed(struct Object *object) +{ + Mesh *orig_me = BKE_object_get_original_mesh(object); + if (!U.experimental.use_sculpt_vertex_colors) { + return; + } + + if (CustomData_has_layer(&orig_me->vdata, CD_PROP_COLOR)) { + return; + } + + CustomData_add_layer(&orig_me->vdata, CD_PROP_COLOR, CD_DEFAULT, NULL, orig_me->totvert); + BKE_mesh_update_customdata_pointers(orig_me, true); + DEG_id_tag_update(&orig_me->id, ID_RECALC_GEOMETRY); + return; +} + void BKE_sculpt_update_object_for_edit( Depsgraph *depsgraph, Object *ob_orig, bool need_pmap, bool need_mask, bool need_colors) { @@ -1819,6 +1825,64 @@ static bool check_sculpt_object_deformed(Object *object, const bool for_construc return deformed; } +static void sculpt_sync_face_sets_visibility_to_base_mesh(Mesh *mesh) +{ + int *face_sets = CustomData_get_layer(&mesh->pdata, CD_SCULPT_FACE_SETS); + if (!face_sets) { + return; + } + + for (int i = 0; i < mesh->totvert; i++) { + mesh->mvert[i].flag |= ME_HIDE; + } + + for (int i = 0; i < mesh->totpoly; i++) { + if (face_sets[i] >= 0) { + for (int l = 0; l < mesh->mpoly[i].totloop; l++) { + MLoop *loop = &mesh->mloop[mesh->mpoly[i].loopstart + l]; + mesh->mvert[loop->v].flag &= ~ME_HIDE; + } + } + } +} + +static void sculpt_sync_face_sets_visibility_to_grids(Mesh *mesh, SubdivCCG *subdiv_ccg) +{ + int *face_sets = CustomData_get_layer(&mesh->pdata, CD_SCULPT_FACE_SETS); + if (!face_sets) { + return; + } + + if (!subdiv_ccg) { + return; + } + + CCGKey key; + BKE_subdiv_ccg_key_top_level(&key, subdiv_ccg); + for (int i = 0; i < mesh->totloop; i++) { + const int face_index = BKE_subdiv_ccg_grid_to_face_index(subdiv_ccg, i); + const bool is_hidden = (face_sets[face_index] < 0); + + /* Avoid creating and modifying the grid_hidden bitmap if the base mesh face is visible and + * there is not bitmap for the grid. This is because missing grid_hidden implies grid is fully + * visible. */ + if (is_hidden) { + BKE_subdiv_ccg_grid_hidden_ensure(subdiv_ccg, i); + } + + BLI_bitmap *gh = subdiv_ccg->grid_hidden[i]; + if (gh) { + BLI_bitmap_set_all(gh, is_hidden, key.grid_area); + } + } +} + +void BKE_sculpt_sync_face_set_visibility(struct Mesh *mesh, struct SubdivCCG *subdiv_ccg) +{ + sculpt_sync_face_sets_visibility_to_base_mesh(mesh); + sculpt_sync_face_sets_visibility_to_grids(mesh, subdiv_ccg); +} + static PBVH *build_pbvh_for_dynamic_topology(Object *ob) { PBVH *pbvh = BKE_pbvh_new(); @@ -1844,6 +1908,8 @@ static PBVH *build_pbvh_from_regular_mesh(Object *ob, Mesh *me_eval_deform, bool BKE_mesh_recalc_looptri(me->mloop, me->mpoly, me->mvert, me->totloop, me->totpoly, looptri); + BKE_sculpt_sync_face_set_visibility(me, NULL); + BKE_pbvh_build_mesh(pbvh, me, me->mpoly, @@ -1876,6 +1942,10 @@ static PBVH *build_pbvh_from_ccg(Object *ob, SubdivCCG *subdiv_ccg, bool respect BKE_subdiv_ccg_key_top_level(&key, subdiv_ccg); PBVH *pbvh = BKE_pbvh_new(); BKE_pbvh_respect_hide_set(pbvh, respect_hide); + + Mesh *base_mesh = BKE_mesh_from_object(ob); + BKE_sculpt_sync_face_set_visibility(base_mesh, subdiv_ccg); + BKE_pbvh_build_grids(pbvh, subdiv_ccg->grids, subdiv_ccg->num_grids, diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 67988427bd2..92a47f24240 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -644,7 +644,7 @@ void BKE_pbvh_build_grids(PBVH *pbvh, pbvh->totgrid = totgrid; pbvh->gridkey = *key; pbvh->grid_hidden = grid_hidden; - pbvh->leaf_limit = max_ii(LEAF_LIMIT / ((gridsize - 1) * (gridsize - 1)), 1); + pbvh->leaf_limit = max_ii(LEAF_LIMIT / (gridsize * gridsize), 1); BB cb; BB_reset(&cb); diff --git a/source/blender/blenkernel/intern/pbvh_intern.h b/source/blender/blenkernel/intern/pbvh_intern.h index 6f8bae822ea..63bc8753fc7 100644 --- a/source/blender/blenkernel/intern/pbvh_intern.h +++ b/source/blender/blenkernel/intern/pbvh_intern.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __PBVH_INTERN_H__ -#define __PBVH_INTERN_H__ +#pragma once /** \file * \ingroup bli @@ -235,5 +234,3 @@ bool pbvh_bmesh_node_nearest_to_ray(PBVHNode *node, bool use_original); void pbvh_bmesh_normals_update(PBVHNode **nodes, int totnode); - -#endif diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 31ae71622f7..d147ad9ee87 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -46,6 +46,7 @@ #include "BLI_listbase.h" #include "BLI_math.h" #include "BLI_path_util.h" +#include "BLI_session_uuid.h" #include "BLI_string.h" #include "BLI_string_utf8.h" #include "BLI_threads.h" @@ -3154,12 +3155,33 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, return ibuf; } +static ImBuf *seq_render_movie_strip_custom_file_proxy(const SeqRenderData *context, + Sequence *seq, + int cfra) +{ + char name[PROXY_MAXFILE]; + StripProxy *proxy = seq->strip->proxy; + + if (proxy->anim == NULL) { + if (seq_proxy_get_custom_file_fname(seq, name, context->view_id)) { + proxy->anim = openanim(name, IB_rect, 0, seq->strip->colorspace_settings.name); + } + if (proxy->anim == NULL) { + return NULL; + } + } + + int frameno = (int)BKE_sequencer_give_stripelem_index(seq, cfra) + seq->anim_startofs; + return IMB_anim_absolute(proxy->anim, frameno, IMB_TC_NONE, IMB_PROXY_NONE); +} + /** * Render individual view for multi-view or single (default view) for mono-view. */ static ImBuf *seq_render_movie_strip_view(const SeqRenderData *context, Sequence *seq, float nr, + float cfra, StripAnim *sanim, bool *r_is_proxy_image) { @@ -3169,10 +3191,19 @@ static ImBuf *seq_render_movie_strip_view(const SeqRenderData *context, IMB_anim_set_preseek(sanim->anim, seq->anim_preseek); if (seq_can_use_proxy(seq, psize)) { - ibuf = IMB_anim_absolute(sanim->anim, - nr + seq->anim_startofs, - seq->strip->proxy ? seq->strip->proxy->tc : IMB_TC_RECORD_RUN, - psize); + /* Try to get a proxy image. + * Movie proxies are handled by ImBuf module with exception of `custom file` setting. */ + if (context->scene->ed->proxy_storage != SEQ_EDIT_PROXY_DIR_STORAGE && + seq->strip->proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) { + ibuf = seq_render_movie_strip_custom_file_proxy(context, seq, cfra); + } + else { + ibuf = IMB_anim_absolute(sanim->anim, + nr + seq->anim_startofs, + seq->strip->proxy ? seq->strip->proxy->tc : IMB_TC_RECORD_RUN, + psize); + } + if (ibuf != NULL) { *r_is_proxy_image = true; } @@ -3221,7 +3252,7 @@ static ImBuf *seq_render_movie_strip( for (ibuf_view_id = 0, sanim = seq->anims.first; sanim; sanim = sanim->next, ibuf_view_id++) { if (sanim->anim) { ibuf_arr[ibuf_view_id] = seq_render_movie_strip_view( - context, seq, nr, sanim, r_is_proxy_image); + context, seq, nr, cfra, sanim, r_is_proxy_image); } } @@ -3258,7 +3289,7 @@ static ImBuf *seq_render_movie_strip( MEM_freeN(ibuf_arr); } else { - ibuf = seq_render_movie_strip_view(context, seq, nr, sanim, r_is_proxy_image); + ibuf = seq_render_movie_strip_view(context, seq, nr, cfra, sanim, r_is_proxy_image); } if (ibuf == NULL) { @@ -4301,6 +4332,10 @@ void BKE_sequence_invalidate_movieclip_strips(Main *bmain, MovieClip *clip_targe void BKE_sequencer_free_imbuf(Scene *scene, ListBase *seqbase, bool for_render) { + if (scene->ed == NULL) { + return; + } + Sequence *seq; BKE_sequencer_cache_cleanup(scene); @@ -5348,9 +5383,16 @@ Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine, int type) seq->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Sequence Stereo Format"); seq->cache_flag = SEQ_CACHE_STORE_RAW | SEQ_CACHE_STORE_PREPROCESSED | SEQ_CACHE_STORE_COMPOSITE; + BKE_sequence_session_uuid_generate(seq); + return seq; } +void BKE_sequence_session_uuid_generate(struct Sequence *sequence) +{ + sequence->runtime.session_uuid = BLI_session_uuid_generate(); +} + void BKE_sequence_alpha_mode_from_extension(Sequence *seq) { if (seq->strip && seq->strip->stripdata) { @@ -5580,6 +5622,9 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad } } + if (seq_load->flag & SEQ_LOAD_MOVIE_SOUND) { + seq_load->channel++; + } seq = BKE_sequence_alloc(seqbasep, seq_load->start_frame, seq_load->channel, SEQ_TYPE_MOVIE); /* multiview settings */ @@ -5636,11 +5681,8 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad if (seq_load->flag & SEQ_LOAD_MOVIE_SOUND) { int start_frame_back = seq_load->start_frame; seq_load->channel--; - seq_load->seq_sound = BKE_sequencer_add_sound_strip(C, seqbasep, seq_load); - seq_load->start_frame = start_frame_back; - seq_load->channel++; } /* can be NULL */ @@ -5660,6 +5702,10 @@ static Sequence *seq_dupli(const Scene *scene_src, { Sequence *seqn = MEM_dupallocN(seq); + if ((flag & LIB_ID_CREATE_NO_MAIN) == 0) { + BKE_sequence_session_uuid_generate(seq); + } + seq->tmp = seqn; seqn->strip = MEM_dupallocN(seq->strip); @@ -6042,3 +6088,55 @@ bool BKE_sequencer_check_scene_recursion(Scene *scene, ReportList *reports) return false; } + +/* Check if "seq_main" (indirectly) uses strip "seq". */ +bool BKE_sequencer_render_loop_check(Sequence *seq_main, Sequence *seq) +{ + if (seq_main == seq) { + return true; + } + + if ((seq_main->seq1 && BKE_sequencer_render_loop_check(seq_main->seq1, seq)) || + (seq_main->seq2 && BKE_sequencer_render_loop_check(seq_main->seq2, seq)) || + (seq_main->seq3 && BKE_sequencer_render_loop_check(seq_main->seq3, seq))) { + return true; + } + + SequenceModifierData *smd; + for (smd = seq_main->modifiers.first; smd; smd = smd->next) { + if (smd->mask_sequence && BKE_sequencer_render_loop_check(smd->mask_sequence, seq)) { + return true; + } + } + + return false; +} + +void BKE_sequencer_check_uuids_unique_and_report(const Scene *scene) +{ + if (scene->ed == NULL) { + return; + } + + struct GSet *used_uuids = BLI_gset_new( + BLI_session_uuid_ghash_hash, BLI_session_uuid_ghash_compare, "sequencer used uuids"); + + const Sequence *sequence; + SEQ_BEGIN (scene->ed, sequence) { + const SessionUUID *session_uuid = &sequence->runtime.session_uuid; + if (!BLI_session_uuid_is_generated(session_uuid)) { + printf("Sequence %s does not have UUID generated.\n", sequence->name); + continue; + } + + if (BLI_gset_lookup(used_uuids, session_uuid) != NULL) { + printf("Sequence %s has duplicate UUID generated.\n", sequence->name); + continue; + } + + BLI_gset_insert(used_uuids, (void *)session_uuid); + } + SEQ_END; + + BLI_gset_free(used_uuids, NULL); +} diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index b7b325644ca..d31f5f61597 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -2965,6 +2965,9 @@ static void lattice_to_softbody(Scene *scene, Object *ob) if (ob->softflag & OB_SB_EDGES) { makelatticesprings(lt, ob->soft->bspring, ob->softflag & OB_SB_QUADS, ob); build_bps_springlist(ob); /* link bps to springs */ + if (ob->softflag & OB_SB_SELF) { + calculate_collision_balls(ob); + } } } diff --git a/source/blender/blenkernel/intern/subdiv_ccg.c b/source/blender/blenkernel/intern/subdiv_ccg.c index 22649a2af07..bc1b79f62c5 100644 --- a/source/blender/blenkernel/intern/subdiv_ccg.c +++ b/source/blender/blenkernel/intern/subdiv_ccg.c @@ -1618,6 +1618,18 @@ static int prev_adjacent_edge_point_index(const SubdivCCG *subdiv_ccg, const int return point_index - 1; } +/* When the point index corresponds to a grid corner, returs the point index which corresponds to + * the corner of the adjacent grid, as the adjacent edge has two separate points for each grid + * corner at the middle of the edge. */ +static int adjacent_grid_corner_point_index_on_edge(const SubdivCCG *subdiv_ccg, + const int point_index) +{ + if (point_index == subdiv_ccg->grid_size) { + return point_index - 1; + } + return point_index + 1; +} + /* Common implementation of neighbor calculation when input coordinate is at the edge between two * coarse faces, but is not at the coarse vertex. */ static void neighbor_coords_edge_get(const SubdivCCG *subdiv_ccg, @@ -1626,6 +1638,7 @@ static void neighbor_coords_edge_get(const SubdivCCG *subdiv_ccg, SubdivCCGNeighbors *r_neighbors) { + const bool is_corner = is_corner_grid_coord(subdiv_ccg, coord); const int adjacent_edge_index = adjacent_edge_index_from_coord(subdiv_ccg, coord); BLI_assert(adjacent_edge_index >= 0); BLI_assert(adjacent_edge_index < subdiv_ccg->num_adjacent_edges); @@ -1633,15 +1646,27 @@ static void neighbor_coords_edge_get(const SubdivCCG *subdiv_ccg, /* 2 neighbor points along the edge, plus one inner point per every adjacent grid. */ const int num_adjacent_faces = adjacent_edge->num_adjacent_faces; - subdiv_ccg_neighbors_init( - r_neighbors, num_adjacent_faces + 2, (include_duplicates) ? num_adjacent_faces - 1 : 0); + int num_duplicates = 0; + if (include_duplicates) { + num_duplicates += num_adjacent_faces - 1; + if (is_corner) { + /* When the coord is a grid corner, add an extra duplicate per adajacent grid in all adjacent + * faces to the edge. */ + num_duplicates += num_adjacent_faces; + } + } + subdiv_ccg_neighbors_init(r_neighbors, num_adjacent_faces + 2, num_duplicates); const int point_index = adjacent_edge_point_index_from_coord( subdiv_ccg, coord, adjacent_edge_index); + const int point_index_duplicate = adjacent_grid_corner_point_index_on_edge(subdiv_ccg, + point_index); + const int next_point_index = next_adjacent_edge_point_index(subdiv_ccg, point_index); const int prev_point_index = prev_adjacent_edge_point_index(subdiv_ccg, point_index); - for (int i = 0, duplicate_i = num_adjacent_faces; i < num_adjacent_faces; ++i) { + int duplicate_i = num_adjacent_faces; + for (int i = 0; i < num_adjacent_faces; ++i) { SubdivCCGCoord *boundary_coords = adjacent_edge->boundary_coords[i]; /* One step into the grid from the edge for each adjacent face. */ SubdivCCGCoord grid_coord = boundary_coords[point_index]; @@ -1657,7 +1682,15 @@ static void neighbor_coords_edge_get(const SubdivCCG *subdiv_ccg, r_neighbors->coords[duplicate_i + 2] = grid_coord; duplicate_i++; } + + /* When it is a corner, add the duplicate of the adjacent grid in the same face. */ + if (include_duplicates && is_corner) { + SubdivCCGCoord duplicate_corner_grid_coord = boundary_coords[point_index_duplicate]; + r_neighbors->coords[duplicate_i + 2] = duplicate_corner_grid_coord; + duplicate_i++; + } } + BLI_assert(duplicate_i - num_adjacent_faces == num_duplicates); } /* The corner is at the middle of edge between faces. */ @@ -1889,4 +1922,15 @@ SubdivCCGAdjacencyType BKE_subdiv_ccg_coarse_mesh_adjacency_info_get(const Subdi return SUBDIV_CCG_ADJACENT_NONE; } +void BKE_subdiv_ccg_grid_hidden_ensure(SubdivCCG *subdiv_ccg, int grid_index) +{ + if (subdiv_ccg->grid_hidden[grid_index] != NULL) { + return; + } + + CCGKey key; + BKE_subdiv_ccg_key_top_level(&key, subdiv_ccg); + subdiv_ccg->grid_hidden[grid_index] = BLI_BITMAP_NEW(key.grid_area, __func__); +} + /** \} */ diff --git a/source/blender/blenkernel/intern/subdiv_converter.h b/source/blender/blenkernel/intern/subdiv_converter.h index fb0e84ade13..ea0efe994b5 100644 --- a/source/blender/blenkernel/intern/subdiv_converter.h +++ b/source/blender/blenkernel/intern/subdiv_converter.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __SUBDIV_CONVERTER_H__ -#define __SUBDIV_CONVERTER_H__ +#pragma once /** \file * \ingroup bke @@ -51,5 +50,3 @@ int BKE_subdiv_converter_vtx_boundary_interpolation_from_settings(const SubdivSe /* TODO(sergey): Find a way to make it OpenSubdiv_FVarLinearInterpolation, * without breaking compilation without OpenSubdiv. */ int BKE_subdiv_converter_fvar_linear_from_settings(const SubdivSettings *settings); - -#endif /* __SUBDIV_CONVERTER_H__ */ diff --git a/source/blender/blenkernel/intern/subdiv_inline.h b/source/blender/blenkernel/intern/subdiv_inline.h index a51a33feb3d..ba45d0a4997 100644 --- a/source/blender/blenkernel/intern/subdiv_inline.h +++ b/source/blender/blenkernel/intern/subdiv_inline.h @@ -21,8 +21,7 @@ * \ingroup bke */ -#ifndef __SUBDIV_INLINE_H__ -#define __SUBDIV_INLINE_H__ +#pragma once #include "BLI_assert.h" #include "BLI_compiler_compat.h" @@ -114,5 +113,3 @@ BLI_INLINE float BKE_subdiv_edge_crease_to_sharpness_char(char edge_crease) const float edge_crease_f = edge_crease / 255.0f; return BKE_subdiv_edge_crease_to_sharpness_f(edge_crease_f); } - -#endif /* __SUBDIV_INLINE_H__ */ diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index f37feab4b85..efe10b02940 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -1005,7 +1005,6 @@ bool bUnit_ReplaceString( /* Fix cases like "-1m50cm" which would evaluate to -0.5m without this. */ changed |= unit_distribute_negatives(str, len_max); - printf("%s\n", str); /* Try to find a default unit from current or previous string. */ default_unit = unit_detect_from_str(usys, str, str_prev); diff --git a/source/blender/blenkernel/intern/volume.cc b/source/blender/blenkernel/intern/volume.cc index 48b920c8a05..633ad250a67 100644 --- a/source/blender/blenkernel/intern/volume.cc +++ b/source/blender/blenkernel/intern/volume.cc @@ -218,7 +218,9 @@ static struct VolumeFileCache { cache.erase(entry); } else if (entry.num_tree_users == 0) { - entry.grid->clear(); + /* Note we replace the grid rather than clearing, so that if there is + * any other shared pointer to the grid it will keep the tree. */ + entry.grid = entry.grid->copyGridWithNewTree(); entry.is_loaded = false; } } @@ -239,15 +241,14 @@ struct VolumeGrid { VolumeGrid(const VolumeFileCache::Entry &template_entry) : entry(NULL), is_loaded(false) { entry = GLOBAL_CACHE.add_metadata_user(template_entry); - vdb = entry->grid; } - VolumeGrid(const openvdb::GridBase::Ptr &vdb) : vdb(vdb), entry(NULL), is_loaded(true) + VolumeGrid(const openvdb::GridBase::Ptr &grid) : entry(NULL), local_grid(grid), is_loaded(true) { } VolumeGrid(const VolumeGrid &other) - : vdb(other.vdb), entry(other.entry), is_loaded(other.is_loaded) + : entry(other.entry), local_grid(other.local_grid), is_loaded(other.is_loaded) { if (entry) { GLOBAL_CACHE.copy_user(*entry, is_loaded); @@ -330,7 +331,7 @@ struct VolumeGrid { void clear_reference(const char *UNUSED(volume_name)) { /* Clear any reference to a grid in the file cache. */ - vdb = vdb->copyGridWithNewTree(); + local_grid = grid()->copyGridWithNewTree(); if (entry) { GLOBAL_CACHE.remove_user(*entry, is_loaded); entry = NULL; @@ -344,7 +345,7 @@ struct VolumeGrid { * file cache. Load file grid into memory first if needed. */ load(volume_name, filepath); /* TODO: avoid deep copy if we are the only user. */ - vdb = vdb->deepCopyGrid(); + local_grid = grid()->deepCopyGrid(); if (entry) { GLOBAL_CACHE.remove_user(*entry, is_loaded); entry = NULL; @@ -356,7 +357,7 @@ struct VolumeGrid { { /* Don't use vdb.getName() since it copies the string, we want a pointer to the * original so it doesn't get freed out of scope. */ - openvdb::StringMetadata::ConstPtr name_meta = vdb->getMetadata<openvdb::StringMetadata>( + openvdb::StringMetadata::ConstPtr name_meta = grid()->getMetadata<openvdb::StringMetadata>( openvdb::GridBase::META_GRID_NAME); return (name_meta) ? name_meta->value().c_str() : ""; } @@ -371,10 +372,22 @@ struct VolumeGrid { } } - /* OpenVDB grid. */ - openvdb::GridBase::Ptr vdb; - /* File cache entry. */ + const bool grid_is_loaded() const + { + return is_loaded; + } + + const openvdb::GridBase::Ptr &grid() const + { + return (entry) ? entry->grid : local_grid; + } + + protected: + /* File cache entry when grid comes directly from a file and may be shared + * with other volume datablocks. */ VolumeFileCache::Entry *entry; + /* OpenVDB grid if it's not shared through the file cache. */ + openvdb::GridBase::Ptr local_grid; /* Indicates if the tree has been loaded for this grid. Note that vdb.tree() * may actually be loaded by another user while this is false. But only after * calling load() and is_loaded changes to true is it safe to access. */ @@ -1047,7 +1060,7 @@ void BKE_volume_grid_unload(const Volume *volume, VolumeGrid *grid) bool BKE_volume_grid_is_loaded(const VolumeGrid *grid) { #ifdef WITH_OPENVDB - return grid->is_loaded; + return grid->grid_is_loaded(); #else UNUSED_VARS(grid); return true; @@ -1069,7 +1082,7 @@ const char *BKE_volume_grid_name(const VolumeGrid *volume_grid) VolumeGridType BKE_volume_grid_type(const VolumeGrid *volume_grid) { #ifdef WITH_OPENVDB - const openvdb::GridBase::Ptr &grid = volume_grid->vdb; + const openvdb::GridBase::Ptr &grid = volume_grid->grid(); if (grid->isType<openvdb::FloatGrid>()) { return VOLUME_GRID_FLOAT; @@ -1138,7 +1151,7 @@ int BKE_volume_grid_channels(const VolumeGrid *grid) void BKE_volume_grid_transform_matrix(const VolumeGrid *volume_grid, float mat[4][4]) { #ifdef WITH_OPENVDB - const openvdb::GridBase::Ptr &grid = volume_grid->vdb; + const openvdb::GridBase::Ptr &grid = volume_grid->grid(); const openvdb::math::Transform &transform = grid->transform(); /* Perspective not supported for now, getAffineMap() will leave out the @@ -1162,7 +1175,7 @@ bool BKE_volume_grid_bounds(const VolumeGrid *volume_grid, float min[3], float m { #ifdef WITH_OPENVDB /* TODO: we can get this from grid metadata in some cases? */ - const openvdb::GridBase::Ptr &grid = volume_grid->vdb; + const openvdb::GridBase::Ptr &grid = volume_grid->grid(); BLI_assert(BKE_volume_grid_is_loaded(volume_grid)); openvdb::CoordBBox coordbbox; @@ -1287,14 +1300,14 @@ void BKE_volume_grid_remove(Volume *volume, VolumeGrid *grid) #ifdef WITH_OPENVDB openvdb::GridBase::ConstPtr BKE_volume_grid_openvdb_for_metadata(const VolumeGrid *grid) { - return grid->vdb; + return grid->grid(); } openvdb::GridBase::ConstPtr BKE_volume_grid_openvdb_for_read(const Volume *volume, VolumeGrid *grid) { BKE_volume_grid_load(volume, grid); - return grid->vdb; + return grid->grid(); } openvdb::GridBase::Ptr BKE_volume_grid_openvdb_for_write(const Volume *volume, @@ -1310,6 +1323,6 @@ openvdb::GridBase::Ptr BKE_volume_grid_openvdb_for_write(const Volume *volume, grid->duplicate_reference(volume_name, grids.filepath); } - return grid->vdb; + return grid->grid(); } #endif diff --git a/source/blender/blenkernel/nla_private.h b/source/blender/blenkernel/nla_private.h index 67e9afdf7fa..7057e9ab5bd 100644 --- a/source/blender/blenkernel/nla_private.h +++ b/source/blender/blenkernel/nla_private.h @@ -21,8 +21,7 @@ * \ingroup bke */ -#ifndef __NLA_PRIVATE_H__ -#define __NLA_PRIVATE_H__ +#pragma once #include "BLI_bitmap.h" #include "BLI_ghash.h" @@ -190,5 +189,3 @@ void nladata_flush_channels(PointerRNA *ptr, #ifdef __cplusplus } #endif - -#endif /* __NLA_PRIVATE_H__ */ diff --git a/source/blender/blenkernel/particle_private.h b/source/blender/blenkernel/particle_private.h index 6f80089be29..33277d1caac 100644 --- a/source/blender/blenkernel/particle_private.h +++ b/source/blender/blenkernel/particle_private.h @@ -21,8 +21,7 @@ * \ingroup bke */ -#ifndef __PARTICLE_PRIVATE_H__ -#define __PARTICLE_PRIVATE_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -72,5 +71,3 @@ void do_child_modifiers(const ParticleChildModifierContext *modifier_ctx, #ifdef __cplusplus } #endif - -#endif /* __PARTICLE_PRIVATE_H__ */ diff --git a/source/blender/blenkernel/tracking_private.h b/source/blender/blenkernel/tracking_private.h index 955a0b8753e..0965cef0d9b 100644 --- a/source/blender/blenkernel/tracking_private.h +++ b/source/blender/blenkernel/tracking_private.h @@ -24,8 +24,7 @@ * by multiple tracking files but which should not be public. */ -#ifndef __TRACKING_PRIVATE_H__ -#define __TRACKING_PRIVATE_H__ +#pragma once #include "BLI_threads.h" @@ -152,5 +151,3 @@ void tracking_image_accessor_destroy(TrackingImageAccessor *accessor); #ifdef __cplusplus } #endif - -#endif /* __TRACKING_PRIVATE_H__ */ diff --git a/source/blender/blenlib/BLI_alloca.h b/source/blender/blenlib/BLI_alloca.h index 5297296b7ef..92567ed35fa 100644 --- a/source/blender/blenlib/BLI_alloca.h +++ b/source/blender/blenlib/BLI_alloca.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_ALLOCA_H__ -#define __BLI_ALLOCA_H__ +#pragma once /** \file * \ingroup bli @@ -25,6 +24,8 @@ /* BLI_array_alloca / alloca */ +#include <stdlib.h> + #if defined(__GNUC__) || defined(__clang__) # if defined(__cplusplus) && (__cplusplus > 199711L) # define BLI_array_alloca(arr, realsize) (decltype(arr)) alloca(sizeof(*arr) * (realsize)) @@ -34,5 +35,3 @@ #else # define BLI_array_alloca(arr, realsize) alloca(sizeof(*arr) * (realsize)) #endif - -#endif /* __BLI_ALLOCA_H__ */ diff --git a/source/blender/blenlib/BLI_allocator.hh b/source/blender/blenlib/BLI_allocator.hh index 47d8156476f..3f753d1d81d 100644 --- a/source/blender/blenlib/BLI_allocator.hh +++ b/source/blender/blenlib/BLI_allocator.hh @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_ALLOCATOR_HH__ -#define __BLI_ALLOCATOR_HH__ +#pragma once /** \file * \ingroup bli @@ -100,5 +99,3 @@ class RawAllocator { }; } // namespace blender - -#endif /* __BLI_ALLOCATOR_HH__ */ diff --git a/source/blender/blenlib/BLI_args.h b/source/blender/blenlib/BLI_args.h index 9031cd2ba2f..54b5161f15a 100644 --- a/source/blender/blenlib/BLI_args.h +++ b/source/blender/blenlib/BLI_args.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_ARGS_H__ -#define __BLI_ARGS_H__ +#pragma once /** \file * \ingroup bli @@ -78,5 +77,3 @@ const char **BLI_argsArgv(struct bArgs *ba); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h index 5b85711f8ac..6ea01d45f79 100644 --- a/source/blender/blenlib/BLI_array.h +++ b/source/blender/blenlib/BLI_array.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_ARRAY_H__ -#define __BLI_ARRAY_H__ +#pragma once /** \file * \ingroup bli @@ -173,5 +172,3 @@ void _bli_array_grow_func(void **arr_p, ((void)0) /** \} */ - -#endif /* __BLI_ARRAY_H__ */ diff --git a/source/blender/blenlib/BLI_array.hh b/source/blender/blenlib/BLI_array.hh index c7b4bdc977f..796123af765 100644 --- a/source/blender/blenlib/BLI_array.hh +++ b/source/blender/blenlib/BLI_array.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_ARRAY_HH__ -#define __BLI_ARRAY_HH__ +#pragma once /** \file * \ingroup bli @@ -369,5 +368,3 @@ template<typename T, int64_t InlineBufferCapacity = default_inline_buffer_capaci using RawArray = Array<T, InlineBufferCapacity, RawAllocator>; } // namespace blender - -#endif /* __BLI_ARRAY_HH__ */ diff --git a/source/blender/blenlib/BLI_array_store.h b/source/blender/blenlib/BLI_array_store.h index a8a7dde63b5..78d718117ba 100644 --- a/source/blender/blenlib/BLI_array_store.h +++ b/source/blender/blenlib/BLI_array_store.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_ARRAY_STORE_H__ -#define __BLI_ARRAY_STORE_H__ +#pragma once /** \file * \ingroup bli @@ -53,5 +52,3 @@ bool BLI_array_store_is_valid(BArrayStore *bs); #ifdef __cplusplus } #endif - -#endif /* __BLI_ARRAY_STORE_H__ */ diff --git a/source/blender/blenlib/BLI_array_store_utils.h b/source/blender/blenlib/BLI_array_store_utils.h index 5b5263bf8a4..771f4f962a7 100644 --- a/source/blender/blenlib/BLI_array_store_utils.h +++ b/source/blender/blenlib/BLI_array_store_utils.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_ARRAY_STORE_UTILS_H__ -#define __BLI_ARRAY_STORE_UTILS_H__ +#pragma once /** \file * \ingroup bli @@ -47,5 +46,3 @@ void BLI_array_store_at_size_calc_memory_usage(struct BArrayStore_AtSize *bs_str #ifdef __cplusplus } #endif - -#endif /* __BLI_ARRAY_STORE_UTILS_H__ */ diff --git a/source/blender/blenlib/BLI_array_utils.h b/source/blender/blenlib/BLI_array_utils.h index afa9a3d2241..b8d63e7cdc1 100644 --- a/source/blender/blenlib/BLI_array_utils.h +++ b/source/blender/blenlib/BLI_array_utils.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_ARRAY_UTILS_H__ -#define __BLI_ARRAY_UTILS_H__ +#pragma once /** \file * \ingroup bli @@ -93,5 +92,3 @@ bool _bli_array_is_zeroed(const void *arr, unsigned int arr_len, size_t arr_stri #ifdef __cplusplus } #endif - -#endif /* __BLI_ARRAY_UTILS_H__ */ diff --git a/source/blender/blenlib/BLI_asan.h b/source/blender/blenlib/BLI_asan.h index fdade805c2a..a2a44e164ab 100644 --- a/source/blender/blenlib/BLI_asan.h +++ b/source/blender/blenlib/BLI_asan.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_ADDRESS_SANITIZER_H__ -#define __BLI_ADDRESS_SANITIZER_H__ +#pragma once /* Clang defines this. */ #ifndef __has_feature @@ -41,5 +40,3 @@ * Mark a region of memory as usable again. */ #define BLI_asan_unpoison(addr, size) ASAN_UNPOISON_MEMORY_REGION(addr, size) - -#endif /* __BLI_ADDRESS_SANITIZER_H__ */ diff --git a/source/blender/blenlib/BLI_assert.h b/source/blender/blenlib/BLI_assert.h index 603be115b35..172a2fb44ca 100644 --- a/source/blender/blenlib/BLI_assert.h +++ b/source/blender/blenlib/BLI_assert.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_ASSERT_H__ -#define __BLI_ASSERT_H__ +#pragma once /** \file * \ingroup bli @@ -30,58 +29,33 @@ extern "C" { #endif -#ifndef NDEBUG /* for BLI_assert */ -# include <stdio.h> -#endif +/* Utility functions. */ +void _BLI_assert_print_pos(const char *file, const int line, const char *function, const char *id); +void _BLI_assert_print_backtrace(void); +void _BLI_assert_abort(void); #ifdef _MSC_VER # include <crtdbg.h> /* for _STATIC_ASSERT */ #endif -/* BLI_assert(), default only to print - * for aborting need to define WITH_ASSERT_ABORT - */ -/* For 'abort' only. */ -#include <stdlib.h> - #ifndef NDEBUG -# include "BLI_system.h" /* _BLI_ASSERT_PRINT_POS */ # if defined(__GNUC__) -# define _BLI_ASSERT_PRINT_POS(a) \ - fprintf(stderr, \ - "BLI_assert failed: %s:%d, %s(), at \'%s\'\n", \ - __FILE__, \ - __LINE__, \ - __func__, \ - #a) +# define _BLI_ASSERT_PRINT_POS(a) _BLI_assert_print_pos(__FILE__, __LINE__, __func__, # a) # elif defined(_MSC_VER) -# define _BLI_ASSERT_PRINT_POS(a) \ - fprintf(stderr, \ - "BLI_assert failed: %s:%d, %s(), at \'%s\'\n", \ - __FILE__, \ - __LINE__, \ - __FUNCTION__, \ - #a) +# define _BLI_ASSERT_PRINT_POS(a) _BLI_assert_print_pos(__FILE__, __LINE__, __func__, # a) # else -# define _BLI_ASSERT_PRINT_POS(a) \ - fprintf(stderr, "BLI_assert failed: %s:%d, at \'%s\'\n", __FILE__, __LINE__, #a) +# define _BLI_ASSERT_PRINT_POS(a) _BLI_assert_print_pos(__FILE__, __LINE__, "<?>", # a) # endif /* _BLI_ASSERT_ABORT */ # ifdef WITH_ASSERT_ABORT -# ifdef __GNUC__ -/* Cast to remove 'noreturn' attribute since this suppresses missing return statements, - * allowing changes to debug builds to accidentally to break release builds. */ -# define _BLI_ASSERT_ABORT ((void (*)(void))(*(((void **)abort)))) -# else -# define _BLI_ASSERT_ABORT abort -# endif +# define _BLI_ASSERT_ABORT _BLI_assert_abort # else # define _BLI_ASSERT_ABORT() (void)0 # endif /* BLI_assert */ # define BLI_assert(a) \ - (void)((!(a)) ? ((BLI_system_backtrace(stderr), \ + (void)((!(a)) ? ((_BLI_assert_print_backtrace(), \ _BLI_ASSERT_PRINT_POS(a), \ _BLI_ASSERT_ABORT(), \ NULL)) : \ @@ -117,5 +91,3 @@ extern "C" { #ifdef __cplusplus } #endif - -#endif /* __BLI_ASSERT_H__ */ diff --git a/source/blender/blenlib/BLI_astar.h b/source/blender/blenlib/BLI_astar.h index 8a70371cbcb..fe5c4ddad69 100644 --- a/source/blender/blenlib/BLI_astar.h +++ b/source/blender/blenlib/BLI_astar.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_ASTAR_H__ -#define __BLI_ASTAR_H__ +#pragma once /** \file * \ingroup bli @@ -121,5 +120,3 @@ bool BLI_astar_graph_solve(BLI_AStarGraph *as_graph, #ifdef __cplusplus } #endif - -#endif /* __BLI_ASTAR_H__ */ diff --git a/source/blender/blenlib/BLI_bitmap.h b/source/blender/blenlib/BLI_bitmap.h index 2b811e50efb..61a50662d79 100644 --- a/source/blender/blenlib/BLI_bitmap.h +++ b/source/blender/blenlib/BLI_bitmap.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_BITMAP_H__ -#define __BLI_BITMAP_H__ +#pragma once /** \file * \ingroup bli @@ -118,5 +117,3 @@ void BLI_bitmap_or_all(BLI_bitmap *dst, const BLI_bitmap *src, size_t bits); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenlib/BLI_bitmap_draw_2d.h b/source/blender/blenlib/BLI_bitmap_draw_2d.h index f5f8b28b27f..8331d8fac08 100644 --- a/source/blender/blenlib/BLI_bitmap_draw_2d.h +++ b/source/blender/blenlib/BLI_bitmap_draw_2d.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_BITMAP_DRAW_2D_H__ -#define __BLI_BITMAP_DRAW_2D_H__ +#pragma once /** \file * \ingroup bli @@ -48,5 +47,3 @@ void BLI_bitmap_draw_2d_poly_v2i_n(const int xmin, #ifdef __cplusplus } #endif - -#endif /* __BLI_BITMAP_DRAW_2D_H__ */ diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index 4ebef814337..a9e8c55b6b4 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -47,8 +47,7 @@ * standard libraries. */ -#ifndef __BLI_BLENLIB_H__ -#define __BLI_BLENLIB_H__ +#pragma once #include <stdlib.h> @@ -63,5 +62,3 @@ #include "BLI_fileops.h" #include "BLI_rect.h" - -#endif diff --git a/source/blender/blenlib/BLI_boxpack_2d.h b/source/blender/blenlib/BLI_boxpack_2d.h index 762cb7aaa44..c36cbc03928 100644 --- a/source/blender/blenlib/BLI_boxpack_2d.h +++ b/source/blender/blenlib/BLI_boxpack_2d.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_BOXPACK_2D_H__ -#define __BLI_BOXPACK_2D_H__ +#pragma once /** \file * \ingroup bli @@ -64,5 +63,3 @@ void BLI_box_pack_2d_fixedarea(struct ListBase *boxes, #ifdef __cplusplus } #endif - -#endif /* __BLI_BOXPACK_2D_H__ */ diff --git a/source/blender/blenlib/BLI_buffer.h b/source/blender/blenlib/BLI_buffer.h index d81446af14b..fc348c25c46 100644 --- a/source/blender/blenlib/BLI_buffer.h +++ b/source/blender/blenlib/BLI_buffer.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_BUFFER_H__ -#define __BLI_BUFFER_H__ +#pragma once /** \file * \ingroup bli @@ -100,5 +99,3 @@ void _bli_buffer_free(BLI_Buffer *buffer); #ifdef __cplusplus } #endif - -#endif /* __BLI_BUFFER_H__ */ diff --git a/source/blender/blenlib/BLI_color.hh b/source/blender/blenlib/BLI_color.hh index 72caa5b1118..c0d2f43645d 100644 --- a/source/blender/blenlib/BLI_color.hh +++ b/source/blender/blenlib/BLI_color.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_COLOR_HH__ -#define __BLI_COLOR_HH__ +#pragma once #include <iostream> @@ -127,5 +126,3 @@ struct Color4b { }; } // namespace blender - -#endif /* __BLI_COLOR_HH__ */ diff --git a/source/blender/blenlib/BLI_compiler_attrs.h b/source/blender/blenlib/BLI_compiler_attrs.h index 24da0be122c..680c4bc78da 100644 --- a/source/blender/blenlib/BLI_compiler_attrs.h +++ b/source/blender/blenlib/BLI_compiler_attrs.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_COMPILER_ATTRS_H__ -#define __BLI_COMPILER_ATTRS_H__ +#pragma once /** \file * \ingroup bli @@ -99,5 +98,3 @@ #else # define ATTR_ALIGN(x) __attribute__((aligned(x))) #endif - -#endif /* __BLI_COMPILER_ATTRS_H__ */ diff --git a/source/blender/blenlib/BLI_compiler_compat.h b/source/blender/blenlib/BLI_compiler_compat.h index 056ea1a08c6..0870d01872a 100644 --- a/source/blender/blenlib/BLI_compiler_compat.h +++ b/source/blender/blenlib/BLI_compiler_compat.h @@ -19,8 +19,8 @@ /* #define typeof() triggers a bug in some clang-format versions, disable format * for entire file to keep results consistent. */ -#ifndef __BLI_COMPILER_COMPAT_H__ -#define __BLI_COMPILER_COMPAT_H__ +#pragma once + /** \file * \ingroup bli @@ -56,4 +56,3 @@ template<typename T> static inline T decltype_helper(T x) # define BLI_NOINLINE #endif -#endif /* __BLI_COMPILER_COMPAT_H__ */ diff --git a/source/blender/blenlib/BLI_compiler_typecheck.h b/source/blender/blenlib/BLI_compiler_typecheck.h index 0a2eddc4ecc..d9c2bfc1d58 100644 --- a/source/blender/blenlib/BLI_compiler_typecheck.h +++ b/source/blender/blenlib/BLI_compiler_typecheck.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_COMPILER_TYPECHECK_H__ -#define __BLI_COMPILER_TYPECHECK_H__ +#pragma once /** \file * \ingroup bli @@ -692,5 +691,3 @@ /* clang-format on */ #define GENERIC_TYPE_ANY(...) VA_NARGS_CALL_OVERLOAD(_VA_GENERIC_TYPE_ANY, __VA_ARGS__) - -#endif /* __BLI_COMPILER_TYPECHECK_H__ */ diff --git a/source/blender/blenlib/BLI_console.h b/source/blender/blenlib/BLI_console.h index d666de3a8e8..dc07d3df754 100644 --- a/source/blender/blenlib/BLI_console.h +++ b/source/blender/blenlib/BLI_console.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_CONSOLE_H__ -#define __BLI_CONSOLE_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -40,5 +39,3 @@ extern "C" { #ifdef __cplusplus } #endif - -#endif /* __BLI_CONSOLE_H__ */ diff --git a/source/blender/blenlib/BLI_convexhull_2d.h b/source/blender/blenlib/BLI_convexhull_2d.h index 7417c1e3a98..e930117822f 100644 --- a/source/blender/blenlib/BLI_convexhull_2d.h +++ b/source/blender/blenlib/BLI_convexhull_2d.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_CONVEXHULL_2D_H__ -#define __BLI_CONVEXHULL_2D_H__ +#pragma once /** \file * \ingroup bli @@ -34,5 +33,3 @@ float BLI_convexhull_aabb_fit_points_2d(const float (*points)[2], unsigned int n #ifdef __cplusplus } #endif - -#endif /* __BLI_CONVEXHULL_2D_H__ */ diff --git a/source/blender/blenlib/BLI_delaunay_2d.h b/source/blender/blenlib/BLI_delaunay_2d.h index 95111dbbbf7..a826a6b2677 100644 --- a/source/blender/blenlib/BLI_delaunay_2d.h +++ b/source/blender/blenlib/BLI_delaunay_2d.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_DELAUNAY_2D_H__ -#define __BLI_DELAUNAY_2D_H__ +#pragma once /** \file * \ingroup bli @@ -209,5 +208,3 @@ void BLI_delaunay_2d_cdt_free(CDT_result *result); #ifdef __cplusplus } #endif - -#endif /* __BLI_DELAUNAY_2D_H__ */ diff --git a/source/blender/blenlib/BLI_dial_2d.h b/source/blender/blenlib/BLI_dial_2d.h index a39543720e6..f43237f6b75 100644 --- a/source/blender/blenlib/BLI_dial_2d.h +++ b/source/blender/blenlib/BLI_dial_2d.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_DIAL_2D_H__ -#define __BLI_DIAL_2D_H__ +#pragma once /** \file * \ingroup bli @@ -59,5 +58,3 @@ float BLI_dial_angle(Dial *dial, const float current_position[2]); #ifdef __cplusplus } #endif - -#endif /* __BLI_DIAL_2D_H__ */ diff --git a/source/blender/blenlib/BLI_disjoint_set.hh b/source/blender/blenlib/BLI_disjoint_set.hh index e0580709a44..2002577f956 100644 --- a/source/blender/blenlib/BLI_disjoint_set.hh +++ b/source/blender/blenlib/BLI_disjoint_set.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_DISJOINT_SET_HH__ -#define __BLI_DISJOINT_SET_HH__ +#pragma once /** \file * \ingroup bli @@ -102,5 +101,3 @@ class DisjointSet { }; } // namespace blender - -#endif /* __BLI_DISJOINT_SET_HH__ */ diff --git a/source/blender/blenlib/BLI_dlrbTree.h b/source/blender/blenlib/BLI_dlrbTree.h index 5db0dd16a34..fc52904d699 100644 --- a/source/blender/blenlib/BLI_dlrbTree.h +++ b/source/blender/blenlib/BLI_dlrbTree.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_DLRBTREE_H__ -#define __BLI_DLRBTREE_H__ +#pragma once /** \file * \ingroup bli @@ -166,5 +165,3 @@ void BLI_dlrbTree_insert(DLRBT_Tree *tree, DLRBT_Node *node); #ifdef __cplusplus } #endif - -#endif /* __BLI_DLRBTREE_H__ */ diff --git a/source/blender/blenlib/BLI_dot_export.hh b/source/blender/blenlib/BLI_dot_export.hh index 0870d8c4c30..2d6dbb1f600 100644 --- a/source/blender/blenlib/BLI_dot_export.hh +++ b/source/blender/blenlib/BLI_dot_export.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_DOT_EXPORT_HH__ -#define __BLI_DOT_EXPORT_HH__ +#pragma once /** * Language grammar: https://www.graphviz.org/doc/info/lang.html @@ -288,5 +287,3 @@ class NodeWithSocketsRef { }; } // namespace blender::dot - -#endif /* __BLI_DOT_EXPORT_HH__ */ diff --git a/source/blender/blenlib/BLI_dot_export_attribute_enums.hh b/source/blender/blenlib/BLI_dot_export_attribute_enums.hh index 94c7025b2a6..8cbe7a3e6e6 100644 --- a/source/blender/blenlib/BLI_dot_export_attribute_enums.hh +++ b/source/blender/blenlib/BLI_dot_export_attribute_enums.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_DOT_EXPORT_ATTRIBUTE_ENUMS_HH__ -#define __BLI_DOT_EXPORT_ATTRIBUTE_ENUMS_HH__ +#pragma once #include "BLI_string_ref.hh" @@ -119,5 +118,3 @@ inline StringRef dirType_to_string(Attr_dirType value) } } // namespace blender::dot - -#endif /* __BLI_DOT_EXPORT_ATTRIBUTE_ENUMS_HH__ */ diff --git a/source/blender/blenlib/BLI_dynlib.h b/source/blender/blenlib/BLI_dynlib.h index 4adffd51e17..628e33b6f02 100644 --- a/source/blender/blenlib/BLI_dynlib.h +++ b/source/blender/blenlib/BLI_dynlib.h @@ -21,8 +21,7 @@ * \ingroup bli */ -#ifndef __BLI_DYNLIB_H__ -#define __BLI_DYNLIB_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -38,5 +37,3 @@ void BLI_dynlib_close(DynamicLibrary *lib); #ifdef __cplusplus } #endif - -#endif /* __BLI_DYNLIB_H__ */ diff --git a/source/blender/blenlib/BLI_dynstr.h b/source/blender/blenlib/BLI_dynstr.h index cb1f3d58f23..075786c4424 100644 --- a/source/blender/blenlib/BLI_dynstr.h +++ b/source/blender/blenlib/BLI_dynstr.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_DYNSTR_H__ -#define __BLI_DYNSTR_H__ +#pragma once /** \file * \ingroup bli @@ -64,5 +63,3 @@ void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL(); #ifdef __cplusplus } #endif - -#endif /* __BLI_DYNSTR_H__ */ diff --git a/source/blender/blenlib/BLI_easing.h b/source/blender/blenlib/BLI_easing.h index 73e17be31b7..e6bf8c3bdfa 100644 --- a/source/blender/blenlib/BLI_easing.h +++ b/source/blender/blenlib/BLI_easing.h @@ -28,8 +28,7 @@ * All rights reserved. */ -#ifndef __BLI_EASING_H__ -#define __BLI_EASING_H__ +#pragma once /** \file * \ingroup bli @@ -80,5 +79,3 @@ float BLI_easing_sine_ease_in_out(float time, float begin, float change, float d #ifdef __cplusplus } #endif - -#endif /* __BLI_EASING_H__ */ diff --git a/source/blender/blenlib/BLI_edgehash.h b/source/blender/blenlib/BLI_edgehash.h index 0e2d0b538c7..44dc3cf096b 100644 --- a/source/blender/blenlib/BLI_edgehash.h +++ b/source/blender/blenlib/BLI_edgehash.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_EDGEHASH_H__ -#define __BLI_EDGEHASH_H__ +#pragma once /** \file * \ingroup bli @@ -158,5 +157,3 @@ BLI_INLINE bool BLI_edgesetIterator_isDone(EdgeSetIterator *esi) #ifdef __cplusplus } #endif - -#endif /* __BLI_EDGEHASH_H__ */ diff --git a/source/blender/blenlib/BLI_endian_switch_inline.h b/source/blender/blenlib/BLI_endian_switch_inline.h index 316e24cfc6d..70d428147e2 100644 --- a/source/blender/blenlib/BLI_endian_switch_inline.h +++ b/source/blender/blenlib/BLI_endian_switch_inline.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_ENDIAN_SWITCH_INLINE_H__ -#define __BLI_ENDIAN_SWITCH_INLINE_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -92,5 +91,3 @@ BLI_INLINE void BLI_endian_switch_double(double *val) #ifdef __cplusplus } #endif - -#endif /* __BLI_ENDIAN_SWITCH_INLINE_H__ */ diff --git a/source/blender/blenlib/BLI_expr_pylike_eval.h b/source/blender/blenlib/BLI_expr_pylike_eval.h index 1db91ea4205..c074b5d8130 100644 --- a/source/blender/blenlib/BLI_expr_pylike_eval.h +++ b/source/blender/blenlib/BLI_expr_pylike_eval.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_EXPR_PYLIKE_EVAL_H__ -#define __BLI_EXPR_PYLIKE_EVAL_H__ +#pragma once /** \file * \ingroup bli @@ -57,5 +56,3 @@ eExprPyLike_EvalStatus BLI_expr_pylike_eval(struct ExprPyLike_Parsed *expr, #ifdef __cplusplus } #endif - -#endif /* __BLI_EXPR_PYLIKE_EVAL_H__ */ diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h index fe4600b9121..e61e20ee5e9 100644 --- a/source/blender/blenlib/BLI_fileops.h +++ b/source/blender/blenlib/BLI_fileops.h @@ -22,8 +22,7 @@ * \brief File and directory operations. * */ -#ifndef __BLI_FILEOPS_H__ -#define __BLI_FILEOPS_H__ +#pragma once #include <stdint.h> #include <stdio.h> @@ -189,5 +188,3 @@ void BLI_get_short_name(char short_name[256], const char *filename); #ifdef __cplusplus } #endif - -#endif /* __BLI_FILEOPS_H__ */ diff --git a/source/blender/blenlib/BLI_fileops_types.h b/source/blender/blenlib/BLI_fileops_types.h index 41f916ed0ca..cdae9665f98 100644 --- a/source/blender/blenlib/BLI_fileops_types.h +++ b/source/blender/blenlib/BLI_fileops_types.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_FILEOPS_TYPES_H__ -#define __BLI_FILEOPS_TYPES_H__ +#pragma once /** \file * \ingroup bli @@ -64,5 +63,3 @@ struct dirlink { #ifdef __cplusplus } #endif - -#endif /* __BLI_FILEOPS_TYPES_H__ */ diff --git a/source/blender/blenlib/BLI_float2.hh b/source/blender/blenlib/BLI_float2.hh index 5fe9d1b8ca9..e55a8de4633 100644 --- a/source/blender/blenlib/BLI_float2.hh +++ b/source/blender/blenlib/BLI_float2.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_FLOAT2_HH__ -#define __BLI_FLOAT2_HH__ +#pragma once #include "BLI_float3.hh" @@ -120,5 +119,3 @@ struct float2 { }; } // namespace blender - -#endif /* __BLI_FLOAT2_HH__ */ diff --git a/source/blender/blenlib/BLI_float3.hh b/source/blender/blenlib/BLI_float3.hh index b2633985ac7..85575f65365 100644 --- a/source/blender/blenlib/BLI_float3.hh +++ b/source/blender/blenlib/BLI_float3.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_FLOAT3_HH__ -#define __BLI_FLOAT3_HH__ +#pragma once #include <iostream> @@ -232,5 +231,3 @@ struct float3 { }; } // namespace blender - -#endif /* __BLI_FLOAT3_HH__ */ diff --git a/source/blender/blenlib/BLI_float4x4.hh b/source/blender/blenlib/BLI_float4x4.hh index 185cffd13ac..a8b939ed32e 100644 --- a/source/blender/blenlib/BLI_float4x4.hh +++ b/source/blender/blenlib/BLI_float4x4.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_FLOAT4X4_HH__ -#define __BLI_FLOAT4X4_HH__ +#pragma once #include "BLI_float3.hh" #include "BLI_math_matrix.h" @@ -121,5 +120,3 @@ struct float4x4 { }; } // namespace blender - -#endif /* __BLI_FLOAT4X4_HH__ */ diff --git a/source/blender/blenlib/BLI_fnmatch.h b/source/blender/blenlib/BLI_fnmatch.h index 28169c36e23..d09a14621d8 100644 --- a/source/blender/blenlib/BLI_fnmatch.h +++ b/source/blender/blenlib/BLI_fnmatch.h @@ -19,8 +19,7 @@ * Bugs can be reported to bug-glibc@prep.ai.mit.edu. */ -#ifndef __BLI_FNMATCH_H__ -#define __BLI_FNMATCH_H__ +#pragma once /** \file * \ingroup bli @@ -77,5 +76,3 @@ extern int fnmatch __P((const char *__pattern, const char *__string, int __flags #ifdef __cplusplus } #endif - -#endif /* __BLI_FNMATCH_H__ */ diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index 31a9658bd7e..cd84dd4f327 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_GHASH_H__ -#define __BLI_GHASH_H__ +#pragma once /** \file * \ingroup bli @@ -416,5 +415,3 @@ GSet *BLI_gset_int_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; #ifdef __cplusplus } #endif - -#endif /* __BLI_GHASH_H__ */ diff --git a/source/blender/blenlib/BLI_gsqueue.h b/source/blender/blenlib/BLI_gsqueue.h index b69bdb7057c..077d1646d1d 100644 --- a/source/blender/blenlib/BLI_gsqueue.h +++ b/source/blender/blenlib/BLI_gsqueue.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_GSQUEUE_H__ -#define __BLI_GSQUEUE_H__ +#pragma once /** \file * \ingroup bli @@ -42,5 +41,3 @@ void BLI_gsqueue_free(GSQueue *gq); #ifdef __cplusplus } #endif - -#endif /* __BLI_GSQUEUE_H__ */ diff --git a/source/blender/blenlib/BLI_hash.h b/source/blender/blenlib/BLI_hash.h index 96111ffaf5a..c2be416ef5f 100644 --- a/source/blender/blenlib/BLI_hash.h +++ b/source/blender/blenlib/BLI_hash.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_HASH_H__ -#define __BLI_HASH_H__ +#pragma once /** \file * \ingroup bli @@ -91,5 +90,3 @@ BLI_INLINE void BLI_hash_pointer_to_color(const void *ptr, int *r, int *g, int * #ifdef __cplusplus } #endif - -#endif // __BLI_HASH_H__ diff --git a/source/blender/blenlib/BLI_hash.hh b/source/blender/blenlib/BLI_hash.hh index b14a4ca933c..ad3224e037a 100644 --- a/source/blender/blenlib/BLI_hash.hh +++ b/source/blender/blenlib/BLI_hash.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_HASH_HH__ -#define __BLI_HASH_HH__ +#pragma once /** \file * \ingroup bli @@ -210,5 +209,3 @@ template<typename T1, typename T2> struct DefaultHash<std::pair<T1, T2>> { }; } // namespace blender - -#endif /* __BLI_HASH_HH__ */ diff --git a/source/blender/blenlib/BLI_hash_md5.h b/source/blender/blenlib/BLI_hash_md5.h index b326b17c19b..4a5cd8b19f3 100644 --- a/source/blender/blenlib/BLI_hash_md5.h +++ b/source/blender/blenlib/BLI_hash_md5.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_HASH_MD5_H__ -#define __BLI_HASH_MD5_H__ +#pragma once /** \file * \ingroup bli @@ -43,5 +42,3 @@ char *BLI_hash_md5_to_hexdigest(void *resblock, char r_hex_digest[33]); #ifdef __cplusplus } #endif - -#endif /* __BLI_HASH_MD5_H__ */ diff --git a/source/blender/blenlib/BLI_hash_mm2a.h b/source/blender/blenlib/BLI_hash_mm2a.h index 840ff31dd19..193a78e6293 100644 --- a/source/blender/blenlib/BLI_hash_mm2a.h +++ b/source/blender/blenlib/BLI_hash_mm2a.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_HASH_MM2A_H__ -#define __BLI_HASH_MM2A_H__ +#pragma once /** \file * \ingroup bli @@ -47,5 +46,3 @@ uint32_t BLI_hash_mm2(const unsigned char *data, size_t len, uint32_t seed); #ifdef __cplusplus } #endif - -#endif /* __BLI_HASH_MM2A_H__ */ diff --git a/source/blender/blenlib/BLI_hash_mm3.h b/source/blender/blenlib/BLI_hash_mm3.h index e76808812bc..99c24f53dd4 100644 --- a/source/blender/blenlib/BLI_hash_mm3.h +++ b/source/blender/blenlib/BLI_hash_mm3.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_HASH_MM3_H__ -#define __BLI_HASH_MM3_H__ +#pragma once /** \file * \ingroup bli @@ -32,5 +31,3 @@ uint32_t BLI_hash_mm3(const unsigned char *data, size_t len, uint32_t seed); #ifdef __cplusplus } #endif - -#endif /* __BLI_HASH_MM2A_H__ */ diff --git a/source/blender/blenlib/BLI_hash_tables.hh b/source/blender/blenlib/BLI_hash_tables.hh index 5d8f8862a09..e6026d93e2c 100644 --- a/source/blender/blenlib/BLI_hash_tables.hh +++ b/source/blender/blenlib/BLI_hash_tables.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_OPEN_ADDRESSING_HH__ -#define __BLI_OPEN_ADDRESSING_HH__ +#pragma once /** \file * \ingroup bli @@ -353,5 +352,3 @@ struct DefaultEquality { }; } // namespace blender - -#endif /* __BLI_OPEN_ADDRESSING_HH__ */ diff --git a/source/blender/blenlib/BLI_heap.h b/source/blender/blenlib/BLI_heap.h index ca5edcbead5..4cfb7945303 100644 --- a/source/blender/blenlib/BLI_heap.h +++ b/source/blender/blenlib/BLI_heap.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_HEAP_H__ -#define __BLI_HEAP_H__ +#pragma once /** \file * \ingroup bli @@ -61,5 +60,3 @@ bool BLI_heap_is_valid(const Heap *heap); #ifdef __cplusplus } #endif - -#endif /* __BLI_HEAP_H__ */ diff --git a/source/blender/blenlib/BLI_heap_simple.h b/source/blender/blenlib/BLI_heap_simple.h index d2bc542491c..b2a1b5582e5 100644 --- a/source/blender/blenlib/BLI_heap_simple.h +++ b/source/blender/blenlib/BLI_heap_simple.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_HEAP_SIMPLE_H__ -#define __BLI_HEAP_SIMPLE_H__ +#pragma once /** \file * \ingroup bli @@ -44,5 +43,3 @@ void *BLI_heapsimple_pop_min(HeapSimple *heap) ATTR_NONNULL(1); #ifdef __cplusplus } #endif - -#endif /* __BLI_HEAP_SIMPLE_H__ */ diff --git a/source/blender/blenlib/BLI_index_mask.hh b/source/blender/blenlib/BLI_index_mask.hh index ff271faa0c2..48b01edcd6f 100644 --- a/source/blender/blenlib/BLI_index_mask.hh +++ b/source/blender/blenlib/BLI_index_mask.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_INDEX_MASK_HH__ -#define __BLI_INDEX_MASK_HH__ +#pragma once /** \file * \ingroup bli @@ -208,5 +207,3 @@ class IndexMask { }; } // namespace blender - -#endif /* __BLI_INDEX_MASK_HH__ */ diff --git a/source/blender/blenlib/BLI_index_range.hh b/source/blender/blenlib/BLI_index_range.hh index 7c813f58b2c..2b060c986cd 100644 --- a/source/blender/blenlib/BLI_index_range.hh +++ b/source/blender/blenlib/BLI_index_range.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_INDEX_RANGE_HH__ -#define __BLI_INDEX_RANGE_HH__ +#pragma once /** \file * \ingroup bli @@ -245,5 +244,3 @@ class IndexRange { }; } // namespace blender - -#endif /* __BLI_INDEX_RANGE_HH__ */ diff --git a/source/blender/blenlib/BLI_iterator.h b/source/blender/blenlib/BLI_iterator.h index ce2311aa3f7..c1cd1c21dac 100644 --- a/source/blender/blenlib/BLI_iterator.h +++ b/source/blender/blenlib/BLI_iterator.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_ITERATOR_H__ -#define __BLI_ITERATOR_H__ +#pragma once /** \file * \ingroup bli @@ -58,5 +57,3 @@ typedef void (*IteratorBeginCb)(BLI_Iterator *iter, void *data_in); #ifdef __cplusplus } #endif - -#endif /* __BLI_ITERATOR_H__ */ diff --git a/source/blender/blenlib/BLI_jitter_2d.h b/source/blender/blenlib/BLI_jitter_2d.h index fa184916b5b..a0af352ddd2 100644 --- a/source/blender/blenlib/BLI_jitter_2d.h +++ b/source/blender/blenlib/BLI_jitter_2d.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_JITTER_2D_H__ -#define __BLI_JITTER_2D_H__ +#pragma once /** \file * \ingroup bli @@ -35,5 +34,3 @@ void BLI_jitterate2(float (*jit1)[2], float (*jit2)[2], int num, float radius2); #ifdef __cplusplus } #endif - -#endif /* __BLI_JITTER_2D_H__ */ diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h index 9e4e30181b9..5e317c89625 100644 --- a/source/blender/blenlib/BLI_kdopbvh.h +++ b/source/blender/blenlib/BLI_kdopbvh.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_KDOPBVH_H__ -#define __BLI_KDOPBVH_H__ +#pragma once /** \file * \ingroup bli @@ -264,5 +263,3 @@ extern const float bvhtree_kdop_axes[13][3]; #ifdef __cplusplus } #endif - -#endif /* __BLI_KDOPBVH_H__ */ diff --git a/source/blender/blenlib/BLI_kdtree.h b/source/blender/blenlib/BLI_kdtree.h index 9ba045fdbf8..76f39dfbacb 100644 --- a/source/blender/blenlib/BLI_kdtree.h +++ b/source/blender/blenlib/BLI_kdtree.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_KDTREE_H__ -#define __BLI_KDTREE_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -73,5 +72,3 @@ extern "C" { #ifdef __cplusplus } #endif - -#endif /* __BLI_KDTREE_H__ */ diff --git a/source/blender/blenlib/BLI_lasso_2d.h b/source/blender/blenlib/BLI_lasso_2d.h index fb661c41784..e920d1189a2 100644 --- a/source/blender/blenlib/BLI_lasso_2d.h +++ b/source/blender/blenlib/BLI_lasso_2d.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_LASSO_2D_H__ -#define __BLI_LASSO_2D_H__ +#pragma once /** \file * \ingroup bli @@ -47,5 +46,3 @@ bool BLI_lasso_is_edge_inside(const int mcoords[][2], #ifdef __cplusplus } #endif - -#endif /* __BLI_LASSO_2D_H__ */ diff --git a/source/blender/blenlib/BLI_linear_allocator.hh b/source/blender/blenlib/BLI_linear_allocator.hh index 39a3ed27f42..fcc20d483c9 100644 --- a/source/blender/blenlib/BLI_linear_allocator.hh +++ b/source/blender/blenlib/BLI_linear_allocator.hh @@ -22,8 +22,7 @@ * memory. When the current buffer is full, it reallocates a new larger buffer and continues. */ -#ifndef __BLI_LINEAR_ALLOCATOR_HH__ -#define __BLI_LINEAR_ALLOCATOR_HH__ +#pragma once #include "BLI_string_ref.hh" #include "BLI_utility_mixins.hh" @@ -219,5 +218,3 @@ template<typename Allocator = GuardedAllocator> class LinearAllocator : NonCopya }; } // namespace blender - -#endif /* __BLI_LINEAR_ALLOCATOR_HH__ */ diff --git a/source/blender/blenlib/BLI_link_utils.h b/source/blender/blenlib/BLI_link_utils.h index c0db53ca9a3..a877860cd8d 100644 --- a/source/blender/blenlib/BLI_link_utils.h +++ b/source/blender/blenlib/BLI_link_utils.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_LINK_UTILS_H__ -#define __BLI_LINK_UTILS_H__ +#pragma once /** \file * \ingroup bli @@ -67,5 +66,3 @@ } \ } \ (void)0 - -#endif /* __BLI_LINK_UTILS_H__ */ diff --git a/source/blender/blenlib/BLI_linklist.h b/source/blender/blenlib/BLI_linklist.h index 324da859af1..25d58a3050c 100644 --- a/source/blender/blenlib/BLI_linklist.h +++ b/source/blender/blenlib/BLI_linklist.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_LINKLIST_H__ -#define __BLI_LINKLIST_H__ +#pragma once /** \file * \ingroup bli @@ -101,5 +100,3 @@ LinkNode *BLI_linklist_sort_r(LinkNode *list, #ifdef __cplusplus } #endif - -#endif /* __BLI_LINKLIST_H__ */ diff --git a/source/blender/blenlib/BLI_linklist_lockfree.h b/source/blender/blenlib/BLI_linklist_lockfree.h index 647b00ec658..142fa1cf243 100644 --- a/source/blender/blenlib/BLI_linklist_lockfree.h +++ b/source/blender/blenlib/BLI_linklist_lockfree.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_LINKLIST_LOCKFREE_H__ -#define __BLI_LINKLIST_LOCKFREE_H__ +#pragma once /** \file * \ingroup bli @@ -73,5 +72,3 @@ void BLI_linklist_lockfree_insert(LockfreeLinkList *list, LockfreeLinkNode *node #ifdef __cplusplus } #endif - -#endif /* __BLI_LINKLIST_H__ */ diff --git a/source/blender/blenlib/BLI_linklist_stack.h b/source/blender/blenlib/BLI_linklist_stack.h index 3725682d380..065ed12f353 100644 --- a/source/blender/blenlib/BLI_linklist_stack.h +++ b/source/blender/blenlib/BLI_linklist_stack.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_LINKLIST_STACK_H__ -#define __BLI_LINKLIST_STACK_H__ +#pragma once /** \file * \ingroup bli @@ -194,5 +193,3 @@ (void)0 /** \} */ - -#endif /* __BLI_LINKLIST_STACK_H__ */ diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h index b027acb88da..fa7cf7a1847 100644 --- a/source/blender/blenlib/BLI_listbase.h +++ b/source/blender/blenlib/BLI_listbase.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_LISTBASE_H__ -#define __BLI_LISTBASE_H__ +#pragma once /** \file * \ingroup bli @@ -190,5 +189,3 @@ struct LinkData *BLI_genericNodeN(void *data); #ifdef __cplusplus } #endif - -#endif /* __BLI_LISTBASE_H__ */ diff --git a/source/blender/blenlib/BLI_listbase_wrapper.hh b/source/blender/blenlib/BLI_listbase_wrapper.hh index 46f4a9d49fa..00f757d4bc2 100644 --- a/source/blender/blenlib/BLI_listbase_wrapper.hh +++ b/source/blender/blenlib/BLI_listbase_wrapper.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_LISTBASE_WRAPPER_HH__ -#define __BLI_LISTBASE_WRAPPER_HH__ +#pragma once /** \file * \ingroup bli @@ -111,5 +110,3 @@ template<typename T> class ListBaseWrapper { }; } /* namespace blender */ - -#endif /* __BLI_LISTBASE_WRAPPER_HH__ */ diff --git a/source/blender/blenlib/BLI_map.hh b/source/blender/blenlib/BLI_map.hh index dd375272fdb..f90d59f45a5 100644 --- a/source/blender/blenlib/BLI_map.hh +++ b/source/blender/blenlib/BLI_map.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_MAP_HH__ -#define __BLI_MAP_HH__ +#pragma once /** \file * \ingroup bli @@ -1242,5 +1241,3 @@ template<typename Key, typename Value> class StdUnorderedMapWrapper { }; } // namespace blender - -#endif /* __BLI_MAP_HH__ */ diff --git a/source/blender/blenlib/BLI_map_slots.hh b/source/blender/blenlib/BLI_map_slots.hh index b5360795a13..25fb92d61a3 100644 --- a/source/blender/blenlib/BLI_map_slots.hh +++ b/source/blender/blenlib/BLI_map_slots.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_MAP_SLOTS_HH__ -#define __BLI_MAP_SLOTS_HH__ +#pragma once /** \file * \ingroup bli @@ -357,5 +356,3 @@ template<typename Key, typename Value> struct DefaultMapSlot<Key *, Value> { }; } // namespace blender - -#endif /* __BLI_MAP_SLOTS_HH__ */ diff --git a/source/blender/blenlib/BLI_math.h b/source/blender/blenlib/BLI_math.h index f8de8b7ed53..51833d081d0 100644 --- a/source/blender/blenlib/BLI_math.h +++ b/source/blender/blenlib/BLI_math.h @@ -20,8 +20,7 @@ * * */ -#ifndef __BLI_MATH_H__ -#define __BLI_MATH_H__ +#pragma once /** \file * \ingroup bli @@ -73,5 +72,3 @@ #include "BLI_math_solvers.h" #include "BLI_math_statistics.h" #include "BLI_math_vector.h" - -#endif /* __BLI_MATH_H__ */ diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index c456ab0ecef..f407da3133f 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -20,8 +20,7 @@ * * */ -#ifndef __BLI_MATH_BASE_H__ -#define __BLI_MATH_BASE_H__ +#pragma once /** \file * \ingroup bli @@ -289,5 +288,3 @@ double double_round(double x, int ndigits); #ifdef __cplusplus } #endif - -#endif /* __BLI_MATH_BASE_H__ */ diff --git a/source/blender/blenlib/BLI_math_base_safe.h b/source/blender/blenlib/BLI_math_base_safe.h index 88a08c3cbc7..1d6590b2faa 100644 --- a/source/blender/blenlib/BLI_math_base_safe.h +++ b/source/blender/blenlib/BLI_math_base_safe.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_MATH_BASE_SAFE_H__ -#define __BLI_MATH_BASE_SAFE_H__ +#pragma once /** \file * \ingroup bli @@ -46,5 +45,3 @@ MINLINE float safe_powf(float base, float exponent); #if BLI_MATH_DO_INLINE # include "intern/math_base_safe_inline.c" #endif - -#endif /* __BLI_MATH_BASE_SAFE_H__ */ diff --git a/source/blender/blenlib/BLI_math_bits.h b/source/blender/blenlib/BLI_math_bits.h index 0283622ca89..b602900bedc 100644 --- a/source/blender/blenlib/BLI_math_bits.h +++ b/source/blender/blenlib/BLI_math_bits.h @@ -15,8 +15,7 @@ * * */ -#ifndef __BLI_MATH_BITS_H__ -#define __BLI_MATH_BITS_H__ +#pragma once /** \file * \ingroup bli @@ -68,5 +67,3 @@ MINLINE float xor_fl(float x, int y); #ifdef __cplusplus } #endif - -#endif /* __BLI_MATH_BITS_H__ */ diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h index 48f8e7d31d9..943f0fc764f 100644 --- a/source/blender/blenlib/BLI_math_color.h +++ b/source/blender/blenlib/BLI_math_color.h @@ -20,8 +20,7 @@ * * */ -#ifndef __BLI_MATH_COLOR_H__ -#define __BLI_MATH_COLOR_H__ +#pragma once /** \file * \ingroup bli @@ -162,5 +161,3 @@ void lift_gamma_gain_to_asc_cdl(const float *lift, #ifdef __cplusplus } #endif - -#endif /* __BLI_MATH_COLOR_H__ */ diff --git a/source/blender/blenlib/BLI_math_color_blend.h b/source/blender/blenlib/BLI_math_color_blend.h index 60ada1e4509..d5e4eedb1a6 100644 --- a/source/blender/blenlib/BLI_math_color_blend.h +++ b/source/blender/blenlib/BLI_math_color_blend.h @@ -20,8 +20,7 @@ * * */ -#ifndef __BLI_MATH_COLOR_BLEND_H__ -#define __BLI_MATH_COLOR_BLEND_H__ +#pragma once /** \file * \ingroup bli @@ -151,5 +150,3 @@ MINLINE void blend_color_interpolate_float(float dst[4], #ifdef __cplusplus } #endif - -#endif /* __BLI_MATH_COLOR_BLEND_H__ */ diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 64b0dcccda1..213f5a029b0 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -20,8 +20,7 @@ * * */ -#ifndef __BLI_MATH_GEOM_H__ -#define __BLI_MATH_GEOM_H__ +#pragma once /** \file * \ingroup bli @@ -403,15 +402,19 @@ bool isect_ray_tri_epsilon_v3(const float ray_origin[3], float *r_lambda, float r_uv[2], const float epsilon); -bool isect_tri_tri_epsilon_v3(const float t_a0[3], - const float t_a1[3], - const float t_a2[3], - const float t_b0[3], - const float t_b1[3], - const float t_b2[3], - float r_i1[3], - float r_i2[3], - const float epsilon); +bool isect_tri_tri_v3_ex(const float tri_a[3][3], + const float tri_b[3][3], + float r_i1[3], + float r_i2[3], + int *r_tri_a_edge_isect_count); +bool isect_tri_tri_v3(const float t_a0[3], + const float t_a1[3], + const float t_a2[3], + const float t_b0[3], + const float t_b1[3], + const float t_b2[3], + float r_i1[3], + float r_i2[3]); bool isect_tri_tri_v2(const float p1[2], const float q1[2], @@ -454,11 +457,11 @@ bool isect_ray_seg_v2(const float ray_origin[2], float *r_lambda, float *r_u); -bool isect_ray_seg_v3(const float ray_origin[3], - const float ray_direction[3], - const float v0[3], - const float v1[3], - float *r_lambda); +bool isect_ray_line_v3(const float ray_origin[3], + const float ray_direction[3], + const float v0[3], + const float v1[3], + float *r_lambda); /* point in polygon */ bool isect_point_poly_v2(const float pt[2], @@ -825,5 +828,3 @@ float cubic_tangent_factor_circle_v3(const float tan_l[3], const float tan_r[3]) #ifdef __cplusplus } #endif - -#endif /* __BLI_MATH_GEOM_H__ */ diff --git a/source/blender/blenlib/BLI_math_inline.h b/source/blender/blenlib/BLI_math_inline.h index 3e32a517471..506386f8d25 100644 --- a/source/blender/blenlib/BLI_math_inline.h +++ b/source/blender/blenlib/BLI_math_inline.h @@ -20,8 +20,7 @@ * * */ -#ifndef __BLI_MATH_INLINE_H__ -#define __BLI_MATH_INLINE_H__ +#pragma once /** \file * \ingroup bli @@ -56,5 +55,3 @@ extern "C" { #ifdef __cplusplus } #endif - -#endif /* __BLI_MATH_INLINE_H__ */ diff --git a/source/blender/blenlib/BLI_math_interp.h b/source/blender/blenlib/BLI_math_interp.h index 0f3032fa625..3e9839b4d3a 100644 --- a/source/blender/blenlib/BLI_math_interp.h +++ b/source/blender/blenlib/BLI_math_interp.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_MATH_INTERP_H__ -#define __BLI_MATH_INTERP_H__ +#pragma once /** \file * \ingroup bli @@ -95,5 +94,3 @@ void BLI_ewa_filter(const int width, #ifdef __cplusplus } #endif - -#endif /* __BLI_MATH_INTERP_H__ */ diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h index 33fcd750aee..a00fdaa0ae9 100644 --- a/source/blender/blenlib/BLI_math_matrix.h +++ b/source/blender/blenlib/BLI_math_matrix.h @@ -19,8 +19,7 @@ * The Original Code is: some of this file. * */ -#ifndef __BLI_MATH_MATRIX_H__ -#define __BLI_MATH_MATRIX_H__ +#pragma once /** \file * \ingroup bli @@ -399,5 +398,3 @@ void print_m4(const char *str, const float M[4][4]); #ifdef __cplusplus } #endif - -#endif /* __BLI_MATH_MATRIX_H__ */ diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index b7ae35b2e23..61708528e24 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -20,8 +20,7 @@ * * */ -#ifndef __BLI_MATH_ROTATION_H__ -#define __BLI_MATH_ROTATION_H__ +#pragma once /** \file * \ingroup bli @@ -246,5 +245,3 @@ bool mat3_from_axis_conversion_single(int src_axis, int dst_axis, float r_mat[3] #ifdef __cplusplus } #endif - -#endif /* __BLI_MATH_ROTATION_H__ */ diff --git a/source/blender/blenlib/BLI_math_solvers.h b/source/blender/blenlib/BLI_math_solvers.h index 193bbdd4e8c..9b2d1eedec7 100644 --- a/source/blender/blenlib/BLI_math_solvers.h +++ b/source/blender/blenlib/BLI_math_solvers.h @@ -17,8 +17,7 @@ * All rights reserved. * */ -#ifndef __BLI_MATH_SOLVERS_H__ -#define __BLI_MATH_SOLVERS_H__ +#pragma once /** \file * \ingroup bli @@ -76,5 +75,3 @@ bool BLI_newton3d_solve(Newton3D_DeltaFunc func_delta, #ifdef __cplusplus } #endif - -#endif /* __BLI_MATH_SOLVERS_H__ */ diff --git a/source/blender/blenlib/BLI_math_statistics.h b/source/blender/blenlib/BLI_math_statistics.h index a9f9ae39506..aebc445002b 100644 --- a/source/blender/blenlib/BLI_math_statistics.h +++ b/source/blender/blenlib/BLI_math_statistics.h @@ -17,8 +17,7 @@ * All rights reserved. * */ -#ifndef __BLI_MATH_STATISTICS_H__ -#define __BLI_MATH_STATISTICS_H__ +#pragma once /** \file * \ingroup bli @@ -57,5 +56,3 @@ void BLI_covariance_m3_v3n(const float (*cos_v3)[3], #ifdef __cplusplus } #endif - -#endif /* __BLI_MATH_STATISTICS_H__ */ diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index d46c02a961c..1ccfe5d86b1 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -20,8 +20,7 @@ * * */ -#ifndef __BLI_MATH_VECTOR_H__ -#define __BLI_MATH_VECTOR_H__ +#pragma once /** \file * \ingroup bli @@ -133,6 +132,7 @@ MINLINE void sub_v3_v3v3_db(double r[3], const double a[3], const double b[3]); MINLINE void sub_v4_v4(float r[4], const float a[4]); MINLINE void sub_v4_v4v4(float r[4], const float a[4], const float b[4]); +MINLINE void sub_v2db_v2fl_v2fl(double r[2], const float a[2], const float b[2]); MINLINE void sub_v3db_v3fl_v3fl(double r[3], const float a[3], const float b[3]); MINLINE void mul_v2_fl(float r[2], float f); @@ -205,6 +205,7 @@ MINLINE double dot_v3db_v3fl(const double a[3], const float b[3]) ATTR_WARN_UNUS MINLINE double dot_v3v3_db(const double a[3], const double b[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float cross_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT; +MINLINE double cross_v2v2_db(const double a[2], const double b[2]) ATTR_WARN_UNUSED_RESULT; MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3]); MINLINE void cross_v3_v3v3_hi_prec(float r[3], const float a[3], const float b[3]); MINLINE void cross_v3_v3v3_db(double r[3], const double a[3], const double b[3]); @@ -221,6 +222,7 @@ MINLINE float len_manhattan_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT; MINLINE int len_manhattan_v2_int(const int v[2]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_manhattan_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT; +MINLINE double len_v2_db(const double v[2]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT; MINLINE double len_v2v2_db(const double a[2], const double b[2]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_v2v2_int(const int v1[2], const int v2[2]); @@ -523,5 +525,3 @@ void mul_vn_db(double *array_tar, const int size, const double f); #ifdef __cplusplus } #endif - -#endif /* __BLI_MATH_VECTOR_H__ */ diff --git a/source/blender/blenlib/BLI_memarena.h b/source/blender/blenlib/BLI_memarena.h index e0aff82e874..87a320e336d 100644 --- a/source/blender/blenlib/BLI_memarena.h +++ b/source/blender/blenlib/BLI_memarena.h @@ -21,8 +21,7 @@ * \ingroup bli */ -#ifndef __BLI_MEMARENA_H__ -#define __BLI_MEMARENA_H__ +#pragma once #include "BLI_compiler_attrs.h" @@ -55,5 +54,3 @@ void BLI_memarena_clear(MemArena *ma) ATTR_NONNULL(1); #ifdef __cplusplus } #endif - -#endif /* __BLI_MEMARENA_H__ */ diff --git a/source/blender/blenlib/BLI_memblock.h b/source/blender/blenlib/BLI_memblock.h index 8f66ee3b9cb..cb6b31d54e0 100644 --- a/source/blender/blenlib/BLI_memblock.h +++ b/source/blender/blenlib/BLI_memblock.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_MEMBLOCK_H__ -#define __BLI_MEMBLOCK_H__ +#pragma once /** \file * \ingroup bli @@ -63,5 +62,3 @@ void *BLI_memblock_elem_get(BLI_memblock *mblk, int chunk, int elem) ATTR_WARN_U #ifdef __cplusplus } #endif - -#endif /* __BLI_MEMBLOCK_H__ */ diff --git a/source/blender/blenlib/BLI_memiter.h b/source/blender/blenlib/BLI_memiter.h index 4aa9cdb6b6c..c7a715309e1 100644 --- a/source/blender/blenlib/BLI_memiter.h +++ b/source/blender/blenlib/BLI_memiter.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_MEMITER_H__ -#define __BLI_MEMITER_H__ +#pragma once /** \file * \ingroup bli @@ -69,5 +68,3 @@ void *BLI_memiter_iter_step_size(BLI_memiter_handle *iter, uint *r_size) ATTR_WA #ifdef __cplusplus } #endif - -#endif /* __BLI_MEMITER_H__ */ diff --git a/source/blender/blenlib/BLI_memory_utils.hh b/source/blender/blenlib/BLI_memory_utils.hh index 9f65fe0742e..d663bf4038d 100644 --- a/source/blender/blenlib/BLI_memory_utils.hh +++ b/source/blender/blenlib/BLI_memory_utils.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_MEMORY_UTILS_HH__ -#define __BLI_MEMORY_UTILS_HH__ +#pragma once /** \file * \ingroup bli @@ -429,5 +428,3 @@ inline constexpr int64_t default_inline_buffer_capacity(size_t element_size) } } // namespace blender - -#endif /* __BLI_MEMORY_UTILS_HH__ */ diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h index 3749f9e1b76..3ee6f182593 100644 --- a/source/blender/blenlib/BLI_mempool.h +++ b/source/blender/blenlib/BLI_mempool.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_MEMPOOL_H__ -#define __BLI_MEMPOOL_H__ +#pragma once /** \file * \ingroup bli @@ -97,5 +96,3 @@ void BLI_mempool_iter_threadsafe_free(BLI_mempool_iter *iter_arr) ATTR_NONNULL() #ifdef __cplusplus } #endif - -#endif /* __BLI_MEMPOOL_H__ */ diff --git a/source/blender/blenlib/BLI_noise.h b/source/blender/blenlib/BLI_noise.h index 32731ff24fc..cb66b0552df 100644 --- a/source/blender/blenlib/BLI_noise.h +++ b/source/blender/blenlib/BLI_noise.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_NOISE_H__ -#define __BLI_NOISE_H__ +#pragma once /** \file * \ingroup bli @@ -79,5 +78,3 @@ void cellNoiseV(float x, float y, float z, float r_ca[3]); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 30823773d6c..05c256ccf1c 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BLI_PATH_UTIL_H__ -#define __BLI_PATH_UTIL_H__ +#pragma once /** \file * \ingroup bli @@ -158,5 +157,3 @@ bool BLI_path_suffix(char *string, size_t maxlen, const char *suffix, const char #ifdef __cplusplus } #endif - -#endif /* __BLI_PATH_UTIL_H__ */ diff --git a/source/blender/blenlib/BLI_polyfill_2d.h b/source/blender/blenlib/BLI_polyfill_2d.h index cb12b73c1d5..ca63ea5af87 100644 --- a/source/blender/blenlib/BLI_polyfill_2d.h +++ b/source/blender/blenlib/BLI_polyfill_2d.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_POLYFILL_2D_H__ -#define __BLI_POLYFILL_2D_H__ +#pragma once /** \file * \ingroup bli @@ -45,5 +44,3 @@ void BLI_polyfill_calc(const float (*coords)[2], #ifdef __cplusplus } #endif - -#endif /* __BLI_POLYFILL_2D_H__ */ diff --git a/source/blender/blenlib/BLI_polyfill_2d_beautify.h b/source/blender/blenlib/BLI_polyfill_2d_beautify.h index 94c4b412225..2c5296269ae 100644 --- a/source/blender/blenlib/BLI_polyfill_2d_beautify.h +++ b/source/blender/blenlib/BLI_polyfill_2d_beautify.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_POLYFILL_2D_BEAUTIFY_H__ -#define __BLI_POLYFILL_2D_BEAUTIFY_H__ +#pragma once /** \file * \ingroup bli @@ -51,5 +50,3 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex(const float v1[2], #ifdef __cplusplus } #endif - -#endif /* __BLI_POLYFILL_2D_BEAUTIFY_H__ */ diff --git a/source/blender/blenlib/BLI_probing_strategies.hh b/source/blender/blenlib/BLI_probing_strategies.hh index 0e5338fa6ed..a37a979b754 100644 --- a/source/blender/blenlib/BLI_probing_strategies.hh +++ b/source/blender/blenlib/BLI_probing_strategies.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_PROBING_STRATEGIES_HH__ -#define __BLI_PROBING_STRATEGIES_HH__ +#pragma once /** \file * \ingroup bli @@ -246,5 +245,3 @@ using DefaultProbingStrategy = PythonProbingStrategy<>; // clang-format on } // namespace blender - -#endif /* __BLI_PROBING_STRATEGIES_HH__ */ diff --git a/source/blender/blenlib/BLI_quadric.h b/source/blender/blenlib/BLI_quadric.h index 1383a19ed1f..fdb7d1e67ac 100644 --- a/source/blender/blenlib/BLI_quadric.h +++ b/source/blender/blenlib/BLI_quadric.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_QUADRIC_H__ -#define __BLI_QUADRIC_H__ +#pragma once /** \file * \ingroup bli @@ -50,5 +49,3 @@ bool BLI_quadric_optimize(const Quadric *q, double v[3], const double epsilon); #ifdef __cplusplus } #endif - -#endif /* __BLI_QUADRIC_H__ */ diff --git a/source/blender/blenlib/BLI_rand.h b/source/blender/blenlib/BLI_rand.h index c55bbd26db5..78a323c2431 100644 --- a/source/blender/blenlib/BLI_rand.h +++ b/source/blender/blenlib/BLI_rand.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_RAND_H__ -#define __BLI_RAND_H__ +#pragma once #include "BLI_compiler_attrs.h" #include "BLI_sys_types.h" @@ -116,5 +115,3 @@ void BLI_hammersley_2d_sequence(unsigned int n, double *r); #ifdef __cplusplus } #endif - -#endif /* __BLI_RAND_H__ */ diff --git a/source/blender/blenlib/BLI_rand.hh b/source/blender/blenlib/BLI_rand.hh index 612ac0bbe19..72c750d9fa2 100644 --- a/source/blender/blenlib/BLI_rand.hh +++ b/source/blender/blenlib/BLI_rand.hh @@ -18,8 +18,7 @@ * \ingroup bli */ -#ifndef __BLI_RAND_HH__ -#define __BLI_RAND_HH__ +#pragma once #include "BLI_float2.hh" #include "BLI_float3.hh" @@ -105,5 +104,3 @@ class RandomNumberGenerator { }; } // namespace blender - -#endif /* __BLI_RAND_HH__ */ diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h index 14d18308ed6..ae3eb9d2144 100644 --- a/source/blender/blenlib/BLI_rect.h +++ b/source/blender/blenlib/BLI_rect.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_RECT_H__ -#define __BLI_RECT_H__ +#pragma once /** \file * \ingroup bli @@ -166,5 +165,3 @@ BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct) #ifdef __cplusplus } #endif - -#endif /* __BLI_RECT_H__ */ diff --git a/source/blender/blenlib/BLI_resource_collector.hh b/source/blender/blenlib/BLI_resource_collector.hh index 10d610da618..9c8fefc1202 100644 --- a/source/blender/blenlib/BLI_resource_collector.hh +++ b/source/blender/blenlib/BLI_resource_collector.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_RESOURCE_COLLECTOR_HH__ -#define __BLI_RESOURCE_COLLECTOR_HH__ +#pragma once /** \file * \ingroup bli @@ -141,5 +140,3 @@ class ResourceCollector : NonCopyable, NonMovable { }; } // namespace blender - -#endif /* __BLI_RESOURCE_COLLECTOR_HH__ */ diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h index 376ea9d88de..cf74bc14cac 100644 --- a/source/blender/blenlib/BLI_scanfill.h +++ b/source/blender/blenlib/BLI_scanfill.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_SCANFILL_H__ -#define __BLI_SCANFILL_H__ +#pragma once /** \file * \ingroup bli @@ -131,5 +130,3 @@ bool BLI_scanfill_calc_self_isect(ScanFillContext *sf_ctx, #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenlib/BLI_session_uuid.h b/source/blender/blenlib/BLI_session_uuid.h new file mode 100644 index 00000000000..05355a85b39 --- /dev/null +++ b/source/blender/blenlib/BLI_session_uuid.h @@ -0,0 +1,68 @@ +/* + * 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. + */ + +#pragma once + +/** \file + * \ingroup bli + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "DNA_session_uuid_types.h" + +/* Generate new UUID which is unique throughout the Blender session. */ +SessionUUID BLI_session_uuid_generate(void); + +/* Check whether the UUID is properly generated. */ +bool BLI_session_uuid_is_generated(const SessionUUID *uuid); + +/* Check whether two UUIDs are identical. */ +bool BLI_session_uuid_is_equal(const SessionUUID *lhs, const SessionUUID *rhs); + +uint64_t BLI_session_uuid_hash_uint64(const SessionUUID *uuid); + +/* Utility functions to make it possible to create GHash/GSet with UUID as a key. */ +uint BLI_session_uuid_ghash_hash(const void *uuid_v); +bool BLI_session_uuid_ghash_compare(const void *lhs_v, const void *rhs_v); + +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus + +namespace blender { + +inline const bool operator==(const SessionUUID &lhs, const SessionUUID &rhs) +{ + return BLI_session_uuid_is_equal(&lhs, &rhs); +} + +template<typename T> struct DefaultHash; + +template<> struct DefaultHash<SessionUUID> { + uint64_t operator()(const SessionUUID &value) const + { + return BLI_session_uuid_hash_uint64(&value); + } +}; + +} // namespace blender + +#endif diff --git a/source/blender/blenlib/BLI_set.hh b/source/blender/blenlib/BLI_set.hh index 90adea69e06..eb4e258b679 100644 --- a/source/blender/blenlib/BLI_set.hh +++ b/source/blender/blenlib/BLI_set.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_SET_HH__ -#define __BLI_SET_HH__ +#pragma once /** \file * \ingroup bli @@ -831,5 +830,3 @@ template<typename Key, using RawSet = Set<Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, RawAllocator>; } // namespace blender - -#endif /* __BLI_SET_HH__ */ diff --git a/source/blender/blenlib/BLI_set_slots.hh b/source/blender/blenlib/BLI_set_slots.hh index b78ed37f534..ee5da17fcaf 100644 --- a/source/blender/blenlib/BLI_set_slots.hh +++ b/source/blender/blenlib/BLI_set_slots.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_SET_SLOTS_HH__ -#define __BLI_SET_SLOTS_HH__ +#pragma once /** \file * \ingroup bli @@ -411,5 +410,3 @@ template<typename Key> struct DefaultSetSlot<Key *> { }; } // namespace blender - -#endif /* __BLI_SET_SLOTS_HH__ */ diff --git a/source/blender/blenlib/BLI_smallhash.h b/source/blender/blenlib/BLI_smallhash.h index cb0330d1bad..daea2fcd914 100644 --- a/source/blender/blenlib/BLI_smallhash.h +++ b/source/blender/blenlib/BLI_smallhash.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_SMALLHASH_H__ -#define __BLI_SMALLHASH_H__ +#pragma once /** \file * \ingroup bli @@ -81,5 +80,3 @@ double BLI_smallhash_calc_quality(SmallHash *sh); #ifdef __cplusplus } #endif - -#endif /* __BLI_SMALLHASH_H__ */ diff --git a/source/blender/blenlib/BLI_sort.h b/source/blender/blenlib/BLI_sort.h index 08e61915a83..969816086e2 100644 --- a/source/blender/blenlib/BLI_sort.h +++ b/source/blender/blenlib/BLI_sort.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_SORT_H__ -#define __BLI_SORT_H__ +#pragma once /** \file * \ingroup bli @@ -39,5 +38,3 @@ void BLI_qsort_r(void *a, size_t n, size_t es, BLI_sort_cmp_t cmp, void *thunk) __attribute__((nonnull(1, 5))) #endif ; - -#endif /* __BLI_SORT_H__ */ diff --git a/source/blender/blenlib/BLI_sort_utils.h b/source/blender/blenlib/BLI_sort_utils.h index 9c99f893a1f..e54252f4e1b 100644 --- a/source/blender/blenlib/BLI_sort_utils.h +++ b/source/blender/blenlib/BLI_sort_utils.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_SORT_UTILS_H__ -#define __BLI_SORT_UTILS_H__ +#pragma once /** \file * \ingroup bli @@ -64,5 +63,3 @@ int BLI_sortutil_cmp_ptr_reverse(const void *a_, const void *b_); #ifdef __cplusplus } #endif - -#endif /* __BLI_SORT_UTILS_H__ */ diff --git a/source/blender/blenlib/BLI_span.hh b/source/blender/blenlib/BLI_span.hh index 2d875fe73be..a2de76e080e 100644 --- a/source/blender/blenlib/BLI_span.hh +++ b/source/blender/blenlib/BLI_span.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_SPAN_HH__ -#define __BLI_SPAN_HH__ +#pragma once /** \file * \ingroup bli @@ -645,5 +644,3 @@ void assert_same_size(const T1 &v1, const T2 &v2, const T3 &v3) } } /* namespace blender */ - -#endif /* __BLI_SPAN_HH__ */ diff --git a/source/blender/blenlib/BLI_stack.h b/source/blender/blenlib/BLI_stack.h index 9fc25e378a3..b00bc0a2e57 100644 --- a/source/blender/blenlib/BLI_stack.h +++ b/source/blender/blenlib/BLI_stack.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_STACK_H__ -#define __BLI_STACK_H__ +#pragma once /** \file * \ingroup bli @@ -55,5 +54,3 @@ bool BLI_stack_is_empty(const BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NON #ifdef __cplusplus } #endif - -#endif /* __BLI_STACK_H__ */ diff --git a/source/blender/blenlib/BLI_stack.hh b/source/blender/blenlib/BLI_stack.hh index 75ae9df79a4..5fa7867e176 100644 --- a/source/blender/blenlib/BLI_stack.hh +++ b/source/blender/blenlib/BLI_stack.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_STACK_HH__ -#define __BLI_STACK_HH__ +#pragma once /** \file * \ingroup bli @@ -386,5 +385,3 @@ template<typename T, int64_t InlineBufferCapacity = default_inline_buffer_capaci using RawStack = Stack<T, InlineBufferCapacity, RawAllocator>; } /* namespace blender */ - -#endif /* __BLI_STACK_HH__ */ diff --git a/source/blender/blenlib/BLI_strict_flags.h b/source/blender/blenlib/BLI_strict_flags.h index cf7888d3c5e..6cee6b64797 100644 --- a/source/blender/blenlib/BLI_strict_flags.h +++ b/source/blender/blenlib/BLI_strict_flags.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_STRICT_FLAGS_H__ -#define __BLI_STRICT_FLAGS_H__ +#pragma once /** \file * \ingroup bli @@ -53,5 +52,3 @@ # pragma warning(error : 4305) /* truncation from 'type1' to 'type2' */ # pragma warning(error : 4389) /* signed/unsigned mismatch */ #endif - -#endif /* __BLI_STRICT_FLAGS_H__ */ diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index 00e4e3485d1..d1fab065959 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_STRING_H__ -#define __BLI_STRING_H__ +#pragma once /** \file * \ingroup bli @@ -206,5 +205,3 @@ int BLI_string_find_split_words(const char *str, #ifdef __cplusplus } #endif - -#endif /* __BLI_STRING_H__ */ diff --git a/source/blender/blenlib/BLI_string_cursor_utf8.h b/source/blender/blenlib/BLI_string_cursor_utf8.h index f8afff214a3..e78c7b56cf7 100644 --- a/source/blender/blenlib/BLI_string_cursor_utf8.h +++ b/source/blender/blenlib/BLI_string_cursor_utf8.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_STRING_CURSOR_UTF8_H__ -#define __BLI_STRING_CURSOR_UTF8_H__ +#pragma once /** \file * \ingroup bli @@ -59,5 +58,3 @@ void BLI_str_cursor_step_utf32(const char32_t *str, #ifdef __cplusplus } #endif - -#endif /* __BLI_STRING_CURSOR_UTF8_H__ */ diff --git a/source/blender/blenlib/BLI_string_ref.hh b/source/blender/blenlib/BLI_string_ref.hh index 06fc66f6b55..8bf4821f72a 100644 --- a/source/blender/blenlib/BLI_string_ref.hh +++ b/source/blender/blenlib/BLI_string_ref.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_STRING_REF_HH__ -#define __BLI_STRING_REF_HH__ +#pragma once /** \file * \ingroup bli @@ -371,5 +370,3 @@ inline StringRef StringRefBase::substr(const int64_t start, const int64_t size) } } // namespace blender - -#endif /* __BLI_STRING_REF_HH__ */ diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h index 78e7113b6ef..3620a3ccc55 100644 --- a/source/blender/blenlib/BLI_string_utf8.h +++ b/source/blender/blenlib/BLI_string_utf8.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_STRING_UTF8_H__ -#define __BLI_STRING_UTF8_H__ +#pragma once /** \file * \ingroup bli @@ -115,5 +114,3 @@ int BLI_str_utf8_offset_from_column(const char *str, int column); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenlib/BLI_string_utils.h b/source/blender/blenlib/BLI_string_utils.h index 857b22540e9..46fb096599f 100644 --- a/source/blender/blenlib/BLI_string_utils.h +++ b/source/blender/blenlib/BLI_string_utils.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_STRING_UTILS_H__ -#define __BLI_STRING_UTILS_H__ +#pragma once /** \file * \ingroup bli @@ -97,5 +96,3 @@ bool BLI_uniquename(struct ListBase *list, #ifdef __cplusplus } #endif - -#endif /* __BLI_STRING_UTILS_H__ */ diff --git a/source/blender/blenlib/BLI_sys_types.h b/source/blender/blenlib/BLI_sys_types.h index ef15ce111b6..ff1f6af9573 100644 --- a/source/blender/blenlib/BLI_sys_types.h +++ b/source/blender/blenlib/BLI_sys_types.h @@ -31,8 +31,7 @@ * For these rogue platforms, we make the typedefs ourselves. */ -#ifndef __BLI_SYS_TYPES_H__ -#define __BLI_SYS_TYPES_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -89,5 +88,3 @@ typedef unsigned char uchar; #ifdef __cplusplus } #endif - -#endif /* eof */ diff --git a/source/blender/blenlib/BLI_system.h b/source/blender/blenlib/BLI_system.h index 50f8adc20f6..8dd0706e1e2 100644 --- a/source/blender/blenlib/BLI_system.h +++ b/source/blender/blenlib/BLI_system.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_SYSTEM_H__ -#define __BLI_SYSTEM_H__ +#pragma once #include <stdio.h> @@ -64,5 +63,3 @@ void BLI_windows_handle_exception(void *exception); #ifdef __cplusplus } #endif - -#endif /* __BLI_SYSTEM_H__ */ diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h index 920a0a8f650..a281aaa5b51 100644 --- a/source/blender/blenlib/BLI_threads.h +++ b/source/blender/blenlib/BLI_threads.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_THREADS_H__ -#define __BLI_THREADS_H__ +#pragma once /** \file * \ingroup bli @@ -205,5 +204,3 @@ void BLI_thread_put_thread_on_fast_node(void); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenlib/BLI_timecode.h b/source/blender/blenlib/BLI_timecode.h index d3c6803130a..1dff50efa23 100644 --- a/source/blender/blenlib/BLI_timecode.h +++ b/source/blender/blenlib/BLI_timecode.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_TIMECODE_H__ -#define __BLI_TIMECODE_H__ +#pragma once /** \file * \ingroup BLI @@ -49,5 +48,3 @@ size_t BLI_timecode_string_from_time_seconds(char *str, #ifdef __cplusplus } #endif - -#endif /* __BLI_TIMECODE_H__ */ diff --git a/source/blender/blenlib/BLI_timeit.hh b/source/blender/blenlib/BLI_timeit.hh index f0968587597..8e107585576 100644 --- a/source/blender/blenlib/BLI_timeit.hh +++ b/source/blender/blenlib/BLI_timeit.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_TIMEIT_HH__ -#define __BLI_TIMEIT_HH__ +#pragma once #include <chrono> #include <iostream> @@ -56,5 +55,3 @@ class ScopedTimer { } // namespace blender::timeit #define SCOPED_TIMER(name) blender::timeit::ScopedTimer scoped_timer(name) - -#endif /* __BLI_TIMEIT_HH__ */ diff --git a/source/blender/blenlib/BLI_timer.h b/source/blender/blenlib/BLI_timer.h index 144fcd0a0d7..19275ff5b9a 100644 --- a/source/blender/blenlib/BLI_timer.h +++ b/source/blender/blenlib/BLI_timer.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_TIMER_H__ -#define __BLI_TIMER_H__ +#pragma once #include "BLI_sys_types.h" @@ -61,5 +60,3 @@ void BLI_timer_on_file_load(void); #ifdef __cplusplus } #endif - -#endif /* __BLI_TIMER_H__ */ diff --git a/source/blender/blenlib/BLI_utildefines_iter.h b/source/blender/blenlib/BLI_utildefines_iter.h index bbd83573e53..5fb6248e1e9 100644 --- a/source/blender/blenlib/BLI_utildefines_iter.h +++ b/source/blender/blenlib/BLI_utildefines_iter.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_UTILDEFINES_ITER_H__ -#define __BLI_UTILDEFINES_ITER_H__ +#pragma once /** \file * \ingroup bli @@ -42,5 +41,3 @@ for (int _src = (src), _src2 = _src * 2, _dst2 = (dst)*2, _error = _dst2 - _src, i = 0, _delta; \ ((void)(_delta = divide_floor_i(_error, _dst2)), (void)(i -= _delta), (i < _src)); \ _error -= (_delta * _dst2) + _src2) - -#endif /* __BLI_UTILDEFINES_ITER_H__ */ diff --git a/source/blender/blenlib/BLI_utildefines_stack.h b/source/blender/blenlib/BLI_utildefines_stack.h index 9f9bfb0405d..f50004ef79a 100644 --- a/source/blender/blenlib/BLI_utildefines_stack.h +++ b/source/blender/blenlib/BLI_utildefines_stack.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_UTILDEFINES_STACK_H__ -#define __BLI_UTILDEFINES_STACK_H__ +#pragma once /** \file * \ingroup bli @@ -99,5 +98,3 @@ } \ ((void)0) #endif - -#endif /* __BLI_UTILDEFINES_STACK_H__ */ diff --git a/source/blender/blenlib/BLI_utildefines_variadic.h b/source/blender/blenlib/BLI_utildefines_variadic.h index f5a420a7faf..be0d0b93cc7 100644 --- a/source/blender/blenlib/BLI_utildefines_variadic.h +++ b/source/blender/blenlib/BLI_utildefines_variadic.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_UTILDEFINES_VARIADIC_H__ -#define __BLI_UTILDEFINES_VARIADIC_H__ +#pragma once /** \file * \ingroup bli @@ -47,5 +46,3 @@ _VA_NARGS_GLUE(_VA_NARGS_OVERLOAD_MACRO(name, VA_NARGS_COUNT(__VA_ARGS__)), (__VA_ARGS__)) /* clang-format on */ - -#endif /* __BLI_UTILDEFINES_VARIADIC_H__ */ diff --git a/source/blender/blenlib/BLI_utility_mixins.hh b/source/blender/blenlib/BLI_utility_mixins.hh index 61444e36725..69b1d85b3b6 100644 --- a/source/blender/blenlib/BLI_utility_mixins.hh +++ b/source/blender/blenlib/BLI_utility_mixins.hh @@ -18,8 +18,7 @@ * \ingroup bli */ -#ifndef __BLI_UTILITY_MIXINS_HH__ -#define __BLI_UTILITY_MIXINS_HH__ +#pragma once namespace blender { @@ -54,5 +53,3 @@ class NonMovable { }; } // namespace blender - -#endif /* __BLI_UTILITY_MIXINS_HH__ */ diff --git a/source/blender/blenlib/BLI_uvproject.h b/source/blender/blenlib/BLI_uvproject.h index 8a33ea6961c..6028d95bda0 100644 --- a/source/blender/blenlib/BLI_uvproject.h +++ b/source/blender/blenlib/BLI_uvproject.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_UVPROJECT_H__ -#define __BLI_UVPROJECT_H__ +#pragma once /** \file * \ingroup bli @@ -45,7 +44,7 @@ void BLI_uvproject_from_view(float target[2], float winy); /* apply ortho uv's */ -void BLI_uvproject_from_view_ortho(float target[2], float source[3], float rotmat[4][4]); +void BLI_uvproject_from_view_ortho(float target[2], float source[3], const float rotmat[4][4]); /* so we can adjust scale with keeping the struct private */ void BLI_uvproject_camera_info_scale(struct ProjCameraInfo *uci, float scale_x, float scale_y); @@ -53,5 +52,3 @@ void BLI_uvproject_camera_info_scale(struct ProjCameraInfo *uci, float scale_x, #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenlib/BLI_vector.hh b/source/blender/blenlib/BLI_vector.hh index 1bb674093bb..df577660f4e 100644 --- a/source/blender/blenlib/BLI_vector.hh +++ b/source/blender/blenlib/BLI_vector.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_VECTOR_HH__ -#define __BLI_VECTOR_HH__ +#pragma once /** \file * \ingroup bli @@ -832,5 +831,3 @@ template<typename T, int64_t InlineBufferCapacity = default_inline_buffer_capaci using RawVector = Vector<T, InlineBufferCapacity, RawAllocator>; } /* namespace blender */ - -#endif /* __BLI_VECTOR_HH__ */ diff --git a/source/blender/blenlib/BLI_vector_set.hh b/source/blender/blenlib/BLI_vector_set.hh index f007d41118f..c3b15bcf454 100644 --- a/source/blender/blenlib/BLI_vector_set.hh +++ b/source/blender/blenlib/BLI_vector_set.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_VECTOR_SET_HH__ -#define __BLI_VECTOR_SET_HH__ +#pragma once /** \file * \ingroup bli @@ -744,5 +743,3 @@ template<typename Key, using RawVectorSet = VectorSet<Key, ProbingStrategy, Hash, IsEqual, Slot, RawAllocator>; } // namespace blender - -#endif /* __BLI_VECTOR_SET_HH__ */ diff --git a/source/blender/blenlib/BLI_vector_set_slots.hh b/source/blender/blenlib/BLI_vector_set_slots.hh index 49e6d4daedb..0e75c4690a4 100644 --- a/source/blender/blenlib/BLI_vector_set_slots.hh +++ b/source/blender/blenlib/BLI_vector_set_slots.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLI_VECTOR_SET_SLOTS_HH__ -#define __BLI_VECTOR_SET_SLOTS_HH__ +#pragma once /** \file * \ingroup bli @@ -167,5 +166,3 @@ template<typename Key> struct DefaultVectorSetSlot { }; } // namespace blender - -#endif /* __BLI_VECTOR_SET_SLOTS_HH__ */ diff --git a/source/blender/blenlib/BLI_vfontdata.h b/source/blender/blenlib/BLI_vfontdata.h index 047a72ec59a..0bb32ca24b7 100644 --- a/source/blender/blenlib/BLI_vfontdata.h +++ b/source/blender/blenlib/BLI_vfontdata.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_VFONTDATA_H__ -#define __BLI_VFONTDATA_H__ +#pragma once /** \file * \ingroup bli @@ -59,5 +58,3 @@ VChar *BLI_vfontchar_copy(const VChar *vchar_src, const int flag); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/blenlib/BLI_voronoi_2d.h b/source/blender/blenlib/BLI_voronoi_2d.h index a48f32c283a..92c7d367b48 100644 --- a/source/blender/blenlib/BLI_voronoi_2d.h +++ b/source/blender/blenlib/BLI_voronoi_2d.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_VORONOI_2D_H__ -#define __BLI_VORONOI_2D_H__ +#pragma once struct ListBase; @@ -81,5 +80,3 @@ void BLI_voronoi_triangulate(const VoronoiSite *sites, #ifdef __cplusplus } #endif - -#endif /* __BLI_VORONOI_2D_H__ */ diff --git a/source/blender/blenlib/BLI_voxel.h b/source/blender/blenlib/BLI_voxel.h index 82854c57928..eb84f0a27ee 100644 --- a/source/blender/blenlib/BLI_voxel.h +++ b/source/blender/blenlib/BLI_voxel.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_VOXEL_H__ -#define __BLI_VOXEL_H__ +#pragma once /** \file * \ingroup bli @@ -46,5 +45,3 @@ float BLI_voxel_sample_tricubic(const float *data, #ifdef __cplusplus } #endif - -#endif /* __BLI_VOXEL_H__ */ diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h index 3d59ad21251..2de6098f6be 100644 --- a/source/blender/blenlib/BLI_winstuff.h +++ b/source/blender/blenlib/BLI_winstuff.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLI_WINSTUFF_H__ -#define __BLI_WINSTUFF_H__ +#pragma once /** \file * \ingroup bli @@ -111,5 +110,3 @@ int BLI_getInstallationDir(char *str); #ifdef __cplusplus } #endif - -#endif /* __BLI_WINSTUFF_H__ */ diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index c6e04d4147a..9703c78e19c 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -37,6 +37,7 @@ set(INC_SYS set(SRC intern/BLI_args.c intern/BLI_array.c + intern/BLI_assert.c intern/BLI_dial_2d.c intern/BLI_dynstr.c intern/BLI_filelist.c @@ -110,6 +111,7 @@ set(SRC intern/rct.c intern/scanfill.c intern/scanfill_utils.c + intern/session_uuid.c intern/smallhash.c intern/sort.c intern/sort_utils.c @@ -239,6 +241,7 @@ set(SRC BLI_rect.h BLI_resource_collector.hh BLI_scanfill.h + BLI_session_uuid.h BLI_set.hh BLI_set_slots.hh BLI_smallhash.h diff --git a/source/blender/blenlib/PIL_time.h b/source/blender/blenlib/PIL_time.h index 21ebc9d4b90..311869e844a 100644 --- a/source/blender/blenlib/PIL_time.h +++ b/source/blender/blenlib/PIL_time.h @@ -22,8 +22,7 @@ * \brief Platform independent time functions. */ -#ifndef __PIL_TIME_H__ -#define __PIL_TIME_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -51,5 +50,3 @@ void PIL_sleep_ms(int ms); #ifdef __cplusplus } #endif - -#endif /* __PIL_TIME_H__ */ diff --git a/source/blender/blenlib/PIL_time_utildefines.h b/source/blender/blenlib/PIL_time_utildefines.h index ffe753badf8..d404a8b2b8a 100644 --- a/source/blender/blenlib/PIL_time_utildefines.h +++ b/source/blender/blenlib/PIL_time_utildefines.h @@ -22,8 +22,7 @@ * \brief Utility defines for timing/benchmarks. */ -#ifndef __PIL_TIME_UTILDEFINES_H__ -#define __PIL_TIME_UTILDEFINES_H__ +#pragma once #include "BLI_utildefines.h" /* for AT */ #include "PIL_time.h" /* for PIL_check_seconds_timer */ @@ -127,5 +126,3 @@ fflush(stdout); \ } \ (void)0 - -#endif /* __PIL_TIME_UTILDEFINES_H__ */ diff --git a/source/blender/blenlib/intern/BLI_assert.c b/source/blender/blenlib/intern/BLI_assert.c new file mode 100644 index 00000000000..dc22d035459 --- /dev/null +++ b/source/blender/blenlib/intern/BLI_assert.c @@ -0,0 +1,51 @@ +/* + * 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. + */ + +/** \file + * \ingroup bli + * + * Helper functions for BLI_assert.h header. + */ + +#include "BLI_assert.h" /* Own include. */ +#include "BLI_system.h" + +#include <stdio.h> +#include <stdlib.h> + +void _BLI_assert_print_pos(const char *file, int line, const char *function, const char *id) +{ + fprintf(stderr, "BLI_assert failed: %s:%d, %s(), at \'%s\'\n", file, line, function, id); +} + +void _BLI_assert_print_backtrace(void) +{ +#ifndef NDEBUG + BLI_system_backtrace(stderr); +#endif +} + +/** + * Wrap to remove 'noreturn' attribute since this suppresses missing return statements, + * allowing changes to debug builds to accidentally to break release builds. + * + * For example `BLI_assert(0);` at the end of a function that returns a value, + * will hide that it's missing a return. + */ +void _BLI_assert_abort(void) +{ + abort(); +} diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 79f1aa1e640..83750277bf6 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -630,7 +630,7 @@ float dist_squared_ray_to_seg_v3(const float ray_origin[3], float *r_depth) { float lambda, depth; - if (isect_ray_seg_v3(ray_origin, ray_direction, v0, v1, &lambda)) { + if (isect_ray_line_v3(ray_origin, ray_direction, v0, v1, &lambda)) { if (lambda <= 0.0f) { copy_v3_v3(r_point, v0); } @@ -2129,11 +2129,11 @@ bool isect_ray_seg_v2(const float ray_origin[2], return false; } -bool isect_ray_seg_v3(const float ray_origin[3], - const float ray_direction[3], - const float v0[3], - const float v1[3], - float *r_lambda) +bool isect_ray_line_v3(const float ray_origin[3], + const float ray_direction[3], + const float v0[3], + const float v1[3], + float *r_lambda) { float a[3], t[3], n[3]; sub_v3_v3v3(a, v1, v0); @@ -2311,109 +2311,171 @@ bool isect_plane_plane_v3(const float plane_a[4], /** * Intersect two triangles. * - * \param r_i1, r_i2: Optional arguments to retrieve the overlapping edge between the 2 triangles. + * \param r_i1, r_i2: Retrieve the overlapping edge between the 2 triangles. + * \param r_tri_a_edge_isect_count: Indicates how many edges in the first triangle are intersected. * \return true when the triangles intersect. * + * \note If it exists, \a r_i1 will be a point on the edge of the 1st triangle. * \note intersections between coplanar triangles are currently undetected. */ -bool isect_tri_tri_epsilon_v3(const float t_a0[3], - const float t_a1[3], - const float t_a2[3], - const float t_b0[3], - const float t_b1[3], - const float t_b2[3], - float r_i1[3], - float r_i2[3], - const float epsilon) -{ - const float *tri_pair[2][3] = {{t_a0, t_a1, t_a2}, {t_b0, t_b1, t_b2}}; - float plane_a[4], plane_b[4]; - float plane_co[3], plane_no[3]; - - BLI_assert((r_i1 != NULL) == (r_i2 != NULL)); +bool isect_tri_tri_v3_ex(const float tri_a[3][3], + const float tri_b[3][3], + float r_i1[3], + float r_i2[3], + int *r_tri_a_edge_isect_count) +{ + struct { + /* Factor that indicates the position of the intersection point on the line + * that intersects the planes of the triangles. */ + float min, max; + /* Intersection point location. */ + float loc[2][3]; + } range[2]; + + float side[2][3]; + float ba[3], bc[3], plane_a[4], plane_b[4]; + *r_tri_a_edge_isect_count = 0; + + sub_v3_v3v3(ba, tri_a[0], tri_a[1]); + sub_v3_v3v3(bc, tri_a[2], tri_a[1]); + cross_v3_v3v3(plane_a, ba, bc); + plane_a[3] = -dot_v3v3(tri_a[1], plane_a); + side[1][0] = plane_point_side_v3(plane_a, tri_b[0]); + side[1][1] = plane_point_side_v3(plane_a, tri_b[1]); + side[1][2] = plane_point_side_v3(plane_a, tri_b[2]); + + if (!side[1][0] && !side[1][1] && !side[1][2]) { + /* Coplanar case is not supported. */ + return false; + } - /* normalizing is needed for small triangles T46007 */ - normal_tri_v3(plane_a, UNPACK3(tri_pair[0])); - normal_tri_v3(plane_b, UNPACK3(tri_pair[1])); + if ((side[1][0] && side[1][1] && side[1][2]) && (side[1][0] < 0.0f) == (side[1][1] < 0.0f) && + (side[1][0] < 0.0f) == (side[1][2] < 0.0f)) { + /* All vertices of the 2nd triangle are positioned on the same side to the + * plane defined by the 1st triangle. */ + return false; + } - plane_a[3] = -dot_v3v3(plane_a, t_a0); - plane_b[3] = -dot_v3v3(plane_b, t_b0); + sub_v3_v3v3(ba, tri_b[0], tri_b[1]); + sub_v3_v3v3(bc, tri_b[2], tri_b[1]); + cross_v3_v3v3(plane_b, ba, bc); + plane_b[3] = -dot_v3v3(tri_b[1], plane_b); + side[0][0] = plane_point_side_v3(plane_b, tri_a[0]); + side[0][1] = plane_point_side_v3(plane_b, tri_a[1]); + side[0][2] = plane_point_side_v3(plane_b, tri_a[2]); + if ((side[0][0] && side[0][1] && side[0][2]) && (side[0][0] < 0.0f) == (side[0][1] < 0.0f) && + (side[0][0] < 0.0f) == (side[0][2] < 0.0f)) { + /* All vertices of the 1st triangle are positioned on the same side to the + * plane defined by the 2nd triangle. */ + return false; + } - if (isect_plane_plane_v3(plane_a, plane_b, plane_co, plane_no) && - (normalize_v3(plane_no) > epsilon)) { - /** - * Implementation note: its simpler to project the triangles onto the intersection plane - * before intersecting their edges with the ray, defined by 'isect_plane_plane_v3'. - * This way we can use 'line_point_factor_v3_ex' to see if an edge crosses 'co_proj', - * then use the factor to calculate the world-space point. - */ - struct { - float min, max; - } range[2] = {{FLT_MAX, -FLT_MAX}, {FLT_MAX, -FLT_MAX}}; - int t; - float co_proj[3]; - - closest_to_plane3_normalized_v3(co_proj, plane_no, plane_co); - - /* For both triangles, find the overlap with the line defined by the ray [co_proj, plane_no]. - * When the ranges overlap we know the triangles do too. */ - for (t = 0; t < 2; t++) { - int j, j_prev; - float tri_proj[3][3]; - - closest_to_plane3_normalized_v3(tri_proj[0], plane_no, tri_pair[t][0]); - closest_to_plane3_normalized_v3(tri_proj[1], plane_no, tri_pair[t][1]); - closest_to_plane3_normalized_v3(tri_proj[2], plane_no, tri_pair[t][2]); - - for (j = 0, j_prev = 2; j < 3; j_prev = j++) { - /* note that its important to have a very small nonzero epsilon here - * otherwise this fails for very small faces. - * However if its too small, large adjacent faces will count as intersecting */ - const float edge_fac = line_point_factor_v3_ex( - co_proj, tri_proj[j_prev], tri_proj[j], 1e-10f, -1.0f); - /* ignore collinear lines, they are either an edge shared between 2 tri's - * (which runs along [co_proj, plane_no], but can be safely ignored). - * - * or a collinear edge placed away from the ray - - * which we don't intersect with & can ignore. */ - if (UNLIKELY(edge_fac == -1.0f)) { - /* pass */ - } - /* Important to include 0.0f and 1.0f as one of the triangles vertices may be placed - * exactly on the plane. In this case both it's edges will have a factor of 0 or 1, - * but not be going through the plane. See T73566. */ - else if (edge_fac >= 0.0f && edge_fac <= 1.0f) { - float ix_tri[3]; - float span_fac; - - interp_v3_v3v3(ix_tri, tri_pair[t][j_prev], tri_pair[t][j], edge_fac); - /* the actual distance, since 'plane_no' is normalized */ - span_fac = dot_v3v3(plane_no, ix_tri); - - range[t].min = min_ff(range[t].min, span_fac); - range[t].max = max_ff(range[t].max, span_fac); - } + /* Direction of the line that intersects the planes of the triangles. */ + float isect_dir[3]; + cross_v3_v3v3(isect_dir, plane_a, plane_b); + for (int i = 0; i < 2; i++) { + const float(*tri)[3] = i == 0 ? tri_a : tri_b; + /* Rearrange the triangle so that the vertex that is alone on one side + * of the plane is located at index 1. */ + int tri_i[3]; + if ((side[i][0] && side[i][1]) && (side[i][0] < 0.0f) == (side[i][1] < 0.0f)) { + tri_i[0] = 1; + tri_i[1] = 2; + tri_i[2] = 0; + } + else if ((side[i][1] && side[i][2]) && (side[i][1] < 0.0f) == (side[i][2] < 0.0f)) { + tri_i[0] = 2; + tri_i[1] = 0; + tri_i[2] = 1; + } + else { + tri_i[0] = 0; + tri_i[1] = 1; + tri_i[2] = 2; + } + + float dot_b = dot_v3v3(isect_dir, tri[tri_i[1]]); + range[i].min = dot_b; + range[i].max = dot_b; + + float sidec = side[i][tri_i[1]]; + if (sidec) { + float dot_a = dot_v3v3(isect_dir, tri[tri_i[0]]); + float dot_c = dot_v3v3(isect_dir, tri[tri_i[2]]); + float fac0 = sidec / (sidec - side[i][tri_i[0]]); + float fac1 = sidec / (sidec - side[i][tri_i[2]]); + float offset0 = fac0 * (dot_a - dot_b); + float offset1 = fac1 * (dot_c - dot_b); + if (offset0 > offset1) { + /* Sort min max. */ + SWAP(float, offset0, offset1); + SWAP(float, fac0, fac1); + SWAP(int, tri_i[0], tri_i[2]); } - if (range[t].min == FLT_MAX) { - return false; - } + range[i].min += offset0; + range[i].max += offset1; + interp_v3_v3v3(range[i].loc[0], tri[tri_i[1]], tri[tri_i[0]], fac0); + interp_v3_v3v3(range[i].loc[1], tri[tri_i[1]], tri[tri_i[2]], fac1); } + else { + copy_v3_v3(range[i].loc[0], tri[tri_i[1]]); + copy_v3_v3(range[i].loc[1], tri[tri_i[1]]); + } + } - if (((range[0].min > range[1].max) || (range[0].max < range[1].min)) == 0) { - if (r_i1 && r_i2) { - project_plane_normalized_v3_v3v3(plane_co, plane_co, plane_no); - madd_v3_v3v3fl(r_i1, plane_co, plane_no, max_ff(range[0].min, range[1].min)); - madd_v3_v3v3fl(r_i2, plane_co, plane_no, min_ff(range[0].max, range[1].max)); + if ((range[0].max >= range[1].min) && (range[0].min <= range[1].max)) { + /* The triangles intersect because they overlap on the intersection line. + * Now identify the two points of intersection that are in the middle to get the actual + * intersection between the triangles. (B--C from A--B--C--D) */ + if (range[0].min >= range[1].min) { + copy_v3_v3(r_i1, range[0].loc[0]); + if (range[0].max <= range[1].max) { + copy_v3_v3(r_i2, range[0].loc[1]); + *r_tri_a_edge_isect_count = 2; + } + else { + copy_v3_v3(r_i2, range[1].loc[1]); + *r_tri_a_edge_isect_count = 1; } - - return true; } + else { + if (range[0].max <= range[1].max) { + copy_v3_v3(r_i1, range[0].loc[1]); + copy_v3_v3(r_i2, range[1].loc[0]); + *r_tri_a_edge_isect_count = 1; + } + else { + copy_v3_v3(r_i1, range[1].loc[0]); + copy_v3_v3(r_i2, range[1].loc[1]); + } + } + return true; } return false; } +bool isect_tri_tri_v3(const float t_a0[3], + const float t_a1[3], + const float t_a2[3], + const float t_b0[3], + const float t_b1[3], + const float t_b2[3], + float r_i1[3], + float r_i2[3]) +{ + float tri_a[3][3], tri_b[3][3]; + int dummy; + copy_v3_v3(tri_a[0], t_a0); + copy_v3_v3(tri_a[1], t_a1); + copy_v3_v3(tri_a[2], t_a2); + copy_v3_v3(tri_b[0], t_b0); + copy_v3_v3(tri_b[1], t_b1); + copy_v3_v3(tri_b[2], t_b2); + return isect_tri_tri_v3_ex(tri_a, tri_b, r_i1, r_i2, &dummy); +} + /* -------------------------------------------------------------------- */ /** \name Tri-Tri Intersect 2D * @@ -3000,7 +3062,7 @@ int isect_line_line_epsilon_v3(const float v1[3], mul_v3_fl(a, dot_v3v3(cb, ab) / dot_v3v3(ab, ab)); add_v3_v3v3(r_i1, v1, a); - /* for the second line, just substract the offset from the first intersection point */ + /* for the second line, just subtract the offset from the first intersection point */ sub_v3_v3v3(r_i2, r_i1, t); return 2; /* two nearest points */ @@ -4176,8 +4238,8 @@ int interp_sparse_array(float *array, const int list_size, const float skipval) #define DIR_V2_SET(d_len, va, vb) \ { \ - sub_v2_v2v2((d_len)->dir, va, vb); \ - (d_len)->len = len_v2((d_len)->dir); \ + sub_v2db_v2fl_v2fl((d_len)->dir, va, vb); \ + (d_len)->len = len_v2_db((d_len)->dir); \ } \ (void)0 @@ -4185,8 +4247,8 @@ struct Float3_Len { float dir[3], len; }; -struct Float2_Len { - float dir[2], len; +struct Double2_Len { + double dir[2], len; }; /* Mean value weights - smooth interpolation weights for polygons with @@ -4209,21 +4271,30 @@ static float mean_value_half_tan_v3(const struct Float3_Len *d_curr, return 0.0f; } -static float mean_value_half_tan_v2(const struct Float2_Len *d_curr, - const struct Float2_Len *d_next) +/** + * Mean value weights - same as #mean_value_half_tan_v3 but for 2D vectors. + * + * \note When interpolating a 2D polygon, a point can be considered "outside" + * the polygon's bounds. Thus, when the point is very distant and the vectors + * have relatively close values, the precision problems are evident since they + * do not indicate a point "inside" the polygon. + * To resolve this, doubles are used. + */ +static double mean_value_half_tan_v2_db(const struct Double2_Len *d_curr, + const struct Double2_Len *d_next) { - /* different from the 3d version but still correct */ - const float area = cross_v2v2(d_curr->dir, d_next->dir); + /* Different from the 3d version but still correct. */ + const double area = cross_v2v2_db(d_curr->dir, d_next->dir); /* Compare against zero since 'FLT_EPSILON' can be too large, see: T73348. */ - if (LIKELY(area != 0.0f)) { - const float dot = dot_v2v2(d_curr->dir, d_next->dir); - const float len = d_curr->len * d_next->len; - const float result = (len - dot) / area; + if (LIKELY(area != 0.0)) { + const double dot = dot_v2v2_db(d_curr->dir, d_next->dir); + const double len = d_curr->len * d_next->len; + const double result = (len - dot) / area; if (isfinite(result)) { return result; } } - return 0.0f; + return 0.0; } void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[3]) @@ -4328,11 +4399,11 @@ void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[ const float eps_sq = eps * eps; const float *v_curr, *v_next; - float ht_prev, ht; /* half tangents */ + double ht_prev, ht; /* half tangents */ float totweight = 0.0f; int i_curr, i_next; char ix_flag = 0; - struct Float2_Len d_curr, d_next; + struct Double2_Len d_curr, d_next; /* loop over 'i_next' */ i_curr = n - 1; @@ -4343,7 +4414,7 @@ void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[ DIR_V2_SET(&d_curr, v_curr - 2 /* v[n - 2] */, co); DIR_V2_SET(&d_next, v_curr /* v[n - 1] */, co); - ht_prev = mean_value_half_tan_v2(&d_curr, &d_next); + ht_prev = mean_value_half_tan_v2_db(&d_curr, &d_next); while (i_next < n) { /* Mark Mayer et al algorithm that is used here does not operate well if vertex is close @@ -4362,8 +4433,8 @@ void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[ d_curr = d_next; DIR_V2_SET(&d_next, v_next, co); - ht = mean_value_half_tan_v2(&d_curr, &d_next); - w[i_curr] = (ht_prev + ht) / d_curr.len; + ht = mean_value_half_tan_v2_db(&d_curr, &d_next); + w[i_curr] = (float)((ht_prev + ht) / d_curr.len); totweight += w[i_curr]; /* step */ diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index ca405907bdd..1b47832589e 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -509,6 +509,12 @@ MINLINE void sub_v3_v3v3_db(double r[3], const double a[3], const double b[3]) r[2] = a[2] - b[2]; } +MINLINE void sub_v2db_v2fl_v2fl(double r[2], const float a[2], const float b[2]) +{ + r[0] = (double)a[0] - (double)b[0]; + r[1] = (double)a[1] - (double)b[1]; +} + MINLINE void sub_v3db_v3fl_v3fl(double r[3], const float a[3], const float b[3]) { r[0] = (double)a[0] - (double)b[0]; @@ -917,6 +923,11 @@ MINLINE float cross_v2v2(const float a[2], const float b[2]) return a[0] * b[1] - a[1] * b[0]; } +MINLINE double cross_v2v2_db(const double a[2], const double b[2]) +{ + return a[0] * b[1] - a[1] * b[0]; +} + MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3]) { BLI_assert(r != a && r != b); @@ -997,6 +1008,11 @@ MINLINE float len_v2(const float v[2]) return sqrtf(v[0] * v[0] + v[1] * v[1]); } +MINLINE double len_v2_db(const double v[2]) +{ + return sqrt(v[0] * v[0] + v[1] * v[1]); +} + MINLINE float len_v2v2(const float v1[2], const float v2[2]) { float x, y; diff --git a/source/blender/blenlib/intern/session_uuid.c b/source/blender/blenlib/intern/session_uuid.c new file mode 100644 index 00000000000..8ed96f02149 --- /dev/null +++ b/source/blender/blenlib/intern/session_uuid.c @@ -0,0 +1,78 @@ +/* + * 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. + */ + +/** \file + * \ingroup bli + */ + +#include "BLI_session_uuid.h" + +#include "BLI_utildefines.h" + +#include "atomic_ops.h" + +/* Special value which indicates the UUID has not been assigned yet. */ +#define BLI_SESSION_UUID_NONE 0 + +static const SessionUUID global_session_uuid_none = {BLI_SESSION_UUID_NONE}; + +/* Denotes last used UUID. + * It might eventually overflow, and easiest is to add more bits to it. */ +static SessionUUID global_session_uuid = {BLI_SESSION_UUID_NONE}; + +SessionUUID BLI_session_uuid_generate(void) +{ + SessionUUID result; + result.uuid_ = atomic_add_and_fetch_uint64(&global_session_uuid.uuid_, 1); + if (!BLI_session_uuid_is_generated(&result)) { + /* Happens when the UUID overflows. + * + * Just request the UUID once again, hoping that there are not a lot of high-priority threads + * which will overflow the counter once again between the previous call and this one. + * + * NOTE: It is possible to have collisions after such overflow. */ + result.uuid_ = atomic_add_and_fetch_uint64(&global_session_uuid.uuid_, 1); + } + return result; +} + +bool BLI_session_uuid_is_generated(const SessionUUID *uuid) +{ + return !BLI_session_uuid_is_equal(uuid, &global_session_uuid_none); +} + +bool BLI_session_uuid_is_equal(const SessionUUID *lhs, const SessionUUID *rhs) +{ + return lhs->uuid_ == rhs->uuid_; +} + +uint64_t BLI_session_uuid_hash_uint64(const SessionUUID *uuid) +{ + return uuid->uuid_; +} + +uint BLI_session_uuid_ghash_hash(const void *uuid_v) +{ + const SessionUUID *uuid = (const SessionUUID *)uuid_v; + return uuid->uuid_ & 0xffffffff; +} + +bool BLI_session_uuid_ghash_compare(const void *lhs_v, const void *rhs_v) +{ + const SessionUUID *lhs = (const SessionUUID *)lhs_v; + const SessionUUID *rhs = (const SessionUUID *)rhs_v; + return BLI_session_uuid_is_equal(lhs, rhs); +} diff --git a/source/blender/blenlib/intern/uvproject.c b/source/blender/blenlib/intern/uvproject.c index a34c551767a..00fef29587c 100644 --- a/source/blender/blenlib/intern/uvproject.c +++ b/source/blender/blenlib/intern/uvproject.c @@ -183,7 +183,7 @@ ProjCameraInfo *BLI_uvproject_camera_info(Object *ob, float (*rotmat)[4], float return NULL; } -void BLI_uvproject_from_view_ortho(float target[2], float source[3], float rotmat[4][4]) +void BLI_uvproject_from_view_ortho(float target[2], float source[3], const float rotmat[4][4]) { float pv[3]; diff --git a/source/blender/blenloader/BLO_blend_defs.h b/source/blender/blenloader/BLO_blend_defs.h index fec61605dca..40da63f20e8 100644 --- a/source/blender/blenloader/BLO_blend_defs.h +++ b/source/blender/blenloader/BLO_blend_defs.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLO_BLEND_DEFS_H__ -#define __BLO_BLEND_DEFS_H__ +#pragma once /** \file * \ingroup blenloader @@ -72,5 +71,3 @@ enum { }; #define BLEN_THUMB_MEMSIZE_FILE(_x, _y) (sizeof(int) * (2 + (size_t)(_x) * (size_t)(_y))) - -#endif /* __BLO_BLEND_DEFS_H__ */ diff --git a/source/blender/blenloader/BLO_blend_validate.h b/source/blender/blenloader/BLO_blend_validate.h index 1ffaddef02f..78aa481d4b1 100644 --- a/source/blender/blenloader/BLO_blend_validate.h +++ b/source/blender/blenloader/BLO_blend_validate.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLO_BLEND_VALIDATE_H__ -#define __BLO_BLEND_VALIDATE_H__ +#pragma once /** \file * \ingroup blenloader @@ -31,5 +30,3 @@ struct ReportList; bool BLO_main_validate_libraries(struct Main *bmain, struct ReportList *reports); bool BLO_main_validate_shapekeys(struct Main *bmain, struct ReportList *reports); - -#endif diff --git a/source/blender/blenloader/BLO_read_write.h b/source/blender/blenloader/BLO_read_write.h index 7c9738b67c5..024b6a6c5e4 100644 --- a/source/blender/blenloader/BLO_read_write.h +++ b/source/blender/blenloader/BLO_read_write.h @@ -38,8 +38,7 @@ * necessary. */ -#ifndef __BLO_READ_WRITE_H__ -#define __BLO_READ_WRITE_H__ +#pragma once /* for SDNA_TYPE_FROM_STRUCT() macro */ #include "dna_type_offsets.h" @@ -223,5 +222,3 @@ void BLO_expand_id(BlendExpander *expander, struct ID *id); #ifdef __cplusplus } #endif - -#endif /* __BLO_READ_WRITE_H__ */ diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index e4908eb7257..97c77ed2e19 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __BLO_READFILE_H__ -#define __BLO_READFILE_H__ +#pragma once #include "BLI_sys_types.h" @@ -196,5 +195,3 @@ extern const struct UserDef U_default; #ifdef __cplusplus } #endif - -#endif /* __BLO_READFILE_H__ */ diff --git a/source/blender/blenloader/BLO_undofile.h b/source/blender/blenloader/BLO_undofile.h index f9300f8a521..f5527c13429 100644 --- a/source/blender/blenloader/BLO_undofile.h +++ b/source/blender/blenloader/BLO_undofile.h @@ -18,8 +18,7 @@ * external writefile function prototypes */ -#ifndef __BLO_UNDOFILE_H__ -#define __BLO_UNDOFILE_H__ +#pragma once /** \file * \ingroup blenloader @@ -85,5 +84,3 @@ extern struct Main *BLO_memfile_main_get(struct MemFile *memfile, struct Main *bmain, struct Scene **r_scene); extern bool BLO_memfile_write_file(struct MemFile *memfile, const char *filename); - -#endif /* __BLO_UNDOFILE_H__ */ diff --git a/source/blender/blenloader/BLO_writefile.h b/source/blender/blenloader/BLO_writefile.h index 8fe04e764f9..746c663926d 100644 --- a/source/blender/blenloader/BLO_writefile.h +++ b/source/blender/blenloader/BLO_writefile.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BLO_WRITEFILE_H__ -#define __BLO_WRITEFILE_H__ +#pragma once /** \file * \ingroup blenloader @@ -73,5 +72,3 @@ extern bool BLO_write_file_mem(struct Main *mainvar, int write_flags); /** \} */ - -#endif diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 9320187f2a0..134e23d36e8 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5145,6 +5145,9 @@ static void direct_link_pose(BlendDataReader *reader, bPose *pose) pose->chan_array = NULL; for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { + BKE_pose_channel_runtime_reset(&pchan->runtime); + BKE_pose_channel_session_uuid_generate(pchan); + pchan->bone = NULL; BLO_read_data_address(reader, &pchan->parent); BLO_read_data_address(reader, &pchan->child); @@ -5170,7 +5173,6 @@ static void direct_link_pose(BlendDataReader *reader, bPose *pose) CLAMP(pchan->rotmode, ROT_MODE_MIN, ROT_MODE_MAX); pchan->draw_data = NULL; - BKE_pose_channel_runtime_reset(&pchan->runtime); } pose->ikdata = NULL; if (pose->ikparam != NULL) { @@ -6030,7 +6032,7 @@ static void direct_link_lightcache_texture(BlendDataReader *reader, LightCacheTe if (lctex->data) { BLO_read_data_address(reader, &lctex->data); - if (BLO_read_requires_endian_switch(reader)) { + if (lctex->data && BLO_read_requires_endian_switch(reader)) { int data_size = lctex->components * lctex->tex_size[0] * lctex->tex_size[1] * lctex->tex_size[2]; @@ -6042,10 +6044,15 @@ static void direct_link_lightcache_texture(BlendDataReader *reader, LightCacheTe } } } + + if (lctex->data == NULL) { + zero_v3_int(lctex->tex_size); + } } static void direct_link_lightcache(BlendDataReader *reader, LightCache *cache) { + cache->flag &= ~LIGHTCACHE_NOT_USABLE; direct_link_lightcache_texture(reader, &cache->cube_tx); direct_link_lightcache_texture(reader, &cache->grid_tx); @@ -6086,6 +6093,14 @@ static bool scene_validate_setscene__liblink(Scene *sce, const int totscene) } for (a = 0, sce_iter = sce; sce_iter->set; sce_iter = sce_iter->set, a++) { + /* This runs per library (before each libraries #Main has been joined), + * so we can't step into other libraries since `totscene` is only for this library. + * + * Also, other libraries may not have been linked yet, + * while we could check #LIB_TAG_NEED_LINK the library pointer check is sufficient. */ + if (sce->id.lib != sce_iter->id.lib) { + return true; + } if (sce_iter->flag & SCE_READFILE_LIBLINK_NEED_SETSCENE_CHECK) { return true; } @@ -6461,6 +6476,9 @@ static void direct_link_scene(BlendDataReader *reader, Scene *sce) link_recurs_seq(reader, &ed->seqbase); SEQ_BEGIN (ed, seq) { + /* Do as early as possible, so that other parts of reading can rely on valid session UUID. */ + BKE_sequence_session_uuid_generate(seq); + BLO_read_data_address(reader, &seq->seq1); BLO_read_data_address(reader, &seq->seq2); BLO_read_data_address(reader, &seq->seq3); diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index f8c91c77634..34a670a8357 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -22,8 +22,7 @@ * \ingroup blenloader */ -#ifndef __READFILE_H__ -#define __READFILE_H__ +#pragma once #include "DNA_sdna_types.h" #include "DNA_space_types.h" @@ -199,5 +198,3 @@ void do_versions_after_linking_270(struct Main *bmain); void do_versions_after_linking_280(struct Main *bmain, struct ReportList *reports); void do_versions_after_linking_290(struct Main *bmain, struct ReportList *reports); void do_versions_after_linking_cycles(struct Main *bmain); - -#endif diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index b6caa018756..a96b82e2e91 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -28,6 +28,7 @@ #include "DNA_constraint_types.h" #include "DNA_genfile.h" #include "DNA_gpencil_modifier_types.h" +#include "DNA_gpencil_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" #include "DNA_screen_types.h" @@ -35,6 +36,7 @@ #include "BKE_collection.h" #include "BKE_colortools.h" +#include "BKE_gpencil.h" #include "BKE_lib_id.h" #include "BKE_main.h" #include "BKE_node.h" @@ -183,6 +185,23 @@ void do_versions_after_linking_290(Main *bmain, ReportList *UNUSED(reports)) } } } + + /* Patch first frame for old files. */ + Scene *scene = bmain->scenes.first; + LISTBASE_FOREACH (Object *, ob, &bmain->objects) { + if (ob->type != OB_GPENCIL) { + continue; + } + bGPdata *gpd = ob->data; + LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { + bGPDframe *gpf = gpl->frames.first; + if (gpf && gpf->framenum > scene->r.sfra) { + bGPDframe *gpf_dup = BKE_gpencil_frame_duplicate(gpf); + gpf_dup->framenum = scene->r.sfra; + BLI_addhead(&gpl->frames, gpf_dup); + } + } + } } /** diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 46ac6b43c92..6f9f3eec31d 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -152,6 +152,7 @@ #include "MEM_guardedalloc.h" // MEM_freeN #include "BKE_action.h" +#include "BKE_armature.h" #include "BKE_blender_version.h" #include "BKE_bpath.h" #include "BKE_collection.h" @@ -1582,7 +1583,7 @@ static void write_constraints(BlendWriter *writer, ListBase *conlist) } } -static void write_pose(BlendWriter *writer, bPose *pose) +static void write_pose(BlendWriter *writer, bPose *pose, bArmature *arm) { bPoseChannel *chan; bActionGroup *grp; @@ -1592,6 +1593,8 @@ static void write_pose(BlendWriter *writer, bPose *pose) return; } + BLI_assert(arm != NULL); + /* Write channels */ for (chan = pose->chanbase.first; chan; chan = chan->next) { /* Write ID Properties -- and copy this comment EXACTLY for easy finding @@ -1604,11 +1607,15 @@ static void write_pose(BlendWriter *writer, bPose *pose) write_motionpath(writer, chan->mpath); - /* prevent crashes with autosave, - * when a bone duplicated in editmode has not yet been assigned to its posechannel */ - if (chan->bone) { + /* Prevent crashes with autosave, + * when a bone duplicated in editmode has not yet been assigned to its posechannel. + * Also needed with memundo, in some cases we can store a step before pose has been + * properly rebuilt from previous undo step. */ + Bone *bone = (pose->flag & POSE_RECALC) ? BKE_armature_find_bone_name(arm, chan->name) : + chan->bone; + if (bone != NULL) { /* gets restored on read, for library armatures */ - chan->selectflag = chan->bone->flag & BONE_SELECTED; + chan->selectflag = bone->flag & BONE_SELECTED; } BLO_write_struct(writer, bPoseChannel, chan); @@ -1853,15 +1860,16 @@ static void write_object(BlendWriter *writer, Object *ob, const void *id_address BLO_write_pointer_array(writer, ob->totcol, ob->mat); BLO_write_raw(writer, sizeof(char) * ob->totcol, ob->matbits); + bArmature *arm = NULL; if (ob->type == OB_ARMATURE) { - bArmature *arm = ob->data; + arm = ob->data; if (arm && ob->pose && arm->act_bone) { BLI_strncpy( ob->pose->proxy_act_bone, arm->act_bone->name, sizeof(ob->pose->proxy_act_bone)); } } - write_pose(writer, ob->pose); + write_pose(writer, ob->pose, arm); write_defgroups(writer, &ob->defbase); write_fmaps(writer, &ob->fmaps); write_constraints(writer, &ob->constraints); @@ -2497,7 +2505,12 @@ static void write_lightcache_texture(BlendWriter *writer, LightCacheTexture *tex else if (tex->data_type == LIGHTCACHETEX_UINT) { data_size *= sizeof(uint); } - BLO_write_raw(writer, data_size, tex->data); + + /* FIXME: We can't save more than what 32bit systems can handle. + * The solution would be to split the texture but it is too late for 2.90. (see T78529) */ + if (data_size < INT_MAX) { + BLO_write_raw(writer, data_size, tex->data); + } } } diff --git a/source/blender/blentranslation/BLT_lang.h b/source/blender/blentranslation/BLT_lang.h index 6ce9a0ba71c..dcd4de10416 100644 --- a/source/blender/blentranslation/BLT_lang.h +++ b/source/blender/blentranslation/BLT_lang.h @@ -21,8 +21,7 @@ * \ingroup blt */ -#ifndef __BLT_LANG_H__ -#define __BLT_LANG_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -60,5 +59,3 @@ struct EnumPropertyItem *BLT_lang_RNA_enum_properties(void); #ifdef __cplusplus }; #endif - -#endif /* __BLT_LANG_H__ */ diff --git a/source/blender/blentranslation/BLT_translation.h b/source/blender/blentranslation/BLT_translation.h index 817b99e8b91..b8979caa909 100644 --- a/source/blender/blentranslation/BLT_translation.h +++ b/source/blender/blentranslation/BLT_translation.h @@ -21,8 +21,7 @@ * \ingroup blt */ -#ifndef __BLT_TRANSLATION_H__ -#define __BLT_TRANSLATION_H__ +#pragma once #include "BLI_utildefines.h" /* for bool type */ @@ -221,5 +220,3 @@ typedef struct { #ifdef __cplusplus }; #endif - -#endif /* __BLT_TRANSLATION_H__ */ diff --git a/source/blender/bmesh/bmesh.h b/source/blender/bmesh/bmesh.h index c1f4b9daf27..5f5d6baaba2 100644 --- a/source/blender/bmesh/bmesh.h +++ b/source/blender/bmesh/bmesh.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_H__ -#define __BMESH_H__ +#pragma once /** \file * \ingroup bmesh @@ -231,5 +230,3 @@ extern "C" { #ifdef __cplusplus } #endif - -#endif /* __BMESH_H__ */ diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h index 1393e24e48e..edb355993c1 100644 --- a/source/blender/bmesh/bmesh_class.h +++ b/source/blender/bmesh/bmesh_class.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_CLASS_H__ -#define __BMESH_CLASS_H__ +#pragma once /** \file * \ingroup bmesh @@ -472,5 +471,3 @@ typedef bool (*BMLoopFilterFunc)(const BMLoop *, void *user_data); #else # define BM_OMP_LIMIT 10000 #endif - -#endif /* __BMESH_CLASS_H__ */ diff --git a/source/blender/bmesh/bmesh_tools.h b/source/blender/bmesh/bmesh_tools.h index 4593f34792b..ee53cb9804d 100644 --- a/source/blender/bmesh/bmesh_tools.h +++ b/source/blender/bmesh/bmesh_tools.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_TOOLS_H__ -#define __BMESH_TOOLS_H__ +#pragma once /** \file * \ingroup bmesh @@ -45,5 +44,3 @@ extern "C" { #ifdef __cplusplus } #endif - -#endif /* __BMESH_TOOLS_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_callback_generic.h b/source/blender/bmesh/intern/bmesh_callback_generic.h index 5191bd31873..3f3a48fd546 100644 --- a/source/blender/bmesh/intern/bmesh_callback_generic.h +++ b/source/blender/bmesh/intern/bmesh_callback_generic.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_CALLBACK_GENERIC_H__ -#define __BMESH_CALLBACK_GENERIC_H__ +#pragma once /** \file * \ingroup bmesh @@ -35,5 +34,3 @@ bool BM_elem_cb_check_elem_not_equal(BMElem *ele, void *user_data); #define BM_elem_cb_check_hflag_disabled_simple(type, hflag_n) \ (bool (*)(type, void *)) BM_elem_cb_check_hflag_disabled, POINTER_FROM_UINT(hflag_n) - -#endif /* __BMESH_CALLBACK_GENERIC_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_construct.h b/source/blender/bmesh/intern/bmesh_construct.h index ae2b137d38a..3523c4aec1a 100644 --- a/source/blender/bmesh/intern/bmesh_construct.h +++ b/source/blender/bmesh/intern/bmesh_construct.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_CONSTRUCT_H__ -#define __BMESH_CONSTRUCT_H__ +#pragma once /** \file * \ingroup bmesh @@ -78,5 +77,3 @@ char BM_vert_flag_from_mflag(const char mflag); char BM_face_flag_to_mflag(BMFace *f); short BM_edge_flag_to_mflag(BMEdge *e); char BM_vert_flag_to_mflag(BMVert *v); - -#endif /* __BMESH_CONSTRUCT_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_core.h b/source/blender/bmesh/intern/bmesh_core.h index 3308f93d5d3..0e19437a527 100644 --- a/source/blender/bmesh/intern/bmesh_core.h +++ b/source/blender/bmesh/intern/bmesh_core.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_CORE_H__ -#define __BMESH_CORE_H__ +#pragma once /** \file * \ingroup bmesh @@ -128,5 +127,3 @@ BMFace *bmesh_kernel_join_face_kill_edge(BMesh *bm, BMFace *f1, BMFace *f2, BMEd BMVert *bmesh_kernel_unglue_region_make_vert(BMesh *bm, BMLoop *l_sep); BMVert *bmesh_kernel_unglue_region_make_vert_multi(BMesh *bm, BMLoop **larr, int larr_len); BMVert *bmesh_kernel_unglue_region_make_vert_multi_isolated(BMesh *bm, BMLoop *l_sep); - -#endif /* __BMESH_CORE_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_delete.h b/source/blender/bmesh/intern/bmesh_delete.h index d41f26baddd..fcbcb8a90fc 100644 --- a/source/blender/bmesh/intern/bmesh_delete.h +++ b/source/blender/bmesh/intern/bmesh_delete.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_DELETE_H__ -#define __BMESH_DELETE_H__ +#pragma once /** \file * \ingroup bmesh @@ -26,5 +25,3 @@ void BM_mesh_delete_hflag_tagged(BMesh *bm, const char hflag, const char htype); void BMO_mesh_delete_oflag_context(BMesh *bm, const short oflag, const int type); void BM_mesh_delete_hflag_context(BMesh *bm, const char hflag, const int type); - -#endif /* __BMESH_DELETE_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.h b/source/blender/bmesh/intern/bmesh_edgeloop.h index 4c76ea4f9cf..2e5c4d0193e 100644 --- a/source/blender/bmesh/intern/bmesh_edgeloop.h +++ b/source/blender/bmesh/intern/bmesh_edgeloop.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BMESH_EDGELOOP_H__ -#define __BMESH_EDGELOOP_H__ +#pragma once /** \file * \ingroup bmesh @@ -84,5 +83,3 @@ bool BM_edgeloop_overlap_check(struct BMEdgeLoopStore *el_store_a, #define BM_EDGELOOP_NEXT(el_store) \ (CHECK_TYPE_INLINE(el_store, struct BMEdgeLoopStore *), \ (struct BMEdgeLoopStore *)((LinkData *)el_store)->next) - -#endif /* __BMESH_EDGELOOP_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_error.h b/source/blender/bmesh/intern/bmesh_error.h index 289b603d134..2307377fd71 100644 --- a/source/blender/bmesh/intern/bmesh_error.h +++ b/source/blender/bmesh/intern/bmesh_error.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_ERROR_H__ -#define __BMESH_ERROR_H__ +#pragma once /** \file * \ingroup bmesh @@ -84,5 +83,3 @@ enum { _BMESH_DUMMY_ABORT(), \ NULL)) : \ NULL) - -#endif /* __BMESH_ERROR_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_inline.h b/source/blender/bmesh/intern/bmesh_inline.h index 13691776a27..203f44a540d 100644 --- a/source/blender/bmesh/intern/bmesh_inline.h +++ b/source/blender/bmesh/intern/bmesh_inline.h @@ -20,8 +20,7 @@ * BM Inline functions. */ -#ifndef __BMESH_INLINE_H__ -#define __BMESH_INLINE_H__ +#pragma once /* stuff for dealing with header flags */ #define BM_elem_flag_test(ele, hflag) _bm_elem_flag_test(&(ele)->head, hflag) @@ -135,5 +134,3 @@ BLI_INLINE int _bm_elem_index_get(const BMHeader *head) { return head->index; } - -#endif /* __BMESH_INLINE_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_interp.h b/source/blender/bmesh/intern/bmesh_interp.h index bd3824ed3fd..0399b796cfd 100644 --- a/source/blender/bmesh/intern/bmesh_interp.h +++ b/source/blender/bmesh/intern/bmesh_interp.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_INTERP_H__ -#define __BMESH_INTERP_H__ +#pragma once /** \file * \ingroup bmesh @@ -82,5 +81,3 @@ void BM_vert_loop_groups_data_layer_merge_weights(BMesh *bm, struct LinkNode *groups, const int layer_n, const float *loop_weights); - -#endif /* __BMESH_INTERP_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_iterators.h b/source/blender/bmesh/intern/bmesh_iterators.h index a809c9a3d32..9314e23b21f 100644 --- a/source/blender/bmesh/intern/bmesh_iterators.h +++ b/source/blender/bmesh/intern/bmesh_iterators.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_ITERATORS_H__ -#define __BMESH_ITERATORS_H__ +#pragma once /** \file * \ingroup bmesh @@ -252,5 +251,3 @@ BMITER_CB_DEF(loop_of_face); (BM_ITER_CHECK_TYPE_DATA(data), BM_iter_new(iter, bm, itype, data)) #define BM_iter_init(iter, bm, itype, data) \ (BM_ITER_CHECK_TYPE_DATA(data), BM_iter_init(iter, bm, itype, data)) - -#endif /* __BMESH_ITERATORS_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_iterators_inline.h b/source/blender/bmesh/intern/bmesh_iterators_inline.h index 4b9fbf52630..c384fb03cd9 100644 --- a/source/blender/bmesh/intern/bmesh_iterators_inline.h +++ b/source/blender/bmesh/intern/bmesh_iterators_inline.h @@ -20,8 +20,7 @@ * BMesh inline iterator functions. */ -#ifndef __BMESH_ITERATORS_INLINE_H__ -#define __BMESH_ITERATORS_INLINE_H__ +#pragma once /* inline here optimizes out the switch statement when called with * constant values (which is very common), nicer for loop-in-loop situations */ @@ -210,5 +209,3 @@ BLI_INLINE void BM_iter_parallel(BMesh *bm, } #endif /* __BLI_TASK_H__ */ - -#endif /* __BMESH_ITERATORS_INLINE_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_log.h b/source/blender/bmesh/intern/bmesh_log.h index 25c58132802..5c0ca78bddf 100644 --- a/source/blender/bmesh/intern/bmesh_log.h +++ b/source/blender/bmesh/intern/bmesh_log.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_LOG_H__ -#define __BMESH_LOG_H__ +#pragma once /** \file * \ingroup bmesh @@ -98,5 +97,3 @@ void BM_log_original_vert_data(BMLog *log, BMVert *v, const float **r_co, const /* For internal use only (unit testing) */ BMLogEntry *BM_log_current_entry(BMLog *log); struct RangeTreeUInt *BM_log_unused_ids(BMLog *log); - -#endif diff --git a/source/blender/bmesh/intern/bmesh_marking.h b/source/blender/bmesh/intern/bmesh_marking.h index 06314a7a388..958980bdc23 100644 --- a/source/blender/bmesh/intern/bmesh_marking.h +++ b/source/blender/bmesh/intern/bmesh_marking.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_MARKING_H__ -#define __BMESH_MARKING_H__ +#pragma once /** \file * \ingroup bmesh @@ -137,5 +136,3 @@ void BM_select_history_merge_from_targetmap( (bm)->selected = _bm_prev_selected; \ } \ (void)0 - -#endif /* __BMESH_MARKING_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_mesh.h b/source/blender/bmesh/intern/bmesh_mesh.h index 0d665f1d391..a6b8b629ddf 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.h +++ b/source/blender/bmesh/intern/bmesh_mesh.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_MESH_H__ -#define __BMESH_MESH_H__ +#pragma once /** \file * \ingroup bmesh @@ -171,5 +170,3 @@ void BM_mesh_vert_coords_apply(BMesh *bm, const float (*orco)[3]); void BM_mesh_vert_coords_apply_with_mat4(BMesh *bm, const float (*vert_coords)[3], const float mat[4][4]); - -#endif /* __BMESH_MESH_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.h b/source/blender/bmesh/intern/bmesh_mesh_convert.h index 1ad43558c60..1b5d001d35d 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_convert.h +++ b/source/blender/bmesh/intern/bmesh_mesh_convert.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BMESH_MESH_CONV_H__ -#define __BMESH_MESH_CONV_H__ +#pragma once /** \file * \ingroup bmesh @@ -71,5 +70,3 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, struct Mesh *me, const struct CustomData_MeshMasks *cd_mask_extra) ATTR_NONNULL(1, 2); - -#endif /* __BMESH_MESH_CONV_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_mesh_duplicate.h b/source/blender/bmesh/intern/bmesh_mesh_duplicate.h index 17d4071b69f..8ace555d61f 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_duplicate.h +++ b/source/blender/bmesh/intern/bmesh_mesh_duplicate.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_MESH_DUPLICATE_H__ -#define __BMESH_MESH_DUPLICATE_H__ +#pragma once /** \file * \ingroup bmesh @@ -29,5 +28,3 @@ void BM_mesh_copy_arrays(BMesh *bm_src, uint edges_src_len, BMFace **faces_src, uint faces_src_len); - -#endif /* __BMESH_MESH_DUPLICATE_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_mesh_validate.h b/source/blender/bmesh/intern/bmesh_mesh_validate.h index 32bb4fb023b..2112e1f3200 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_validate.h +++ b/source/blender/bmesh/intern/bmesh_mesh_validate.h @@ -17,13 +17,10 @@ * All rights reserved. */ -#ifndef __BMESH_MESH_VALIDATE_H__ -#define __BMESH_MESH_VALIDATE_H__ +#pragma once /** \file * \ingroup bmesh */ bool BM_mesh_validate(BMesh *bm); - -#endif /* __BMESH_MESH_VALIDATE_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_mods.h b/source/blender/bmesh/intern/bmesh_mods.h index 36cb85bc9bc..8099d1dd603 100644 --- a/source/blender/bmesh/intern/bmesh_mods.h +++ b/source/blender/bmesh/intern/bmesh_mods.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_MODS_H__ -#define __BMESH_MODS_H__ +#pragma once /** \file * \ingroup bmesh @@ -94,5 +93,3 @@ enum { BMVert *BM_face_loop_separate(BMesh *bm, BMLoop *l_sep); BMVert *BM_face_loop_separate_multi_isolated(BMesh *bm, BMLoop *l_sep); BMVert *BM_face_loop_separate_multi(BMesh *bm, BMLoop **larr, int larr_len); - -#endif /* __BMESH_MODS_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h index 5af812d1b1d..a9282b8e5d0 100644 --- a/source/blender/bmesh/intern/bmesh_operator_api.h +++ b/source/blender/bmesh/intern/bmesh_operator_api.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_OPERATOR_API_H__ -#define __BMESH_OPERATOR_API_H__ +#pragma once /** \file * \ingroup bmesh @@ -668,5 +667,3 @@ int BMO_opcode_from_opname(const char *opname); #ifdef __cplusplus } #endif - -#endif /* __BMESH_OPERATOR_API_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_operator_api_inline.h b/source/blender/bmesh/intern/bmesh_operator_api_inline.h index 2bda2d121c2..43628f01bc8 100644 --- a/source/blender/bmesh/intern/bmesh_operator_api_inline.h +++ b/source/blender/bmesh/intern/bmesh_operator_api_inline.h @@ -20,8 +20,7 @@ * BMesh inline operator functions. */ -#ifndef __BMESH_OPERATOR_API_INLINE_H__ -#define __BMESH_OPERATOR_API_INLINE_H__ +#pragma once /* tool flag API. never, ever ever should tool code put junk in * header flags (element->head.flag), nor should they use @@ -236,5 +235,3 @@ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE return NULL; } - -#endif /* __BMESH_OPERATOR_API_INLINE_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h index c0e59758120..2f7d91c78c4 100644 --- a/source/blender/bmesh/intern/bmesh_operators.h +++ b/source/blender/bmesh/intern/bmesh_operators.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_OPERATORS_H__ -#define __BMESH_OPERATORS_H__ +#pragma once /** \file * \ingroup bmesh @@ -193,5 +192,3 @@ void BM_mesh_calc_uvs_cone(BMesh *bm, void BM_mesh_calc_uvs_cube(BMesh *bm, const short oflag); #include "intern/bmesh_operator_api_inline.h" - -#endif /* __BMESH_OPERATORS_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_operators_private.h b/source/blender/bmesh/intern/bmesh_operators_private.h index 137c5aa338e..1c53c3d5c89 100644 --- a/source/blender/bmesh/intern/bmesh_operators_private.h +++ b/source/blender/bmesh/intern/bmesh_operators_private.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_OPERATORS_PRIVATE_H__ -#define __BMESH_OPERATORS_PRIVATE_H__ +#pragma once /** \file * \ingroup bmesh @@ -103,5 +102,3 @@ void bmo_triangulate_exec(BMesh *bm, BMOperator *op); void bmo_unsubdivide_exec(BMesh *bm, BMOperator *op); void bmo_weld_verts_exec(BMesh *bm, BMOperator *op); void bmo_wireframe_exec(BMesh *bm, BMOperator *op); - -#endif /* __BMESH_OPERATORS_PRIVATE_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 0b93db6a91e..06bab8c8cc1 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -163,7 +163,7 @@ void BM_face_calc_tessellation(const BMFace *f, float(*projverts)[2] = BLI_array_alloca(projverts, f->len); int j; - axis_dominant_v3_to_m3(axis_mat, f->no); + axis_dominant_v3_to_m3_negate(axis_mat, f->no); j = 0; l_iter = l_first; @@ -174,7 +174,7 @@ void BM_face_calc_tessellation(const BMFace *f, } while ((l_iter = l_iter->next) != l_first); /* complete the loop */ - BLI_polyfill_calc(projverts, f->len, -1, r_index); + BLI_polyfill_calc(projverts, f->len, 1, r_index); } } diff --git a/source/blender/bmesh/intern/bmesh_polygon.h b/source/blender/bmesh/intern/bmesh_polygon.h index 1611bc0b893..d9413e303e3 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.h +++ b/source/blender/bmesh/intern/bmesh_polygon.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_POLYGON_H__ -#define __BMESH_POLYGON_H__ +#pragma once /** \file * \ingroup bmesh @@ -114,5 +113,3 @@ void BM_face_as_array_loop_quad(BMFace *f, BMLoop *r_loops[4]) ATTR_NONNULL(); void BM_vert_tri_calc_tangent_edge(BMVert *verts[3], float r_tangent[3]); void BM_vert_tri_calc_tangent_edge_pair(BMVert *verts[3], float r_tangent[3]); - -#endif /* __BMESH_POLYGON_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_polygon_edgenet.h b/source/blender/bmesh/intern/bmesh_polygon_edgenet.h index 38af944d0cd..6833f067421 100644 --- a/source/blender/bmesh/intern/bmesh_polygon_edgenet.h +++ b/source/blender/bmesh/intern/bmesh_polygon_edgenet.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_POLYGON_EDGENET_H__ -#define __BMESH_POLYGON_EDGENET_H__ +#pragma once /** \file * \ingroup bmesh @@ -37,5 +36,3 @@ bool BM_face_split_edgenet_connect_islands(BMesh *bm, BMEdge ***r_edge_net_new, uint *r_edge_net_new_len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3, 6, 7, 8); - -#endif /* __BMESH_POLYGON_EDGENET_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_private.h b/source/blender/bmesh/intern/bmesh_private.h index 8b4a59d5b9b..2c3bac6df33 100644 --- a/source/blender/bmesh/intern/bmesh_private.h +++ b/source/blender/bmesh/intern/bmesh_private.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BMESH_PRIVATE_H__ -#define __BMESH_PRIVATE_H__ +#pragma once /** \file * \ingroup bmesh @@ -90,5 +89,3 @@ void poly_rotate_plane(const float normal[3], float (*verts)[3], const uint nver /* include the rest of our private declarations */ #include "bmesh_structure.h" - -#endif /* __BMESH_PRIVATE_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_query.h b/source/blender/bmesh/intern/bmesh_query.h index 0d95efb778f..4ec6b0e50d1 100644 --- a/source/blender/bmesh/intern/bmesh_query.h +++ b/source/blender/bmesh/intern/bmesh_query.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_QUERY_H__ -#define __BMESH_QUERY_H__ +#pragma once /** \file * \ingroup bmesh @@ -273,5 +272,3 @@ int BM_mesh_calc_edge_groups_as_arrays(BMesh *bm, float bmesh_subd_falloff_calc(const int falloff, float val) ATTR_WARN_UNUSED_RESULT; #include "bmesh_query_inline.h" - -#endif /* __BMESH_QUERY_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_query_inline.h b/source/blender/bmesh/intern/bmesh_query_inline.h index 90919cc361b..8b12ccace20 100644 --- a/source/blender/bmesh/intern/bmesh_query_inline.h +++ b/source/blender/bmesh/intern/bmesh_query_inline.h @@ -18,8 +18,7 @@ * \ingroup bmesh */ -#ifndef __BMESH_QUERY_INLINE_H__ -#define __BMESH_QUERY_INLINE_H__ +#pragma once /** * Returns whether or not a given vertex is @@ -152,5 +151,3 @@ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) BLI_INLINE bool BM_vert_is_wire_endpoint } return false; } - -#endif /* __BMESH_QUERY_INLINE_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_query_uv.c b/source/blender/bmesh/intern/bmesh_query_uv.c index b9ea51f0c4d..1aa75bfb037 100644 --- a/source/blender/bmesh/intern/bmesh_query_uv.c +++ b/source/blender/bmesh/intern/bmesh_query_uv.c @@ -95,6 +95,20 @@ void BM_face_uv_calc_center_median_weighted(const BMFace *f, #undef UV_ASPECT +void BM_face_uv_calc_center_median(const BMFace *f, const int cd_loop_uv_offset, float r_cent[2]) +{ + const BMLoop *l_iter; + const BMLoop *l_first; + zero_v2(r_cent); + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset); + add_v2_v2(r_cent, luv->uv); + } while ((l_iter = l_iter->next) != l_first); + + mul_v2_fl(r_cent, 1.0f / (float)f->len); +} + /** * Calculate the UV cross product (use the sign to check the winding). */ diff --git a/source/blender/bmesh/intern/bmesh_query_uv.h b/source/blender/bmesh/intern/bmesh_query_uv.h index 2558f814f32..0a86c0cbeae 100644 --- a/source/blender/bmesh/intern/bmesh_query_uv.h +++ b/source/blender/bmesh/intern/bmesh_query_uv.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_QUERY_UV_H__ -#define __BMESH_QUERY_UV_H__ +#pragma once /** \file * \ingroup bmesh @@ -32,6 +31,8 @@ void BM_face_uv_calc_center_median_weighted(const BMFace *f, const float aspect[2], const int cd_loop_uv_offset, float r_cent[2]) ATTR_NONNULL(); +void BM_face_uv_calc_center_median(const BMFace *f, const int cd_loop_uv_offset, float r_cent[2]) + ATTR_NONNULL(); float BM_face_uv_calc_cross(const BMFace *f, const int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); @@ -54,5 +55,3 @@ bool BM_loop_uv_share_vert_check(BMLoop *l_a, BMLoop *l_b, const int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); - -#endif /* __BMESH_QUERY_UV_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_structure.h b/source/blender/bmesh/intern/bmesh_structure.h index 38c75dec354..b3b9536618c 100644 --- a/source/blender/bmesh/intern/bmesh_structure.h +++ b/source/blender/bmesh/intern/bmesh_structure.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BMESH_STRUCTURE_H__ -#define __BMESH_STRUCTURE_H__ +#pragma once /** \file * \ingroup bmesh @@ -93,5 +92,3 @@ BMEdge *bmesh_disk_edge_exists(const BMVert *v1, const BMVert *v2) ATTR_WARN_UNU bool bmesh_disk_validate(int len, BMEdge *e, BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); #include "intern/bmesh_structure_inline.h" - -#endif /* __BMESH_STRUCTURE_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_structure_inline.h b/source/blender/bmesh/intern/bmesh_structure_inline.h index 26d161693af..85a84dde4ad 100644 --- a/source/blender/bmesh/intern/bmesh_structure_inline.h +++ b/source/blender/bmesh/intern/bmesh_structure_inline.h @@ -20,8 +20,7 @@ * BMesh inline operator functions. */ -#ifndef __BMESH_STRUCTURE_INLINE_H__ -#define __BMESH_STRUCTURE_INLINE_H__ +#pragma once ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2) BLI_INLINE BMDiskLink *bmesh_disk_edge_link_from_vert(const BMEdge *e, const BMVert *v) @@ -72,5 +71,3 @@ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2) BLI_INLINE BMEdge *bmesh_disk_edge_pr { return BM_DISK_EDGE_PREV(e, v); } - -#endif /* __BMESH_STRUCTURE_INLINE_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_walkers.h b/source/blender/bmesh/intern/bmesh_walkers.h index 0b862a5e9a1..a973e12a4c7 100644 --- a/source/blender/bmesh/intern/bmesh_walkers.h +++ b/source/blender/bmesh/intern/bmesh_walkers.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_WALKERS_H__ -#define __BMESH_WALKERS_H__ +#pragma once /** \file * \ingroup bmesh @@ -130,5 +129,3 @@ enum { /* use with BMW_init, so as not to confuse with restrict flags */ #define BMW_NIL_LAY 0 - -#endif /* __BMESH_WALKERS_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_walkers_private.h b/source/blender/bmesh/intern/bmesh_walkers_private.h index 3457a2b9187..721f3c2c65b 100644 --- a/source/blender/bmesh/intern/bmesh_walkers_private.h +++ b/source/blender/bmesh/intern/bmesh_walkers_private.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_WALKERS_PRIVATE_H__ -#define __BMESH_WALKERS_PRIVATE_H__ +#pragma once /** \file * \ingroup bmesh @@ -94,5 +93,3 @@ typedef struct BMwConnectedVertexWalker { BMwGenericWalker header; BMVert *curvert; } BMwConnectedVertexWalker; - -#endif /* __BMESH_WALKERS_PRIVATE_H__ */ diff --git a/source/blender/bmesh/operators/bmo_beautify.c b/source/blender/bmesh/operators/bmo_beautify.c index 36122e06e9b..de26ca5ebd2 100644 --- a/source/blender/bmesh/operators/bmo_beautify.c +++ b/source/blender/bmesh/operators/bmo_beautify.c @@ -39,7 +39,10 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op) BMFace *f; BMEdge *e; const bool use_restrict_tag = BMO_slot_bool_get(op->slots_in, "use_restrict_tag"); - const short flag = (use_restrict_tag ? VERT_RESTRICT_TAG : 0); + const short flag = + ((use_restrict_tag ? VERT_RESTRICT_TAG : 0) | + /* Enable to avoid iterative edge rotation to cause the direction of faces to flip. */ + EDGE_RESTRICT_DEGENERATE); const short method = (short)BMO_slot_int_get(op->slots_in, "method"); BMEdge **edge_array; diff --git a/source/blender/bmesh/tools/bmesh_beautify.c b/source/blender/bmesh/tools/bmesh_beautify.c index c877c534376..a25e4666a22 100644 --- a/source/blender/bmesh/tools/bmesh_beautify.c +++ b/source/blender/bmesh/tools/bmesh_beautify.c @@ -141,7 +141,8 @@ static void erot_state_alternate(const BMEdge *e, EdRotState *e_state) static float bm_edge_calc_rotate_beauty__area(const float v1[3], const float v2[3], const float v3[3], - const float v4[3]) + const float v4[3], + const bool lock_degenerate) { /* not a loop (only to be able to break out) */ do { @@ -199,7 +200,8 @@ static float bm_edge_calc_rotate_beauty__area(const float v1[3], * Allowing to rotate out of a degenerate state can flip the faces * (when performed iteratively). */ - return BLI_polyfill_beautify_quad_rotate_calc_ex(v1_xy, v2_xy, v3_xy, v4_xy, true, NULL); + return BLI_polyfill_beautify_quad_rotate_calc_ex( + v1_xy, v2_xy, v3_xy, v4_xy, lock_degenerate, NULL); } while (false); return FLT_MAX; @@ -262,7 +264,8 @@ float BM_verts_calc_rotate_beauty(const BMVert *v1, switch (method) { case 0: - return bm_edge_calc_rotate_beauty__area(v1->co, v2->co, v3->co, v4->co); + return bm_edge_calc_rotate_beauty__area( + v1->co, v2->co, v3->co, v4->co, flag & EDGE_RESTRICT_DEGENERATE); default: return bm_edge_calc_rotate_beauty__angle(v1->co, v2->co, v3->co, v4->co); } diff --git a/source/blender/bmesh/tools/bmesh_beautify.h b/source/blender/bmesh/tools/bmesh_beautify.h index f957f0d3560..d0fef828e7c 100644 --- a/source/blender/bmesh/tools/bmesh_beautify.h +++ b/source/blender/bmesh/tools/bmesh_beautify.h @@ -14,15 +14,17 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_BEAUTIFY_H__ -#define __BMESH_BEAUTIFY_H__ +#pragma once /** \file * \ingroup bmesh */ enum { + /** Vertices tags must match (special case). */ VERT_RESTRICT_TAG = (1 << 0), + /** Don't rotate out of degenerate state (needed for iterative rotation). */ + EDGE_RESTRICT_DEGENERATE = (1 << 1), }; void BM_mesh_beautify_fill(BMesh *bm, @@ -39,5 +41,3 @@ float BM_verts_calc_rotate_beauty(const BMVert *v1, const BMVert *v4, const short flag, const short method); - -#endif /* __BMESH_BEAUTIFY_H__ */ diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 236c759c06a..6c666183755 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -835,6 +835,7 @@ static void math_layer_info_init(BevelParams *bp, BMesh *bm) BMFace *bmf, *bmf_other; BMEdge *bme; BMFace **stack; + bool *in_stack; BMIter eiter, fiter; bp->math_layer_info.has_math_layers = false; @@ -855,24 +856,29 @@ static void math_layer_info_init(BevelParams *bp, BMesh *bm) face_component = BLI_memarena_alloc(bp->mem_arena, totface * sizeof(int)); bp->math_layer_info.face_component = face_component; + /* Use an array as a stack. Stack size can't exceed total faces if keep track of what is in + * stack. */ + stack = MEM_malloc_arrayN(totface, sizeof(BMFace *), __func__); + in_stack = MEM_malloc_arrayN(totface, sizeof(bool), __func__); + /* Set all component ids by DFS from faces with unassigned components. */ for (f = 0; f < totface; f++) { face_component[f] = -1; + in_stack[f] = false; } current_component = -1; - - /* Use an array as a stack. Stack size can't exceed double total faces. */ - stack = MEM_malloc_arrayN(2 * totface, sizeof(BMFace *), __func__); for (f = 0; f < totface; f++) { - if (face_component[f] == -1) { + if (face_component[f] == -1 && !in_stack[f]) { stack_top = 0; current_component++; - BLI_assert(stack_top < 2 * totface); + BLI_assert(stack_top < totface); stack[stack_top] = BM_face_at_index(bm, f); + in_stack[f] = true; while (stack_top >= 0) { bmf = stack[stack_top]; stack_top--; bmf_index = BM_elem_index_get(bmf); + in_stack[bmf_index] = false; if (face_component[bmf_index] != -1) { continue; } @@ -885,13 +891,14 @@ static void math_layer_info_init(BevelParams *bp, BMesh *bm) BM_ITER_ELEM (bmf_other, &fiter, bme, BM_FACES_OF_EDGE) { if (bmf_other != bmf) { bmf_other_index = BM_elem_index_get(bmf_other); - if (face_component[bmf_other_index] != -1) { + if (face_component[bmf_other_index] != -1 || in_stack[bmf_other_index]) { continue; } if (contig_ldata_across_edge(bm, bme, bmf, bmf_other)) { stack_top++; - BLI_assert(stack_top < 2 * totface); + BLI_assert(stack_top < totface); stack[stack_top] = bmf_other; + in_stack[bmf_other_index] = true; } } } @@ -900,6 +907,7 @@ static void math_layer_info_init(BevelParams *bp, BMesh *bm) } } MEM_freeN(stack); + MEM_freeN(in_stack); } /** @@ -7140,27 +7148,6 @@ static void set_profile_spacing(BevelParams *bp, ProfileSpacing *pro_spacing, bo seg = bp->seg; seg_2 = power_of_2_max_i(bp->seg); if (seg > 1) { - /* Sample the input number of segments. */ - pro_spacing->xvals = (double *)BLI_memarena_alloc(bp->mem_arena, - (size_t)(seg + 1) * sizeof(double)); - pro_spacing->yvals = (double *)BLI_memarena_alloc(bp->mem_arena, - (size_t)(seg + 1) * sizeof(double)); - if (custom) { - /* Make sure the curve profile's sample table is full. */ - if (bp->custom_profile->segments_len != seg || !bp->custom_profile->segments) { - BKE_curveprofile_initialize((CurveProfile *)bp->custom_profile, (short)seg); - } - - /* Copy segment locations into the profile spacing struct. */ - for (int i = 0; i < seg + 1; i++) { - pro_spacing->xvals[i] = (double)bp->custom_profile->segments[i].y; - pro_spacing->yvals[i] = (double)bp->custom_profile->segments[i].x; - } - } - else { - find_even_superellipse_chords(seg, bp->pro_super_r, pro_spacing->xvals, pro_spacing->yvals); - } - /* Sample the seg_2 segments used for subdividing the vertex meshes. */ if (seg_2 == 2) { seg_2 = 4; @@ -7190,6 +7177,27 @@ static void set_profile_spacing(BevelParams *bp, ProfileSpacing *pro_spacing, bo seg_2, bp->pro_super_r, pro_spacing->xvals_2, pro_spacing->yvals_2); } } + + /* Sample the input number of segments. */ + pro_spacing->xvals = (double *)BLI_memarena_alloc(bp->mem_arena, + (size_t)(seg + 1) * sizeof(double)); + pro_spacing->yvals = (double *)BLI_memarena_alloc(bp->mem_arena, + (size_t)(seg + 1) * sizeof(double)); + if (custom) { + /* Make sure the curve profile's sample table is full. */ + if (bp->custom_profile->segments_len != seg || !bp->custom_profile->segments) { + BKE_curveprofile_initialize((CurveProfile *)bp->custom_profile, (short)seg); + } + + /* Copy segment locations into the profile spacing struct. */ + for (int i = 0; i < seg + 1; i++) { + pro_spacing->xvals[i] = (double)bp->custom_profile->segments[i].y; + pro_spacing->yvals[i] = (double)bp->custom_profile->segments[i].x; + } + } + else { + find_even_superellipse_chords(seg, bp->pro_super_r, pro_spacing->xvals, pro_spacing->yvals); + } } else { /* Only 1 segment, we don't need any profile information. */ pro_spacing->xvals = NULL; diff --git a/source/blender/bmesh/tools/bmesh_bevel.h b/source/blender/bmesh/tools/bmesh_bevel.h index 317ca05b68a..de57e1c62a9 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.h +++ b/source/blender/bmesh/tools/bmesh_bevel.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_BEVEL_H__ -#define __BMESH_BEVEL_H__ +#pragma once /** \file * \ingroup bmesh @@ -47,5 +46,3 @@ void BM_mesh_bevel(BMesh *bm, const float smoothresh, const struct CurveProfile *custom_profile, const int vmesh_method); - -#endif /* __BMESH_BEVEL_H__ */ diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.h b/source/blender/bmesh/tools/bmesh_bisect_plane.h index ca6281be99f..f64b5d8097c 100644 --- a/source/blender/bmesh/tools/bmesh_bisect_plane.h +++ b/source/blender/bmesh/tools/bmesh_bisect_plane.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_BISECT_PLANE_H__ -#define __BMESH_BISECT_PLANE_H__ +#pragma once /** \file * \ingroup bmesh @@ -28,5 +27,3 @@ void BM_mesh_bisect_plane(BMesh *bm, const short oflag_center, const short oflag_new, const float eps); - -#endif /* __BMESH_BISECT_PLANE_H__ */ diff --git a/source/blender/bmesh/tools/bmesh_decimate.h b/source/blender/bmesh/tools/bmesh_decimate.h index 669eb629e70..c62288c269a 100644 --- a/source/blender/bmesh/tools/bmesh_decimate.h +++ b/source/blender/bmesh/tools/bmesh_decimate.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_DECIMATE_H__ -#define __BMESH_DECIMATE_H__ +#pragma once /** \file * \ingroup bmesh @@ -45,5 +44,3 @@ void BM_mesh_decimate_dissolve(BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries, const BMO_Delimit delimit); - -#endif /* __BMESH_DECIMATE_H__ */ diff --git a/source/blender/bmesh/tools/bmesh_edgenet.h b/source/blender/bmesh/tools/bmesh_edgenet.h index 5db0e1170f3..7855b2e2886 100644 --- a/source/blender/bmesh/tools/bmesh_edgenet.h +++ b/source/blender/bmesh/tools/bmesh_edgenet.h @@ -14,13 +14,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_EDGENET_H__ -#define __BMESH_EDGENET_H__ +#pragma once /** \file * \ingroup bmesh */ void BM_mesh_edgenet(BMesh *bm, const bool use_edge_tag, const bool use_new_face_tag); - -#endif /* __BMESH_EDGENET_H__ */ diff --git a/source/blender/bmesh/tools/bmesh_edgesplit.h b/source/blender/bmesh/tools/bmesh_edgesplit.h index 0b3884ec888..4b8c07fc992 100644 --- a/source/blender/bmesh/tools/bmesh_edgesplit.h +++ b/source/blender/bmesh/tools/bmesh_edgesplit.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_EDGESPLIT_H__ -#define __BMESH_EDGESPLIT_H__ +#pragma once /** \file * \ingroup bmesh @@ -25,5 +24,3 @@ void BM_mesh_edgesplit(BMesh *bm, const bool use_verts, const bool tag_only, const bool copy_select); - -#endif /* __BMESH_EDGESPLIT_H__ */ diff --git a/source/blender/bmesh/tools/bmesh_intersect.h b/source/blender/bmesh/tools/bmesh_intersect.h index cbbc74d3f82..adb88f2fd76 100644 --- a/source/blender/bmesh/tools/bmesh_intersect.h +++ b/source/blender/bmesh/tools/bmesh_intersect.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_INTERSECT_H__ -#define __BMESH_INTERSECT_H__ +#pragma once /** \file * \ingroup bmesh @@ -42,5 +41,3 @@ enum { BMESH_ISECT_BOOLEAN_UNION = 1, BMESH_ISECT_BOOLEAN_DIFFERENCE = 2, }; - -#endif /* __BMESH_INTERSECT_H__ */ diff --git a/source/blender/bmesh/tools/bmesh_intersect_edges.h b/source/blender/bmesh/tools/bmesh_intersect_edges.h index 7e2252250d6..2736b7a52f9 100644 --- a/source/blender/bmesh/tools/bmesh_intersect_edges.h +++ b/source/blender/bmesh/tools/bmesh_intersect_edges.h @@ -18,10 +18,7 @@ * \ingroup bmesh */ -#ifndef __BMESH_INTERSECT_EDGES_H__ -#define __BMESH_INTERSECT_EDGES_H__ +#pragma once bool BM_mesh_intersect_edges( BMesh *bm, const char hflag, const float dist, const bool split_faces, GHash *r_targetmap); - -#endif /* __BMESH_INTERSECT_EDGES_H__ */ diff --git a/source/blender/bmesh/tools/bmesh_path.h b/source/blender/bmesh/tools/bmesh_path.h index 6d22a7e7e07..79c3d3a5d63 100644 --- a/source/blender/bmesh/tools/bmesh_path.h +++ b/source/blender/bmesh/tools/bmesh_path.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_PATH_H__ -#define __BMESH_PATH_H__ +#pragma once /** \file * \ingroup bmesh @@ -49,5 +48,3 @@ struct LinkNode *BM_mesh_calc_path_face(BMesh *bm, bool (*filter_fn)(BMFace *, void *), void *user_data) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3, 5); - -#endif /* __BMESH_PATH_H__ */ diff --git a/source/blender/bmesh/tools/bmesh_path_region.h b/source/blender/bmesh/tools/bmesh_path_region.h index 5204aa45da2..99a5b4a0960 100644 --- a/source/blender/bmesh/tools/bmesh_path_region.h +++ b/source/blender/bmesh/tools/bmesh_path_region.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_PATH_REGION_H__ -#define __BMESH_PATH_REGION_H__ +#pragma once /** \file * \ingroup bmesh @@ -41,5 +40,3 @@ struct LinkNode *BM_mesh_calc_path_region_face(BMesh *bm, bool (*test_fn)(BMFace *, void *user_data), void *user_data) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3); - -#endif /* __BMESH_PATH_REGION_H__ */ diff --git a/source/blender/bmesh/tools/bmesh_path_region_uv.h b/source/blender/bmesh/tools/bmesh_path_region_uv.h index 16e627ab461..18fe977c9fa 100644 --- a/source/blender/bmesh/tools/bmesh_path_region_uv.h +++ b/source/blender/bmesh/tools/bmesh_path_region_uv.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_PATH_REGION_UV_H__ -#define __BMESH_PATH_REGION_UV_H__ +#pragma once /** \file * \ingroup bmesh @@ -44,5 +43,3 @@ struct LinkNode *BM_mesh_calc_path_uv_region_face(BMesh *bm, bool (*test_fn)(BMFace *, void *user_data), void *user_data) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3); - -#endif /* __BMESH_PATH_REGION_UV_H__ */ diff --git a/source/blender/bmesh/tools/bmesh_path_uv.h b/source/blender/bmesh/tools/bmesh_path_uv.h index c7c5768f7d0..5f35d2c1594 100644 --- a/source/blender/bmesh/tools/bmesh_path_uv.h +++ b/source/blender/bmesh/tools/bmesh_path_uv.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_PATH_UV_H__ -#define __BMESH_PATH_UV_H__ +#pragma once /** \file * \ingroup bmesh @@ -43,5 +42,3 @@ struct LinkNode *BM_mesh_calc_path_uv_face(BMesh *bm, bool (*filter_fn)(BMFace *, void *), void *user_data) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3, 5); - -#endif /* __BMESH_PATH_UV_H__ */ diff --git a/source/blender/bmesh/tools/bmesh_region_match.h b/source/blender/bmesh/tools/bmesh_region_match.h index a0625543c51..799af938c31 100644 --- a/source/blender/bmesh/tools/bmesh_region_match.h +++ b/source/blender/bmesh/tools/bmesh_region_match.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_REGION_MATCH_H__ -#define __BMESH_REGION_MATCH_H__ +#pragma once /** \file * \ingroup bmesh @@ -25,5 +24,3 @@ int BM_mesh_region_match(BMesh *bm, BMFace **faces_region, uint faces_region_len, ListBase *r_face_regions); - -#endif /* __BMESH_REGION_MATCH_H__ */ diff --git a/source/blender/bmesh/tools/bmesh_separate.h b/source/blender/bmesh/tools/bmesh_separate.h index 13293b155fd..9260903a8fa 100644 --- a/source/blender/bmesh/tools/bmesh_separate.h +++ b/source/blender/bmesh/tools/bmesh_separate.h @@ -14,13 +14,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BMESH_SEPARATE_H__ -#define __BMESH_SEPARATE_H__ +#pragma once /** \file * \ingroup bmesh */ void BM_mesh_separate_faces(BMesh *bm, BMFaceFilterFunc filter_fn, void *user_data); - -#endif /* __BMESH_SEPARATE_H__ */ diff --git a/source/blender/bmesh/tools/bmesh_triangulate.h b/source/blender/bmesh/tools/bmesh_triangulate.h index ababd78f9a1..5353b315a38 100644 --- a/source/blender/bmesh/tools/bmesh_triangulate.h +++ b/source/blender/bmesh/tools/bmesh_triangulate.h @@ -20,8 +20,7 @@ * Triangulate. */ -#ifndef __BMESH_TRIANGULATE_H__ -#define __BMESH_TRIANGULATE_H__ +#pragma once void BM_mesh_triangulate(BMesh *bm, const int quad_method, @@ -31,5 +30,3 @@ void BM_mesh_triangulate(BMesh *bm, BMOperator *op, BMOpSlot *slot_facemap_out, BMOpSlot *slot_doubles_out); - -#endif /* __BMESH_TRIANGULATE_H__ */ diff --git a/source/blender/bmesh/tools/bmesh_wireframe.h b/source/blender/bmesh/tools/bmesh_wireframe.h index 3be43b2e9f5..b2c2f5f5523 100644 --- a/source/blender/bmesh/tools/bmesh_wireframe.h +++ b/source/blender/bmesh/tools/bmesh_wireframe.h @@ -20,8 +20,7 @@ * Wire Frame. */ -#ifndef __BMESH_WIREFRAME_H__ -#define __BMESH_WIREFRAME_H__ +#pragma once void BM_mesh_wireframe(BMesh *bm, const float offset, @@ -38,5 +37,3 @@ void BM_mesh_wireframe(BMesh *bm, const short mat_offset, const short mat_max, const bool use_tag); - -#endif /* __BMESH_WIREFRAME_H__ */ diff --git a/source/blender/compositor/COM_compositor.h b/source/blender/compositor/COM_compositor.h index a24904551c6..b200fa8d266 100644 --- a/source/blender/compositor/COM_compositor.h +++ b/source/blender/compositor/COM_compositor.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COMPOSITOR_H__ -#define __COM_COMPOSITOR_H__ +#pragma once #include "DNA_color_types.h" #include "DNA_node_types.h" @@ -364,4 +363,3 @@ void COM_deinitialize(void); } #endif -#endif /* __COM_COMPOSITOR_H__ */ diff --git a/source/blender/compositor/COM_defines.h b/source/blender/compositor/COM_defines.h index 3707845ef9b..a42719aaf09 100644 --- a/source/blender/compositor/COM_defines.h +++ b/source/blender/compositor/COM_defines.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DEFINES_H__ -#define __COM_DEFINES_H__ +#pragma once /** * \brief possible data types for sockets @@ -108,5 +107,3 @@ typedef enum OrderOfChunks { #define COM_NUM_CHANNELS_COLOR 4 #define COM_BLUR_BOKEH_PIXELS 512 - -#endif /* __COM_DEFINES_H__ */ diff --git a/source/blender/compositor/intern/COM_CPUDevice.h b/source/blender/compositor/intern/COM_CPUDevice.h index 1d411569146..962380d7bc8 100644 --- a/source/blender/compositor/intern/COM_CPUDevice.h +++ b/source/blender/compositor/intern/COM_CPUDevice.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_CPUDEVICE_H__ -#define __COM_CPUDEVICE_H__ +#pragma once #include "COM_Device.h" @@ -44,5 +43,3 @@ class CPUDevice : public Device { protected: int m_thread_id; }; - -#endif diff --git a/source/blender/compositor/intern/COM_ChunkOrder.h b/source/blender/compositor/intern/COM_ChunkOrder.h index e75c07136b4..32d8c07de83 100644 --- a/source/blender/compositor/intern/COM_ChunkOrder.h +++ b/source/blender/compositor/intern/COM_ChunkOrder.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_CHUNKORDER_H__ -#define __COM_CHUNKORDER_H__ +#pragma once #include "COM_ChunkOrderHotspot.h" class ChunkOrder { @@ -53,5 +52,3 @@ class ChunkOrder { return this->m_distance; } }; - -#endif diff --git a/source/blender/compositor/intern/COM_ChunkOrderHotspot.h b/source/blender/compositor/intern/COM_ChunkOrderHotspot.h index f0bc92ad6d6..afacf5fc672 100644 --- a/source/blender/compositor/intern/COM_ChunkOrderHotspot.h +++ b/source/blender/compositor/intern/COM_ChunkOrderHotspot.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_CHUNKORDERHOTSPOT_H__ -#define __COM_CHUNKORDERHOTSPOT_H__ +#pragma once #ifdef WITH_CXX_GUARDEDALLOC # include "MEM_guardedalloc.h" @@ -37,5 +36,3 @@ class ChunkOrderHotspot { MEM_CXX_CLASS_ALLOC_FUNCS("COM:ChunkOrderHotspot") #endif }; - -#endif diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h index 7e775b7beaf..e29a8f67187 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.h +++ b/source/blender/compositor/intern/COM_CompositorContext.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COMPOSITORCONTEXT_H__ -#define __COM_COMPOSITORCONTEXT_H__ +#pragma once #include "BLI_rect.h" #include "COM_defines.h" @@ -269,5 +268,3 @@ class CompositorContext { return (this->getbNodeTree()->flag & NTREE_COM_GROUPNODE_BUFFER) != 0; } }; - -#endif diff --git a/source/blender/compositor/intern/COM_Converter.h b/source/blender/compositor/intern/COM_Converter.h index 1213246b9c9..fe3b8b75ccc 100644 --- a/source/blender/compositor/intern/COM_Converter.h +++ b/source/blender/compositor/intern/COM_Converter.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_CONVERTER_H__ -#define __COM_CONVERTER_H__ +#pragma once #ifdef WITH_CXX_GUARDEDALLOC # include "MEM_guardedalloc.h" @@ -85,4 +84,3 @@ class Converter { MEM_CXX_CLASS_ALLOC_FUNCS("COM:Converter") #endif }; -#endif diff --git a/source/blender/compositor/intern/COM_Debug.h b/source/blender/compositor/intern/COM_Debug.h index 250f360fa35..35e44506ef2 100644 --- a/source/blender/compositor/intern/COM_Debug.h +++ b/source/blender/compositor/intern/COM_Debug.h @@ -16,8 +16,7 @@ * Copyright 2013, Blender Foundation. */ -#ifndef __COM_DEBUG_H__ -#define __COM_DEBUG_H__ +#pragma once #include <map> #include <string> @@ -77,5 +76,3 @@ class DebugInfo { static GroupStateMap m_group_states; /**< for visualizing group states */ #endif }; - -#endif diff --git a/source/blender/compositor/intern/COM_Device.h b/source/blender/compositor/intern/COM_Device.h index 8573f69658e..bb95f1e953c 100644 --- a/source/blender/compositor/intern/COM_Device.h +++ b/source/blender/compositor/intern/COM_Device.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DEVICE_H__ -#define __COM_DEVICE_H__ +#pragma once #include "COM_WorkPackage.h" @@ -62,5 +61,3 @@ class Device { MEM_CXX_CLASS_ALLOC_FUNCS("COM:Device") #endif }; - -#endif diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h index 0299dad2ee8..f0dca4e9b34 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.h +++ b/source/blender/compositor/intern/COM_ExecutionGroup.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_EXECUTIONGROUP_H__ -#define __COM_EXECUTIONGROUP_H__ +#pragma once #ifdef WITH_CXX_GUARDEDALLOC # include "MEM_guardedalloc.h" @@ -447,5 +446,3 @@ class ExecutionGroup { MEM_CXX_CLASS_ALLOC_FUNCS("COM:ExecutionGroup") #endif }; - -#endif diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h index bf65594fc4f..44b47787b06 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.h +++ b/source/blender/compositor/intern/COM_ExecutionSystem.h @@ -18,8 +18,7 @@ class ExecutionGroup; -#ifndef __COM_EXECUTIONSYSTEM_H__ -#define __COM_EXECUTIONSYSTEM_H__ +#pragma once #include "BKE_text.h" #include "COM_ExecutionGroup.h" @@ -196,5 +195,3 @@ class ExecutionSystem { MEM_CXX_CLASS_ALLOC_FUNCS("COM:ExecutionSystem") #endif }; - -#endif /* __COM_EXECUTIONSYSTEM_H__ */ diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h index 6ba8f144482..fce1310f6ef 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.h +++ b/source/blender/compositor/intern/COM_MemoryBuffer.h @@ -18,8 +18,7 @@ class MemoryBuffer; -#ifndef __COM_MEMORYBUFFER_H__ -#define __COM_MEMORYBUFFER_H__ +#pragma once #include "COM_ExecutionGroup.h" #include "COM_MemoryProxy.h" @@ -357,5 +356,3 @@ class MemoryBuffer { MEM_CXX_CLASS_ALLOC_FUNCS("COM:MemoryBuffer") #endif }; - -#endif diff --git a/source/blender/compositor/intern/COM_MemoryProxy.h b/source/blender/compositor/intern/COM_MemoryProxy.h index afbe0e3c166..a40e6f95dce 100644 --- a/source/blender/compositor/intern/COM_MemoryProxy.h +++ b/source/blender/compositor/intern/COM_MemoryProxy.h @@ -18,8 +18,8 @@ class MemoryProxy; -#ifndef __COM_MEMORYPROXY_H__ -#define __COM_MEMORYPROXY_H__ +#pragma once + #include "COM_ExecutionGroup.h" #include "COM_MemoryBuffer.h" @@ -129,5 +129,3 @@ class MemoryProxy { MEM_CXX_CLASS_ALLOC_FUNCS("COM:MemoryProxy") #endif }; - -#endif diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h index a2ab1996a19..0a34eff3492 100644 --- a/source/blender/compositor/intern/COM_Node.h +++ b/source/blender/compositor/intern/COM_Node.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_NODE_H__ -#define __COM_NODE_H__ +#pragma once #include "DNA_node_types.h" #include <algorithm> @@ -329,5 +328,3 @@ class NodeOutput { void getEditorValueColor(float *value); void getEditorValueVector(float *value); }; - -#endif /* __COM_NODE_H__ */ diff --git a/source/blender/compositor/intern/COM_NodeConverter.h b/source/blender/compositor/intern/COM_NodeConverter.h index 56e9aa85010..e9b05184857 100644 --- a/source/blender/compositor/intern/COM_NodeConverter.h +++ b/source/blender/compositor/intern/COM_NodeConverter.h @@ -16,8 +16,7 @@ * Copyright 2013, Blender Foundation. */ -#ifndef __COM_NODECONVERTER_H__ -#define __COM_NODECONVERTER_H__ +#pragma once #ifdef WITH_CXX_GUARDEDALLOC # include "MEM_guardedalloc.h" @@ -121,5 +120,3 @@ class NodeConverter { MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeCompiler") #endif }; - -#endif /* __COM_NODECONVERTER_H__ */ diff --git a/source/blender/compositor/intern/COM_NodeGraph.h b/source/blender/compositor/intern/COM_NodeGraph.h index 531832c2c65..7cbd45bd0b5 100644 --- a/source/blender/compositor/intern/COM_NodeGraph.h +++ b/source/blender/compositor/intern/COM_NodeGraph.h @@ -16,8 +16,7 @@ * Copyright 2013, Blender Foundation. */ -#ifndef __COM_NODEGRAPH_H__ -#define __COM_NODEGRAPH_H__ +#pragma once #include <map> #include <set> @@ -135,5 +134,3 @@ class NodeGraph { MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeGraph") #endif }; - -#endif /* __COM_NODEGRAPH_H__ */ diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h index d2c896a2e56..d9324729560 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.h +++ b/source/blender/compositor/intern/COM_NodeOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_NODEOPERATION_H__ -#define __COM_NODEOPERATION_H__ +#pragma once #include <list> #include <sstream> @@ -521,5 +520,3 @@ class NodeOperationOutput { MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeOperation") #endif }; - -#endif diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.h b/source/blender/compositor/intern/COM_NodeOperationBuilder.h index 917fa2888fd..5dd4022b127 100644 --- a/source/blender/compositor/intern/COM_NodeOperationBuilder.h +++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.h @@ -16,8 +16,7 @@ * Copyright 2013, Blender Foundation. */ -#ifndef __COM_NODEOPERATIONBUILDER_H__ -#define __COM_NODEOPERATIONBUILDER_H__ +#pragma once #include <map> #include <set> @@ -176,5 +175,3 @@ class NodeOperationBuilder { MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeCompilerImpl") #endif }; - -#endif /* __COM_NODEOPERATIONBUILDER_H__ */ diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.h b/source/blender/compositor/intern/COM_OpenCLDevice.h index 3f6e0fb55ef..d502f5aa34b 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.h +++ b/source/blender/compositor/intern/COM_OpenCLDevice.h @@ -18,8 +18,7 @@ class OpenCLDevice; -#ifndef __COM_OPENCLDEVICE_H__ -#define __COM_OPENCLDEVICE_H__ +#pragma once #include "COM_Device.h" #include "COM_ReadBufferOperation.h" @@ -133,5 +132,3 @@ class OpenCLDevice : public Device { NodeOperation *operation); cl_kernel COM_clCreateKernel(const char *kernelname, list<cl_kernel> *clKernelsToCleanUp); }; - -#endif diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.h b/source/blender/compositor/intern/COM_SingleThreadedOperation.h index 68c7f05a6c2..7a97d790afe 100644 --- a/source/blender/compositor/intern/COM_SingleThreadedOperation.h +++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_SINGLETHREADEDOPERATION_H__ -#define __COM_SINGLETHREADEDOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" class SingleThreadedOperation : public NodeOperation { @@ -57,4 +57,3 @@ class SingleThreadedOperation : public NodeOperation { return true; } }; -#endif diff --git a/source/blender/compositor/intern/COM_SocketReader.h b/source/blender/compositor/intern/COM_SocketReader.h index 82bebd5e7b9..ee2a6e0e1bf 100644 --- a/source/blender/compositor/intern/COM_SocketReader.h +++ b/source/blender/compositor/intern/COM_SocketReader.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_SOCKETREADER_H__ -#define __COM_SOCKETREADER_H__ +#pragma once + #include "BLI_rect.h" #include "COM_defines.h" @@ -138,5 +138,3 @@ class SocketReader { MEM_CXX_CLASS_ALLOC_FUNCS("COM:SocketReader") #endif }; - -#endif /* __COM_SOCKETREADER_H__ */ diff --git a/source/blender/compositor/intern/COM_WorkPackage.h b/source/blender/compositor/intern/COM_WorkPackage.h index 2a0e47301f5..f4370aa41be 100644 --- a/source/blender/compositor/intern/COM_WorkPackage.h +++ b/source/blender/compositor/intern/COM_WorkPackage.h @@ -18,8 +18,8 @@ class WorkPackage; -#ifndef __COM_WORKPACKAGE_H__ -#define __COM_WORKPACKAGE_H__ +#pragma once + class ExecutionGroup; #include "COM_ExecutionGroup.h" @@ -67,5 +67,3 @@ class WorkPackage { MEM_CXX_CLASS_ALLOC_FUNCS("COM:WorkPackage") #endif }; - -#endif diff --git a/source/blender/compositor/intern/COM_WorkScheduler.h b/source/blender/compositor/intern/COM_WorkScheduler.h index 3a1b4c533bd..2424d1bdb72 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.h +++ b/source/blender/compositor/intern/COM_WorkScheduler.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_WORKSCHEDULER_H__ -#define __COM_WORKSCHEDULER_H__ +#pragma once #include "COM_ExecutionGroup.h" @@ -116,5 +115,3 @@ class WorkScheduler { MEM_CXX_CLASS_ALLOC_FUNCS("COM:WorkScheduler") #endif }; - -#endif /* __COM_WORKSCHEDULER_H__ */ diff --git a/source/blender/compositor/nodes/COM_AlphaOverNode.h b/source/blender/compositor/nodes/COM_AlphaOverNode.h index 27e868e6f25..32cd2e20204 100644 --- a/source/blender/compositor/nodes/COM_AlphaOverNode.h +++ b/source/blender/compositor/nodes/COM_AlphaOverNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_ALPHAOVERNODE_H__ -#define __COM_ALPHAOVERNODE_H__ +#pragma once #include "COM_Node.h" @@ -32,5 +31,3 @@ class AlphaOverNode : public Node { } void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_BilateralBlurNode.h b/source/blender/compositor/nodes/COM_BilateralBlurNode.h index abed491c891..39308c7d1b6 100644 --- a/source/blender/compositor/nodes/COM_BilateralBlurNode.h +++ b/source/blender/compositor/nodes/COM_BilateralBlurNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_BILATERALBLURNODE_H__ -#define __COM_BILATERALBLURNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class BilateralBlurNode : public Node { BilateralBlurNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_BlurNode.h b/source/blender/compositor/nodes/COM_BlurNode.h index f0d6cad320e..3c832c93ca2 100644 --- a/source/blender/compositor/nodes/COM_BlurNode.h +++ b/source/blender/compositor/nodes/COM_BlurNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_BLURNODE_H__ -#define __COM_BLURNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class BlurNode : public Node { BlurNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.h b/source/blender/compositor/nodes/COM_BokehBlurNode.h index e2f728fb30b..87aca9af1f6 100644 --- a/source/blender/compositor/nodes/COM_BokehBlurNode.h +++ b/source/blender/compositor/nodes/COM_BokehBlurNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_BOKEHBLURNODE_H__ -#define __COM_BOKEHBLURNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class BokehBlurNode : public Node { BokehBlurNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_BokehImageNode.h b/source/blender/compositor/nodes/COM_BokehImageNode.h index 3e78e8d5185..b9d957cd6df 100644 --- a/source/blender/compositor/nodes/COM_BokehImageNode.h +++ b/source/blender/compositor/nodes/COM_BokehImageNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_BOKEHIMAGENODE_H__ -#define __COM_BOKEHIMAGENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class BokehImageNode : public Node { BokehImageNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_BoxMaskNode.h b/source/blender/compositor/nodes/COM_BoxMaskNode.h index 0d39014bbd0..b815fd75284 100644 --- a/source/blender/compositor/nodes/COM_BoxMaskNode.h +++ b/source/blender/compositor/nodes/COM_BoxMaskNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_BOXMASKNODE_H__ -#define __COM_BOXMASKNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class BoxMaskNode : public Node { BoxMaskNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_BrightnessNode.h b/source/blender/compositor/nodes/COM_BrightnessNode.h index 8529fc17d9c..b64b622dd71 100644 --- a/source/blender/compositor/nodes/COM_BrightnessNode.h +++ b/source/blender/compositor/nodes/COM_BrightnessNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_BRIGHTNESSNODE_H__ -#define __COM_BRIGHTNESSNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class BrightnessNode : public Node { BrightnessNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_ChannelMatteNode.h b/source/blender/compositor/nodes/COM_ChannelMatteNode.h index e6cd8bf6f0d..bca821fa60c 100644 --- a/source/blender/compositor/nodes/COM_ChannelMatteNode.h +++ b/source/blender/compositor/nodes/COM_ChannelMatteNode.h @@ -16,8 +16,7 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_CHANNELMATTENODE_H__ -#define __COM_CHANNELMATTENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class ChannelMatteNode : public Node { ChannelMatteNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* COM_ChannelMatteNODE_H */ diff --git a/source/blender/compositor/nodes/COM_ChromaMatteNode.h b/source/blender/compositor/nodes/COM_ChromaMatteNode.h index cfb6f23ebcb..d8febdde36f 100644 --- a/source/blender/compositor/nodes/COM_ChromaMatteNode.h +++ b/source/blender/compositor/nodes/COM_ChromaMatteNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_CHROMAMATTENODE_H__ -#define __COM_CHROMAMATTENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class ChromaMatteNode : public Node { ChromaMatteNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* COM_ChromaMatteNODE_H */ diff --git a/source/blender/compositor/nodes/COM_ColorBalanceNode.h b/source/blender/compositor/nodes/COM_ColorBalanceNode.h index 482b34e7809..302b66863ca 100644 --- a/source/blender/compositor/nodes/COM_ColorBalanceNode.h +++ b/source/blender/compositor/nodes/COM_ColorBalanceNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COLORBALANCENODE_H__ -#define __COM_COLORBALANCENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class ColorBalanceNode : public Node { ColorBalanceNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* COM_ColorBalanceNODE_H */ diff --git a/source/blender/compositor/nodes/COM_ColorCorrectionNode.h b/source/blender/compositor/nodes/COM_ColorCorrectionNode.h index 0275106095e..be6545f0cfa 100644 --- a/source/blender/compositor/nodes/COM_ColorCorrectionNode.h +++ b/source/blender/compositor/nodes/COM_ColorCorrectionNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COLORCORRECTIONNODE_H__ -#define __COM_COLORCORRECTIONNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class ColorCorrectionNode : public Node { ColorCorrectionNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_ColorCurveNode.h b/source/blender/compositor/nodes/COM_ColorCurveNode.h index 2a529e5713e..6eaf1db6fbb 100644 --- a/source/blender/compositor/nodes/COM_ColorCurveNode.h +++ b/source/blender/compositor/nodes/COM_ColorCurveNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COLORCURVENODE_H__ -#define __COM_COLORCURVENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class ColorCurveNode : public Node { ColorCurveNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_ColorMatteNode.h b/source/blender/compositor/nodes/COM_ColorMatteNode.h index 1f02a091307..e84bdfc836f 100644 --- a/source/blender/compositor/nodes/COM_ColorMatteNode.h +++ b/source/blender/compositor/nodes/COM_ColorMatteNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COLORMATTENODE_H__ -#define __COM_COLORMATTENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class ColorMatteNode : public Node { ColorMatteNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* COM_ColorMatteNODE_H */ diff --git a/source/blender/compositor/nodes/COM_ColorNode.h b/source/blender/compositor/nodes/COM_ColorNode.h index 5c7580a9ec9..9b50e9ab7d4 100644 --- a/source/blender/compositor/nodes/COM_ColorNode.h +++ b/source/blender/compositor/nodes/COM_ColorNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COLORNODE_H__ -#define __COM_COLORNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class ColorNode : public Node { ColorNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_ColorRampNode.h b/source/blender/compositor/nodes/COM_ColorRampNode.h index 3f7a188e549..b53edf14dbd 100644 --- a/source/blender/compositor/nodes/COM_ColorRampNode.h +++ b/source/blender/compositor/nodes/COM_ColorRampNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COLORRAMPNODE_H__ -#define __COM_COLORRAMPNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class ColorRampNode : public Node { ColorRampNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* COM_ColorRampNODE_H */ diff --git a/source/blender/compositor/nodes/COM_ColorSpillNode.h b/source/blender/compositor/nodes/COM_ColorSpillNode.h index 4678d1dd7b1..3cf8072c7b7 100644 --- a/source/blender/compositor/nodes/COM_ColorSpillNode.h +++ b/source/blender/compositor/nodes/COM_ColorSpillNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COLORSPILLNODE_H__ -#define __COM_COLORSPILLNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class ColorSpillNode : public Node { ColorSpillNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* COM_ColorSpillNODE_H */ diff --git a/source/blender/compositor/nodes/COM_ColorToBWNode.h b/source/blender/compositor/nodes/COM_ColorToBWNode.h index d811cab8019..6e7025de496 100644 --- a/source/blender/compositor/nodes/COM_ColorToBWNode.h +++ b/source/blender/compositor/nodes/COM_ColorToBWNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COLORTOBWNODE_H__ -#define __COM_COLORTOBWNODE_H__ +#pragma once #include "COM_Node.h" #include "DNA_node_types.h" @@ -30,4 +29,3 @@ class ColorToBWNode : public Node { ColorToBWNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif diff --git a/source/blender/compositor/nodes/COM_CombineColorNode.h b/source/blender/compositor/nodes/COM_CombineColorNode.h index 203a8e84306..378a4855abf 100644 --- a/source/blender/compositor/nodes/COM_CombineColorNode.h +++ b/source/blender/compositor/nodes/COM_CombineColorNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COMBINECOLORNODE_H__ -#define __COM_COMBINECOLORNODE_H__ +#pragma once #include "COM_Node.h" @@ -65,5 +64,3 @@ class CombineYUVANode : public CombineColorNode { NodeOperation *getColorConverter(const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_CompositorNode.h b/source/blender/compositor/nodes/COM_CompositorNode.h index 8fb2a5a5cf5..a75355dfc14 100644 --- a/source/blender/compositor/nodes/COM_CompositorNode.h +++ b/source/blender/compositor/nodes/COM_CompositorNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COMPOSITORNODE_H__ -#define __COM_COMPOSITORNODE_H__ +#pragma once #include "COM_Node.h" #include "DNA_node_types.h" @@ -30,4 +29,3 @@ class CompositorNode : public Node { CompositorNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif diff --git a/source/blender/compositor/nodes/COM_ConvertAlphaNode.h b/source/blender/compositor/nodes/COM_ConvertAlphaNode.h index 8fdeae39ada..372f34a576f 100644 --- a/source/blender/compositor/nodes/COM_ConvertAlphaNode.h +++ b/source/blender/compositor/nodes/COM_ConvertAlphaNode.h @@ -16,8 +16,7 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_CONVERTALPHANODE_H__ -#define __COM_CONVERTALPHANODE_H__ +#pragma once #include "COM_Node.h" @@ -32,5 +31,3 @@ class ConvertAlphaNode : public Node { } void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_CornerPinNode.h b/source/blender/compositor/nodes/COM_CornerPinNode.h index a8e88a0ef4f..ba845a614fb 100644 --- a/source/blender/compositor/nodes/COM_CornerPinNode.h +++ b/source/blender/compositor/nodes/COM_CornerPinNode.h @@ -15,8 +15,7 @@ * Copyright 2014, Blender Foundation. */ -#ifndef __COM_CORNERPINNODE_H__ -#define __COM_CORNERPINNODE_H__ +#pragma once #include "COM_Node.h" @@ -31,5 +30,3 @@ class CornerPinNode : public Node { CornerPinNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* __COM_CORNERPINNODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_CropNode.h b/source/blender/compositor/nodes/COM_CropNode.h index 295d4fb77e1..f643ebbabcc 100644 --- a/source/blender/compositor/nodes/COM_CropNode.h +++ b/source/blender/compositor/nodes/COM_CropNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_CROPNODE_H__ -#define __COM_CROPNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class CropNode : public Node { CropNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.h b/source/blender/compositor/nodes/COM_CryptomatteNode.h index 91f8051f125..1fb8893efa0 100644 --- a/source/blender/compositor/nodes/COM_CryptomatteNode.h +++ b/source/blender/compositor/nodes/COM_CryptomatteNode.h @@ -16,8 +16,7 @@ * Copyright 2018, Blender Foundation. */ -#ifndef __COM_CRYPTOMATTENODE_H__ -#define __COM_CRYPTOMATTENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class CryptomatteNode : public Node { CryptomatteNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_DefocusNode.h b/source/blender/compositor/nodes/COM_DefocusNode.h index f2589c7ae1a..c042e98c515 100644 --- a/source/blender/compositor/nodes/COM_DefocusNode.h +++ b/source/blender/compositor/nodes/COM_DefocusNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DEFOCUSNODE_H__ -#define __COM_DEFOCUSNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class DefocusNode : public Node { DefocusNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_DenoiseNode.h b/source/blender/compositor/nodes/COM_DenoiseNode.h index 6cbe598f7d2..99f59c89fdb 100644 --- a/source/blender/compositor/nodes/COM_DenoiseNode.h +++ b/source/blender/compositor/nodes/COM_DenoiseNode.h @@ -16,8 +16,7 @@ * Copyright 2019, Blender Foundation. */ -#ifndef __COM_DENOISENODE_H__ -#define __COM_DENOISENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class DenoiseNode : public Node { DenoiseNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_DespeckleNode.h b/source/blender/compositor/nodes/COM_DespeckleNode.h index ee510a0568c..6b39dd94ac7 100644 --- a/source/blender/compositor/nodes/COM_DespeckleNode.h +++ b/source/blender/compositor/nodes/COM_DespeckleNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DESPECKLENODE_H__ -#define __COM_DESPECKLENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class DespeckleNode : public Node { DespeckleNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_DifferenceMatteNode.h b/source/blender/compositor/nodes/COM_DifferenceMatteNode.h index 3a86a0bbf85..26be5fe1e80 100644 --- a/source/blender/compositor/nodes/COM_DifferenceMatteNode.h +++ b/source/blender/compositor/nodes/COM_DifferenceMatteNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DIFFERENCEMATTENODE_H__ -#define __COM_DIFFERENCEMATTENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class DifferenceMatteNode : public Node { DifferenceMatteNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* COM_DifferenceMatteNODE_H */ diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.h b/source/blender/compositor/nodes/COM_DilateErodeNode.h index d5b2863a4bb..090095df447 100644 --- a/source/blender/compositor/nodes/COM_DilateErodeNode.h +++ b/source/blender/compositor/nodes/COM_DilateErodeNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DILATEERODENODE_H__ -#define __COM_DILATEERODENODE_H__ +#pragma once #include "COM_Node.h" @@ -33,5 +32,3 @@ class DilateErodeNode : public Node { DilateErodeNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_DirectionalBlurNode.h b/source/blender/compositor/nodes/COM_DirectionalBlurNode.h index 0f9249a83a5..dfb705cbe64 100644 --- a/source/blender/compositor/nodes/COM_DirectionalBlurNode.h +++ b/source/blender/compositor/nodes/COM_DirectionalBlurNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DIRECTIONALBLURNODE_H__ -#define __COM_DIRECTIONALBLURNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class DirectionalBlurNode : public Node { DirectionalBlurNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_DisplaceNode.h b/source/blender/compositor/nodes/COM_DisplaceNode.h index e6a13e06772..a9e8a5ad657 100644 --- a/source/blender/compositor/nodes/COM_DisplaceNode.h +++ b/source/blender/compositor/nodes/COM_DisplaceNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DISPLACENODE_H__ -#define __COM_DISPLACENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,4 +29,3 @@ class DisplaceNode : public Node { DisplaceNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif diff --git a/source/blender/compositor/nodes/COM_DistanceMatteNode.h b/source/blender/compositor/nodes/COM_DistanceMatteNode.h index baba9bb8c97..6ae71ef715f 100644 --- a/source/blender/compositor/nodes/COM_DistanceMatteNode.h +++ b/source/blender/compositor/nodes/COM_DistanceMatteNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DISTANCEMATTENODE_H__ -#define __COM_DISTANCEMATTENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class DistanceMatteNode : public Node { DistanceMatteNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* COM_DistanceMatteNODE_H */ diff --git a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h index c45d42675f3..6d26cbbf528 100644 --- a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h +++ b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DOUBLEEDGEMASKNODE_H__ -#define __COM_DOUBLEEDGEMASKNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class DoubleEdgeMaskNode : public Node { DoubleEdgeMaskNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_EllipseMaskNode.h b/source/blender/compositor/nodes/COM_EllipseMaskNode.h index b7093bf68fa..d7376cad52e 100644 --- a/source/blender/compositor/nodes/COM_EllipseMaskNode.h +++ b/source/blender/compositor/nodes/COM_EllipseMaskNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_ELLIPSEMASKNODE_H__ -#define __COM_ELLIPSEMASKNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class EllipseMaskNode : public Node { EllipseMaskNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_FilterNode.h b/source/blender/compositor/nodes/COM_FilterNode.h index d0e824051bb..735d8925b48 100644 --- a/source/blender/compositor/nodes/COM_FilterNode.h +++ b/source/blender/compositor/nodes/COM_FilterNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_FILTERNODE_H__ -#define __COM_FILTERNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class FilterNode : public Node { FilterNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* __COM_FILTERNODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_FlipNode.h b/source/blender/compositor/nodes/COM_FlipNode.h index 2122961dac9..e819c003430 100644 --- a/source/blender/compositor/nodes/COM_FlipNode.h +++ b/source/blender/compositor/nodes/COM_FlipNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_FLIPNODE_H__ -#define __COM_FLIPNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class FlipNode : public Node { FlipNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_GammaNode.h b/source/blender/compositor/nodes/COM_GammaNode.h index 46573fc4b3f..1a4d02af160 100644 --- a/source/blender/compositor/nodes/COM_GammaNode.h +++ b/source/blender/compositor/nodes/COM_GammaNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_GAMMANODE_H__ -#define __COM_GAMMANODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class GammaNode : public Node { GammaNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_GlareNode.h b/source/blender/compositor/nodes/COM_GlareNode.h index 051ae1d1dc3..7463af97306 100644 --- a/source/blender/compositor/nodes/COM_GlareNode.h +++ b/source/blender/compositor/nodes/COM_GlareNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_GLARENODE_H__ -#define __COM_GLARENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class GlareNode : public Node { GlareNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h index 270d29cc41b..01790c1a5fb 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h +++ b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_HUESATURATIONVALUECORRECTNODE_H__ -#define __COM_HUESATURATIONVALUECORRECTNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,4 +29,3 @@ class HueSaturationValueCorrectNode : public Node { HueSaturationValueCorrectNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueNode.h b/source/blender/compositor/nodes/COM_HueSaturationValueNode.h index 5e023a0762d..7ef7abe4188 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueNode.h +++ b/source/blender/compositor/nodes/COM_HueSaturationValueNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_HUESATURATIONVALUENODE_H__ -#define __COM_HUESATURATIONVALUENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,4 +29,3 @@ class HueSaturationValueNode : public Node { HueSaturationValueNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif diff --git a/source/blender/compositor/nodes/COM_IDMaskNode.h b/source/blender/compositor/nodes/COM_IDMaskNode.h index 3f4019bf5b7..51076619951 100644 --- a/source/blender/compositor/nodes/COM_IDMaskNode.h +++ b/source/blender/compositor/nodes/COM_IDMaskNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_IDMASKNODE_H__ -#define __COM_IDMASKNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class IDMaskNode : public Node { IDMaskNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_ImageNode.h b/source/blender/compositor/nodes/COM_ImageNode.h index 7883f4d7ab3..9481ef4f7b1 100644 --- a/source/blender/compositor/nodes/COM_ImageNode.h +++ b/source/blender/compositor/nodes/COM_ImageNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_IMAGENODE_H__ -#define __COM_IMAGENODE_H__ +#pragma once #include "COM_Node.h" #include "COM_defines.h" @@ -46,5 +45,3 @@ class ImageNode : public Node { ImageNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* __COM_IMAGENODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_InpaintNode.h b/source/blender/compositor/nodes/COM_InpaintNode.h index 61a7ac63146..3f778c8ba5c 100644 --- a/source/blender/compositor/nodes/COM_InpaintNode.h +++ b/source/blender/compositor/nodes/COM_InpaintNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_INPAINTNODE_H__ -#define __COM_INPAINTNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class InpaintNode : public Node { InpaintNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_InvertNode.h b/source/blender/compositor/nodes/COM_InvertNode.h index 02e2eb38dc9..d90d6e48713 100644 --- a/source/blender/compositor/nodes/COM_InvertNode.h +++ b/source/blender/compositor/nodes/COM_InvertNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_INVERTNODE_H__ -#define __COM_INVERTNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class InvertNode : public Node { InvertNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_KeyingNode.h b/source/blender/compositor/nodes/COM_KeyingNode.h index fc5f55e33ae..cfb1f2e6ddf 100644 --- a/source/blender/compositor/nodes/COM_KeyingNode.h +++ b/source/blender/compositor/nodes/COM_KeyingNode.h @@ -16,8 +16,7 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_KEYINGNODE_H__ -#define __COM_KEYINGNODE_H__ +#pragma once #include "COM_Node.h" @@ -58,5 +57,3 @@ class KeyingNode : public Node { KeyingNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* __COM_KEYINGNODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_KeyingScreenNode.h b/source/blender/compositor/nodes/COM_KeyingScreenNode.h index 12db2ed8889..ce9ef54543d 100644 --- a/source/blender/compositor/nodes/COM_KeyingScreenNode.h +++ b/source/blender/compositor/nodes/COM_KeyingScreenNode.h @@ -16,8 +16,7 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_KEYINGSCREENNODE_H__ -#define __COM_KEYINGSCREENNODE_H__ +#pragma once #include "COM_Node.h" #include "DNA_node_types.h" @@ -31,5 +30,3 @@ class KeyingScreenNode : public Node { KeyingScreenNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* __COM_KEYINGSCREENNODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_LensDistortionNode.h b/source/blender/compositor/nodes/COM_LensDistortionNode.h index f4d9e127558..8df0e3f7df1 100644 --- a/source/blender/compositor/nodes/COM_LensDistortionNode.h +++ b/source/blender/compositor/nodes/COM_LensDistortionNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_LENSDISTORTIONNODE_H__ -#define __COM_LENSDISTORTIONNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class LensDistortionNode : public Node { LensDistortionNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_LuminanceMatteNode.h b/source/blender/compositor/nodes/COM_LuminanceMatteNode.h index 57a8f25602a..7f2d9dfbe95 100644 --- a/source/blender/compositor/nodes/COM_LuminanceMatteNode.h +++ b/source/blender/compositor/nodes/COM_LuminanceMatteNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_LUMINANCEMATTENODE_H__ -#define __COM_LUMINANCEMATTENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class LuminanceMatteNode : public Node { LuminanceMatteNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* __COM_LUMINANCEMATTENODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_MapRangeNode.h b/source/blender/compositor/nodes/COM_MapRangeNode.h index b63524291c1..b838ea858ee 100644 --- a/source/blender/compositor/nodes/COM_MapRangeNode.h +++ b/source/blender/compositor/nodes/COM_MapRangeNode.h @@ -16,8 +16,7 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_MAPRANGENODE_H__ -#define __COM_MAPRANGENODE_H__ +#pragma once #include "COM_Node.h" #include "DNA_node_types.h" @@ -30,5 +29,3 @@ class MapRangeNode : public Node { MapRangeNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* __COM_MAPRANGENODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_MapUVNode.h b/source/blender/compositor/nodes/COM_MapUVNode.h index 46892453b92..f9fc413dbe5 100644 --- a/source/blender/compositor/nodes/COM_MapUVNode.h +++ b/source/blender/compositor/nodes/COM_MapUVNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_MAPUVNODE_H__ -#define __COM_MAPUVNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,4 +29,3 @@ class MapUVNode : public Node { MapUVNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif diff --git a/source/blender/compositor/nodes/COM_MapValueNode.h b/source/blender/compositor/nodes/COM_MapValueNode.h index 289b4f24138..60ee262d447 100644 --- a/source/blender/compositor/nodes/COM_MapValueNode.h +++ b/source/blender/compositor/nodes/COM_MapValueNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_MAPVALUENODE_H__ -#define __COM_MAPVALUENODE_H__ +#pragma once #include "COM_Node.h" #include "DNA_node_types.h" @@ -30,5 +29,3 @@ class MapValueNode : public Node { MapValueNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* __COM_MAPVALUENODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_MaskNode.h b/source/blender/compositor/nodes/COM_MaskNode.h index 6c8006a8de6..4a03916b3c2 100644 --- a/source/blender/compositor/nodes/COM_MaskNode.h +++ b/source/blender/compositor/nodes/COM_MaskNode.h @@ -16,8 +16,7 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_MASKNODE_H__ -#define __COM_MASKNODE_H__ +#pragma once #include "COM_Node.h" #include "DNA_node_types.h" @@ -31,5 +30,3 @@ class MaskNode : public Node { MaskNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* __COM_MASKNODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_MathNode.h b/source/blender/compositor/nodes/COM_MathNode.h index e53d84a221f..41b144679ac 100644 --- a/source/blender/compositor/nodes/COM_MathNode.h +++ b/source/blender/compositor/nodes/COM_MathNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_MATHNODE_H__ -#define __COM_MATHNODE_H__ +#pragma once #include "COM_Node.h" @@ -32,5 +31,3 @@ class MathNode : public Node { } void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_MixNode.h b/source/blender/compositor/nodes/COM_MixNode.h index 511e1ffa7a8..91ce29fdbf2 100644 --- a/source/blender/compositor/nodes/COM_MixNode.h +++ b/source/blender/compositor/nodes/COM_MixNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_MIXNODE_H__ -#define __COM_MIXNODE_H__ +#pragma once #include "COM_Node.h" #include "DNA_node_types.h" @@ -30,4 +29,3 @@ class MixNode : public Node { MixNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif diff --git a/source/blender/compositor/nodes/COM_MovieClipNode.h b/source/blender/compositor/nodes/COM_MovieClipNode.h index 2c3f29772d5..58262592dca 100644 --- a/source/blender/compositor/nodes/COM_MovieClipNode.h +++ b/source/blender/compositor/nodes/COM_MovieClipNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_MOVIECLIPNODE_H__ -#define __COM_MOVIECLIPNODE_H__ +#pragma once #include "COM_Node.h" #include "DNA_node_types.h" @@ -31,5 +30,3 @@ class MovieClipNode : public Node { MovieClipNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* __COM_MOVIECLIPNODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_MovieDistortionNode.h b/source/blender/compositor/nodes/COM_MovieDistortionNode.h index da687080691..f4df48dac13 100644 --- a/source/blender/compositor/nodes/COM_MovieDistortionNode.h +++ b/source/blender/compositor/nodes/COM_MovieDistortionNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_MOVIEDISTORTIONNODE_H__ -#define __COM_MOVIEDISTORTIONNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class MovieDistortionNode : public Node { MovieDistortionNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_NormalNode.h b/source/blender/compositor/nodes/COM_NormalNode.h index 4151960c506..c23e83fb023 100644 --- a/source/blender/compositor/nodes/COM_NormalNode.h +++ b/source/blender/compositor/nodes/COM_NormalNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_NORMALNODE_H__ -#define __COM_NORMALNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class NormalNode : public Node { NormalNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* COM_NormalNODE_H */ diff --git a/source/blender/compositor/nodes/COM_NormalizeNode.h b/source/blender/compositor/nodes/COM_NormalizeNode.h index 593c98f2ce2..7e53ac7e9a0 100644 --- a/source/blender/compositor/nodes/COM_NormalizeNode.h +++ b/source/blender/compositor/nodes/COM_NormalizeNode.h @@ -16,8 +16,7 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_NORMALIZENODE_H__ -#define __COM_NORMALIZENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class NormalizeNode : public Node { NormalizeNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.h b/source/blender/compositor/nodes/COM_OutputFileNode.h index 932fa375a3a..037a345fa50 100644 --- a/source/blender/compositor/nodes/COM_OutputFileNode.h +++ b/source/blender/compositor/nodes/COM_OutputFileNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_OUTPUTFILENODE_H__ -#define __COM_OUTPUTFILENODE_H__ +#pragma once #include "COM_Node.h" #include "DNA_node_types.h" @@ -31,5 +30,3 @@ class OutputFileNode : public Node { OutputFileNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_PixelateNode.h b/source/blender/compositor/nodes/COM_PixelateNode.h index f46035398e2..87cb4df59e8 100644 --- a/source/blender/compositor/nodes/COM_PixelateNode.h +++ b/source/blender/compositor/nodes/COM_PixelateNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_PIXELATENODE_H__ -#define __COM_PIXELATENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class PixelateNode : public Node { PixelateNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h index 2c17739a220..36844bc1650 100644 --- a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h +++ b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h @@ -16,8 +16,7 @@ * Copyright 2013, Blender Foundation. */ -#ifndef __COM_PLANETRACKDEFORMNODE_H__ -#define __COM_PLANETRACKDEFORMNODE_H__ +#pragma once #include "COM_Node.h" @@ -33,5 +32,3 @@ class PlaneTrackDeformNode : public Node { PlaneTrackDeformNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* __COM_PLANETRACKDEFORMNODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_RenderLayersNode.h b/source/blender/compositor/nodes/COM_RenderLayersNode.h index c992f60581f..1ffd084ad1e 100644 --- a/source/blender/compositor/nodes/COM_RenderLayersNode.h +++ b/source/blender/compositor/nodes/COM_RenderLayersNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_RENDERLAYERSNODE_H__ -#define __COM_RENDERLAYERSNODE_H__ +#pragma once #include "COM_Node.h" #include "COM_RenderLayersProg.h" @@ -49,5 +48,3 @@ class RenderLayersNode : public Node { void missingSocketLink(NodeConverter &converter, NodeOutput *output) const; void missingRenderLink(NodeConverter &converter) const; }; - -#endif /* __COM_RENDERLAYERSNODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_RotateNode.h b/source/blender/compositor/nodes/COM_RotateNode.h index e7440bb7a8e..b75fdd52683 100644 --- a/source/blender/compositor/nodes/COM_RotateNode.h +++ b/source/blender/compositor/nodes/COM_RotateNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_ROTATENODE_H__ -#define __COM_ROTATENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class RotateNode : public Node { RotateNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_ScaleNode.h b/source/blender/compositor/nodes/COM_ScaleNode.h index b6e589cfcec..c9a02411b1c 100644 --- a/source/blender/compositor/nodes/COM_ScaleNode.h +++ b/source/blender/compositor/nodes/COM_ScaleNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_SCALENODE_H__ -#define __COM_SCALENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class ScaleNode : public Node { ScaleNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_SeparateColorNode.h b/source/blender/compositor/nodes/COM_SeparateColorNode.h index f98a9d6d12f..aaf86c6e22b 100644 --- a/source/blender/compositor/nodes/COM_SeparateColorNode.h +++ b/source/blender/compositor/nodes/COM_SeparateColorNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_SEPARATECOLORNODE_H__ -#define __COM_SEPARATECOLORNODE_H__ +#pragma once #include "COM_Node.h" @@ -65,5 +64,3 @@ class SeparateYUVANode : public SeparateColorNode { NodeOperation *getColorConverter(const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_SetAlphaNode.h b/source/blender/compositor/nodes/COM_SetAlphaNode.h index 9882b3e62e9..2e652539cec 100644 --- a/source/blender/compositor/nodes/COM_SetAlphaNode.h +++ b/source/blender/compositor/nodes/COM_SetAlphaNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_SETALPHANODE_H__ -#define __COM_SETALPHANODE_H__ +#pragma once #include "COM_Node.h" @@ -32,5 +31,3 @@ class SetAlphaNode : public Node { } void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_SocketProxyNode.h b/source/blender/compositor/nodes/COM_SocketProxyNode.h index 21e888d323e..a0c0b63dafd 100644 --- a/source/blender/compositor/nodes/COM_SocketProxyNode.h +++ b/source/blender/compositor/nodes/COM_SocketProxyNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_SOCKETPROXYNODE_H__ -#define __COM_SOCKETPROXYNODE_H__ +#pragma once #include "COM_Node.h" @@ -52,5 +51,3 @@ class SocketBufferNode : public Node { SocketBufferNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_SplitViewerNode.h b/source/blender/compositor/nodes/COM_SplitViewerNode.h index 2e350720841..c9ce5164ef4 100644 --- a/source/blender/compositor/nodes/COM_SplitViewerNode.h +++ b/source/blender/compositor/nodes/COM_SplitViewerNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_SPLITVIEWERNODE_H__ -#define __COM_SPLITVIEWERNODE_H__ +#pragma once #include "COM_Node.h" #include "DNA_node_types.h" @@ -30,4 +29,3 @@ class SplitViewerNode : public Node { SplitViewerNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif diff --git a/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp b/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp index 7a308ac47b9..38db080a154 100644 --- a/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp +++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp @@ -82,17 +82,32 @@ void Stabilize2dNode::convertToOperations(NodeConverter &converter, converter.addOperation(rotateOperation); converter.addOperation(psoperation); - converter.mapInputSocket(imageInput, scaleOperation->getInputSocket(0)); converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(1)); converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(2)); - converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0)); converter.addLink(angleAttribute->getOutputSocket(), rotateOperation->getInputSocket(1)); - converter.addLink(rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0)); converter.addLink(xAttribute->getOutputSocket(), translateOperation->getInputSocket(1)); converter.addLink(yAttribute->getOutputSocket(), translateOperation->getInputSocket(2)); - converter.addLink(translateOperation->getOutputSocket(), psoperation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(), psoperation->getOutputSocket()); + + if (invert) { + // Translate -> Rotate -> Scale. + converter.mapInputSocket(imageInput, translateOperation->getInputSocket(0)); + + converter.addLink(translateOperation->getOutputSocket(), rotateOperation->getInputSocket(0)); + converter.addLink(rotateOperation->getOutputSocket(), scaleOperation->getInputSocket(0)); + + converter.addLink(scaleOperation->getOutputSocket(), psoperation->getInputSocket(0)); + } + else { + // Scale -> Rotate -> Translate. + converter.mapInputSocket(imageInput, scaleOperation->getInputSocket(0)); + + converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0)); + converter.addLink(rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0)); + + converter.addLink(translateOperation->getOutputSocket(), psoperation->getInputSocket(0)); + } } diff --git a/source/blender/compositor/nodes/COM_Stabilize2dNode.h b/source/blender/compositor/nodes/COM_Stabilize2dNode.h index bbf7b239d82..cb46926a3f3 100644 --- a/source/blender/compositor/nodes/COM_Stabilize2dNode.h +++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_STABILIZE2DNODE_H__ -#define __COM_STABILIZE2DNODE_H__ +#pragma once #include "COM_Node.h" #include "DNA_node_types.h" @@ -31,5 +30,3 @@ class Stabilize2dNode : public Node { Stabilize2dNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_SunBeamsNode.h b/source/blender/compositor/nodes/COM_SunBeamsNode.h index 9d35f40f760..9a56fc1fcea 100644 --- a/source/blender/compositor/nodes/COM_SunBeamsNode.h +++ b/source/blender/compositor/nodes/COM_SunBeamsNode.h @@ -15,8 +15,7 @@ * Copyright 2014, Blender Foundation. */ -#ifndef __COM_SUNBEAMSNODE_H__ -#define __COM_SUNBEAMSNODE_H__ +#pragma once #include "COM_Node.h" @@ -29,5 +28,3 @@ class SunBeamsNode : public Node { SunBeamsNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_SwitchNode.h b/source/blender/compositor/nodes/COM_SwitchNode.h index 509b748b18a..d4d8dd23a98 100644 --- a/source/blender/compositor/nodes/COM_SwitchNode.h +++ b/source/blender/compositor/nodes/COM_SwitchNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_SWITCHNODE_H__ -#define __COM_SWITCHNODE_H__ +#pragma once #include "COM_Node.h" #include "COM_NodeOperation.h" @@ -31,4 +30,3 @@ class SwitchNode : public Node { SwitchNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif diff --git a/source/blender/compositor/nodes/COM_SwitchViewNode.h b/source/blender/compositor/nodes/COM_SwitchViewNode.h index 0260621961d..9423740f668 100644 --- a/source/blender/compositor/nodes/COM_SwitchViewNode.h +++ b/source/blender/compositor/nodes/COM_SwitchViewNode.h @@ -16,8 +16,7 @@ * Copyright 2015, Blender Foundation. */ -#ifndef __COM_SWITCHVIEWNODE_H__ -#define __COM_SWITCHVIEWNODE_H__ +#pragma once #include "COM_Node.h" #include "COM_NodeOperation.h" @@ -31,4 +30,3 @@ class SwitchViewNode : public Node { SwitchViewNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif diff --git a/source/blender/compositor/nodes/COM_TextureNode.h b/source/blender/compositor/nodes/COM_TextureNode.h index 8fe620a89b3..4d780850190 100644 --- a/source/blender/compositor/nodes/COM_TextureNode.h +++ b/source/blender/compositor/nodes/COM_TextureNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_TEXTURENODE_H__ -#define __COM_TEXTURENODE_H__ +#pragma once #include "COM_Node.h" #include "DNA_node_types.h" @@ -31,5 +30,3 @@ class TextureNode : public Node { TextureNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* __COM_TEXTURENODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_TimeNode.h b/source/blender/compositor/nodes/COM_TimeNode.h index 230ffe3b676..78177014dc1 100644 --- a/source/blender/compositor/nodes/COM_TimeNode.h +++ b/source/blender/compositor/nodes/COM_TimeNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_TIMENODE_H__ -#define __COM_TIMENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class TimeNode : public Node { TimeNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_TonemapNode.h b/source/blender/compositor/nodes/COM_TonemapNode.h index 9e6c01a5e45..d934a1ede5b 100644 --- a/source/blender/compositor/nodes/COM_TonemapNode.h +++ b/source/blender/compositor/nodes/COM_TonemapNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_TONEMAPNODE_H__ -#define __COM_TONEMAPNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class TonemapNode : public Node { TonemapNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_TrackPositionNode.h b/source/blender/compositor/nodes/COM_TrackPositionNode.h index 7136077a123..37d3d25d592 100644 --- a/source/blender/compositor/nodes/COM_TrackPositionNode.h +++ b/source/blender/compositor/nodes/COM_TrackPositionNode.h @@ -16,8 +16,7 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_TRACKPOSITIONNODE_H__ -#define __COM_TRACKPOSITIONNODE_H__ +#pragma once #include "COM_Node.h" #include "DNA_node_types.h" @@ -31,5 +30,3 @@ class TrackPositionNode : public Node { TrackPositionNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* __COM_TRACKPOSITIONNODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_TransformNode.h b/source/blender/compositor/nodes/COM_TransformNode.h index 12eb66a19bb..bd01808d662 100644 --- a/source/blender/compositor/nodes/COM_TransformNode.h +++ b/source/blender/compositor/nodes/COM_TransformNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_TRANSFORMNODE_H__ -#define __COM_TRANSFORMNODE_H__ +#pragma once #include "COM_Node.h" #include "DNA_node_types.h" @@ -31,5 +30,3 @@ class TransformNode : public Node { TransformNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif /* __COM_TRANSFORMNODE_H__ */ diff --git a/source/blender/compositor/nodes/COM_TranslateNode.h b/source/blender/compositor/nodes/COM_TranslateNode.h index d9ef6c639a0..d381274c0e5 100644 --- a/source/blender/compositor/nodes/COM_TranslateNode.h +++ b/source/blender/compositor/nodes/COM_TranslateNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_TRANSLATENODE_H__ -#define __COM_TRANSLATENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class TranslateNode : public Node { TranslateNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_ValueNode.h b/source/blender/compositor/nodes/COM_ValueNode.h index a973649aa46..5179e6828e4 100644 --- a/source/blender/compositor/nodes/COM_ValueNode.h +++ b/source/blender/compositor/nodes/COM_ValueNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_VALUENODE_H__ -#define __COM_VALUENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class ValueNode : public Node { ValueNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_VectorBlurNode.h b/source/blender/compositor/nodes/COM_VectorBlurNode.h index 027c241f72d..f370c82a1ee 100644 --- a/source/blender/compositor/nodes/COM_VectorBlurNode.h +++ b/source/blender/compositor/nodes/COM_VectorBlurNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_VECTORBLURNODE_H__ -#define __COM_VECTORBLURNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class VectorBlurNode : public Node { VectorBlurNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_VectorCurveNode.h b/source/blender/compositor/nodes/COM_VectorCurveNode.h index 14bea25cf8d..4d7f92897a1 100644 --- a/source/blender/compositor/nodes/COM_VectorCurveNode.h +++ b/source/blender/compositor/nodes/COM_VectorCurveNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_VECTORCURVENODE_H__ -#define __COM_VECTORCURVENODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class VectorCurveNode : public Node { VectorCurveNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_ViewLevelsNode.h b/source/blender/compositor/nodes/COM_ViewLevelsNode.h index 851b1ecbd78..0e931fed055 100644 --- a/source/blender/compositor/nodes/COM_ViewLevelsNode.h +++ b/source/blender/compositor/nodes/COM_ViewLevelsNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_VIEWLEVELSNODE_H__ -#define __COM_VIEWLEVELSNODE_H__ +#pragma once #include "COM_Node.h" @@ -30,5 +29,3 @@ class ViewLevelsNode : public Node { ViewLevelsNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/nodes/COM_ViewerNode.h b/source/blender/compositor/nodes/COM_ViewerNode.h index 6168623e69c..74758417014 100644 --- a/source/blender/compositor/nodes/COM_ViewerNode.h +++ b/source/blender/compositor/nodes/COM_ViewerNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_VIEWERNODE_H__ -#define __COM_VIEWERNODE_H__ +#pragma once #include "COM_Node.h" #include "DNA_node_types.h" @@ -30,4 +29,3 @@ class ViewerNode : public Node { ViewerNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; -#endif diff --git a/source/blender/compositor/nodes/COM_ZCombineNode.h b/source/blender/compositor/nodes/COM_ZCombineNode.h index 95e81ca8c8f..ca54fd7fffa 100644 --- a/source/blender/compositor/nodes/COM_ZCombineNode.h +++ b/source/blender/compositor/nodes/COM_ZCombineNode.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_ZCOMBINENODE_H__ -#define __COM_ZCOMBINENODE_H__ +#pragma once #include "COM_Node.h" @@ -32,5 +31,3 @@ class ZCombineNode : public Node { } void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; - -#endif diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h index a4475bc2fbc..de3d6bd1ee0 100644 --- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_ALPHAOVERKEYOPERATION_H__ -#define __COM_ALPHAOVERKEYOPERATION_H__ +#pragma once + #include "COM_MixOperation.h" /** @@ -36,4 +36,3 @@ class AlphaOverKeyOperation : public MixBaseOperation { */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; -#endif diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h index 88fa3d963f4..22d64807512 100644 --- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_ALPHAOVERMIXEDOPERATION_H__ -#define __COM_ALPHAOVERMIXEDOPERATION_H__ +#pragma once + #include "COM_MixOperation.h" /** @@ -44,4 +44,3 @@ class AlphaOverMixedOperation : public MixBaseOperation { this->m_x = x; } }; -#endif diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h index 4ef5f9d996e..bc5cd07baf8 100644 --- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_ALPHAOVERPREMULTIPLYOPERATION_H__ -#define __COM_ALPHAOVERPREMULTIPLYOPERATION_H__ +#pragma once + #include "COM_MixOperation.h" /** @@ -36,4 +36,3 @@ class AlphaOverPremultiplyOperation : public MixBaseOperation { */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; -#endif diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.h b/source/blender/compositor/operations/COM_AntiAliasOperation.h index 6141fb92c3f..8600c6dd481 100644 --- a/source/blender/compositor/operations/COM_AntiAliasOperation.h +++ b/source/blender/compositor/operations/COM_AntiAliasOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_ANTIALIASOPERATION_H__ -#define __COM_ANTIALIASOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "DNA_node_types.h" @@ -56,4 +56,3 @@ class AntiAliasOperation : public NodeOperation { ReadBufferOperation *readOperation, rcti *output); }; -#endif diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.h b/source/blender/compositor/operations/COM_BilateralBlurOperation.h index c3482005d8c..a54e830459b 100644 --- a/source/blender/compositor/operations/COM_BilateralBlurOperation.h +++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_BILATERALBLUROPERATION_H__ -#define __COM_BILATERALBLUROPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "COM_QualityStepHelper.h" @@ -55,4 +55,3 @@ class BilateralBlurOperation : public NodeOperation, public QualityStepHelper { this->m_data = data; } }; -#endif diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.h b/source/blender/compositor/operations/COM_BlurBaseOperation.h index 07893c19126..e4ac8b3c874 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.h +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_BLURBASEOPERATION_H__ -#define __COM_BLURBASEOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "COM_QualityStepHelper.h" @@ -77,4 +77,3 @@ class BlurBaseOperation : public NodeOperation, public QualityStepHelper { void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); }; -#endif diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.h b/source/blender/compositor/operations/COM_BokehBlurOperation.h index 4f594f16cb4..e6873a4b70b 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_BOKEHBLUROPERATION_H__ -#define __COM_BOKEHBLUROPERATION_H__ +#pragma once #include "COM_NodeOperation.h" #include "COM_QualityStepHelper.h" @@ -78,4 +77,3 @@ class BokehBlurOperation : public NodeOperation, public QualityStepHelper { void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); }; -#endif diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.h b/source/blender/compositor/operations/COM_BokehImageOperation.h index e907559d6e7..db1d3976d44 100644 --- a/source/blender/compositor/operations/COM_BokehImageOperation.h +++ b/source/blender/compositor/operations/COM_BokehImageOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_BOKEHIMAGEOPERATION_H__ -#define __COM_BOKEHIMAGEOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" /** @@ -149,4 +149,3 @@ class BokehImageOperation : public NodeOperation { this->m_deleteData = true; } }; -#endif diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.h b/source/blender/compositor/operations/COM_BoxMaskOperation.h index f770922ee7c..070a7f52b1b 100644 --- a/source/blender/compositor/operations/COM_BoxMaskOperation.h +++ b/source/blender/compositor/operations/COM_BoxMaskOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_BOXMASKOPERATION_H__ -#define __COM_BOXMASKOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" class BoxMaskOperation : public NodeOperation { @@ -63,4 +63,3 @@ class BoxMaskOperation : public NodeOperation { this->m_maskType = maskType; } }; -#endif diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.h b/source/blender/compositor/operations/COM_BrightnessOperation.h index df6b3ef7b6e..28bd3576201 100644 --- a/source/blender/compositor/operations/COM_BrightnessOperation.h +++ b/source/blender/compositor/operations/COM_BrightnessOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_BRIGHTNESSOPERATION_H__ -#define __COM_BRIGHTNESSOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" class BrightnessOperation : public NodeOperation { @@ -51,4 +51,3 @@ class BrightnessOperation : public NodeOperation { void setUsePremultiply(bool use_premultiply); }; -#endif diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.h b/source/blender/compositor/operations/COM_CalculateMeanOperation.h index 38d68b2a6fd..aa08555467b 100644 --- a/source/blender/compositor/operations/COM_CalculateMeanOperation.h +++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_CALCULATEMEANOPERATION_H__ -#define __COM_CALCULATEMEANOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "DNA_node_types.h" @@ -67,4 +67,3 @@ class CalculateMeanOperation : public NodeOperation { protected: void calculateMean(MemoryBuffer *tile); }; -#endif diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h index 377276777f0..2ab0e82728d 100644 --- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h +++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_CALCULATESTANDARDDEVIATIONOPERATION_H__ -#define __COM_CALCULATESTANDARDDEVIATIONOPERATION_H__ +#pragma once + #include "COM_CalculateMeanOperation.h" #include "COM_NodeOperation.h" #include "DNA_node_types.h" @@ -40,4 +40,3 @@ class CalculateStandardDeviationOperation : public CalculateMeanOperation { void *initializeTileData(rcti *rect); }; -#endif diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.h b/source/blender/compositor/operations/COM_ChangeHSVOperation.h index 3898345f922..b4fa1a3bdd4 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.h +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_CHANGEHSVOPERATION_H__ -#define __COM_CHANGEHSVOPERATION_H__ +#pragma once + #include "COM_MixOperation.h" /** @@ -45,4 +45,3 @@ class ChangeHSVOperation : public NodeOperation { */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; -#endif diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.h b/source/blender/compositor/operations/COM_ChannelMatteOperation.h index ad88b41cc91..d4c097fe66e 100644 --- a/source/blender/compositor/operations/COM_ChannelMatteOperation.h +++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.h @@ -16,8 +16,8 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_CHANNELMATTEOPERATION_H__ -#define __COM_CHANNELMATTEOPERATION_H__ +#pragma once + #include "COM_MixOperation.h" /** @@ -70,4 +70,3 @@ class ChannelMatteOperation : public NodeOperation { this->m_matte_channel = custom2; } }; -#endif diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.h b/source/blender/compositor/operations/COM_ChromaMatteOperation.h index 58da839823d..5c4ada8de38 100644 --- a/source/blender/compositor/operations/COM_ChromaMatteOperation.h +++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_CHROMAMATTEOPERATION_H__ -#define __COM_CHROMAMATTEOPERATION_H__ +#pragma once + #include "COM_MixOperation.h" /** @@ -49,4 +49,3 @@ class ChromaMatteOperation : public NodeOperation { this->m_settings = nodeChroma; } }; -#endif diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h index fd1d51a293b..77ead2f1d26 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h +++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COLORBALANCEASCCDLOPERATION_H__ -#define __COM_COLORBALANCEASCCDLOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" /** @@ -70,4 +70,3 @@ class ColorBalanceASCCDLOperation : public NodeOperation { copy_v3_v3(this->m_slope, slope); } }; -#endif diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h index a2d4b4cd13a..c34591172b9 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h +++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COLORBALANCELGGOPERATION_H__ -#define __COM_COLORBALANCELGGOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" /** @@ -70,4 +70,3 @@ class ColorBalanceLGGOperation : public NodeOperation { copy_v3_v3(this->m_gamma_inv, gamma_inv); } }; -#endif diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.h b/source/blender/compositor/operations/COM_ColorCorrectionOperation.h index ec9632acc7c..66213eb88a4 100644 --- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.h +++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COLORCORRECTIONOPERATION_H__ -#define __COM_COLORCORRECTIONOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" class ColorCorrectionOperation : public NodeOperation { @@ -68,4 +68,3 @@ class ColorCorrectionOperation : public NodeOperation { this->m_blueChannelEnabled = enabled; } }; -#endif diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.h b/source/blender/compositor/operations/COM_ColorCurveOperation.h index 7869d1c4a56..65a822508b8 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.h +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COLORCURVEOPERATION_H__ -#define __COM_COLORCURVEOPERATION_H__ +#pragma once + #include "COM_CurveBaseOperation.h" #include "COM_NodeOperation.h" #include "DNA_color_types.h" @@ -88,5 +88,3 @@ class ConstantLevelColorCurveOperation : public CurveBaseOperation { copy_v3_v3(this->m_white, white); } }; - -#endif diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.h b/source/blender/compositor/operations/COM_ColorMatteOperation.h index 7e8a0e295e1..bb00c344606 100644 --- a/source/blender/compositor/operations/COM_ColorMatteOperation.h +++ b/source/blender/compositor/operations/COM_ColorMatteOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COLORMATTEOPERATION_H__ -#define __COM_COLORMATTEOPERATION_H__ +#pragma once + #include "COM_MixOperation.h" /** @@ -49,4 +49,3 @@ class ColorMatteOperation : public NodeOperation { this->m_settings = nodeChroma; } }; -#endif diff --git a/source/blender/compositor/operations/COM_ColorRampOperation.h b/source/blender/compositor/operations/COM_ColorRampOperation.h index 3e2acda1d10..b4253a3f074 100644 --- a/source/blender/compositor/operations/COM_ColorRampOperation.h +++ b/source/blender/compositor/operations/COM_ColorRampOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COLORRAMPOPERATION_H__ -#define __COM_COLORRAMPOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "DNA_texture_types.h" @@ -52,4 +52,3 @@ class ColorRampOperation : public NodeOperation { this->m_colorBand = colorBand; } }; -#endif diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.h b/source/blender/compositor/operations/COM_ColorSpillOperation.h index 73f4f5b045d..560d198693f 100644 --- a/source/blender/compositor/operations/COM_ColorSpillOperation.h +++ b/source/blender/compositor/operations/COM_ColorSpillOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COLORSPILLOPERATION_H__ -#define __COM_COLORSPILLOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" /** @@ -64,5 +64,3 @@ class ColorSpillOperation : public NodeOperation { float calculateMapValue(float fac, float *input); }; - -#endif diff --git a/source/blender/compositor/operations/COM_CompositorOperation.h b/source/blender/compositor/operations/COM_CompositorOperation.h index 8db8fe00d3c..3633bfd511c 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.h +++ b/source/blender/compositor/operations/COM_CompositorOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_COMPOSITOROPERATION_H__ -#define __COM_COMPOSITOROPERATION_H__ +#pragma once + #include "BLI_rect.h" #include "BLI_string.h" #include "COM_NodeOperation.h" @@ -123,4 +123,3 @@ class CompositorOperation : public NodeOperation { this->m_active = active; } }; -#endif diff --git a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h index 7cc39a47dd0..8fce5ef3e1a 100644 --- a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h +++ b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_CONVERTCOLORPROFILEOPERATION_H__ -#define __COM_CONVERTCOLORPROFILEOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" /** @@ -80,4 +80,3 @@ class ConvertColorProfileOperation : public NodeOperation { this->m_predivided = predivided; } }; -#endif diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h index 7c3e0ed9738..3babcfe4dc3 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_CONVERTDEPTHTORADIUSOPERATION_H__ -#define __COM_CONVERTDEPTHTORADIUSOPERATION_H__ +#pragma once + #include "COM_FastGaussianBlurOperation.h" #include "COM_NodeOperation.h" #include "DNA_object_types.h" @@ -81,4 +81,3 @@ class ConvertDepthToRadiusOperation : public NodeOperation { this->m_blurPostOperation = operation; } }; -#endif diff --git a/source/blender/compositor/operations/COM_ConvertOperation.h b/source/blender/compositor/operations/COM_ConvertOperation.h index a4cf05372a5..ca026528a38 100644 --- a/source/blender/compositor/operations/COM_ConvertOperation.h +++ b/source/blender/compositor/operations/COM_ConvertOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_CONVERTOPERATION_H__ -#define __COM_CONVERTOPERATION_H__ +#pragma once #include "COM_NodeOperation.h" @@ -183,5 +182,3 @@ class CombineChannelsOperation : public NodeOperation { void initExecution(); void deinitExecution(); }; - -#endif diff --git a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h index 17509b018bf..ab4b8a1dad1 100644 --- a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h +++ b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_CONVOLUTIONEDGEFILTEROPERATION_H__ -#define __COM_CONVOLUTIONEDGEFILTEROPERATION_H__ +#pragma once #include "COM_ConvolutionFilterOperation.h" @@ -26,5 +25,3 @@ class ConvolutionEdgeFilterOperation : public ConvolutionFilterOperation { ConvolutionEdgeFilterOperation(); void executePixel(float output[4], int x, int y, void *data); }; - -#endif diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h index 78db5a5ae9d..d178b0a7418 100644 --- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h +++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_CONVOLUTIONFILTEROPERATION_H__ -#define __COM_CONVOLUTIONFILTEROPERATION_H__ +#pragma once #include "COM_NodeOperation.h" @@ -43,5 +42,3 @@ class ConvolutionFilterOperation : public NodeOperation { void initExecution(); void deinitExecution(); }; - -#endif diff --git a/source/blender/compositor/operations/COM_CropOperation.h b/source/blender/compositor/operations/COM_CropOperation.h index 36c18d29e92..f20664f0501 100644 --- a/source/blender/compositor/operations/COM_CropOperation.h +++ b/source/blender/compositor/operations/COM_CropOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_CROPOPERATION_H__ -#define __COM_CROPOPERATION_H__ +#pragma once #include "COM_NodeOperation.h" @@ -64,4 +63,3 @@ class CropImageOperation : public CropBaseOperation { void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; -#endif diff --git a/source/blender/compositor/operations/COM_CryptomatteOperation.h b/source/blender/compositor/operations/COM_CryptomatteOperation.h index 459d8b65f12..8c5a3134720 100644 --- a/source/blender/compositor/operations/COM_CryptomatteOperation.h +++ b/source/blender/compositor/operations/COM_CryptomatteOperation.h @@ -16,8 +16,8 @@ * Copyright 2018, Blender Foundation. */ -#ifndef __COM_CRYPTOMATTEOPERATION_H__ -#define __COM_CRYPTOMATTEOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" class CryptomatteOperation : public NodeOperation { @@ -34,4 +34,3 @@ class CryptomatteOperation : public NodeOperation { void addObjectIndex(float objectIndex); }; -#endif diff --git a/source/blender/compositor/operations/COM_CurveBaseOperation.h b/source/blender/compositor/operations/COM_CurveBaseOperation.h index f42ce3c366f..63e667cfe12 100644 --- a/source/blender/compositor/operations/COM_CurveBaseOperation.h +++ b/source/blender/compositor/operations/COM_CurveBaseOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_CURVEBASEOPERATION_H__ -#define __COM_CURVEBASEOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "DNA_color_types.h" @@ -40,4 +40,3 @@ class CurveBaseOperation : public NodeOperation { void setCurveMapping(CurveMapping *mapping); }; -#endif diff --git a/source/blender/compositor/operations/COM_DenoiseOperation.h b/source/blender/compositor/operations/COM_DenoiseOperation.h index 6a53eead65c..5af6e16c958 100644 --- a/source/blender/compositor/operations/COM_DenoiseOperation.h +++ b/source/blender/compositor/operations/COM_DenoiseOperation.h @@ -16,8 +16,7 @@ * Copyright 2019, Blender Foundation. */ -#ifndef __COM_DENOISEOPERATION_H__ -#define __COM_DENOISEOPERATION_H__ +#pragma once #include "COM_SingleThreadedOperation.h" #include "DNA_node_types.h" @@ -65,5 +64,3 @@ class DenoiseOperation : public SingleThreadedOperation { MemoryBuffer *createMemoryBuffer(rcti *rect); }; - -#endif /* __COM_DENOISEOPERATION_H__ */ diff --git a/source/blender/compositor/operations/COM_DespeckleOperation.h b/source/blender/compositor/operations/COM_DespeckleOperation.h index 280948b7fbe..af37c276bd2 100644 --- a/source/blender/compositor/operations/COM_DespeckleOperation.h +++ b/source/blender/compositor/operations/COM_DespeckleOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DESPECKLEOPERATION_H__ -#define __COM_DESPECKLEOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" class DespeckleOperation : public NodeOperation { @@ -51,5 +51,3 @@ class DespeckleOperation : public NodeOperation { void initExecution(); void deinitExecution(); }; - -#endif diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.h b/source/blender/compositor/operations/COM_DifferenceMatteOperation.h index e96e212e511..beaa4400712 100644 --- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.h +++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DIFFERENCEMATTEOPERATION_H__ -#define __COM_DIFFERENCEMATTEOPERATION_H__ +#pragma once + #include "COM_MixOperation.h" /** @@ -49,4 +49,3 @@ class DifferenceMatteOperation : public NodeOperation { this->m_settings = nodeChroma; } }; -#endif diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.h b/source/blender/compositor/operations/COM_DilateErodeOperation.h index bd7e0938c58..95a799ab648 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.h +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DILATEERODEOPERATION_H__ -#define __COM_DILATEERODEOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" class DilateErodeThresholdOperation : public NodeOperation { @@ -180,5 +180,3 @@ class ErodeStepOperation : public DilateStepOperation { void *initializeTileData(rcti *rect); }; - -#endif diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.h b/source/blender/compositor/operations/COM_DirectionalBlurOperation.h index f8b7bab010b..57fc0bb7fa3 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.h +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DIRECTIONALBLUROPERATION_H__ -#define __COM_DIRECTIONALBLUROPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "COM_QualityStepHelper.h" @@ -64,4 +64,3 @@ class DirectionalBlurOperation : public NodeOperation, public QualityStepHelper list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp); }; -#endif diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.h b/source/blender/compositor/operations/COM_DisplaceOperation.h index 4e44572fcf2..ee06bf320a6 100644 --- a/source/blender/compositor/operations/COM_DisplaceOperation.h +++ b/source/blender/compositor/operations/COM_DisplaceOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DISPLACEOPERATION_H__ -#define __COM_DISPLACEOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" class DisplaceOperation : public NodeOperation { @@ -64,4 +64,3 @@ class DisplaceOperation : public NodeOperation { bool read_displacement( float x, float y, float xscale, float yscale, const float origin[2], float &r_u, float &r_v); }; -#endif diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h index 6d4d6047137..6930985b0e5 100644 --- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h +++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h @@ -16,8 +16,8 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_DISPLACESIMPLEOPERATION_H__ -#define __COM_DISPLACESIMPLEOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" class DisplaceSimpleOperation : public NodeOperation { @@ -58,4 +58,3 @@ class DisplaceSimpleOperation : public NodeOperation { */ void deinitExecution(); }; -#endif diff --git a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h index c64c6da8d24..d99ab262c18 100644 --- a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h +++ b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DISTANCERGBMATTEOPERATION_H__ -#define __COM_DISTANCERGBMATTEOPERATION_H__ +#pragma once + #include "COM_MixOperation.h" /** @@ -51,4 +51,3 @@ class DistanceRGBMatteOperation : public NodeOperation { this->m_settings = nodeChroma; } }; -#endif diff --git a/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h index 1cb477bc05d..e9b2cda6251 100644 --- a/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h +++ b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DISTANCEYCCMATTEOPERATION_H__ -#define __COM_DISTANCEYCCMATTEOPERATION_H__ +#pragma once + #include "COM_DistanceRGBMatteOperation.h" #include "COM_MixOperation.h" @@ -35,4 +35,3 @@ class DistanceYCCMatteOperation : public DistanceRGBMatteOperation { */ DistanceYCCMatteOperation(); }; -#endif diff --git a/source/blender/compositor/operations/COM_DotproductOperation.h b/source/blender/compositor/operations/COM_DotproductOperation.h index 9ef9753f4c9..63b735ce30f 100644 --- a/source/blender/compositor/operations/COM_DotproductOperation.h +++ b/source/blender/compositor/operations/COM_DotproductOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DOTPRODUCTOPERATION_H__ -#define __COM_DOTPRODUCTOPERATION_H__ +#pragma once #include "COM_NodeOperation.h" @@ -33,5 +32,3 @@ class DotproductOperation : public NodeOperation { void initExecution(); void deinitExecution(); }; - -#endif diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h index 40cfa370cb7..0c77e83daec 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_DOUBLEEDGEMASKOPERATION_H__ -#define __COM_DOUBLEEDGEMASKOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" class DoubleEdgeMaskOperation : public NodeOperation { @@ -65,4 +65,3 @@ class DoubleEdgeMaskOperation : public NodeOperation { this->m_keepInside = keepInside; } }; -#endif diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.h b/source/blender/compositor/operations/COM_EllipseMaskOperation.h index b73a35a5452..2e6b1f782a1 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.h +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_ELLIPSEMASKOPERATION_H__ -#define __COM_ELLIPSEMASKOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" class EllipseMaskOperation : public NodeOperation { @@ -63,4 +63,3 @@ class EllipseMaskOperation : public NodeOperation { this->m_maskType = maskType; } }; -#endif diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h index 22f9a6f9cf2..6ab6474c20a 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_FASTGAUSSIANBLUROPERATION_H__ -#define __COM_FASTGAUSSIANBLUROPERATION_H__ +#pragma once #include "COM_BlurBaseOperation.h" #include "DNA_node_types.h" @@ -80,5 +79,3 @@ class FastGaussianBlurValueOperation : public NodeOperation { this->m_overlay = overlay; } }; - -#endif diff --git a/source/blender/compositor/operations/COM_FlipOperation.h b/source/blender/compositor/operations/COM_FlipOperation.h index 2d00c50dc8a..711b51261e6 100644 --- a/source/blender/compositor/operations/COM_FlipOperation.h +++ b/source/blender/compositor/operations/COM_FlipOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_FLIPOPERATION_H__ -#define __COM_FLIPOPERATION_H__ +#pragma once #include "COM_NodeOperation.h" @@ -45,5 +44,3 @@ class FlipOperation : public NodeOperation { this->m_flipY = flipY; } }; - -#endif diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.h b/source/blender/compositor/operations/COM_GammaCorrectOperation.h index 26e31df880f..be57e279ac8 100644 --- a/source/blender/compositor/operations/COM_GammaCorrectOperation.h +++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_GAMMACORRECTOPERATION_H__ -#define __COM_GAMMACORRECTOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" class GammaCorrectOperation : public NodeOperation { @@ -71,5 +71,3 @@ class GammaUncorrectOperation : public NodeOperation { */ void deinitExecution(); }; - -#endif diff --git a/source/blender/compositor/operations/COM_GammaOperation.h b/source/blender/compositor/operations/COM_GammaOperation.h index ba0b84db931..493fdb1f889 100644 --- a/source/blender/compositor/operations/COM_GammaOperation.h +++ b/source/blender/compositor/operations/COM_GammaOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_GAMMAOPERATION_H__ -#define __COM_GAMMAOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" class GammaOperation : public NodeOperation { @@ -46,4 +46,3 @@ class GammaOperation : public NodeOperation { */ void deinitExecution(); }; -#endif diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h index 9de75ff53a7..a8e1ddfb885 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_GAUSSIANALPHAXBLUROPERATION_H__ -#define __COM_GAUSSIANALPHAXBLUROPERATION_H__ +#pragma once + #include "COM_BlurBaseOperation.h" #include "COM_NodeOperation.h" @@ -65,4 +65,3 @@ class GaussianAlphaXBlurOperation : public BlurBaseOperation { this->m_falloff = falloff; } }; -#endif diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h index 44689922bfc..df34f15fccc 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_GAUSSIANALPHAYBLUROPERATION_H__ -#define __COM_GAUSSIANALPHAYBLUROPERATION_H__ +#pragma once + #include "COM_BlurBaseOperation.h" #include "COM_NodeOperation.h" @@ -65,4 +65,3 @@ class GaussianAlphaYBlurOperation : public BlurBaseOperation { this->m_falloff = falloff; } }; -#endif diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h index 3aa380853bd..b4b5c0e8b2f 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_GAUSSIANBOKEHBLUROPERATION_H__ -#define __COM_GAUSSIANBOKEHBLUROPERATION_H__ +#pragma once + #include "COM_BlurBaseOperation.h" #include "COM_NodeOperation.h" #include "COM_QualityStepHelper.h" @@ -75,5 +75,3 @@ class GaussianBlurReferenceOperation : public BlurBaseOperation { ReadBufferOperation *readOperation, rcti *output); }; - -#endif diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h index c5c08df8ce7..1bd6ef20a48 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_GAUSSIANXBLUROPERATION_H__ -#define __COM_GAUSSIANXBLUROPERATION_H__ +#pragma once + #include "COM_BlurBaseOperation.h" #include "COM_NodeOperation.h" @@ -65,4 +65,3 @@ class GaussianXBlurOperation : public BlurBaseOperation { this->setOpenCL(m_data.sizex >= 128); } }; -#endif diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h index 92154aa7518..a9af28791f8 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_GAUSSIANYBLUROPERATION_H__ -#define __COM_GAUSSIANYBLUROPERATION_H__ +#pragma once + #include "COM_BlurBaseOperation.h" #include "COM_NodeOperation.h" @@ -65,4 +65,3 @@ class GaussianYBlurOperation : public BlurBaseOperation { this->setOpenCL(m_data.sizex >= 128); } }; -#endif diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.h b/source/blender/compositor/operations/COM_GlareBaseOperation.h index ba2b9a8f4b8..aabb76f5cf0 100644 --- a/source/blender/compositor/operations/COM_GlareBaseOperation.h +++ b/source/blender/compositor/operations/COM_GlareBaseOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_GLAREBASEOPERATION_H__ -#define __COM_GLAREBASEOPERATION_H__ +#pragma once #include "COM_SingleThreadedOperation.h" #include "DNA_node_types.h" @@ -74,4 +73,3 @@ class GlareBaseOperation : public SingleThreadedOperation { MemoryBuffer *createMemoryBuffer(rcti *rect); }; -#endif diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.h b/source/blender/compositor/operations/COM_GlareFogGlowOperation.h index dae0b714e56..9084f27052e 100644 --- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.h +++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_GLAREFOGGLOWOPERATION_H__ -#define __COM_GLAREFOGGLOWOPERATION_H__ +#pragma once + #include "COM_GlareBaseOperation.h" #include "COM_NodeOperation.h" #include "DNA_node_types.h" @@ -31,4 +31,3 @@ class GlareFogGlowOperation : public GlareBaseOperation { protected: void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings); }; -#endif diff --git a/source/blender/compositor/operations/COM_GlareGhostOperation.h b/source/blender/compositor/operations/COM_GlareGhostOperation.h index c0b41762c8a..8ecf8da3385 100644 --- a/source/blender/compositor/operations/COM_GlareGhostOperation.h +++ b/source/blender/compositor/operations/COM_GlareGhostOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_GLAREGHOSTOPERATION_H__ -#define __COM_GLAREGHOSTOPERATION_H__ +#pragma once + #include "COM_GlareBaseOperation.h" #include "COM_NodeOperation.h" #include "DNA_node_types.h" @@ -31,4 +31,3 @@ class GlareGhostOperation : public GlareBaseOperation { protected: void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings); }; -#endif diff --git a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h index b6e2e499f64..0f5913fcef9 100644 --- a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h +++ b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_GLARESIMPLESTAROPERATION_H__ -#define __COM_GLARESIMPLESTAROPERATION_H__ +#pragma once + #include "COM_GlareBaseOperation.h" #include "COM_NodeOperation.h" #include "DNA_node_types.h" @@ -31,4 +31,3 @@ class GlareSimpleStarOperation : public GlareBaseOperation { protected: void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings); }; -#endif diff --git a/source/blender/compositor/operations/COM_GlareStreaksOperation.h b/source/blender/compositor/operations/COM_GlareStreaksOperation.h index 9f137f90b71..df31981170d 100644 --- a/source/blender/compositor/operations/COM_GlareStreaksOperation.h +++ b/source/blender/compositor/operations/COM_GlareStreaksOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_GLARESTREAKSOPERATION_H__ -#define __COM_GLARESTREAKSOPERATION_H__ +#pragma once + #include "COM_GlareBaseOperation.h" #include "COM_NodeOperation.h" #include "DNA_node_types.h" @@ -31,4 +31,3 @@ class GlareStreaksOperation : public GlareBaseOperation { protected: void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings); }; -#endif diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.h b/source/blender/compositor/operations/COM_GlareThresholdOperation.h index 385111cdf0b..e4ac36f2053 100644 --- a/source/blender/compositor/operations/COM_GlareThresholdOperation.h +++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_GLARETHRESHOLDOPERATION_H__ -#define __COM_GLARETHRESHOLDOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "DNA_light_types.h" @@ -58,4 +58,3 @@ class GlareThresholdOperation : public NodeOperation { void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); }; -#endif diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h index 0624a5c022f..f29a932d7f8 100644 --- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h +++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_HUESATURATIONVALUECORRECTOPERATION_H__ -#define __COM_HUESATURATIONVALUECORRECTOPERATION_H__ +#pragma once + #include "COM_CurveBaseOperation.h" #include "COM_NodeOperation.h" @@ -46,4 +46,3 @@ class HueSaturationValueCorrectOperation : public CurveBaseOperation { */ void deinitExecution(); }; -#endif diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.h b/source/blender/compositor/operations/COM_IDMaskOperation.h index b3a40106b9d..abd2a719371 100644 --- a/source/blender/compositor/operations/COM_IDMaskOperation.h +++ b/source/blender/compositor/operations/COM_IDMaskOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_IDMASKOPERATION_H__ -#define __COM_IDMASKOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" class IDMaskOperation : public NodeOperation { @@ -35,4 +35,3 @@ class IDMaskOperation : public NodeOperation { this->m_objectIndex = objectIndex; } }; -#endif diff --git a/source/blender/compositor/operations/COM_ImageOperation.h b/source/blender/compositor/operations/COM_ImageOperation.h index 3e081ee0000..fcffdc7aae9 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.h +++ b/source/blender/compositor/operations/COM_ImageOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_IMAGEOPERATION_H__ -#define __COM_IMAGEOPERATION_H__ +#pragma once #include "BKE_image.h" #include "BLI_listbase.h" @@ -103,4 +102,3 @@ class ImageDepthOperation : public BaseImageOperation { ImageDepthOperation(); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; -#endif diff --git a/source/blender/compositor/operations/COM_InpaintOperation.h b/source/blender/compositor/operations/COM_InpaintOperation.h index 2fef7c590ea..12523d5f064 100644 --- a/source/blender/compositor/operations/COM_InpaintOperation.h +++ b/source/blender/compositor/operations/COM_InpaintOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_INPAINTOPERATION_H__ -#define __COM_INPAINTOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" class InpaintSimpleOperation : public NodeOperation { @@ -72,5 +72,3 @@ class InpaintSimpleOperation : public NodeOperation { bool next_pixel(int &x, int &y, int &curr, int iters); void pix_step(int x, int y); }; - -#endif diff --git a/source/blender/compositor/operations/COM_InvertOperation.h b/source/blender/compositor/operations/COM_InvertOperation.h index 39161455a76..5399122ab62 100644 --- a/source/blender/compositor/operations/COM_InvertOperation.h +++ b/source/blender/compositor/operations/COM_InvertOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_INVERTOPERATION_H__ -#define __COM_INVERTOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" class InvertOperation : public NodeOperation { @@ -58,4 +58,3 @@ class InvertOperation : public NodeOperation { this->m_alpha = alpha; } }; -#endif diff --git a/source/blender/compositor/operations/COM_KeyingBlurOperation.h b/source/blender/compositor/operations/COM_KeyingBlurOperation.h index 0e45f1c32b8..6a2b43a6cd4 100644 --- a/source/blender/compositor/operations/COM_KeyingBlurOperation.h +++ b/source/blender/compositor/operations/COM_KeyingBlurOperation.h @@ -16,8 +16,7 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_KEYINGBLUROPERATION_H__ -#define __COM_KEYINGBLUROPERATION_H__ +#pragma once #include "COM_NodeOperation.h" @@ -54,5 +53,3 @@ class KeyingBlurOperation : public NodeOperation { ReadBufferOperation *readOperation, rcti *output); }; - -#endif diff --git a/source/blender/compositor/operations/COM_KeyingClipOperation.h b/source/blender/compositor/operations/COM_KeyingClipOperation.h index 8237c443cf2..9d876966e96 100644 --- a/source/blender/compositor/operations/COM_KeyingClipOperation.h +++ b/source/blender/compositor/operations/COM_KeyingClipOperation.h @@ -16,8 +16,7 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_KEYINGCLIPOPERATION_H__ -#define __COM_KEYINGCLIPOPERATION_H__ +#pragma once #include "COM_NodeOperation.h" @@ -68,5 +67,3 @@ class KeyingClipOperation : public NodeOperation { ReadBufferOperation *readOperation, rcti *output); }; - -#endif diff --git a/source/blender/compositor/operations/COM_KeyingDespillOperation.h b/source/blender/compositor/operations/COM_KeyingDespillOperation.h index eb43a478e50..32df7939c43 100644 --- a/source/blender/compositor/operations/COM_KeyingDespillOperation.h +++ b/source/blender/compositor/operations/COM_KeyingDespillOperation.h @@ -16,8 +16,7 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_KEYINGDESPILLOPERATION_H__ -#define __COM_KEYINGDESPILLOPERATION_H__ +#pragma once #include "COM_NodeOperation.h" @@ -48,5 +47,3 @@ class KeyingDespillOperation : public NodeOperation { void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; - -#endif diff --git a/source/blender/compositor/operations/COM_KeyingOperation.h b/source/blender/compositor/operations/COM_KeyingOperation.h index 81d23e76b2a..946d7bdc1f7 100644 --- a/source/blender/compositor/operations/COM_KeyingOperation.h +++ b/source/blender/compositor/operations/COM_KeyingOperation.h @@ -16,8 +16,7 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_KEYINGOPERATION_H__ -#define __COM_KEYINGOPERATION_H__ +#pragma once #include <string.h> @@ -48,5 +47,3 @@ class KeyingOperation : public NodeOperation { void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; - -#endif diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.h b/source/blender/compositor/operations/COM_KeyingScreenOperation.h index 593e902117b..595301bb951 100644 --- a/source/blender/compositor/operations/COM_KeyingScreenOperation.h +++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.h @@ -16,8 +16,7 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_KEYINGSCREENOPERATION_H__ -#define __COM_KEYINGSCREENOPERATION_H__ +#pragma once #include <string.h> @@ -83,5 +82,3 @@ class KeyingScreenOperation : public NodeOperation { void executePixel(float output[4], int x, int y, void *data); }; - -#endif diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.h b/source/blender/compositor/operations/COM_LuminanceMatteOperation.h index 2df7847f7ff..2b77b3cde85 100644 --- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.h +++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_LUMINANCEMATTEOPERATION_H__ -#define __COM_LUMINANCEMATTEOPERATION_H__ +#pragma once + #include "COM_MixOperation.h" /** @@ -48,4 +48,3 @@ class LuminanceMatteOperation : public NodeOperation { this->m_settings = nodeChroma; } }; -#endif diff --git a/source/blender/compositor/operations/COM_MapRangeOperation.h b/source/blender/compositor/operations/COM_MapRangeOperation.h index 55b5cc7453c..8656b5539a0 100644 --- a/source/blender/compositor/operations/COM_MapRangeOperation.h +++ b/source/blender/compositor/operations/COM_MapRangeOperation.h @@ -16,8 +16,8 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_MAPRANGEOPERATION_H__ -#define __COM_MAPRANGEOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "DNA_texture_types.h" @@ -67,4 +67,3 @@ class MapRangeOperation : public NodeOperation { this->m_useClamp = value; } }; -#endif diff --git a/source/blender/compositor/operations/COM_MapUVOperation.h b/source/blender/compositor/operations/COM_MapUVOperation.h index 64e17b180b4..639b61847c4 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.h +++ b/source/blender/compositor/operations/COM_MapUVOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_MAPUVOPERATION_H__ -#define __COM_MAPUVOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" class MapUVOperation : public NodeOperation { @@ -65,5 +65,3 @@ class MapUVOperation : public NodeOperation { private: bool read_uv(float x, float y, float &r_u, float &r_v, float &r_alpha); }; - -#endif diff --git a/source/blender/compositor/operations/COM_MapValueOperation.h b/source/blender/compositor/operations/COM_MapValueOperation.h index 81071d78cd7..cdbc98bd2a5 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.h +++ b/source/blender/compositor/operations/COM_MapValueOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_MAPVALUEOPERATION_H__ -#define __COM_MAPVALUEOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "DNA_texture_types.h" @@ -62,4 +62,3 @@ class MapValueOperation : public NodeOperation { this->m_settings = settings; } }; -#endif diff --git a/source/blender/compositor/operations/COM_MaskOperation.h b/source/blender/compositor/operations/COM_MaskOperation.h index 45363ea5220..eba14d10373 100644 --- a/source/blender/compositor/operations/COM_MaskOperation.h +++ b/source/blender/compositor/operations/COM_MaskOperation.h @@ -16,8 +16,7 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_MASKOPERATION_H__ -#define __COM_MASKOPERATION_H__ +#pragma once #include "BLI_listbase.h" #include "COM_NodeOperation.h" @@ -94,5 +93,3 @@ class MaskOperation : public NodeOperation { void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; - -#endif diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.h b/source/blender/compositor/operations/COM_MathBaseOperation.h index 199b59d8649..f844f668f08 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.h +++ b/source/blender/compositor/operations/COM_MathBaseOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_MATHBASEOPERATION_H__ -#define __COM_MATHBASEOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" /** @@ -372,4 +372,3 @@ class MathSmoothMaxOperation : public MathBaseOperation { } void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; -#endif diff --git a/source/blender/compositor/operations/COM_MixOperation.h b/source/blender/compositor/operations/COM_MixOperation.h index cea0e59b541..e597e8af63a 100644 --- a/source/blender/compositor/operations/COM_MixOperation.h +++ b/source/blender/compositor/operations/COM_MixOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_MIXOPERATION_H__ -#define __COM_MIXOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" /** @@ -193,5 +193,3 @@ class MixValueOperation : public MixBaseOperation { MixValueOperation(); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; - -#endif diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h index 8a95293b470..449e5d01a37 100644 --- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h +++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_MOVIECLIPATTRIBUTEOPERATION_H__ -#define __COM_MOVIECLIPATTRIBUTEOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "DNA_movieclip_types.h" @@ -70,4 +70,3 @@ class MovieClipAttributeOperation : public NodeOperation { this->m_invert = invert; } }; -#endif diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.h b/source/blender/compositor/operations/COM_MovieClipOperation.h index 7ae85eac25e..8897f85f77c 100644 --- a/source/blender/compositor/operations/COM_MovieClipOperation.h +++ b/source/blender/compositor/operations/COM_MovieClipOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_MOVIECLIPOPERATION_H__ -#define __COM_MOVIECLIPOPERATION_H__ +#pragma once #include "BLI_listbase.h" #include "COM_NodeOperation.h" @@ -77,5 +76,3 @@ class MovieClipAlphaOperation : public MovieClipBaseOperation { MovieClipAlphaOperation(); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; - -#endif diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.h b/source/blender/compositor/operations/COM_MovieDistortionOperation.h index 799c6385a10..f11ce485f97 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.h +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_MOVIEDISTORTIONOPERATION_H__ -#define __COM_MOVIEDISTORTIONOPERATION_H__ +#pragma once #include "COM_NodeOperation.h" #include "DNA_movieclip_types.h" @@ -58,5 +57,3 @@ class MovieDistortionOperation : public NodeOperation { ReadBufferOperation *readOperation, rcti *output); }; - -#endif diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.h b/source/blender/compositor/operations/COM_MultilayerImageOperation.h index 10c475ced4d..adfcc975ade 100644 --- a/source/blender/compositor/operations/COM_MultilayerImageOperation.h +++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_MULTILAYERIMAGEOPERATION_H__ -#define __COM_MULTILAYERIMAGEOPERATION_H__ +#pragma once #include "COM_ImageOperation.h" @@ -67,5 +66,3 @@ class MultilayerVectorOperation : public MultilayerBaseOperation { } void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; - -#endif diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.h b/source/blender/compositor/operations/COM_NormalizeOperation.h index a38e79bb0ab..58c03e633e2 100644 --- a/source/blender/compositor/operations/COM_NormalizeOperation.h +++ b/source/blender/compositor/operations/COM_NormalizeOperation.h @@ -16,8 +16,8 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_NORMALIZEOPERATION_H__ -#define __COM_NORMALIZEOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "DNA_node_types.h" @@ -63,5 +63,3 @@ class NormalizeOperation : public NodeOperation { ReadBufferOperation *readOperation, rcti *output); }; - -#endif diff --git a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h index 609448c0bcb..1deaf121173 100644 --- a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h +++ b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h @@ -16,8 +16,8 @@ * Copyright 2015, Blender Foundation. */ -#ifndef __COM_OUTPUTFILEMULTIVIEWOPERATION_H__ -#define __COM_OUTPUTFILEMULTIVIEWOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "COM_OutputFileOperation.h" @@ -77,5 +77,3 @@ class OutputStereoOperation : public OutputSingleLayerOperation { void *get_handle(const char *filename); void deinitExecution(); }; - -#endif diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.h b/source/blender/compositor/operations/COM_OutputFileOperation.h index d00d1d0dc0d..b2454e17e3f 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.h +++ b/source/blender/compositor/operations/COM_OutputFileOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_OUTPUTFILEOPERATION_H__ -#define __COM_OUTPUTFILEOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "BLI_path_util.h" @@ -140,5 +140,3 @@ void free_exr_channels(void *exrhandle, const char *layerName, const DataType datatype); int get_datatype_size(DataType datatype); - -#endif diff --git a/source/blender/compositor/operations/COM_PixelateOperation.h b/source/blender/compositor/operations/COM_PixelateOperation.h index 86aab26ee00..c7595756d39 100644 --- a/source/blender/compositor/operations/COM_PixelateOperation.h +++ b/source/blender/compositor/operations/COM_PixelateOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_PIXELATEOPERATION_H__ -#define __COM_PIXELATEOPERATION_H__ +#pragma once #include "COM_NodeOperation.h" @@ -61,5 +60,3 @@ class PixelateOperation : public NodeOperation { */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; - -#endif diff --git a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h index 444616e13f2..1e892465db8 100644 --- a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h +++ b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h @@ -15,8 +15,7 @@ * Copyright 2014, Blender Foundation. */ -#ifndef __COM_PLANECORNERPINOPERATION_H__ -#define __COM_PLANECORNERPINOPERATION_H__ +#pragma once #include <string.h> @@ -59,5 +58,3 @@ class PlaneCornerPinWarpImageOperation : public PlaneDistortWarpImageOperation { ReadBufferOperation *readOperation, rcti *output); }; - -#endif diff --git a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.h b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.h index 35e7745cb5d..6cc9456c13f 100644 --- a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.h +++ b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.h @@ -16,8 +16,7 @@ * Copyright 2013, Blender Foundation. */ -#ifndef __COM_PLANEDISTORTCOMMONOPERATION_H__ -#define __COM_PLANEDISTORTCOMMONOPERATION_H__ +#pragma once #include <string.h> @@ -97,5 +96,3 @@ class PlaneDistortMaskOperation : public NodeOperation { this->m_motion_blur_shutter = shutter; } }; - -#endif diff --git a/source/blender/compositor/operations/COM_PlaneTrackOperation.h b/source/blender/compositor/operations/COM_PlaneTrackOperation.h index 875c8ce8fa0..fc0a0873d5f 100644 --- a/source/blender/compositor/operations/COM_PlaneTrackOperation.h +++ b/source/blender/compositor/operations/COM_PlaneTrackOperation.h @@ -16,8 +16,7 @@ * Copyright 2013, Blender Foundation. */ -#ifndef __COM_PLANETRACKOPERATION_H__ -#define __COM_PLANETRACKOPERATION_H__ +#pragma once #include <string.h> @@ -96,5 +95,3 @@ class PlaneTrackWarpImageOperation : public PlaneDistortWarpImageOperation, NodeOperation::determineResolution(temp, resolution); } }; - -#endif diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cpp b/source/blender/compositor/operations/COM_PreviewOperation.cpp index 30fe2ca824d..43d20271141 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.cpp +++ b/source/blender/compositor/operations/COM_PreviewOperation.cpp @@ -126,14 +126,27 @@ void PreviewOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) { NodeOperation::determineResolution(resolution, preferredResolution); - int width = resolution[0]; - int height = resolution[1]; + + /* If resolution is 0 there are two possible scenarios: + * - Either node is not connected at all + * - It is connected to input which doesn't have own resolution (i.e. color input). + * + * In the former case we rely on the execution system to not evaluate this node. + * + * For the latter case we use 1 pixel preview, so that it's possible to see preview color in the + * preview. This is how final F12 render will behave (flood-fill final frame with the color). + * + * Having things consistent in terms that node preview is scaled down F12 render is a very + * natural thing to do. */ + int width = max_ii(1, resolution[0]); + int height = max_ii(1, resolution[1]); + this->m_divider = 0.0f; if (width > height) { - this->m_divider = COM_PREVIEW_SIZE / (width - 1); + this->m_divider = (float)COM_PREVIEW_SIZE / (width); } else { - this->m_divider = COM_PREVIEW_SIZE / (height - 1); + this->m_divider = (float)COM_PREVIEW_SIZE / (height); } width = width * this->m_divider; height = height * this->m_divider; diff --git a/source/blender/compositor/operations/COM_PreviewOperation.h b/source/blender/compositor/operations/COM_PreviewOperation.h index f31bd533971..eca50c5cda4 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.h +++ b/source/blender/compositor/operations/COM_PreviewOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_PREVIEWOPERATION_H__ -#define __COM_PREVIEWOPERATION_H__ +#pragma once + #include "BKE_global.h" #include "BLI_rect.h" #include "COM_NodeOperation.h" @@ -61,4 +61,3 @@ class PreviewOperation : public NodeOperation { return true; } }; -#endif diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h index 3574f40e3bb..b9290fa1548 100644 --- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h +++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_PROJECTORLENSDISTORTIONOPERATION_H__ -#define __COM_PROJECTORLENSDISTORTIONOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "DNA_node_types.h" @@ -58,4 +58,3 @@ class ProjectorLensDistortionOperation : public NodeOperation { void updateDispersion(); }; -#endif diff --git a/source/blender/compositor/operations/COM_QualityStepHelper.h b/source/blender/compositor/operations/COM_QualityStepHelper.h index 0814f5cdb4c..e437613fb29 100644 --- a/source/blender/compositor/operations/COM_QualityStepHelper.h +++ b/source/blender/compositor/operations/COM_QualityStepHelper.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_QUALITYSTEPHELPER_H__ -#define __COM_QUALITYSTEPHELPER_H__ +#pragma once + #include "COM_defines.h" typedef enum QualityHelper { @@ -54,4 +54,3 @@ class QualityStepHelper { this->m_quality = quality; } }; -#endif diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.h b/source/blender/compositor/operations/COM_ReadBufferOperation.h index 60d064a5582..e59cb5449d6 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.h +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_READBUFFEROPERATION_H__ -#define __COM_READBUFFEROPERATION_H__ +#pragma once #include "COM_MemoryBuffer.h" #include "COM_MemoryProxy.h" @@ -73,5 +72,3 @@ class ReadBufferOperation : public NodeOperation { void readResolutionFromWriteBuffer(); void updateMemoryBuffer(); }; - -#endif diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.h b/source/blender/compositor/operations/COM_RenderLayersProg.h index 6f84eae3252..74664c128c0 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.h +++ b/source/blender/compositor/operations/COM_RenderLayersProg.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_RENDERLAYERSPROG_H__ -#define __COM_RENDERLAYERSPROG_H__ +#pragma once #include "BLI_listbase.h" #include "BLI_utildefines.h" @@ -150,5 +149,3 @@ class RenderLayersDepthProg : public RenderLayersProg { } void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; - -#endif diff --git a/source/blender/compositor/operations/COM_RotateOperation.h b/source/blender/compositor/operations/COM_RotateOperation.h index 46bdc68161e..0ef4466671a 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.h +++ b/source/blender/compositor/operations/COM_RotateOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_ROTATEOPERATION_H__ -#define __COM_ROTATEOPERATION_H__ +#pragma once #include "COM_NodeOperation.h" @@ -47,5 +46,3 @@ class RotateOperation : public NodeOperation { void ensureDegree(); }; - -#endif diff --git a/source/blender/compositor/operations/COM_ScaleOperation.h b/source/blender/compositor/operations/COM_ScaleOperation.h index 28e32ff8606..f28b8237485 100644 --- a/source/blender/compositor/operations/COM_ScaleOperation.h +++ b/source/blender/compositor/operations/COM_ScaleOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_SCALEOPERATION_H__ -#define __COM_SCALEOPERATION_H__ +#pragma once #include "COM_NodeOperation.h" @@ -129,5 +128,3 @@ class ScaleFixedSizeOperation : public BaseScaleOperation { this->m_offsetY = y; } }; - -#endif diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h index c9db5bc88b8..f9982d94f60 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_SCREENLENSDISTORTIONOPERATION_H__ -#define __COM_SCREENLENSDISTORTIONOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "DNA_node_types.h" @@ -96,4 +96,3 @@ class ScreenLensDistortionOperation : public NodeOperation { float sum[4], int count[3]) const; }; -#endif diff --git a/source/blender/compositor/operations/COM_SetAlphaOperation.h b/source/blender/compositor/operations/COM_SetAlphaOperation.h index 24f80b71eae..a84fb0f2228 100644 --- a/source/blender/compositor/operations/COM_SetAlphaOperation.h +++ b/source/blender/compositor/operations/COM_SetAlphaOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_SETALPHAOPERATION_H__ -#define __COM_SETALPHAOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" /** @@ -43,4 +43,3 @@ class SetAlphaOperation : public NodeOperation { void initExecution(); void deinitExecution(); }; -#endif diff --git a/source/blender/compositor/operations/COM_SetColorOperation.h b/source/blender/compositor/operations/COM_SetColorOperation.h index d16d3806864..0723ac8a8e4 100644 --- a/source/blender/compositor/operations/COM_SetColorOperation.h +++ b/source/blender/compositor/operations/COM_SetColorOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_SETCOLOROPERATION_H__ -#define __COM_SETCOLOROPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" /** @@ -82,4 +82,3 @@ class SetColorOperation : public NodeOperation { return true; } }; -#endif diff --git a/source/blender/compositor/operations/COM_SetSamplerOperation.h b/source/blender/compositor/operations/COM_SetSamplerOperation.h index 62f01129ff7..c0b5d5a37be 100644 --- a/source/blender/compositor/operations/COM_SetSamplerOperation.h +++ b/source/blender/compositor/operations/COM_SetSamplerOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_SETSAMPLEROPERATION_H__ -#define __COM_SETSAMPLEROPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" /** @@ -47,4 +47,3 @@ class SetSamplerOperation : public NodeOperation { void initExecution(); void deinitExecution(); }; -#endif diff --git a/source/blender/compositor/operations/COM_SetValueOperation.h b/source/blender/compositor/operations/COM_SetValueOperation.h index 6fb2832450d..6645cd558b2 100644 --- a/source/blender/compositor/operations/COM_SetValueOperation.h +++ b/source/blender/compositor/operations/COM_SetValueOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_SETVALUEOPERATION_H__ -#define __COM_SETVALUEOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" /** @@ -54,4 +54,3 @@ class SetValueOperation : public NodeOperation { return true; } }; -#endif diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.h b/source/blender/compositor/operations/COM_SetVectorOperation.h index a2f9aaa6b3b..05c8e6dc56b 100644 --- a/source/blender/compositor/operations/COM_SetVectorOperation.h +++ b/source/blender/compositor/operations/COM_SetVectorOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_SETVECTOROPERATION_H__ -#define __COM_SETVECTOROPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" /** @@ -88,4 +88,3 @@ class SetVectorOperation : public NodeOperation { setZ(vector[2]); } }; -#endif diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.h b/source/blender/compositor/operations/COM_SocketProxyOperation.h index 3855c26088a..22c144598f6 100644 --- a/source/blender/compositor/operations/COM_SocketProxyOperation.h +++ b/source/blender/compositor/operations/COM_SocketProxyOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_SOCKETPROXYOPERATION_H__ -#define __COM_SOCKETPROXYOPERATION_H__ +#pragma once #include "COM_NodeOperation.h" @@ -46,5 +45,3 @@ class SocketProxyOperation : public NodeOperation { private: bool m_use_conversion; }; - -#endif diff --git a/source/blender/compositor/operations/COM_SplitOperation.h b/source/blender/compositor/operations/COM_SplitOperation.h index ea923123290..62d41a615ff 100644 --- a/source/blender/compositor/operations/COM_SplitOperation.h +++ b/source/blender/compositor/operations/COM_SplitOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_SPLITOPERATION_H__ -#define __COM_SPLITOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" class SplitOperation : public NodeOperation { @@ -43,4 +43,3 @@ class SplitOperation : public NodeOperation { this->m_xSplit = xsplit; } }; -#endif diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.h b/source/blender/compositor/operations/COM_SunBeamsOperation.h index d8153264d98..09bdb018cc3 100644 --- a/source/blender/compositor/operations/COM_SunBeamsOperation.h +++ b/source/blender/compositor/operations/COM_SunBeamsOperation.h @@ -15,8 +15,7 @@ * Copyright 2014, Blender Foundation. */ -#ifndef __COM_SUNBEAMSOPERATION_H__ -#define __COM_SUNBEAMSOPERATION_H__ +#pragma once #include "COM_NodeOperation.h" @@ -45,5 +44,3 @@ class SunBeamsOperation : public NodeOperation { float m_source_px[2]; float m_ray_length_px; }; - -#endif diff --git a/source/blender/compositor/operations/COM_TextureOperation.h b/source/blender/compositor/operations/COM_TextureOperation.h index ebfdbb6513a..7fa85922b0b 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.h +++ b/source/blender/compositor/operations/COM_TextureOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_TEXTUREOPERATION_H__ -#define __COM_TEXTUREOPERATION_H__ +#pragma once #include "BLI_listbase.h" #include "COM_NodeOperation.h" @@ -81,5 +80,3 @@ class TextureAlphaOperation : public TextureBaseOperation { TextureAlphaOperation(); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; - -#endif diff --git a/source/blender/compositor/operations/COM_TonemapOperation.h b/source/blender/compositor/operations/COM_TonemapOperation.h index 11e82c1fc9c..066332fb7e4 100644 --- a/source/blender/compositor/operations/COM_TonemapOperation.h +++ b/source/blender/compositor/operations/COM_TonemapOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_TONEMAPOPERATION_H__ -#define __COM_TONEMAPOPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "DNA_node_types.h" @@ -98,5 +98,3 @@ class PhotoreceptorTonemapOperation : public TonemapOperation { */ void executePixel(float output[4], int x, int y, void *data); }; - -#endif diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.h b/source/blender/compositor/operations/COM_TrackPositionOperation.h index 695e85f4fa3..7d831ec5d8d 100644 --- a/source/blender/compositor/operations/COM_TrackPositionOperation.h +++ b/source/blender/compositor/operations/COM_TrackPositionOperation.h @@ -16,8 +16,7 @@ * Copyright 2012, Blender Foundation. */ -#ifndef __COM_TRACKPOSITIONOPERATION_H__ -#define __COM_TRACKPOSITIONOPERATION_H__ +#pragma once #include <string.h> @@ -97,5 +96,3 @@ class TrackPositionOperation : public NodeOperation { return true; } }; - -#endif diff --git a/source/blender/compositor/operations/COM_TranslateOperation.h b/source/blender/compositor/operations/COM_TranslateOperation.h index 2d13813a86a..99cfb528858 100644 --- a/source/blender/compositor/operations/COM_TranslateOperation.h +++ b/source/blender/compositor/operations/COM_TranslateOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_TRANSLATEOPERATION_H__ -#define __COM_TRANSLATEOPERATION_H__ +#pragma once #include "COM_NodeOperation.h" @@ -65,5 +64,3 @@ class TranslateOperation : public NodeOperation { void setFactorXY(float factorX, float factorY); }; - -#endif diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h index 930bfd77943..82f41ad68e3 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_VARIABLESIZEBOKEHBLUROPERATION_H__ -#define __COM_VARIABLESIZEBOKEHBLUROPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "COM_QualityStepHelper.h" @@ -123,4 +123,3 @@ class InverseSearchRadiusOperation : public NodeOperation { } }; #endif -#endif diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.h b/source/blender/compositor/operations/COM_VectorBlurOperation.h index 3caf5c5c8e4..846b69310bf 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.h +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_VECTORBLUROPERATION_H__ -#define __COM_VECTORBLUROPERATION_H__ +#pragma once + #include "COM_NodeOperation.h" #include "COM_QualityStepHelper.h" #include "DNA_node_types.h" @@ -72,4 +72,3 @@ class VectorBlurOperation : public NodeOperation, public QualityStepHelper { MemoryBuffer *inputSpeed, MemoryBuffer *inputZ); }; -#endif diff --git a/source/blender/compositor/operations/COM_VectorCurveOperation.h b/source/blender/compositor/operations/COM_VectorCurveOperation.h index 65441dbdfb7..9fa5fe78a4b 100644 --- a/source/blender/compositor/operations/COM_VectorCurveOperation.h +++ b/source/blender/compositor/operations/COM_VectorCurveOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_VECTORCURVEOPERATION_H__ -#define __COM_VECTORCURVEOPERATION_H__ +#pragma once + #include "COM_CurveBaseOperation.h" #include "COM_NodeOperation.h" @@ -46,4 +46,3 @@ class VectorCurveOperation : public CurveBaseOperation { */ void deinitExecution(); }; -#endif diff --git a/source/blender/compositor/operations/COM_ViewerOperation.h b/source/blender/compositor/operations/COM_ViewerOperation.h index aae2e912804..680744c70d9 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.h +++ b/source/blender/compositor/operations/COM_ViewerOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_VIEWEROPERATION_H__ -#define __COM_VIEWEROPERATION_H__ +#pragma once + #include "BKE_global.h" #include "BLI_rect.h" #include "COM_NodeOperation.h" @@ -129,4 +129,3 @@ class ViewerOperation : public NodeOperation { void updateImage(rcti *rect); void initImage(); }; -#endif diff --git a/source/blender/compositor/operations/COM_WrapOperation.h b/source/blender/compositor/operations/COM_WrapOperation.h index 6360fa0c246..d1acfb10f25 100644 --- a/source/blender/compositor/operations/COM_WrapOperation.h +++ b/source/blender/compositor/operations/COM_WrapOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_WRAPOPERATION_H__ -#define __COM_WRAPOPERATION_H__ +#pragma once #include "COM_ReadBufferOperation.h" @@ -38,5 +37,3 @@ class WrapOperation : public ReadBufferOperation { void setFactorXY(float factorX, float factorY); }; - -#endif diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.h b/source/blender/compositor/operations/COM_WriteBufferOperation.h index be525db4420..a9f90830a92 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.h +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.h @@ -16,8 +16,7 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_WRITEBUFFEROPERATION_H__ -#define __COM_WRITEBUFFEROPERATION_H__ +#pragma once #include "COM_MemoryProxy.h" #include "COM_NodeOperation.h" @@ -63,4 +62,3 @@ class WriteBufferOperation : public NodeOperation { return m_input; } }; -#endif diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.h b/source/blender/compositor/operations/COM_ZCombineOperation.h index 9a93d080a2f..8c6e73f8c55 100644 --- a/source/blender/compositor/operations/COM_ZCombineOperation.h +++ b/source/blender/compositor/operations/COM_ZCombineOperation.h @@ -16,8 +16,8 @@ * Copyright 2011, Blender Foundation. */ -#ifndef __COM_ZCOMBINEOPERATION_H__ -#define __COM_ZCOMBINEOPERATION_H__ +#pragma once + #include "COM_MixOperation.h" /** @@ -66,5 +66,3 @@ class ZCombineMaskOperation : public NodeOperation { class ZCombineMaskAlphaOperation : public ZCombineMaskOperation { void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; - -#endif diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt index 355d2536e1a..51fce738700 100644 --- a/source/blender/depsgraph/CMakeLists.txt +++ b/source/blender/depsgraph/CMakeLists.txt @@ -46,6 +46,7 @@ set(SRC intern/builder/deg_builder_nodes_view_layer.cc intern/builder/deg_builder_pchanmap.cc intern/builder/deg_builder_relations.cc + intern/builder/deg_builder_relations_drivers.cc intern/builder/deg_builder_relations_keys.cc intern/builder/deg_builder_relations_rig.cc intern/builder/deg_builder_relations_scene.cc @@ -100,6 +101,7 @@ set(SRC intern/builder/deg_builder.h intern/builder/deg_builder_cache.h intern/builder/deg_builder_cycle.h + intern/builder/deg_builder_relations_drivers.h intern/builder/deg_builder_map.h intern/builder/deg_builder_nodes.h intern/builder/deg_builder_pchanmap.h @@ -145,3 +147,14 @@ set(LIB ) blender_add_lib(bf_depsgraph "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") + +if(WITH_GTESTS) + set(TEST_SRC + intern/builder/deg_builder_rna_test.cc + ) + set(TEST_LIB + bf_depsgraph + ) + include(GTestTesting) + blender_add_test_lib(bf_depsgraph_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB}") +endif() diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h index d735d3b89bc..b3636743101 100644 --- a/source/blender/depsgraph/DEG_depsgraph.h +++ b/source/blender/depsgraph/DEG_depsgraph.h @@ -43,8 +43,7 @@ * - These are used in all depsgraph code and by all callers of Depsgraph API... */ -#ifndef __DEG_DEPSGRAPH_H__ -#define __DEG_DEPSGRAPH_H__ +#pragma once #include "DNA_ID.h" @@ -233,5 +232,3 @@ void DEG_debug_print_eval_time(struct Depsgraph *depsgraph, #ifdef __cplusplus } /* extern "C" */ #endif - -#endif /* __DEG_DEPSGRAPH_H__ */ diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h b/source/blender/depsgraph/DEG_depsgraph_build.h index 81157102bb1..50f22b00028 100644 --- a/source/blender/depsgraph/DEG_depsgraph_build.h +++ b/source/blender/depsgraph/DEG_depsgraph_build.h @@ -23,8 +23,7 @@ * Public API for Depsgraph */ -#ifndef __DEG_DEPSGRAPH_BUILD_H__ -#define __DEG_DEPSGRAPH_BUILD_H__ +#pragma once /* ************************************************* */ @@ -201,5 +200,3 @@ struct Depsgraph *DEG_get_graph_from_handle(struct DepsNodeHandle *node_handle); #ifdef __cplusplus } /* extern "C" */ #endif - -#endif /* __DEG_DEPSGRAPH_BUILD_H__ */ diff --git a/source/blender/depsgraph/DEG_depsgraph_debug.h b/source/blender/depsgraph/DEG_depsgraph_debug.h index 73e03523003..e261ff67a20 100644 --- a/source/blender/depsgraph/DEG_depsgraph_debug.h +++ b/source/blender/depsgraph/DEG_depsgraph_debug.h @@ -23,8 +23,7 @@ * Public API for Querying and Filtering Depsgraph */ -#ifndef __DEG_DEPSGRAPH_DEBUG_H__ -#define __DEG_DEPSGRAPH_DEBUG_H__ +#pragma once #include <stdio.h> @@ -80,5 +79,3 @@ bool DEG_debug_consistency_check(struct Depsgraph *graph); #ifdef __cplusplus } /* extern "C" */ #endif - -#endif /* __DEG_DEPSGRAPH_DEBUG_H__ */ diff --git a/source/blender/depsgraph/DEG_depsgraph_physics.h b/source/blender/depsgraph/DEG_depsgraph_physics.h index 7eae6b4eec4..7bd2994b426 100644 --- a/source/blender/depsgraph/DEG_depsgraph_physics.h +++ b/source/blender/depsgraph/DEG_depsgraph_physics.h @@ -23,8 +23,7 @@ * Physics utilities for effectors and collision. */ -#ifndef __DEG_DEPSGRAPH_PHYSICS_H__ -#define __DEG_DEPSGRAPH_PHYSICS_H__ +#pragma once #include "DEG_depsgraph.h" @@ -74,5 +73,3 @@ void DEG_add_forcefield_relations(struct DepsNodeHandle *handle, #ifdef __cplusplus } /* extern "C" */ #endif - -#endif /* __DEG_DEPSGRAPH_PHYSICS_H__ */ diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h index 3d570536223..e0166a13d69 100644 --- a/source/blender/depsgraph/DEG_depsgraph_query.h +++ b/source/blender/depsgraph/DEG_depsgraph_query.h @@ -23,8 +23,7 @@ * Public API for Querying Depsgraph. */ -#ifndef __DEG_DEPSGRAPH_QUERY_H__ -#define __DEG_DEPSGRAPH_QUERY_H__ +#pragma once #include "BLI_iterator.h" @@ -261,5 +260,3 @@ void DEG_foreach_ID(const Depsgraph *depsgraph, DEGForeachIDCallback callback, v #ifdef __cplusplus } /* extern "C" */ #endif - -#endif /* __DEG_DEPSGRAPH_QUERY_H__ */ diff --git a/source/blender/depsgraph/intern/builder/deg_builder_map.h b/source/blender/depsgraph/intern/builder/deg_builder_map.h index 5dfc3297b3e..8b23d3d0d3b 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_map.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_map.h @@ -40,7 +40,7 @@ class BuilderMap { TAG_SCENE_COMPOSITOR = (1 << 4), TAG_SCENE_SEQUENCER = (1 << 5), - TAG_SCENE_AUDIO = (1 << 5), + TAG_SCENE_AUDIO = (1 << 6), /* All ID components has been built. */ TAG_COMPLETE = (TAG_ANIMATION | TAG_PARAMETERS | TAG_TRANSFORM | TAG_GEOMETRY | diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index c8309656f21..dcdcf0c05ca 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -1797,6 +1797,9 @@ void DepsgraphNodeBuilder::build_scene_sequencer(Scene *scene) if (scene->ed == nullptr) { return; } + if (built_map_.checkIsBuiltAndTag(scene, BuilderMap::TAG_SCENE_SEQUENCER)) { + return; + } build_scene_audio(scene); Scene *scene_cow = get_cow_datablock(scene); add_operation_node(&scene->id, diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 8eeea4c18eb..ccd7cadc8e8 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -104,6 +104,7 @@ #include "intern/builder/deg_builder.h" #include "intern/builder/deg_builder_pchanmap.h" +#include "intern/builder/deg_builder_relations_drivers.h" #include "intern/debug/deg_debug.h" #include "intern/depsgraph_physics.h" #include "intern/depsgraph_tag.h" @@ -1012,6 +1013,9 @@ void DepsgraphRelationBuilder::build_object_pointcache(Object *object) /* Check which components needs the point cache. */ int flag = -1; if (ptcache_id->type == PTCACHE_TYPE_RIGIDBODY) { + if (object->rigidbody_object->type == RBO_TYPE_PASSIVE) { + continue; + } flag = FLAG_TRANSFORM; OperationKey transform_key( &object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_SIMULATION_INIT); @@ -1712,8 +1716,7 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene) /* Geometry must be known to create the rigid body. RBO_MESH_BASE * uses the non-evaluated mesh, so then the evaluation is * unnecessary. */ - if (object->rigidbody_object != nullptr && - object->rigidbody_object->mesh_source != RBO_MESH_BASE) { + if (rigidbody_object_depends_on_evaluated_geometry(object->rigidbody_object)) { /* NOTE: We prefer this relation to be never killed, to avoid * access partially evaluated mesh from solver. */ ComponentKey object_geometry_key(&object->id, NodeType::GEOMETRY); @@ -2843,121 +2846,6 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDNode *id_node) #endif } -static bool is_reachable(const Node *const from, const Node *const to) -{ - if (from == to) { - return true; - } - - // Perform a graph walk from 'to' towards its incoming connections. - // Walking from 'from' towards its outgoing connections is 10x slower on the Spring rig. - deque<const Node *> queue; - Set<const Node *> seen; - queue.push_back(to); - while (!queue.empty()) { - // Visit the next node to inspect. - const Node *visit = queue.back(); - queue.pop_back(); - - if (visit == from) { - return true; - } - - // Queue all incoming relations that we haven't seen before. - for (Relation *relation : visit->inlinks) { - const Node *prev_node = relation->from; - if (seen.add(prev_node)) { - queue.push_back(prev_node); - } - } - } - return false; -} - -void DepsgraphRelationBuilder::build_driver_relations() -{ - for (IDNode *id_node : graph_->id_nodes) { - build_driver_relations(id_node); - } -} - -void DepsgraphRelationBuilder::build_driver_relations(IDNode *id_node) -{ - /* Add relations between drivers that write to the same datablock. - * - * This prevents threading issues when two separate RNA properties write to - * the same memory address. For example: - * - Drivers on individual array elements, as the animation system will write - * the whole array back to RNA even when changing individual array value. - * - Drivers on RNA properties that map to a single bit flag. Changing the RNA - * value will write the entire int containing the bit, in a non-thread-safe - * way. - */ - ID *id_orig = id_node->id_orig; - AnimData *adt = BKE_animdata_from_id(id_orig); - if (adt == nullptr) { - return; - } - - // Mapping from RNA prefix -> set of driver evaluation nodes: - Map<string, Vector<Node *>> driver_groups; - - LISTBASE_FOREACH (FCurve *, fcu, &adt->drivers) { - if (fcu->rna_path == nullptr) { - continue; - } - // Get the RNA path except the part after the last dot. - char *last_dot = strrchr(fcu->rna_path, '.'); - StringRef rna_prefix; - if (last_dot != nullptr) { - rna_prefix = StringRef(fcu->rna_path, last_dot); - } - - // Insert this driver node into the group belonging to the RNA prefix. - OperationKey driver_key( - id_orig, NodeType::PARAMETERS, OperationCode::DRIVER, fcu->rna_path, fcu->array_index); - Node *node_driver = get_node(driver_key); - driver_groups.lookup_or_add_default_as(rna_prefix).append(node_driver); - } - - for (Span<Node *> prefix_group : driver_groups.values()) { - // For each node in the driver group, try to connect it to another node - // in the same group without creating any cycles. - int num_drivers = prefix_group.size(); - if (num_drivers < 2) { - // A relation requires two drivers. - continue; - } - for (int from_index = 0; from_index < num_drivers; ++from_index) { - Node *op_from = prefix_group[from_index]; - - // Start by trying the next node in the group. - for (int to_offset = 1; to_offset < num_drivers; ++to_offset) { - int to_index = (from_index + to_offset) % num_drivers; - Node *op_to = prefix_group[to_index]; - - // Investigate whether this relation would create a dependency cycle. - // Example graph: - // A -> B -> C - // and investigating a potential connection C->A. Because A->C is an - // existing transitive connection, adding C->A would create a cycle. - if (is_reachable(op_to, op_from)) { - continue; - } - - // No need to directly connect this node if there is already a transitive connection. - if (is_reachable(op_from, op_to)) { - break; - } - - add_operation_relation( - op_from->get_exit_operation(), op_to->get_entry_operation(), "Driver Serialization"); - break; - } - } - } -} - /* **** ID traversal callbacks functions **** */ void DepsgraphRelationBuilder::modifier_walk(void *user_data, diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_drivers.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_drivers.cc new file mode 100644 index 00000000000..717c8300f9b --- /dev/null +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_drivers.cc @@ -0,0 +1,258 @@ +/* + * 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. + * + * The Original Code is Copyright (C) 2013 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup depsgraph + * + * Methods for constructing depsgraph relations for drivers. + */ + +#include "intern/builder/deg_builder_relations_drivers.h" + +#include <cstring> + +#include "DNA_anim_types.h" + +#include "BKE_anim_data.h" + +#include "intern/builder/deg_builder_relations.h" +#include "intern/depsgraph_relation.h" +#include "intern/node/deg_node.h" + +namespace blender { +namespace deg { + +DriverDescriptor::DriverDescriptor(PointerRNA *id_ptr, FCurve *fcu) + : rna_prefix(), + rna_suffix(), + id_ptr_(id_ptr), + fcu_(fcu), + driver_relations_needed_(false), + pointer_rna_(), + property_rna_(nullptr), + is_array_(false) +{ + driver_relations_needed_ = determine_relations_needed(); + split_rna_path(); +} + +bool DriverDescriptor::determine_relations_needed() +{ + if (fcu_->array_index > 0) { + /* Drivers on array elements always need relations. */ + is_array_ = true; + return true; + } + + if (!resolve_rna()) { + /* Properties that don't exist can't cause threading issues either. */ + return false; + } + + if (RNA_property_array_check(property_rna_)) { + /* Drivers on array elements always need relations. */ + is_array_ = true; + return true; + } + + /* Drivers on Booleans and Enums (when used as bitflags) can write to the same memory location, + * so they need relations between each other. */ + return ELEM(RNA_property_type(property_rna_), PROP_BOOLEAN, PROP_ENUM); +} + +bool DriverDescriptor::driver_relations_needed() const +{ + return driver_relations_needed_; +} + +bool DriverDescriptor::is_array() const +{ + return is_array_; +} + +/* Assumes that 'other' comes from the same RNA group, that is, has the same RNA path prefix. */ +bool DriverDescriptor::is_same_array_as(const DriverDescriptor &other) const +{ + if (!is_array_ || !other.is_array_) { + return false; + } + return rna_suffix == other.rna_suffix; +} + +OperationKey DriverDescriptor::depsgraph_key() const +{ + return OperationKey(id_ptr_->owner_id, + NodeType::PARAMETERS, + OperationCode::DRIVER, + fcu_->rna_path, + fcu_->array_index); +} + +void DriverDescriptor::split_rna_path() +{ + const char *last_dot = strrchr(fcu_->rna_path, '.'); + if (last_dot == nullptr || last_dot[1] == '\0') { + rna_prefix = StringRef(); + rna_suffix = StringRef(fcu_->rna_path); + return; + } + + rna_prefix = StringRef(fcu_->rna_path, last_dot); + rna_suffix = StringRef(last_dot + 1); +} + +bool DriverDescriptor::resolve_rna() +{ + return RNA_path_resolve_property(id_ptr_, fcu_->rna_path, &pointer_rna_, &property_rna_); +} + +static bool is_reachable(const Node *const from, const Node *const to) +{ + if (from == to) { + return true; + } + + // Perform a graph walk from 'to' towards its incoming connections. + // Walking from 'from' towards its outgoing connections is 10x slower on the Spring rig. + deque<const Node *> queue; + Set<const Node *> seen; + queue.push_back(to); + while (!queue.empty()) { + // Visit the next node to inspect. + const Node *visit = queue.back(); + queue.pop_back(); + + if (visit == from) { + return true; + } + + // Queue all incoming relations that we haven't seen before. + for (Relation *relation : visit->inlinks) { + const Node *prev_node = relation->from; + if (seen.add(prev_node)) { + queue.push_back(prev_node); + } + } + } + return false; +} + +/* **** DepsgraphRelationBuilder functions **** */ + +void DepsgraphRelationBuilder::build_driver_relations() +{ + for (IDNode *id_node : graph_->id_nodes) { + build_driver_relations(id_node); + } +} + +void DepsgraphRelationBuilder::build_driver_relations(IDNode *id_node) +{ + /* Add relations between drivers that write to the same datablock. + * + * This prevents threading issues when two separate RNA properties write to + * the same memory address. For example: + * - Drivers on individual array elements, as the animation system will write + * the whole array back to RNA even when changing individual array value. + * - Drivers on RNA properties that map to a single bit flag. Changing the RNA + * value will write the entire int containing the bit, in a non-thread-safe + * way. + */ + ID *id_orig = id_node->id_orig; + AnimData *adt = BKE_animdata_from_id(id_orig); + if (adt == nullptr) { + return; + } + + // Mapping from RNA prefix -> set of driver descriptors: + Map<string, Vector<DriverDescriptor>> driver_groups; + + PointerRNA id_ptr; + RNA_id_pointer_create(id_orig, &id_ptr); + + LISTBASE_FOREACH (FCurve *, fcu, &adt->drivers) { + if (fcu->rna_path == nullptr) { + continue; + } + + DriverDescriptor driver_desc(&id_ptr, fcu); + if (!driver_desc.driver_relations_needed()) { + continue; + } + + driver_groups.lookup_or_add_default_as(driver_desc.rna_prefix).append(driver_desc); + } + + for (Span<DriverDescriptor> prefix_group : driver_groups.values()) { + // For each node in the driver group, try to connect it to another node + // in the same group without creating any cycles. + int num_drivers = prefix_group.size(); + if (num_drivers < 2) { + // A relation requires two drivers. + continue; + } + for (int from_index = 0; from_index < num_drivers; ++from_index) { + const DriverDescriptor &driver_from = prefix_group[from_index]; + Node *op_from = get_node(driver_from.depsgraph_key()); + + // Start by trying the next node in the group. + for (int to_offset = 1; to_offset < num_drivers; ++to_offset) { + const int to_index = (from_index + to_offset) % num_drivers; + const DriverDescriptor &driver_to = prefix_group[to_index]; + Node *op_to = get_node(driver_to.depsgraph_key()); + + // Duplicate drivers can exist (see T78615), but cannot be distinguished by OperationKey + // and thus have the same depsgraph node. Relations between those drivers should not be + // created. This not something that is expected to happen (both the UI and the Python API + // prevent duplicate drivers), it did happen in a file and it is easy to deal with here. + if (op_from == op_to) { + continue; + } + + if (from_index < to_index && driver_from.is_same_array_as(driver_to)) { + // This is for adding a relation like `color[0]` -> `color[1]`. + // When the search for another driver wraps around, we cannot blindly add relations any + // more. + } + else { + // Investigate whether this relation would create a dependency cycle. + // Example graph: + // A -> B -> C + // and investigating a potential connection C->A. Because A->C is an + // existing transitive connection, adding C->A would create a cycle. + if (is_reachable(op_to, op_from)) { + continue; + } + + // No need to directly connect this node if there is already a transitive connection. + if (is_reachable(op_from, op_to)) { + break; + } + } + + add_operation_relation( + op_from->get_exit_operation(), op_to->get_entry_operation(), "Driver Serialization"); + break; + } + } + } +} + +} // namespace deg +} // namespace blender diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_drivers.h b/source/blender/depsgraph/intern/builder/deg_builder_relations_drivers.h new file mode 100644 index 00000000000..c80c69be9e2 --- /dev/null +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_drivers.h @@ -0,0 +1,76 @@ +/* + * 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. + * + * The Original Code is Copyright (C) 2013 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup depsgraph + */ + +#pragma once + +#include "BLI_string_ref.hh" + +#include "RNA_types.h" + +#include "intern/builder/deg_builder_relations.h" + +struct FCurve; + +namespace blender { +namespace deg { + +/* Helper class for determining which relations are needed between driver evaluation nodes. */ +class DriverDescriptor { + public: + /* Drivers are grouped by their RNA prefix. The prefix is the part of the RNA + * path up to the last dot, the suffix is the remainder of the RNA path: + * + * fcu->rna_path rna_prefix rna_suffix + * ------------------------------- ---------------------- ---------- + * 'color' '' 'color' + * 'rigidbody_world.time_scale' 'rigidbody_world' 'time_scale' + * 'pose.bones["master"].location' 'pose.bones["master"]' 'location' + */ + StringRef rna_prefix; + StringRef rna_suffix; + + public: + DriverDescriptor(PointerRNA *id_ptr, FCurve *fcu); + + bool driver_relations_needed() const; + bool is_array() const; + /* Assumes that 'other' comes from the same RNA group, that is, has the same RNA path prefix. */ + bool is_same_array_as(const DriverDescriptor &other) const; + OperationKey depsgraph_key() const; + + private: + PointerRNA *id_ptr_; + FCurve *fcu_; + bool driver_relations_needed_; + + PointerRNA pointer_rna_; + PropertyRNA *property_rna_; + bool is_array_; + + bool determine_relations_needed(); + void split_rna_path(); + bool resolve_rna(); +}; + +} // namespace deg +} // namespace blender diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h b/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h index d4c28060878..b853ecd8e56 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h @@ -27,6 +27,7 @@ #include "DNA_ID.h" #include "DNA_object_types.h" +#include "DNA_rigidbody_types.h" namespace blender { namespace deg { @@ -126,6 +127,19 @@ Relation *DepsgraphRelationBuilder::add_node_handle_relation(const KeyType &key_ return nullptr; } +static bool rigidbody_object_depends_on_evaluated_geometry(const RigidBodyOb *rbo) +{ + if (rbo == nullptr) { + return false; + } + if (ELEM(rbo->shape, RB_SHAPE_CONVEXH, RB_SHAPE_TRIMESH)) { + if (rbo->mesh_source != RBO_MESH_BASE) { + return true; + } + } + return false; +} + template<typename KeyTo> Relation *DepsgraphRelationBuilder::add_depends_on_transform_relation(ID *id, const KeyTo &key_to, @@ -134,7 +148,7 @@ Relation *DepsgraphRelationBuilder::add_depends_on_transform_relation(ID *id, { if (GS(id->name) == ID_OB) { Object *object = reinterpret_cast<Object *>(id); - if (object->rigidbody_object != nullptr) { + if (rigidbody_object_depends_on_evaluated_geometry(object->rigidbody_object)) { OperationKey transform_key(&object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_EVAL); return add_relation(transform_key, key_to, description, flags); } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc index 98ae653d294..b13ddb294aa 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc @@ -149,6 +149,25 @@ Node *RNANodeQuery::find_node(const PointerRNA *ptr, node_identifier.operation_name_tag); } +bool RNANodeQuery::contains(const char *prop_identifier, const char *rna_path_component) +{ + const char *substr = strstr(prop_identifier, rna_path_component); + if (substr == nullptr) { + return false; + } + + // If substr != prop_identifier, it means that the substring is found further in prop_identifier, + // and that thus index -1 is a valid memory location. + const bool start_ok = substr == prop_identifier || substr[-1] == '.'; + if (!start_ok) { + return false; + } + + const size_t component_len = strlen(rna_path_component); + const bool end_ok = ELEM(substr[component_len], '\0', '.', '['); + return end_ok; +} + RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr, const PropertyRNA *prop, RNAPointerSource source) @@ -283,12 +302,24 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr, if (prop != nullptr) { const char *prop_identifier = RNA_property_identifier((PropertyRNA *)prop); /* TODO(sergey): How to optimize this? */ - if (strstr(prop_identifier, "location") || strstr(prop_identifier, "rotation") || - strstr(prop_identifier, "scale") || strstr(prop_identifier, "matrix_")) { + if (contains(prop_identifier, "location") || contains(prop_identifier, "matrix_basis") || + contains(prop_identifier, "matrix_channel") || + contains(prop_identifier, "matrix_inverse") || + contains(prop_identifier, "matrix_local") || + contains(prop_identifier, "matrix_parent_inverse") || + contains(prop_identifier, "matrix_world") || + contains(prop_identifier, "rotation_axis_angle") || + contains(prop_identifier, "rotation_euler") || + contains(prop_identifier, "rotation_mode") || + contains(prop_identifier, "rotation_quaternion") || contains(prop_identifier, "scale") || + contains(prop_identifier, "delta_location") || + contains(prop_identifier, "delta_rotation_euler") || + contains(prop_identifier, "delta_rotation_quaternion") || + contains(prop_identifier, "delta_scale")) { node_identifier.type = NodeType::TRANSFORM; return node_identifier; } - else if (strstr(prop_identifier, "data")) { + else if (contains(prop_identifier, "data")) { /* We access object.data, most likely a geometry. * Might be a bone tho. */ node_identifier.type = NodeType::GEOMETRY; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna.h b/source/blender/depsgraph/intern/builder/deg_builder_rna.h index 52d0e5f6b12..c48c6489c47 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_rna.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_rna.h @@ -93,6 +93,19 @@ class RNANodeQuery { /* Make sure ID data exists for the given ID, and returns it. */ RNANodeQueryIDData *ensure_id_data(const ID *id); + + /* Check whether prop_identifier contains rna_path_component. + * + * This checks more than a substring: + * + * prop_identifier contains(prop_identifier, "location") + * ------------------------ ------------------------------------- + * location true + * ["test_location"] false + * pose["bone"].location true + * pose["bone"].location.x true + */ + static bool contains(const char *prop_identifier, const char *rna_path_component); }; } // namespace deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna_test.cc b/source/blender/depsgraph/intern/builder/deg_builder_rna_test.cc new file mode 100644 index 00000000000..c91dda87190 --- /dev/null +++ b/source/blender/depsgraph/intern/builder/deg_builder_rna_test.cc @@ -0,0 +1,60 @@ +/* + * 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. + * + * The Original Code is Copyright (C) 2020 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup depsgraph + */ + +#include "intern/builder/deg_builder_rna.h" + +#include "testing/testing.h" + +namespace blender { +namespace deg { +namespace tests { + +class TestableRNANodeQuery : public RNANodeQuery { + public: + static bool contains(const char *prop_identifier, const char *rna_path_component) + { + return RNANodeQuery::contains(prop_identifier, rna_path_component); + } +}; + +TEST(deg_builder_rna, contains) +{ + EXPECT_TRUE(TestableRNANodeQuery::contains("location", "location")); + EXPECT_TRUE(TestableRNANodeQuery::contains("location.x", "location")); + EXPECT_TRUE(TestableRNANodeQuery::contains("pose.bone[\"blork\"].location", "location")); + EXPECT_TRUE(TestableRNANodeQuery::contains("pose.bone[\"blork\"].location.x", "location")); + EXPECT_TRUE(TestableRNANodeQuery::contains("pose.bone[\"blork\"].location[0]", "location")); + + EXPECT_FALSE(TestableRNANodeQuery::contains("", "location")); + EXPECT_FALSE(TestableRNANodeQuery::contains("locatio", "location")); + EXPECT_FALSE(TestableRNANodeQuery::contains("locationnn", "location")); + EXPECT_FALSE(TestableRNANodeQuery::contains("test_location", "location")); + EXPECT_FALSE(TestableRNANodeQuery::contains("location_test", "location")); + EXPECT_FALSE(TestableRNANodeQuery::contains("test_location_test", "location")); + EXPECT_FALSE(TestableRNANodeQuery::contains("pose.bone[\"location\"].scale", "location")); + EXPECT_FALSE(TestableRNANodeQuery::contains("pose.bone[\"location\"].scale[0]", "location")); +} + +} // namespace tests +} // namespace deg +} // namespace blender diff --git a/source/blender/depsgraph/intern/depsgraph_registry.cc b/source/blender/depsgraph/intern/depsgraph_registry.cc index c9d03e47ded..623702ee3ae 100644 --- a/source/blender/depsgraph/intern/depsgraph_registry.cc +++ b/source/blender/depsgraph/intern/depsgraph_registry.cc @@ -30,29 +30,35 @@ namespace blender { namespace deg { -static RawMap<Main *, RawVectorSet<Depsgraph *>> g_graph_registry; +using GraphRegistry = Map<Main *, VectorSet<Depsgraph *>>; +static GraphRegistry &get_graph_registry() +{ + static GraphRegistry graph_registry; + return graph_registry; +} void register_graph(Depsgraph *depsgraph) { Main *bmain = depsgraph->bmain; - g_graph_registry.lookup_or_add_default(bmain).add_new(depsgraph); + get_graph_registry().lookup_or_add_default(bmain).add_new(depsgraph); } void unregister_graph(Depsgraph *depsgraph) { Main *bmain = depsgraph->bmain; - RawVectorSet<Depsgraph *> &graphs = g_graph_registry.lookup(bmain); + GraphRegistry &graph_registry = get_graph_registry(); + VectorSet<Depsgraph *> &graphs = graph_registry.lookup(bmain); graphs.remove(depsgraph); // If this was the last depsgraph associated with the main, remove the main entry as well. if (graphs.is_empty()) { - g_graph_registry.remove(bmain); + graph_registry.remove(bmain); } } Span<Depsgraph *> get_all_registered_graphs(Main *bmain) { - RawVectorSet<Depsgraph *> *graphs = g_graph_registry.lookup_ptr(bmain); + VectorSet<Depsgraph *> *graphs = get_graph_registry().lookup_ptr(bmain); if (graphs != nullptr) { return *graphs; } diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index 79d6c8d6a77..c1e1ed3036d 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -283,6 +283,14 @@ bool id_copy_inplace_no_main(const ID *id, ID *newid) { const ID *id_for_copy = id; + if (G.debug & G_DEBUG_DEPSGRAPH_UUID) { + const ID_Type id_type = GS(id_for_copy->name); + if (id_type == ID_OB) { + const Object *object = reinterpret_cast<const Object *>(id_for_copy); + BKE_pose_check_uuids_unique_and_report(object->pose); + } + } + #ifdef NESTED_ID_NASTY_WORKAROUND NestedIDHackTempStorage id_hack_storage; id_for_copy = nested_id_hack_get_discarded_pointers(&id_hack_storage, id); @@ -306,6 +314,10 @@ bool scene_copy_inplace_no_main(const Scene *scene, Scene *new_scene) { const ID *id_for_copy = &scene->id; + if (G.debug & G_DEBUG_DEPSGRAPH_UUID) { + BKE_sequencer_check_uuids_unique_and_report(scene); + } + #ifdef NESTED_ID_NASTY_WORKAROUND NestedIDHackTempStorage id_hack_storage; id_for_copy = nested_id_hack_get_discarded_pointers(&id_hack_storage, &scene->id); @@ -476,25 +488,6 @@ void scene_setup_view_layers_after_remap(const Depsgraph *depsgraph, * Still not an excuse to have those. */ } -void update_sequence_orig_pointers(const ListBase *sequences_orig, ListBase *sequences_cow) -{ - Sequence *sequence_orig = reinterpret_cast<Sequence *>(sequences_orig->first); - Sequence *sequence_cow = reinterpret_cast<Sequence *>(sequences_cow->first); - while (sequence_orig != nullptr) { - update_sequence_orig_pointers(&sequence_orig->seqbase, &sequence_cow->seqbase); - sequence_cow->orig_sequence = sequence_orig; - sequence_cow = sequence_cow->next; - sequence_orig = sequence_orig->next; - } -} - -void update_scene_orig_pointers(const Scene *scene_orig, Scene *scene_cow) -{ - if (scene_orig->ed != nullptr) { - update_sequence_orig_pointers(&scene_orig->ed->seqbase, &scene_cow->ed->seqbase); - } -} - /* Check whether given ID is expanded or still a shallow copy. */ inline bool check_datablock_expanded(const ID *id_cow) { @@ -807,7 +800,6 @@ void update_id_after_copy(const Depsgraph *depsgraph, scene_cow->toolsettings = scene_orig->toolsettings; scene_cow->eevee.light_cache_data = scene_orig->eevee.light_cache_data; scene_setup_view_layers_after_remap(depsgraph, id_node, reinterpret_cast<Scene *>(id_cow)); - update_scene_orig_pointers(scene_orig, scene_cow); break; } default: diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_object.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_object.cc index e0957a10cb1..88334e41192 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_object.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_object.cc @@ -85,11 +85,11 @@ void ObjectRuntimeBackup::backup_pose_channel_runtime_data(Object *object) { if (object->pose != nullptr) { LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) { - /* This is nullptr in Edit mode. */ - if (pchan->orig_pchan != nullptr) { - pose_channel_runtime_data.add(pchan->orig_pchan, pchan->runtime); - BKE_pose_channel_runtime_reset(&pchan->runtime); - } + const SessionUUID &session_uuid = pchan->runtime.session_uuid; + BLI_assert(BLI_session_uuid_is_generated(&session_uuid)); + + pose_channel_runtime_data.add(session_uuid, pchan->runtime); + BKE_pose_channel_runtime_reset(&pchan->runtime); } } } @@ -171,13 +171,10 @@ void ObjectRuntimeBackup::restore_pose_channel_runtime_data(Object *object) { if (object->pose != nullptr) { LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) { - /* This is nullptr in Edit mode. */ - if (pchan->orig_pchan != nullptr) { - optional<bPoseChannel_Runtime> runtime = pose_channel_runtime_data.pop_try( - pchan->orig_pchan); - if (runtime.has_value()) { - pchan->runtime = *runtime; - } + const SessionUUID &session_uuid = pchan->runtime.session_uuid; + optional<bPoseChannel_Runtime> runtime = pose_channel_runtime_data.pop_try(session_uuid); + if (runtime.has_value()) { + pchan->runtime = *runtime; } } } diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_object.h b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_object.h index 04d7fb1bc22..a10f15634ce 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_object.h +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_object.h @@ -24,6 +24,9 @@ #pragma once #include "DNA_object_types.h" +#include "DNA_session_uuid_types.h" + +#include "BLI_session_uuid.h" #include "intern/eval/deg_eval_runtime_backup_modifier.h" #include "intern/eval/deg_eval_runtime_backup_pose.h" @@ -54,7 +57,7 @@ class ObjectRuntimeBackup { short base_flag; unsigned short base_local_view_bits; ModifierRuntimeDataBackup modifier_runtime_data; - Map<bPoseChannel *, bPoseChannel_Runtime> pose_channel_runtime_data; + Map<SessionUUID, bPoseChannel_Runtime> pose_channel_runtime_data; }; } // namespace deg diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc index 2780938fe05..ba7d20c0ba8 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc @@ -26,6 +26,8 @@ #include "DNA_scene_types.h" #include "DNA_sequence_types.h" +#include "BLI_assert.h" + #include "BKE_sequencer.h" #include "BKE_sound.h" @@ -43,7 +45,9 @@ void SequencerBackup::init_from_scene(Scene *scene) SequenceBackup sequence_backup(depsgraph); sequence_backup.init_from_sequence(sequence); if (!sequence_backup.isEmpty()) { - sequences_backup.add(sequence->orig_sequence, sequence_backup); + const SessionUUID &session_uuid = sequence->runtime.session_uuid; + BLI_assert(BLI_session_uuid_is_generated(&session_uuid)); + sequences_backup.add(session_uuid, sequence_backup); } } SEQ_END; @@ -53,7 +57,9 @@ void SequencerBackup::restore_to_scene(Scene *scene) { Sequence *sequence; SEQ_BEGIN (scene->ed, sequence) { - SequenceBackup *sequence_backup = sequences_backup.lookup_ptr(sequence->orig_sequence); + const SessionUUID &session_uuid = sequence->runtime.session_uuid; + BLI_assert(BLI_session_uuid_is_generated(&session_uuid)); + SequenceBackup *sequence_backup = sequences_backup.lookup_ptr(session_uuid); if (sequence_backup != nullptr) { sequence_backup->restore_to_sequence(sequence); } diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.h b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.h index 9fe38ec270c..4419238da32 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.h +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.h @@ -23,6 +23,10 @@ #pragma once +#include "DNA_session_uuid_types.h" + +#include "BLI_session_uuid.h" + #include "intern/depsgraph_type.h" #include "intern/eval/deg_eval_runtime_backup_sequence.h" @@ -43,7 +47,7 @@ class SequencerBackup { const Depsgraph *depsgraph; - Map<Sequence *, SequenceBackup> sequences_backup; + Map<SessionUUID, SequenceBackup> sequences_backup; }; } // namespace deg diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h index bc4efd82a03..6db3bb39643 100644 --- a/source/blender/draw/DRW_engine.h +++ b/source/blender/draw/DRW_engine.h @@ -20,8 +20,7 @@ * \ingroup draw */ -#ifndef __DRW_ENGINE_H__ -#define __DRW_ENGINE_H__ +#pragma once #include "BLI_sys_types.h" /* for bool */ @@ -174,5 +173,3 @@ void DRW_drawdata_free(struct ID *id); #ifdef __cplusplus } #endif - -#endif /* __DRW_ENGINE_H__ */ diff --git a/source/blender/draw/DRW_engine_types.h b/source/blender/draw/DRW_engine_types.h index d31bab5a1b5..807f654f559 100644 --- a/source/blender/draw/DRW_engine_types.h +++ b/source/blender/draw/DRW_engine_types.h @@ -20,8 +20,7 @@ * \ingroup draw */ -#ifndef __DRW_ENGINE_TYPES_H__ -#define __DRW_ENGINE_TYPES_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -50,5 +49,3 @@ typedef struct DefaultTextureList { #ifdef __cplusplus } #endif - -#endif /* __DRW_ENGINE_H__ */ diff --git a/source/blender/draw/DRW_select_buffer.h b/source/blender/draw/DRW_select_buffer.h index 66dee3a9aa9..43d4005c3a9 100644 --- a/source/blender/draw/DRW_select_buffer.h +++ b/source/blender/draw/DRW_select_buffer.h @@ -20,8 +20,7 @@ * \ingroup draw */ -#ifndef __DRW_SELECT_BUFFER_H__ -#define __DRW_SELECT_BUFFER_H__ +#pragma once #include "BLI_sys_types.h" /* for bool and uint */ @@ -126,5 +125,3 @@ uint DRW_select_buffer_find_nearest_to_point(struct Depsgraph *depsgraph, void DRW_select_buffer_context_create(struct Base **bases, const uint bases_len, short select_mode); - -#endif /* __DRW_SELECT_BUFFER_H__ */ diff --git a/source/blender/draw/engines/basic/basic_engine.h b/source/blender/draw/engines/basic/basic_engine.h index d17f1c24c37..8ace6f23cdc 100644 --- a/source/blender/draw/engines/basic/basic_engine.h +++ b/source/blender/draw/engines/basic/basic_engine.h @@ -20,9 +20,6 @@ * \ingroup draw_engine */ -#ifndef __BASIC_ENGINE_H__ -#define __BASIC_ENGINE_H__ +#pragma once extern DrawEngineType draw_engine_basic_type; - -#endif /* __BASIC_ENGINE_H__ */ diff --git a/source/blender/draw/engines/eevee/eevee_data.c b/source/blender/draw/engines/eevee/eevee_data.c index 87948f403a0..e18c43fc643 100644 --- a/source/blender/draw/engines/eevee/eevee_data.c +++ b/source/blender/draw/engines/eevee/eevee_data.c @@ -28,6 +28,8 @@ #include "BLI_memblock.h" #include "BKE_duplilist.h" +#include "BKE_modifier.h" +#include "BKE_object.h" #include "DEG_depsgraph_query.h" @@ -41,15 +43,20 @@ static void eevee_motion_blur_mesh_data_free(void *val) { EEVEE_GeometryMotionData *geom_mb = (EEVEE_GeometryMotionData *)val; + EEVEE_HairMotionData *hair_mb = (EEVEE_HairMotionData *)val; switch (geom_mb->type) { - case EEVEE_HAIR_GEOM_MOTION_DATA: - for (int i = 0; i < ARRAY_SIZE(geom_mb->vbo); i++) { - GPU_VERTBUF_DISCARD_SAFE(geom_mb->hair_pos[i]); - DRW_TEXTURE_FREE_SAFE(geom_mb->hair_pos_tx[i]); + case EEVEE_MOTION_DATA_HAIR: + for (int j = 0; j < hair_mb->psys_len; j++) { + for (int i = 0; i < ARRAY_SIZE(hair_mb->psys[0].hair_pos); i++) { + GPU_VERTBUF_DISCARD_SAFE(hair_mb->psys[j].hair_pos[i]); + } + for (int i = 0; i < ARRAY_SIZE(hair_mb->psys[0].hair_pos); i++) { + DRW_TEXTURE_FREE_SAFE(hair_mb->psys[j].hair_pos_tx[i]); + } } break; - case EEVEE_MESH_GEOM_MOTION_DATA: + case EEVEE_MOTION_DATA_MESH: for (int i = 0; i < ARRAY_SIZE(geom_mb->vbo); i++) { GPU_VERTBUF_DISCARD_SAFE(geom_mb->vbo[i]); } @@ -63,7 +70,7 @@ static uint eevee_object_key_hash(const void *key) EEVEE_ObjectKey *ob_key = (EEVEE_ObjectKey *)key; uint hash = BLI_ghashutil_ptrhash(ob_key->ob); hash = BLI_ghashutil_combine_hash(hash, BLI_ghashutil_ptrhash(ob_key->parent)); - for (int i = 0; i < 16; i++) { + for (int i = 0; i < MAX_DUPLI_RECUR; i++) { if (ob_key->id[i] != 0) { hash = BLI_ghashutil_combine_hash(hash, BLI_ghashutil_inthash(ob_key->id[i])); } @@ -147,28 +154,55 @@ EEVEE_ObjectMotionData *EEVEE_motion_blur_object_data_get(EEVEE_MotionBlurData * return ob_step; } -EEVEE_GeometryMotionData *EEVEE_motion_blur_geometry_data_get(EEVEE_MotionBlurData *mb, - Object *ob, - bool hair) +static void *motion_blur_deform_data_get(EEVEE_MotionBlurData *mb, Object *ob, bool hair) { if (mb->geom == NULL) { return NULL; } - - /* Use original data as key to ensure matching accross update. */ - Object *ob_orig = DEG_get_original_object(ob); - - void *key = (char *)ob_orig->data + hair; + DupliObject *dup = DRW_object_get_dupli(ob); + void *key; + if (dup) { + key = dup->ob; + } + else { + key = ob; + } + /* Only use data for object that have no modifiers. */ + if (!BKE_object_is_modified(DRW_context_state_get()->scene, ob)) { + key = ob->data; + } + key = (char *)key + (int)hair; EEVEE_GeometryMotionData *geom_step = BLI_ghash_lookup(mb->geom, key); if (geom_step == NULL) { - geom_step = MEM_callocN(sizeof(EEVEE_GeometryMotionData), __func__); - geom_step->type = (hair) ? EEVEE_HAIR_GEOM_MOTION_DATA : EEVEE_MESH_GEOM_MOTION_DATA; + if (hair) { + EEVEE_HairMotionData *hair_step; + /* Ugly, we allocate for each modifiers and just fill based on modifier index in the list. */ + int psys_len = (ob->type != OB_HAIR) ? BLI_listbase_count(&ob->modifiers) : 1; + hair_step = MEM_callocN(sizeof(EEVEE_HairMotionData) + sizeof(hair_step->psys[0]) * psys_len, + __func__); + hair_step->psys_len = psys_len; + geom_step = (EEVEE_GeometryMotionData *)hair_step; + geom_step->type = EEVEE_MOTION_DATA_HAIR; + } + else { + geom_step = MEM_callocN(sizeof(EEVEE_GeometryMotionData), __func__); + geom_step->type = EEVEE_MOTION_DATA_MESH; + } BLI_ghash_insert(mb->geom, key, geom_step); } - return geom_step; } +EEVEE_GeometryMotionData *EEVEE_motion_blur_geometry_data_get(EEVEE_MotionBlurData *mb, Object *ob) +{ + return motion_blur_deform_data_get(mb, ob, false); +} + +EEVEE_HairMotionData *EEVEE_motion_blur_hair_data_get(EEVEE_MotionBlurData *mb, Object *ob) +{ + return motion_blur_deform_data_get(mb, ob, true); +} + /* View Layer data. */ void EEVEE_view_layer_data_free(void *storage) @@ -218,6 +252,11 @@ EEVEE_ViewLayerData *EEVEE_view_layer_data_get(void) return (EEVEE_ViewLayerData *)DRW_view_layer_engine_data_get(&draw_engine_eevee_type); } +static void eevee_view_layer_init(EEVEE_ViewLayerData *sldata) +{ + sldata->common_ubo = DRW_uniformbuffer_create(sizeof(sldata->common_data), NULL); +} + EEVEE_ViewLayerData *EEVEE_view_layer_data_ensure_ex(struct ViewLayer *view_layer) { EEVEE_ViewLayerData **sldata = (EEVEE_ViewLayerData **)DRW_view_layer_engine_data_ensure_ex( @@ -225,6 +264,7 @@ EEVEE_ViewLayerData *EEVEE_view_layer_data_ensure_ex(struct ViewLayer *view_laye if (*sldata == NULL) { *sldata = MEM_callocN(sizeof(**sldata), "EEVEE_ViewLayerData"); + eevee_view_layer_init(*sldata); } return *sldata; @@ -237,6 +277,7 @@ EEVEE_ViewLayerData *EEVEE_view_layer_data_ensure(void) if (*sldata == NULL) { *sldata = MEM_callocN(sizeof(**sldata), "EEVEE_ViewLayerData"); + eevee_view_layer_init(*sldata); } return *sldata; diff --git a/source/blender/draw/engines/eevee/eevee_effects.c b/source/blender/draw/engines/eevee/eevee_effects.c index f6e74c6822c..43fb8374173 100644 --- a/source/blender/draw/engines/eevee/eevee_effects.c +++ b/source/blender/draw/engines/eevee/eevee_effects.c @@ -147,6 +147,7 @@ void EEVEE_effects_init(EEVEE_ViewLayerData *sldata, if (!stl->effects) { stl->effects = MEM_callocN(sizeof(EEVEE_EffectsInfo), "EEVEE_EffectsInfo"); + stl->effects->taa_render_sample = 1; } effects = stl->effects; diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index f42c60b04bf..a142648d08d 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -79,11 +79,6 @@ static void eevee_engine_init(void *ved) GPU_framebuffer_ensure_config(&fbl->main_color_fb, {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->color)}); - if (sldata->common_ubo == NULL) { - sldata->common_ubo = DRW_uniformbuffer_create(sizeof(sldata->common_data), - &sldata->common_data); - } - /* `EEVEE_renderpasses_init` will set the active render passes used by `EEVEE_effects_init`. * `EEVEE_effects_init` needs to go second for TAA. */ EEVEE_renderpasses_init(vedata); @@ -459,6 +454,9 @@ static void eevee_render_to_image(void *vedata, } EEVEE_PrivateData *g_data = ved->stl->g_data; + EEVEE_render_modules_init(vedata, engine, depsgraph); + + int initial_frame = CFRA; int steps = max_ii(1, scene->eevee.motion_blur_steps); int time_steps_tot = (do_motion_blur) ? steps : 1; g_data->render_tot_samples = divide_ceil_u(scene->eevee.taa_render_samples, time_steps_tot); @@ -480,9 +478,10 @@ static void eevee_render_to_image(void *vedata, } else { EEVEE_motion_blur_step_set(ved, MB_PREV); - RE_engine_frame_set(engine, floorf(time_prev), fractf(time_prev)); + DRW_render_set_time(engine, depsgraph, floorf(time_prev), fractf(time_prev)); + EEVEE_render_modules_init(vedata, engine, depsgraph); + sldata = EEVEE_view_layer_data_ensure(); - EEVEE_render_view_sync(vedata, engine, depsgraph); EEVEE_render_cache_init(sldata, vedata); DRW_render_object_iter(vedata, engine, depsgraph, EEVEE_render_cache); @@ -496,9 +495,10 @@ static void eevee_render_to_image(void *vedata, /* Next motion step. */ if (do_motion_blur_fx) { EEVEE_motion_blur_step_set(ved, MB_NEXT); - RE_engine_frame_set(engine, floorf(time_next), fractf(time_next)); + DRW_render_set_time(engine, depsgraph, floorf(time_next), fractf(time_next)); + EEVEE_render_modules_init(vedata, engine, depsgraph); + sldata = EEVEE_view_layer_data_ensure(); - EEVEE_render_view_sync(vedata, engine, depsgraph); EEVEE_render_cache_init(sldata, vedata); DRW_render_object_iter(vedata, engine, depsgraph, EEVEE_render_cache); @@ -512,10 +512,11 @@ static void eevee_render_to_image(void *vedata, { if (do_motion_blur) { EEVEE_motion_blur_step_set(ved, MB_CURR); - RE_engine_frame_set(engine, floorf(time_curr), fractf(time_curr)); + DRW_render_set_time(engine, depsgraph, floorf(time_curr), fractf(time_curr)); + EEVEE_render_modules_init(vedata, engine, depsgraph); + sldata = EEVEE_view_layer_data_ensure(); } - EEVEE_render_view_sync(vedata, engine, depsgraph); EEVEE_render_cache_init(sldata, vedata); DRW_render_object_iter(vedata, engine, depsgraph, EEVEE_render_cache); @@ -558,6 +559,11 @@ static void eevee_render_to_image(void *vedata, /* Restore original viewport size. */ DRW_render_viewport_size_set((int[2]){g_data->size_orig[0], g_data->size_orig[1]}); + + if (CFRA != initial_frame) { + /* Restore original frame number. This is because the render pipeline expects it. */ + RE_engine_frame_set(engine, initial_frame, 0.0f); + } } static void eevee_engine_free(void) diff --git a/source/blender/draw/engines/eevee/eevee_engine.h b/source/blender/draw/engines/eevee/eevee_engine.h index b27d16aa7d8..40784e2980b 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.h +++ b/source/blender/draw/engines/eevee/eevee_engine.h @@ -20,9 +20,6 @@ * \ingroup DNA */ -#ifndef __EEVEE_ENGINE_H__ -#define __EEVEE_ENGINE_H__ +#pragma once extern RenderEngineType DRW_engine_viewport_eevee_type; - -#endif /* __EEVEE_ENGINE_H__ */ diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c index 78fcd28eb5d..19325729114 100644 --- a/source/blender/draw/engines/eevee/eevee_lightcache.c +++ b/source/blender/draw/engines/eevee/eevee_lightcache.c @@ -203,6 +203,21 @@ static bool eevee_lightcache_version_check(LightCache *lcache) } } +static bool eevee_lightcache_can_be_saved(LightCache *lcache) +{ + if (lcache->grid_tx.data) { + if (MEM_allocN_len(lcache->grid_tx.data) >= INT_MAX) { + return false; + } + } + if (lcache->cube_tx.data) { + if (MEM_allocN_len(lcache->cube_tx.data) >= INT_MAX) { + return false; + } + } + return true; +} + static int eevee_lightcache_irradiance_sample_count(LightCache *lcache) { int total_irr_samples = 0; @@ -228,7 +243,14 @@ void EEVEE_lightcache_info_update(SceneEEVEE *eevee) if (lcache->cube_tx.tex_size[2] > GPU_max_texture_layers()) { BLI_strncpy(eevee->light_cache_info, - TIP_("Error: Light cache is too big for your GPU to be loaded"), + TIP_("Error: Light cache is too big for the GPU to be loaded"), + sizeof(eevee->light_cache_info)); + return; + } + + if (lcache->flag & LIGHTCACHE_INVALID) { + BLI_strncpy(eevee->light_cache_info, + TIP_("Error: Light cache dimensions not supported by the GPU"), sizeof(eevee->light_cache_info)); return; } @@ -239,6 +261,13 @@ void EEVEE_lightcache_info_update(SceneEEVEE *eevee) return; } + if (!eevee_lightcache_can_be_saved(lcache)) { + BLI_strncpy(eevee->light_cache_info, + TIP_("Error: LightCache is too large and will not be saved to disk"), + sizeof(eevee->light_cache_info)); + return; + } + char formatted_mem[15]; BLI_str_format_byte_unit(formatted_mem, eevee_lightcache_memsize_get(lcache), false); @@ -281,7 +310,7 @@ static bool EEVEE_lightcache_validate(const LightCache *light_cache, const int grid_len, const int irr_size[3]) { - if (light_cache) { + if (light_cache && !(light_cache->flag & LIGHTCACHE_INVALID)) { /* See if we need the same amount of texture space. */ if ((irr_size[0] == light_cache->grid_tx.tex_size[0]) && (irr_size[1] == light_cache->grid_tx.tex_size[1]) && @@ -343,12 +372,18 @@ LightCache *EEVEE_lightcache_create(const int grid_len, light_cache->cube_mips = MEM_callocN(sizeof(LightCacheTexture) * light_cache->mips_len, "LightCacheTexture"); - for (int mip = 0; mip < light_cache->mips_len; mip++) { - GPU_texture_get_mipmap_size( - light_cache->cube_tx.tex, mip + 1, light_cache->cube_mips[mip].tex_size); + if (light_cache->grid_tx.tex == NULL || light_cache->cube_tx.tex == NULL) { + /* We could not create the requested textures size. Stop baking and do not use the cache. */ + light_cache->flag = LIGHTCACHE_INVALID; } + else { + light_cache->flag = LIGHTCACHE_UPDATE_WORLD | LIGHTCACHE_UPDATE_CUBE | LIGHTCACHE_UPDATE_GRID; - light_cache->flag = LIGHTCACHE_UPDATE_WORLD | LIGHTCACHE_UPDATE_CUBE | LIGHTCACHE_UPDATE_GRID; + for (int mip = 0; mip < light_cache->mips_len; mip++) { + GPU_texture_get_mipmap_size( + light_cache->cube_tx.tex, mip + 1, light_cache->cube_mips[mip].tex_size); + } + } return light_cache; } @@ -376,6 +411,12 @@ static bool eevee_lightcache_static_load(LightCache *lcache) 0, false, NULL); + + if (lcache->grid_tx.tex == NULL) { + lcache->flag |= LIGHTCACHE_NOT_USABLE; + return false; + } + GPU_texture_filter_mode(lcache->grid_tx.tex, true); } @@ -401,6 +442,11 @@ static bool eevee_lightcache_static_load(LightCache *lcache) NULL); } + if (lcache->cube_tx.tex == NULL) { + lcache->flag |= LIGHTCACHE_NOT_USABLE; + return false; + } + for (int mip = 0; mip < lcache->mips_len; mip++) { GPU_texture_add_mipmap( lcache->cube_tx.tex, GPU_DATA_10_11_11_REV, mip + 1, lcache->cube_mips[mip].data); @@ -420,6 +466,10 @@ bool EEVEE_lightcache_load(LightCache *lcache) return false; } + if (lcache->flag & (LIGHTCACHE_INVALID | LIGHTCACHE_NOT_USABLE)) { + return false; + } + switch (lcache->type) { case LIGHTCACHE_TYPE_STATIC: return eevee_lightcache_static_load(lcache); @@ -481,6 +531,12 @@ void EEVEE_lightcache_free(LightCache *lcache) static void eevee_lightbake_context_enable(EEVEE_LightBake *lbake) { + if (GPU_use_main_context_workaround() && !BLI_thread_is_main()) { + GPU_context_main_lock(); + DRW_opengl_context_enable(); + return; + } + if (lbake->gl_context) { DRW_opengl_render_context_enable(lbake->gl_context); if (lbake->gpu_context == NULL) { @@ -495,6 +551,12 @@ static void eevee_lightbake_context_enable(EEVEE_LightBake *lbake) static void eevee_lightbake_context_disable(EEVEE_LightBake *lbake) { + if (GPU_use_main_context_workaround() && !BLI_thread_is_main()) { + DRW_opengl_context_disable(); + GPU_context_main_unlock(); + return; + } + if (lbake->gl_context) { DRW_gpu_render_context_disable(lbake->gpu_context); DRW_opengl_render_context_disable(lbake->gl_context); @@ -590,9 +652,7 @@ static void eevee_lightbake_create_resources(EEVEE_LightBake *lbake) if (lbake->lcache == NULL) { lbake->lcache = EEVEE_lightcache_create( lbake->grid_len, lbake->cube_len, lbake->ref_cube_res, lbake->vis_res, lbake->irr_size); - lbake->lcache->flag = LIGHTCACHE_UPDATE_WORLD | LIGHTCACHE_UPDATE_CUBE | - LIGHTCACHE_UPDATE_GRID; - lbake->lcache->vis_res = lbake->vis_res; + lbake->own_light_cache = true; eevee->light_cache_data = lbake->lcache; @@ -649,7 +709,7 @@ wmJob *EEVEE_lightbake_job_create(struct wmWindowManager *wm, lbake->delay = delay; lbake->frame = frame; - if (lbake->gl_context == NULL) { + if (lbake->gl_context == NULL && !GPU_use_main_context_workaround()) { lbake->gl_context = WM_opengl_context_create(); wm_window_reset_drawable(); } @@ -694,7 +754,7 @@ void *EEVEE_lightbake_job_data_alloc(struct Main *bmain, lbake->mutex = BLI_mutex_alloc(); lbake->frame = frame; - if (run_as_job) { + if (run_as_job && !GPU_use_main_context_workaround()) { lbake->gl_context = WM_opengl_context_create(); wm_window_reset_drawable(); } @@ -801,11 +861,6 @@ static void eevee_lightbake_cache_create(EEVEE_Data *vedata, EEVEE_LightBake *lb DRW_view_set_active(view); } - if (sldata->common_ubo == NULL) { - sldata->common_ubo = DRW_uniformbuffer_create(sizeof(sldata->common_data), - &sldata->common_data); - } - /* HACK: set txl->color but unset it before Draw Manager frees it. */ txl->color = lbake->rt_color; int viewport_size[2] = { @@ -1269,6 +1324,17 @@ void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float * We cannot do it in the main thread. */ eevee_lightbake_context_enable(lbake); eevee_lightbake_create_resources(lbake); + + /* Resource allocation can fail. Early exit in this case. */ + if (lbake->lcache->flag & LIGHTCACHE_INVALID) { + *lbake->stop = 1; + *lbake->do_update = 1; + lbake->lcache->flag &= ~LIGHTCACHE_BAKING; + eevee_lightbake_context_disable(lbake); + eevee_lightbake_delete_resources(lbake); + return; + } + eevee_lightbake_create_render_target(lbake, lbake->rt_res); eevee_lightbake_context_disable(lbake); diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.h b/source/blender/draw/engines/eevee/eevee_lightcache.h index 0db36ce0c2e..834f0fc8a45 100644 --- a/source/blender/draw/engines/eevee/eevee_lightcache.h +++ b/source/blender/draw/engines/eevee/eevee_lightcache.h @@ -20,8 +20,7 @@ * \ingroup eevee */ -#ifndef __EEVEE_LIGHTCACHE_H__ -#define __EEVEE_LIGHTCACHE_H__ +#pragma once #include "BLI_sys_types.h" /* for bool */ @@ -62,5 +61,3 @@ struct LightCache *EEVEE_lightcache_create(const int grid_len, void EEVEE_lightcache_free(struct LightCache *lcache); bool EEVEE_lightcache_load(struct LightCache *lcache); void EEVEE_lightcache_info_update(struct SceneEEVEE *eevee); - -#endif /* __EEVEE_LIGHTCACHE_H__ */ diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 72187dc29eb..a2f7686619f 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -23,6 +23,7 @@ #include "DRW_render.h" #include "BLI_rand.h" +#include "BLI_string_utils.h" #include "BLI_utildefines.h" #include "DNA_image_types.h" @@ -161,6 +162,7 @@ void EEVEE_lightprobes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) const DRWContextState *draw_ctx = DRW_context_state_get(); const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph); + vedata->info[0] = '\0'; if (!e_data.hammersley) { EEVEE_shaders_lightprobe_shaders_init(); @@ -176,6 +178,13 @@ void EEVEE_lightprobes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) stl->g_data->light_cache = scene_eval->eevee.light_cache_data; } else { + if (scene_eval->eevee.light_cache_data && + (scene_eval->eevee.light_cache_data->flag & LIGHTCACHE_NOT_USABLE)) { + /* Error message info. */ + BLI_snprintf( + vedata->info, sizeof(vedata->info), "Error: LightCache cannot be loaded on this GPU"); + } + if (!sldata->fallback_lightcache) { #if defined(IRRADIANCE_SH_L2) int grid_res = 4; diff --git a/source/blender/draw/engines/eevee/eevee_lut.h b/source/blender/draw/engines/eevee/eevee_lut.h index 04049efd758..d5dbf8ce690 100644 --- a/source/blender/draw/engines/eevee/eevee_lut.h +++ b/source/blender/draw/engines/eevee/eevee_lut.h @@ -21,8 +21,7 @@ * \ingroup gpu */ -#ifndef __EEVEE_LUT_H__ -#define __EEVEE_LUT_H__ +#pragma once extern const float ltc_mat_ggx[64 * 64 * 4]; extern const float ltc_mag_ggx[64 * 64 * 2]; @@ -30,5 +29,3 @@ extern const float bsdf_split_sum_ggx[64 * 64 * 2]; extern const float ltc_disk_integral[64 * 64]; extern const float btdf_split_sum_ggx[32][64 * 64]; extern const float blue_noise[64 * 64][4]; - -#endif /* __EEVEE_LUT_H__ */ diff --git a/source/blender/draw/engines/eevee/eevee_motion_blur.c b/source/blender/draw/engines/eevee/eevee_motion_blur.c index 586ee780f1d..91a9939cd1f 100644 --- a/source/blender/draw/engines/eevee/eevee_motion_blur.c +++ b/source/blender/draw/engines/eevee/eevee_motion_blur.c @@ -37,6 +37,7 @@ #include "DNA_mesh_types.h" #include "DNA_modifier_types.h" #include "DNA_particle_types.h" +#include "DNA_rigidbody_types.h" #include "DNA_screen_types.h" #include "ED_screen.h" @@ -288,8 +289,14 @@ void EEVEE_motion_blur_hair_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata), /* Store transform */ DRW_hair_duplimat_get(ob, psys, md, mb_data->obmat[mb_step]); - EEVEE_GeometryMotionData *mb_geom = EEVEE_motion_blur_geometry_data_get( - &effects->motion_blur, ob, true); + EEVEE_HairMotionData *mb_hair = EEVEE_motion_blur_hair_data_get(&effects->motion_blur, ob); + int psys_id = (md != NULL) ? BLI_findindex(&ob->modifiers, md) : 0; + + if (psys_id >= mb_hair->psys_len) { + /* This should never happen. It means the modifier list was changed by frame evaluation. */ + BLI_assert(0); + return; + } if (mb_step == MB_CURR) { /* Fill missing matrices if the object was hidden in previous or next frame. */ @@ -300,18 +307,21 @@ void EEVEE_motion_blur_hair_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata), copy_m4_m4(mb_data->obmat[MB_NEXT], mb_data->obmat[MB_CURR]); } + GPUTexture *tex_prev = mb_hair->psys[psys_id].hair_pos_tx[MB_PREV]; + GPUTexture *tex_next = mb_hair->psys[psys_id].hair_pos_tx[MB_NEXT]; + grp = DRW_shgroup_hair_create_sub(ob, psys, md, effects->motion_blur.hair_grp); DRW_shgroup_uniform_mat4(grp, "prevModelMatrix", mb_data->obmat[MB_PREV]); DRW_shgroup_uniform_mat4(grp, "currModelMatrix", mb_data->obmat[MB_CURR]); DRW_shgroup_uniform_mat4(grp, "nextModelMatrix", mb_data->obmat[MB_NEXT]); - DRW_shgroup_uniform_texture(grp, "prvBuffer", mb_geom->hair_pos_tx[MB_PREV]); - DRW_shgroup_uniform_texture(grp, "nxtBuffer", mb_geom->hair_pos_tx[MB_NEXT]); - DRW_shgroup_uniform_bool(grp, "useDeform", &mb_geom->use_deform, 1); + DRW_shgroup_uniform_texture(grp, "prvBuffer", tex_prev); + DRW_shgroup_uniform_texture(grp, "nxtBuffer", tex_next); + DRW_shgroup_uniform_bool(grp, "useDeform", &mb_hair->use_deform, 1); } else { /* Store vertex position buffer. */ - mb_geom->hair_pos[mb_step] = DRW_hair_pos_buffer_get(ob, psys, md); - mb_geom->use_deform = true; + mb_hair->psys[psys_id].hair_pos[mb_step] = DRW_hair_pos_buffer_get(ob, psys, md); + mb_hair->use_deform = true; } } } @@ -329,10 +339,21 @@ void EEVEE_motion_blur_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata), return; } - const bool is_dupli = (ob->base_flag & BASE_FROM_DUPLI) != 0; + RigidBodyOb *rbo = ob->rigidbody_object; + + /* active rigidbody objects only, as only those are affected by sim. */ + const bool has_rigidbody = (rbo && (rbo->type == RBO_TYPE_ACTIVE)); +#if 0 /* For now we assume dupli objects are moving. */ - const bool object_moves = is_dupli || BKE_object_moves_in_time(ob, true); - const bool is_deform = BKE_object_is_deform_modified(DRW_context_state_get()->scene, ob); + const bool is_dupli = (ob->base_flag & BASE_FROM_DUPLI) != 0; + const bool object_moves = is_dupli || has_rigidbody || BKE_object_moves_in_time(ob, true); +#else + /* BKE_object_moves_in_time does not work in some cases. + * Better detect non moving object after evaluation. */ + const bool object_moves = true; +#endif + const bool is_deform = BKE_object_is_deform_modified(DRW_context_state_get()->scene, ob) || + (has_rigidbody && (rbo->flag & RBO_FLAG_USE_DEFORM) != 0); if (!(object_moves || is_deform)) { return; @@ -346,8 +367,8 @@ void EEVEE_motion_blur_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata), /* Store transform */ copy_m4_m4(mb_data->obmat[mb_step], ob->obmat); - EEVEE_GeometryMotionData *mb_geom = EEVEE_motion_blur_geometry_data_get( - &effects->motion_blur, ob, false); + EEVEE_GeometryMotionData *mb_geom = EEVEE_motion_blur_geometry_data_get(&effects->motion_blur, + ob); if (mb_step == MB_CURR) { GPUBatch *batch = DRW_cache_object_surface_get(ob); @@ -363,6 +384,18 @@ void EEVEE_motion_blur_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata), copy_m4_m4(mb_data->obmat[MB_NEXT], mb_data->obmat[MB_CURR]); } + if (mb_geom->use_deform) { + /* Keep to modify later (after init). */ + mb_geom->batch = batch; + } + + /* Avoid drawing object that has no motions since object_moves is always true. */ + if (!mb_geom->use_deform && /* Object deformation can happen without transform. */ + equals_m4m4(mb_data->obmat[MB_PREV], mb_data->obmat[MB_CURR]) && + equals_m4m4(mb_data->obmat[MB_NEXT], mb_data->obmat[MB_CURR])) { + return; + } + grp = DRW_shgroup_create(e_data.motion_blur_object_sh, psl->velocity_object); DRW_shgroup_uniform_mat4(grp, "prevModelMatrix", mb_data->obmat[MB_PREV]); DRW_shgroup_uniform_mat4(grp, "currModelMatrix", mb_data->obmat[MB_CURR]); @@ -370,22 +403,6 @@ void EEVEE_motion_blur_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata), DRW_shgroup_uniform_bool(grp, "useDeform", &mb_geom->use_deform, 1); DRW_shgroup_call(grp, batch, ob); - - if (mb_geom->use_deform) { - EEVEE_ObjectEngineData *oedata = EEVEE_object_data_ensure(ob); - if (!oedata->geom_update) { - /* FIXME(fclem) There can be false positive where the actual mesh is not updated. - * This avoids a crash but removes the motion blur from some object. - * Maybe an issue with depsgraph tagging. */ - mb_geom->use_deform = false; - oedata->geom_update = false; - - GPU_VERTBUF_DISCARD_SAFE(mb_geom->vbo[MB_PREV]); - GPU_VERTBUF_DISCARD_SAFE(mb_geom->vbo[MB_NEXT]); - } - /* Keep to modify later (after init). */ - mb_geom->batch = batch; - } } else if (is_deform) { /* Store vertex position buffer. */ @@ -427,29 +444,36 @@ void EEVEE_motion_blur_cache_finish(EEVEE_Data *vedata) BLI_ghashIterator_done(&ghi) == false; BLI_ghashIterator_step(&ghi)) { EEVEE_GeometryMotionData *mb_geom = BLI_ghashIterator_getValue(&ghi); + EEVEE_HairMotionData *mb_hair = (EEVEE_HairMotionData *)mb_geom; if (!mb_geom->use_deform) { continue; } switch (mb_geom->type) { - case EEVEE_HAIR_GEOM_MOTION_DATA: + case EEVEE_MOTION_DATA_HAIR: if (mb_step == MB_CURR) { /* TODO(fclem) Check if vertex count mismatch. */ - mb_geom->use_deform = true; + mb_hair->use_deform = true; } else { - mb_geom->hair_pos[mb_step] = GPU_vertbuf_duplicate(mb_geom->hair_pos[mb_step]); + for (int i = 0; i < mb_hair->psys_len; i++) { + if (mb_hair->psys[i].hair_pos[mb_step] == NULL) { + continue; + } + mb_hair->psys[i].hair_pos[mb_step] = GPU_vertbuf_duplicate( + mb_hair->psys[i].hair_pos[mb_step]); - /* Create vbo immediately to bind to texture buffer. */ - GPU_vertbuf_use(mb_geom->hair_pos[mb_step]); + /* Create vbo immediately to bind to texture buffer. */ + GPU_vertbuf_use(mb_hair->psys[i].hair_pos[mb_step]); - mb_geom->hair_pos_tx[mb_step] = GPU_texture_create_from_vertbuf( - mb_geom->hair_pos[mb_step]); + mb_hair->psys[i].hair_pos_tx[mb_step] = GPU_texture_create_from_vertbuf( + mb_hair->psys[i].hair_pos[mb_step]); + } } break; - case EEVEE_MESH_GEOM_MOTION_DATA: + case EEVEE_MOTION_DATA_MESH: if (mb_step == MB_CURR) { /* Modify batch to have data from adjacent frames. */ GPUBatch *batch = mb_geom->batch; @@ -468,14 +492,7 @@ void EEVEE_motion_blur_cache_finish(EEVEE_Data *vedata) } else { /* Modify the batch to include the previous & next position. */ - if (i == MB_PREV) { - GPU_batch_vertbuf_add_ex(batch, vbo, true); - mb_geom->vbo[i] = NULL; - } - else { - /* This VBO can be reuse by next time step. Don't pass ownership. */ - GPU_batch_vertbuf_add_ex(batch, vbo, false); - } + GPU_batch_vertbuf_add_ex(batch, vbo, false); } } } @@ -531,16 +548,28 @@ void EEVEE_motion_blur_swap_data(EEVEE_Data *vedata) BLI_ghashIterator_done(&ghi) == false; BLI_ghashIterator_step(&ghi)) { EEVEE_GeometryMotionData *mb_geom = BLI_ghashIterator_getValue(&ghi); + EEVEE_HairMotionData *mb_hair = (EEVEE_HairMotionData *)mb_geom; switch (mb_geom->type) { - case EEVEE_HAIR_GEOM_MOTION_DATA: - GPU_VERTBUF_DISCARD_SAFE(mb_geom->hair_pos[MB_PREV]); - DRW_TEXTURE_FREE_SAFE(mb_geom->hair_pos_tx[MB_PREV]); - mb_geom->hair_pos[MB_PREV] = mb_geom->hair_pos[MB_NEXT]; - mb_geom->hair_pos_tx[MB_PREV] = mb_geom->hair_pos_tx[MB_NEXT]; + case EEVEE_MOTION_DATA_HAIR: + for (int i = 0; i < mb_hair->psys_len; i++) { + GPU_VERTBUF_DISCARD_SAFE(mb_hair->psys[i].hair_pos[MB_PREV]); + DRW_TEXTURE_FREE_SAFE(mb_hair->psys[i].hair_pos_tx[MB_PREV]); + mb_hair->psys[i].hair_pos[MB_PREV] = mb_hair->psys[i].hair_pos[MB_NEXT]; + mb_hair->psys[i].hair_pos_tx[MB_PREV] = mb_hair->psys[i].hair_pos_tx[MB_NEXT]; + } break; - case EEVEE_MESH_GEOM_MOTION_DATA: + case EEVEE_MOTION_DATA_MESH: + if (mb_geom->batch != NULL) { + for (int i = 0; i < GPU_BATCH_VBO_MAX_LEN; i++) { + if (mb_geom->batch->verts[i] == mb_geom->vbo[MB_PREV] || + mb_geom->batch->verts[i] == mb_geom->vbo[MB_NEXT]) { + /* Avoid double reference of the VBOs. */ + mb_geom->batch->verts[i] = NULL; + } + } + } GPU_VERTBUF_DISCARD_SAFE(mb_geom->vbo[MB_PREV]); mb_geom->vbo[MB_PREV] = mb_geom->vbo[MB_NEXT]; diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index 81a50d36e17..8d11a3e5dc1 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -20,8 +20,7 @@ * \ingroup DNA */ -#ifndef __EEVEE_PRIVATE_H__ -#define __EEVEE_PRIVATE_H__ +#pragma once #include "DRW_render.h" @@ -29,6 +28,8 @@ #include "DNA_lightprobe_types.h" +#include "GPU_viewport.h" + #include "BKE_camera.h" struct EEVEE_ShadowCasterBuffer; @@ -594,25 +595,30 @@ typedef struct EEVEE_ObjectMotionData { } EEVEE_ObjectMotionData; typedef enum eEEVEEMotionData { - EEVEE_MESH_GEOM_MOTION_DATA = 0, - EEVEE_HAIR_GEOM_MOTION_DATA, + EEVEE_MOTION_DATA_MESH = 0, + EEVEE_MOTION_DATA_HAIR, } eEEVEEMotionData; +typedef struct EEVEE_HairMotionData { + /** Needs to be first to ensure casting. */ + eEEVEEMotionData type; + int use_deform; + /** Allocator will alloc enough slot for all particle systems. Or 1 if it's a hair object. */ + int psys_len; + struct { + struct GPUVertBuf *hair_pos[2]; /* Position buffer for time = t +/- step. */ + struct GPUTexture *hair_pos_tx[2]; /* Buffer Texture of the corresponding VBO. */ + } psys[0]; +} EEVEE_HairMotionData; + typedef struct EEVEE_GeometryMotionData { + /** Needs to be first to ensure casting. */ eEEVEEMotionData type; - int use_deform; /* To disable deform mb if vertcount mismatch. */ - union { - struct { - /* Mesh */ - struct GPUBatch *batch; /* Batch for time = t. */ - struct GPUVertBuf *vbo[2]; /* Vbo for time = t +/- step. */ - }; - struct { - /* Hair */ - struct GPUVertBuf *hair_pos[2]; /* Position buffer for time = t +/- step. */ - struct GPUTexture *hair_pos_tx[2]; /* Buffer Texture of the corresponding VBO. */ - }; - }; + /** To disable deform mb if vertcount mismatch. */ + int use_deform; + + struct GPUBatch *batch; /* Batch for time = t. */ + struct GPUVertBuf *vbo[2]; /* Vbo for time = t +/- step. */ } EEVEE_GeometryMotionData; /* ************ EFFECTS DATA ************* */ @@ -891,6 +897,7 @@ typedef struct EEVEE_Data { EEVEE_TextureList *txl; EEVEE_PassList *psl; EEVEE_StorageList *stl; + char info[GPU_INFO_SIZE]; } EEVEE_Data; typedef struct EEVEE_PrivateData { @@ -910,8 +917,12 @@ typedef struct EEVEE_PrivateData { /* Render Matrices */ float studiolight_matrix[3][3]; float overscan, overscan_pixels; + float camtexcofac[4]; float size_orig[2]; + /* Cached original camera when rendering for motion blur (see T79637). */ + struct Object *cam_original_ob; + /* Mist Settings */ float mist_start, mist_inv_dist, mist_falloff; @@ -968,8 +979,8 @@ EEVEE_ObjectMotionData *EEVEE_motion_blur_object_data_get(EEVEE_MotionBlurData * Object *ob, bool hair); EEVEE_GeometryMotionData *EEVEE_motion_blur_geometry_data_get(EEVEE_MotionBlurData *mb, - Object *ob, - bool hair); + Object *ob); +EEVEE_HairMotionData *EEVEE_motion_blur_hair_data_get(EEVEE_MotionBlurData *mb, Object *ob); EEVEE_LightProbeEngineData *EEVEE_lightprobe_data_get(Object *ob); EEVEE_LightProbeEngineData *EEVEE_lightprobe_data_ensure(Object *ob); EEVEE_LightEngineData *EEVEE_light_data_get(Object *ob); @@ -1280,6 +1291,9 @@ bool EEVEE_render_init(EEVEE_Data *vedata, void EEVEE_render_view_sync(EEVEE_Data *vedata, struct RenderEngine *engine, struct Depsgraph *depsgraph); +void EEVEE_render_modules_init(EEVEE_Data *vedata, + struct RenderEngine *engine, + struct Depsgraph *depsgraph); void EEVEE_render_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata); void EEVEE_render_cache(void *vedata, struct Object *ob, @@ -1351,5 +1365,3 @@ static const float cubefacemat[6][4][4] = { {0.0f, 0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, }; - -#endif /* __EEVEE_PRIVATE_H__ */ diff --git a/source/blender/draw/engines/eevee/eevee_render.c b/source/blender/draw/engines/eevee/eevee_render.c index 787fc16a7da..3a99bd1b18e 100644 --- a/source/blender/draw/engines/eevee/eevee_render.c +++ b/source/blender/draw/engines/eevee/eevee_render.c @@ -53,11 +53,9 @@ bool EEVEE_render_init(EEVEE_Data *ved, RenderEngine *engine, struct Depsgraph * EEVEE_StorageList *stl = vedata->stl; EEVEE_TextureList *txl = vedata->txl; EEVEE_FramebufferList *fbl = vedata->fbl; - EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_ensure(); Scene *scene = DEG_get_evaluated_scene(depsgraph); const float *size_orig = DRW_viewport_size_get(); float size_final[2]; - float camtexcofac[4]; /* Init default FB and render targets: * In render mode the default framebuffer is not generated @@ -75,6 +73,7 @@ bool EEVEE_render_init(EEVEE_Data *ved, RenderEngine *engine, struct Depsgraph * g_data->valid_double_buffer = 0; copy_v2_v2(g_data->size_orig, size_orig); + float *camtexcofac = g_data->camtexcofac; if (scene->eevee.flag & SCE_EEVEE_OVERSCAN) { g_data->overscan = scene->eevee.overscan / 100.0f; g_data->overscan_pixels = roundf(max_ff(size_orig[0], size_orig[1]) * g_data->overscan); @@ -125,19 +124,23 @@ bool EEVEE_render_init(EEVEE_Data *ved, RenderEngine *engine, struct Depsgraph * GPU_framebuffer_ensure_config(&fbl->main_color_fb, {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->color)}); - /* Alloc common ubo data. */ - if (sldata->common_ubo == NULL) { - sldata->common_ubo = DRW_uniformbuffer_create(sizeof(sldata->common_data), - &sldata->common_data); - } + /* Camera could change because of Motion blur. */ + g_data->cam_original_ob = RE_GetCamera(engine->re); - EEVEE_render_view_sync(vedata, engine, depsgraph); + return true; +} +void EEVEE_render_modules_init(EEVEE_Data *vedata, + RenderEngine *engine, + struct Depsgraph *depsgraph) +{ + EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_ensure(); + EEVEE_StorageList *stl = vedata->stl; + EEVEE_PrivateData *g_data = vedata->stl->g_data; + EEVEE_FramebufferList *fbl = vedata->fbl; /* TODO(sergey): Shall render hold pointer to an evaluated camera instead? */ - struct Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, RE_GetCamera(engine->re)); - - DRWView *view = (DRWView *)DRW_view_default_get(); - DRW_view_camtexco_set(view, camtexcofac); + struct Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, g_data->cam_original_ob); + EEVEE_render_view_sync(vedata, engine, depsgraph); /* `EEVEE_renderpasses_init` will set the active render passes used by `EEVEE_effects_init`. * `EEVEE_effects_init` needs to go second for TAA. */ @@ -146,8 +149,6 @@ bool EEVEE_render_init(EEVEE_Data *ved, RenderEngine *engine, struct Depsgraph * EEVEE_materials_init(sldata, vedata, stl, fbl); EEVEE_shadows_init(sldata); EEVEE_lightprobes_init(sldata, vedata); - - return true; } void EEVEE_render_view_sync(EEVEE_Data *vedata, RenderEngine *engine, struct Depsgraph *depsgraph) @@ -157,10 +158,10 @@ void EEVEE_render_view_sync(EEVEE_Data *vedata, RenderEngine *engine, struct Dep /* Set the pers & view matrix. */ float winmat[4][4], viewmat[4][4], viewinv[4][4]; /* TODO(sergey): Shall render hold pointer to an evaluated camera instead? */ - struct Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, RE_GetCamera(engine->re)); + struct Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, g_data->cam_original_ob); RE_GetCameraWindow(engine->re, ob_camera_eval, winmat); - RE_GetCameraWindowWithOverscan(engine->re, winmat, g_data->overscan); + RE_GetCameraWindowWithOverscan(engine->re, g_data->overscan, winmat); RE_GetCameraModelMatrix(engine->re, ob_camera_eval, viewinv); invert_m4_m4(viewmat, viewinv); @@ -169,10 +170,13 @@ void EEVEE_render_view_sync(EEVEE_Data *vedata, RenderEngine *engine, struct Dep DRW_view_reset(); DRW_view_default_set(view); DRW_view_set_active(view); + + DRW_view_camtexco_set(view, g_data->camtexcofac); } void EEVEE_render_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) { + EEVEE_view_layer_data_ensure(); EEVEE_bloom_cache_init(sldata, vedata); EEVEE_depth_of_field_cache_init(sldata, vedata); EEVEE_effects_cache_init(sldata, vedata); diff --git a/source/blender/draw/engines/eevee/eevee_temporal_sampling.c b/source/blender/draw/engines/eevee/eevee_temporal_sampling.c index 997f9a5be9d..01db16b1289 100644 --- a/source/blender/draw/engines/eevee/eevee_temporal_sampling.c +++ b/source/blender/draw/engines/eevee/eevee_temporal_sampling.c @@ -212,7 +212,9 @@ int EEVEE_temporal_sampling_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data * Reset for each "redraw". When rendering using ogl render, * we accumulate the redraw inside the drawing loop in eevee_draw_scene(). **/ - effects->taa_render_sample = 1; + if (DRW_state_is_opengl_render()) { + effects->taa_render_sample = 1; + } effects->bypass_drawing = false; EEVEE_temporal_sampling_create_view(vedata); @@ -269,7 +271,14 @@ int EEVEE_temporal_sampling_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data } } else { - effects->bypass_drawing = true; + const bool all_shaders_compiled = stl->g_data->queued_shaders_count_prev == 0; + /* Fix Texture painting (see T79370) and shader compilation (see T78520). */ + if (DRW_state_is_navigating() || !all_shaders_compiled) { + effects->taa_current_sample = 1; + } + else { + effects->bypass_drawing = true; + } } return repro_flag | EFFECT_TAA | EFFECT_DOUBLE_BUFFER | EFFECT_DEPTH_DOUBLE_BUFFER | diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c index 300022e97a9..a443ec61ceb 100644 --- a/source/blender/draw/engines/eevee/eevee_volumes.c +++ b/source/blender/draw/engines/eevee/eevee_volumes.c @@ -66,6 +66,7 @@ static struct { GPUTexture *dummy_density; GPUTexture *dummy_color; GPUTexture *dummy_flame; + GPUTexture *dummy_missing; GPUTexture *dummy_scatter; GPUTexture *dummy_transmit; @@ -154,6 +155,9 @@ static void eevee_create_shader_volumes(void) const float flame = 0.0f; e_data.dummy_flame = DRW_texture_create_3d(1, 1, 1, GPU_R8, DRW_TEX_WRAP, &flame); + + const float missing[4] = {0.0f, 0.0f, 0.0f, 0.0f}; + e_data.dummy_missing = DRW_texture_create_3d(1, 1, 1, GPU_RGBA8, DRW_TEX_WRAP, missing); } void EEVEE_volumes_set_jitter(EEVEE_ViewLayerData *sldata, uint current_sample) @@ -374,7 +378,7 @@ void EEVEE_volumes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) /* Fix principle volumetric not working with world materials. */ ListBase gpu_grids = GPU_material_volume_grids(mat); LISTBASE_FOREACH (GPUMaterialVolumeGrid *, gpu_grid, &gpu_grids) { - DRW_shgroup_uniform_texture(grp, gpu_grid->sampler_name, e_data.dummy_density); + DRW_shgroup_uniform_texture(grp, gpu_grid->sampler_name, e_data.dummy_missing); } DRW_shgroup_call_procedural_triangles(grp, NULL, common_data->vol_tex_size[2]); @@ -462,7 +466,7 @@ static bool eevee_volume_object_grids_init(Object *ob, ListBase *gpu_grids, DRWS NULL; DRW_shgroup_uniform_texture( - grp, gpu_grid->sampler_name, (drw_grid) ? drw_grid->texture : e_data.dummy_density); + grp, gpu_grid->sampler_name, (drw_grid) ? drw_grid->texture : e_data.dummy_missing); if (drw_grid && multiple_transforms) { /* Specify per-volume transform matrix that is applied after the @@ -857,6 +861,7 @@ void EEVEE_volumes_free(void) DRW_TEXTURE_FREE_SAFE(e_data.dummy_density); DRW_TEXTURE_FREE_SAFE(e_data.dummy_flame); DRW_TEXTURE_FREE_SAFE(e_data.dummy_color); + DRW_TEXTURE_FREE_SAFE(e_data.dummy_missing); DRW_SHADER_FREE_SAFE(e_data.volumetric_clear_sh); DRW_SHADER_FREE_SAFE(e_data.scatter_sh); diff --git a/source/blender/draw/engines/external/external_engine.h b/source/blender/draw/engines/external/external_engine.h index 01edea38ab0..c645fb99e0e 100644 --- a/source/blender/draw/engines/external/external_engine.h +++ b/source/blender/draw/engines/external/external_engine.h @@ -20,9 +20,6 @@ * \ingroup draw_engine */ -#ifndef __EXTERNAL_ENGINE_H__ -#define __EXTERNAL_ENGINE_H__ +#pragma once extern RenderEngineType DRW_engine_viewport_external_type; - -#endif /* __EXTERNAL_ENGINE_H__ */ diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h index 7baca28dca3..a406df530fc 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.h +++ b/source/blender/draw/engines/gpencil/gpencil_engine.h @@ -20,8 +20,7 @@ * \ingroup draw */ -#ifndef __GPENCIL_ENGINE_H__ -#define __GPENCIL_ENGINE_H__ +#pragma once #include "DNA_gpencil_types.h" @@ -439,5 +438,3 @@ void GPENCIL_render_to_image(void *vedata, void gpencil_light_pool_free(void *storage); void gpencil_material_pool_free(void *storage); GPENCIL_ViewLayerData *GPENCIL_view_layer_data_ensure(void); - -#endif /* __GPENCIL_ENGINE_H__ */ diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl index 36fe9df9e5a..c19bf1e7b50 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl @@ -487,7 +487,7 @@ void stroke_vertex() vec2 screen_ofs = miter * y; - /* Reminder: we packed the cap flag into the sign of stength and thickness sign. */ + /* Reminder: we packed the cap flag into the sign of strength and thickness sign. */ if ((is_stroke_start && strength1 > 0.0) || (is_stroke_end && thickness1 > 0.0) || (miter_break && !is_stroke_start && !is_stroke_end)) { screen_ofs += line * x; diff --git a/source/blender/draw/engines/overlay/overlay_engine.h b/source/blender/draw/engines/overlay/overlay_engine.h index 795e3805037..f9f6ee0511c 100644 --- a/source/blender/draw/engines/overlay/overlay_engine.h +++ b/source/blender/draw/engines/overlay/overlay_engine.h @@ -20,9 +20,6 @@ * \ingroup draw_engine */ -#ifndef __OVERLAY_ENGINE_H__ -#define __OVERLAY_ENGINE_H__ +#pragma once extern DrawEngineType draw_engine_overlay_type; - -#endif /* __OVERLAY_ENGINE_H__ */ diff --git a/source/blender/draw/engines/overlay/overlay_extra.c b/source/blender/draw/engines/overlay/overlay_extra.c index 47f05eda58e..0b4d0fcdc11 100644 --- a/source/blender/draw/engines/overlay/overlay_extra.c +++ b/source/blender/draw/engines/overlay/overlay_extra.c @@ -547,7 +547,7 @@ static void OVERLAY_forcefield(OVERLAY_ExtraCallBuffers *cb, Object *ob, ViewLay if (cu && (cu->flag & CU_PATH) && ob->runtime.curve_cache->path && ob->runtime.curve_cache->path->data) { instdata.size_x = instdata.size_y = instdata.size_z = pd->f_strength; - float pos[3], tmp[3]; + float pos[4], tmp[3]; where_on_path(ob, 0.0f, pos, tmp, NULL, NULL, NULL); copy_v3_v3(instdata.pos, ob->obmat[3]); translate_m4(instdata.mat, pos[0], pos[1], pos[2]); diff --git a/source/blender/draw/engines/overlay/overlay_private.h b/source/blender/draw/engines/overlay/overlay_private.h index efb9594f499..a8ac2616c02 100644 --- a/source/blender/draw/engines/overlay/overlay_private.h +++ b/source/blender/draw/engines/overlay/overlay_private.h @@ -20,8 +20,7 @@ * \ingroup DNA */ -#ifndef __OVERLAY_PRIVATE_H__ -#define __OVERLAY_PRIVATE_H__ +#pragma once #ifdef __APPLE__ # define USE_GEOM_SHADER_WORKAROUND 1 @@ -630,5 +629,3 @@ GPUShader *OVERLAY_shader_xray_fade(void); OVERLAY_InstanceFormats *OVERLAY_shader_instance_formats_get(void); void OVERLAY_shader_free(void); - -#endif /* __OVERLAY_PRIVATE_H__ */ diff --git a/source/blender/draw/engines/select/select_engine.h b/source/blender/draw/engines/select/select_engine.h index 79139d9deaf..2b35cf6bee5 100644 --- a/source/blender/draw/engines/select/select_engine.h +++ b/source/blender/draw/engines/select/select_engine.h @@ -20,8 +20,7 @@ * \ingroup draw_engine */ -#ifndef __SELECT_ENGINE_H__ -#define __SELECT_ENGINE_H__ +#pragma once extern DrawEngineType draw_engine_select_type; extern RenderEngineType DRW_engine_viewport_select_type; @@ -30,5 +29,3 @@ struct SELECTID_Context *DRW_select_engine_context_get(void); struct GPUFrameBuffer *DRW_engine_select_framebuffer_get(void); struct GPUTexture *DRW_engine_select_texture_get(void); - -#endif /* __SELECT_ENGINE_H__ */ diff --git a/source/blender/draw/engines/select/select_private.h b/source/blender/draw/engines/select/select_private.h index 1e99a49252e..763d1a0897d 100644 --- a/source/blender/draw/engines/select/select_private.h +++ b/source/blender/draw/engines/select/select_private.h @@ -20,8 +20,7 @@ * \ingroup draw_engine */ -#ifndef __SELECT_PRIVATE_H__ -#define __SELECT_PRIVATE_H__ +#pragma once #define USE_CAGE_OCCLUSION @@ -78,5 +77,3 @@ void select_id_draw_object(void *vedata, uint *r_vert_offset, uint *r_edge_offset, uint *r_face_offset); - -#endif /* __SELECT_PRIVATE_H__ */ diff --git a/source/blender/draw/engines/workbench/shaders/workbench_prepass_hair_vert.glsl b/source/blender/draw/engines/workbench/shaders/workbench_prepass_hair_vert.glsl index 6a7bc185fe9..3e1ea14f47c 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_prepass_hair_vert.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_prepass_hair_vert.glsl @@ -90,5 +90,5 @@ void main() packed_rough_metal = workbench_float_pair_encode(roughness, metallic); #endif - object_id = int((uint(resource_id) + 1u) & 0xFFu); + object_id = int(uint(resource_handle) & 0xFFFFu) + 1; } diff --git a/source/blender/draw/engines/workbench/shaders/workbench_prepass_pointcloud_vert.glsl b/source/blender/draw/engines/workbench/shaders/workbench_prepass_pointcloud_vert.glsl index 8e5c8a1b21f..6f61874b8f5 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_prepass_pointcloud_vert.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_prepass_pointcloud_vert.glsl @@ -34,5 +34,5 @@ void main() packed_rough_metal = workbench_float_pair_encode(roughness, metallic); #endif - object_id = int((uint(resource_id) + 1u) & 0xFFu); + object_id = int(uint(resource_handle) & 0xFFFFu) + 1; } diff --git a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl index 31e298d1540..1192081caf1 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl @@ -36,5 +36,5 @@ void main() packed_rough_metal = workbench_float_pair_encode(roughness, metallic); #endif - object_id = int((uint(resource_id) + 1u) & 0xFFu); + object_id = int(uint(resource_handle) & 0xFFFFu) + 1; } diff --git a/source/blender/draw/engines/workbench/workbench_engine.h b/source/blender/draw/engines/workbench/workbench_engine.h index eee53fcde07..8fd427c2683 100644 --- a/source/blender/draw/engines/workbench/workbench_engine.h +++ b/source/blender/draw/engines/workbench/workbench_engine.h @@ -20,9 +20,6 @@ * \ingroup draw_engine */ -#ifndef __WORKBENCH_ENGINE_H__ -#define __WORKBENCH_ENGINE_H__ +#pragma once extern RenderEngineType DRW_engine_viewport_workbench_type; - -#endif /* __WORKBENCH_ENGINE_H__ */ diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c index 3fa2e7ef084..4d5a5b163ed 100644 --- a/source/blender/draw/engines/workbench/workbench_materials.c +++ b/source/blender/draw/engines/workbench/workbench_materials.c @@ -231,15 +231,15 @@ DRWShadingGroup *workbench_material_setup_ex(WORKBENCH_PrivateData *wpd, workbench_material_ubo_data(wpd, ob, NULL, &wpd->material_ubo_data_curr[mat_id], color_type); const bool transp = wpd->shading.xray_alpha < 1.0f || ob->color[3] < 1.0f; - DRWShadingGroup *grp = wpd->prepass[transp][infront][datatype].common_shgrp; + DRWShadingGroup **grp = &wpd->prepass[transp][infront][datatype].common_shgrp; if (resource_changed) { - grp = DRW_shgroup_create_sub(grp); - DRW_shgroup_uniform_block(grp, "material_block", wpd->material_ubo_curr); + *grp = DRW_shgroup_create_sub(*grp); + DRW_shgroup_uniform_block(*grp, "material_block", wpd->material_ubo_curr); } if (r_transp && transp) { *r_transp = true; } - return grp; + return *grp; } } } diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h index 244ac695e78..4a6dadc32fd 100644 --- a/source/blender/draw/engines/workbench/workbench_private.h +++ b/source/blender/draw/engines/workbench/workbench_private.h @@ -20,8 +20,7 @@ * \ingroup draw_engine */ -#ifndef __WORKBENCH_PRIVATE_H__ -#define __WORKBENCH_PRIVATE_H__ +#pragma once #include "BKE_studiolight.h" @@ -520,5 +519,3 @@ void workbench_render(void *ved, void workbench_render_update_passes(struct RenderEngine *engine, struct Scene *scene, struct ViewLayer *view_layer); - -#endif diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 7a889d9399e..ab6ea53261f 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -22,8 +22,7 @@ /* This is the Render Functions used by Realtime engines to draw with OpenGL */ -#ifndef __DRW_RENDER_H__ -#define __DRW_RENDER_H__ +#pragma once #include "DRW_engine_types.h" @@ -632,6 +631,10 @@ void DRW_render_object_iter(void *vedata, struct RenderEngine *engine, struct Depsgraph *depsgraph)); void DRW_render_instance_buffer_finish(void); +void DRW_render_set_time(struct RenderEngine *engine, + struct Depsgraph *depsgraph, + int frame, + float subframe); void DRW_render_viewport_size_set(const int size[2]); void DRW_custom_pipeline(DrawEngineType *draw_engine_type, @@ -736,5 +739,3 @@ typedef struct DRWContextState { } DRWContextState; const DRWContextState *DRW_context_state_get(void); - -#endif /* __DRW_RENDER_H__ */ diff --git a/source/blender/draw/intern/draw_cache.h b/source/blender/draw/intern/draw_cache.h index 1ea53c91cb3..2a7448ce877 100644 --- a/source/blender/draw/intern/draw_cache.h +++ b/source/blender/draw/intern/draw_cache.h @@ -20,8 +20,7 @@ * \ingroup draw */ -#ifndef __DRAW_CACHE_H__ -#define __DRAW_CACHE_H__ +#pragma once struct GPUBatch; struct GPUMaterial; @@ -251,5 +250,3 @@ struct GPUBatch *DRW_cache_gpencil_face_wireframe_get(struct Object *ob); struct bGPDstroke *DRW_cache_gpencil_sbuffer_stroke_data_get(struct Object *ob); void DRW_cache_gpencil_sbuffer_clear(struct Object *ob); - -#endif /* __DRAW_CACHE_H__ */ diff --git a/source/blender/draw/intern/draw_cache_extract.h b/source/blender/draw/intern/draw_cache_extract.h index 4156e2e79d8..2653b3127ae 100644 --- a/source/blender/draw/intern/draw_cache_extract.h +++ b/source/blender/draw/intern/draw_cache_extract.h @@ -20,8 +20,7 @@ * \ingroup draw */ -#ifndef __DRAW_CACHE_EXTRACT_H__ -#define __DRAW_CACHE_EXTRACT_H__ +#pragma once struct TaskGraph; @@ -269,5 +268,3 @@ void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph, const Scene *scene, const ToolSettings *ts, const bool use_hide); - -#endif /* __DRAW_CACHE_EXTRACT_H__ */ diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.c b/source/blender/draw/intern/draw_cache_extract_mesh.c index cca8ebcf2a8..63efc82f87e 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh.c +++ b/source/blender/draw/intern/draw_cache_extract_mesh.c @@ -4047,8 +4047,7 @@ static bool bvh_overlap_cb(void *userdata, int index_a, int index_b, int UNUSED( return false; } - return (isect_tri_tri_epsilon_v3( - UNPACK3(tri_a_co), UNPACK3(tri_b_co), ix_pair[0], ix_pair[1], data->epsilon) && + return (isect_tri_tri_v3(UNPACK3(tri_a_co), UNPACK3(tri_b_co), ix_pair[0], ix_pair[1]) && /* if we share a vertex, check the intersection isn't a 'point' */ ((verts_shared == 0) || (len_squared_v3v3(ix_pair[0], ix_pair[1]) > data->epsilon))); } diff --git a/source/blender/draw/intern/draw_cache_impl.h b/source/blender/draw/intern/draw_cache_impl.h index 96d351794e6..784e52cfa17 100644 --- a/source/blender/draw/intern/draw_cache_impl.h +++ b/source/blender/draw/intern/draw_cache_impl.h @@ -20,8 +20,7 @@ * \ingroup draw */ -#ifndef __DRAW_CACHE_IMPL_H__ -#define __DRAW_CACHE_IMPL_H__ +#pragma once struct GPUBatch; struct GPUIndexBuf; @@ -254,5 +253,3 @@ struct GPUBatch *DRW_particles_batch_cache_get_edit_inner_points(struct Object * struct GPUBatch *DRW_particles_batch_cache_get_edit_tip_points(struct Object *object, struct ParticleSystem *psys, struct PTCacheEdit *edit); - -#endif /* __DRAW_CACHE_IMPL_H__ */ diff --git a/source/blender/draw/intern/draw_cache_impl_gpencil.c b/source/blender/draw/intern/draw_cache_impl_gpencil.c index d648245f232..e8355c1d8da 100644 --- a/source/blender/draw/intern/draw_cache_impl_gpencil.c +++ b/source/blender/draw/intern/draw_cache_impl_gpencil.c @@ -272,7 +272,7 @@ static void gpencil_buffer_add_point(gpStrokeVert *verts, int v, bool is_endpoint) { - /* Note: we use the sign of stength and thickness to pass cap flag. */ + /* Note: we use the sign of strength and thickness to pass cap flag. */ const bool round_cap0 = (gps->caps[0] == GP_STROKE_CAP_ROUND); const bool round_cap1 = (gps->caps[1] == GP_STROKE_CAP_ROUND); gpStrokeVert *vert = &verts[v]; diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 410d59b557b..361c66eca6e 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -95,6 +95,11 @@ BLI_INLINE void mesh_cd_layers_type_clear(DRW_MeshCDMask *a) *((uint64_t *)a) = 0; } +BLI_INLINE const Mesh *editmesh_final_or_this(const Mesh *me) +{ + return (me->edit_mesh && me->edit_mesh->mesh_eval_final) ? me->edit_mesh->mesh_eval_final : me; +} + static void mesh_cd_calc_edit_uv_layer(const Mesh *UNUSED(me), DRW_MeshCDMask *cd_used) { cd_used->edit_uv = 1; @@ -132,7 +137,7 @@ BLI_INLINE const CustomData *mesh_cd_vdata_get_from_mesh(const Mesh *me) static void mesh_cd_calc_active_uv_layer(const Mesh *me, DRW_MeshCDMask *cd_used) { - const Mesh *me_final = (me->edit_mesh) ? me->edit_mesh->mesh_eval_final : me; + const Mesh *me_final = editmesh_final_or_this(me); const CustomData *cd_ldata = mesh_cd_ldata_get_from_mesh(me_final); int layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPUV); if (layer != -1) { @@ -142,7 +147,7 @@ static void mesh_cd_calc_active_uv_layer(const Mesh *me, DRW_MeshCDMask *cd_used static void mesh_cd_calc_active_mask_uv_layer(const Mesh *me, DRW_MeshCDMask *cd_used) { - const Mesh *me_final = (me->edit_mesh) ? me->edit_mesh->mesh_eval_final : me; + const Mesh *me_final = editmesh_final_or_this(me); const CustomData *cd_ldata = mesh_cd_ldata_get_from_mesh(me_final); int layer = CustomData_get_stencil_layer(cd_ldata, CD_MLOOPUV); if (layer != -1) { @@ -152,7 +157,7 @@ static void mesh_cd_calc_active_mask_uv_layer(const Mesh *me, DRW_MeshCDMask *cd static void mesh_cd_calc_active_vcol_layer(const Mesh *me, DRW_MeshCDMask *cd_used) { - const Mesh *me_final = (me->edit_mesh) ? me->edit_mesh->mesh_eval_final : me; + const Mesh *me_final = editmesh_final_or_this(me); const CustomData *cd_vdata = mesh_cd_vdata_get_from_mesh(me_final); int layer = CustomData_get_active_layer(cd_vdata, CD_PROP_COLOR); @@ -163,7 +168,7 @@ static void mesh_cd_calc_active_vcol_layer(const Mesh *me, DRW_MeshCDMask *cd_us static void mesh_cd_calc_active_mloopcol_layer(const Mesh *me, DRW_MeshCDMask *cd_used) { - const Mesh *me_final = (me->edit_mesh) ? me->edit_mesh->mesh_eval_final : me; + const Mesh *me_final = editmesh_final_or_this(me); const CustomData *cd_ldata = &me_final->ldata; int layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPCOL); @@ -176,7 +181,7 @@ static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const Mesh *me, struct GPUMaterial **gpumat_array, int gpumat_array_len) { - const Mesh *me_final = (me->edit_mesh) ? me->edit_mesh->mesh_eval_final : me; + const Mesh *me_final = editmesh_final_or_this(me); const CustomData *cd_ldata = mesh_cd_ldata_get_from_mesh(me_final); const CustomData *cd_vdata = mesh_cd_vdata_get_from_mesh(me_final); @@ -1269,9 +1274,11 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph, FOREACH_MESH_BUFFER_CACHE (cache, mbuffercache) { GPU_VERTBUF_DISCARD_SAFE(mbuffercache->vbo.edituv_data); GPU_VERTBUF_DISCARD_SAFE(mbuffercache->vbo.fdots_uv); + GPU_VERTBUF_DISCARD_SAFE(mbuffercache->vbo.fdots_edituv_data); GPU_INDEXBUF_DISCARD_SAFE(mbuffercache->ibo.edituv_tris); GPU_INDEXBUF_DISCARD_SAFE(mbuffercache->ibo.edituv_lines); GPU_INDEXBUF_DISCARD_SAFE(mbuffercache->ibo.edituv_points); + GPU_INDEXBUF_DISCARD_SAFE(mbuffercache->ibo.edituv_fdots); } /* We only clear the batches as they may already have been * referenced. */ diff --git a/source/blender/draw/intern/draw_cache_inline.h b/source/blender/draw/intern/draw_cache_inline.h index 67f44b5fb0c..bb3a908c6c5 100644 --- a/source/blender/draw/intern/draw_cache_inline.h +++ b/source/blender/draw/intern/draw_cache_inline.h @@ -20,8 +20,7 @@ * \ingroup draw */ -#ifndef __DRAW_CACHE_INLINE_H__ -#define __DRAW_CACHE_INLINE_H__ +#pragma once #include "GPU_batch.h" #include "MEM_guardedalloc.h" @@ -110,5 +109,3 @@ BLI_INLINE bool DRW_vbo_requested(GPUVertBuf *vbo) { return (vbo != NULL && vbo->format.attr_len == 0); } - -#endif /* __DRAW_CACHE_INLINE_H__ */ diff --git a/source/blender/draw/intern/draw_color_management.h b/source/blender/draw/intern/draw_color_management.h index 9d83eccdce9..3150ec72138 100644 --- a/source/blender/draw/intern/draw_color_management.h +++ b/source/blender/draw/intern/draw_color_management.h @@ -20,9 +20,6 @@ * \ingroup draw */ -#ifndef __DRAW_COLOR_MANAGEMENT_H__ -#define __DRAW_COLOR_MANAGEMENT_H__ +#pragma once void DRW_transform_none(struct GPUTexture *tex); - -#endif /* __DRAW_COLOR_MANAGEMENT_H__ */ diff --git a/source/blender/draw/intern/draw_common.h b/source/blender/draw/intern/draw_common.h index 81c0e97a1a8..d7bb9b78e09 100644 --- a/source/blender/draw/intern/draw_common.h +++ b/source/blender/draw/intern/draw_common.h @@ -20,8 +20,7 @@ * \ingroup draw */ -#ifndef __DRAW_COMMON_H__ -#define __DRAW_COMMON_H__ +#pragma once struct DRWPass; struct DRWShadingGroup; @@ -203,5 +202,3 @@ struct DRW_Global { struct GPUUniformBuffer *view_ubo; }; extern struct DRW_Global G_draw; - -#endif /* __DRAW_COMMON_H__ */ diff --git a/source/blender/draw/intern/draw_debug.h b/source/blender/draw/intern/draw_debug.h index e7404b17384..149825974d4 100644 --- a/source/blender/draw/intern/draw_debug.h +++ b/source/blender/draw/intern/draw_debug.h @@ -20,8 +20,7 @@ * \ingroup draw */ -#ifndef __DRAW_DEBUG_H__ -#define __DRAW_DEBUG_H__ +#pragma once struct BoundBox; @@ -34,5 +33,3 @@ void DRW_debug_m4(const float m[4][4]); void DRW_debug_m4_as_bbox(const float m[4][4], const float color[4], const bool invert); void DRW_debug_bbox(const BoundBox *bbox, const float color[4]); void DRW_debug_sphere(const float center[3], const float radius, const float color[4]); - -#endif /* __DRAW_DEBUG_H__ */ diff --git a/source/blender/draw/intern/draw_hair_private.h b/source/blender/draw/intern/draw_hair_private.h index b599ad389c1..33abae156cc 100644 --- a/source/blender/draw/intern/draw_hair_private.h +++ b/source/blender/draw/intern/draw_hair_private.h @@ -21,8 +21,7 @@ * \ingroup draw */ -#ifndef __DRAW_HAIR_PRIVATE_H__ -#define __DRAW_HAIR_PRIVATE_H__ +#pragma once #define MAX_LAYER_NAME_CT 4 /* u0123456789, u, au, a0123456789 */ #define MAX_LAYER_NAME_LEN GPU_MAX_SAFE_ATTR_NAME + 2 @@ -92,5 +91,3 @@ bool hair_ensure_procedural_data(struct Object *object, struct ParticleHairCache **r_hair_cache, int subdiv, int thickness_res); - -#endif /* __DRAW_HAIR_PRIVATE_H__ */ diff --git a/source/blender/draw/intern/draw_instance_data.h b/source/blender/draw/intern/draw_instance_data.h index f891d380ee3..e562d99097e 100644 --- a/source/blender/draw/intern/draw_instance_data.h +++ b/source/blender/draw/intern/draw_instance_data.h @@ -20,8 +20,7 @@ * \ingroup draw */ -#ifndef __DRAW_INSTANCE_DATA_H__ -#define __DRAW_INSTANCE_DATA_H__ +#pragma once #include "BLI_compiler_attrs.h" #include "BLI_sys_types.h" @@ -55,5 +54,3 @@ void DRW_instance_buffer_finish(DRWInstanceDataList *idatalist); void DRW_instance_data_list_reset(DRWInstanceDataList *idatalist); void DRW_instance_data_list_free_unused(DRWInstanceDataList *idatalist); void DRW_instance_data_list_resize(DRWInstanceDataList *idatalist); - -#endif /* __DRAW_INSTANCE_DATA_H__ */ diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 712a93e8880..2beab021cfb 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -1658,7 +1658,6 @@ void DRW_render_gpencil(struct RenderEngine *engine, struct Depsgraph *depsgraph Scene *scene = DEG_get_evaluated_scene(depsgraph); ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); RenderEngineType *engine_type = engine->type; - RenderData *r = &scene->r; Render *render = engine->re; DRW_render_context_enable(render); @@ -1680,7 +1679,7 @@ void DRW_render_gpencil(struct RenderEngine *engine, struct Depsgraph *depsgraph drw_context_state_init(); DST.viewport = GPU_viewport_create(); - const int size[2] = {(r->size * r->xsch) / 100, (r->size * r->ysch) / 100}; + const int size[2] = {engine->resolution_x, engine->resolution_y}; GPU_viewport_size_set(DST.viewport, size); drw_viewport_var_init(); @@ -1954,13 +1953,21 @@ void DRW_render_instance_buffer_finish(void) drw_resource_buffer_finish(DST.vmempool); } +/* WARNING: Changing frame might free the ViewLayerEngineData */ +void DRW_render_set_time(RenderEngine *engine, Depsgraph *depsgraph, int frame, float subframe) +{ + RE_engine_frame_set(engine, frame, subframe); + DST.draw_ctx.scene = DEG_get_evaluated_scene(depsgraph); + DST.draw_ctx.view_layer = DEG_get_evaluated_view_layer(depsgraph); +} + /** * object mode select-loop, see: ED_view3d_draw_select_loop (legacy drawing). */ void DRW_draw_select_loop(struct Depsgraph *depsgraph, ARegion *region, View3D *v3d, - bool UNUSED(use_obedit_skip), + bool use_obedit_skip, bool draw_surface, bool UNUSED(use_nearest), const rcti *rect, @@ -1973,7 +1980,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type); ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); Object *obact = OBACT(view_layer); - Object *obedit = OBEDIT_FROM_OBACT(obact); + Object *obedit = use_obedit_skip ? NULL : OBEDIT_FROM_OBACT(obact); #ifndef USE_GPU_SELECT UNUSED_VARS(scene, view_layer, v3d, region, rect); #else @@ -2719,6 +2726,12 @@ void DRW_render_context_enable(Render *render) WM_init_opengl(G_MAIN); } + if (GPU_use_main_context_workaround()) { + GPU_context_main_lock(); + DRW_opengl_context_enable(); + return; + } + void *re_gl_context = RE_gl_context_get(render); /* Changing Context */ @@ -2736,6 +2749,12 @@ void DRW_render_context_enable(Render *render) void DRW_render_context_disable(Render *render) { + if (GPU_use_main_context_workaround()) { + DRW_opengl_context_disable(); + GPU_context_main_unlock(); + return; + } + void *re_gl_context = RE_gl_context_get(render); if (re_gl_context != NULL) { diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h index a448a94185a..92a01cbbe04 100644 --- a/source/blender/draw/intern/draw_manager.h +++ b/source/blender/draw/intern/draw_manager.h @@ -22,8 +22,7 @@ /* Private functions / structs of the draw manager */ -#ifndef __DRAW_MANAGER_H__ -#define __DRAW_MANAGER_H__ +#pragma once #include "DRW_engine.h" #include "DRW_render.h" @@ -596,5 +595,3 @@ void drw_resource_buffer_finish(ViewportMemoryPool *vmempool); GPUBatch *drw_cache_procedural_points_get(void); GPUBatch *drw_cache_procedural_lines_get(void); GPUBatch *drw_cache_procedural_triangles_get(void); - -#endif /* __DRAW_MANAGER_H__ */ diff --git a/source/blender/draw/intern/draw_manager_profiling.h b/source/blender/draw/intern/draw_manager_profiling.h index 3da6a4c8b1c..3842bdffaff 100644 --- a/source/blender/draw/intern/draw_manager_profiling.h +++ b/source/blender/draw/intern/draw_manager_profiling.h @@ -20,8 +20,7 @@ * \ingroup draw */ -#ifndef __DRAW_MANAGER_PROFILING_H__ -#define __DRAW_MANAGER_PROFILING_H__ +#pragma once struct rcti; @@ -36,5 +35,3 @@ void DRW_stats_query_start(const char *name); void DRW_stats_query_end(void); void DRW_stats_draw(const rcti *rect); - -#endif /* __DRAW_MANAGER_PROFILING_H__ */ diff --git a/source/blender/draw/intern/draw_manager_shader.c b/source/blender/draw/intern/draw_manager_shader.c index 0bb20631537..34069438e47 100644 --- a/source/blender/draw/intern/draw_manager_shader.c +++ b/source/blender/draw/intern/draw_manager_shader.c @@ -34,6 +34,7 @@ #include "DEG_depsgraph_query.h" +#include "GPU_extensions.h" #include "GPU_material.h" #include "GPU_shader.h" @@ -106,6 +107,12 @@ static void drw_deferred_shader_compilation_exec( BLI_assert(gl_context != NULL); #endif + const bool use_main_context_workaround = GPU_use_main_context_workaround(); + if (use_main_context_workaround) { + BLI_assert(gl_context == DST.gl_context); + GPU_context_main_lock(); + } + WM_opengl_context_activate(gl_context); while (true) { @@ -154,6 +161,9 @@ static void drw_deferred_shader_compilation_exec( } WM_opengl_context_release(gl_context); + if (use_main_context_workaround) { + GPU_context_main_unlock(); + } } static void drw_deferred_shader_compilation_free(void *custom_data) @@ -196,6 +206,8 @@ static void drw_deferred_shader_add(GPUMaterial *mat, bool deferred) GPU_material_compile(mat); return; } + const bool use_main_context = GPU_use_main_context_workaround(); + const bool job_own_context = !use_main_context; DRWDeferredShader *dsh = MEM_callocN(sizeof(DRWDeferredShader), "Deferred Shader"); @@ -227,7 +239,7 @@ static void drw_deferred_shader_add(GPUMaterial *mat, bool deferred) if (old_comp->gl_context) { comp->gl_context = old_comp->gl_context; old_comp->own_context = false; - comp->own_context = true; + comp->own_context = job_own_context; } } @@ -235,9 +247,14 @@ static void drw_deferred_shader_add(GPUMaterial *mat, bool deferred) /* Create only one context. */ if (comp->gl_context == NULL) { - comp->gl_context = WM_opengl_context_create(); - WM_opengl_context_activate(DST.gl_context); - comp->own_context = true; + if (use_main_context) { + comp->gl_context = DST.gl_context; + } + else { + comp->gl_context = WM_opengl_context_create(); + WM_opengl_context_activate(DST.gl_context); + } + comp->own_context = job_own_context; } WM_jobs_customdata_set(wm_job, comp, drw_deferred_shader_compilation_free); diff --git a/source/blender/draw/intern/draw_manager_text.h b/source/blender/draw/intern/draw_manager_text.h index 66ef2379e38..f6dff335f1f 100644 --- a/source/blender/draw/intern/draw_manager_text.h +++ b/source/blender/draw/intern/draw_manager_text.h @@ -20,8 +20,7 @@ * \ingroup draw */ -#ifndef __DRAW_MANAGER_TEXT_H__ -#define __DRAW_MANAGER_TEXT_H__ +#pragma once struct ARegion; struct DRWTextStore; @@ -58,5 +57,3 @@ enum { /* draw_manager.c */ struct DRWTextStore *DRW_text_cache_ensure(void); - -#endif /* __DRAW_MANAGER_TEXT_H__ */ diff --git a/source/blender/draw/intern/draw_manager_texture.c b/source/blender/draw/intern/draw_manager_texture.c index 77b0462303d..b94a6db3bad 100644 --- a/source/blender/draw/intern/draw_manager_texture.c +++ b/source/blender/draw/intern/draw_manager_texture.c @@ -61,6 +61,10 @@ static bool drw_texture_format_supports_framebuffer(eGPUTextureFormat format) void drw_texture_set_parameters(GPUTexture *tex, DRWTextureFlag flags) { + if (tex == NULL) { + return; + } + if (flags & DRW_TEX_MIPMAP) { GPU_texture_mipmap_mode(tex, true, flags & DRW_TEX_FILTER); GPU_texture_bind(tex, 0); @@ -119,7 +123,6 @@ GPUTexture *DRW_texture_create_cube(int w, { GPUTexture *tex = GPU_texture_create_cube(w, format, fpixels, NULL); drw_texture_set_parameters(tex, flags); - return tex; } @@ -128,7 +131,6 @@ GPUTexture *DRW_texture_create_cube_array( { GPUTexture *tex = GPU_texture_create_cube_array(w, d, format, fpixels, NULL); drw_texture_set_parameters(tex, flags); - return tex; } diff --git a/source/blender/draw/intern/draw_view.h b/source/blender/draw/intern/draw_view.h index 04f7d2bbabb..a01a2d0dcce 100644 --- a/source/blender/draw/intern/draw_view.h +++ b/source/blender/draw/intern/draw_view.h @@ -20,13 +20,10 @@ * \ingroup draw */ -#ifndef __DRAW_VIEW_H__ -#define __DRAW_VIEW_H__ +#pragma once void DRW_draw_region_info(void); void DRW_clear_background(void); void DRW_draw_cursor(void); void DRW_draw_gizmo_3d(void); void DRW_draw_gizmo_2d(void); - -#endif /* __DRAW_VIEW_H__ */ diff --git a/source/blender/draw/intern/shaders/common_view_lib.glsl b/source/blender/draw/intern/shaders/common_view_lib.glsl index 095bc64a19e..c77537bbe48 100644 --- a/source/blender/draw/intern/shaders/common_view_lib.glsl +++ b/source/blender/draw/intern/shaders/common_view_lib.glsl @@ -75,7 +75,7 @@ vec4 pack_line_data(vec2 frag_co, vec2 edge_start, vec2 edge_pos) uniform int resourceChunk; #ifdef GPU_VERTEX_SHADER -# ifdef GL_ARB_shader_draw_parameters +# ifdef GPU_ARB_shader_draw_parameters # define baseInstance gl_BaseInstanceARB # else /* no ARB_shader_draw_parameters */ uniform int baseInstance; diff --git a/source/blender/draw/intern/smaa_textures.h b/source/blender/draw/intern/smaa_textures.h index 43b29340cac..7556f3a1952 100644 --- a/source/blender/draw/intern/smaa_textures.h +++ b/source/blender/draw/intern/smaa_textures.h @@ -26,8 +26,7 @@ * SOFTWARE. */ -#ifndef __SMAA_TEXTURES_H__ -#define __SMAA_TEXTURES_H__ +#pragma once #define AREATEX_WIDTH 160 #define AREATEX_HEIGHT 560 @@ -15083,4 +15082,3 @@ static const unsigned char searchTexBytes[] = { /* clang-format off */ -#endif /* __SMAA_TEXTURES_H__ */ diff --git a/source/blender/editors/animation/anim_intern.h b/source/blender/editors/animation/anim_intern.h index 7fb5540fdf7..fb7b6b8983a 100644 --- a/source/blender/editors/animation/anim_intern.h +++ b/source/blender/editors/animation/anim_intern.h @@ -21,8 +21,7 @@ * \ingroup edanimation */ -#ifndef __ANIM_INTERN_H__ -#define __ANIM_INTERN_H__ +#pragma once /* KeyingSets/Keyframing Interface ------------- */ @@ -77,5 +76,3 @@ void ANIM_OT_driver_button_remove(struct wmOperatorType *ot); void ANIM_OT_driver_button_edit(struct wmOperatorType *ot); void ANIM_OT_copy_driver_button(struct wmOperatorType *ot); void ANIM_OT_paste_driver_button(struct wmOperatorType *ot); - -#endif /* __ANIM_INTERN_H__ */ diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 8c2f4216aa9..66d4882cf9d 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -3025,8 +3025,11 @@ bool ED_autokeyframe_property( bool special; bool changed = false; + /* for entire array buttons we check the first component, it's not perfect + * but works well enough in typical cases */ + const int rnaindex_check = (rnaindex == -1) ? 0 : rnaindex; fcu = BKE_fcurve_find_by_rna_context_ui( - C, ptr, prop, rnaindex, NULL, &action, &driven, &special); + C, ptr, prop, rnaindex_check, NULL, &action, &driven, &special); if (fcu == NULL) { return changed; diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 08d82bf13c9..9a04425a083 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -21,8 +21,7 @@ * \ingroup edarmature */ -#ifndef __ARMATURE_INTERN_H__ -#define __ARMATURE_INTERN_H__ +#pragma once /* internal exports only */ struct wmOperatorType; @@ -289,5 +288,3 @@ int bone_looper(struct Object *ob, struct Bone *bone, void *data, int (*bone_func)(struct Object *, struct Bone *, void *)); - -#endif /* __ARMATURE_INTERN_H__ */ diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index 0dd35fb9fdc..a737916e9a2 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -384,6 +384,7 @@ int ED_armature_join_objects_exec(bContext *C, wmOperator *op) BLI_remlink(curarm->edbo, curbone); BLI_addtail(arm->edbo, curbone); + /* Pose channel is moved from one storage to another, its UUID is still unique. */ BLI_remlink(&opose->chanbase, pchan); BLI_addtail(&pose->chanbase, pchan); BKE_pose_channels_hash_free(opose); diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c index b2e329deee7..04c1ec97841 100644 --- a/source/blender/editors/armature/armature_utils.c +++ b/source/blender/editors/armature/armature_utils.c @@ -229,7 +229,7 @@ EditBone *ED_armature_ebone_find_shared_parent(EditBone *ebone_child[], const ui return NULL; } -void ED_armature_ebone_to_mat3(EditBone *ebone, float mat[3][3]) +void ED_armature_ebone_to_mat3(EditBone *ebone, float r_mat[3][3]) { float delta[3], roll; @@ -246,20 +246,20 @@ void ED_armature_ebone_to_mat3(EditBone *ebone, float mat[3][3]) } } - vec_roll_to_mat3_normalized(delta, roll, mat); + vec_roll_to_mat3_normalized(delta, roll, r_mat); } -void ED_armature_ebone_to_mat4(EditBone *ebone, float mat[4][4]) +void ED_armature_ebone_to_mat4(EditBone *ebone, float r_mat[4][4]) { float m3[3][3]; ED_armature_ebone_to_mat3(ebone, m3); - copy_m4_m3(mat, m3); - copy_v3_v3(mat[3], ebone->head); + copy_m4_m3(r_mat, m3); + copy_v3_v3(r_mat[3], ebone->head); } -void ED_armature_ebone_from_mat3(EditBone *ebone, float mat[3][3]) +void ED_armature_ebone_from_mat3(EditBone *ebone, const float mat[3][3]) { float vec[3], roll; const float len = len_v3v3(ebone->head, ebone->tail); @@ -270,7 +270,7 @@ void ED_armature_ebone_from_mat3(EditBone *ebone, float mat[3][3]) ebone->roll = roll; } -void ED_armature_ebone_from_mat4(EditBone *ebone, float mat[4][4]) +void ED_armature_ebone_from_mat4(EditBone *ebone, const float mat[4][4]) { float mat3[3][3]; diff --git a/source/blender/editors/armature/meshlaplacian.h b/source/blender/editors/armature/meshlaplacian.h index 0a9e6e878e4..0405e361b2f 100644 --- a/source/blender/editors/armature/meshlaplacian.h +++ b/source/blender/editors/armature/meshlaplacian.h @@ -20,8 +20,7 @@ * \ingroup edarmature */ -#ifndef __MESHLAPLACIAN_H__ -#define __MESHLAPLACIAN_H__ +#pragma once //#define RIGID_DEFORM @@ -70,5 +69,3 @@ void rigid_deform_end(int cancel); /* Harmonic Coordinates */ /* ED_mesh_deform_bind_callback(...) defined in ED_armature.h */ - -#endif diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h index 7d0a2e5edbc..4426739e421 100644 --- a/source/blender/editors/curve/curve_intern.h +++ b/source/blender/editors/curve/curve_intern.h @@ -21,8 +21,7 @@ * \ingroup edcurve */ -#ifndef __CURVE_INTERN_H__ -#define __CURVE_INTERN_H__ +#pragma once /* internal exports only */ struct EditNurb; @@ -194,5 +193,3 @@ void ED_curve_nurb_vert_selected_find( /* editcurve_paint.c */ void CURVE_OT_draw(struct wmOperatorType *ot); - -#endif /* __CURVE_INTERN_H__ */ diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt index 0dcb8de37f1..b8cc704eb23 100644 --- a/source/blender/editors/datafiles/CMakeLists.txt +++ b/source/blender/editors/datafiles/CMakeLists.txt @@ -744,6 +744,7 @@ set_property(GLOBAL PROPERTY ICON_GEOM_NAMES ops.pose.relax ops.sculpt.border_hide ops.sculpt.border_mask + ops.sculpt.cloth_filter ops.sculpt.lasso_mask ops.sculpt.mesh_filter ops.sequencer.blade diff --git a/source/blender/editors/gizmo_library/gizmo_geometry.h b/source/blender/editors/gizmo_library/gizmo_geometry.h index a5f61158f66..70f508df8b6 100644 --- a/source/blender/editors/gizmo_library/gizmo_geometry.h +++ b/source/blender/editors/gizmo_library/gizmo_geometry.h @@ -27,8 +27,7 @@ * called geom_xxx_gizmo.c */ -#ifndef __GIZMO_GEOMETRY_H__ -#define __GIZMO_GEOMETRY_H__ +#pragma once #include "BLI_sys_types.h" @@ -48,5 +47,3 @@ extern GizmoGeomInfo wm_gizmo_geom_data_cube; /* dial gizmo */ extern GizmoGeomInfo wm_gizmo_geom_data_dial; - -#endif /* __GIZMO_GEOMETRY_H__ */ diff --git a/source/blender/editors/gizmo_library/gizmo_library_intern.h b/source/blender/editors/gizmo_library/gizmo_library_intern.h index 31decb71c77..f3670708543 100644 --- a/source/blender/editors/gizmo_library/gizmo_library_intern.h +++ b/source/blender/editors/gizmo_library/gizmo_library_intern.h @@ -21,8 +21,7 @@ * \ingroup edgizmolib */ -#ifndef __GIZMO_LIBRARY_INTERN_H__ -#define __GIZMO_LIBRARY_INTERN_H__ +#pragma once /** * Data for common interactions. Used in gizmo_library_utils.c functions. @@ -99,5 +98,3 @@ void wm_gizmo_geometryinfo_draw(const struct GizmoGeomInfo *info, const float color[4]); void wm_gizmo_vec_draw( const float color[4], const float (*verts)[3], uint vert_count, uint pos, uint primitive_type); - -#endif /* __GIZMO_LIBRARY_INTERN_H__ */ diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c index d4d37e7a9b7..21d755bea52 100644 --- a/source/blender/editors/gpencil/gpencil_convert.c +++ b/source/blender/editors/gpencil/gpencil_convert.c @@ -1707,7 +1707,7 @@ void GPENCIL_OT_convert(wmOperatorType *ot) 0, 0, 32, - "Bevel_Resolution", + "Bevel Resolution", "Bevel resolution when depth is non-zero", 0, 32); @@ -1722,7 +1722,7 @@ void GPENCIL_OT_convert(wmOperatorType *ot) 1.0f, 0.0f, 1000.0f, - "Radius Fac", + "Radius Factor", "Multiplier for the points' radii (set from stroke width)", 0.0f, 10.0f); diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index f8010edfcdd..286efeeff01 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -4283,8 +4283,11 @@ static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op) base_new = ED_object_add_duplicate(bmain, scene, view_layer, base_prev, dupflag); ob_dst = base_new->object; ob_dst->mode = OB_MODE_OBJECT; - /* create new grease pencil datablock */ + /* Duplication will increment bGPdata usercount, but since we create a new greasepencil datablock + * for ob_dst (which gets its own user automatically), we have to decrement the usercount again. + */ gpd_dst = BKE_gpencil_data_addnew(bmain, gpd_src->id.name + 2); + id_us_min(ob_dst->data); ob_dst->data = (bGPdata *)gpd_dst; /* loop old datablock and separate parts */ diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index bd697dbc768..66ac7948596 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -21,8 +21,7 @@ * \ingroup edgpencil */ -#ifndef __GPENCIL_INTERN_H__ -#define __GPENCIL_INTERN_H__ +#pragma once #include "DNA_vec_types.h" @@ -731,5 +730,3 @@ struct GP_EditableStrokes_Iter { (void)0 /* ****************************************************** */ - -#endif /* __GPENCIL_INTERN_H__ */ diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c index 179f621205b..3a7029b1288 100644 --- a/source/blender/editors/gpencil/gpencil_interpolate.c +++ b/source/blender/editors/gpencil/gpencil_interpolate.c @@ -136,15 +136,17 @@ static void gpencil_interpolate_free_temp_strokes(bGPDframe *gpf) } /* Helper: Untag all strokes. */ -static void gpencil_interpolate_untag_strokes(bGPDframe *gpf) +static void gpencil_interpolate_untag_strokes(bGPDlayer *gpl) { - if (gpf == NULL) { + if (gpl == NULL) { return; } - LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { - if (gps->flag & GP_STROKE_TAG) { - gps->flag &= ~GP_STROKE_TAG; + LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) { + LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { + if (gps->flag & GP_STROKE_TAG) { + gps->flag &= ~GP_STROKE_TAG; + } } } } @@ -263,15 +265,6 @@ static void gpencil_interpolate_set_points(bContext *C, tGPDinterpolate *tgpi) /* set layers */ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { tGPDinterpolate_layer *tgpil; - - /* Untag strokes to be sure nothing is pending. This must be done for - * all layer because it could be anything tagged and it would be removed - * at the end of the process when all tagged strokes are removed. */ - if (gpl->actframe != NULL) { - gpencil_interpolate_untag_strokes(gpl->actframe); - gpencil_interpolate_untag_strokes(gpl->actframe->next); - } - /* all layers or only active */ if (!(tgpi->flag & GP_TOOLFLAG_INTERPOLATE_ALL_LAYERS) && (gpl != active_gpl)) { continue; @@ -483,6 +476,11 @@ static bool gpencil_interpolate_set_init_values(bContext *C, wmOperator *op, tGP /* set layers */ gpencil_interpolate_set_points(C, tgpi); + /* Untag strokes to be sure nothing is pending due any canceled process. */ + LISTBASE_FOREACH (bGPDlayer *, gpl, &tgpi->gpd->layers) { + gpencil_interpolate_untag_strokes(gpl); + } + return 1; } @@ -606,6 +604,8 @@ static int gpencil_interpolate_modal(bContext *C, wmOperator *op, const wmEvent /* make copy of source stroke, then adjust pointer to points too */ gps_dst = BKE_gpencil_stroke_duplicate(gps_src, true); + gps_dst->flag &= ~GP_STROKE_TAG; + /* Calc geometry data. */ BKE_gpencil_stroke_geometry_update(gps_dst); diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index d3ff7f8a4d2..1880045e238 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -836,7 +836,7 @@ static short gpencil_stroke_addpoint(tGPsdata *p, } /* color strength */ - if (brush_settings->flag & GP_BRUSH_USE_STENGTH_PRESSURE) { + if (brush_settings->flag & GP_BRUSH_USE_STRENGTH_PRESSURE) { pt->strength *= BKE_curvemapping_evaluateF(brush_settings->curve_strength, 0, pressure); CLAMP(pt->strength, GPENCIL_STRENGTH_MIN, 1.0f); } diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c index f206f5c832a..20f959e2e2c 100644 --- a/source/blender/editors/gpencil/gpencil_primitive.c +++ b/source/blender/editors/gpencil/gpencil_primitive.c @@ -412,7 +412,8 @@ static void gpencil_primitive_status_indicators(bContext *C, tGPDprimitive *tgpi } else if (tgpi->type == GP_STROKE_POLYLINE) { BLI_strncpy(msg_str, - TIP_("Line: ESC to cancel, LMB to set, Enter/MMB to confirm, Shift to align"), + TIP_("Polyline: ESC to cancel, LMB to set, Enter/MMB to confirm, WHEEL/+- to " + "adjust subdivision number, Shift to align"), UI_MAX_DRAW_STR); } else if (tgpi->type == GP_STROKE_BOX) { @@ -746,7 +747,7 @@ static void gpencil_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi) if (brush_settings->flag & GP_BRUSH_USE_JITTER_PRESSURE) { BKE_curvemapping_initialize(brush_settings->curve_jitter); } - if (brush_settings->flag & GP_BRUSH_USE_STENGTH_PRESSURE) { + if (brush_settings->flag & GP_BRUSH_USE_STRENGTH_PRESSURE) { BKE_curvemapping_initialize(brush_settings->curve_strength); } @@ -912,7 +913,7 @@ static void gpencil_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi) } /* color strength */ - if (brush_settings->flag & GP_BRUSH_USE_STENGTH_PRESSURE) { + if (brush_settings->flag & GP_BRUSH_USE_STRENGTH_PRESSURE) { float curvef = BKE_curvemapping_evaluateF(brush_settings->curve_strength, 0, curve_pressure); strength *= curvef; strength *= brush_settings->draw_strength; diff --git a/source/blender/editors/gpencil/gpencil_weight_paint.c b/source/blender/editors/gpencil/gpencil_weight_paint.c index e41146575e4..4392ec92824 100644 --- a/source/blender/editors/gpencil/gpencil_weight_paint.c +++ b/source/blender/editors/gpencil/gpencil_weight_paint.c @@ -453,9 +453,9 @@ static void gpencil_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso, /* To each point individually... */ pt = &gps->points[i]; - pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; - index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i; + pt_active = pt->runtime.pt_orig; if (pt_active != NULL) { + index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i; gpencil_save_selected_point(gso, gps_active, index, pc1); } @@ -469,9 +469,9 @@ static void gpencil_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso, */ if (i + 1 == gps->totpoints - 1) { pt = &gps->points[i + 1]; - pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; - index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i + 1; + pt_active = pt->runtime.pt_orig; if (pt_active != NULL) { + index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i + 1; gpencil_save_selected_point(gso, gps_active, index, pc2); include_last = false; } @@ -487,9 +487,9 @@ static void gpencil_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso, * (but wasn't added then, to avoid double-ups). */ pt = &gps->points[i]; - pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; - index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i; + pt_active = pt->runtime.pt_orig; if (pt_active != NULL) { + index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i; gpencil_save_selected_point(gso, gps_active, index, pc1); include_last = false; diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index 1eb22fb34e2..e0ce72e5c3c 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -21,8 +21,7 @@ * \ingroup editorui */ -#ifndef __BIF_GLUTIL_H__ -#define __BIF_GLUTIL_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -177,5 +176,3 @@ void immDrawBorderCorners(unsigned int pos, const struct rcti *border, float zoo #ifdef __cplusplus } #endif - -#endif /* __BIF_GLUTIL_H__ */ diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 9d9f2925c23..36990414e6d 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_ANIM_API_H__ -#define __ED_ANIM_API_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -880,5 +879,3 @@ void animviz_get_object_motionpaths(struct Object *ob, ListBase *targets); #ifdef __cplusplus } #endif - -#endif /* __ED_ANIM_API_H__ */ diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index d82c7126cf2..62f4c068de0 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_ARMATURE_H__ -#define __ED_ARMATURE_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -225,10 +224,10 @@ void ED_armature_ebone_remove(struct bArmature *arm, EditBone *exBone); bool ED_armature_ebone_is_child_recursive(EditBone *ebone_parent, EditBone *ebone_child); EditBone *ED_armature_ebone_find_shared_parent(EditBone *ebone_child[], const unsigned int ebone_child_tot); -void ED_armature_ebone_to_mat3(EditBone *ebone, float mat[3][3]); -void ED_armature_ebone_to_mat4(EditBone *ebone, float mat[4][4]); -void ED_armature_ebone_from_mat3(EditBone *ebone, float mat[3][3]); -void ED_armature_ebone_from_mat4(EditBone *ebone, float mat[4][4]); +void ED_armature_ebone_to_mat3(EditBone *ebone, float r_mat[3][3]); +void ED_armature_ebone_to_mat4(EditBone *ebone, float r_mat[4][4]); +void ED_armature_ebone_from_mat3(EditBone *ebone, const float mat[3][3]); +void ED_armature_ebone_from_mat4(EditBone *ebone, const float mat[4][4]); EditBone *ED_armature_ebone_find_name(const struct ListBase *edbo, const char *name); EditBone *ED_armature_ebone_get_mirrored(const struct ListBase *edbo, EditBone *ebo); void ED_armature_ebone_transform_mirror_update(struct bArmature *arm, @@ -298,5 +297,3 @@ void ED_mesh_deform_bind_callback(struct MeshDeformModifierData *mmd, #ifdef __cplusplus } #endif - -#endif /* __ED_ARMATURE_H__ */ diff --git a/source/blender/editors/include/ED_buttons.h b/source/blender/editors/include/ED_buttons.h index 2eaef5e82e0..8206f5a8619 100644 --- a/source/blender/editors/include/ED_buttons.h +++ b/source/blender/editors/include/ED_buttons.h @@ -20,8 +20,7 @@ * \ingroup editors */ -#ifndef __ED_BUTTONS_H__ -#define __ED_BUTTONS_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -30,5 +29,3 @@ extern "C" { #ifdef __cplusplus } #endif - -#endif /* __ED_BUTTONS_H__ */ diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h index f270a0324f9..0a66c439f79 100644 --- a/source/blender/editors/include/ED_clip.h +++ b/source/blender/editors/include/ED_clip.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_CLIP_H__ -#define __ED_CLIP_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -106,5 +105,3 @@ void ED_operatormacros_clip(void); #ifdef __cplusplus } #endif - -#endif /* __ED_CLIP_H__ */ diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h index 79f5f62f293..f9b1d9cdc64 100644 --- a/source/blender/editors/include/ED_curve.h +++ b/source/blender/editors/include/ED_curve.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_CURVE_H__ -#define __ED_CURVE_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -111,5 +110,3 @@ void printknots(struct Object *obedit); #ifdef __cplusplus } #endif - -#endif /* __ED_CURVE_H__ */ diff --git a/source/blender/editors/include/ED_datafiles.h b/source/blender/editors/include/ED_datafiles.h index ad1cde5406d..ba77da24406 100644 --- a/source/blender/editors/include/ED_datafiles.h +++ b/source/blender/editors/include/ED_datafiles.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_DATAFILES_H__ -#define __ED_DATAFILES_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -301,5 +300,3 @@ extern char datatoc_gp_brush_erase_stroke_png[]; #ifdef __cplusplus } #endif - -#endif /* __ED_DATAFILES_H__ */ diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h index 8a239559627..deda0861b60 100644 --- a/source/blender/editors/include/ED_fileselect.h +++ b/source/blender/editors/include/ED_fileselect.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_FILESELECT_H__ -#define __ED_FILESELECT_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -214,5 +213,3 @@ void ED_fsmenu_entry_set_icon(struct FSMenuEntry *fsentry, const int icon); #ifdef __cplusplus } #endif - -#endif /* __ED_FILESELECT_H__ */ diff --git a/source/blender/editors/include/ED_gizmo_library.h b/source/blender/editors/include/ED_gizmo_library.h index a1a5d65b61d..0ee3b00e426 100644 --- a/source/blender/editors/include/ED_gizmo_library.h +++ b/source/blender/editors/include/ED_gizmo_library.h @@ -22,8 +22,7 @@ * This is exposes pre-defined gizmos for re-use. */ -#ifndef __ED_GIZMO_LIBRARY_H__ -#define __ED_GIZMO_LIBRARY_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -278,5 +277,3 @@ short ED_gizmotypes_snap_3d_update(struct wmGizmo *gz, #ifdef __cplusplus } #endif - -#endif /* __ED_GIZMO_LIBRARY_H__ */ diff --git a/source/blender/editors/include/ED_gizmo_utils.h b/source/blender/editors/include/ED_gizmo_utils.h index 70ff8a8d32f..0cfc3df9d54 100644 --- a/source/blender/editors/include/ED_gizmo_utils.h +++ b/source/blender/editors/include/ED_gizmo_utils.h @@ -20,8 +20,7 @@ * \name Generic Gizmo Utilities. */ -#ifndef __ED_GIZMO_UTILS_H__ -#define __ED_GIZMO_UTILS_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -46,5 +45,3 @@ bool ED_gizmo_poll_or_unlink_delayed_from_tool(const struct bContext *C, #ifdef __cplusplus } #endif - -#endif /* __ED_GIZMO_UTILS_H__ */ diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index 64276706759..06839276027 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_GPENCIL_H__ -#define __ED_GPENCIL_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -362,5 +361,3 @@ bool ED_gpencil_stroke_point_is_inside(struct bGPDstroke *gps, #ifdef __cplusplus } #endif - -#endif /* __ED_GPENCIL_H__ */ diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index e8343fbbc19..65ca181e160 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_IMAGE_H__ -#define __ED_IMAGE_H__ +#pragma once #include "DNA_listBase.h" #include "DNA_space_types.h" @@ -157,5 +156,3 @@ ListBase ED_image_filesel_detect_sequences(struct Main *bmain, #ifdef __cplusplus } #endif - -#endif /* __ED_IMAGE_H__ */ diff --git a/source/blender/editors/include/ED_info.h b/source/blender/editors/include/ED_info.h index e97fd424742..df6b6a20ddc 100644 --- a/source/blender/editors/include/ED_info.h +++ b/source/blender/editors/include/ED_info.h @@ -20,8 +20,7 @@ * \ingroup editors */ -#ifndef __ED_INFO_H__ -#define __ED_INFO_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -40,5 +39,3 @@ void ED_info_draw_stats( #ifdef __cplusplus } #endif - -#endif /* __ED_INFO_H__ */ diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h index 7000075d4b5..adc1e09821e 100644 --- a/source/blender/editors/include/ED_keyframes_draw.h +++ b/source/blender/editors/include/ED_keyframes_draw.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_KEYFRAMES_DRAW_H__ -#define __ED_KEYFRAMES_DRAW_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -273,5 +272,3 @@ int actkeyblock_get_valid_hold(ActKeyColumn *ab); #ifdef __cplusplus } #endif - -#endif /* __ED_KEYFRAMES_DRAW_H__ */ diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h index 28bc0b22790..b08ab57545f 100644 --- a/source/blender/editors/include/ED_keyframes_edit.h +++ b/source/blender/editors/include/ED_keyframes_edit.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_KEYFRAMES_EDIT_H__ -#define __ED_KEYFRAMES_EDIT_H__ +#pragma once #include "ED_anim_api.h" /* for enum eAnimFilter_Flags */ @@ -340,5 +339,3 @@ short paste_animedit_keys(struct bAnimContext *ac, #ifdef __cplusplus } #endif - -#endif /* __ED_KEYFRAMES_EDIT_H__ */ diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index 3fe6407aae7..7f833cd59bf 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_KEYFRAMING_H__ -#define __ED_KEYFRAMING_H__ +#pragma once #include "DNA_anim_types.h" #include "RNA_types.h" @@ -516,5 +515,3 @@ bool ED_autokeyframe_property(struct bContext *C, #ifdef __cplusplus } #endif - -#endif /* __ED_KEYFRAMING_H__ */ diff --git a/source/blender/editors/include/ED_lattice.h b/source/blender/editors/include/ED_lattice.h index 2e4b9472ce7..6982ad20f07 100644 --- a/source/blender/editors/include/ED_lattice.h +++ b/source/blender/editors/include/ED_lattice.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_LATTICE_H__ -#define __ED_LATTICE_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -51,5 +50,3 @@ void ED_lattice_undosys_type(struct UndoType *ut); #ifdef __cplusplus } #endif - -#endif /* __ED_LATTICE_H__ */ diff --git a/source/blender/editors/include/ED_markers.h b/source/blender/editors/include/ED_markers.h index 54a5d0cb0e1..8c10a8e36fd 100644 --- a/source/blender/editors/include/ED_markers.h +++ b/source/blender/editors/include/ED_markers.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_MARKERS_H__ -#define __ED_MARKERS_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -77,5 +76,3 @@ void debug_markers_print_list(struct ListBase *markers); #ifdef __cplusplus } #endif - -#endif /* __ED_MARKERS_H__ */ diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h index 5aafc0702da..80510d3afa1 100644 --- a/source/blender/editors/include/ED_mask.h +++ b/source/blender/editors/include/ED_mask.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_MASK_H__ -#define __ED_MASK_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -125,5 +124,3 @@ void mirror_masklayer_frames(struct MaskLayer *mask_layer, short mode); #ifdef __cplusplus } #endif - -#endif /* __ED_MASK_H__ */ diff --git a/source/blender/editors/include/ED_mball.h b/source/blender/editors/include/ED_mball.h index 5c2106b934c..7648af159c9 100644 --- a/source/blender/editors/include/ED_mball.h +++ b/source/blender/editors/include/ED_mball.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_MBALL_H__ -#define __ED_MBALL_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -65,5 +64,3 @@ void ED_mball_undosys_type(struct UndoType *ut); #ifdef __cplusplus } #endif - -#endif /* __ED_MBALL_H__ */ diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 392a5075750..f2cad1acc84 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_MESH_H__ -#define __ED_MESH_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -517,5 +516,3 @@ void EDBM_mesh_elem_index_ensure_multi(struct Object **objects, #ifdef __cplusplus } #endif - -#endif /* __ED_MESH_H__ */ diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index 382902cd2de..ecb98a46f99 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_NODE_H__ -#define __ED_NODE_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -127,5 +126,3 @@ bool ED_space_node_color_sample(struct Main *bmain, #ifdef __cplusplus } #endif - -#endif /* __ED_NODE_H__ */ diff --git a/source/blender/editors/include/ED_numinput.h b/source/blender/editors/include/ED_numinput.h index 8c8f3e6f4a3..447b7b76c72 100644 --- a/source/blender/editors/include/ED_numinput.h +++ b/source/blender/editors/include/ED_numinput.h @@ -18,8 +18,7 @@ * \ingroup editors */ -#ifndef __ED_NUMINPUT_H__ -#define __ED_NUMINPUT_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -111,5 +110,3 @@ bool user_string_to_number( #ifdef __cplusplus } #endif - -#endif /* __ED_NUMINPUT_H__ */ diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index d8f55a0f60a..4c7dd4fe66c 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_OBJECT_H__ -#define __ED_OBJECT_H__ +#pragma once #include "BLI_compiler_attrs.h" #include "DNA_object_enums.h" @@ -492,7 +491,7 @@ struct XFormObjectData *ED_object_data_xform_create_ex(struct ID *id, bool is_ed struct XFormObjectData *ED_object_data_xform_create(struct ID *id); struct XFormObjectData *ED_object_data_xform_create_from_edit_mode(ID *id); -void ED_object_data_xform_destroy(struct XFormObjectData *xod); +void ED_object_data_xform_destroy(struct XFormObjectData *xod_base); void ED_object_data_xform_by_mat4(struct XFormObjectData *xod, const float mat[4][4]); @@ -502,5 +501,3 @@ void ED_object_data_xform_tag_update(struct XFormObjectData *xod); #ifdef __cplusplus } #endif - -#endif /* __ED_OBJECT_H__ */ diff --git a/source/blender/editors/include/ED_outliner.h b/source/blender/editors/include/ED_outliner.h index 0325ad9fdba..9853b4644c1 100644 --- a/source/blender/editors/include/ED_outliner.h +++ b/source/blender/editors/include/ED_outliner.h @@ -20,8 +20,7 @@ * \ingroup editors */ -#ifndef __ED_OUTLINER_H__ -#define __ED_OUTLINER_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -53,5 +52,3 @@ void ED_outliner_select_sync_flag_outliners(const struct bContext *C); #ifdef __cplusplus } #endif - -#endif /* __ED_OUTLINER_H__ */ diff --git a/source/blender/editors/include/ED_paint.h b/source/blender/editors/include/ED_paint.h index 4159f22703f..3412d62317e 100644 --- a/source/blender/editors/include/ED_paint.h +++ b/source/blender/editors/include/ED_paint.h @@ -18,8 +18,7 @@ * \ingroup editors */ -#ifndef __ED_PAINT_H__ -#define __ED_PAINT_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -104,5 +103,3 @@ void ED_paintcurve_undosys_type(struct UndoType *ut); #ifdef __cplusplus } #endif - -#endif /* __ED_PAINT_H__ */ diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h index 789db5ae56e..e84298bd9c2 100644 --- a/source/blender/editors/include/ED_particle.h +++ b/source/blender/editors/include/ED_particle.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_PARTICLE_H__ -#define __ED_PARTICLE_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -83,5 +82,3 @@ void ED_particle_undosys_type(struct UndoType *ut); #ifdef __cplusplus } #endif - -#endif /* __ED_PARTICLE_H__ */ diff --git a/source/blender/editors/include/ED_physics.h b/source/blender/editors/include/ED_physics.h index ebd7e387c83..f9c56f31ebd 100644 --- a/source/blender/editors/include/ED_physics.h +++ b/source/blender/editors/include/ED_physics.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_PHYSICS_H__ -#define __ED_PHYSICS_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -63,5 +62,3 @@ void ED_keymap_physics(struct wmKeyConfig *keyconf); #ifdef __cplusplus } #endif - -#endif /* __ED_PHYSICS_H__ */ diff --git a/source/blender/editors/include/ED_render.h b/source/blender/editors/include/ED_render.h index ba70abcc055..d580e36d0ce 100644 --- a/source/blender/editors/include/ED_render.h +++ b/source/blender/editors/include/ED_render.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_RENDER_H__ -#define __ED_RENDER_H__ +#pragma once #include "DNA_vec_types.h" @@ -110,5 +109,3 @@ void ED_render_internal_init(void); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/editors/include/ED_scene.h b/source/blender/editors/include/ED_scene.h index 27c2e9d0df8..e3abd26a4cd 100644 --- a/source/blender/editors/include/ED_scene.h +++ b/source/blender/editors/include/ED_scene.h @@ -18,8 +18,7 @@ * \ingroup editors */ -#ifndef __ED_SCENE_H__ -#define __ED_SCENE_H__ +#pragma once #include "BLI_compiler_attrs.h" @@ -46,5 +45,3 @@ void ED_operatortypes_scene(void); #ifdef __cplusplus } #endif - -#endif /* __ED_SCENE_H__ */ diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 71b7d35908b..59567803f35 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_SCREEN_H__ -#define __ED_SCREEN_H__ +#pragma once #include "DNA_screen_types.h" #include "DNA_space_types.h" @@ -477,5 +476,3 @@ enum { #ifdef __cplusplus } #endif - -#endif /* __ED_SCREEN_H__ */ diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h index 9826ec8c3b8..0185de426f3 100644 --- a/source/blender/editors/include/ED_screen_types.h +++ b/source/blender/editors/include/ED_screen_types.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_SCREEN_TYPES_H__ -#define __ED_SCREEN_TYPES_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -140,5 +139,3 @@ enum { #ifdef __cplusplus } #endif - -#endif /* __ED_SCREEN_TYPES_H__ */ diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h index e61c7be5216..c3abde479f1 100644 --- a/source/blender/editors/include/ED_sculpt.h +++ b/source/blender/editors/include/ED_sculpt.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_SCULPT_H__ -#define __ED_SCULPT_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -62,5 +61,3 @@ void ED_sculpt_undo_push_multires_mesh_end(struct bContext *C, const char *str); #ifdef __cplusplus } #endif - -#endif /* __ED_SCULPT_H__ */ diff --git a/source/blender/editors/include/ED_select_utils.h b/source/blender/editors/include/ED_select_utils.h index 9c7cc0ef7a2..049ea7a092f 100644 --- a/source/blender/editors/include/ED_select_utils.h +++ b/source/blender/editors/include/ED_select_utils.h @@ -18,8 +18,7 @@ * \ingroup editors */ -#ifndef __ED_SELECT_UTILS_H__ -#define __ED_SELECT_UTILS_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -78,5 +77,3 @@ eSelectOp ED_select_op_modal(const eSelectOp sel_op, const bool is_first); #ifdef __cplusplus } #endif - -#endif /* __ED_SELECT_UTILS_H__ */ diff --git a/source/blender/editors/include/ED_sequencer.h b/source/blender/editors/include/ED_sequencer.h index f35ed12cdb9..11eff2d583b 100644 --- a/source/blender/editors/include/ED_sequencer.h +++ b/source/blender/editors/include/ED_sequencer.h @@ -20,8 +20,7 @@ * \ingroup editors */ -#ifndef __ED_SEQUENCER_H__ -#define __ED_SEQUENCER_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -53,5 +52,3 @@ void ED_sequencer_special_preview_clear(void); #ifdef __cplusplus } #endif - -#endif /* __ED_SEQUENCER_H__ */ diff --git a/source/blender/editors/include/ED_sound.h b/source/blender/editors/include/ED_sound.h index f7632bc81cb..022c7784ed3 100644 --- a/source/blender/editors/include/ED_sound.h +++ b/source/blender/editors/include/ED_sound.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_SOUND_H__ -#define __ED_SOUND_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -33,5 +32,3 @@ void ED_operatortypes_sound(void); #ifdef __cplusplus } #endif - -#endif /* __ED_SOUND_H__ */ diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h index ae4add2fca2..f3e867e8360 100644 --- a/source/blender/editors/include/ED_space_api.h +++ b/source/blender/editors/include/ED_space_api.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_SPACE_API_H__ -#define __ED_SPACE_API_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -83,5 +82,3 @@ void ED_region_draw_mouse_line_cb(const struct bContext *C, #ifdef __cplusplus } #endif - -#endif /* __ED_SPACE_API_H__ */ diff --git a/source/blender/editors/include/ED_text.h b/source/blender/editors/include/ED_text.h index 4f7b76675f0..6742561735e 100644 --- a/source/blender/editors/include/ED_text.h +++ b/source/blender/editors/include/ED_text.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_TEXT_H__ -#define __ED_TEXT_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -51,5 +50,3 @@ bool ED_text_is_syntax_highlight_supported(struct Text *text); #ifdef __cplusplus } #endif - -#endif /* __ED_TEXT_H__ */ diff --git a/source/blender/editors/include/ED_time_scrub_ui.h b/source/blender/editors/include/ED_time_scrub_ui.h index 483dce56577..216e67dd820 100644 --- a/source/blender/editors/include/ED_time_scrub_ui.h +++ b/source/blender/editors/include/ED_time_scrub_ui.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_TIME_SCRUB_UI_H__ -#define __ED_TIME_SCRUB_UI_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -51,5 +50,3 @@ void ED_time_scrub_channel_search_draw(const struct bContext *C, #ifdef __cplusplus } #endif - -#endif /* __ED_TIME_SCRUB_UI_H__ */ diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h index 29ed0485490..4c4672edffc 100644 --- a/source/blender/editors/include/ED_transform.h +++ b/source/blender/editors/include/ED_transform.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_TRANSFORM_H__ -#define __ED_TRANSFORM_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -215,5 +214,3 @@ int ED_transform_calc_gizmo_stats(const struct bContext *C, #ifdef __cplusplus } #endif - -#endif /* __ED_TRANSFORM_H__ */ diff --git a/source/blender/editors/include/ED_transform_snap_object_context.h b/source/blender/editors/include/ED_transform_snap_object_context.h index 8feb73436a6..ebaa32941f2 100644 --- a/source/blender/editors/include/ED_transform_snap_object_context.h +++ b/source/blender/editors/include/ED_transform_snap_object_context.h @@ -18,8 +18,7 @@ * \ingroup editors */ -#ifndef __ED_TRANSFORM_SNAP_OBJECT_CONTEXT_H__ -#define __ED_TRANSFORM_SNAP_OBJECT_CONTEXT_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -157,5 +156,3 @@ bool ED_transform_snap_object_project_all_view3d_ex(SnapObjectContext *sctx, #ifdef __cplusplus } #endif - -#endif /* __ED_TRANSFORM_SNAP_OBJECT_CONTEXT_H__ */ diff --git a/source/blender/editors/include/ED_transverts.h b/source/blender/editors/include/ED_transverts.h index 062658a562b..bff31149b75 100644 --- a/source/blender/editors/include/ED_transverts.h +++ b/source/blender/editors/include/ED_transverts.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_TRANSVERTS_H__ -#define __ED_TRANSVERTS_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -75,5 +74,3 @@ enum { #ifdef __cplusplus } #endif - -#endif /* __ED_TRANSVERTS_H__ */ diff --git a/source/blender/editors/include/ED_types.h b/source/blender/editors/include/ED_types.h index 4abb7d446d1..ab9098a33c5 100644 --- a/source/blender/editors/include/ED_types.h +++ b/source/blender/editors/include/ED_types.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_TYPES_H__ -#define __ED_TYPES_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -42,5 +41,3 @@ extern "C" { #ifdef __cplusplus } #endif - -#endif /* __ED_TYPES_H__ */ diff --git a/source/blender/editors/include/ED_undo.h b/source/blender/editors/include/ED_undo.h index 983e0c4f14a..dbd374415b0 100644 --- a/source/blender/editors/include/ED_undo.h +++ b/source/blender/editors/include/ED_undo.h @@ -18,8 +18,7 @@ * \ingroup editors */ -#ifndef __ED_UNDO_H__ -#define __ED_UNDO_H__ +#pragma once #include "BLI_compiler_attrs.h" @@ -89,5 +88,3 @@ struct MemFile *ED_undosys_stack_memfile_get_active(struct UndoStack *ustack); #ifdef __cplusplus } #endif - -#endif /* __ED_UNDO_H__ */ diff --git a/source/blender/editors/include/ED_userpref.h b/source/blender/editors/include/ED_userpref.h index 1d43009e37c..e588fa31ad5 100644 --- a/source/blender/editors/include/ED_userpref.h +++ b/source/blender/editors/include/ED_userpref.h @@ -18,8 +18,7 @@ * \ingroup editors */ -#ifndef __ED_USERPREF_H__ -#define __ED_USERPREF_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -30,5 +29,3 @@ void ED_operatortypes_userpref(void); #ifdef __cplusplus } #endif - -#endif /* __ED_USERPREF_H__ */ diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h index 1f2706957a7..68ae3589064 100644 --- a/source/blender/editors/include/ED_util.h +++ b/source/blender/editors/include/ED_util.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_UTIL_H__ -#define __ED_UTIL_H__ +#pragma once #include "BLI_compiler_attrs.h" @@ -71,5 +70,3 @@ void unpack_menu(struct bContext *C, #ifdef __cplusplus } #endif - -#endif /* __ED_UTIL_H__ */ diff --git a/source/blender/editors/include/ED_util_imbuf.h b/source/blender/editors/include/ED_util_imbuf.h index 76171383b49..d142d3d6425 100644 --- a/source/blender/editors/include/ED_util_imbuf.h +++ b/source/blender/editors/include/ED_util_imbuf.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_UTIL_IMBUF_H__ -#define __ED_UTIL_IMBUF_H__ +#pragma once #include "BLI_compiler_attrs.h" #include "BLI_sys_types.h" @@ -48,5 +47,3 @@ bool ED_imbuf_sample_poll(struct bContext *C); #ifdef __cplusplus } #endif - -#endif /* __ED_UTIL_IMBUF_H__ */ diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h index c89a9fe0e99..53fb79bb012 100644 --- a/source/blender/editors/include/ED_uvedit.h +++ b/source/blender/editors/include/ED_uvedit.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_UVEDIT_H__ -#define __ED_UVEDIT_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -217,6 +216,9 @@ struct BMLoop *ED_uvedit_active_vert_loop_get(struct BMesh *bm); void ED_uvedit_active_edge_loop_set(struct BMesh *bm, struct BMLoop *l); struct BMLoop *ED_uvedit_active_edge_loop_get(struct BMesh *bm); +char ED_uvedit_select_mode_get(const Scene *scene); +void ED_uvedit_select_sync_flush(const ToolSettings *ts, struct BMEditMesh *em, const bool select); + /* uvedit_unwrap_ops.c */ void ED_uvedit_live_unwrap_begin(struct Scene *scene, struct Object *obedit); void ED_uvedit_live_unwrap_re_solve(void); @@ -240,5 +242,3 @@ void ED_uvedit_buttons_register(struct ARegionType *art); #ifdef __cplusplus } #endif - -#endif /* __ED_UVEDIT_H__ */ diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index f44b099f42e..739a2184fb5 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_VIEW3D_H__ -#define __ED_VIEW3D_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -135,13 +134,13 @@ bool ED_view3d_has_workbench_in_texture_color(const struct Scene *scene, void ED_view3d_cursor3d_position(struct bContext *C, const int mval[2], const bool use_depth, - float cursor_co[3]); + float r_cursor_co[3]); void ED_view3d_cursor3d_position_rotation(struct bContext *C, const int mval[2], const bool use_depth, enum eV3DCursorOrient orientation, - float cursor_co[3], - float cursor_quat[4]); + float r_cursor_co[3], + float r_cursor_quat[4]); void ED_view3d_cursor3d_update(struct bContext *C, const int mval[2], const bool use_depth, @@ -403,10 +402,10 @@ bool ED_view3d_win_to_segment_clipped(struct Depsgraph *depsgraph, const bool do_clip); void ED_view3d_ob_project_mat_get(const struct RegionView3D *v3d, struct Object *ob, - float pmat[4][4]); + float r_pmat[4][4]); void ED_view3d_ob_project_mat_get_from_obmat(const struct RegionView3D *rv3d, - float obmat[4][4], - float pmat[4][4]); + const float obmat[4][4], + float r_pmat[4][4]); void ED_view3d_project(const struct ARegion *region, const float world[3], float r_region_co[3]); bool ED_view3d_unproject( @@ -460,7 +459,7 @@ void ED_view3d_clipping_calc(struct BoundBox *bb, const struct ARegion *region, const struct Object *ob, const struct rcti *rect); -void ED_view3d_clipping_local(struct RegionView3D *rv3d, float mat[4][4]); +void ED_view3d_clipping_local(struct RegionView3D *rv3d, const float mat[4][4]); bool ED_view3d_clipping_test(const struct RegionView3D *rv3d, const float co[3], const bool is_local); @@ -601,8 +600,8 @@ void ED_view3d_draw_setup_view(const struct wmWindowManager *wm, struct Scene *scene, struct ARegion *region, struct View3D *v3d, - float viewmat[4][4], - float winmat[4][4], + const float viewmat[4][4], + const float winmat[4][4], const struct rcti *rect); struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]); @@ -613,11 +612,11 @@ void ED_view3d_update_viewmat(struct Depsgraph *depsgraph, const struct Scene *scene, struct View3D *v3d, struct ARegion *region, - float viewmat[4][4], - float winmat[4][4], + const float viewmat[4][4], + const float winmat[4][4], const struct rcti *rect, bool offscreen); -bool ED_view3d_quat_from_axis_view(const char view, const char view_axis_roll, float quat[4]); +bool ED_view3d_quat_from_axis_view(const char view, const char view_axis_roll, float r_quat[4]); bool ED_view3d_quat_to_axis_view(const float viewquat[4], const float epsilon, char *r_view, @@ -676,7 +675,9 @@ void ED_view3d_lock_clear(struct View3D *v3d); #define VIEW3D_MARGIN 1.4f #define VIEW3D_DIST_FALLBACK 1.0f -float ED_view3d_offset_distance(float mat[4][4], const float ofs[3], const float dist_fallback); +float ED_view3d_offset_distance(const float mat[4][4], + const float ofs[3], + const float dist_fallback); void ED_view3d_distance_set(struct RegionView3D *rv3d, const float dist); bool ED_view3d_distance_set_from_location(struct RegionView3D *rv3d, const float dist_co[3], @@ -759,5 +760,3 @@ bool ED_view3d_is_region_xr_mirror_active(const struct wmWindowManager *wm, #ifdef __cplusplus } #endif - -#endif /* __ED_VIEW3D_H__ */ diff --git a/source/blender/editors/include/ED_view3d_offscreen.h b/source/blender/editors/include/ED_view3d_offscreen.h index 11d1aed1e73..2833d205e77 100644 --- a/source/blender/editors/include/ED_view3d_offscreen.h +++ b/source/blender/editors/include/ED_view3d_offscreen.h @@ -21,8 +21,7 @@ * \ingroup editors */ -#ifndef __ED_VIEW3D_OFFSCREEN_H__ -#define __ED_VIEW3D_OFFSCREEN_H__ +#pragma once #include "DNA_object_enums.h" #include "DNA_view3d_types.h" @@ -49,8 +48,8 @@ void ED_view3d_draw_offscreen(struct Depsgraph *depsgraph, struct ARegion *region, int winx, int winy, - float viewmat[4][4], - float winmat[4][4], + const float viewmat[4][4], + const float winmat[4][4], bool is_image_render, bool do_sky, bool is_persp, @@ -65,8 +64,8 @@ void ED_view3d_draw_offscreen_simple(struct Depsgraph *depsgraph, int winx, int winy, unsigned int draw_flags, - float viewmat[4][4], - float winmat[4][4], + const float viewmat[4][4], + const float winmat[4][4], float clip_start, float clip_end, bool is_image_render, @@ -106,5 +105,3 @@ struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(struct Depsgraph *depsgraph, #ifdef __cplusplus } #endif - -#endif /* __ED_VIEW3D_H__ */ diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 7ce74a87ea0..d682597da8e 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -21,8 +21,7 @@ * \ingroup editorui */ -#ifndef __UI_INTERFACE_H__ -#define __UI_INTERFACE_H__ +#pragma once #include "BLI_compiler_attrs.h" #include "BLI_sys_types.h" /* size_t */ @@ -1575,7 +1574,13 @@ eAutoPropButsReturn uiDefAutoButsRNA(uiLayout *layout, const bool compact); /* use inside searchfunc to add items */ -bool UI_search_item_add(uiSearchItems *items, const char *name, void *poin, int iconid, int state); +bool UI_search_item_add(uiSearchItems *items, + const char *name, + void *poin, + int iconid, + int state, + uint8_t name_prefix_offset); + void UI_but_func_search_set(uiBut *but, uiButSearchCreateFn search_create_fn, uiButSearchUpdateFn search_update_fn, @@ -2571,5 +2576,3 @@ void UI_interface_tag_script_reload(void); #ifdef __cplusplus } #endif - -#endif /* __UI_INTERFACE_H__ */ diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h index 0529ee08da6..7b59d45b203 100644 --- a/source/blender/editors/include/UI_interface_icons.h +++ b/source/blender/editors/include/UI_interface_icons.h @@ -21,8 +21,7 @@ * \ingroup editorui */ -#ifndef __UI_INTERFACE_ICONS_H__ -#define __UI_INTERFACE_ICONS_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -111,5 +110,3 @@ int UI_library_icon_get(const struct ID *id); #ifdef __cplusplus } #endif - -#endif /* __UI_INTERFACE_ICONS_H__ */ diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index c5c4ca79f14..3f548f98e97 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -21,8 +21,7 @@ * \ingroup editorui */ -#ifndef __UI_RESOURCES_H__ -#define __UI_RESOURCES_H__ +#pragma once #include "BLI_sys_types.h" @@ -458,5 +457,3 @@ void UI_make_axis_color(const unsigned char *src_col, unsigned char *dst_col, co #ifdef __cplusplus } #endif - -#endif /* __UI_RESOURCES_H__ */ diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index 0ddc45f4878..6e0f4434b7b 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -23,8 +23,7 @@ * \ingroup editorui */ -#ifndef __UI_VIEW2D_H__ -#define __UI_VIEW2D_H__ +#pragma once #include "BLI_compiler_attrs.h" @@ -288,5 +287,3 @@ void VIEW2D_GGT_navigate_impl(struct wmGizmoGroupType *gzgt, const char *idname) #ifdef __cplusplus } #endif - -#endif /* __UI_VIEW2D_H__ */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 106145005bd..286cb1571bd 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -893,6 +893,12 @@ bool UI_but_active_only_ex( } } if ((activate == true) || (found == false)) { + /* There might still be another active button. */ + uiBut *old_active = ui_region_find_active_but(region); + if (old_active) { + ui_but_active_free(C, old_active); + } + ui_but_activate_event((bContext *)C, region, but); } else if ((found == true) && (isactive == false)) { @@ -3079,8 +3085,38 @@ static double soft_range_round_down(double value, double max) return newmax; } +void ui_but_range_set_hard(uiBut *but) +{ + if (but->rnaprop) { + const PropertyType type = RNA_property_type(but->rnaprop); + double hardmin, hardmax; + + /* clamp button range to something reasonable in case + * we get -inf/inf from RNA properties */ + if (type == PROP_INT) { + int imin, imax; + + RNA_property_int_range(&but->rnapoin, but->rnaprop, &imin, &imax); + hardmin = (imin == INT_MIN) ? -1e4 : imin; + hardmax = (imin == INT_MAX) ? 1e4 : imax; + } + else if (type == PROP_FLOAT) { + float fmin, fmax; + + RNA_property_float_range(&but->rnapoin, but->rnaprop, &fmin, &fmax); + hardmin = (fmin == -FLT_MAX) ? (float)-1e4 : fmin; + hardmax = (fmax == FLT_MAX) ? (float)1e4 : fmax; + } + else { + return; + } + but->hardmin = hardmin; + but->hardmax = hardmax; + } +} + /* note: this could be split up into functions which handle arrays and not */ -static void ui_set_but_soft_range(uiBut *but) +void ui_but_range_set_soft(uiBut *but) { /* ideally we would not limit this but practically, its more than * enough worst case is very long vectors wont use a smart soft-range @@ -3484,7 +3520,7 @@ static void ui_but_update_ex(uiBut *but, const bool validate) /* only update soft range while not editing */ if (!ui_but_is_editing(but)) { if ((but->rnaprop != NULL) || (but->poin && (but->pointype & UI_BUT_POIN_TYPES))) { - ui_set_but_soft_range(but); + ui_but_range_set_soft(but); } } @@ -6431,7 +6467,8 @@ static void operator_enum_search_update_fn(const struct bContext *C, /* note: need to give the index rather than the * identifier because the enum can be freed */ if (BLI_strcasestr(item->name, str)) { - if (!UI_search_item_add(items, item->name, POINTER_FROM_INT(item->value), item->icon, 0)) { + if (!UI_search_item_add( + items, item->name, POINTER_FROM_INT(item->value), item->icon, 0, 0)) { break; } } diff --git a/source/blender/editors/interface/interface_align.c b/source/blender/editors/interface/interface_align.c index 8edae5d8740..4981ef111e0 100644 --- a/source/blender/editors/interface/interface_align.c +++ b/source/blender/editors/interface/interface_align.c @@ -371,7 +371,7 @@ static void ui_block_align_but_to_region(uiBut *but, const ARegion *region) rect->xmin = rect->xmax - but_width; break; default: - BLI_assert(0); + /* Tabs may be shown in unaligned regions too, they just appear as regular buttons then. */ break; } } diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 8d12a1dd1ad..d2f97eabc80 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -306,8 +306,7 @@ bool ui_but_anim_expression_create(uiBut *but, const char *str) void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra) { - const int rnaindex = (but->rnaindex == -1) ? 0 : but->rnaindex; - ED_autokeyframe_property(C, scene, &but->rnapoin, but->rnaprop, rnaindex, cfra); + ED_autokeyframe_property(C, scene, &but->rnapoin, but->rnaprop, but->rnaindex, cfra); } void ui_but_anim_copy_driver(bContext *C) diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index cc5d21c3df3..4f901d49391 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -2084,7 +2084,6 @@ void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, /* Curve filled. */ immUniformColor3ubvAlpha(wcol->item, 128); - GPU_polygon_smooth(true); immBegin(GPU_PRIM_TRI_STRIP, (CM_TABLE * 2 + 2) + 4); immVertex2f(pos, line_range.xmin, rect->ymin); immVertex2f(pos, line_range.xmin, line_range.ymin); @@ -2097,7 +2096,6 @@ void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, immVertex2f(pos, line_range.xmax, rect->ymin); immVertex2f(pos, line_range.xmax, line_range.ymax); immEnd(); - GPU_polygon_smooth(false); /* Curve line. */ GPU_line_width(1.0f); diff --git a/source/blender/editors/interface/interface_eyedropper_intern.h b/source/blender/editors/interface/interface_eyedropper_intern.h index cabf997b725..fd60dcb7c86 100644 --- a/source/blender/editors/interface/interface_eyedropper_intern.h +++ b/source/blender/editors/interface/interface_eyedropper_intern.h @@ -20,8 +20,7 @@ * Share between interface_eyedropper_*.c files. */ -#ifndef __INTERFACE_EYEDROPPER_INTERN_H__ -#define __INTERFACE_EYEDROPPER_INTERN_H__ +#pragma once /* interface_eyedropper.c */ void eyedropper_draw_cursor_text(const struct bContext *C, @@ -48,5 +47,3 @@ enum { EYE_MODAL_POINT_RESET, EYE_MODAL_POINT_REMOVE_LAST, }; - -#endif /* __INTERFACE_EYEDROPPER_INTERN_H__ */ diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 88ad5d8fec1..bcb4f7c672f 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1382,6 +1382,9 @@ static void ui_multibut_states_apply(bContext *C, uiHandleButtonData *data, uiBl static bool ui_drag_toggle_but_is_supported(const uiBut *but) { + if (but->flag & UI_BUT_DISABLED) { + return false; + } if (ui_but_is_bool(but)) { return true; } @@ -7998,6 +8001,9 @@ static void button_activate_init(bContext *C, { uiHandleButtonData *data; + /* Only ever one active button! */ + BLI_assert(ui_region_find_active_but(region) == NULL); + /* setup struct */ data = MEM_callocN(sizeof(uiHandleButtonData), "uiHandleButtonData"); data->wm = CTX_wm_manager(C); @@ -8900,6 +8906,11 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) /* for jumping to the next button with tab while text editing */ if (post_but) { + /* The post_but still has previous ranges (without the changes in active button considered), + * needs refreshing the ranges. */ + ui_but_range_set_soft(post_but); + ui_but_range_set_hard(post_but); + button_activate_init(C, region, post_but, post_type); } else if (!((event->type == EVT_BUT_CANCEL) && (event->val == 1))) { diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 249134c6abf..ab5d8806837 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -21,8 +21,7 @@ * \ingroup edinterface */ -#ifndef __INTERFACE_INTERN_H__ -#define __INTERFACE_INTERN_H__ +#pragma once #include "BLI_compiler_attrs.h" #include "BLI_rect.h" @@ -537,6 +536,9 @@ extern void ui_but_rna_menu_convert_to_panel_type(struct uiBut *but, const char extern void ui_but_rna_menu_convert_to_menu_type(struct uiBut *but, const char *menu_type); extern bool ui_but_menu_draw_as_popover(const uiBut *but); +void ui_but_range_set_hard(uiBut *but); +void ui_but_range_set_soft(uiBut *but); + extern void ui_but_update(uiBut *but); extern void ui_but_update_edited(uiBut *but); extern bool ui_but_is_float(const uiBut *but) ATTR_WARN_UNUSED_RESULT; @@ -1075,5 +1077,3 @@ bool ui_jump_to_target_button_poll(struct bContext *C); /* interface_queries.c */ void ui_interface_tag_script_reload_queries(void); - -#endif /* __INTERFACE_INTERN_H__ */ diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index b707aaa0ee9..f1d1ef589a5 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -937,7 +937,7 @@ static uiBut *ui_item_with_label(uiLayout *layout, int h, int flag) { - uiLayout *sub; + uiLayout *sub = layout; uiBut *but = NULL; PropertyType type; PropertySubType subtype; @@ -945,14 +945,20 @@ static uiBut *ui_item_with_label(uiLayout *layout, #ifdef UI_PROP_DECORATE uiLayout *layout_prop_decorate = NULL; const bool use_prop_sep = ((layout->item.flag & UI_ITEM_PROP_SEP) != 0); + const bool use_prop_decorate = use_prop_sep && (layout->item.flag & UI_ITEM_PROP_DECORATE) && + (layout->item.flag & UI_ITEM_PROP_DECORATE_NO_PAD) == 0; #endif - /* Previously 'align' was enabled to make sure the label is spaced closely to the button. - * Set the space to zero instead as aligning a large number of labels can end up aligning - * thousands of buttons when displaying key-map search (a heavy operation), see: T78636. */ - sub = uiLayoutRow(layout, false); - sub->space = 0; - UI_block_layout_set_current(block, sub); + UI_block_layout_set_current(block, layout); + + /* Only add new row if more than 1 item will be added. */ + if (name[0] || use_prop_decorate) { + /* Also avoid setting 'align' if possible. Set the space to zero instead as aligning a large + * number of labels can end up aligning thousands of buttons when displaying key-map search (a + * heavy operation), see: T78636. */ + sub = uiLayoutRow(layout, layout->align); + sub->space = 0; + } #ifdef UI_PROP_DECORATE if (name[0]) { @@ -1050,11 +1056,8 @@ static uiBut *ui_item_with_label(uiLayout *layout, #ifdef UI_PROP_DECORATE /* Only for alignment. */ - if (use_prop_sep) { /* Flag may have been unset meanwhile. */ - if ((layout->item.flag & UI_ITEM_PROP_DECORATE) && - (layout->item.flag & UI_ITEM_PROP_DECORATE_NO_PAD) == 0) { - uiItemL(layout_prop_decorate ? layout_prop_decorate : sub, NULL, ICON_BLANK1); - } + if (use_prop_decorate) { /* Note that sep flag may have been unset meanwhile. */ + uiItemL(layout_prop_decorate ? layout_prop_decorate : sub, NULL, ICON_BLANK1); } #endif /* UI_PROP_DECORATE */ diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index dd3074d6258..799a3b7fd5e 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -321,7 +321,7 @@ void UI_list_panel_unique_str(Panel *panel, char *r_name) * Remove the #uiBlock corresponding to a panel. The lookup is needed because panels don't store * a reference to their corresponding #uiBlock. */ -static void panel_free_block(ARegion *region, Panel *panel) +static void panel_free_block(const bContext *C, ARegion *region, Panel *panel) { BLI_assert(panel->type); @@ -334,7 +334,7 @@ static void panel_free_block(ARegion *region, Panel *panel) LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) { if (STREQ(block->name, block_name)) { BLI_remlink(®ion->uiblocks, block); - UI_block_free(NULL, block); + UI_block_free(C, block); break; /* Only delete one block for this panel. */ } } @@ -347,15 +347,15 @@ static void panel_free_block(ARegion *region, Panel *panel) * \note The only panels that should need to be deleted at runtime are panels with the * #PNL_INSTANCED flag set. */ -static void panel_delete(ARegion *region, ListBase *panels, Panel *panel) +static void panel_delete(const bContext *C, ARegion *region, ListBase *panels, Panel *panel) { /* Recursively delete children. */ LISTBASE_FOREACH_MUTABLE (Panel *, child, &panel->children) { - panel_delete(region, &panel->children, child); + panel_delete(C, region, &panel->children, child); } BLI_freelistN(&panel->children); - panel_free_block(region, panel); + panel_free_block(C, region, panel); BLI_remlink(panels, panel); if (panel->activedata) { @@ -386,7 +386,7 @@ void UI_panels_free_instanced(bContext *C, ARegion *region) } /* Free the panel and its sub-panels. */ - panel_delete(region, ®ion->panels, panel); + panel_delete(C, region, ®ion->panels, panel); } } } diff --git a/source/blender/editors/interface/interface_region_search.c b/source/blender/editors/interface/interface_region_search.c index 307bab5ad79..a9e87f4cc07 100644 --- a/source/blender/editors/interface/interface_region_search.c +++ b/source/blender/editors/interface/interface_region_search.c @@ -76,6 +76,7 @@ struct uiSearchItems { void **pointers; int *icons; int *states; + uint8_t *name_prefix_offsets; /** Is there any item with an icon? */ bool has_icon; @@ -117,7 +118,12 @@ typedef struct uiSearchboxData { * typically #UI_BUT_DISABLED / #UI_BUT_INACTIVE. * \return false if there is nothing to add. */ -bool UI_search_item_add(uiSearchItems *items, const char *name, void *poin, int iconid, int state) +bool UI_search_item_add(uiSearchItems *items, + const char *name, + void *poin, + int iconid, + int state, + const uint8_t name_prefix_offset) { /* hijack for autocomplete */ if (items->autocpl) { @@ -159,6 +165,15 @@ bool UI_search_item_add(uiSearchItems *items, const char *name, void *poin, int items->icons[items->totitem] = iconid; } + if (name_prefix_offset != 0) { + /* Lazy initialize, as this isn't used often. */ + if (items->name_prefix_offsets == NULL) { + items->name_prefix_offsets = MEM_callocN( + items->maxitem * sizeof(*items->name_prefix_offsets), "search name prefix offsets"); + } + items->name_prefix_offsets[items->totitem] = name_prefix_offset; + } + /* Limit flags that can be set so flags such as 'UI_SELECT' aren't accidentally set * which will cause problems, add others as needed. */ BLI_assert( @@ -184,10 +199,18 @@ int UI_searchbox_size_x(void) int UI_search_items_find_index(uiSearchItems *items, const char *name) { - int i; - for (i = 0; i < items->totitem; i++) { - if (STREQ(name, items->names[i])) { - return i; + if (items->name_prefix_offsets != NULL) { + for (int i = 0; i < items->totitem; i++) { + if (STREQ(name, items->names[i] + items->name_prefix_offsets[i])) { + return i; + } + } + } + else { + for (int i = 0; i < items->totitem; i++) { + if (STREQ(name, items->names[i])) { + return i; + } } } return -1; @@ -283,7 +306,12 @@ bool ui_searchbox_apply(uiBut *but, ARegion *region) but->func_arg2 = NULL; if (data->active != -1) { - const char *name = data->items.names[data->active]; + const char *name = data->items.names[data->active] + + /* Never include the prefix in the button. */ + (data->items.name_prefix_offsets ? + data->items.name_prefix_offsets[data->active] : + 0); + const char *name_sep = data->use_sep ? strrchr(name, UI_SEP_CHAR) : NULL; BLI_strncpy(but->editstr, name, name_sep ? (name_sep - name) + 1 : data->items.maxstrlen); @@ -472,7 +500,10 @@ void ui_searchbox_update(bContext *C, ARegion *region, uiBut *but, const bool re int a; for (a = 0; a < data->items.totitem; a++) { - const char *name = data->items.names[a]; + const char *name = data->items.names[a] + + /* Never include the prefix in the button. */ + (data->items.name_prefix_offsets ? data->items.name_prefix_offsets[a] : + 0); const char *name_sep = data->use_sep ? strrchr(name, UI_SEP_CHAR) : NULL; if (STREQLEN(but->editstr, name, name_sep ? (name_sep - name) : data->items.maxstrlen)) { data->active = a; @@ -634,6 +665,10 @@ static void ui_searchbox_region_free_cb(ARegion *region) MEM_freeN(data->items.icons); MEM_freeN(data->items.states); + if (data->items.name_prefix_offsets != NULL) { + MEM_freeN(data->items.name_prefix_offsets); + } + MEM_freeN(data); region->regiondata = NULL; } @@ -802,6 +837,7 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but data->items.pointers = MEM_callocN(data->items.maxitem * sizeof(void *), "search pointers"); data->items.icons = MEM_callocN(data->items.maxitem * sizeof(int), "search icons"); data->items.states = MEM_callocN(data->items.maxitem * sizeof(int), "search flags"); + data->items.name_prefix_offsets = NULL; /* Lazy initialized as needed. */ for (i = 0; i < data->items.maxitem; i++) { data->items.names[i] = MEM_callocN(but->hardmax + 1, "search pointers"); } diff --git a/source/blender/editors/interface/interface_regions_intern.h b/source/blender/editors/interface/interface_regions_intern.h index c299562a357..0cb1fee9a92 100644 --- a/source/blender/editors/interface/interface_regions_intern.h +++ b/source/blender/editors/interface/interface_regions_intern.h @@ -20,8 +20,7 @@ * Share between interface_region_*.c files. */ -#ifndef __INTERFACE_REGIONS_INTERN_H__ -#define __INTERFACE_REGIONS_INTERN_H__ +#pragma once /* interface_region_menu_popup.c */ uint ui_popup_menu_hash(const char *str); @@ -29,5 +28,3 @@ uint ui_popup_menu_hash(const char *str); /* interface_regions_intern.h */ ARegion *ui_region_temp_add(bScreen *screen); void ui_region_temp_remove(struct bContext *C, bScreen *screen, ARegion *region); - -#endif /* __INTERFACE_REGIONS_INTERN_H__ */ diff --git a/source/blender/editors/interface/interface_template_search_menu.c b/source/blender/editors/interface/interface_template_search_menu.c index ad5f897e5fe..0708714c659 100644 --- a/source/blender/editors/interface/interface_template_search_menu.c +++ b/source/blender/editors/interface/interface_template_search_menu.c @@ -1009,7 +1009,7 @@ static void menu_search_update_fn(const bContext *UNUSED(C), } if (index == words_len) { - if (!UI_search_item_add(items, item->drawwstr_full, item, item->icon, item->state)) { + if (!UI_search_item_add(items, item->drawwstr_full, item, item->icon, item->state, 0)) { break; } } diff --git a/source/blender/editors/interface/interface_template_search_operator.c b/source/blender/editors/interface/interface_template_search_operator.c index cdf87103587..b8070ccbb25 100644 --- a/source/blender/editors/interface/interface_template_search_operator.c +++ b/source/blender/editors/interface/interface_template_search_operator.c @@ -109,7 +109,7 @@ static void operator_search_update_fn(const bContext *C, } } - if (!UI_search_item_add(items, name, ot, ICON_NONE, 0)) { + if (!UI_search_item_add(items, name, ot, ICON_NONE, 0, 0)) { break; } } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 21696b9c1ab..50148d8a8cd 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -367,13 +367,19 @@ static bool id_search_add(const bContext *C, /* When using previews, the library hint (linked, overridden, missing) is added with a * character prefix, otherwise we can use a icon. */ - BKE_id_full_name_ui_prefix_get(name_ui, id, use_lib_prefix, UI_SEP_CHAR); + int name_prefix_offset; + BKE_id_full_name_ui_prefix_get( + name_ui, id, use_lib_prefix, UI_SEP_CHAR, &name_prefix_offset); if (!use_lib_prefix) { iconid = UI_library_icon_get(id); } - if (!UI_search_item_add( - items, name_ui, id, iconid, has_sep_char ? UI_BUT_HAS_SEP_CHAR : 0)) { + if (!UI_search_item_add(items, + name_ui, + id, + iconid, + has_sep_char ? UI_BUT_HAS_SEP_CHAR : 0, + name_prefix_offset)) { return false; } } @@ -566,6 +572,15 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) if (override_id != NULL) { BKE_main_id_clear_newpoins(bmain); + if (GS(override_id->name) == ID_OB) { + Scene *scene = CTX_data_scene(C); + if (!BKE_collection_has_object_recursive(scene->master_collection, + (Object *)override_id)) { + BKE_collection_object_add_from( + bmain, scene, (Object *)id, (Object *)override_id); + } + } + /* Assign new pointer, takes care of updates/notifiers */ RNA_id_pointer_create(override_id, &idptr); } diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 24f90f6b0a0..208fd7136da 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -382,6 +382,7 @@ typedef struct CollItemSearch { int index; int iconid; bool is_id; + int name_prefix_offset; uint has_sep_char : 1; } CollItemSearch; @@ -432,6 +433,7 @@ void ui_rna_collection_search_update_fn(const struct bContext *C, } } + int name_prefix_offset = 0; int iconid = ICON_NONE; bool has_sep_char = false; bool is_id = itemptr.type && RNA_struct_is_ID(itemptr.type); @@ -447,7 +449,8 @@ void ui_rna_collection_search_update_fn(const struct bContext *C, } else { const ID *id = itemptr.data; - BKE_id_full_name_ui_prefix_get(name_buf, itemptr.data, true, UI_SEP_CHAR); + BKE_id_full_name_ui_prefix_get( + name_buf, itemptr.data, true, UI_SEP_CHAR, &name_prefix_offset); BLI_STATIC_ASSERT(sizeof(name_buf) >= MAX_ID_FULL_NAME_UI, "Name string buffer should be big enough to hold full UI ID name"); name = name_buf; @@ -459,13 +462,14 @@ void ui_rna_collection_search_update_fn(const struct bContext *C, } if (name) { - if (skip_filter || BLI_strcasestr(name, str)) { + if (skip_filter || BLI_strcasestr(name + name_prefix_offset, str)) { cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch"); cis->data = itemptr.data; cis->name = BLI_strdup(name); cis->index = i; cis->iconid = iconid; cis->is_id = is_id; + cis->name_prefix_offset = name_prefix_offset; cis->has_sep_char = has_sep_char; BLI_addtail(items_list, cis); } @@ -484,11 +488,12 @@ void ui_rna_collection_search_update_fn(const struct bContext *C, for (cis = items_list->first; cis; cis = cis->next) { /* If no item has an own icon to display, libraries can use the library icons rather than the * name prefix for showing the library status. */ + int name_prefix_offset = cis->name_prefix_offset; if (!has_id_icon && cis->is_id) { cis->iconid = UI_library_icon_get(cis->data); /* No need to re-allocate, string should be shorter than before (lib status prefix is * removed). */ - BKE_id_full_name_ui_prefix_get(name_buf, cis->data, false, UI_SEP_CHAR); + BKE_id_full_name_ui_prefix_get(name_buf, cis->data, false, UI_SEP_CHAR, &name_prefix_offset); BLI_assert(strlen(name_buf) <= MEM_allocN_len(cis->name)); strcpy(cis->name, name_buf); } @@ -497,7 +502,8 @@ void ui_rna_collection_search_update_fn(const struct bContext *C, cis->name, cis->data, cis->iconid, - cis->has_sep_char ? UI_BUT_HAS_SEP_CHAR : 0)) { + cis->has_sep_char ? UI_BUT_HAS_SEP_CHAR : 0, + name_prefix_offset)) { break; } } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index c8f2bec145b..9ba1a2c73f4 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -53,6 +53,7 @@ #include "GPU_immediate.h" #include "GPU_immediate_util.h" #include "GPU_matrix.h" +#include "GPU_platform.h" #include "GPU_state.h" #ifdef WITH_INPUT_IME @@ -1208,6 +1209,26 @@ void UI_widgetbase_draw_cache_end(void) GPU_blend(false); } +/* Disable cached/instanced drawing and enforce single widget drawing pipeline. + * Works around interface artifacts happening on certain driver and hardware + * configurations. */ +static bool draw_widgetbase_batch_skip_draw_cache(void) +{ + /* MacOS is known to have issues on Mac Mini and MacBook Pro with Intel Iris GPU. + * For example, T78307. */ + if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_MAC, GPU_DRIVER_ANY)) { + return true; + } + + /* There are also reports that some AMD and Mesa driver configuration suffer from the + * same issue, T78803. */ + if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) { + return true; + } + + return false; +} + static void draw_widgetbase_batch(uiWidgetBase *wtb) { wtb->uniform_params.tria_type = wtb->tria1.type; @@ -1216,7 +1237,7 @@ static void draw_widgetbase_batch(uiWidgetBase *wtb) copy_v2_v2(wtb->uniform_params.tria1_center, wtb->tria1.center); copy_v2_v2(wtb->uniform_params.tria2_center, wtb->tria2.center); - if (g_widget_base_batch.enabled) { + if (g_widget_base_batch.enabled && !draw_widgetbase_batch_skip_draw_cache()) { g_widget_base_batch.params[g_widget_base_batch.count] = wtb->uniform_params; g_widget_base_batch.count++; @@ -1380,7 +1401,7 @@ static void widget_draw_icon( } } else if (ELEM(but->type, UI_BTYPE_BUT)) { - if (but->flag & UI_BUT_DISABLED) { + if (but->flag & (UI_BUT_DISABLED | UI_BUT_INACTIVE)) { alpha *= 0.5f; } } @@ -2382,7 +2403,7 @@ static void widget_draw_text_icon(const uiFontStyle *fstyle, } else if (but->flag & UI_BUT_DRAG_MULTI) { bool text_is_edited = ui_but_drag_multi_edit_get(but) != NULL; - if (text_is_edited) { + if (text_is_edited || (but->drawflag & UI_BUT_TEXT_LEFT)) { rect->xmin += text_padding; } } @@ -2601,18 +2622,19 @@ static void widget_state_numslider(uiWidgetType *wt, int state, int drawflag) /* labels use theme colors for text */ static void widget_state_option_menu(uiWidgetType *wt, int state, int drawflag) { - bTheme *btheme = UI_GetTheme(); /* XXX */ + const bTheme *btheme = UI_GetTheme(); + + const uiWidgetColors *old_wcol = wt->wcol_theme; + uiWidgetColors wcol_menu_option = *wt->wcol_theme; + + /* Override the checkbox theme colors to use the menu-back text colors. */ + copy_v3_v3_uchar(wcol_menu_option.text, btheme->tui.wcol_menu_back.text); + copy_v3_v3_uchar(wcol_menu_option.text_sel, btheme->tui.wcol_menu_back.text_sel); + wt->wcol_theme = &wcol_menu_option; - /* call this for option button */ widget_state(wt, state, drawflag); - /* if not selected we get theme from menu back */ - if (state & UI_SELECT) { - copy_v3_v3_uchar(wt->wcol.text, btheme->tui.wcol_menu_back.text_sel); - } - else { - copy_v3_v3_uchar(wt->wcol.text, btheme->tui.wcol_menu_back.text); - } + wt->wcol_theme = old_wcol; } static void widget_state_nothing(uiWidgetType *wt, int UNUSED(state), int UNUSED(drawflag)) diff --git a/source/blender/editors/interface/view2d_draw.c b/source/blender/editors/interface/view2d_draw.c index 0108dafc531..54b25939baf 100644 --- a/source/blender/editors/interface/view2d_draw.c +++ b/source/blender/editors/interface/view2d_draw.c @@ -174,26 +174,38 @@ static void get_parallel_lines_draw_steps(const ParallelLinesSet *lines, } } +/** + * \param rect_mask: Region size in pixels. + */ static void draw_parallel_lines(const ParallelLinesSet *lines, const rctf *rect, - const uchar *color, + const rcti *rect_mask, + const uchar color[3], char direction) { float first; - uint steps; + uint steps, steps_max; if (direction == 'v') { get_parallel_lines_draw_steps(lines, rect->xmin, rect->xmax, &first, &steps); + steps_max = BLI_rcti_size_x(rect_mask); } else { BLI_assert(direction == 'h'); get_parallel_lines_draw_steps(lines, rect->ymin, rect->ymax, &first, &steps); + steps_max = BLI_rcti_size_y(rect_mask); } if (steps == 0) { return; } + if (UNLIKELY(steps >= steps_max)) { + /* Note that we could draw a solid color, + * however this flickers because of numeric instability when zoomed out. */ + return; + } + GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -234,12 +246,12 @@ static void draw_parallel_lines(const ParallelLinesSet *lines, static void view2d_draw_lines_internal(const View2D *v2d, const ParallelLinesSet *lines, - const uchar *color, + const uchar color[3], char direction) { GPU_matrix_push_projection(); UI_view2d_view_ortho(v2d); - draw_parallel_lines(lines, &v2d->cur, color, direction); + draw_parallel_lines(lines, &v2d->cur, &v2d->mask, color, direction); GPU_matrix_pop_projection(); } @@ -248,17 +260,18 @@ static void view2d_draw_lines(const View2D *v2d, bool display_minor_lines, char direction) { - uchar major_color[3]; - uchar minor_color[3]; - UI_GetThemeColor3ubv(TH_GRID, major_color); - UI_GetThemeColorShade3ubv(TH_GRID, 16, minor_color); - - ParallelLinesSet major_lines; - major_lines.distance = major_distance; - major_lines.offset = 0; - view2d_draw_lines_internal(v2d, &major_lines, major_color, direction); + { + uchar major_color[3]; + UI_GetThemeColor3ubv(TH_GRID, major_color); + ParallelLinesSet major_lines; + major_lines.distance = major_distance; + major_lines.offset = 0; + view2d_draw_lines_internal(v2d, &major_lines, major_color, direction); + } if (display_minor_lines) { + uchar minor_color[3]; + UI_GetThemeColorShade3ubv(TH_GRID, 16, minor_color); ParallelLinesSet minor_lines; minor_lines.distance = major_distance; minor_lines.offset = major_distance / 2.0f; @@ -284,9 +297,6 @@ static void draw_horizontal_scale_indicators(const ARegion *region, return; } - GPU_matrix_push_projection(); - wmOrtho2_region_pixelspace(region); - float start; uint steps; { @@ -298,8 +308,15 @@ static void draw_horizontal_scale_indicators(const ARegion *region, UI_view2d_region_to_view_x(v2d, rect->xmax), &start, &steps); + const uint steps_max = BLI_rcti_size_x(&v2d->mask); + if (UNLIKELY(steps >= steps_max)) { + return; + } } + GPU_matrix_push_projection(); + wmOrtho2_region_pixelspace(region); + const int font_id = BLF_default(); UI_FontThemeColor(font_id, colorid); @@ -339,9 +356,6 @@ static void draw_vertical_scale_indicators(const ARegion *region, return; } - GPU_matrix_push_projection(); - wmOrtho2_region_pixelspace(region); - float start; uint steps; { @@ -353,8 +367,15 @@ static void draw_vertical_scale_indicators(const ARegion *region, UI_view2d_region_to_view_y(v2d, rect->ymax), &start, &steps); + const uint steps_max = BLI_rcti_size_y(&v2d->mask); + if (UNLIKELY(steps >= steps_max)) { + return; + } } + GPU_matrix_push_projection(); + wmOrtho2_region_pixelspace(region); + const int font_id = BLF_default(); UI_FontThemeColor(font_id, colorid); diff --git a/source/blender/editors/io/io_alembic.h b/source/blender/editors/io/io_alembic.h index ecd8c1818f8..512f4e4636b 100644 --- a/source/blender/editors/io/io_alembic.h +++ b/source/blender/editors/io/io_alembic.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __IO_ALEMBIC_H__ -#define __IO_ALEMBIC_H__ +#pragma once /** \file * \ingroup editor/io @@ -28,5 +27,3 @@ struct wmOperatorType; void WM_OT_alembic_export(struct wmOperatorType *ot); void WM_OT_alembic_import(struct wmOperatorType *ot); - -#endif /* __IO_ALEMBIC_H__ */ diff --git a/source/blender/editors/io/io_cache.h b/source/blender/editors/io/io_cache.h index c6fc50a236e..be6e31842af 100644 --- a/source/blender/editors/io/io_cache.h +++ b/source/blender/editors/io/io_cache.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __IO_CACHE_H__ -#define __IO_CACHE_H__ +#pragma once /** \file * \ingroup editor/io @@ -28,5 +27,3 @@ struct wmOperatorType; void CACHEFILE_OT_open(struct wmOperatorType *ot); void CACHEFILE_OT_reload(struct wmOperatorType *ot); - -#endif /* __IO_CACHE_H__ */ diff --git a/source/blender/editors/io/io_collada.h b/source/blender/editors/io/io_collada.h index 6330fc9639a..5c0a1a8b927 100644 --- a/source/blender/editors/io/io_collada.h +++ b/source/blender/editors/io/io_collada.h @@ -21,12 +21,9 @@ * \ingroup editor/io */ -#ifndef __IO_COLLADA_H__ -#define __IO_COLLADA_H__ +#pragma once struct wmOperatorType; void WM_OT_collada_export(struct wmOperatorType *ot); void WM_OT_collada_import(struct wmOperatorType *ot); - -#endif diff --git a/source/blender/editors/io/io_ops.h b/source/blender/editors/io/io_ops.h index 2923e052752..2e6cccbf438 100644 --- a/source/blender/editors/io/io_ops.h +++ b/source/blender/editors/io/io_ops.h @@ -21,9 +21,6 @@ * \ingroup editor/io */ -#ifndef __IO_OPS_H__ -#define __IO_OPS_H__ +#pragma once void ED_operatortypes_io(void); - -#endif diff --git a/source/blender/editors/io/io_usd.h b/source/blender/editors/io/io_usd.h index c794dc744df..671984b6f34 100644 --- a/source/blender/editors/io/io_usd.h +++ b/source/blender/editors/io/io_usd.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __IO_USD_H__ -#define __IO_USD_H__ +#pragma once /** \file * \ingroup editor/io @@ -27,5 +26,3 @@ struct wmOperatorType; void WM_OT_usd_export(struct wmOperatorType *ot); - -#endif /* __IO_USD_H__ */ diff --git a/source/blender/editors/lattice/lattice_intern.h b/source/blender/editors/lattice/lattice_intern.h index fe3f35b9223..ee324a3b31e 100644 --- a/source/blender/editors/lattice/lattice_intern.h +++ b/source/blender/editors/lattice/lattice_intern.h @@ -21,8 +21,7 @@ * \ingroup edlattice */ -#ifndef __LATTICE_INTERN_H__ -#define __LATTICE_INTERN_H__ +#pragma once /* editlattice_select.c */ void LATTICE_OT_select_all(struct wmOperatorType *ot); @@ -35,5 +34,3 @@ void LATTICE_OT_select_mirror(struct wmOperatorType *ot); /* editlattice_tools.c */ void LATTICE_OT_make_regular(struct wmOperatorType *ot); void LATTICE_OT_flip(struct wmOperatorType *ot); - -#endif /* __LATTICE_INTERN_H__ */ diff --git a/source/blender/editors/mask/mask_intern.h b/source/blender/editors/mask/mask_intern.h index 6a45af4d2a6..f6990583383 100644 --- a/source/blender/editors/mask/mask_intern.h +++ b/source/blender/editors/mask/mask_intern.h @@ -21,8 +21,7 @@ * \ingroup spclip */ -#ifndef __MASK_INTERN_H__ -#define __MASK_INTERN_H__ +#pragma once struct Mask; struct bContext; @@ -130,5 +129,3 @@ void MASK_OT_shape_key_insert(struct wmOperatorType *ot); void MASK_OT_shape_key_clear(struct wmOperatorType *ot); void MASK_OT_shape_key_feather_reset(struct wmOperatorType *ot); void MASK_OT_shape_key_rekey(struct wmOperatorType *ot); - -#endif /* __MASK_INTERN_H__ */ diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 5dc4ffcad18..4de7143682a 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2035,19 +2035,26 @@ static bool flip_custom_normals(BMesh *bm, BMLoopNorEditDataArray *lnors_ed_arr) } BMFace *f; - BMLoop *l; - BMIter iter_f, iter_l; + BMLoop *l, *l_start; + BMIter iter_f; BM_ITER_MESH (f, &iter_f, bm, BM_FACES_OF_MESH) { + /* Flip all the custom loop normals on the selected faces. */ if (!BM_elem_flag_test(f, BM_ELEM_SELECT)) { continue; } - /* Flip all the custom loop normals on the selected faces. */ - BM_ITER_ELEM (l, &iter_l, f, BM_LOOPS_OF_FACE) { + /* Because the winding has changed, we need to go the reverse way around the face to get the + * correct placement of the normals. However we need to derive the old loop index to get the + * correct data. Note that the first loop index is the same though. So the loop starts and ends + * in the same place as before the flip. + */ + l_start = l = BM_FACE_FIRST_LOOP(f); + int old_index = BM_elem_index_get(l); + do { int loop_index = BM_elem_index_get(l); - BMLoopNorEditData *lnor_ed = lnors_ed_arr->lidx_to_lnor_editdata[loop_index]; + BMLoopNorEditData *lnor_ed = lnors_ed_arr->lidx_to_lnor_editdata[old_index]; BMLoopNorEditData *lnor_ed_new = lnors_ed_arr_new_full->lidx_to_lnor_editdata[loop_index]; BLI_assert(lnor_ed != NULL && lnor_ed_new != NULL); @@ -2055,7 +2062,10 @@ static bool flip_custom_normals(BMesh *bm, BMLoopNorEditDataArray *lnors_ed_arr) BKE_lnor_space_custom_normal_to_data( bm->lnor_spacearr->lspacearr[loop_index], lnor_ed->nloc, lnor_ed_new->clnors_data); - } + + old_index++; + l = l->prev; + } while (l != l_start); } BM_loop_normal_editdata_array_free(lnors_ed_arr_new_full); return true; @@ -4172,7 +4182,8 @@ static Base *mesh_separate_tagged( BKE_object_material_array_assign(bmain, base_new->object, BKE_object_material_array_p(obedit), - *BKE_object_material_len_p(obedit)); + *BKE_object_material_len_p(obedit), + false); ED_object_base_select(base_new, BA_SELECT); @@ -4244,7 +4255,8 @@ static Base *mesh_separate_arrays(Main *bmain, BKE_object_material_array_assign(bmain, base_new->object, BKE_object_material_array_p(obedit), - *BKE_object_material_len_p(obedit)); + *BKE_object_material_len_p(obedit), + false); ED_object_base_select(base_new, BA_SELECT); diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index cec425d687d..bb5da8f3a9c 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -23,8 +23,7 @@ /* Internal for editmesh_xxxx.c functions */ -#ifndef __MESH_INTERN_H__ -#define __MESH_INTERN_H__ +#pragma once struct BMEditMesh; struct BMElem; @@ -276,5 +275,3 @@ void MESH_OT_customdata_skin_add(struct wmOperatorType *ot); void MESH_OT_customdata_skin_clear(struct wmOperatorType *ot); void MESH_OT_customdata_custom_splitnormals_add(struct wmOperatorType *ot); void MESH_OT_customdata_custom_splitnormals_clear(struct wmOperatorType *ot); - -#endif /* __MESH_INTERN_H__ */ diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 4d84db9b35b..964a43dead3 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -1063,7 +1063,7 @@ static float *editmesh_get_mirror_uv( BMFace *efa; BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { - uv_poly_center(efa, cent, cd_loop_uv_offset); + BM_face_uv_calc_center_median(efa, cd_loop_uv_offset, cent); if ((fabsf(cent[0] - cent_vec[0]) < 0.001f) && (fabsf(cent[1] - cent_vec[1]) < 0.001f)) { BMIter liter; diff --git a/source/blender/editors/metaball/mball_intern.h b/source/blender/editors/metaball/mball_intern.h index dec94f97b8a..2b90667f612 100644 --- a/source/blender/editors/metaball/mball_intern.h +++ b/source/blender/editors/metaball/mball_intern.h @@ -21,8 +21,7 @@ * \ingroup edmeta */ -#ifndef __MBALL_INTERN_H__ -#define __MBALL_INTERN_H__ +#pragma once #include "DNA_object_types.h" @@ -37,5 +36,3 @@ void MBALL_OT_duplicate_metaelems(struct wmOperatorType *ot); void MBALL_OT_select_all(struct wmOperatorType *ot); void MBALL_OT_select_similar(struct wmOperatorType *ot); void MBALL_OT_select_random_metaelems(struct wmOperatorType *ot); - -#endif diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index f92dafcc7f9..9c364d41e24 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -255,13 +255,13 @@ void ED_object_base_init_transform_on_add(Object *object, const float loc[3], co /* Uses context to figure out transform for primitive. * Returns standard diameter. */ float ED_object_new_primitive_matrix( - bContext *C, Object *obedit, const float loc[3], const float rot[3], float primmat[4][4]) + bContext *C, Object *obedit, const float loc[3], const float rot[3], float r_primmat[4][4]) { Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); float mat[3][3], rmat[3][3], cmat[3][3], imat[3][3]; - unit_m4(primmat); + unit_m4(r_primmat); eul_to_mat3(rmat, rot); invert_m3(rmat); @@ -270,13 +270,13 @@ float ED_object_new_primitive_matrix( copy_m3_m4(mat, obedit->obmat); mul_m3_m3m3(cmat, rmat, mat); invert_m3_m3(imat, cmat); - copy_m4_m3(primmat, imat); + copy_m4_m3(r_primmat, imat); /* center */ - copy_v3_v3(primmat[3], loc); - sub_v3_v3v3(primmat[3], primmat[3], obedit->obmat[3]); + copy_v3_v3(r_primmat[3], loc); + sub_v3_v3v3(r_primmat[3], r_primmat[3], obedit->obmat[3]); invert_m3_m3(imat, mat); - mul_m3_v3(imat, primmat[3]); + mul_m3_v3(imat, r_primmat[3]); { const float dia = v3d ? ED_view3d_grid_scale(scene, v3d, NULL) : diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c index c4cb21a67f3..edbe4ae9a83 100644 --- a/source/blender/editors/object/object_bake_api.c +++ b/source/blender/editors/object/object_bake_api.c @@ -1598,9 +1598,8 @@ static void bake_set_props(wmOperator *op, Scene *scene) prop = RNA_struct_find_property(op->ptr, "cage_object"); if (!RNA_property_is_set(op->ptr, prop)) { - if (bake->cage_object) { - RNA_property_string_set(op->ptr, prop, bake->cage_object->id.name + 2); - } + RNA_property_string_set( + op->ptr, prop, (bake->cage_object) ? bake->cage_object->id.name + 2 : ""); } prop = RNA_struct_find_property(op->ptr, "normal_space"); diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c index 14bf73027d9..8bec200cb40 100644 --- a/source/blender/editors/object/object_data_transfer.c +++ b/source/blender/editors/object/object_data_transfer.c @@ -420,8 +420,8 @@ static int data_transfer_exec(bContext *C, wmOperator *op) const float ray_radius = RNA_float_get(op->ptr, "ray_radius"); const float islands_precision = RNA_float_get(op->ptr, "islands_precision"); - const int layers_src = RNA_enum_get(op->ptr, "layers_select_src"); - const int layers_dst = RNA_enum_get(op->ptr, "layers_select_dst"); + int layers_src = RNA_enum_get(op->ptr, "layers_select_src"); + int layers_dst = RNA_enum_get(op->ptr, "layers_select_dst"); int layers_select_src[DT_MULTILAYER_INDEX_MAX] = {0}; int layers_select_dst[DT_MULTILAYER_INDEX_MAX] = {0}; const int fromto_idx = BKE_object_data_transfer_dttype_to_srcdst_index(data_type); @@ -447,6 +447,10 @@ static int data_transfer_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } + if (reverse_transfer) { + SWAP(int, layers_src, layers_dst); + } + if (fromto_idx != DT_MULTILAYER_INDEX_INVALID) { layers_select_src[fromto_idx] = layers_src; layers_select_dst[fromto_idx] = layers_dst; @@ -508,13 +512,15 @@ static int data_transfer_exec(bContext *C, wmOperator *op) BLI_freelistN(&ctx_objects); - WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL); + if (changed) { + DEG_relations_tag_update(CTX_data_main(C)); + WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL); + } #if 0 /* TODO */ /* Note: issue with that is that if canceled, operator cannot be redone... Nasty in our case. */ return changed ? OPERATOR_FINISHED : OPERATOR_CANCELLED; #else - (void)changed; return OPERATOR_FINISHED; #endif } @@ -760,7 +766,7 @@ void OBJECT_OT_data_transfer(wmOperatorType *ot) static bool datalayout_transfer_poll(bContext *C) { - return (edit_modifier_poll_generic(C, &RNA_DataTransferModifier, (1 << OB_MESH), true) || + return (edit_modifier_poll_generic(C, &RNA_DataTransferModifier, (1 << OB_MESH), true, false) || data_transfer_poll(C)); } diff --git a/source/blender/editors/object/object_data_transform.c b/source/blender/editors/object/object_data_transform.c index 1e030a50f38..8ea35c7a92c 100644 --- a/source/blender/editors/object/object_data_transform.c +++ b/source/blender/editors/object/object_data_transform.c @@ -48,6 +48,7 @@ #include "BKE_curve.h" #include "BKE_editmesh.h" #include "BKE_gpencil_geom.h" +#include "BKE_key.h" #include "BKE_lattice.h" #include "BKE_mball.h" #include "BKE_mesh.h" @@ -282,16 +283,22 @@ struct XFormObjectData { struct XFormObjectData_Mesh { struct XFormObjectData base; + /* Optional data for shape keys. */ + void *key_data; float elem_array[0][3]; }; struct XFormObjectData_Lattice { struct XFormObjectData base; + /* Optional data for shape keys. */ + void *key_data; float elem_array[0][3]; }; struct XFormObjectData_Curve { struct XFormObjectData base; + /* Optional data for shape keys. */ + void *key_data; float elem_array[0][3]; }; @@ -316,48 +323,98 @@ struct XFormObjectData *ED_object_data_xform_create_ex(ID *id, bool is_edit_mode if (id == NULL) { return xod_base; } + switch (GS(id->name)) { case ID_ME: { Mesh *me = (Mesh *)id; + struct Key *key = me->key; + const int key_index = -1; + if (is_edit_mode) { BMesh *bm = me->edit_mesh->bm; + /* Always operate on all keys for the moment. */ + // key_index = bm->shapenr - 1; const int elem_array_len = bm->totvert; struct XFormObjectData_Mesh *xod = MEM_mallocN( sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__); + memset(xod, 0x0, sizeof(*xod)); + BM_mesh_vert_coords_get(bm, xod->elem_array); xod_base = &xod->base; + + if (key != NULL) { + const size_t key_size = BKE_keyblock_element_calc_size_from_shape(key, key_index); + if (key_size) { + xod->key_data = MEM_mallocN(key_size, __func__); + BKE_keyblock_data_get_from_shape(key, xod->key_data, key_index); + } + } } else { const int elem_array_len = me->totvert; struct XFormObjectData_Mesh *xod = MEM_mallocN( sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__); + memset(xod, 0x0, sizeof(*xod)); + BKE_mesh_vert_coords_get(me, xod->elem_array); xod_base = &xod->base; + + if (key != NULL) { + const size_t key_size = BKE_keyblock_element_calc_size_from_shape(key, key_index); + if (key_size) { + xod->key_data = MEM_mallocN(key_size, __func__); + BKE_keyblock_data_get_from_shape(key, xod->key_data, key_index); + } + } } break; } case ID_LT: { Lattice *lt_orig = (Lattice *)id; Lattice *lt = is_edit_mode ? lt_orig->editlatt->latt : lt_orig; + struct Key *key = lt->key; + const int key_index = -1; + + if (is_edit_mode) { + /* Always operate on all keys for the moment. */ + // key_index = lt_orig->editlatt->shapenr - 1; + } + const int elem_array_len = lt->pntsu * lt->pntsv * lt->pntsw; struct XFormObjectData_Lattice *xod = MEM_mallocN( sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__); + memset(xod, 0x0, sizeof(*xod)); + BKE_lattice_vert_coords_get(lt, xod->elem_array); xod_base = &xod->base; + + if (key != NULL) { + const size_t key_size = BKE_keyblock_element_calc_size_from_shape(key, key_index); + if (key_size) { + xod->key_data = MEM_mallocN(key_size, __func__); + BKE_keyblock_data_get_from_shape(key, xod->key_data, key_index); + } + } + break; } case ID_CU: { Curve *cu = (Curve *)id; + struct Key *key = cu->key; + const short ob_type = BKE_curve_type_get(cu); if (ob_type == OB_FONT) { /* We could support translation. */ break; } + const int key_index = -1; ListBase *nurbs; if (is_edit_mode) { EditNurb *editnurb = cu->editnurb; nurbs = &editnurb->nurbs; + /* Always operate on all keys for the moment. */ + // key_index = editnurb->shapenr - 1; } else { nurbs = &cu->nurb; @@ -366,8 +423,19 @@ struct XFormObjectData *ED_object_data_xform_create_ex(ID *id, bool is_edit_mode const int elem_array_len = BKE_nurbList_verts_count(nurbs); struct XFormObjectData_Curve *xod = MEM_mallocN( sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__); + memset(xod, 0x0, sizeof(*xod)); + BKE_curve_nurbs_vert_coords_get(nurbs, xod->elem_array, elem_array_len); xod_base = &xod->base; + + if (key != NULL) { + const size_t key_size = BKE_keyblock_element_calc_size_from_shape(key, key_index); + if (key_size) { + xod->key_data = MEM_mallocN(key_size, __func__); + BKE_keyblock_data_get_from_shape(key, xod->key_data, key_index); + } + } + break; } case ID_AR: { @@ -376,6 +444,8 @@ struct XFormObjectData *ED_object_data_xform_create_ex(ID *id, bool is_edit_mode const int elem_array_len = BLI_listbase_count(arm->edbo); struct XFormObjectData_Armature *xod = MEM_mallocN( sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__); + memset(xod, 0x0, sizeof(*xod)); + edit_armature_coords_and_quats_get(arm, xod->elem_array); xod_base = &xod->base; } @@ -383,6 +453,8 @@ struct XFormObjectData *ED_object_data_xform_create_ex(ID *id, bool is_edit_mode const int elem_array_len = BKE_armature_bonelist_count(&arm->bonebase); struct XFormObjectData_Armature *xod = MEM_mallocN( sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__); + memset(xod, 0x0, sizeof(*xod)); + armature_coords_and_quats_get(arm, xod->elem_array); xod_base = &xod->base; } @@ -394,6 +466,8 @@ struct XFormObjectData *ED_object_data_xform_create_ex(ID *id, bool is_edit_mode const int elem_array_len = BLI_listbase_count(&mb->elems); struct XFormObjectData_MetaBall *xod = MEM_mallocN( sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__); + memset(xod, 0x0, sizeof(*xod)); + metaball_coords_and_quats_get(mb, xod->elem_array); xod_base = &xod->base; break; @@ -403,6 +477,8 @@ struct XFormObjectData *ED_object_data_xform_create_ex(ID *id, bool is_edit_mode const int elem_array_len = BKE_gpencil_stroke_point_count(gpd); struct XFormObjectData_GPencil *xod = MEM_mallocN( sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__); + memset(xod, 0x0, sizeof(*xod)); + BKE_gpencil_point_coords_get(gpd, xod->elem_array); xod_base = &xod->base; break; @@ -428,9 +504,35 @@ struct XFormObjectData *ED_object_data_xform_create_from_edit_mode(ID *id) return ED_object_data_xform_create_ex(id, true); } -void ED_object_data_xform_destroy(struct XFormObjectData *xod) +void ED_object_data_xform_destroy(struct XFormObjectData *xod_base) { - MEM_freeN(xod); + switch (GS(xod_base->id->name)) { + case ID_ME: { + struct XFormObjectData_Mesh *xod = (struct XFormObjectData_Mesh *)xod_base; + if (xod->key_data != NULL) { + MEM_freeN(xod->key_data); + } + break; + } + case ID_LT: { + struct XFormObjectData_Lattice *xod = (struct XFormObjectData_Lattice *)xod_base; + if (xod->key_data != NULL) { + MEM_freeN(xod->key_data); + } + break; + } + case ID_CU: { + struct XFormObjectData_Curve *xod = (struct XFormObjectData_Curve *)xod_base; + if (xod->key_data != NULL) { + MEM_freeN(xod->key_data); + } + break; + } + default: { + break; + } + } + MEM_freeN(xod_base); } void ED_object_data_xform_by_mat4(struct XFormObjectData *xod_base, const float mat[4][4]) @@ -438,34 +540,72 @@ void ED_object_data_xform_by_mat4(struct XFormObjectData *xod_base, const float switch (GS(xod_base->id->name)) { case ID_ME: { Mesh *me = (Mesh *)xod_base->id; + + struct Key *key = me->key; + const int key_index = -1; + struct XFormObjectData_Mesh *xod = (struct XFormObjectData_Mesh *)xod_base; if (xod_base->is_edit_mode) { BMesh *bm = me->edit_mesh->bm; BM_mesh_vert_coords_apply_with_mat4(bm, xod->elem_array, mat); + /* Always operate on all keys for the moment. */ + // key_index = bm->shapenr - 1; } else { BKE_mesh_vert_coords_apply_with_mat4(me, xod->elem_array, mat); } + + if (key != NULL) { + BKE_keyblock_data_set_with_mat4(key, key_index, xod->key_data, mat); + } + break; } case ID_LT: { Lattice *lt_orig = (Lattice *)xod_base->id; Lattice *lt = xod_base->is_edit_mode ? lt_orig->editlatt->latt : lt_orig; + + struct Key *key = lt->key; + const int key_index = -1; + struct XFormObjectData_Lattice *xod = (struct XFormObjectData_Lattice *)xod_base; BKE_lattice_vert_coords_apply_with_mat4(lt, xod->elem_array, mat); + if (xod_base->is_edit_mode) { + /* Always operate on all keys for the moment. */ + // key_index = lt_orig->editlatt->shapenr - 1; + } + + if ((key != NULL) && (xod->key_data != NULL)) { + BKE_keyblock_data_set_with_mat4(key, key_index, xod->key_data, mat); + } + break; } case ID_CU: { BLI_assert(xod_base->is_edit_mode == false); /* Not used currently. */ Curve *cu = (Curve *)xod_base->id; + + struct Key *key = cu->key; + const int key_index = -1; + ListBase *nurb = NULL; + struct XFormObjectData_Curve *xod = (struct XFormObjectData_Curve *)xod_base; if (xod_base->is_edit_mode) { EditNurb *editnurb = cu->editnurb; + nurb = &editnurb->nurbs; BKE_curve_nurbs_vert_coords_apply_with_mat4(&editnurb->nurbs, xod->elem_array, mat, true); + /* Always operate on all keys for the moment. */ + // key_index = editnurb->shapenr - 1; } else { + nurb = &cu->nurb; BKE_curve_nurbs_vert_coords_apply_with_mat4(&cu->nurb, xod->elem_array, mat, true); } + + if ((key != NULL) && (xod->key_data != NULL)) { + BKE_keyblock_curve_data_set_with_mat4(key, nurb, key_index, xod->key_data, mat); + } + break; } case ID_AR: { @@ -504,33 +644,68 @@ void ED_object_data_xform_restore(struct XFormObjectData *xod_base) switch (GS(xod_base->id->name)) { case ID_ME: { Mesh *me = (Mesh *)xod_base->id; + + struct Key *key = me->key; + const int key_index = -1; + struct XFormObjectData_Mesh *xod = (struct XFormObjectData_Mesh *)xod_base; if (xod_base->is_edit_mode) { BMesh *bm = me->edit_mesh->bm; BM_mesh_vert_coords_apply(bm, xod->elem_array); + /* Always operate on all keys for the moment. */ + // key_index = bm->shapenr - 1; } else { BKE_mesh_vert_coords_apply(me, xod->elem_array); } + + if ((key != NULL) && (xod->key_data != NULL)) { + BKE_keyblock_data_set(key, key_index, xod->key_data); + } + break; } case ID_LT: { Lattice *lt_orig = (Lattice *)xod_base->id; Lattice *lt = xod_base->is_edit_mode ? lt_orig->editlatt->latt : lt_orig; + + struct Key *key = lt->key; + const int key_index = -1; + struct XFormObjectData_Lattice *xod = (struct XFormObjectData_Lattice *)xod_base; BKE_lattice_vert_coords_apply(lt, xod->elem_array); + if (xod_base->is_edit_mode) { + /* Always operate on all keys for the moment. */ + // key_index = lt_orig->editlatt->shapenr - 1; + } + + if ((key != NULL) && (xod->key_data != NULL)) { + BKE_keyblock_data_set(key, key_index, xod->key_data); + } + break; } case ID_CU: { Curve *cu = (Curve *)xod_base->id; + + struct Key *key = cu->key; + const int key_index = -1; + struct XFormObjectData_Curve *xod = (struct XFormObjectData_Curve *)xod_base; if (xod_base->is_edit_mode) { EditNurb *editnurb = cu->editnurb; BKE_curve_nurbs_vert_coords_apply(&editnurb->nurbs, xod->elem_array, true); + /* Always operate on all keys for the moment. */ + // key_index = editnurb->shapenr - 1; } else { BKE_curve_nurbs_vert_coords_apply(&cu->nurb, xod->elem_array, true); } + + if ((key != NULL) && (xod->key_data != NULL)) { + BKE_keyblock_data_set(key, key_index, xod->key_data); + } + break; } case ID_AR: { diff --git a/source/blender/editors/object/object_gpencil_modifier.c b/source/blender/editors/object/object_gpencil_modifier.c index 019ab2c345b..cfa55c68a56 100644 --- a/source/blender/editors/object/object_gpencil_modifier.c +++ b/source/blender/editors/object/object_gpencil_modifier.c @@ -412,28 +412,30 @@ void OBJECT_OT_gpencil_modifier_add(wmOperatorType *ot) /********** generic functions for operators using mod names and data context *********************/ -static int gpencil_edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag) +static bool gpencil_edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag) { PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", rna_type); Object *ob = (ptr.owner_id) ? (Object *)ptr.owner_id : ED_object_active_context(C); + GpencilModifierData *mod = ptr.data; /* May be NULL. */ if (!ob || ID_IS_LINKED(ob)) { - return 0; + return false; } if (obtype_flag && ((1 << ob->type) & obtype_flag) == 0) { - return 0; + return false; } if (ptr.owner_id && ID_IS_LINKED(ptr.owner_id)) { - return 0; + return false; } if (ID_IS_OVERRIDE_LIBRARY(ob)) { - CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from library override"); - return (((GpencilModifierData *)ptr.data)->flag & - eGpencilModifierFlag_OverrideLibrary_Local) != 0; + if ((mod == NULL) || (mod->flag & eGpencilModifierFlag_OverrideLibrary_Local) == 0) { + CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from library override"); + return false; + } } - return 1; + return true; } static bool gpencil_edit_modifier_poll(bContext *C) diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 9dc204b9083..50825ae1ae4 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -21,8 +21,7 @@ * \ingroup edobj */ -#ifndef __OBJECT_INTERN_H__ -#define __OBJECT_INTERN_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -150,8 +149,8 @@ void COLLECTION_OT_objects_remove_active(struct wmOperatorType *ot); bool edit_modifier_poll_generic(struct bContext *C, struct StructRNA *rna_type, int obtype_flag, - const bool is_editmode_allowed); -bool edit_modifier_poll(struct bContext *C); + const bool is_editmode_allowed, + const bool is_liboverride_allowed); void edit_modifier_properties(struct wmOperatorType *ot); bool edit_modifier_invoke_properties(struct bContext *C, struct wmOperator *op, @@ -311,5 +310,3 @@ void OBJECT_OT_datalayout_transfer(struct wmOperatorType *ot); #ifdef __cplusplus } #endif - -#endif /* __OBJECT_INTERN_H__ */ diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 8a736c380bf..8b48406bce8 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -895,6 +895,8 @@ int ED_object_modifier_copy( BKE_modifier_unique_name(&ob->modifiers, nmd); } + nmd->flag |= eModifierFlag_OverrideLibrary_Local; + return 1; } @@ -1005,7 +1007,8 @@ void OBJECT_OT_modifier_add(wmOperatorType *ot) bool edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag, - const bool is_editmode_allowed) + const bool is_editmode_allowed, + const bool is_liboverride_allowed) { PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", rna_type); Object *ob = (ptr.owner_id) ? (Object *)ptr.owner_id : ED_object_active_context(C); @@ -1021,8 +1024,8 @@ bool edit_modifier_poll_generic(bContext *C, return false; } - if (ID_IS_OVERRIDE_LIBRARY(ob)) { - if ((mod != NULL) && (mod->flag & eModifierFlag_OverrideLibrary_Local) == 0) { + if (ID_IS_OVERRIDE_LIBRARY(ob) && !is_liboverride_allowed) { + if ((mod == NULL) || (mod->flag & eModifierFlag_OverrideLibrary_Local) == 0) { CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from library override"); return false; } @@ -1036,9 +1039,16 @@ bool edit_modifier_poll_generic(bContext *C, return true; } -bool edit_modifier_poll(bContext *C) +static bool edit_modifier_poll(bContext *C) { - return edit_modifier_poll_generic(C, &RNA_Modifier, 0, true); + return edit_modifier_poll_generic(C, &RNA_Modifier, 0, true, false); +} + +/* Used by operators performing actions allowed also on modifiers from the overridden linked object + * (not only from added 'local' ones). */ +static bool edit_modifier_liboverride_allowed_poll(bContext *C) +{ + return edit_modifier_poll_generic(C, &RNA_Modifier, 0, true, true); } void edit_modifier_properties(wmOperatorType *ot) @@ -1282,11 +1292,6 @@ void OBJECT_OT_modifier_move_down(wmOperatorType *ot) /** \name Move to Index Modifier Operator * \{ */ -static bool modifier_move_to_index_poll(bContext *C) -{ - return edit_modifier_poll(C); -} - static int modifier_move_to_index_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); @@ -1321,7 +1326,7 @@ void OBJECT_OT_modifier_move_to_index(wmOperatorType *ot) ot->invoke = modifier_move_to_index_invoke; ot->exec = modifier_move_to_index_exec; - ot->poll = modifier_move_to_index_poll; + ot->poll = edit_modifier_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; @@ -1338,7 +1343,7 @@ void OBJECT_OT_modifier_move_to_index(wmOperatorType *ot) static bool modifier_apply_poll_ex(bContext *C, bool allow_shared) { - if (!edit_modifier_poll_generic(C, &RNA_Modifier, 0, false)) { + if (!edit_modifier_poll_generic(C, &RNA_Modifier, 0, false, false)) { return false; } @@ -1347,7 +1352,7 @@ static bool modifier_apply_poll_ex(bContext *C, bool allow_shared) Object *ob = (ptr.owner_id != NULL) ? (Object *)ptr.owner_id : ED_object_active_context(C); ModifierData *md = ptr.data; /* May be NULL. */ - if (ID_IS_OVERRIDE_LIBRARY(ob) || ID_IS_OVERRIDE_LIBRARY(ob->data)) { + if (ID_IS_OVERRIDE_LIBRARY(ob) || ((ob->data != NULL) && ID_IS_OVERRIDE_LIBRARY(ob->data))) { CTX_wm_operator_poll_msg_set(C, "Modifiers cannot be applied on override data"); return false; } @@ -1585,7 +1590,7 @@ void OBJECT_OT_modifier_copy(wmOperatorType *ot) ot->invoke = modifier_copy_invoke; ot->exec = modifier_copy_exec; - ot->poll = edit_modifier_poll; + ot->poll = edit_modifier_liboverride_allowed_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; @@ -1600,7 +1605,7 @@ void OBJECT_OT_modifier_copy(wmOperatorType *ot) static bool multires_poll(bContext *C) { - return edit_modifier_poll_generic(C, &RNA_MultiresModifier, (1 << OB_MESH), true); + return edit_modifier_poll_generic(C, &RNA_MultiresModifier, (1 << OB_MESH), true, false); } static int multires_higher_levels_delete_exec(bContext *C, wmOperator *op) @@ -2109,13 +2114,14 @@ static void modifier_skin_customdata_delete(Object *ob) static bool skin_poll(bContext *C) { - return (edit_modifier_poll_generic(C, &RNA_SkinModifier, (1 << OB_MESH), false)); + return (edit_modifier_poll_generic(C, &RNA_SkinModifier, (1 << OB_MESH), false, false)); } static bool skin_edit_poll(bContext *C) { Object *ob = CTX_data_edit_object(C); - return (ob != NULL && edit_modifier_poll_generic(C, &RNA_SkinModifier, (1 << OB_MESH), true) && + return (ob != NULL && + edit_modifier_poll_generic(C, &RNA_SkinModifier, (1 << OB_MESH), true, false) && !ID_IS_OVERRIDE_LIBRARY(ob) && !ID_IS_OVERRIDE_LIBRARY(ob->data)); } @@ -2471,7 +2477,7 @@ void OBJECT_OT_skin_armature_create(wmOperatorType *ot) static bool correctivesmooth_poll(bContext *C) { - return edit_modifier_poll_generic(C, &RNA_CorrectiveSmoothModifier, 0, true); + return edit_modifier_poll_generic(C, &RNA_CorrectiveSmoothModifier, 0, true, false); } static int correctivesmooth_bind_exec(bContext *C, wmOperator *op) @@ -2551,7 +2557,7 @@ void OBJECT_OT_correctivesmooth_bind(wmOperatorType *ot) static bool meshdeform_poll(bContext *C) { - return edit_modifier_poll_generic(C, &RNA_MeshDeformModifier, 0, true); + return edit_modifier_poll_generic(C, &RNA_MeshDeformModifier, 0, true, false); } static int meshdeform_bind_exec(bContext *C, wmOperator *op) @@ -2626,7 +2632,7 @@ void OBJECT_OT_meshdeform_bind(wmOperatorType *ot) static bool explode_poll(bContext *C) { - return edit_modifier_poll_generic(C, &RNA_ExplodeModifier, 0, true); + return edit_modifier_poll_generic(C, &RNA_ExplodeModifier, 0, true, false); } static int explode_refresh_exec(bContext *C, wmOperator *op) @@ -2678,7 +2684,7 @@ void OBJECT_OT_explode_refresh(wmOperatorType *ot) static bool ocean_bake_poll(bContext *C) { - return edit_modifier_poll_generic(C, &RNA_OceanModifier, 0, true); + return edit_modifier_poll_generic(C, &RNA_OceanModifier, 0, true, false); } typedef struct OceanBakeJob { @@ -2886,7 +2892,7 @@ void OBJECT_OT_ocean_bake(wmOperatorType *ot) static bool laplaciandeform_poll(bContext *C) { - return edit_modifier_poll_generic(C, &RNA_LaplacianDeformModifier, 0, false); + return edit_modifier_poll_generic(C, &RNA_LaplacianDeformModifier, 0, false, false); } static int laplaciandeform_bind_exec(bContext *C, wmOperator *op) @@ -2963,7 +2969,7 @@ void OBJECT_OT_laplaciandeform_bind(wmOperatorType *ot) static bool surfacedeform_bind_poll(bContext *C) { - return edit_modifier_poll_generic(C, &RNA_SurfaceDeformModifier, 0, true); + return edit_modifier_poll_generic(C, &RNA_SurfaceDeformModifier, 0, true, false); } static int surfacedeform_bind_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/object/object_shader_fx.c b/source/blender/editors/object/object_shader_fx.c index 977d4abd4d4..e2a30c4ce98 100644 --- a/source/blender/editors/object/object_shader_fx.c +++ b/source/blender/editors/object/object_shader_fx.c @@ -332,23 +332,26 @@ static bool edit_shaderfx_poll_generic(bContext *C, StructRNA *rna_type, int obt { PointerRNA ptr = CTX_data_pointer_get_type(C, "shaderfx", rna_type); Object *ob = (ptr.owner_id) ? (Object *)ptr.owner_id : ED_object_active_context(C); + ShaderFxData *fx = ptr.data; /* May be NULL. */ if (!ob || ID_IS_LINKED(ob)) { - return 0; + return false; } if (obtype_flag && ((1 << ob->type) & obtype_flag) == 0) { - return 0; + return false; } if (ptr.owner_id && ID_IS_LINKED(ptr.owner_id)) { - return 0; + return false; } if (ID_IS_OVERRIDE_LIBRARY(ob)) { - CTX_wm_operator_poll_msg_set(C, "Cannot edit shaderfxs coming from library override"); - return (((ShaderFxData *)ptr.data)->flag & eShaderFxFlag_OverrideLibrary_Local) != 0; + if ((fx == NULL) || (fx->flag & eShaderFxFlag_OverrideLibrary_Local) == 0) { + CTX_wm_operator_poll_msg_set(C, "Cannot edit shaderfxs coming from library override"); + return false; + } } - return 1; + return true; } static bool edit_shaderfx_poll(bContext *C) diff --git a/source/blender/editors/physics/particle_edit_utildefines.h b/source/blender/editors/physics/particle_edit_utildefines.h index dc858687341..289ca193f17 100644 --- a/source/blender/editors/physics/particle_edit_utildefines.h +++ b/source/blender/editors/physics/particle_edit_utildefines.h @@ -21,8 +21,7 @@ * \ingroup edphys */ -#ifndef __PARTICLE_EDIT_UTILDEFINES_H__ -#define __PARTICLE_EDIT_UTILDEFINES_H__ +#pragma once #define KEY_K \ PTCacheEditKey *key; \ @@ -58,5 +57,3 @@ if (key->flag & PEK_TAG) #define KEY_WCO ((key->flag & PEK_USE_WCO) ? key->world_co : key->co) - -#endif /* __PARTICLE_EDIT_UTILDEFINES_H__ */ diff --git a/source/blender/editors/physics/physics_intern.h b/source/blender/editors/physics/physics_intern.h index 87c3a709d47..4dc3ded9bd7 100644 --- a/source/blender/editors/physics/physics_intern.h +++ b/source/blender/editors/physics/physics_intern.h @@ -21,8 +21,7 @@ * \ingroup edphys */ -#ifndef __PHYSICS_INTERN_H__ -#define __PHYSICS_INTERN_H__ +#pragma once struct Depsgraph; struct Object; @@ -152,5 +151,3 @@ void RIGIDBODY_OT_constraint_remove(struct wmOperatorType *ot); void RIGIDBODY_OT_world_add(struct wmOperatorType *ot); void RIGIDBODY_OT_world_remove(struct wmOperatorType *ot); void RIGIDBODY_OT_world_export(struct wmOperatorType *ot); - -#endif /* __PHYSICS_INTERN_H__ */ diff --git a/source/blender/editors/render/render_intern.h b/source/blender/editors/render/render_intern.h index 88b913b84ca..d3a06f0fc2c 100644 --- a/source/blender/editors/render/render_intern.h +++ b/source/blender/editors/render/render_intern.h @@ -21,8 +21,7 @@ * \ingroup edrend */ -#ifndef __RENDER_INTERN_H__ -#define __RENDER_INTERN_H__ +#pragma once struct ScrArea; struct bContext; @@ -90,5 +89,3 @@ void RENDER_OT_view_cancel(struct wmOperatorType *ot); /* render_opengl.c */ void RENDER_OT_opengl(struct wmOperatorType *ot); - -#endif /* __RENDER_INTERN_H__ */ diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 149bae718a0..711f89b9fda 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -465,17 +465,27 @@ static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Object *ob = ED_object_context(C); - Material ***matar; + Material ***matar_obdata; - if (!ob || !(matar = BKE_object_material_array_p(ob))) { + if (!ob || !(matar_obdata = BKE_object_material_array_p(ob))) { return OPERATOR_CANCELLED; } + BLI_assert(ob->totcol == *BKE_object_material_len_p(ob)); + + Material ***matar_object = &ob->mat; + + Material **matar = MEM_callocN(sizeof(*matar) * (size_t)ob->totcol, __func__); + for (int i = ob->totcol; i--;) { + matar[i] = ob->matbits[i] ? (*matar_object)[i] : (*matar_obdata)[i]; + } + CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) { if (ob != ob_iter && BKE_object_material_array_p(ob_iter)) { - if (ob->data != ob_iter->data) { - BKE_object_material_array_assign(bmain, ob_iter, matar, ob->totcol); - } + /* If we are using the same obdata, we only assign slots in ob_iter that are using object + * materials, and not obdata ones. */ + const bool is_same_obdata = ob->data == ob_iter->data; + BKE_object_material_array_assign(bmain, ob_iter, &matar, ob->totcol, is_same_obdata); if (ob_iter->totcol == ob->totcol) { ob_iter->actcol = ob->actcol; @@ -486,6 +496,8 @@ static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op)) } CTX_DATA_END; + MEM_freeN(matar); + return OPERATOR_FINISHED; } @@ -933,6 +945,11 @@ static int light_cache_bake_modal(bContext *C, wmOperator *op, const wmEvent *ev /* no running blender, remove handler and pass through */ if (0 == WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_RENDER)) { + LightCache *lcache = scene->eevee.light_cache_data; + if (lcache && (lcache->flag & LIGHTCACHE_INVALID)) { + BKE_report(op->reports, RPT_ERROR, "Lightcache cannot allocate resources"); + return OPERATOR_CANCELLED; + } return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH; } diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h index 2d42313d528..21168a992b5 100644 --- a/source/blender/editors/screen/screen_intern.h +++ b/source/blender/editors/screen/screen_intern.h @@ -21,8 +21,7 @@ * \ingroup edscr */ -#ifndef __SCREEN_INTERN_H__ -#define __SCREEN_INTERN_H__ +#pragma once struct Main; struct bContext; @@ -97,5 +96,3 @@ void SCREEN_OT_screenshot(struct wmOperatorType *ot); /* workspace_layout_edit.c */ bool workspace_layout_set_poll(const struct WorkSpaceLayout *layout); - -#endif /* __SCREEN_INTERN_H__ */ diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index fde1498bc5e..f882a786b65 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -4414,7 +4414,7 @@ static void screen_animation_region_tag_redraw(ScrArea *area, * We do need to redraw when this area is in full screen as no other areas * will be tagged for redrawing. */ if ((region->regiontype == RGN_TYPE_WINDOW) && - (ELEM(area->spacetype, SPACE_GRAPH, SPACE_NLA, SPACE_ACTION, SPACE_SEQ)) && !area->full) { + (ELEM(area->spacetype, SPACE_GRAPH, SPACE_NLA, SPACE_ACTION)) && !area->full) { return; } ED_region_tag_redraw(region); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 7f64fdf3501..7ee3d991eb7 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -1118,7 +1118,6 @@ void PAINT_OT_sample_color(wmOperatorType *ot) void ED_object_texture_paint_mode_enter_ex(Main *bmain, Scene *scene, Object *ob) { - bScreen *screen; Image *ima = NULL; ImagePaintSettings *imapaint = &scene->toolsettings->imapaint; @@ -1142,17 +1141,16 @@ void ED_object_texture_paint_mode_enter_ex(Main *bmain, Scene *scene, Object *ob } if (ima) { - for (screen = bmain->screens.first; screen; screen = screen->id.next) { - ScrArea *area; - for (area = screen->areabase.first; area; area = area->next) { - SpaceLink *sl; - for (sl = area->spacedata.first; sl; sl = sl->next) { - if (sl->spacetype == SPACE_IMAGE) { - SpaceImage *sima = (SpaceImage *)sl; - - if (!sima->pin) { - ED_space_image_set(bmain, sima, NULL, ima, true); - } + wmWindowManager *wm = bmain->wm.first; + for (wmWindow *win = wm->windows.first; win; win = win->next) { + const bScreen *screen = WM_window_get_active_screen(win); + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + SpaceLink *sl = area->spacedata.first; + if (sl->spacetype == SPACE_IMAGE) { + SpaceImage *sima = (SpaceImage *)sl; + + if (!sima->pin) { + ED_space_image_set(bmain, sima, NULL, ima, true); } } } diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index 0d4e957c77b..d532ef977fe 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -21,8 +21,7 @@ * \ingroup edsculpt */ -#ifndef __PAINT_INTERN_H__ -#define __PAINT_INTERN_H__ +#pragma once struct ARegion; struct Brush; @@ -366,5 +365,3 @@ void paint_delete_blur_kernel(BlurKernel *); /* paint curve defines */ #define PAINT_CURVE_NUM_SEGMENTS 40 - -#endif /* __PAINT_INTERN_H__ */ diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index da5d6588dc8..13b576f0402 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3147,21 +3147,49 @@ void SCULPT_relax_vertex(SculptSession *ss, { float smooth_pos[3]; float final_disp[3]; - int count = 0; + float boundary_normal[3]; + int avg_count = 0; + int neighbor_count = 0; zero_v3(smooth_pos); + zero_v3(boundary_normal); + const bool is_boundary = SCULPT_vertex_is_boundary(ss, vd->index); SculptVertexNeighborIter ni; SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vd->index, ni) { + neighbor_count++; if (!filter_boundary_face_sets || (filter_boundary_face_sets && !SCULPT_vertex_has_unique_face_set(ss, ni.index))) { - add_v3_v3(smooth_pos, SCULPT_vertex_co_get(ss, ni.index)); - count++; + + /* When the vertex to relax is boundary, use only connected boundary vertices for the average + * position. */ + if (is_boundary) { + if (SCULPT_vertex_is_boundary(ss, ni.index)) { + add_v3_v3(smooth_pos, SCULPT_vertex_co_get(ss, ni.index)); + avg_count++; + + /* Calculate a normal for the constraint plane using the edges of the boundary. */ + float to_neighbor[3]; + sub_v3_v3v3(to_neighbor, SCULPT_vertex_co_get(ss, ni.index), vd->co); + normalize_v3(to_neighbor); + add_v3_v3(boundary_normal, to_neighbor); + } + } + else { + add_v3_v3(smooth_pos, SCULPT_vertex_co_get(ss, ni.index)); + avg_count++; + } } } SCULPT_VERTEX_NEIGHBORS_ITER_END(ni); - if (count > 0) { - mul_v3_fl(smooth_pos, 1.0f / (float)count); + /* Don't modify corner vertices. */ + if (neighbor_count <= 2) { + copy_v3_v3(r_final_pos, vd->co); + return; + } + + if (avg_count > 0) { + mul_v3_fl(smooth_pos, 1.0f / (float)avg_count); } else { copy_v3_v3(r_final_pos, vd->co); @@ -3171,11 +3199,12 @@ void SCULPT_relax_vertex(SculptSession *ss, float plane[4]; float smooth_closest_plane[3]; float vno[3]; - if (vd->no) { - normal_short_to_float_v3(vno, vd->no); + + if (is_boundary && avg_count == 2) { + normalize_v3_v3(vno, boundary_normal); } else { - copy_v3_v3(vno, vd->fno); + SCULPT_vertex_normal_get(ss, vd->index, vno); } if (is_zero_v3(vno)) { @@ -3256,6 +3285,7 @@ static void do_slide_relax_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int t TaskParallelSettings settings; BKE_pbvh_parallel_range_settings(&settings, true, totnode); if (ss->cache->alt_smooth) { + SCULPT_boundary_info_ensure(ob); for (int i = 0; i < 4; i++) { BLI_task_parallel_range(0, totnode, &data, do_topology_relax_task_cb_ex, &settings); } @@ -5486,7 +5516,7 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSe SculptSearchSphereData data = { .ss = ss, .sd = sd, - .radius_squared = square_f(ss->cache->radius * (1.0 + brush->cloth_sim_limit)), + .radius_squared = square_f(ss->cache->initial_radius * (1.0 + brush->cloth_sim_limit)), .original = false, .ignore_fully_ineffective = false, .center = ss->cache->initial_location, @@ -5865,7 +5895,7 @@ void SCULPT_flush_stroke_deform(Sculpt *sd, Object *ob, bool is_proxy_used) SculptSession *ss = ob->sculpt; Brush *brush = BKE_paint_brush(&sd->paint); - if (is_proxy_used) { + if (is_proxy_used && ss->deform_modifiers_active) { /* This brushes aren't using proxies, so sculpt_combine_proxies() wouldn't propagate needed * deformation to original base. */ @@ -7140,7 +7170,6 @@ static void sculpt_brush_init_tex(const Scene *scene, Sculpt *sd, SculptSession static void sculpt_brush_stroke_init(bContext *C, wmOperator *op) { - Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); Sculpt *sd = CTX_data_tool_settings(C)->sculpt; @@ -7163,6 +7192,14 @@ static void sculpt_brush_stroke_init(bContext *C, wmOperator *op) is_smooth = sculpt_needs_connectivity_info(sd, brush, ss, mode); needs_colors = ELEM(brush->sculpt_tool, SCULPT_TOOL_PAINT, SCULPT_TOOL_SMEAR); + + if (needs_colors) { + BKE_sculpt_color_layer_create_if_needed(ob); + } + + /* CTX_data_ensure_evaluated_depsgraph should be used at the end to include the updates of + * earlier steps modifying the data. */ + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); BKE_sculpt_update_object_for_edit(depsgraph, ob, is_smooth, need_mask, needs_colors); } @@ -7171,11 +7208,16 @@ static void sculpt_restore_mesh(Sculpt *sd, Object *ob) SculptSession *ss = ob->sculpt; Brush *brush = BKE_paint_brush(&sd->paint); + /* For the cloth brush it makes more sense to not restore the mesh state to keep running the + * simulation from the previous state. */ + if (brush->sculpt_tool == SCULPT_TOOL_CLOTH) { + return; + } + /* Restore the mesh before continuing with anchored stroke. */ if ((brush->flag & BRUSH_ANCHORED) || ((brush->sculpt_tool == SCULPT_TOOL_GRAB || - brush->sculpt_tool == SCULPT_TOOL_ELASTIC_DEFORM || - brush->sculpt_tool == SCULPT_TOOL_CLOTH) && + brush->sculpt_tool == SCULPT_TOOL_ELASTIC_DEFORM) && BKE_brush_use_size_pressure(brush)) || (brush->flag & BRUSH_DRAG_DOT)) { @@ -8905,7 +8947,7 @@ static void SCULPT_OT_mask_by_color(wmOperatorType *ot) "preserve_previous_mask", false, "Preserve Previous Mask", - "Preserve the previous mask and add or substract the new one generated by the colors"); + "Preserve the previous mask and add or subtract the new one generated by the colors"); RNA_def_float(ot->srna, "threshold", diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c b/source/blender/editors/sculpt_paint/sculpt_cloth.c index 6a2137b6626..4232be91034 100644 --- a/source/blender/editors/sculpt_paint/sculpt_cloth.c +++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c @@ -254,8 +254,7 @@ static void do_cloth_brush_apply_forces_task_cb_ex(void *__restrict userdata, /* Gravity */ float gravity[3] = {0.0f}; if (ss->cache->supports_gravity) { - madd_v3_v3fl( - gravity, ss->cache->gravity_direction, -ss->cache->radius * data->sd->gravity_factor); + madd_v3_v3fl(gravity, ss->cache->gravity_direction, -data->sd->gravity_factor); } /* Original data for deform brushes. */ @@ -279,6 +278,11 @@ static void do_cloth_brush_apply_forces_task_cb_ex(void *__restrict userdata, copy_v3_v3(current_vertex_location, vd.co); } + /* Apply gravity in the entire simulation area. */ + float vertex_gravity[3]; + mul_v3_v3fl(vertex_gravity, gravity, sim_factor); + cloth_brush_apply_force_to_vertex(ss, ss->cache->cloth_sim, vertex_gravity, vd.index); + /* When using the plane falloff mode the falloff is not constrained by the brush radius. */ if (sculpt_brush_test_sq_fn(&test, current_vertex_location) || use_falloff_plane) { @@ -356,8 +360,6 @@ static void do_cloth_brush_apply_forces_task_cb_ex(void *__restrict userdata, break; } - madd_v3_v3fl(force, gravity, fade); - cloth_brush_apply_force_to_vertex(ss, ss->cache->cloth_sim, force, vd.index); } } @@ -639,12 +641,13 @@ void SCULPT_do_cloth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode /* In the first brush step of each symmetry pass, build the constraints for the vertices in all * nodes inside the simulation's limits. */ - /* Brush stroke types that restore the mesh on each brush step also need the cloth sim data to be - * created on each step. */ + /* Brushes that use anchored strokes and restore the mesh can't rely on symmetry passes and steps + * count as it is always the first step, so the simulation needs to be created when it does not + * exist for this stroke. */ if (SCULPT_stroke_is_first_brush_step_of_symmetry_pass(ss->cache) || !ss->cache->cloth_sim) { /* The simulation structure only needs to be created on the first symmetry pass. */ - if (SCULPT_stroke_is_first_brush_step(ss->cache)) { + if (SCULPT_stroke_is_first_brush_step(ss->cache) || !ss->cache->cloth_sim) { ss->cache->cloth_sim = cloth_brush_simulation_create( ss, brush->cloth_mass, brush->cloth_damping); for (int i = 0; i < totverts; i++) { diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c b/source/blender/editors/sculpt_paint/sculpt_face_set.c index 031b4f8731d..1940b007cb0 100644 --- a/source/blender/editors/sculpt_paint/sculpt_face_set.c +++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c @@ -205,6 +205,7 @@ void SCULPT_do_draw_face_sets_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, in TaskParallelSettings settings; BKE_pbvh_parallel_range_settings(&settings, true, totnode); if (ss->cache->alt_smooth) { + SCULPT_boundary_info_ensure(ob); for (int i = 0; i < 4; i++) { BLI_task_parallel_range(0, totnode, &data, do_relax_face_sets_brush_task_cb_ex, &settings); } diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_color.c b/source/blender/editors/sculpt_paint/sculpt_filter_color.c index 556b73b0ea5..912dfd808b0 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_color.c +++ b/source/blender/editors/sculpt_paint/sculpt_filter_color.c @@ -80,7 +80,7 @@ typedef enum eSculptColorFilterTypes { COLOR_FILTER_SMOOTH, } eSculptColorFilterTypes; -EnumPropertyItem prop_color_filter_types[] = { +static EnumPropertyItem prop_color_filter_types[] = { {COLOR_FILTER_FILL, "FILL", 0, "Fill", "Fill with a specific color"}, {COLOR_FILTER_HUE, "HUE", 0, "Hue", "Change hue"}, {COLOR_FILTER_SATURATION, "SATURATION", 0, "Saturation", "Change saturation"}, @@ -265,7 +265,6 @@ static int sculpt_color_filter_modal(bContext *C, wmOperator *op, const wmEvent static int sculpt_color_filter_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { Object *ob = CTX_data_active_object(C); - Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); Sculpt *sd = CTX_data_tool_settings(C)->sculpt; SculptSession *ss = ob->sculpt; int mode = RNA_enum_get(op->ptr, "type"); @@ -285,6 +284,11 @@ static int sculpt_color_filter_invoke(bContext *C, wmOperator *op, const wmEvent SCULPT_undo_push_begin("color filter"); + BKE_sculpt_color_layer_create_if_needed(ob); + + /* CTX_data_ensure_evaluated_depsgraph should be used at the end to include the updates of + * earlier steps modifying the data. */ + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); bool needs_pmap = mode == COLOR_FILTER_SMOOTH; BKE_sculpt_update_object_for_edit(depsgraph, ob, needs_pmap, false, true); @@ -318,6 +322,6 @@ void SCULPT_OT_color_filter(struct wmOperatorType *ot) ot->srna, "strength", 1.0f, -10.0f, 10.0f, "Strength", "Filter Strength", -10.0f, 10.0f); PropertyRNA *prop = RNA_def_float_color( - ot->srna, "fill_color", 3, NULL, 0.0f, FLT_MAX, "Fill Color", "fill color", 0.0f, 1.0f); + ot->srna, "fill_color", 3, NULL, 0.0f, FLT_MAX, "Fill Color", "", 0.0f, 1.0f); RNA_def_property_subtype(prop, PROP_COLOR_GAMMA); } diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c index 9c9726ff3db..e9a98a17f8a 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c +++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c @@ -310,8 +310,7 @@ static void mesh_filter_task_cb(void *__restrict userdata, break; } case MESH_FILTER_RELAX: { - SCULPT_relax_vertex( - ss, &vd, clamp_f(fade * ss->filter_cache->automask[vd.index], 0.0f, 1.0f), false, val); + SCULPT_relax_vertex(ss, &vd, clamp_f(fade, 0.0f, 1.0f), false, val); sub_v3_v3v3(disp, val, vd.co); break; } @@ -543,6 +542,10 @@ static int sculpt_mesh_filter_invoke(bContext *C, wmOperator *op, const wmEvent SCULPT_undo_push_begin("Mesh filter"); + if (ELEM(filter_type, MESH_FILTER_RELAX, MESH_FILTER_RELAX_FACE_SETS)) { + SCULPT_boundary_info_ensure(ob); + } + SCULPT_filter_cache_init(ob, sd, SCULPT_UNDO_COORDS); if (use_face_sets) { @@ -572,16 +575,6 @@ static int sculpt_mesh_filter_invoke(bContext *C, wmOperator *op, const wmEvent ss->filter_cache->enabled_axis[1] = deform_axis & MESH_FILTER_DEFORM_Y; ss->filter_cache->enabled_axis[2] = deform_axis & MESH_FILTER_DEFORM_Z; - if (RNA_enum_get(op->ptr, "type") == MESH_FILTER_RELAX) { - ss->filter_cache->automask = MEM_mallocN(totvert * sizeof(float), - "Relax filter edge automask"); - for (int i = 0; i < totvert; i++) { - ss->filter_cache->automask[i] = 1.0f; - } - SCULPT_boundary_automasking_init( - ob, AUTOMASK_INIT_BOUNDARY_EDGES, 1, ss->filter_cache->automask); - } - WM_event_add_modal_handler(C, op); return OPERATOR_RUNNING_MODAL; } diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index f834ab7b179..6a989ffea7e 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -21,8 +21,7 @@ * \ingroup edsculpt */ -#ifndef __SCULPT_INTERN_H__ -#define __SCULPT_INTERN_H__ +#pragma once #include "DNA_brush_types.h" #include "DNA_key_types.h" @@ -991,5 +990,3 @@ void SCULPT_OT_set_detail_size(struct wmOperatorType *ot); /* Dyntopo. */ void SCULPT_OT_dynamic_topology_toggle(struct wmOperatorType *ot); - -#endif diff --git a/source/blender/editors/sculpt_paint/sculpt_pose.c b/source/blender/editors/sculpt_paint/sculpt_pose.c index a338b5346af..dc556fa1945 100644 --- a/source/blender/editors/sculpt_paint/sculpt_pose.c +++ b/source/blender/editors/sculpt_paint/sculpt_pose.c @@ -830,17 +830,21 @@ static bool pose_face_sets_fk_find_masked_floodfill_cb( } const int to_face_set = SCULPT_vertex_face_set_get(ss, to_v); - if (SCULPT_vertex_has_unique_face_set(ss, to_v) && - !SCULPT_vertex_has_unique_face_set(ss, from_v) && - SCULPT_vertex_has_face_set(ss, from_v, to_face_set)) { + if (!BLI_gset_haskey(data->visited_face_sets, POINTER_FROM_INT(to_face_set))) { + if (SCULPT_vertex_has_unique_face_set(ss, to_v) && + !SCULPT_vertex_has_unique_face_set(ss, from_v) && + SCULPT_vertex_has_face_set(ss, from_v, to_face_set)) { - if (data->floodfill_it[to_v] > data->masked_face_set_it) { - data->masked_face_set = to_face_set; - data->masked_face_set_it = data->floodfill_it[to_v]; - } + BLI_gset_add(data->visited_face_sets, POINTER_FROM_INT(to_face_set)); + + if (data->floodfill_it[to_v] >= data->masked_face_set_it) { + data->masked_face_set = to_face_set; + data->masked_face_set_it = data->floodfill_it[to_v]; + } - if (data->target_face_set == SCULPT_FACE_SET_NONE) { - data->target_face_set = to_face_set; + if (data->target_face_set == SCULPT_FACE_SET_NONE) { + data->target_face_set = to_face_set; + } } } @@ -875,8 +879,10 @@ static SculptPoseIKChain *pose_ik_chain_init_face_sets_fk( fdata.masked_face_set = SCULPT_FACE_SET_NONE; fdata.target_face_set = SCULPT_FACE_SET_NONE; fdata.masked_face_set_it = 0; + fdata.visited_face_sets = BLI_gset_int_new_ex("visited_face_sets", 3); SCULPT_floodfill_execute(ss, &flood, pose_face_sets_fk_find_masked_floodfill_cb, &fdata); SCULPT_floodfill_free(&flood); + BLI_gset_free(fdata.visited_face_sets, NULL); int origin_count = 0; float origin_acc[3] = {0.0f}; diff --git a/source/blender/editors/sculpt_paint/sculpt_smooth.c b/source/blender/editors/sculpt_paint/sculpt_smooth.c index 1a699c91e9b..7fbbcd1c896 100644 --- a/source/blender/editors/sculpt_paint/sculpt_smooth.c +++ b/source/blender/editors/sculpt_paint/sculpt_smooth.c @@ -242,6 +242,9 @@ static void do_smooth_brush_task_cb_ex(void *__restrict userdata, madd_v3_v3v3fl(val, vd.co, val, fade); SCULPT_clip(sd, ss, vd.co, val); } + if (vd.mvert) { + vd.mvert->flag |= ME_VERT_PBVH_UPDATE; + } } } BKE_pbvh_vertex_iter_end; diff --git a/source/blender/editors/sound/sound_intern.h b/source/blender/editors/sound/sound_intern.h index 40cdb9ccf02..f4797838be0 100644 --- a/source/blender/editors/sound/sound_intern.h +++ b/source/blender/editors/sound/sound_intern.h @@ -21,7 +21,4 @@ * \ingroup edsnd */ -#ifndef __SOUND_INTERN_H__ -#define __SOUND_INTERN_H__ - -#endif /* __SOUND_INTERN_H__ */ +#pragma once diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h index bf1b90bbe98..ffe0606c98f 100644 --- a/source/blender/editors/space_action/action_intern.h +++ b/source/blender/editors/space_action/action_intern.h @@ -21,8 +21,7 @@ * \ingroup spaction */ -#ifndef __ACTION_INTERN_H__ -#define __ACTION_INTERN_H__ +#pragma once struct ARegion; struct ARegionType; @@ -142,5 +141,3 @@ enum eActKeys_Mirror_Mode { /* action_ops.c */ void action_operatortypes(void); void action_keymap(struct wmKeyConfig *keyconf); - -#endif /* __ACTION_INTERN_H__ */ diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index 49dbba5eba9..3ae203b563b 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -44,7 +44,6 @@ #include "ED_gizmo_library.h" #include "ED_gpencil.h" #include "ED_lattice.h" -#include "ED_logic.h" #include "ED_markers.h" #include "ED_mask.h" #include "ED_mball.h" diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index f2f377c142f..16256f6c97e 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -56,7 +56,6 @@ #include "RNA_access.h" #include "ED_armature.h" -#include "ED_buttons.h" #include "ED_physics.h" #include "ED_screen.h" diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h index 64166f15ea3..911cf4526bb 100644 --- a/source/blender/editors/space_buttons/buttons_intern.h +++ b/source/blender/editors/space_buttons/buttons_intern.h @@ -21,8 +21,7 @@ * \ingroup spbuttons */ -#ifndef __BUTTONS_INTERN_H__ -#define __BUTTONS_INTERN_H__ +#pragma once #include "DNA_listBase.h" #include "RNA_types.h" @@ -97,5 +96,3 @@ void buttons_texture_context_compute(const struct bContext *C, struct SpacePrope void BUTTONS_OT_file_browse(struct wmOperatorType *ot); void BUTTONS_OT_directory_browse(struct wmOperatorType *ot); void BUTTONS_OT_context_menu(struct wmOperatorType *ot); - -#endif /* __BUTTONS_INTERN_H__ */ diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c index 3dc5eca8a8b..8e5aa00115b 100644 --- a/source/blender/editors/space_buttons/buttons_texture.c +++ b/source/blender/editors/space_buttons/buttons_texture.c @@ -63,7 +63,6 @@ #include "UI_interface.h" #include "UI_resources.h" -#include "ED_buttons.h" #include "ED_node.h" #include "ED_screen.h" diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 88c2c6e82b6..ac59bb245f3 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -493,6 +493,10 @@ static void buttons_area_listener(wmWindow *UNUSED(win), if (wmn->data == ND_SPACE_PROPERTIES) { ED_area_tag_redraw(area); } + else if (wmn->data == ND_SPACE_CHANGED) { + ED_area_tag_redraw(area); + sbuts->preview = 1; + } break; case NC_ID: if (wmn->action == NA_RENAME) { @@ -533,6 +537,12 @@ static void buttons_area_listener(wmWindow *UNUSED(win), sbuts->preview = 1; } break; + case NC_SCREEN: + if (wmn->data == ND_LAYOUTSET) { + ED_area_tag_redraw(area); + sbuts->preview = 1; + } + break; #ifdef WITH_FREESTYLE case NC_LINESTYLE: ED_area_tag_redraw(area); diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c index 3b1cc6fcab0..71f75d96cb1 100644 --- a/source/blender/editors/space_clip/clip_buttons.c +++ b/source/blender/editors/space_clip/clip_buttons.c @@ -259,6 +259,8 @@ typedef struct { MovieTrackingTrack *track; MovieTrackingMarker *marker; + /** current frame number */ + int framenr; /** position of marker in pixel coords */ float marker_pos[2]; /** position and dimensions of marker pattern in pixel coords */ @@ -286,7 +288,8 @@ static void marker_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg)) return; } - MovieTrackingMarker *marker = cb->marker; + int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(cb->clip, cb->framenr); + MovieTrackingMarker *marker = BKE_tracking_marker_ensure(cb->track, clip_framenr); marker->flag = cb->marker_flag; WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL); @@ -300,7 +303,9 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event) BKE_movieclip_get_size(cb->clip, cb->user, &width, &height); - MovieTrackingMarker *marker = cb->marker; + int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(cb->clip, cb->framenr); + MovieTrackingMarker *marker = BKE_tracking_marker_ensure(cb->track, clip_framenr); + if (event == B_MARKER_POS) { marker->pos[0] = cb->marker_pos[0] / width; marker->pos[1] = cb->marker_pos[1] / height; @@ -456,6 +461,7 @@ void uiTemplateMarker(uiLayout *layout, cb->track = track; cb->marker = marker; cb->marker_flag = marker->flag; + cb->framenr = user->framenr; if (compact) { block = uiLayoutGetBlock(layout); diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h index 27493bb5ccd..4848ec72f79 100644 --- a/source/blender/editors/space_clip/clip_intern.h +++ b/source/blender/editors/space_clip/clip_intern.h @@ -21,8 +21,7 @@ * \ingroup spclip */ -#ifndef __CLIP_INTERN_H__ -#define __CLIP_INTERN_H__ +#pragma once struct ARegion; struct MovieClip; @@ -245,5 +244,3 @@ void CLIP_OT_select_box(struct wmOperatorType *ot); void CLIP_OT_select_lasso(struct wmOperatorType *ot); void CLIP_OT_select_circle(struct wmOperatorType *ot); void CLIP_OT_select_grouped(struct wmOperatorType *ot); - -#endif /* __CLIP_INTERN_H__ */ diff --git a/source/blender/editors/space_clip/tracking_ops_intern.h b/source/blender/editors/space_clip/tracking_ops_intern.h index c29a485e234..5a9a84a235b 100644 --- a/source/blender/editors/space_clip/tracking_ops_intern.h +++ b/source/blender/editors/space_clip/tracking_ops_intern.h @@ -21,8 +21,7 @@ * \ingroup spclip */ -#ifndef __TRACKING_OPS_INTERN_H__ -#define __TRACKING_OPS_INTERN_H__ +#pragma once struct ListBase; struct MovieClip; @@ -40,5 +39,3 @@ void clip_tracking_hide_cursor(struct bContext *C); void ed_tracking_deselect_all_tracks(struct ListBase *tracks_base); void ed_tracking_deselect_all_plane_tracks(struct ListBase *plane_tracks_base); - -#endif /* __TRACKING_OPS_INTERN_H__ */ diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h index d051e351f3e..d4cb8363266 100644 --- a/source/blender/editors/space_console/console_intern.h +++ b/source/blender/editors/space_console/console_intern.h @@ -18,8 +18,7 @@ * \ingroup spconsole */ -#ifndef __CONSOLE_INTERN_H__ -#define __CONSOLE_INTERN_H__ +#pragma once /* internal exports only */ @@ -75,5 +74,3 @@ enum { DEL_NEXT_SEL, DEL_PREV_SEL }; - -#endif /* __CONSOLE_INTERN_H__ */ diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 8d14664c0fa..5150f6bed69 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -876,7 +876,9 @@ void file_draw_list(const bContext *C, ARegion *region) sfile->files, file, FILE_SEL_REMOVE, FILE_SEL_EDITING, CHECK_ALL); } } - else { + + /* file_selflag might have been modified by branch above. */ + if ((file_selflag & FILE_SEL_EDITING) == 0) { const int txpos = (params->display == FILE_IMGDISPLAY) ? sx : sx + 1 + icon_ofs; const int typos = (params->display == FILE_IMGDISPLAY) ? sy - layout->tile_h + layout->textheight : diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h index b7e8d35ffee..44131693628 100644 --- a/source/blender/editors/space_file/file_intern.h +++ b/source/blender/editors/space_file/file_intern.h @@ -21,8 +21,7 @@ * \ingroup spfile */ -#ifndef __FILE_INTERN_H__ -#define __FILE_INTERN_H__ +#pragma once /* internal exports only */ @@ -116,5 +115,3 @@ void file_execute_region_panels_register(struct ARegionType *art); /* file_utils.c */ void file_tile_boundbox(const ARegion *region, FileLayout *layout, const int file, rcti *r_bounds); - -#endif /* __FILE_INTERN_H__ */ diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 45e45093238..6ce81f90de0 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -518,7 +518,7 @@ static int file_select_invoke(bContext *C, wmOperator *op, const wmEvent *event) rect.ymin = rect.ymax = event->mval[1]; if (!ED_fileselect_layout_is_inside_pt(sfile->layout, ®ion->v2d, rect.xmin, rect.ymin)) { - return OPERATOR_CANCELLED; + return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH; } if (sfile && sfile->params) { diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h index e90a8659417..53937e7a743 100644 --- a/source/blender/editors/space_file/filelist.h +++ b/source/blender/editors/space_file/filelist.h @@ -21,8 +21,7 @@ * \ingroup spfile */ -#ifndef __FILELIST_H__ -#define __FILELIST_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -139,5 +138,3 @@ bool filelist_cache_previews_running(struct FileList *filelist); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/editors/space_file/fsmenu.h b/source/blender/editors/space_file/fsmenu.h index 17cfdf1c7f0..c4af27a25aa 100644 --- a/source/blender/editors/space_file/fsmenu.h +++ b/source/blender/editors/space_file/fsmenu.h @@ -21,8 +21,7 @@ * \ingroup spfile */ -#ifndef __FSMENU_H__ -#define __FSMENU_H__ +#pragma once /* XXX could become UserPref */ #define FSMENU_RECENT_MAX 10 @@ -76,5 +75,3 @@ void fsmenu_refresh_bookmarks_status(struct wmWindowManager *wm, struct FSMenu * int fsmenu_get_active_indices(struct FSMenu *fsmenu, enum FSMenuCategory category, const char *dir); - -#endif diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h index 3ec36e43278..d00e911e3fc 100644 --- a/source/blender/editors/space_graph/graph_intern.h +++ b/source/blender/editors/space_graph/graph_intern.h @@ -21,8 +21,7 @@ * \ingroup spgraph */ -#ifndef __GRAPH_INTERN_H__ -#define __GRAPH_INTERN_H__ +#pragma once struct ARegion; struct ARegionType; @@ -177,5 +176,3 @@ bool graphop_selected_fcurve_poll(struct bContext *C); /* graph_ops.c */ void graphedit_keymap(struct wmKeyConfig *keyconf); void graphedit_operatortypes(void); - -#endif /* __GRAPH_INTERN_H__ */ diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt index 12de74c6ae7..24ec7a89397 100644 --- a/source/blender/editors/space_image/CMakeLists.txt +++ b/source/blender/editors/space_image/CMakeLists.txt @@ -23,6 +23,7 @@ set(INC ../../blentranslation ../../bmesh ../../depsgraph + ../../draw ../../gpu ../../imbuf ../../makesdna diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index cb0fdcf23ca..4eb4e6649d9 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -400,7 +400,10 @@ bool ED_image_slot_cycle(struct Image *image, int direction) } } - if (i == num_slots) { + if (num_slots == 1) { + image->render_slot = 0; + } + else if (i == num_slots) { image->render_slot = ((cur == 1) ? 0 : 1); } diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h index ae26363ad79..e6f5988aed8 100644 --- a/source/blender/editors/space_image/image_intern.h +++ b/source/blender/editors/space_image/image_intern.h @@ -21,8 +21,7 @@ * \ingroup spimage */ -#ifndef __IMAGE_INTERN_H__ -#define __IMAGE_INTERN_H__ +#pragma once /* internal exports only */ struct ARegion; @@ -96,5 +95,3 @@ void IMAGE_OT_tile_fill(struct wmOperatorType *ot); /* image_panels.c */ struct ImageUser *ntree_get_active_iuser(struct bNodeTree *ntree); void image_buttons_register(struct ARegionType *art); - -#endif /* __IMAGE_INTERN_H__ */ diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index d7d85112497..ac0dbba1606 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -75,11 +75,10 @@ #include "GPU_batch_presets.h" #include "GPU_framebuffer.h" #include "GPU_viewport.h" -#include "image_intern.h" -/* TODO(fclem) remove bad level calls */ -#include "../draw/DRW_engine.h" -#include "wm_draw.h" +#include "DRW_engine_types.h" + +#include "image_intern.h" /**************************** common state *****************************/ @@ -643,17 +642,18 @@ static void image_main_region_draw(const bContext *C, ARegion *region) // View2DScrollers *scrollers; float col[3]; - /* XXX This is in order to draw UI batches with the DRW - * old context since we now use it for drawing the entire area. */ - gpu_batch_presets_reset(); + GPU_batch_presets_reset(); + GPUViewport *viewport = WM_draw_region_get_viewport(region); + GPUFrameBuffer *framebuffer_default, *framebuffer_overlay; + + framebuffer_default = GPU_viewport_framebuffer_default_get(viewport); + framebuffer_overlay = GPU_viewport_framebuffer_overlay_get(viewport); - GPUViewport *viewport = region->draw_buffer->viewport; - DefaultFramebufferList *fbl = GPU_viewport_framebuffer_list_get(viewport); - GPU_framebuffer_bind(fbl->default_fb); + GPU_framebuffer_bind(framebuffer_default); GPU_clear_color(0.0f, 0.0f, 0.0f, 0.0f); GPU_clear(GPU_COLOR_BIT); - GPU_framebuffer_bind(fbl->overlay_fb); + GPU_framebuffer_bind(framebuffer_overlay); /* XXX not supported yet, disabling for now */ scene->r.scemode &= ~R_COMP_CROP; diff --git a/source/blender/editors/space_info/info_intern.h b/source/blender/editors/space_info/info_intern.h index 79bfb1fa047..a19ebe5ef04 100644 --- a/source/blender/editors/space_info/info_intern.h +++ b/source/blender/editors/space_info/info_intern.h @@ -21,8 +21,7 @@ * \ingroup spinfo */ -#ifndef __INFO_INTERN_H__ -#define __INFO_INTERN_H__ +#pragma once /* internal exports only */ @@ -65,5 +64,3 @@ void INFO_OT_select_box(struct wmOperatorType *ot); void INFO_OT_report_replay(struct wmOperatorType *ot); void INFO_OT_report_delete(struct wmOperatorType *ot); void INFO_OT_report_copy(struct wmOperatorType *ot); - -#endif /* __INFO_INTERN_H__ */ diff --git a/source/blender/editors/space_info/textview.h b/source/blender/editors/space_info/textview.h index 41f8baf634e..7520dbce191 100644 --- a/source/blender/editors/space_info/textview.h +++ b/source/blender/editors/space_info/textview.h @@ -18,8 +18,7 @@ * \ingroup spinfo */ -#ifndef __TEXTVIEW_H__ -#define __TEXTVIEW_H__ +#pragma once enum eTextViewContext_LineFlag { TVC_LINE_FG = (1 << 0), @@ -79,5 +78,3 @@ int textview_draw(struct TextViewContext *tvc, const int mval_init[2], void **r_mval_pick_item, int *r_mval_pick_offset); - -#endif /* __TEXTVIEW_H__ */ diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h index 6b0429230fe..9a9ea161f56 100644 --- a/source/blender/editors/space_nla/nla_intern.h +++ b/source/blender/editors/space_nla/nla_intern.h @@ -21,8 +21,7 @@ * \ingroup spnla */ -#ifndef __NLA_INTERN_H__ -#define __NLA_INTERN_H__ +#pragma once /* internal exports only */ @@ -149,5 +148,3 @@ bool nlaedit_is_tweakmode_on(bAnimContext *ac); void nla_operatortypes(void); void nla_keymap(wmKeyConfig *keyconf); - -#endif /* __NLA_INTERN_H__ */ diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 695214bcc2f..01883f1c086 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -3576,6 +3576,8 @@ static void std_node_socket_interface_draw(bContext *UNUSED(C), uiLayout *layout break; } } + + uiItemR(layout, ptr, "hide_value", DEFAULT_FLAGS, NULL, 0); } void ED_init_standard_node_socket_type(bNodeSocketType *stype) diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c index ef468c63d77..7894fade517 100644 --- a/source/blender/editors/space_node/node_group.c +++ b/source/blender/editors/space_node/node_group.c @@ -56,6 +56,7 @@ #include "UI_resources.h" #include "NOD_common.h" +#include "NOD_socket.h" #include "node_intern.h" /* own include */ static bool node_group_operator_active(bContext *C) @@ -179,6 +180,26 @@ void NODE_OT_group_edit(wmOperatorType *ot) /* ******************** Ungroup operator ********************** */ +/* The given paths will be owned by the returned instance. Both pointers are allowed to point to + * the same string. */ +static AnimationBasePathChange *animation_basepath_change_new(const char *src_basepath, + const char *dst_basepath) +{ + AnimationBasePathChange *basepath_change = MEM_callocN(sizeof(*basepath_change), AT); + basepath_change->src_basepath = src_basepath; + basepath_change->dst_basepath = dst_basepath; + return basepath_change; +} + +static void animation_basepath_change_free(AnimationBasePathChange *basepath_change) +{ + if (basepath_change->src_basepath != basepath_change->dst_basepath) { + MEM_freeN((void *)basepath_change->src_basepath); + } + MEM_freeN((void *)basepath_change->dst_basepath); + MEM_freeN(basepath_change); +} + /* returns 1 if its OK */ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode) { @@ -217,16 +238,11 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode) /* keep track of this node's RNA "base" path (the part of the path identifying the node) * if the old nodetree has animation data which potentially covers this node */ + const char *old_animation_basepath = NULL; if (wgroup->adt) { PointerRNA ptr; - char *path; - RNA_pointer_create(&wgroup->id, &RNA_Node, node, &ptr); - path = RNA_path_from_ID_to_struct(&ptr); - - if (path) { - BLI_addtail(&anim_basepaths, BLI_genericNodeN(path)); - } + old_animation_basepath = RNA_path_from_ID_to_struct(&ptr); } /* migrate node */ @@ -236,6 +252,14 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode) /* ensure unique node name in the node tree */ nodeUniqueName(ntree, node); + if (wgroup->adt) { + PointerRNA ptr; + RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr); + const char *new_animation_basepath = RNA_path_from_ID_to_struct(&ptr); + BLI_addtail(&anim_basepaths, + animation_basepath_change_new(old_animation_basepath, new_animation_basepath)); + } + if (!node->parent) { node->locx += gnode->locx; node->locy += gnode->locy; @@ -258,7 +282,6 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode) /* and copy across the animation, * note that the animation data's action can be NULL here */ if (wgroup->adt) { - LinkData *ld, *ldn = NULL; bAction *waction; /* firstly, wgroup needs to temporary dummy action @@ -266,14 +289,11 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode) waction = wgroup->adt->action = BKE_action_copy(bmain, wgroup->adt->action); /* now perform the moving */ - BKE_animdata_separate_by_basepath(bmain, &wgroup->id, &ntree->id, &anim_basepaths); + BKE_animdata_transfer_by_basepath(bmain, &wgroup->id, &ntree->id, &anim_basepaths); /* paths + their wrappers need to be freed */ - for (ld = anim_basepaths.first; ld; ld = ldn) { - ldn = ld->next; - - MEM_freeN(ld->data); - BLI_freelinkN(&anim_basepaths, ld); + LISTBASE_FOREACH_MUTABLE (AnimationBasePathChange *, basepath_change, &anim_basepaths) { + animation_basepath_change_free(basepath_change); } /* free temp action too */ @@ -458,7 +478,7 @@ static int node_group_separate_selected( path = RNA_path_from_ID_to_struct(&ptr); if (path) { - BLI_addtail(&anim_basepaths, BLI_genericNodeN(path)); + BLI_addtail(&anim_basepaths, animation_basepath_change_new(path, path)); } } @@ -511,17 +531,12 @@ static int node_group_separate_selected( /* and copy across the animation, * note that the animation data's action can be NULL here */ if (ngroup->adt) { - LinkData *ld, *ldn = NULL; - /* now perform the moving */ - BKE_animdata_separate_by_basepath(bmain, &ngroup->id, &ntree->id, &anim_basepaths); + BKE_animdata_transfer_by_basepath(bmain, &ngroup->id, &ntree->id, &anim_basepaths); /* paths + their wrappers need to be freed */ - for (ld = anim_basepaths.first; ld; ld = ldn) { - ldn = ld->next; - - MEM_freeN(ld->data); - BLI_freelinkN(&anim_basepaths, ld); + LISTBASE_FOREACH_MUTABLE (AnimationBasePathChange *, basepath_change, &anim_basepaths) { + animation_basepath_change_free(basepath_change); } } @@ -685,7 +700,8 @@ static bool node_group_make_test_selected(bNodeTree *ntree, return true; } -static int node_get_selected_minmax(bNodeTree *ntree, bNode *gnode, float *min, float *max) +static int node_get_selected_minmax( + bNodeTree *ntree, bNode *gnode, float *min, float *max, bool use_size) { bNode *node; float loc[2]; @@ -696,6 +712,11 @@ static int node_get_selected_minmax(bNodeTree *ntree, bNode *gnode, float *min, if (node_group_make_use_node(node, gnode)) { nodeToView(node, 0.0f, 0.0f, &loc[0], &loc[1]); minmax_v2v2_v2(min, max, loc); + if (use_size) { + loc[0] += node->width; + loc[1] -= node->height; + minmax_v2v2_v2(min, max, loc); + } totselect++; } } @@ -713,10 +734,10 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, Main *bmain = CTX_data_main(C); bNodeTree *ngroup = (bNodeTree *)gnode->id; bNodeLink *link, *linkn; - bNode *node, *nextn; - bNodeSocket *sock; + bNode *node, *nextn, *link_node; + bNodeSocket *sock, *link_sock; ListBase anim_basepaths = {NULL, NULL}; - float min[2], max[2], center[2]; + float min[2], max[2], real_min[2], real_max[2], center[2]; int totselect; bool expose_visible = false; bNode *input_node, *output_node; @@ -730,10 +751,12 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, nodeSetSelected(node, false); } - totselect = node_get_selected_minmax(ntree, gnode, min, max); + totselect = node_get_selected_minmax(ntree, gnode, min, max, false); add_v2_v2v2(center, min, max); mul_v2_fl(center, 0.5f); + node_get_selected_minmax(ntree, gnode, real_min, real_max, true); + /* auto-add interface for "solo" nodes */ if (totselect == 1) { expose_visible = true; @@ -754,7 +777,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, path = RNA_path_from_ID_to_struct(&ptr); if (path) { - BLI_addtail(&anim_basepaths, BLI_genericNodeN(path)); + BLI_addtail(&anim_basepaths, animation_basepath_change_new(path, path)); } } @@ -774,16 +797,11 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, /* move animation data over */ if (ntree->adt) { - LinkData *ld, *ldn = NULL; - - BKE_animdata_separate_by_basepath(bmain, &ntree->id, &ngroup->id, &anim_basepaths); + BKE_animdata_transfer_by_basepath(bmain, &ntree->id, &ngroup->id, &anim_basepaths); /* paths + their wrappers need to be freed */ - for (ld = anim_basepaths.first; ld; ld = ldn) { - ldn = ld->next; - - MEM_freeN(ld->data); - BLI_freelinkN(&anim_basepaths, ld); + LISTBASE_FOREACH_MUTABLE (AnimationBasePathChange *, basepath_change, &anim_basepaths) { + animation_basepath_change_free(basepath_change); } } @@ -792,12 +810,12 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, /* create input node */ input_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_INPUT); - input_node->locx = min[0] - center[0] - offsetx; + input_node->locx = real_min[0] - center[0] - offsetx; input_node->locy = -offsety; /* create output node */ output_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_OUTPUT); - output_node->locx = max[0] - center[0] + offsetx; + output_node->locx = real_max[0] - center[0] + offsetx * 0.25f; output_node->locy = -offsety; /* relink external sockets */ @@ -813,12 +831,9 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, */ nodeRemLink(ntree, link); } - else if (fromselect && toselect) { - BLI_remlink(&ntree->links, link); - BLI_addtail(&ngroup->links, link); - } - else if (toselect) { - bNodeSocket *iosock = ntreeAddSocketInterfaceFromSocket(ngroup, link->tonode, link->tosock); + else if (toselect && !fromselect) { + node_socket_skip_reroutes(&ntree->links, link->tonode, link->tosock, &link_node, &link_sock); + bNodeSocket *iosock = ntreeAddSocketInterfaceFromSocket(ngroup, link_node, link_sock); bNodeSocket *input_sock; /* update the group node and interface node sockets, @@ -835,7 +850,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, link->tonode = gnode; link->tosock = node_group_find_input_socket(gnode, iosock->identifier); } - else if (fromselect) { + else if (fromselect && !toselect) { /* First check whether the source of this link is already connected to an output. * If yes, reuse that output instead of duplicating it. */ bool connected = false; @@ -851,8 +866,9 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, } if (!connected) { - bNodeSocket *iosock = ntreeAddSocketInterfaceFromSocket( - ngroup, link->fromnode, link->fromsock); + node_socket_skip_reroutes( + &ntree->links, link->fromnode, link->fromsock, &link_node, &link_sock); + bNodeSocket *iosock = ntreeAddSocketInterfaceFromSocket(ngroup, link_node, link_sock); bNodeSocket *output_sock; /* update the group node and interface node sockets, @@ -872,6 +888,19 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, } } + /* move internal links */ + for (link = ntree->links.first; link; link = linkn) { + int fromselect = node_group_make_use_node(link->fromnode, gnode); + int toselect = node_group_make_use_node(link->tonode, gnode); + + linkn = link->next; + + if (fromselect && toselect) { + BLI_remlink(&ntree->links, link); + BLI_addtail(&ngroup->links, link); + } + } + /* move nodes in the group to the center */ for (node = ngroup->nodes.first; node; node = node->next) { if (node_group_make_use_node(node, gnode) && !node->parent) { @@ -953,7 +982,7 @@ static bNode *node_group_make_from_selected(const bContext *C, float min[2], max[2]; int totselect; - totselect = node_get_selected_minmax(ntree, NULL, min, max); + totselect = node_get_selected_minmax(ntree, NULL, min, max, false); /* don't make empty group */ if (totselect == 0) { return NULL; diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 04186c3a727..9461892360e 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -21,8 +21,7 @@ * \ingroup spnode */ -#ifndef __NODE_INTERN_H__ -#define __NODE_INTERN_H__ +#pragma once #include "BKE_node.h" #include "UI_interface.h" @@ -301,5 +300,3 @@ enum eNodeSpace_ButEvents { B_NODE_LOADIMAGE, B_NODE_SETIMAGE, }; - -#endif /* __NODE_INTERN_H__ */ diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index e5409271f7c..3e898b7d400 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -251,6 +251,12 @@ static bNodeSocket *best_socket_output(bNodeTree *ntree, } } + /* Always allow linking to an reroute node. The socket type of the reroute sockets might change + * after the link has been created. */ + if (node->type == NODE_REROUTE) { + return node->outputs.first; + } + return NULL; } diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index 316ba3fd2e4..90b824811d9 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -1182,7 +1182,7 @@ static void node_find_update_fn(const struct bContext *C, else { BLI_strncpy(name, node->name, 256); } - if (!UI_search_item_add(items, name, node, ICON_NONE, 0)) { + if (!UI_search_item_add(items, name, node, ICON_NONE, 0, 0)) { break; } } diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 47215f3ccda..a45b415b629 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1376,13 +1376,13 @@ static void outliner_draw_restrictbuts(uiBlock *block, ID *id = tselem->id; bGPDlayer *gpl = (bGPDlayer *)te->directdata; - if (soops->show_restrict_flags & SO_RESTRICT_VIEWPORT) { + if (soops->show_restrict_flags & SO_RESTRICT_HIDE) { bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE, GP_LAYER_HIDE, 0, ICON_HIDE_OFF, - (int)(region->v2d.cur.xmax - restrict_offsets.viewport), + (int)(region->v2d.cur.xmax - restrict_offsets.hide), te->ys, UI_UNIT_X, UI_UNIT_Y, diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 186a66a95c0..05729414f91 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -21,8 +21,7 @@ * \ingroup spoutliner */ -#ifndef __OUTLINER_INTERN_H__ -#define __OUTLINER_INTERN_H__ +#pragma once #include "RNA_types.h" @@ -517,5 +516,3 @@ void outliner_scroll_view(struct ARegion *region, int delta_y); /* outliner_sync.c ---------------------------------------------- */ void outliner_sync_selection(const struct bContext *C, struct SpaceOutliner *soops); - -#endif /* __OUTLINER_INTERN_H__ */ diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index b59cd5bc128..dae2ba32f09 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -543,7 +543,7 @@ static void merged_element_search_cb_recursive( /* Don't allow duplicate named items */ if (UI_search_items_find_index(items, name) == -1) { - if (!UI_search_item_add(items, name, te, iconid, 0)) { + if (!UI_search_item_add(items, name, te, iconid, 0, 0)) { break; } } @@ -744,22 +744,21 @@ typedef struct OutlinerLibOverrideData { bool do_hierarchy; } OutlinerLibOverrideData; -static void id_override_library_cb(bContext *C, - ReportList *UNUSED(reports), - Scene *UNUSED(scene), - TreeElement *te, - TreeStoreElem *UNUSED(tsep), - TreeStoreElem *tselem, - void *user_data) +static void id_override_library_create_cb(bContext *C, + ReportList *UNUSED(reports), + Scene *UNUSED(scene), + TreeElement *te, + TreeStoreElem *UNUSED(tsep), + TreeStoreElem *tselem, + void *user_data) { BLI_assert(TSE_IS_REAL_ID(tselem)); ID *id_root = tselem->id; + OutlinerLibOverrideData *data = user_data; + const bool do_hierarchy = data->do_hierarchy; - if (ID_IS_LINKED(id_root) && - (BKE_idtype_get_info_from_id(id_root)->flags & IDTYPE_FLAGS_NO_LIBLINKING) == 0) { + if (ID_IS_OVERRIDABLE_LIBRARY(id_root) || (ID_IS_LINKED(id_root) && do_hierarchy)) { Main *bmain = CTX_data_main(C); - OutlinerLibOverrideData *data = user_data; - const bool do_hierarchy = data->do_hierarchy; id_root->tag |= LIB_TAG_DOIT; @@ -798,6 +797,34 @@ static void id_override_library_cb(bContext *C, } } +static void id_override_library_reset_cb(bContext *C, + ReportList *UNUSED(reports), + Scene *UNUSED(scene), + TreeElement *UNUSED(te), + TreeStoreElem *UNUSED(tsep), + TreeStoreElem *tselem, + void *user_data) +{ + BLI_assert(TSE_IS_REAL_ID(tselem)); + ID *id_root = tselem->id; + OutlinerLibOverrideData *data = user_data; + const bool do_hierarchy = data->do_hierarchy; + + if (ID_IS_OVERRIDE_LIBRARY_REAL(id_root)) { + Main *bmain = CTX_data_main(C); + + if (do_hierarchy) { + BKE_lib_override_library_id_hierarchy_reset(bmain, id_root); + } + else { + BKE_lib_override_library_id_reset(bmain, id_root); + } + + WM_event_add_notifier(C, NC_WM | ND_DATACHANGED, NULL); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL); + } +} + static void id_fake_user_set_cb(bContext *UNUSED(C), ReportList *UNUSED(reports), Scene *UNUSED(scene), @@ -840,11 +867,17 @@ static void id_select_linked_cb(bContext *C, static void singleuser_action_cb(bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), - TreeElement *UNUSED(te), + TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem, void *UNUSED(user_data)) { + /* This callback runs for all selected elements, some of which may not be actions which results + * in a crash. */ + if (te->idcode != ID_AC) { + return; + } + ID *id = tselem->id; if (id) { @@ -1546,8 +1579,10 @@ typedef enum eOutlinerIdOpTypes { OUTLINER_IDOP_UNLINK, OUTLINER_IDOP_LOCAL, - OUTLINER_IDOP_OVERRIDE_LIBRARY, - OUTLINER_IDOP_OVERRIDE_LIBRARY_HIERARCHY, + OUTLINER_IDOP_OVERRIDE_LIBRARY_CREATE, + OUTLINER_IDOP_OVERRIDE_LIBRARY_CREATE_HIERARCHY, + OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET, + OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET_HIERARCHY, OUTLINER_IDOP_SINGLE, OUTLINER_IDOP_DELETE, OUTLINER_IDOP_REMAP, @@ -1566,16 +1601,6 @@ typedef enum eOutlinerIdOpTypes { static const EnumPropertyItem prop_id_op_types[] = { {OUTLINER_IDOP_UNLINK, "UNLINK", 0, "Unlink", ""}, {OUTLINER_IDOP_LOCAL, "LOCAL", 0, "Make Local", ""}, - {OUTLINER_IDOP_OVERRIDE_LIBRARY, - "OVERRIDE_LIBRARY", - 0, - "Add Library Override", - "Add a local override of this linked data-block"}, - {OUTLINER_IDOP_OVERRIDE_LIBRARY_HIERARCHY, - "OVERRIDE_LIBRARY_HIERARCHY", - 0, - "Add Library Override Hierarchy", - "Add a local override of this linked data-block, and its hierarchy of dependencies"}, {OUTLINER_IDOP_SINGLE, "SINGLE", 0, "Make Single User", ""}, {OUTLINER_IDOP_DELETE, "DELETE", ICON_X, "Delete", ""}, {OUTLINER_IDOP_REMAP, @@ -1584,6 +1609,27 @@ static const EnumPropertyItem prop_id_op_types[] = { "Remap Users", "Make all users of selected data-blocks to use instead current (clicked) one"}, {0, "", 0, NULL, NULL}, + {OUTLINER_IDOP_OVERRIDE_LIBRARY_CREATE, + "OVERRIDE_LIBRARY_CREATE", + 0, + "Add Library Override", + "Add a local override of this linked data-block"}, + {OUTLINER_IDOP_OVERRIDE_LIBRARY_CREATE_HIERARCHY, + "OVERRIDE_LIBRARY_CREATE_HIERARCHY", + 0, + "Add Library Override Hierarchy", + "Add a local override of this linked data-block, and its hierarchy of dependencies"}, + {OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET, + "OVERRIDE_LIBRARY_RESET", + 0, + "Reset Library Override", + "Reset this local override to its linked values"}, + {OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET_HIERARCHY, + "OVERRIDE_LIBRARY_RESET_HIERARCHY", + 0, + "Reset Library Override Hierarchy", + "Reset this local override to its linked values, as well as its hierarchy of dependencies"}, + {0, "", 0, NULL, NULL}, {OUTLINER_IDOP_COPY, "COPY", ICON_COPYDOWN, "Copy", ""}, {OUTLINER_IDOP_PASTE, "PASTE", ICON_PASTEDOWN, "Paste", ""}, {0, "", 0, NULL, NULL}, @@ -1607,7 +1653,11 @@ static bool outliner_id_operation_item_poll(bContext *C, SpaceOutliner *soops = CTX_wm_space_outliner(C); switch (enum_value) { - case OUTLINER_IDOP_OVERRIDE_LIBRARY: + case OUTLINER_IDOP_OVERRIDE_LIBRARY_CREATE: + case OUTLINER_IDOP_OVERRIDE_LIBRARY_CREATE_HIERARCHY: + return true; + case OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET: + case OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET_HIERARCHY: return true; case OUTLINER_IDOP_SINGLE: if (!soops || ELEM(soops->outlinevis, SO_SCENES, SO_VIEW_LAYER)) { @@ -1721,28 +1771,52 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) ED_undo_push(C, "Localized Data"); break; } - case OUTLINER_IDOP_OVERRIDE_LIBRARY: { + case OUTLINER_IDOP_OVERRIDE_LIBRARY_CREATE: { /* make local */ outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, - id_override_library_cb, + id_override_library_create_cb, &(OutlinerLibOverrideData){.do_hierarchy = false}); ED_undo_push(C, "Overridden Data"); break; } - case OUTLINER_IDOP_OVERRIDE_LIBRARY_HIERARCHY: { + case OUTLINER_IDOP_OVERRIDE_LIBRARY_CREATE_HIERARCHY: { /* make local */ outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, - id_override_library_cb, + id_override_library_create_cb, &(OutlinerLibOverrideData){.do_hierarchy = true}); - ED_undo_push(C, "Overridden Data"); + ED_undo_push(C, "Overridden Data Hierarchy"); + break; + } + case OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET: { + /* make local */ + outliner_do_libdata_operation(C, + op->reports, + scene, + soops, + &soops->tree, + id_override_library_reset_cb, + &(OutlinerLibOverrideData){.do_hierarchy = false}); + ED_undo_push(C, "Reset Overridden Data"); + break; + } + case OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET_HIERARCHY: { + /* make local */ + outliner_do_libdata_operation(C, + op->reports, + scene, + soops, + &soops->tree, + id_override_library_reset_cb, + &(OutlinerLibOverrideData){.do_hierarchy = true}); + ED_undo_push(C, "Reset Overridden Data Hierarchy"); break; } case OUTLINER_IDOP_SINGLE: { diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 09dc1320c3a..e1d92c551c3 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -2192,7 +2192,9 @@ static bool outliner_element_is_collection_or_object(TreeElement *te) if ((tselem->type == 0) && (te->idcode == ID_OB)) { return true; } - if (outliner_is_collection_tree_element(te)) { + + /* Collection instance datablocks should not be extracted. */ + if (outliner_is_collection_tree_element(te) && !(te->parent && te->parent->idcode == ID_OB)) { return true; } @@ -2459,7 +2461,9 @@ void outliner_build_tree( te_object->directdata = base; } - outliner_make_object_parent_hierarchy(&soops->tree); + if ((soops->filter & SO_FILTER_NO_CHILDREN) == 0) { + outliner_make_object_parent_hierarchy(&soops->tree); + } } else { /* Show collections in the view layer. */ diff --git a/source/blender/editors/space_script/script_intern.h b/source/blender/editors/space_script/script_intern.h index c6f72784b05..5d73bca350c 100644 --- a/source/blender/editors/space_script/script_intern.h +++ b/source/blender/editors/space_script/script_intern.h @@ -21,8 +21,7 @@ * \ingroup spscript */ -#ifndef __SCRIPT_INTERN_H__ -#define __SCRIPT_INTERN_H__ +#pragma once /* internal exports only */ @@ -33,5 +32,3 @@ void script_keymap(struct wmKeyConfig *keyconf); /* script_edit.c */ void SCRIPT_OT_reload(struct wmOperatorType *ot); void SCRIPT_OT_python_file_run(struct wmOperatorType *ot); - -#endif /* __SCRIPT_INTERN_H__ */ diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 6202a3556a4..a35feb62c9d 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -151,7 +151,7 @@ static int sequencer_generic_invoke_xy_guess_channel(bContext *C, int type) int proximity = INT_MAX; if (!ed || !ed->seqbasep) { - return 2; + return 1; } for (seq = ed->seqbasep->first; seq; seq = seq->next) { @@ -165,7 +165,7 @@ static int sequencer_generic_invoke_xy_guess_channel(bContext *C, int type) if (tgt) { return tgt->machine + 1; } - return 2; + return 1; } static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, int flag, int type) @@ -581,10 +581,10 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad seq = seq_load_fn(C, ed->seqbasep, &seq_load); if (seq) { - sequencer_add_apply_overlap(C, op, seq); if (seq_load.seq_sound) { sequencer_add_apply_overlap(C, op, seq_load.seq_sound); } + sequencer_add_apply_overlap(C, op, seq); } } RNA_END; @@ -594,10 +594,10 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad seq = seq_load_fn(C, ed->seqbasep, &seq_load); if (seq) { - sequencer_add_apply_overlap(C, op, seq); if (seq_load.seq_sound) { sequencer_add_apply_overlap(C, op, seq_load.seq_sound); } + sequencer_add_apply_overlap(C, op, seq); } } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 0d8e0a87694..b2d0362602e 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -467,30 +467,6 @@ static bool seq_is_parent(Sequence *par, Sequence *seq) return ((par->seq1 == seq) || (par->seq2 == seq) || (par->seq3 == seq)); } -static bool seq_is_predecessor(Sequence *pred, Sequence *seq) -{ - if (!pred) { - return 0; - } - if (pred == seq) { - return 0; - } - if (seq_is_parent(pred, seq)) { - return 1; - } - if (pred->seq1 && seq_is_predecessor(pred->seq1, seq)) { - return 1; - } - if (pred->seq2 && seq_is_predecessor(pred->seq2, seq)) { - return 1; - } - if (pred->seq3 && seq_is_predecessor(pred->seq3, seq)) { - return 1; - } - - return 0; -} - /** \} */ /* -------------------------------------------------------------------- */ @@ -1092,6 +1068,7 @@ static bool sequence_offset_after_frame(Scene *scene, const int delta, const int if (seq->startdisp >= cfra) { BKE_sequence_translate(scene, seq, delta); BKE_sequence_calc(scene, seq); + BKE_sequence_invalidate_cache_preprocessed(scene, seq); done = true; } } @@ -2233,14 +2210,16 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op) } if (!seq_effect_find_selected( - scene, last_seq, last_seq->type, &seq1, &seq2, &seq3, &error_msg)) { + scene, last_seq, last_seq->type, &seq1, &seq2, &seq3, &error_msg) || + BKE_sequence_effect_get_num_inputs(last_seq->type) == 0) { BKE_report(op->reports, RPT_ERROR, error_msg); return OPERATOR_CANCELLED; } /* Check if reassigning would create recursivity. */ - if (seq_is_predecessor(seq1, last_seq) || seq_is_predecessor(seq2, last_seq) || - seq_is_predecessor(seq3, last_seq)) { - BKE_report(op->reports, RPT_ERROR, "Cannot reassign inputs: no cycles allowed"); + if (BKE_sequencer_render_loop_check(seq1, last_seq) || + BKE_sequencer_render_loop_check(seq2, last_seq) || + BKE_sequencer_render_loop_check(seq3, last_seq)) { + BKE_report(op->reports, RPT_ERROR, "Cannot reassign inputs: recursion detected"); return OPERATOR_CANCELLED; } @@ -2359,6 +2338,8 @@ static int sequencer_split_exec(bContext *C, wmOperator *op) split_side = RNA_enum_get(op->ptr, "side"); ignore_selection = RNA_boolean_get(op->ptr, "ignore_selection"); + BKE_sequencer_prefetch_stop(scene); + if (split_hard == SEQ_SPLIT_HARD) { changed = split_seq_list(bmain, scene, @@ -2563,7 +2544,8 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) if (nseqbase.first) { Sequence *seq = nseqbase.first; - /* Rely on the nseqbase list being added at the end. */ + /* Rely on the nseqbase list being added at the end. + * Their UUIDs has been re-generated by the BKE_sequence_base_dupli_recursive(), */ BLI_movelisttolist(ed->seqbasep, &nseqbase); for (; seq; seq = seq->next) { @@ -2976,6 +2958,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) if (seq != seqm && (seq->flag & SELECT)) { BKE_sequence_invalidate_cache_composite(scene, seq); channel_max = max_ii(seq->machine, channel_max); + /* Sequence is moved within the same edit, no need to re-generate the UUID. */ BLI_remlink(ed->seqbasep, seq); BLI_addtail(&seqm->seqbase, seq); } @@ -3052,6 +3035,9 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) BKE_sequence_invalidate_cache_composite(scene, seq); } + /* This moves strips from meta to parent, sating within same edit and no new strips are + * allocated. If the UUID was unique already (as it should) it will stay unique. Nn need to + * re-generate the UUIDs.*/ BLI_movelisttolist(ed->seqbasep, &last_seq->seqbase); BLI_listbase_clear(&last_seq->seqbase); @@ -3391,8 +3377,15 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - BKE_sequence_base_dupli_recursive( - scene, scene, &seqbase_clipboard, ed->seqbasep, 0, LIB_ID_CREATE_NO_USER_REFCOUNT); + /* NOTE: The UUID is re-generated on paste, so we can keep UUID in the clipboard since + * nobody can reach them anyway. + * This reduces chance or running out of UUIDs if a cat falls asleep on Ctrl-C. */ + BKE_sequence_base_dupli_recursive(scene, + scene, + &seqbase_clipboard, + ed->seqbasep, + 0, + (LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_FREE_NO_MAIN)); seqbase_clipboard_frame = scene->r.cfra; @@ -3450,6 +3443,8 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) iseq_first = nseqbase.first; + /* NOTE: BKE_sequence_base_dupli_recursive() takes care of generating new UUIDs for sequences + * in the new list. */ BLI_movelisttolist(ed->seqbasep, &nseqbase); for (iseq = iseq_first; iseq; iseq = iseq->next) { diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index fee07e8941d..1d168866e7c 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -21,8 +21,7 @@ * \ingroup spseq */ -#ifndef __SEQUENCER_INTERN_H__ -#define __SEQUENCER_INTERN_H__ +#pragma once #include "DNA_sequence_types.h" #include "RNA_access.h" @@ -208,5 +207,3 @@ int sequencer_image_seq_get_minmax_frame(struct wmOperator *op, int *r_numdigits); void sequencer_image_seq_reserve_frames( struct wmOperator *op, struct StripElem *se, int len, int minframe, int numdigits); - -#endif /* __SEQUENCER_INTERN_H__ */ diff --git a/source/blender/editors/space_text/text_format.h b/source/blender/editors/space_text/text_format.h index 07635e4227a..bb9574ee55e 100644 --- a/source/blender/editors/space_text/text_format.h +++ b/source/blender/editors/space_text/text_format.h @@ -21,8 +21,7 @@ * \ingroup sptext */ -#ifndef __TEXT_FORMAT_H__ -#define __TEXT_FORMAT_H__ +#pragma once /* *** Flatten String *** */ typedef struct FlattenString { @@ -110,5 +109,3 @@ void ED_text_format_register_pov_ini(void); #define STR_LITERAL_STARTSWITH(str, str_literal, len_var) \ (strncmp(str, str_literal, len_var = (sizeof(str_literal) - 1)) == 0) - -#endif /* __TEXT_FORMAT_H__ */ diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h index d6588dda797..abafad4c241 100644 --- a/source/blender/editors/space_text/text_intern.h +++ b/source/blender/editors/space_text/text_intern.h @@ -21,8 +21,7 @@ * \ingroup sptext */ -#ifndef __TEXT_INTERN_H__ -#define __TEXT_INTERN_H__ +#pragma once /* internal exports only */ @@ -181,5 +180,3 @@ void TEXT_OT_autocomplete(struct wmOperatorType *ot); /* space_text.c */ extern const char *text_context_dir[]; /* doc access */ - -#endif /* __TEXT_INTERN_H__ */ diff --git a/source/blender/editors/space_userpref/userpref_intern.h b/source/blender/editors/space_userpref/userpref_intern.h index 56930d3a231..506e93ae7ac 100644 --- a/source/blender/editors/space_userpref/userpref_intern.h +++ b/source/blender/editors/space_userpref/userpref_intern.h @@ -21,9 +21,6 @@ * \ingroup spuserpref */ -#ifndef __USERPREF_INTERN_H__ -#define __USERPREF_INTERN_H__ +#pragma once /* internal exports only */ - -#endif /* __USERPREF_INTERN_H__ */ diff --git a/source/blender/editors/space_view3d/view3d_camera_control.c b/source/blender/editors/space_view3d/view3d_camera_control.c index 7e63d650409..1d5b33e7b90 100644 --- a/source/blender/editors/space_view3d/view3d_camera_control.c +++ b/source/blender/editors/space_view3d/view3d_camera_control.c @@ -198,6 +198,56 @@ struct View3DCameraControl *ED_view3d_cameracontrol_acquire(Depsgraph *depsgraph } /** + * A version of #BKE_object_apply_mat4 that respects #Object.protectflag, + * applying the locking back to the view to avoid the view. + * This is needed so the view doesn't get out of sync with the object, + * causing visible jittering when in fly/walk mode for e.g. + * + * \note This could be exposed as an API option, as we might not want the view + * to be constrained by the thing it's controlling. + */ +static bool object_apply_mat4_with_protect(Object *ob, + const float obmat[4][4], + const bool use_parent, + /* Only use when applying lock. */ + RegionView3D *rv3d, + const float view_mat[4][4]) +{ + const bool use_protect = (ob->protectflag != 0); + bool view_changed = false; + + ObjectTfmProtectedChannels obtfm; + if (use_protect) { + BKE_object_tfm_protected_backup(ob, &obtfm); + } + + BKE_object_apply_mat4(ob, obmat, true, use_parent); + + if (use_protect) { + float obmat_noprotect[4][4], obmat_protect[4][4]; + + BKE_object_to_mat4(ob, obmat_noprotect); + BKE_object_tfm_protected_restore(ob, &obtfm, ob->protectflag); + BKE_object_to_mat4(ob, obmat_protect); + + if (!equals_m4m4(obmat_noprotect, obmat_protect)) { + /* Apply the lock protection back to the view, without this the view + * keeps moving, ignoring the object locking, causing jittering in some cases. */ + float diff_mat[4][4]; + float view_mat_protect[4][4]; + float obmat_noprotect_inv[4][4]; + invert_m4_m4(obmat_noprotect_inv, obmat_noprotect); + mul_m4_m4m4(diff_mat, obmat_protect, obmat_noprotect_inv); + + mul_m4_m4m4(view_mat_protect, diff_mat, view_mat); + ED_view3d_from_m4(view_mat_protect, rv3d->ofs, rv3d->viewquat, &rv3d->dist); + view_changed = true; + } + } + return view_changed; +} + +/** * Updates cameras from the ``rv3d`` values, optionally auto-keyframing. */ void ED_view3d_cameracontrol_update(View3DCameraControl *vctrl, @@ -216,21 +266,25 @@ void ED_view3d_cameracontrol_update(View3DCameraControl *vctrl, ID *id_key; + float view_mat[4][4]; + ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist); + /* transform the parent or the camera? */ if (vctrl->root_parent) { Object *ob_update; - float view_mat[4][4]; float prev_view_imat[4][4]; float diff_mat[4][4]; float parent_mat[4][4]; invert_m4_m4(prev_view_imat, vctrl->view_mat_prev); - ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist); mul_m4_m4m4(diff_mat, view_mat, prev_view_imat); mul_m4_m4m4(parent_mat, diff_mat, vctrl->root_parent->obmat); - BKE_object_apply_mat4(vctrl->root_parent, parent_mat, true, false); + if (object_apply_mat4_with_protect(vctrl->root_parent, parent_mat, false, rv3d, view_mat)) { + /* Calculate again since the view locking changes the matrix. */ + ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist); + } ob_update = v3d->camera->parent; while (ob_update) { @@ -243,18 +297,16 @@ void ED_view3d_cameracontrol_update(View3DCameraControl *vctrl, id_key = &vctrl->root_parent->id; } else { - float view_mat[4][4]; float scale_mat[4][4]; float scale_back[3]; /* even though we handle the scale matrix, this still changes over time */ copy_v3_v3(scale_back, v3d->camera->scale); - ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist); size_to_mat4(scale_mat, v3d->camera->scale); mul_m4_m4m4(view_mat, view_mat, scale_mat); - BKE_object_apply_mat4(v3d->camera, view_mat, true, true); + object_apply_mat4_with_protect(v3d->camera, view_mat, true, rv3d, view_mat); DEG_id_tag_update(&v3d->camera->id, ID_RECALC_TRANSFORM); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index cc5f7deb418..1af0cc074fc 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -115,8 +115,8 @@ void ED_view3d_update_viewmat(Depsgraph *depsgraph, const Scene *scene, View3D *v3d, ARegion *region, - float viewmat[4][4], - float winmat[4][4], + const float viewmat[4][4], + const float winmat[4][4], const rcti *rect, bool offscreen) { @@ -197,8 +197,8 @@ static void view3d_main_region_setup_view(Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *region, - float viewmat[4][4], - float winmat[4][4], + const float viewmat[4][4], + const float winmat[4][4], const rcti *rect) { RegionView3D *rv3d = region->regiondata; @@ -214,8 +214,8 @@ static void view3d_main_region_setup_offscreen(Depsgraph *depsgraph, const Scene *scene, View3D *v3d, ARegion *region, - float viewmat[4][4], - float winmat[4][4]) + const float viewmat[4][4], + const float winmat[4][4]) { RegionView3D *rv3d = region->regiondata; ED_view3d_update_viewmat(depsgraph, scene, v3d, region, viewmat, winmat, NULL, true); @@ -353,8 +353,8 @@ void ED_view3d_draw_setup_view(const wmWindowManager *wm, Scene *scene, ARegion *region, View3D *v3d, - float viewmat[4][4], - float winmat[4][4], + const float viewmat[4][4], + const float winmat[4][4], const rcti *rect) { RegionView3D *rv3d = region->regiondata; @@ -668,7 +668,8 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region, /* safety border */ if (ca) { - immUniformThemeColorBlend(TH_VIEW_OVERLAY, TH_BACK, 0.25f); + GPU_blend(true); + immUniformThemeColorAlpha(TH_VIEW_OVERLAY, 0.75f); if (ca->dtx & CAM_DTX_CENTER) { float x3, y3; @@ -778,6 +779,8 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region, * 2.0f round corner effect was nearly not visible anyway... */ imm_draw_box_wire_2d(shdr_pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); } + + GPU_blend(false); } immUnbindProgram(); @@ -1640,7 +1643,7 @@ static void view3d_stereo3d_setup_offscreen(Depsgraph *depsgraph, const Scene *scene, View3D *v3d, ARegion *region, - float winmat[4][4], + const float winmat[4][4], const char *viewname) { /* update the viewport matrices with the new camera */ @@ -1667,8 +1670,8 @@ void ED_view3d_draw_offscreen(Depsgraph *depsgraph, ARegion *region, int winx, int winy, - float viewmat[4][4], - float winmat[4][4], + const float viewmat[4][4], + const float winmat[4][4], bool is_image_render, bool do_sky, bool UNUSED(is_persp), @@ -1759,8 +1762,8 @@ void ED_view3d_draw_offscreen_simple(Depsgraph *depsgraph, int winx, int winy, uint draw_flags, - float viewmat[4][4], - float winmat[4][4], + const float viewmat[4][4], + const float winmat[4][4], float clip_start, float clip_end, bool is_image_render, @@ -2406,7 +2409,7 @@ struct RV3DMatrixStore *ED_view3d_mats_rv3d_backup(struct RegionView3D *rv3d) copy_m4_m4(rv3dmat->viewinv, rv3d->viewinv); copy_v4_v4(rv3dmat->viewcamtexcofac, rv3d->viewcamtexcofac); rv3dmat->pixsize = rv3d->pixsize; - return (void *)rv3dmat; + return rv3dmat; } void ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixStore *rv3dmat_pt) diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index bf02845058e..19aa9cb203b 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -4868,7 +4868,9 @@ void VIEW3D_OT_background_image_remove(wmOperatorType *ot) * Draw border or toggle off. * \{ */ -static void calc_local_clipping(float clip_local[6][4], BoundBox *clipbb, float mat[4][4]) +static void calc_local_clipping(float clip_local[6][4], + const BoundBox *clipbb, + const float mat[4][4]) { BoundBox clipbb_local; float imat[4][4]; @@ -4883,7 +4885,7 @@ static void calc_local_clipping(float clip_local[6][4], BoundBox *clipbb, float ED_view3d_clipping_calc_from_boundbox(clip_local, &clipbb_local, is_negative_m4(mat)); } -void ED_view3d_clipping_local(RegionView3D *rv3d, float mat[4][4]) +void ED_view3d_clipping_local(RegionView3D *rv3d, const float mat[4][4]) { if (rv3d->rflag & RV3D_CLIPPING) { calc_local_clipping(rv3d->clip_local, rv3d->clipbb, mat); diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index cc19ecf35a8..556b5d51505 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -16,6 +16,10 @@ /** \file * \ingroup spview3d + * + * Interactive fly navigation modal operator (flying around in space). + * + * \note Similar logic to `view3d_walk.c` changes here may apply there too. */ /* defines VIEW3D_OT_fly modal operator */ @@ -998,19 +1002,6 @@ static int flyApply(bContext *C, FlyInfo *fly, bool is_confirm) interp_v3_v3v3( dvec, dvec_tmp, fly->dvec_prev, (1.0f / (1.0f + (time_redraw * FLY_SMOOTH_FAC)))); - if (rv3d->persp == RV3D_CAMOB) { - Object *lock_ob = ED_view3d_cameracontrol_object_get(fly->v3d_camera_control); - if (lock_ob->protectflag & OB_LOCK_LOCX) { - dvec[0] = 0.0; - } - if (lock_ob->protectflag & OB_LOCK_LOCY) { - dvec[1] = 0.0; - } - if (lock_ob->protectflag & OB_LOCK_LOCZ) { - dvec[2] = 0.0; - } - } - add_v3_v3(rv3d->ofs, dvec); if (rv3d->persp == RV3D_CAMOB) { diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 50cd71d7edc..83707ca4383 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -21,8 +21,7 @@ * \ingroup spview3d */ -#ifndef __VIEW3D_INTERN_H__ -#define __VIEW3D_INTERN_H__ +#pragma once #include "ED_view3d.h" @@ -284,5 +283,3 @@ void VIEW3D_GGT_placement(struct wmGizmoGroupType *gzgt); extern uchar view3d_camera_border_hack_col[3]; extern bool view3d_camera_border_hack_test; #endif - -#endif /* __VIEW3D_INTERN_H__ */ diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c index f4ec9a22520..c10a88af146 100644 --- a/source/blender/editors/space_view3d/view3d_project.c +++ b/source/blender/editors/space_view3d/view3d_project.c @@ -303,12 +303,12 @@ eV3DProjStatus ED_view3d_project_float_object(const ARegion *region, float ED_view3d_pixel_size(const RegionView3D *rv3d, const float co[3]) { - return mul_project_m4_v3_zfac((float(*)[4])rv3d->persmat, co) * rv3d->pixsize * U.pixelsize; + return mul_project_m4_v3_zfac(rv3d->persmat, co) * rv3d->pixsize * U.pixelsize; } float ED_view3d_pixel_size_no_ui_scale(const RegionView3D *rv3d, const float co[3]) { - return mul_project_m4_v3_zfac((float(*)[4])rv3d->persmat, co) * rv3d->pixsize; + return mul_project_m4_v3_zfac(rv3d->persmat, co) * rv3d->pixsize; } /** @@ -316,7 +316,7 @@ float ED_view3d_pixel_size_no_ui_scale(const RegionView3D *rv3d, const float co[ */ float ED_view3d_calc_zfac(const RegionView3D *rv3d, const float co[3], bool *r_flip) { - float zfac = mul_project_m4_v3_zfac((float(*)[4])rv3d->persmat, co); + float zfac = mul_project_m4_v3_zfac(rv3d->persmat, co); if (r_flip) { *r_flip = (zfac < 0.0f); @@ -483,11 +483,11 @@ void ED_view3d_global_to_vector(const RegionView3D *rv3d, const float coord[3], p1[3] = 1.0f; copy_v3_v3(p2, p1); p2[3] = 1.0f; - mul_m4_v4((float(*)[4])rv3d->viewmat, p2); + mul_m4_v4(rv3d->viewmat, p2); mul_v3_fl(p2, 2.0f); - mul_m4_v4((float(*)[4])rv3d->viewinv, p2); + mul_m4_v4(rv3d->viewinv, p2); sub_v3_v3v3(vec, p1, p2); } @@ -749,25 +749,26 @@ bool ED_view3d_win_to_segment_clipped(struct Depsgraph *depsgraph, return true; } -/* Utility functions for projection - * ******************************** */ +/* -------------------------------------------------------------------- */ +/** \name Utility functions for projection + * \{ */ -void ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, Object *ob, float pmat[4][4]) +void ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, Object *ob, float r_pmat[4][4]) { float vmat[4][4]; - mul_m4_m4m4(vmat, (float(*)[4])rv3d->viewmat, ob->obmat); - mul_m4_m4m4(pmat, (float(*)[4])rv3d->winmat, vmat); + mul_m4_m4m4(vmat, rv3d->viewmat, ob->obmat); + mul_m4_m4m4(r_pmat, rv3d->winmat, vmat); } void ED_view3d_ob_project_mat_get_from_obmat(const RegionView3D *rv3d, - float obmat[4][4], - float pmat[4][4]) + const float obmat[4][4], + float r_pmat[4][4]) { float vmat[4][4]; - mul_m4_m4m4(vmat, (float(*)[4])rv3d->viewmat, obmat); - mul_m4_m4m4(pmat, (float(*)[4])rv3d->winmat, vmat); + mul_m4_m4m4(vmat, rv3d->viewmat, obmat); + mul_m4_m4m4(r_pmat, rv3d->winmat, vmat); } /** @@ -791,3 +792,5 @@ bool ED_view3d_unproject( return GPU_matrix_unproject(region_co, rv3d->viewmat, rv3d->winmat, viewport, world); } + +/** \} */ diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index fc763d91e3d..64447015bdc 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -2113,7 +2113,7 @@ static bool ed_object_select_pick(bContext *C, if (hits > 0) { /* note: bundles are handling in the same way as bones */ - const bool has_bones = selectbuffer_has_bones(buffer, hits); + const bool has_bones = object ? false : selectbuffer_has_bones(buffer, hits); /* note; shift+alt goes to group-flush-selecting */ if (enumerate) { diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c index bd2323f47f4..4e73a2be17e 100644 --- a/source/blender/editors/space_view3d/view3d_utils.c +++ b/source/blender/editors/space_view3d/view3d_utils.c @@ -335,7 +335,7 @@ void ED_view3d_clipping_calc( * * \{ */ -static bool view3d_boundbox_clip_m4(const BoundBox *bb, float persmatob[4][4]) +static bool view3d_boundbox_clip_m4(const BoundBox *bb, const float persmatob[4][4]) { int a, flag = -1, fl; @@ -1243,7 +1243,9 @@ float ED_view3d_radius_to_dist(const View3D *v3d, * \param fallback_dist: The distance to use if the object is too near or in front of \a ofs. * \returns A newly calculated distance or the fallback. */ -float ED_view3d_offset_distance(float mat[4][4], const float ofs[3], const float fallback_dist) +float ED_view3d_offset_distance(const float mat[4][4], + const float ofs[3], + const float fallback_dist) { float pos[4] = {0.0f, 0.0f, 0.0f, 1.0f}; float dir[4] = {0.0f, 0.0f, 1.0f, 0.0f}; @@ -1374,11 +1376,11 @@ static float view3d_quat_axis[6][4][4] = { }; -bool ED_view3d_quat_from_axis_view(const char view, const char view_axis_roll, float quat[4]) +bool ED_view3d_quat_from_axis_view(const char view, const char view_axis_roll, float r_quat[4]) { BLI_assert(view_axis_roll <= RV3D_VIEW_AXIS_ROLL_270); if (RV3D_VIEW_IS_AXIS(view)) { - copy_qt_qt(quat, view3d_quat_axis[view - RV3D_VIEW_FRONT][view_axis_roll]); + copy_qt_qt(r_quat, view3d_quat_axis[view - RV3D_VIEW_FRONT][view_axis_roll]); return true; } return false; diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 751e37f0235..64167b83655 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -16,6 +16,11 @@ /** \file * \ingroup spview3d + * + * Interactive walk navigation modal operator + * (similar to walking around in a first person game). + * + * \note Similar logic to `view3d_fly.c` changes here may apply there too. */ /* defines VIEW3D_OT_navigate - walk modal operator */ @@ -1295,19 +1300,6 @@ static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm) sub_v3_v3v3(dvec, cur_loc, new_loc); } - if (rv3d->persp == RV3D_CAMOB) { - Object *lock_ob = ED_view3d_cameracontrol_object_get(walk->v3d_camera_control); - if (lock_ob->protectflag & OB_LOCK_LOCX) { - dvec[0] = 0.0f; - } - if (lock_ob->protectflag & OB_LOCK_LOCY) { - dvec[1] = 0.0f; - } - if (lock_ob->protectflag & OB_LOCK_LOCZ) { - dvec[2] = 0.0f; - } - } - /* scale the movement to the scene size */ mul_v3_v3fl(dvec_tmp, dvec, walk->grid); add_v3_v3(rv3d->ofs, dvec_tmp); diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 2bda04ad811..bc00dd8e221 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -21,8 +21,7 @@ * \ingroup edtransform */ -#ifndef __TRANSFORM_H__ -#define __TRANSFORM_H__ +#pragma once #include "ED_numinput.h" #include "ED_transform.h" @@ -752,5 +751,3 @@ bool checkUseAxisMatrix(TransInfo *t); *tc_end = (t)->data_container + (t)->data_container_len; \ th != tc_end; \ th++, i++) - -#endif diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 66b90eb159f..e15239f37d4 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -510,10 +510,12 @@ static void applyObjectConstraintVec( else { /* Specific TransData's space. */ copy_v3_v3(out, in); - mul_m3_v3(t->spacemtx_inv, out); - mul_m3_v3(td->axismtx, out); - if (t->flag & T_EDIT) { - mul_m3_v3(tc->mat3_unit, out); + if (t->con.mode & CON_APPLY) { + mul_m3_v3(t->spacemtx_inv, out); + mul_m3_v3(td->axismtx, out); + if (t->flag & T_EDIT) { + mul_m3_v3(tc->mat3_unit, out); + } } } } diff --git a/source/blender/editors/transform/transform_constraints.h b/source/blender/editors/transform/transform_constraints.h index 282060af2c3..4c901842964 100644 --- a/source/blender/editors/transform/transform_constraints.h +++ b/source/blender/editors/transform/transform_constraints.h @@ -21,8 +21,7 @@ * \ingroup edtransform */ -#ifndef __TRANSFORM_CONSTRAINTS_H__ -#define __TRANSFORM_CONSTRAINTS_H__ +#pragma once struct TransInfo; @@ -49,5 +48,3 @@ int constraintModeToIndex(const TransInfo *t); char constraintModeToChar(const TransInfo *t); bool isLockConstraint(TransInfo *t); int getConstraintSpaceDimension(TransInfo *t); - -#endif diff --git a/source/blender/editors/transform/transform_convert.h b/source/blender/editors/transform/transform_convert.h index ee478ad8567..b753572ea7b 100644 --- a/source/blender/editors/transform/transform_convert.h +++ b/source/blender/editors/transform/transform_convert.h @@ -22,8 +22,7 @@ * \brief conversion and adaptation of different datablocks to a common struct. */ -#ifndef __TRANSFORM_CONVERT_H__ -#define __TRANSFORM_CONVERT_H__ +#pragma once struct BezTriple; struct FCurve; @@ -47,7 +46,7 @@ bool clipUVTransform(TransInfo *t, float vec[2], const bool resize); void clipUVData(TransInfo *t); /* transform_convert_mesh.c */ -void trans_mesh_customdata_correction_init(TransInfo *t); +void mesh_customdatacorrect_init(TransInfo *t); /* transform_convert_sequencer.c */ int transform_convert_sequencer_get_snap_bound(TransInfo *t); @@ -189,4 +188,3 @@ void special_aftertrans_update__sequencer(bContext *C, TransInfo *t); void createTransTrackingData(bContext *C, TransInfo *t); void recalcData_tracking(TransInfo *t); void special_aftertrans_update__movieclip(bContext *C, TransInfo *t); -#endif diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c index 31b9b771047..ad426713719 100644 --- a/source/blender/editors/transform/transform_convert_mesh.c +++ b/source/blender/editors/transform/transform_convert_mesh.c @@ -51,6 +51,8 @@ /* Own include. */ #include "transform_convert.h" +#define USE_FACE_SUBSTITUTE + /* -------------------------------------------------------------------- */ /** \name Island Creation * @@ -470,7 +472,7 @@ static void editmesh_mirror_data_calc(BMEditMesh *em, BMIter iter; int i, flag, totvert = bm->totvert; - vert_map = MEM_mallocN(totvert * sizeof(*vert_map), __func__); + vert_map = MEM_callocN(totvert * sizeof(*vert_map), __func__); float select_sum[3] = {0}; BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) { @@ -496,7 +498,8 @@ static void editmesh_mirror_data_calc(BMEditMesh *em, uint mirror_elem_len = 0; int *index[3] = {NULL, NULL, NULL}; - bool test_selected_only = use_select && (mirror_axis[0] + mirror_axis[1] + mirror_axis[2]) == 1; + bool is_single_mirror_axis = (mirror_axis[0] + mirror_axis[1] + mirror_axis[2]) == 1; + bool test_selected_only = use_select && is_single_mirror_axis; for (int a = 0; a < 3; a++) { if (!mirror_axis[a]) { continue; @@ -521,13 +524,23 @@ static void editmesh_mirror_data_calc(BMEditMesh *em, if (!is_in_quadrant_v3(eve->co, quadrant, TRANSFORM_MAXDIST_MIRROR)) { continue; } + if (vert_map[i_mirr].flag != 0) { + /* One mirror per element. + * It can happen when vertices occupy the same position. */ + continue; + } vert_map[i_mirr] = (struct MirrorDataVert){i, flag}; mirror_elem_len++; } } - if (mirror_elem_len) { + if (!mirror_elem_len) { + MEM_freeN(vert_map); + vert_map = NULL; + } + else if (!is_single_mirror_axis) { + /* Adjustment for elements that are mirrors of mirrored elements. */ for (int a = 0; a < 3; a++) { if (!mirror_axis[a]) { continue; @@ -549,10 +562,6 @@ static void editmesh_mirror_data_calc(BMEditMesh *em, } } } - else { - MEM_freeN(vert_map); - vert_map = NULL; - } MEM_SAFE_FREE(index[0]); MEM_SAFE_FREE(index[1]); @@ -958,41 +967,44 @@ void createTransEditVerts(TransInfo *t) /** \} */ /* -------------------------------------------------------------------- */ -/** \name CustomData Layer Correction (for meshes) +/** \name CustomData Layer Correction * * \{ */ -struct TransCustomDataLayerVert { - BMVert *v; - float co_orig_3d[3]; +struct TransCustomDataMergeGroup { + /** map {BMVert: TransCustomDataLayerVert} */ struct LinkNode **cd_loop_groups; }; struct TransCustomDataLayer { BMesh *bm; + struct MemArena *arena; - int cd_loop_mdisp_offset; - - /** map {BMVert: TransCustomDataLayerVert} */ - struct GHash *origverts; struct GHash *origfaces; struct BMesh *bm_origfaces; - struct MemArena *arena; - /** Number of math BMLoop layers. */ - int layer_math_map_num; - /** Array size of 'layer_math_map_num' - * maps TransCustomDataLayerVert.cd_group index to absolute CustomData layer index */ - int *layer_math_map; - - /* Array with all elements transformed. */ - struct TransCustomDataLayerVert *data; - int data_len; + /* Special handle for multi-resolution. */ + int cd_loop_mdisp_offset; + + /* Optionally merge custom-data groups (this keeps UVs connected for example). */ + struct { + /** map {BMVert: TransDataBasic} */ + struct GHash *origverts; + struct TransCustomDataMergeGroup *data; + int data_len; + /** Array size of 'layer_math_map_len' + * maps #TransCustomDataLayerVert.cd_group index to absolute #CustomData layer index */ + int *customdatalayer_map; + /** Number of math BMLoop layers. */ + int customdatalayer_map_len; + } merge_group; + + bool use_merge_group; }; -static void trans_mesh_customdata_free_cb(struct TransInfo *UNUSED(t), - struct TransDataContainer *UNUSED(tc), - struct TransCustomData *custom_data) +static void mesh_customdatacorrect_free_cb(struct TransInfo *UNUSED(t), + struct TransDataContainer *UNUSED(tc), + struct TransCustomData *custom_data) { struct TransCustomDataLayer *tcld = custom_data->data; bmesh_edit_end(tcld->bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES); @@ -1003,77 +1015,206 @@ static void trans_mesh_customdata_free_cb(struct TransInfo *UNUSED(t), if (tcld->origfaces) { BLI_ghash_free(tcld->origfaces, NULL, NULL); } - if (tcld->origverts) { - BLI_ghash_free(tcld->origverts, NULL, NULL); + if (tcld->merge_group.origverts) { + BLI_ghash_free(tcld->merge_group.origverts, NULL, NULL); } if (tcld->arena) { BLI_memarena_free(tcld->arena); } - if (tcld->layer_math_map) { - MEM_freeN(tcld->layer_math_map); + if (tcld->merge_group.customdatalayer_map) { + MEM_freeN(tcld->merge_group.customdatalayer_map); } MEM_freeN(tcld); custom_data->data = NULL; } -static void create_trans_vert_customdata_layer(BMVert *v, - struct TransCustomDataLayer *tcld, - struct TransCustomDataLayerVert *r_tcld_vert) +#ifdef USE_FACE_SUBSTITUTE + +# define FACE_SUBSTITUTE_INDEX INT_MIN + +/* Search for a neighboring face with area and preferably without selected vertex. + * Used to replace arealess faces in customdata correction. */ +static BMFace *mesh_customdatacorrect_find_best_face_substitute(BMFace *f) { + BMFace *best_face = NULL; + BMLoop *l; + BMIter liter; + BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { + BMLoop *l_radial_next = l->radial_next; + BMFace *f_test = l_radial_next->f; + if (f_test == f) { + continue; + } + if (is_zero_v3(f_test->no)) { + continue; + } + + /* Check the loops edge isn't selected. */ + if (!BM_elem_flag_test(l_radial_next->v, BM_ELEM_SELECT) && + !BM_elem_flag_test(l_radial_next->next->v, BM_ELEM_SELECT)) { + /* Prefer edges with unselected vertices. + * Useful for extrude. */ + best_face = f_test; + break; + } + if (best_face == NULL) { + best_face = f_test; + } + } + return best_face; +} + +static void mesh_customdatacorrect_face_substitute_set(struct TransCustomDataLayer *tcld, + BMFace *f, + BMFace *f_copy) +{ + BLI_assert(is_zero_v3(f->no)); BMesh *bm = tcld->bm; + /* It is impossible to calculate the loops weights of a face without area. + * Find a substitute. */ + BMFace *f_substitute = mesh_customdatacorrect_find_best_face_substitute(f); + if (f_substitute) { + /* Copy the custom-data from the substitute face. */ + BMLoop *l_iter, *l_first; + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + BM_loop_interp_from_face(bm, l_iter, f_substitute, false, false); + } while ((l_iter = l_iter->next) != l_first); + + /* Use the substitute face as the reference during the transformation. */ + BMFace *f_substitute_copy = BM_face_copy(tcld->bm_origfaces, bm, f_substitute, true, true); + + /* Hack: reference substitute face in `f_copy->no`. + * `tcld->origfaces` is already used to restore the initial value. */ + BM_elem_index_set(f_copy, FACE_SUBSTITUTE_INDEX); + *((BMFace **)&f_copy->no[0]) = f_substitute_copy; + } +} + +static BMFace *mesh_customdatacorrect_face_substitute_get(BMFace *f_copy) +{ + BLI_assert(BM_elem_index_get(f_copy) == FACE_SUBSTITUTE_INDEX); + return *((BMFace **)&f_copy->no[0]); +} + +#endif /* USE_FACE_SUBSTITUTE */ + +static void mesh_customdatacorrect_init_vert(struct TransCustomDataLayer *tcld, + struct TransDataBasic *td, + const int index) +{ + BMesh *bm = tcld->bm; + BMVert *v = td->extra; BMIter liter; int j, l_num; float *loop_weights; - /* copy face data */ // BM_ITER_ELEM (l, &liter, sv->v, BM_LOOPS_OF_VERT) { BM_iter_init(&liter, bm, BM_LOOPS_OF_VERT, v); l_num = liter.count; - loop_weights = BLI_array_alloca(loop_weights, l_num); + loop_weights = tcld->use_merge_group ? BLI_array_alloca(loop_weights, l_num) : NULL; for (j = 0; j < l_num; j++) { BMLoop *l = BM_iter_step(&liter); BMLoop *l_prev, *l_next; + + /* Generic custom-data correction. Copy face data. */ void **val_p; if (!BLI_ghash_ensure_p(tcld->origfaces, l->f, &val_p)) { BMFace *f_copy = BM_face_copy(tcld->bm_origfaces, bm, l->f, true, true); *val_p = f_copy; +#ifdef USE_FACE_SUBSTITUTE + if (is_zero_v3(l->f->no)) { + mesh_customdatacorrect_face_substitute_set(tcld, l->f, f_copy); + } +#endif + } + + if (tcld->use_merge_group) { + if ((l_prev = BM_loop_find_prev_nodouble(l, l->next, FLT_EPSILON)) && + (l_next = BM_loop_find_next_nodouble(l, l_prev, FLT_EPSILON))) { + loop_weights[j] = angle_v3v3v3(l_prev->v->co, l->v->co, l_next->v->co); + } + else { + loop_weights[j] = 0.0f; + } } + } - if ((l_prev = BM_loop_find_prev_nodouble(l, l->next, FLT_EPSILON)) && - (l_next = BM_loop_find_next_nodouble(l, l_prev, FLT_EPSILON))) { - loop_weights[j] = angle_v3v3v3(l_prev->v->co, l->v->co, l_next->v->co); + if (tcld->use_merge_group) { + /* Store cd_loop_groups. */ + struct TransCustomDataMergeGroup *merge_data = &tcld->merge_group.data[index]; + if (l_num != 0) { + merge_data->cd_loop_groups = BLI_memarena_alloc( + tcld->arena, tcld->merge_group.customdatalayer_map_len * sizeof(void *)); + for (j = 0; j < tcld->merge_group.customdatalayer_map_len; j++) { + const int layer_nr = tcld->merge_group.customdatalayer_map[j]; + merge_data->cd_loop_groups[j] = BM_vert_loop_groups_data_layer_create( + bm, v, layer_nr, loop_weights, tcld->arena); + } } else { - loop_weights[j] = 0.0f; + merge_data->cd_loop_groups = NULL; } + + BLI_ghash_insert(tcld->merge_group.origverts, v, td); } +} + +static void mesh_customdatacorrect_init_container_generic(TransDataContainer *UNUSED(tc), + struct TransCustomDataLayer *tcld) +{ + BMesh *bm = tcld->bm; + + struct GHash *origfaces = BLI_ghash_ptr_new(__func__); + struct BMesh *bm_origfaces = BM_mesh_create(&bm_mesh_allocsize_default, + &((struct BMeshCreateParams){ + .use_toolflags = false, + })); + + /* We need to have matching custom-data. */ + BM_mesh_copy_init_customdata(bm_origfaces, bm, NULL); + tcld->origfaces = origfaces; + tcld->bm_origfaces = bm_origfaces; + + bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES); + tcld->cd_loop_mdisp_offset = CustomData_get_offset(&bm->ldata, CD_MDISPS); +} + +static void mesh_customdatacorrect_init_container_merge_group(TransDataContainer *tc, + struct TransCustomDataLayer *tcld) +{ + BMesh *bm = tcld->bm; + BLI_assert(CustomData_has_math(&bm->ldata)); + + /* TODO: We don't need `layer_math_map` when there are no loops linked + * to one of the sliding vertices. */ - /* store cd_loop_groups */ - if (tcld->layer_math_map_num && (l_num != 0)) { - r_tcld_vert->cd_loop_groups = BLI_memarena_alloc(tcld->arena, - tcld->layer_math_map_num * sizeof(void *)); - for (j = 0; j < tcld->layer_math_map_num; j++) { - const int layer_nr = tcld->layer_math_map[j]; - r_tcld_vert->cd_loop_groups[j] = BM_vert_loop_groups_data_layer_create( - bm, v, layer_nr, loop_weights, tcld->arena); + /* Over allocate, only 'math' layers are indexed. */ + int *customdatalayer_map = MEM_mallocN(sizeof(int) * bm->ldata.totlayer, __func__); + int layer_math_map_len = 0; + for (int i = 0; i < bm->ldata.totlayer; i++) { + if (CustomData_layer_has_math(&bm->ldata, i)) { + customdatalayer_map[layer_math_map_len++] = i; } } - else { - r_tcld_vert->cd_loop_groups = NULL; - } - - r_tcld_vert->v = v; - copy_v3_v3(r_tcld_vert->co_orig_3d, v->co); - BLI_ghash_insert(tcld->origverts, v, r_tcld_vert); + BLI_assert(layer_math_map_len != 0); + + tcld->merge_group.data_len = tc->data_len + tc->data_mirror_len; + tcld->merge_group.customdatalayer_map = customdatalayer_map; + tcld->merge_group.customdatalayer_map_len = layer_math_map_len; + tcld->merge_group.origverts = BLI_ghash_ptr_new_ex(__func__, tcld->merge_group.data_len); + tcld->merge_group.data = BLI_memarena_alloc( + tcld->arena, tcld->merge_group.data_len * sizeof(*tcld->merge_group.data)); } -static void trans_mesh_customdata_correction_init_container(TransDataContainer *tc) +static void mesh_customdatacorrect_init_container(TransDataContainer *tc, + const bool use_merge_group) { if (tc->custom.type.data) { - /* Custom data correction has initiated before. */ - BLI_assert(tc->custom.type.free_cb == trans_mesh_customdata_free_cb); - return; + /* The custom-data correction has been initiated before. + * Free since some modes have different settings. */ + mesh_customdatacorrect_free_cb(NULL, tc, &tc->custom.type); } BMEditMesh *em = BKE_editmesh_from_object(tc->obedit); @@ -1082,135 +1223,79 @@ static void trans_mesh_customdata_correction_init_container(TransDataContainer * if (bm->shapenr > 1) { /* Don't do this at all for non-basis shape keys, too easy to * accidentally break uv maps or vertex colors then */ - /* create copies of faces for customdata projection. */ + /* create copies of faces for custom-data projection. */ return; } - - const bool has_layer_math = CustomData_has_math(&bm->ldata); - const int cd_loop_mdisp_offset = CustomData_get_offset(&bm->ldata, CD_MDISPS); - if (!has_layer_math && (cd_loop_mdisp_offset == -1)) { + if (!CustomData_has_math(&bm->ldata) && !CustomData_has_layer(&bm->ldata, CD_MDISPS)) { + /* There is no custom-data to correct. */ return; } - bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES); + struct TransCustomDataLayer *tcld = MEM_callocN(sizeof(*tcld), __func__); + tcld->bm = bm; + tcld->arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__); - struct GHash *origfaces = BLI_ghash_ptr_new(__func__); - struct BMesh *bm_origfaces = BM_mesh_create(&bm_mesh_allocsize_default, - &((struct BMeshCreateParams){ - .use_toolflags = false, - })); + /* Init `cd_loop_mdisp_offset` to -1 to avoid problems with a valid index. */ + tcld->cd_loop_mdisp_offset = -1; + tcld->use_merge_group = use_merge_group; - /* we need to have matching customdata */ - BM_mesh_copy_init_customdata(bm_origfaces, bm, NULL); + mesh_customdatacorrect_init_container_generic(tc, tcld); - int *layer_math_map = NULL; - int layer_math_map_len = 0; - { - /* TODO: We don't need `sod->layer_math_map` when there are no loops linked - * to one of the sliding vertices. */ - if (has_layer_math) { - /* over alloc, only 'math' layers are indexed */ - layer_math_map = MEM_mallocN(bm->ldata.totlayer * sizeof(int), __func__); - for (int i = 0; i < bm->ldata.totlayer; i++) { - if (CustomData_layer_has_math(&bm->ldata, i)) { - layer_math_map[layer_math_map_len++] = i; - } - } - BLI_assert(layer_math_map_len != 0); - } + if (tcld->use_merge_group) { + mesh_customdatacorrect_init_container_merge_group(tc, tcld); } - struct TransCustomDataLayer *tcld = MEM_mallocN(sizeof(*tcld), __func__); - int data_len = tc->data_len + tc->data_mirror_len; - - tcld->bm = bm; - tcld->origfaces = origfaces; - tcld->bm_origfaces = bm_origfaces; - tcld->cd_loop_mdisp_offset = cd_loop_mdisp_offset; - tcld->layer_math_map = layer_math_map; - tcld->layer_math_map_num = layer_math_map_len; - tcld->arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__); - tcld->origverts = BLI_ghash_ptr_new_ex(__func__, data_len); - tcld->data = BLI_memarena_alloc(tcld->arena, data_len * sizeof(*tcld->data)); - tcld->data_len = data_len; - { /* Setup Verts. */ - struct TransCustomDataLayerVert *tcld_vert_iter = &tcld->data[0]; + int i = 0; TransData *tob = tc->data; - for (int i = tc->data_len; i--; tob++, tcld_vert_iter++) { - BMVert *v = tob->extra; - create_trans_vert_customdata_layer(v, tcld, tcld_vert_iter); + for (int j = tc->data_len; j--; tob++, i++) { + mesh_customdatacorrect_init_vert(tcld, (TransDataBasic *)tob, i); } TransDataMirror *td_mirror = tc->data_mirror; - for (int i = tc->data_mirror_len; i--; td_mirror++, tcld_vert_iter++) { - BMVert *v = td_mirror->extra; - create_trans_vert_customdata_layer(v, tcld, tcld_vert_iter); + for (int j = tc->data_mirror_len; j--; td_mirror++, i++) { + mesh_customdatacorrect_init_vert(tcld, (TransDataBasic *)td_mirror, i); } } tc->custom.type.data = tcld; - tc->custom.type.free_cb = trans_mesh_customdata_free_cb; + tc->custom.type.free_cb = mesh_customdatacorrect_free_cb; } -void trans_mesh_customdata_correction_init(TransInfo *t) +void mesh_customdatacorrect_init(TransInfo *t) { - if (!ELEM(t->mode, - TFM_TRANSLATION, - TFM_ROTATION, - TFM_RESIZE, - TFM_TOSPHERE, - TFM_SHEAR, - TFM_BEND, - TFM_SHRINKFATTEN, - TFM_TRACKBALL, - TFM_PUSHPULL, - TFM_ALIGN, - TFM_EDGE_SLIDE, - TFM_VERT_SLIDE)) { - /* Currently only modes that change the position of vertices are supported. */ - return; - } - - const char uvcalc_correct_flag = ELEM(t->mode, TFM_VERT_SLIDE, TFM_EDGE_SLIDE) ? - UVCALC_TRANSFORM_CORRECT_SLIDE : - UVCALC_TRANSFORM_CORRECT; - - if (t->settings->uvcalc_flag & uvcalc_correct_flag) { - FOREACH_TRANS_DATA_CONTAINER (t, tc) { - trans_mesh_customdata_correction_init_container(tc); + bool use_merge_group = false; + if (ELEM(t->mode, TFM_EDGE_SLIDE, TFM_VERT_SLIDE)) { + if (!(t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT_SLIDE)) { + /* No custom-data correction. */ + return; } + use_merge_group = true; } -} - -static void trans_mesh_customdata_correction_restore(struct TransDataContainer *tc) -{ - struct TransCustomDataLayer *tcld = tc->custom.type.data; - if (!tcld) { - return; + else if (ELEM(t->mode, + TFM_TRANSLATION, + TFM_ROTATION, + TFM_RESIZE, + TFM_TOSPHERE, + TFM_SHEAR, + TFM_BEND, + TFM_SHRINKFATTEN, + TFM_TRACKBALL, + TFM_PUSHPULL, + TFM_ALIGN)) { + { + if (!(t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT)) { + /* No custom-data correction. */ + return; + } + use_merge_group = (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT_KEEP_CONNECTED) != 0; + } } - BMesh *bm = tcld->bm; - BMesh *bm_copy = tcld->bm_origfaces; - - GHashIterator gh_iter; - GHASH_ITER (gh_iter, tcld->origfaces) { - BMFace *f = BLI_ghashIterator_getKey(&gh_iter); - BMFace *f_copy = BLI_ghashIterator_getValue(&gh_iter); - BLI_assert(f->len == f_copy->len); - - BMLoop *l_iter, *l_first, *l_copy; - l_iter = l_first = BM_FACE_FIRST_LOOP(f); - l_copy = BM_FACE_FIRST_LOOP(f_copy); - do { - /* TODO: Restore only the elements that transform. */ - BM_elem_attrs_copy(bm_copy, bm, l_copy, l_iter); - l_copy = l_copy->next; - } while ((l_iter = l_iter->next) != l_first); - - BM_elem_attrs_copy_ex(bm_copy, bm, f_copy, f, BM_ELEM_SELECT, CD_MASK_NORMAL); + FOREACH_TRANS_DATA_CONTAINER (t, tc) { + mesh_customdatacorrect_init_container(tc, use_merge_group); } } @@ -1219,23 +1304,24 @@ static void trans_mesh_customdata_correction_restore(struct TransDataContainer * */ static const float *trans_vert_orig_co_get(struct TransCustomDataLayer *tcld, BMVert *v) { - struct TransCustomDataLayerVert *tcld_vert = BLI_ghash_lookup(tcld->origverts, v); - return tcld_vert ? tcld_vert->co_orig_3d : v->co; + TransDataBasic *td = BLI_ghash_lookup(tcld->merge_group.origverts, v); + return td ? td->iloc : v->co; } -static void trans_mesh_customdata_correction_apply_vert(struct TransCustomDataLayer *tcld, - struct TransCustomDataLayerVert *tcld_vert, - bool do_loop_mdisps) +static void mesh_customdatacorrect_apply_vert(struct TransCustomDataLayer *tcld, + struct TransDataBasic *td, + struct TransCustomDataMergeGroup *merge_data, + bool do_loop_mdisps) { BMesh *bm = tcld->bm; - BMVert *v = tcld_vert->v; - const float *co_orig_3d = tcld_vert->co_orig_3d; + BMVert *v = td->extra; + const float *co_orig_3d = td->iloc; BMIter liter; int j, l_num; float *loop_weights; const bool is_moved = (len_squared_v3v3(v->co, co_orig_3d) > FLT_EPSILON); - const bool do_loop_weight = is_moved && tcld->layer_math_map_num; + const bool do_loop_weight = is_moved && tcld->merge_group.customdatalayer_map_len; const float *v_proj_axis = v->no; /* original (l->prev, l, l->next) projections for each loop ('l' remains unchanged) */ float v_proj[3][3]; @@ -1254,6 +1340,14 @@ static void trans_mesh_customdata_correction_apply_vert(struct TransCustomDataLa f_copy = BLI_ghash_lookup(tcld->origfaces, l->f); +#ifdef USE_FACE_SUBSTITUTE + /* In some faces it is not possible to calculate interpolation, + * so we use a substitute. */ + if (BM_elem_index_get(f_copy) == FACE_SUBSTITUTE_INDEX) { + f_copy = mesh_customdatacorrect_face_substitute_get(f_copy); + } +#endif + /* only loop data, no vertex data since that contains shape keys, * and we do not want to mess up other shape keys */ BM_loop_interp_from_face(bm, l, f_copy, false, false); @@ -1305,17 +1399,20 @@ static void trans_mesh_customdata_correction_apply_vert(struct TransCustomDataLa } } - struct LinkNode **cd_loop_groups = tcld_vert->cd_loop_groups; - if (tcld->layer_math_map_num && cd_loop_groups) { - if (do_loop_weight) { - for (j = 0; j < tcld->layer_math_map_num; j++) { - BM_vert_loop_groups_data_layer_merge_weights( - bm, cd_loop_groups[j], tcld->layer_math_map[j], loop_weights); + if (tcld->use_merge_group) { + struct LinkNode **cd_loop_groups = merge_data->cd_loop_groups; + if (tcld->merge_group.customdatalayer_map_len && cd_loop_groups) { + if (do_loop_weight) { + for (j = 0; j < tcld->merge_group.customdatalayer_map_len; j++) { + BM_vert_loop_groups_data_layer_merge_weights( + bm, cd_loop_groups[j], tcld->merge_group.customdatalayer_map[j], loop_weights); + } } - } - else { - for (j = 0; j < tcld->layer_math_map_num; j++) { - BM_vert_loop_groups_data_layer_merge(bm, cd_loop_groups[j], tcld->layer_math_map[j]); + else { + for (j = 0; j < tcld->merge_group.customdatalayer_map_len; j++) { + BM_vert_loop_groups_data_layer_merge( + bm, cd_loop_groups[j], tcld->merge_group.customdatalayer_map[j]); + } } } } @@ -1355,19 +1452,63 @@ static void trans_mesh_customdata_correction_apply_vert(struct TransCustomDataLa } } -static void trans_mesh_customdata_correction_apply(struct TransDataContainer *tc, bool is_final) +static void mesh_customdatacorrect_apply(TransInfo *t, bool is_final) { - struct TransCustomDataLayer *tcld = tc->custom.type.data; - if (!tcld) { - return; + FOREACH_TRANS_DATA_CONTAINER (t, tc) { + if (!tc->custom.type.data) { + continue; + } + struct TransCustomDataLayer *tcld = tc->custom.type.data; + const bool use_merge_group = tcld->use_merge_group; + + struct TransCustomDataMergeGroup *merge_data = tcld->merge_group.data; + TransData *tob = tc->data; + for (int i = tc->data_len; i--; tob++) { + mesh_customdatacorrect_apply_vert(tcld, (TransDataBasic *)tob, merge_data, is_final); + + if (use_merge_group) { + merge_data++; + } + } + + TransDataMirror *td_mirror = tc->data_mirror; + for (int i = tc->data_mirror_len; i--; td_mirror++) { + mesh_customdatacorrect_apply_vert(tcld, (TransDataBasic *)td_mirror, merge_data, is_final); + + if (use_merge_group) { + merge_data++; + } + } } +} - const bool do_loop_mdisps = is_final && (tcld->cd_loop_mdisp_offset != -1); - struct TransCustomDataLayerVert *tcld_vert_iter = &tcld->data[0]; +static void mesh_customdatacorrect_restore(struct TransInfo *t) +{ + FOREACH_TRANS_DATA_CONTAINER (t, tc) { + struct TransCustomDataLayer *tcld = tc->custom.type.data; + if (!tcld) { + continue; + } - for (int i = tcld->data_len; i--; tcld_vert_iter++) { - if (tcld_vert_iter->cd_loop_groups || do_loop_mdisps) { - trans_mesh_customdata_correction_apply_vert(tcld, tcld_vert_iter, do_loop_mdisps); + BMesh *bm = tcld->bm; + BMesh *bm_copy = tcld->bm_origfaces; + + GHashIterator gh_iter; + GHASH_ITER (gh_iter, tcld->origfaces) { + BMFace *f = BLI_ghashIterator_getKey(&gh_iter); + BMFace *f_copy = BLI_ghashIterator_getValue(&gh_iter); + BLI_assert(f->len == f_copy->len); + + BMLoop *l_iter, *l_first, *l_copy; + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + l_copy = BM_FACE_FIRST_LOOP(f_copy); + do { + /* TODO: Restore only the elements that transform. */ + BM_elem_attrs_copy(bm_copy, bm, l_copy, l_iter); + l_copy = l_copy->next; + } while ((l_iter = l_iter->next) != l_first); + + BM_elem_attrs_copy_ex(bm_copy, bm, f_copy, f, BM_ELEM_SELECT, CD_MASK_NORMAL); } } } @@ -1428,16 +1569,14 @@ void recalcData_mesh(TransInfo *t) if ((t->flag & T_NO_MIRROR) == 0 && (t->options & CTX_NO_MIRROR) == 0) { transform_apply_to_mirror(t); } + + mesh_customdatacorrect_apply(t, false); + } + else { + mesh_customdatacorrect_restore(t); } FOREACH_TRANS_DATA_CONTAINER (t, tc) { - if (is_cancelling) { - trans_mesh_customdata_correction_restore(tc); - } - else { - trans_mesh_customdata_correction_apply(tc, false); - } - DEG_id_tag_update(tc->obedit->data, 0); /* sets recalc flags */ BMEditMesh *em = BKE_editmesh_from_object(tc->obedit); EDBM_mesh_normals_update(em); @@ -1455,13 +1594,11 @@ void special_aftertrans_update__mesh(bContext *UNUSED(C), TransInfo *t) const bool is_cancelling = (t->state == TRANS_CANCEL); const bool use_automerge = !is_cancelling && (t->flag & (T_AUTOMERGE | T_AUTOSPLIT)) != 0; - if (!is_cancelling && TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.type.data != NULL) { + if (!is_cancelling && ELEM(t->mode, TFM_EDGE_SLIDE, TFM_VERT_SLIDE)) { /* Handle multires re-projection, done * on transform completion since it's * really slow -joeedh. */ - FOREACH_TRANS_DATA_CONTAINER (t, tc) { - trans_mesh_customdata_correction_apply(tc, true); - } + mesh_customdatacorrect_apply(t, true); } if (use_automerge) { diff --git a/source/blender/editors/transform/transform_data.h b/source/blender/editors/transform/transform_data.h index 48ed9ecf34b..bca6a99e35a 100644 --- a/source/blender/editors/transform/transform_data.h +++ b/source/blender/editors/transform/transform_data.h @@ -21,8 +21,7 @@ * \ingroup edtransform */ -#ifndef __TRANSFORM_DATA_H__ -#define __TRANSFORM_DATA_H__ +#pragma once struct bConstraint; struct Object; @@ -193,5 +192,3 @@ enum { /* Hard min/max for proportional size. */ #define T_PROP_SIZE_MIN 1e-6f #define T_PROP_SIZE_MAX 1e12f - -#endif diff --git a/source/blender/editors/transform/transform_draw_cursors.h b/source/blender/editors/transform/transform_draw_cursors.h index e7696bad5a7..0f626c9039b 100644 --- a/source/blender/editors/transform/transform_draw_cursors.h +++ b/source/blender/editors/transform/transform_draw_cursors.h @@ -21,11 +21,8 @@ * \ingroup edtransform */ -#ifndef __TRANSFORM_DRAW_CURSORS_H__ -#define __TRANSFORM_DRAW_CURSORS_H__ +#pragma once /* Callbacks for #WM_paint_cursor_activate */ bool transform_draw_cursor_poll(struct bContext *C); void transform_draw_cursor_draw(struct bContext *C, int x, int y, void *customdata); - -#endif /* __TRANSFORM_DRAW_CURSORS_H__ */ diff --git a/source/blender/editors/transform/transform_mode.c b/source/blender/editors/transform/transform_mode.c index 5988f5a0f83..38d49ab5efd 100644 --- a/source/blender/editors/transform/transform_mode.c +++ b/source/blender/editors/transform/transform_mode.c @@ -1272,7 +1272,7 @@ void transform_mode_init(TransInfo *t, wmOperator *op, const int mode) if (t->data_type == TC_MESH_VERTS) { /* Init Custom Data correction. * Ideally this should be called when creating the TransData. */ - trans_mesh_customdata_correction_init(t); + mesh_customdatacorrect_init(t); } /* TODO(germano): Some of these operations change the `t->mode`. diff --git a/source/blender/editors/transform/transform_mode.h b/source/blender/editors/transform/transform_mode.h index 5cda8e3063a..51aca7d551c 100644 --- a/source/blender/editors/transform/transform_mode.h +++ b/source/blender/editors/transform/transform_mode.h @@ -22,8 +22,7 @@ * \brief transform modes used by different operators. */ -#ifndef __TRANSFORM_MODE_H__ -#define __TRANSFORM_MODE_H__ +#pragma once struct AnimData; struct bContext; @@ -156,4 +155,3 @@ void initTranslation(TransInfo *t); void drawVertSlide(TransInfo *t); void initVertSlide_ex(TransInfo *t, bool use_even, bool flipped, bool use_clamp); void initVertSlide(TransInfo *t); -#endif diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 493b52495db..e805743e6bb 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -467,14 +467,14 @@ short ED_transform_calc_orientation_from_type_ex(const bContext *C, return V3D_ORIENT_GLOBAL; } case V3D_ORIENT_GIMBAL: { - if (gimbal_axis(ob, r_mat)) { + if (ob && gimbal_axis(ob, r_mat)) { return V3D_ORIENT_GIMBAL; } /* if not gimbal, fall through to normal */ ATTR_FALLTHROUGH; } case V3D_ORIENT_NORMAL: { - if (obedit || ob->mode & OB_MODE_POSE) { + if (obedit || (ob && ob->mode & OB_MODE_POSE)) { ED_getTransformOrientationMatrix(C, r_mat, pivot_point); return V3D_ORIENT_NORMAL; } diff --git a/source/blender/editors/transform/transform_snap.h b/source/blender/editors/transform/transform_snap.h index 688661bc2cb..b97a9dc882c 100644 --- a/source/blender/editors/transform/transform_snap.h +++ b/source/blender/editors/transform/transform_snap.h @@ -18,8 +18,7 @@ * \ingroup editors */ -#ifndef __TRANSFORM_SNAP_H__ -#define __TRANSFORM_SNAP_H__ +#pragma once #define SNAP_MIN_DISTANCE 30 @@ -88,5 +87,3 @@ eRedrawFlag updateSelectedSnapPoint(TransInfo *t); void removeSnapPoint(TransInfo *t); float transform_snap_distance_len_squared_fn(TransInfo *t, const float p1[3], const float p2[3]); - -#endif /* __TRANSFORM_SNAP_H__ */ diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 6dbf80ed4b9..eb14c5bec28 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -1276,7 +1276,7 @@ static bool test_projected_edge_dist(const struct DistProjectedAABBPrecalc *prec float r_co[3]) { float near_co[3], lambda; - if (!isect_ray_seg_v3(precalc->ray_origin, precalc->ray_direction, va, vb, &lambda)) { + if (!isect_ray_line_v3(precalc->ray_origin, precalc->ray_direction, va, vb, &lambda)) { copy_v3_v3(near_co, va); } else { @@ -1668,11 +1668,11 @@ static short snap_mesh_edge_verts_mixed(SnapObjectContext *sctx, }; float lambda; - if (!isect_ray_seg_v3(neasrest_precalc.ray_origin, - neasrest_precalc.ray_direction, - v_pair[0], - v_pair[1], - &lambda)) { + if (!isect_ray_line_v3(neasrest_precalc.ray_origin, + neasrest_precalc.ray_direction, + v_pair[0], + v_pair[1], + &lambda)) { /* do nothing */ } else { diff --git a/source/blender/editors/undo/undo_intern.h b/source/blender/editors/undo/undo_intern.h index 8184e7bfbdc..660f1a5b57d 100644 --- a/source/blender/editors/undo/undo_intern.h +++ b/source/blender/editors/undo/undo_intern.h @@ -18,8 +18,7 @@ * \ingroup edundo */ -#ifndef __UNDO_INTERN_H__ -#define __UNDO_INTERN_H__ +#pragma once /* internal exports only */ @@ -27,5 +26,3 @@ struct UndoType; /* memfile_undo.c */ void ED_memfile_undosys_type(struct UndoType *ut); - -#endif /* __UNDO_INTERN_H__ */ diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt index f48ea610345..207606c2dcd 100644 --- a/source/blender/editors/util/CMakeLists.txt +++ b/source/blender/editors/util/CMakeLists.txt @@ -63,7 +63,6 @@ set(SRC ../include/ED_keyframes_edit.h ../include/ED_keyframing.h ../include/ED_lattice.h - ../include/ED_logic.h ../include/ED_markers.h ../include/ED_mask.h ../include/ED_mball.h diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index dad0b96c5e2..93762e6500c 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -58,7 +58,6 @@ #include "DEG_depsgraph.h" #include "ED_armature.h" -#include "ED_buttons.h" #include "ED_image.h" #include "ED_mesh.h" #include "ED_node.h" diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h index d5e7dd08fd1..8a452941954 100644 --- a/source/blender/editors/uvedit/uvedit_intern.h +++ b/source/blender/editors/uvedit/uvedit_intern.h @@ -21,8 +21,7 @@ * \ingroup eduv */ -#ifndef __UVEDIT_INTERN_H__ -#define __UVEDIT_INTERN_H__ +#pragma once struct BMFace; struct BMLoop; @@ -34,7 +33,6 @@ struct wmOperatorType; /* geometric utilities */ void uv_poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len); -void uv_poly_center(struct BMFace *f, float r_cent[2], const int cd_loop_uv_offset); /* find nearest */ @@ -88,6 +86,15 @@ bool uv_find_nearest_face_multi(struct Scene *scene, const float co[2], struct UvNearestHit *hit_final); +BMLoop *uv_find_nearest_loop_from_vert(struct Scene *scene, + struct Object *obedit, + struct BMVert *v, + const float co[2]); +BMLoop *uv_find_nearest_loop_from_edge(struct Scene *scene, + struct Object *obedit, + struct BMEdge *e, + const float co[2]); + /* utility tool functions */ void uvedit_live_unwrap_update(struct SpaceImage *sima, @@ -137,5 +144,3 @@ void UV_OT_select_circle(struct wmOperatorType *ot); void UV_OT_select_more(struct wmOperatorType *ot); void UV_OT_select_less(struct wmOperatorType *ot); void UV_OT_select_overlap(struct wmOperatorType *ot); - -#endif /* __UVEDIT_INTERN_H__ */ diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index e2368ae6ba8..deec72d368f 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -227,22 +227,6 @@ void uvedit_live_unwrap_update(SpaceImage *sima, Scene *scene, Object *obedit) /** \name Geometric Utilities * \{ */ -void uv_poly_center(BMFace *f, float r_cent[2], const int cd_loop_uv_offset) -{ - BMLoop *l; - MLoopUV *luv; - BMIter liter; - - zero_v2(r_cent); - - BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { - luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - add_v2_v2(r_cent, luv->uv); - } - - mul_v2_fl(r_cent, 1.0f / (float)f->len); -} - void uv_poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len) { int i; @@ -2108,7 +2092,7 @@ void ED_operatormacros_uvedit(void) ot = WM_operatortype_append_macro("UV_OT_rip_move", "UV Rip Move", - "unstitch UV's and move the result", + "Unstitch UV's and move the result", OPTYPE_UNDO | OPTYPE_REGISTER); WM_operatortype_macro_define(ot, "UV_OT_rip"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index a4ee9a294fe..e83b54ae8bf 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -190,6 +190,9 @@ typedef struct PChart { LinearSolver *context; float *abf_alpha; PVert *pin1, *pin2; + PVert *single_pin; + float single_pin_area; + float single_pin_uv[2]; } lscm; struct PChartPack { float rescale, area; @@ -467,6 +470,17 @@ static void p_chart_uv_bbox(PChart *chart, float minv[2], float maxv[2]) } } +static float p_chart_uv_area(PChart *chart) +{ + float area = 0.0f; + + for (PFace *f = chart->faces; f; f = f->nextlink) { + area += fabsf(p_face_uv_area_signed(f)); + } + + return area; +} + static void p_chart_uv_scale(PChart *chart, float scale) { PVert *v; @@ -3176,7 +3190,7 @@ static void p_chart_lscm_begin(PChart *chart, PBool live, PBool abf) } } - if ((live && (!select || !deselect)) || (npins == 1)) { + if ((live && (!select || !deselect))) { chart->u.lscm.context = NULL; } else { @@ -3185,6 +3199,16 @@ static void p_chart_lscm_begin(PChart *chart, PBool live, PBool abf) p_chart_topological_sanity_check(chart); #endif + if (npins == 1) { + chart->u.lscm.single_pin_area = p_chart_uv_area(chart); + for (v = chart->verts; v; v = v->nextlink) { + if (v->flag & PVERT_PIN) { + chart->u.lscm.single_pin = v; + break; + } + } + } + if (abf) { if (!p_chart_abf_solve(chart)) { param_warning("ABF solving failed: falling back to LSCM.\n"); @@ -3192,12 +3216,12 @@ static void p_chart_lscm_begin(PChart *chart, PBool live, PBool abf) } if (npins <= 1) { - /* not enough pins, lets find some ourself */ + /* No pins, let's find some ourself. */ PEdge *outer; p_chart_boundaries(chart, NULL, &outer); - /* outer can be NULL with non-finite coords. */ + /* Outer can be NULL with non-finite coords. */ if (!(outer && p_chart_symmetry_pins(chart, outer, &pin1, &pin2))) { p_chart_extrema_verts(chart, &pin1, &pin2); } @@ -3235,6 +3259,11 @@ static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart) } } + if (chart->u.lscm.single_pin) { + /* If only one pin, save area and pin for transform later. */ + copy_v2_v2(chart->u.lscm.single_pin_uv, chart->u.lscm.single_pin->uv); + } + if (chart->u.lscm.pin1) { EIG_linear_solver_variable_lock(context, 2 * pin1->u.id); EIG_linear_solver_variable_lock(context, 2 * pin1->u.id + 1); @@ -3358,6 +3387,25 @@ static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart) return P_FALSE; } +static void p_chart_lscm_transform_single_pin(PChart *chart) +{ + PVert *pin = chart->u.lscm.single_pin; + + /* If only one pin, keep UV area the same. */ + const float new_area = p_chart_uv_area(chart); + if (new_area > 0.0f) { + const float scale = chart->u.lscm.single_pin_area / new_area; + if (scale > 0.0f) { + p_chart_uv_scale(chart, sqrtf(scale)); + } + } + + /* Translate to keep the pinned vertex in place. */ + float offset[2]; + sub_v2_v2v2(offset, chart->u.lscm.single_pin_uv, pin->uv); + p_chart_uv_translate(chart, offset); +} + static void p_chart_lscm_end(PChart *chart) { if (chart->u.lscm.context) { @@ -3372,6 +3420,8 @@ static void p_chart_lscm_end(PChart *chart) chart->u.lscm.context = NULL; chart->u.lscm.pin1 = NULL; chart->u.lscm.pin2 = NULL; + chart->u.lscm.single_pin = NULL; + chart->u.lscm.single_pin_area = 0.0f; } /* Stretch */ @@ -3781,6 +3831,23 @@ static void p_chart_rotate_minimum_area(PChart *chart) } } +static void p_chart_rotate_fit_aabb(PChart *chart) +{ + float(*points)[2] = MEM_mallocN(sizeof(*points) * chart->nverts, __func__); + + p_chart_uv_to_array(chart, points); + + float angle = BLI_convexhull_aabb_fit_points_2d(points, chart->nverts); + + MEM_freeN(points); + + if (angle != 0.0f) { + float mat[2][2]; + angle_to_mat2(mat, angle); + p_chart_uv_transform(chart, mat); + } +} + /* Area Smoothing */ /* 2d bsp tree for inverse mapping - that's a bit silly */ @@ -4576,8 +4643,12 @@ void param_lscm_solve(ParamHandle *handle) if (result && !(chart->flag & PCHART_HAS_PINS)) { p_chart_rotate_minimum_area(chart); } + else if (result && chart->u.lscm.single_pin) { + p_chart_rotate_fit_aabb(chart); + p_chart_lscm_transform_single_pin(chart); + } - if (!result || (chart->u.lscm.pin1)) { + if (!result || !(chart->flag & PCHART_HAS_PINS)) { p_chart_lscm_end(chart); } } @@ -4692,28 +4763,13 @@ static void param_pack_rotate(ParamHandle *handle, bool ignore_pinned) PHandle *phandle = (PHandle *)handle; for (i = 0; i < phandle->ncharts; i++) { - float(*points)[2]; - float angle; - chart = phandle->charts[i]; if (ignore_pinned && (chart->flag & PCHART_HAS_PINS)) { continue; } - points = MEM_mallocN(sizeof(*points) * chart->nverts, __func__); - - p_chart_uv_to_array(chart, points); - - angle = BLI_convexhull_aabb_fit_points_2d(points, chart->nverts); - - MEM_freeN(points); - - if (angle != 0.0f) { - float mat[2][2]; - angle_to_mat2(mat, angle); - p_chart_uv_transform(chart, mat); - } + p_chart_rotate_fit_aabb(chart); } } diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h b/source/blender/editors/uvedit/uvedit_parametrizer.h index 53188ea42bb..ee1eb4f63bf 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.h +++ b/source/blender/editors/uvedit/uvedit_parametrizer.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __UVEDIT_PARAMETRIZER_H__ -#define __UVEDIT_PARAMETRIZER_H__ +#pragma once /** \file * \ingroup eduv @@ -109,5 +108,3 @@ void param_flush_restore(ParamHandle *handle); #ifdef __cplusplus } #endif - -#endif /*__UVEDIT_PARAMETRIZER_H__*/ diff --git a/source/blender/editors/uvedit/uvedit_path.c b/source/blender/editors/uvedit/uvedit_path.c index f72ddcdedd3..546aad078aa 100644 --- a/source/blender/editors/uvedit/uvedit_path.c +++ b/source/blender/editors/uvedit/uvedit_path.c @@ -69,9 +69,6 @@ #include "bmesh_tools.h" -/* TODO(campbell): region filling, matching mesh selection. */ -#define USE_FILL - /* -------------------------------------------------------------------- */ /** \name Local Utilities * \{ */ @@ -84,8 +81,12 @@ * * While the code below is a bit awkward, it's significantly less overhead than * adding full edge selection which is nearly the same as vertex path in the case of UV's. + * + * \param use_nearest: When false use the post distant pair of loops, + * use when filling a region as we want both verts from each edge to be included in the region. */ -static void bm_loop_calc_vert_pair_from_edge_pair(const int cd_loop_uv_offset, +static void bm_loop_calc_vert_pair_from_edge_pair(const bool use_nearest, + const int cd_loop_uv_offset, const float aspect_y, BMElem **ele_src_p, BMElem **ele_dst_p, @@ -116,8 +117,15 @@ static void bm_loop_calc_vert_pair_from_edge_pair(const int cd_loop_uv_offset, }; int i_best = 0; for (int i = 1; i < ARRAY_SIZE(tests); i++) { - if (tests[i].len_sq < tests[i_best].len_sq) { - i_best = i; + if (use_nearest) { + if (tests[i].len_sq < tests[i_best].len_sq) { + i_best = i; + } + } + else { + if (tests[i].len_sq > tests[i_best].len_sq) { + i_best = i; + } } } @@ -139,14 +147,13 @@ struct PathSelectParams { bool track_active; bool use_topology_distance; bool use_face_step; -#ifdef USE_FILL bool use_fill; -#endif struct CheckerIntervalParams interval_params; }; struct UserData_UV { Scene *scene; + BMEditMesh *em; uint cd_loop_uv_offset; }; @@ -162,13 +169,11 @@ static void path_select_properties(wmOperatorType *ot) false, "Topology Distance", "Find the minimum number of steps, ignoring spatial distance"); -#ifdef USE_FILL RNA_def_boolean(ot->srna, "use_fill", false, "Fill Region", "Select all paths between the source/destination elements"); -#endif WM_operator_properties_checker_interval(ot, true); } @@ -177,9 +182,7 @@ static void path_select_params_from_op(wmOperator *op, struct PathSelectParams * { op_params->track_active = false; op_params->use_face_step = RNA_boolean_get(op->ptr, "use_face_step"); -#ifdef USE_FILL op_params->use_fill = RNA_boolean_get(op->ptr, "use_fill"); -#endif op_params->use_topology_distance = RNA_boolean_get(op->ptr, "use_topology_distance"); WM_operator_properties_checker_interval_from_op(op, &op_params->interval_params); } @@ -200,6 +203,7 @@ static bool looptag_test_cb(BMLoop *l, void *user_data_v) { /* All connected loops are selected or we return false. */ struct UserData_UV *user_data = user_data_v; + const Scene *scene = user_data->scene; const uint cd_loop_uv_offset = user_data->cd_loop_uv_offset; const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); BMIter iter; @@ -208,7 +212,7 @@ static bool looptag_test_cb(BMLoop *l, void *user_data_v) if (looptag_filter_cb(l_iter, user_data)) { const MLoopUV *luv_iter = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset); if (equals_v2v2(luv->uv, luv_iter->uv)) { - if ((luv_iter->flag & MLOOPUV_VERTSEL) == 0) { + if (!uvedit_uv_select_test(scene, l_iter, cd_loop_uv_offset)) { return false; } } @@ -219,6 +223,8 @@ static bool looptag_test_cb(BMLoop *l, void *user_data_v) static void looptag_set_cb(BMLoop *l, bool val, void *user_data_v) { struct UserData_UV *user_data = user_data_v; + const Scene *scene = user_data->scene; + BMEditMesh *em = user_data->em; const uint cd_loop_uv_offset = user_data->cd_loop_uv_offset; const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); BMIter iter; @@ -227,28 +233,56 @@ static void looptag_set_cb(BMLoop *l, bool val, void *user_data_v) if (looptag_filter_cb(l_iter, user_data)) { MLoopUV *luv_iter = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset); if (equals_v2v2(luv->uv, luv_iter->uv)) { - SET_FLAG_FROM_TEST(luv_iter->flag, val, MLOOPUV_VERTSEL); + uvedit_uv_select_set(scene, em, l_iter, val, false, cd_loop_uv_offset); } } } } -static void mouse_mesh_uv_shortest_path_vert(Scene *scene, - Object *obedit, - const struct PathSelectParams *op_params, - BMLoop *l_src, - BMLoop *l_dst, - BMLoop *l_dst_add_to_path, - const float aspect_y, - const int cd_loop_uv_offset) +static int mouse_mesh_uv_shortest_path_vert(Scene *scene, + Object *obedit, + const struct PathSelectParams *op_params, + BMLoop *l_src, + BMLoop *l_dst, + const float aspect_y, + const int cd_loop_uv_offset) { - const ToolSettings *ts = scene->toolsettings; - const bool use_fake_edge_select = (ts->uv_selectmode & UV_SELECT_EDGE); + const char uv_selectmode = ED_uvedit_select_mode_get(scene); + const bool use_fake_edge_select = (uv_selectmode & UV_SELECT_EDGE); BMEditMesh *em = BKE_editmesh_from_object(obedit); BMesh *bm = em->bm; + int flush = 0; + + /* Variables to use when `use_fake_edge_select` is set. */ + struct { + BMLoop *l_dst_activate; + BMLoop *l_dst_add_to_path; + } fake_edge_select = {NULL}; + + if (use_fake_edge_select) { + fake_edge_select.l_dst_activate = l_dst; + + /* Use most distant when doing region selection. + * without this we get dangling edges outside the region. */ + bool use_neaerst = (op_params->use_fill == false); + BMElem *ele_src = (BMElem *)l_src; + BMElem *ele_dst = (BMElem *)l_dst; + BMElem *ele_dst_final = NULL; + bm_loop_calc_vert_pair_from_edge_pair( + use_neaerst, cd_loop_uv_offset, aspect_y, &ele_src, &ele_dst, &ele_dst_final); + + if (op_params->use_fill == false) { + /* Always activate the item under the cursor. */ + fake_edge_select.l_dst_add_to_path = (BMLoop *)ele_dst_final; + } + + l_src = (BMLoop *)ele_src; + l_dst = (BMLoop *)ele_dst; + } struct UserData_UV user_data = { .scene = scene, + .em = em, .cd_loop_uv_offset = cd_loop_uv_offset, }; @@ -280,11 +314,14 @@ static void mouse_mesh_uv_shortest_path_vert(Scene *scene, BMLoop *l_dst_last = l_dst; if (path) { - if ((l_dst_add_to_path != NULL) && (BLI_linklist_index(path, l_dst_add_to_path) == -1)) { - /* Append, this isn't optimal compared to #BLI_linklist_append, it's a one-off lookup. */ - LinkNode *path_last = BLI_linklist_find_last(path); - BLI_linklist_insert_after(&path_last, l_dst_add_to_path); - BLI_assert(BLI_linklist_find_last(path)->link == l_dst_add_to_path); + if (use_fake_edge_select) { + if ((fake_edge_select.l_dst_add_to_path != NULL) && + (BLI_linklist_index(path, fake_edge_select.l_dst_add_to_path) == -1)) { + /* Append, this isn't optimal compared to #BLI_linklist_append, it's a one-off lookup. */ + LinkNode *path_last = BLI_linklist_find_last(path); + BLI_linklist_insert_after(&path_last, fake_edge_select.l_dst_add_to_path); + BLI_assert(BLI_linklist_find_last(path)->link == fake_edge_select.l_dst_add_to_path); + } } /* toggle the flag */ @@ -310,6 +347,7 @@ static void mouse_mesh_uv_shortest_path_vert(Scene *scene, } while ((void)depth++, (node = node->next)); BLI_linklist_free(path, NULL); + flush = all_set ? -1 : 1; } else { const bool is_act = !looptag_test_cb(l_dst, &user_data); @@ -319,12 +357,17 @@ static void mouse_mesh_uv_shortest_path_vert(Scene *scene, if (op_params->track_active) { /* Fake edge selection. */ if (use_fake_edge_select) { - ED_uvedit_active_edge_loop_set(bm, l_dst_last); + BMLoop *l_dst_activate = fake_edge_select.l_dst_activate; + /* TODO(campbell): Search for an active loop attached to 'l_dst'. + * when `BLI_linklist_index(path, l_dst_activate) == -1` + * In practice this rarely happens though. */ + ED_uvedit_active_edge_loop_set(bm, l_dst_activate); } else { ED_uvedit_active_vert_loop_set(bm, l_dst_last); } } + return flush; } /** \} */ @@ -343,12 +386,12 @@ static bool facetag_test_cb(BMFace *f, void *user_data_v) { /* All connected loops are selected or we return false. */ struct UserData_UV *user_data = user_data_v; + const Scene *scene = user_data->scene; const uint cd_loop_uv_offset = user_data->cd_loop_uv_offset; BMIter iter; BMLoop *l_iter; BM_ITER_ELEM (l_iter, &iter, f, BM_LOOPS_OF_FACE) { - const MLoopUV *luv_iter = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset); - if ((luv_iter->flag & MLOOPUV_VERTSEL) == 0) { + if (!uvedit_uv_select_test(scene, l_iter, cd_loop_uv_offset)) { return false; } } @@ -357,28 +400,27 @@ static bool facetag_test_cb(BMFace *f, void *user_data_v) static void facetag_set_cb(BMFace *f, bool val, void *user_data_v) { struct UserData_UV *user_data = user_data_v; + const Scene *scene = user_data->scene; + BMEditMesh *em = user_data->em; const uint cd_loop_uv_offset = user_data->cd_loop_uv_offset; - BMIter iter; - BMLoop *l_iter; - BM_ITER_ELEM (l_iter, &iter, f, BM_LOOPS_OF_FACE) { - MLoopUV *luv_iter = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset); - SET_FLAG_FROM_TEST(luv_iter->flag, val, MLOOPUV_VERTSEL); - } + uvedit_face_select_set(scene, em, f, val, false, cd_loop_uv_offset); } -static void mouse_mesh_uv_shortest_path_face(Scene *scene, - Object *obedit, - const struct PathSelectParams *op_params, - BMFace *f_src, - BMFace *f_dst, - const float aspect_y, - const int cd_loop_uv_offset) +static int mouse_mesh_uv_shortest_path_face(Scene *scene, + Object *obedit, + const struct PathSelectParams *op_params, + BMFace *f_src, + BMFace *f_dst, + const float aspect_y, + const int cd_loop_uv_offset) { BMEditMesh *em = BKE_editmesh_from_object(obedit); BMesh *bm = em->bm; + int flush = 0; struct UserData_UV user_data = { .scene = scene, + .em = em, .cd_loop_uv_offset = cd_loop_uv_offset, }; @@ -433,6 +475,7 @@ static void mouse_mesh_uv_shortest_path_face(Scene *scene, } while ((void)depth++, (node = node->next)); BLI_linklist_free(path, NULL); + flush = all_set ? -1 : 1; } else { const bool is_act = !facetag_test_cb(f_dst, &user_data); @@ -443,6 +486,7 @@ static void mouse_mesh_uv_shortest_path_face(Scene *scene, /* Unlike other types, we can track active without it being selected. */ BM_mesh_active_face_set(bm, f_dst_last); } + return flush; } /** \} */ @@ -462,44 +506,56 @@ static bool uv_shortest_path_pick_ex(Scene *scene, const float aspect_y, const int cd_loop_uv_offset) { + const ToolSettings *ts = scene->toolsettings; + const char uv_selectmode = ED_uvedit_select_mode_get(scene); bool ok = false; + int flush = 0; if (ELEM(NULL, ele_src, ele_dst) || (ele_src->head.htype != ele_dst->head.htype)) { /* pass */ } else if (ele_src->head.htype == BM_FACE) { - mouse_mesh_uv_shortest_path_face(scene, - obedit, - op_params, - (BMFace *)ele_src, - (BMFace *)ele_dst, - aspect_y, - cd_loop_uv_offset); + flush = mouse_mesh_uv_shortest_path_face(scene, + obedit, + op_params, + (BMFace *)ele_src, + (BMFace *)ele_dst, + aspect_y, + cd_loop_uv_offset); ok = true; } else if (ele_src->head.htype == BM_LOOP) { - const ToolSettings *ts = scene->toolsettings; - BMElem *ele_dst_final = NULL; - if (ts->uv_selectmode & UV_SELECT_EDGE) { - if (op_params->use_fill == false) { - bm_loop_calc_vert_pair_from_edge_pair( - cd_loop_uv_offset, aspect_y, &ele_src, &ele_dst, &ele_dst_final); - } - } - mouse_mesh_uv_shortest_path_vert(scene, - obedit, - op_params, - (BMLoop *)ele_src, - (BMLoop *)ele_dst, - (BMLoop *)ele_dst_final, - aspect_y, - cd_loop_uv_offset); + flush = mouse_mesh_uv_shortest_path_vert(scene, + obedit, + op_params, + (BMLoop *)ele_src, + (BMLoop *)ele_dst, + aspect_y, + cd_loop_uv_offset); ok = true; } if (ok) { - Object *obedit_eval = DEG_get_evaluated_object(depsgraph, obedit); - BKE_mesh_batch_cache_dirty_tag(obedit_eval->data, BKE_MESH_BATCH_DIRTY_UVEDIT_SELECT); + if (flush != 0) { + const bool select = (flush == 1); + BMEditMesh *em = BKE_editmesh_from_object(obedit); + if (ts->uv_flag & UV_SYNC_SELECTION) { + if (uv_selectmode & UV_SELECT_EDGE) { + /* Special case as we don't use true edge selection, + * flush the selection from the vertices. */ + BM_mesh_select_mode_flush_ex(em->bm, SCE_SELECT_VERTEX); + } + } + ED_uvedit_select_sync_flush(scene->toolsettings, em, select); + } + + if (ts->uv_flag & UV_SYNC_SELECTION) { + DEG_id_tag_update(obedit->data, ID_RECALC_SELECT); + } + else { + Object *obedit_eval = DEG_get_evaluated_object(depsgraph, obedit); + BKE_mesh_batch_cache_dirty_tag(obedit_eval->data, BKE_MESH_BATCH_DIRTY_UVEDIT_SELECT); + } /* Only for region redraw. */ WM_main_add_notifier(NC_GEOM | ND_SELECT, obedit->data); } @@ -511,13 +567,9 @@ static int uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEve { Scene *scene = CTX_data_scene(C); const ToolSettings *ts = scene->toolsettings; + const char uv_selectmode = ED_uvedit_select_mode_get(scene); /* We could support this, it needs further testing. */ - if (ts->uv_flag & UV_SYNC_SELECTION) { - BKE_report(op->reports, RPT_ERROR, "Sync selection doesn't support path select"); - return OPERATOR_CANCELLED; - } - if (RNA_struct_property_is_set(op->ptr, "index")) { return uv_shortest_path_pick_exec(C, op); } @@ -550,7 +602,7 @@ static int uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEve BMElem *ele_src = NULL, *ele_dst = NULL; - if (ts->uv_selectmode & UV_SELECT_FACE) { + if (uv_selectmode == UV_SELECT_FACE) { UvNearestHit hit = UV_NEAREST_HIT_INIT; if (!uv_find_nearest_face(scene, obedit, co, &hit)) { return OPERATOR_CANCELLED; @@ -562,19 +614,30 @@ static int uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEve ele_src = (BMElem *)f_src; ele_dst = (BMElem *)hit.efa; } - else if (ts->uv_selectmode & UV_SELECT_EDGE) { + + else if (uv_selectmode & UV_SELECT_EDGE) { UvNearestHit hit = UV_NEAREST_HIT_INIT; if (!uv_find_nearest_edge(scene, obedit, co, &hit)) { return OPERATOR_CANCELLED; } - BMLoop *l_src = ED_uvedit_active_edge_loop_get(bm); - const MLoopUV *luv_src_v1 = BM_ELEM_CD_GET_VOID_P(l_src, cd_loop_uv_offset); - const MLoopUV *luv_src_v2 = BM_ELEM_CD_GET_VOID_P(l_src->next, cd_loop_uv_offset); - if ((luv_src_v1->flag & MLOOPUV_VERTSEL) == 0 && (luv_src_v2->flag & MLOOPUV_VERTSEL) == 0) { - l_src = NULL; + BMLoop *l_src = NULL; + if (ts->uv_flag & UV_SYNC_SELECTION) { + BMEdge *e_src = BM_mesh_active_edge_get(bm); + if (e_src != NULL) { + l_src = uv_find_nearest_loop_from_edge(scene, obedit, e_src, co); + } + } + else { + l_src = ED_uvedit_active_edge_loop_get(bm); + if (l_src != NULL) { + if ((!uvedit_uv_select_test(scene, l_src, cd_loop_uv_offset)) && + (!uvedit_uv_select_test(scene, l_src->next, cd_loop_uv_offset))) { + l_src = NULL; + } + ele_src = (BMElem *)l_src; + } } - ele_src = (BMElem *)l_src; ele_dst = (BMElem *)hit.l; } @@ -584,12 +647,21 @@ static int uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEve return OPERATOR_CANCELLED; } - BMLoop *l_src = ED_uvedit_active_vert_loop_get(bm); - const MLoopUV *luv_src = BM_ELEM_CD_GET_VOID_P(l_src, cd_loop_uv_offset); - if ((luv_src->flag & MLOOPUV_VERTSEL) == 0) { - l_src = NULL; + BMLoop *l_src = NULL; + if (ts->uv_flag & UV_SYNC_SELECTION) { + BMVert *v_src = BM_mesh_active_vert_get(bm); + if (v_src != NULL) { + l_src = uv_find_nearest_loop_from_vert(scene, obedit, v_src, co); + } + } + else { + l_src = ED_uvedit_active_vert_loop_get(bm); + if (l_src != NULL) { + if (!uvedit_uv_select_test(scene, l_src, cd_loop_uv_offset)) { + l_src = NULL; + } + } } - ele_src = (BMElem *)l_src; ele_dst = (BMElem *)hit.l; } @@ -603,11 +675,11 @@ static int uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEve /* To support redo. */ int index; - if (ts->uv_selectmode & UV_SELECT_FACE) { + if (uv_selectmode & UV_SELECT_FACE) { BM_mesh_elem_index_ensure(bm, BM_FACE); index = BM_elem_index_get(ele_dst); } - else if (ts->uv_selectmode & UV_SELECT_EDGE) { + else if (uv_selectmode & UV_SELECT_EDGE) { BM_mesh_elem_index_ensure(bm, BM_LOOP); index = BM_elem_index_get(ele_dst); } @@ -624,7 +696,7 @@ static int uv_shortest_path_pick_exec(bContext *C, wmOperator *op) { Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Scene *scene = CTX_data_scene(C); - const ToolSettings *ts = scene->toolsettings; + const char uv_selectmode = ED_uvedit_select_mode_get(scene); Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); BMesh *bm = em->bm; @@ -641,7 +713,7 @@ static int uv_shortest_path_pick_exec(bContext *C, wmOperator *op) BMElem *ele_src, *ele_dst; - if (ts->uv_selectmode & UV_SELECT_FACE) { + if (uv_selectmode & UV_SELECT_FACE) { if (index < 0 || index >= bm->totface) { return OPERATOR_CANCELLED; } @@ -650,7 +722,7 @@ static int uv_shortest_path_pick_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } } - else if (ts->uv_selectmode & UV_SELECT_EDGE) { + else if (uv_selectmode & UV_SELECT_EDGE) { if (index < 0 || index >= bm->totloop) { return OPERATOR_CANCELLED; } @@ -716,7 +788,7 @@ static int uv_shortest_path_select_exec(bContext *C, wmOperator *op) { Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Scene *scene = CTX_data_scene(C); - const ToolSettings *ts = scene->toolsettings; + const char uv_selectmode = ED_uvedit_select_mode_get(scene); bool found_valid_elements = false; float aspect_y; @@ -742,10 +814,10 @@ static int uv_shortest_path_select_exec(bContext *C, wmOperator *op) { BMElem **ele_array = NULL; int ele_array_len = 0; - if (ts->uv_selectmode & UV_SELECT_FACE) { + if (uv_selectmode & UV_SELECT_FACE) { ele_array = (BMElem **)ED_uvedit_selected_faces(scene, bm, 3, &ele_array_len); } - else if (ts->uv_selectmode & UV_SELECT_EDGE) { + else if (uv_selectmode & UV_SELECT_EDGE) { ele_array = (BMElem **)ED_uvedit_selected_edges(scene, bm, 3, &ele_array_len); } else { diff --git a/source/blender/editors/uvedit/uvedit_select.c b/source/blender/editors/uvedit/uvedit_select.c index ece0158bc9b..149c5cf1f96 100644 --- a/source/blender/editors/uvedit/uvedit_select.c +++ b/source/blender/editors/uvedit/uvedit_select.c @@ -145,6 +145,59 @@ BMLoop *ED_uvedit_active_edge_loop_get(BMesh *bm) * \{ */ /** + * Intentionally don't return #UV_SELECT_ISLAND as it's not an element type. + * In this case return #UV_SELECT_VERTEX as a fallback. + */ +char ED_uvedit_select_mode_get(const Scene *scene) +{ + const ToolSettings *ts = scene->toolsettings; + char uv_selectmode = UV_SELECT_VERTEX; + + if (ts->uv_flag & UV_SYNC_SELECTION) { + if (ts->selectmode & SCE_SELECT_VERTEX) { + uv_selectmode = UV_SELECT_VERTEX; + } + else if (ts->selectmode & SCE_SELECT_EDGE) { + uv_selectmode = UV_SELECT_EDGE; + } + else if (ts->selectmode & SCE_SELECT_FACE) { + uv_selectmode = UV_SELECT_FACE; + } + } + else { + if (ts->uv_selectmode & UV_SELECT_VERTEX) { + uv_selectmode = UV_SELECT_VERTEX; + } + else if (ts->uv_selectmode & UV_SELECT_EDGE) { + uv_selectmode = UV_SELECT_EDGE; + } + else if (ts->uv_selectmode & UV_SELECT_FACE) { + uv_selectmode = UV_SELECT_FACE; + } + } + return uv_selectmode; +} + +void ED_uvedit_select_sync_flush(const ToolSettings *ts, BMEditMesh *em, const bool select) +{ + /* bmesh API handles flushing but not on de-select */ + if (ts->uv_flag & UV_SYNC_SELECTION) { + if (ts->selectmode != SCE_SELECT_FACE) { + if (select == false) { + EDBM_deselect_flush(em); + } + else { + EDBM_select_flush(em); + } + } + + if (select == false) { + BM_select_history_validate(em->bm); + } + } +} + +/** * Apply a penalty to elements that are already selected * so elements that aren't already selected are prioritized. * @@ -529,7 +582,7 @@ void uvedit_uv_select_enable(const Scene *scene, } if (do_history) { - BM_select_history_remove(em->bm, (BMElem *)l->v); + BM_select_history_store(em->bm, (BMElem *)l->v); } } else { @@ -671,7 +724,7 @@ bool uv_find_nearest_face(Scene *scene, Object *obedit, const float co[2], UvNea } float cent[2]; - uv_poly_center(efa, cent, cd_loop_uv_offset); + BM_face_uv_calc_center_median(efa, cd_loop_uv_offset, cent); const float dist_test_sq = len_squared_v2v2(co, cent); @@ -857,6 +910,72 @@ bool ED_uvedit_nearest_uv_multi(const Scene *scene, /** \} */ /* -------------------------------------------------------------------- */ +/** \name Find Nearest to Element + * + * These functions are quite specialized, useful when sync select is enabled + * and we want to pick an active UV vertex/edge from the active element which may + * have multiple UV's split out. + * \{ */ + +BMLoop *uv_find_nearest_loop_from_vert(struct Scene *scene, + struct Object *obedit, + struct BMVert *v, + const float co[2]) +{ + BMEditMesh *em = BKE_editmesh_from_object(obedit); + const uint cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); + + BMIter liter; + BMLoop *l; + BMLoop *l_found = NULL; + float dist_best_sq = FLT_MAX; + + BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) { + if (!uvedit_face_visible_test(scene, l->f)) { + continue; + } + + const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); + const float dist_test_sq = len_squared_v2v2(co, luv->uv); + if (dist_test_sq < dist_best_sq) { + dist_best_sq = dist_test_sq; + l_found = l; + } + } + return l_found; +} + +BMLoop *uv_find_nearest_loop_from_edge(struct Scene *scene, + struct Object *obedit, + struct BMEdge *e, + const float co[2]) +{ + BMEditMesh *em = BKE_editmesh_from_object(obedit); + const uint cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); + + BMIter eiter; + BMLoop *l; + BMLoop *l_found = NULL; + float dist_best_sq = FLT_MAX; + + BM_ITER_ELEM (l, &eiter, e, BM_LOOPS_OF_EDGE) { + if (!uvedit_face_visible_test(scene, l->f)) { + continue; + } + const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); + const MLoopUV *luv_next = BM_ELEM_CD_GET_VOID_P(l->next, cd_loop_uv_offset); + const float dist_test_sq = dist_squared_to_line_segment_v2(co, luv->uv, luv_next->uv); + if (dist_test_sq < dist_best_sq) { + dist_best_sq = dist_test_sq; + l_found = l; + } + } + return l_found; +} + +/** \} */ + +/* -------------------------------------------------------------------- */ /** \name Edge Loop Select * \{ */ @@ -1144,11 +1263,13 @@ static void uv_select_linked_multi(Scene *scene, Object **objects, const uint objects_len, UvNearestHit *hit_final, - bool extend, + const bool extend, bool deselect, - bool toggle, - bool select_faces) + const bool toggle, + const bool select_faces) { + const bool uv_sync_select = (scene->toolsettings->uv_flag & UV_SYNC_SELECTION); + /* loop over objects, or just use hit_final->ob */ for (uint ob_index = 0; ob_index < objects_len; ob_index++) { if (hit_final && ob_index != 0) { @@ -1159,7 +1280,6 @@ static void uv_select_linked_multi(Scene *scene, BMFace *efa; BMLoop *l; BMIter iter, liter; - MLoopUV *luv; UvVertMap *vmap; UvMapVert *vlist, *iterv, *startv; int i, stacksize = 0, *stack; @@ -1177,7 +1297,7 @@ static void uv_select_linked_multi(Scene *scene, * * Better solve this by having a delimit option for select-linked operator, * keeping island-select working as is. */ - vmap = BM_uv_vert_map_create(em->bm, !select_faces, false); + vmap = BM_uv_vert_map_create(em->bm, !uv_sync_select, false); if (vmap == NULL) { continue; @@ -1199,14 +1319,42 @@ static void uv_select_linked_multi(Scene *scene, } else { BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { - luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - - if (luv->flag & MLOOPUV_VERTSEL) { - stack[stacksize] = a; - stacksize++; - flag[a] = 1; + if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) { + bool add_to_stack = true; + if (uv_sync_select && !select_faces) { + /* Special case, vertex/edge & sync select being enabled. + * + * Without this, a second linked select will 'grow' each time as each new + * selection reaches the boundaries of islands that share vertices but not UV's. + * + * Rules applied here: + * - This loops face isn't selected. + * - The only other fully selected face is connected or, + * - There are no connected fully selected faces UV-connected to this loop. + */ + if (uvedit_face_select_test(scene, l->f, cd_loop_uv_offset)) { + /* pass */ + } + else { + BMIter liter_other; + BMLoop *l_other; + BM_ITER_ELEM (l_other, &liter_other, l->v, BM_LOOPS_OF_VERT) { + if ((l != l_other) && + !BM_loop_uv_share_vert_check(l, l_other, cd_loop_uv_offset) && + uvedit_face_select_test(scene, l_other->f, cd_loop_uv_offset)) { + add_to_stack = false; + break; + } + } + } + } - break; + if (add_to_stack) { + stack[stacksize] = a; + stacksize++; + flag[a] = 1; + break; + } } } } @@ -1275,10 +1423,9 @@ static void uv_select_linked_multi(Scene *scene, } else { BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { - luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - - if (luv->flag & MLOOPUV_VERTSEL) { + if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) { found_selected = true; + break; } } @@ -1295,10 +1442,7 @@ static void uv_select_linked_multi(Scene *scene, BM_face_select_set(em->bm, efa, value); \ } \ else { \ - BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { \ - luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); \ - luv->flag = (value) ? (luv->flag | MLOOPUV_VERTSEL) : (luv->flag & ~MLOOPUV_VERTSEL); \ - } \ + uvedit_face_select_set(scene, em, efa, value, false, cd_loop_uv_offset); \ } \ (void)0 @@ -1323,6 +1467,17 @@ static void uv_select_linked_multi(Scene *scene, MEM_freeN(stack); MEM_freeN(flag); BM_uv_vert_map_free(vmap); + + if (uv_sync_select) { + if (deselect) { + EDBM_deselect_flush(em); + } + else { + if (!select_faces) { + EDBM_selectmode_flush(em); + } + } + } } } @@ -2144,13 +2299,6 @@ static int uv_select_linked_internal(bContext *C, wmOperator *op, const wmEvent UvNearestHit hit = UV_NEAREST_HIT_INIT; - if ((ts->uv_flag & UV_SYNC_SELECTION) && !(ts->selectmode & SCE_SELECT_FACE)) { - BKE_report(op->reports, - RPT_ERROR, - "Select linked only works in face select mode when sync selection is enabled"); - return OPERATOR_CANCELLED; - } - if (pick) { extend = RNA_boolean_get(op->ptr, "extend"); deselect = RNA_boolean_get(op->ptr, "deselect"); @@ -2181,7 +2329,7 @@ static int uv_select_linked_internal(bContext *C, wmOperator *op, const wmEvent } } - if (!extend) { + if (!extend && !deselect) { uv_select_all_perform_multi(scene, objects, objects_len, SEL_DESELECT); } @@ -2383,25 +2531,6 @@ void UV_OT_select_split(wmOperatorType *ot) ot->poll = ED_operator_uvedit; /* requires space image */ } -static void uv_select_sync_flush(const ToolSettings *ts, BMEditMesh *em, const short select) -{ - /* bmesh API handles flushing but not on de-select */ - if (ts->uv_flag & UV_SYNC_SELECTION) { - if (ts->selectmode != SCE_SELECT_FACE) { - if (select == false) { - EDBM_deselect_flush(em); - } - else { - EDBM_select_flush(em); - } - } - - if (select == false) { - BM_select_history_validate(em->bm); - } - } -} - static void uv_select_tag_update_for_object(Depsgraph *depsgraph, const ToolSettings *ts, Object *obedit) @@ -2712,7 +2841,7 @@ static int uv_box_select_exec(bContext *C, wmOperator *op) BM_elem_flag_disable(efa, BM_ELEM_TAG); if (uvedit_face_visible_test(scene, efa)) { - uv_poly_center(efa, cent, cd_loop_uv_offset); + BM_face_uv_calc_center_median(efa, cd_loop_uv_offset, cent); if (BLI_rctf_isect_pt_v(&rectf, cent)) { BM_elem_flag_enable(efa, BM_ELEM_TAG); changed = true; @@ -2806,7 +2935,7 @@ static int uv_box_select_exec(bContext *C, wmOperator *op) if (changed || use_pre_deselect) { changed_multi = true; - uv_select_sync_flush(ts, em, select); + ED_uvedit_select_sync_flush(ts, em, select); uv_select_tag_update_for_object(depsgraph, ts, obedit); } } @@ -2943,7 +3072,7 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op) /* assume not touched */ if (select != uvedit_face_select_test(scene, efa, cd_loop_uv_offset)) { float cent[2]; - uv_poly_center(efa, cent, cd_loop_uv_offset); + BM_face_uv_calc_center_median(efa, cd_loop_uv_offset, cent); if (uv_circle_select_is_point_inside(cent, offset, ellipse)) { BM_elem_flag_enable(efa, BM_ELEM_TAG); changed = true; @@ -3026,7 +3155,7 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op) if (changed || use_pre_deselect) { changed_multi = true; - uv_select_sync_flush(ts, em, select); + ED_uvedit_select_sync_flush(ts, em, select); uv_select_tag_update_for_object(depsgraph, ts, obedit); } } @@ -3134,7 +3263,7 @@ static bool do_lasso_select_mesh_uv(bContext *C, /* assume not touched */ if (select != uvedit_face_select_test(scene, efa, cd_loop_uv_offset)) { float cent[2]; - uv_poly_center(efa, cent, cd_loop_uv_offset); + BM_face_uv_calc_center_median(efa, cd_loop_uv_offset, cent); if (do_lasso_select_mesh_uv_is_point_inside(region, &rect, mcoords, mcoords_len, cent)) { BM_elem_flag_enable(efa, BM_ELEM_TAG); changed = true; @@ -3221,7 +3350,7 @@ static bool do_lasso_select_mesh_uv(bContext *C, if (changed || use_pre_deselect) { changed_multi = true; - uv_select_sync_flush(ts, em, select); + ED_uvedit_select_sync_flush(ts, em, select); uv_select_tag_update_for_object(depsgraph, ts, obedit); } } diff --git a/source/blender/freestyle/FRS_freestyle.h b/source/blender/freestyle/FRS_freestyle.h index 876f40b211f..57b6dc815a3 100644 --- a/source/blender/freestyle/FRS_freestyle.h +++ b/source/blender/freestyle/FRS_freestyle.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FRS_FREESTYLE_H__ -#define __FRS_FREESTYLE_H__ +#pragma once /** \file * \ingroup freestyle @@ -69,5 +68,3 @@ struct Material *FRS_create_stroke_material(struct Main *bmain, #ifdef __cplusplus } #endif - -#endif // __FRS_FREESTYLE_H__ diff --git a/source/blender/freestyle/intern/application/AppCanvas.h b/source/blender/freestyle/intern/application/AppCanvas.h index 9d1e2458564..1ff7e781ce6 100644 --- a/source/blender/freestyle/intern/application/AppCanvas.h +++ b/source/blender/freestyle/intern/application/AppCanvas.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __APPCANVAS_H__ -#define __APPCANVAS_H__ +#pragma once /** \file * \ingroup freestyle @@ -93,5 +92,3 @@ class AppCanvas : public Canvas { }; } /* namespace Freestyle */ - -#endif // __APPCANVAS_H__ diff --git a/source/blender/freestyle/intern/application/AppConfig.cpp b/source/blender/freestyle/intern/application/AppConfig.cpp index b26c9a58f70..3aae4254b4b 100644 --- a/source/blender/freestyle/intern/application/AppConfig.cpp +++ b/source/blender/freestyle/intern/application/AppConfig.cpp @@ -26,9 +26,7 @@ using namespace std; -extern "C" { #include "BKE_appdir.h" -} namespace Freestyle { diff --git a/source/blender/freestyle/intern/application/AppConfig.h b/source/blender/freestyle/intern/application/AppConfig.h index 34f5d220cfe..61beff33876 100644 --- a/source/blender/freestyle/intern/application/AppConfig.h +++ b/source/blender/freestyle/intern/application/AppConfig.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __APP_CONFIG_H__ -#define __APP_CONFIG_H__ +#pragma once /** \file * \ingroup freestyle @@ -123,5 +122,3 @@ static const real DEFAULT_DKR_EPSILON = 0.0; } // namespace Config } /* namespace Freestyle */ - -#endif // __APP_CONFIG_H__ diff --git a/source/blender/freestyle/intern/application/AppView.cpp b/source/blender/freestyle/intern/application/AppView.cpp index 0956d33a20e..5cd30a61712 100644 --- a/source/blender/freestyle/intern/application/AppView.cpp +++ b/source/blender/freestyle/intern/application/AppView.cpp @@ -33,7 +33,6 @@ #include "../view_map/Silhouette.h" #include "../view_map/ViewMap.h" -extern "C" { #include "BLI_blenlib.h" #include "IMB_imbuf.h" @@ -45,7 +44,6 @@ extern "C" { #endif #include "FRS_freestyle.h" -} namespace Freestyle { diff --git a/source/blender/freestyle/intern/application/AppView.h b/source/blender/freestyle/intern/application/AppView.h index 6009f2b0e50..3f07d2794c4 100644 --- a/source/blender/freestyle/intern/application/AppView.h +++ b/source/blender/freestyle/intern/application/AppView.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __APPVIEW_H__ -#define __APPVIEW_H__ +#pragma once /** \file * \ingroup freestyle @@ -272,5 +271,3 @@ class AppView { }; } /* namespace Freestyle */ - -#endif // __APPVIEW_H__ diff --git a/source/blender/freestyle/intern/application/Controller.h b/source/blender/freestyle/intern/application/Controller.h index 613ea2cb45c..6c41733db36 100644 --- a/source/blender/freestyle/intern/application/Controller.h +++ b/source/blender/freestyle/intern/application/Controller.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __CONTROLLER_H__ -#define __CONTROLLER_H__ +#pragma once /** \file * \ingroup freestyle @@ -278,5 +277,3 @@ class Controller { extern Controller *g_pController; } /* namespace Freestyle */ - -#endif // __CONTROLLER_H__ diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h index d9387b221f8..50834db3c5c 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLENDER_FILE_LOADER_H__ -#define __BLENDER_FILE_LOADER_H__ +#pragma once /** \file * \ingroup freestyle @@ -37,7 +36,6 @@ #include "MEM_guardedalloc.h" -extern "C" { #include "DNA_material_types.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" @@ -56,7 +54,6 @@ extern "C" { #include "BLI_iterator.h" #include "BLI_listbase.h" #include "BLI_math.h" -} #include "DEG_depsgraph_query.h" @@ -170,5 +167,3 @@ class BlenderFileLoader { }; } /* namespace Freestyle */ - -#endif // __BLENDER_FILE_LOADER_H__ diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h index 21505f47ae2..1b2e57529d6 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLENDER_STROKE_RENDERER_H__ -#define __BLENDER_STROKE_RENDERER_H__ +#pragma once /** \file * \ingroup freestyle @@ -102,5 +101,3 @@ class BlenderStrokeRenderer : public StrokeRenderer { }; } /* namespace Freestyle */ - -#endif // __BLENDER_STROKE_RENDERER_H__ diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h b/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h index 95612a42722..e7636e2453a 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h +++ b/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLENDERSTYLEMODULE_H__ -#define __BLENDERSTYLEMODULE_H__ +#pragma once /** \file * \ingroup freestyle @@ -87,5 +86,3 @@ class BlenderStyleModule : public StyleModule { }; } /* namespace Freestyle */ - -#endif // __BLENDERSTYLEMODULE_H__ diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp index 26070a88e5d..51ac281e330 100644 --- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp +++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp @@ -34,8 +34,6 @@ using namespace Freestyle; #include "MEM_guardedalloc.h" -extern "C" { - #include "DNA_camera_types.h" #include "DNA_collection_types.h" #include "DNA_freestyle_types.h" @@ -65,6 +63,8 @@ extern "C" { #include "FRS_freestyle.h" +extern "C" { + #define DEFAULT_SPHERE_RADIUS 1.0f #define DEFAULT_DKR_EPSILON 0.0f diff --git a/source/blender/freestyle/intern/geometry/BBox.h b/source/blender/freestyle/intern/geometry/BBox.h index a8965e63451..d9a070faa55 100644 --- a/source/blender/freestyle/intern/geometry/BBox.h +++ b/source/blender/freestyle/intern/geometry/BBox.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BBOX_H__ -#define __BBOX_H__ +#pragma once /** \file * \ingroup freestyle @@ -156,5 +155,3 @@ template<class Point> BBox<Point> &operator+(const BBox<Point> &b1, const BBox<P } } /* namespace Freestyle */ - -#endif // __BBOX_H__ diff --git a/source/blender/freestyle/intern/geometry/Bezier.h b/source/blender/freestyle/intern/geometry/Bezier.h index adcd6e3a652..4c6b38935f9 100644 --- a/source/blender/freestyle/intern/geometry/Bezier.h +++ b/source/blender/freestyle/intern/geometry/Bezier.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BEZIER_H__ -#define __BEZIER_H__ +#pragma once /** \file * \ingroup freestyle @@ -92,5 +91,3 @@ class BezierCurve { }; } /* namespace Freestyle */ - -#endif // __BEZIER_H__ diff --git a/source/blender/freestyle/intern/geometry/FastGrid.h b/source/blender/freestyle/intern/geometry/FastGrid.h index 367c233d799..ec47f36d644 100644 --- a/source/blender/freestyle/intern/geometry/FastGrid.h +++ b/source/blender/freestyle/intern/geometry/FastGrid.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FASTGRID_H__ -#define __FASTGRID_H__ +#pragma once /** \file * \ingroup freestyle @@ -76,5 +75,3 @@ class FastGrid : public Grid { }; } /* namespace Freestyle */ - -#endif // __FASTGRID_H__ diff --git a/source/blender/freestyle/intern/geometry/FitCurve.h b/source/blender/freestyle/intern/geometry/FitCurve.h index 92afd685d8f..c08dc52249e 100644 --- a/source/blender/freestyle/intern/geometry/FitCurve.h +++ b/source/blender/freestyle/intern/geometry/FitCurve.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FITCURVE_H__ -#define __FITCURVE_H__ +#pragma once /** \file * \ingroup freestyle @@ -109,5 +108,3 @@ class FitCurveWrapper { }; } /* namespace Freestyle */ - -#endif // __FITCURVE_H__ diff --git a/source/blender/freestyle/intern/geometry/Geom.h b/source/blender/freestyle/intern/geometry/Geom.h index 63785d56cab..53703c3497a 100644 --- a/source/blender/freestyle/intern/geometry/Geom.h +++ b/source/blender/freestyle/intern/geometry/Geom.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __GEOM_H__ -#define __GEOM_H__ +#pragma once /** \file * \ingroup freestyle @@ -69,5 +68,3 @@ typedef VecMat::SquareMatrix<real, 4> Matrix44r; } // end of namespace Geometry } /* namespace Freestyle */ - -#endif // __GEOM_H__ diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.h b/source/blender/freestyle/intern/geometry/GeomCleaner.h index aee8ed6963d..7abbf881548 100644 --- a/source/blender/freestyle/intern/geometry/GeomCleaner.h +++ b/source/blender/freestyle/intern/geometry/GeomCleaner.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __GEOMCLEANER_H__ -#define __GEOMCLEANER_H__ +#pragma once /** \file * \ingroup freestyle @@ -257,5 +256,3 @@ bool operator<(const IndexedVertex &iv1, const IndexedVertex &iv2) #endif } /* namespace Freestyle */ - -#endif // __GEOMCLEANER_H__ diff --git a/source/blender/freestyle/intern/geometry/GeomUtils.h b/source/blender/freestyle/intern/geometry/GeomUtils.h index 635808aab4b..46cd307d9af 100644 --- a/source/blender/freestyle/intern/geometry/GeomUtils.h +++ b/source/blender/freestyle/intern/geometry/GeomUtils.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __GEOMUTILS_H__ -#define __GEOMUTILS_H__ +#pragma once /** \file * \ingroup freestyle @@ -266,5 +265,3 @@ void fromCameraToWorld(const Vec3r &p, Vec3r &q, const real model_view_matrix[4] } // end of namespace GeomUtils } /* namespace Freestyle */ - -#endif // __GEOMUTILS_H__ diff --git a/source/blender/freestyle/intern/geometry/Grid.h b/source/blender/freestyle/intern/geometry/Grid.h index c1a8dcdb370..b66f04398af 100644 --- a/source/blender/freestyle/intern/geometry/Grid.h +++ b/source/blender/freestyle/intern/geometry/Grid.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __GRID_H__ -#define __GRID_H__ +#pragma once /** \file * \ingroup freestyle @@ -433,5 +432,3 @@ class VirtualOccludersSet { }; } /* namespace Freestyle */ - -#endif // __GRID_H__ diff --git a/source/blender/freestyle/intern/geometry/GridHelpers.h b/source/blender/freestyle/intern/geometry/GridHelpers.h index 3f3c669cb57..077688164b4 100644 --- a/source/blender/freestyle/intern/geometry/GridHelpers.h +++ b/source/blender/freestyle/intern/geometry/GridHelpers.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __GRIDHELPERS_H__ -#define __GRIDHELPERS_H__ +#pragma once /** \file * \ingroup freestyle @@ -212,5 +211,3 @@ inline void expandProscenium(real proscenium[4], const Vec3r &point) }; // namespace GridHelpers } /* namespace Freestyle */ - -#endif // __GRIDHELPERS_H__ diff --git a/source/blender/freestyle/intern/geometry/HashGrid.h b/source/blender/freestyle/intern/geometry/HashGrid.h index 4bb92859775..6fb7f2b9cbe 100644 --- a/source/blender/freestyle/intern/geometry/HashGrid.h +++ b/source/blender/freestyle/intern/geometry/HashGrid.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __HASHGRID_H__ -#define __HASHGRID_H__ +#pragma once /** \file * \ingroup freestyle @@ -104,5 +103,3 @@ class HashGrid : public Grid { }; } /* namespace Freestyle */ - -#endif // __HASHGRID_H__ diff --git a/source/blender/freestyle/intern/geometry/Noise.h b/source/blender/freestyle/intern/geometry/Noise.h index 18992092b19..27a91ded9e2 100644 --- a/source/blender/freestyle/intern/geometry/Noise.h +++ b/source/blender/freestyle/intern/geometry/Noise.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __NOISE_H__ -#define __NOISE_H__ +#pragma once /** \file * \ingroup freestyle @@ -81,5 +80,3 @@ class Noise { }; } /* namespace Freestyle */ - -#endif // __NOISE_H__ diff --git a/source/blender/freestyle/intern/geometry/Polygon.h b/source/blender/freestyle/intern/geometry/Polygon.h index b3f47c8ca77..f6f827fd0f2 100644 --- a/source/blender/freestyle/intern/geometry/Polygon.h +++ b/source/blender/freestyle/intern/geometry/Polygon.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __POLYGON_H__ -#define __POLYGON_H__ +#pragma once /** \file * \ingroup freestyle @@ -230,5 +229,3 @@ class Polygon3r : public Polygon<Vec3r> { } // end of namespace Geometry } /* namespace Freestyle */ - -#endif // __POLYGON_H__ diff --git a/source/blender/freestyle/intern/geometry/SweepLine.h b/source/blender/freestyle/intern/geometry/SweepLine.h index b3555a4a160..d7d379d82f2 100644 --- a/source/blender/freestyle/intern/geometry/SweepLine.h +++ b/source/blender/freestyle/intern/geometry/SweepLine.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __SWEEPLINE_H__ -#define __SWEEPLINE_H__ +#pragma once /** \file * \ingroup freestyle @@ -347,5 +346,3 @@ template<class T, class Point> class SweepLine { }; } /* namespace Freestyle */ - -#endif // __SWEEPLINE_H__ diff --git a/source/blender/freestyle/intern/geometry/VecMat.h b/source/blender/freestyle/intern/geometry/VecMat.h index ee1cc42876c..64c3213560c 100644 --- a/source/blender/freestyle/intern/geometry/VecMat.h +++ b/source/blender/freestyle/intern/geometry/VecMat.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __VECMAT_H__ -#define __VECMAT_H__ +#pragma once /** \file * \ingroup freestyle @@ -1005,5 +1004,3 @@ inline std::ostream &operator<<(std::ostream &s, const Matrix<T, M, N> &m) } // end of namespace VecMat } /* namespace Freestyle */ - -#endif // __VECMAT_H__ diff --git a/source/blender/freestyle/intern/geometry/matrix_util.h b/source/blender/freestyle/intern/geometry/matrix_util.h index f42e043ca97..996ebc928a1 100644 --- a/source/blender/freestyle/intern/geometry/matrix_util.h +++ b/source/blender/freestyle/intern/geometry/matrix_util.h @@ -25,8 +25,7 @@ * FRANCE */ -#ifndef __MATRIX_UTIL__ -#define __MATRIX_UTIL__ +#pragma once /** \file * \ingroup freestyle @@ -61,5 +60,3 @@ void semi_definite_symmetric_eigen(const double *mat, int n, double *eigen_vec, } // namespace OGF } /* namespace Freestyle */ - -#endif // __MATRIX_UTIL__ diff --git a/source/blender/freestyle/intern/geometry/normal_cycle.h b/source/blender/freestyle/intern/geometry/normal_cycle.h index a57bfdb953e..6ac9779e7c2 100644 --- a/source/blender/freestyle/intern/geometry/normal_cycle.h +++ b/source/blender/freestyle/intern/geometry/normal_cycle.h @@ -25,8 +25,7 @@ * FRANCE */ -#ifndef __MESH_TOOLS_MATH_NORMAL_CYCLE__ -#define __MESH_TOOLS_MATH_NORMAL_CYCLE__ +#pragma once /** \file * \ingroup freestyle @@ -145,5 +144,3 @@ inline void NormalCycle::accumulate_dihedral_angle(const Vec3r &edge, } // namespace OGF } /* namespace Freestyle */ - -#endif // __MESH_TOOLS_MATH_NORMAL_CYCLE__ diff --git a/source/blender/freestyle/intern/image/GaussianFilter.h b/source/blender/freestyle/intern/image/GaussianFilter.h index 625e357eddf..ff765e619a8 100644 --- a/source/blender/freestyle/intern/image/GaussianFilter.h +++ b/source/blender/freestyle/intern/image/GaussianFilter.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __GAUSSIANFILTER_H__ -#define __GAUSSIANFILTER_H__ +#pragma once /** \file * \ingroup freestyle @@ -151,5 +150,3 @@ template<class Map> float GaussianFilter::getSmoothedPixel(Map *map, int x, int } } /* namespace Freestyle */ - -#endif // __GAUSSIANFILTER_H__ diff --git a/source/blender/freestyle/intern/image/Image.h b/source/blender/freestyle/intern/image/Image.h index cf8b0e33c6b..385e243a1a2 100644 --- a/source/blender/freestyle/intern/image/Image.h +++ b/source/blender/freestyle/intern/image/Image.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __IMAGE_H__ -#define __IMAGE_H__ +#pragma once /** \file * \ingroup freestyle @@ -430,5 +429,3 @@ class GrayImage : public FrsImage { }; } /* namespace Freestyle */ - -#endif // __IMAGE_H__ diff --git a/source/blender/freestyle/intern/image/ImagePyramid.h b/source/blender/freestyle/intern/image/ImagePyramid.h index 8c6a8bcdff4..ee8bf69aa10 100644 --- a/source/blender/freestyle/intern/image/ImagePyramid.h +++ b/source/blender/freestyle/intern/image/ImagePyramid.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __IMAGEPYRAMID_H__ -#define __IMAGEPYRAMID_H__ +#pragma once /** \file * \ingroup freestyle @@ -113,5 +112,3 @@ class GaussianPyramid : public ImagePyramid { }; } /* namespace Freestyle */ - -#endif // __IMAGEPYRAMID_H__ diff --git a/source/blender/freestyle/intern/python/BPy_BBox.h b/source/blender/freestyle/intern/python/BPy_BBox.h index 84542dc6d1c..a284deed10c 100644 --- a/source/blender/freestyle/intern/python/BPy_BBox.h +++ b/source/blender/freestyle/intern/python/BPy_BBox.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_BBOX_H__ -#define __FREESTYLE_PYTHON_BBOX_H__ +#pragma once extern "C" { #include <Python.h> @@ -55,5 +54,3 @@ int BBox_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_BBOX_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.h b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.h index 3d0575a676c..cdf81f3e4fc 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.h +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_BINARYPREDICATE0D_H__ -#define __FREESTYLE_PYTHON_BINARYPREDICATE0D_H__ +#pragma once extern "C" { #include <Python.h> @@ -54,5 +53,3 @@ int BinaryPredicate0D_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_BINARYPREDICATE0D_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.h b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.h index b258f293694..b761f6f6ace 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.h +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_BINARYPREDICATE1D_H__ -#define __FREESTYLE_PYTHON_BINARYPREDICATE1D_H__ +#pragma once extern "C" { #include <Python.h> @@ -54,5 +53,3 @@ int BinaryPredicate1D_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_BINARYPREDICATE1D_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_ContextFunctions.h b/source/blender/freestyle/intern/python/BPy_ContextFunctions.h index 674023fa008..4cc04379f18 100644 --- a/source/blender/freestyle/intern/python/BPy_ContextFunctions.h +++ b/source/blender/freestyle/intern/python/BPy_ContextFunctions.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_CONTEXTFUNCTIONS_H__ -#define __FREESTYLE_PYTHON_CONTEXTFUNCTIONS_H__ +#pragma once extern "C" { #include <Python.h> @@ -36,5 +35,3 @@ int ContextFunctions_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CONTEXTFUNCTIONS_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_Convert.h b/source/blender/freestyle/intern/python/BPy_Convert.h index 19e0879beff..5a1c11ec086 100644 --- a/source/blender/freestyle/intern/python/BPy_Convert.h +++ b/source/blender/freestyle/intern/python/BPy_Convert.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_CONVERT_H__ -#define __FREESTYLE_PYTHON_CONVERT_H__ +#pragma once extern "C" { #include <Python.h> @@ -177,5 +176,3 @@ int convert_v2(PyObject *obj, void *v); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CONVERT_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.h b/source/blender/freestyle/intern/python/BPy_Freestyle.h index a3a482be9ee..f63eb0d8466 100644 --- a/source/blender/freestyle/intern/python/BPy_Freestyle.h +++ b/source/blender/freestyle/intern/python/BPy_Freestyle.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_FREESTYLE_H__ -#define __FREESTYLE_PYTHON_FREESTYLE_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -38,5 +37,3 @@ PyObject *Freestyle_Init(void); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_FREESTYLE_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.h b/source/blender/freestyle/intern/python/BPy_FrsMaterial.h index 84a3ac2463f..13a116d7ef2 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.h +++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_FRSMATERIAL_H__ -#define __FREESTYLE_PYTHON_FRSMATERIAL_H__ +#pragma once extern "C" { #include <Python.h> @@ -55,5 +54,3 @@ void FrsMaterial_mathutils_register_callback(); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_FRSMATERIAL_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.h b/source/blender/freestyle/intern/python/BPy_FrsNoise.h index 9dcf59779cf..09bcc82ae94 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsNoise.h +++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_FRSNOISE_H__ -#define __FREESTYLE_PYTHON_FRSNOISE_H__ +#pragma once extern "C" { #include <Python.h> @@ -55,5 +54,3 @@ int FrsNoise_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_FRSNOISE_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_Id.h b/source/blender/freestyle/intern/python/BPy_Id.h index 3544f751453..f5952297c66 100644 --- a/source/blender/freestyle/intern/python/BPy_Id.h +++ b/source/blender/freestyle/intern/python/BPy_Id.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_ID_H__ -#define __FREESTYLE_PYTHON_ID_H__ +#pragma once extern "C" { #include <Python.h> @@ -57,5 +56,3 @@ int Id_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_ID_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.h b/source/blender/freestyle/intern/python/BPy_IntegrationType.h index 525feb002e4..be815c6c95a 100644 --- a/source/blender/freestyle/intern/python/BPy_IntegrationType.h +++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_INTEGRATIONTYPE_H__ -#define __FREESTYLE_PYTHON_INTEGRATIONTYPE_H__ +#pragma once extern "C" { #include <Python.h> @@ -49,5 +48,3 @@ int IntegrationType_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_INTEGRATIONTYPE_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_Interface0D.h b/source/blender/freestyle/intern/python/BPy_Interface0D.h index 81fdd40ff04..7e41a8888e1 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface0D.h +++ b/source/blender/freestyle/intern/python/BPy_Interface0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_INTERFACE0D_H__ -#define __FREESTYLE_PYTHON_INTERFACE0D_H__ +#pragma once extern "C" { #include <Python.h> @@ -55,5 +54,3 @@ int Interface0D_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_INTERFACE0D_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_Interface1D.h b/source/blender/freestyle/intern/python/BPy_Interface1D.h index db9bfa7f79c..20a4af0b4d0 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface1D.h +++ b/source/blender/freestyle/intern/python/BPy_Interface1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_INTERFACE1D_H__ -#define __FREESTYLE_PYTHON_INTERFACE1D_H__ +#pragma once extern "C" { #include <Python.h> @@ -55,5 +54,3 @@ int Interface1D_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_INTERFACE1D_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_Iterator.h b/source/blender/freestyle/intern/python/BPy_Iterator.h index f9f80c5f1db..5d1e8422976 100644 --- a/source/blender/freestyle/intern/python/BPy_Iterator.h +++ b/source/blender/freestyle/intern/python/BPy_Iterator.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_ITERATOR_H__ -#define __FREESTYLE_PYTHON_ITERATOR_H__ +#pragma once extern "C" { #include <Python.h> @@ -53,5 +52,3 @@ int Iterator_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_ITERATOR_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_MediumType.h b/source/blender/freestyle/intern/python/BPy_MediumType.h index 5c91890c249..854f826291e 100644 --- a/source/blender/freestyle/intern/python/BPy_MediumType.h +++ b/source/blender/freestyle/intern/python/BPy_MediumType.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_MEDIUMTYPE_H__ -#define __FREESTYLE_PYTHON_MEDIUMTYPE_H__ +#pragma once extern "C" { #include <Python.h> @@ -62,5 +61,3 @@ extern PyLongObject _BPy_MediumType_OPAQUE_MEDIUM; #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_MEDIUMTYPE_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_Nature.h b/source/blender/freestyle/intern/python/BPy_Nature.h index 8eb33f02488..48d15c8e796 100644 --- a/source/blender/freestyle/intern/python/BPy_Nature.h +++ b/source/blender/freestyle/intern/python/BPy_Nature.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_NATURE_H__ -#define __FREESTYLE_PYTHON_NATURE_H__ +#pragma once extern "C" { #include <Python.h> @@ -53,5 +52,3 @@ int Nature_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_NATURE_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_Operators.h b/source/blender/freestyle/intern/python/BPy_Operators.h index 15797ca742e..3b060d63f3c 100644 --- a/source/blender/freestyle/intern/python/BPy_Operators.h +++ b/source/blender/freestyle/intern/python/BPy_Operators.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_OPERATORS_H__ -#define __FREESTYLE_PYTHON_OPERATORS_H__ +#pragma once extern "C" { #include <Python.h> @@ -53,5 +52,3 @@ int Operators_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_OPERATORS_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_SShape.h b/source/blender/freestyle/intern/python/BPy_SShape.h index 55ef11b9a0b..9741a10f69e 100644 --- a/source/blender/freestyle/intern/python/BPy_SShape.h +++ b/source/blender/freestyle/intern/python/BPy_SShape.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_SSHAPE_H__ -#define __FREESTYLE_PYTHON_SSHAPE_H__ +#pragma once extern "C" { #include <Python.h> @@ -54,5 +53,3 @@ int SShape_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_SSHAPE_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.h b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.h index 9e14c292c0a..9068eb4c7a3 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.h +++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_STROKEATTRIBUTE_H__ -#define __FREESTYLE_PYTHON_STROKEATTRIBUTE_H__ +#pragma once extern "C" { #include <Python.h> @@ -56,5 +55,3 @@ void StrokeAttribute_mathutils_register_callback(); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_STROKEATTRIBUTE_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_StrokeShader.h b/source/blender/freestyle/intern/python/BPy_StrokeShader.h index 23b1196fdb9..04fff8e8052 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeShader.h +++ b/source/blender/freestyle/intern/python/BPy_StrokeShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_STROKESHADER_H__ -#define __FREESTYLE_PYTHON_STROKESHADER_H__ +#pragma once extern "C" { #include <Python.h> @@ -58,5 +57,3 @@ int StrokeShader_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_STROKESHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.h b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.h index c0834859dc8..1319cabe94a 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.h +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0D_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION0D_H__ +#pragma once extern "C" { #include <Python.h> @@ -54,5 +53,3 @@ int UnaryFunction0D_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION0D_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.h b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.h index dfd0e56beb6..331c3b4aaa1 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.h +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION1D_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION1D_H__ +#pragma once extern "C" { #include <Python.h> @@ -54,5 +53,3 @@ int UnaryFunction1D_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION1D_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.h b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.h index d422b10f18e..2460b1f028b 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.h +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYPREDICATE0D_H__ -#define __FREESTYLE_PYTHON_UNARYPREDICATE0D_H__ +#pragma once extern "C" { #include <Python.h> @@ -54,5 +53,3 @@ int UnaryPredicate0D_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYPREDICATE0D_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.h b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.h index 22358fab525..8fad7f94caf 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.h +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYPREDICATE1D_H__ -#define __FREESTYLE_PYTHON_UNARYPREDICATE1D_H__ +#pragma once extern "C" { #include <Python.h> @@ -54,5 +53,3 @@ int UnaryPredicate1D_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYPREDICATE1D_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_ViewMap.h b/source/blender/freestyle/intern/python/BPy_ViewMap.h index fe1cd39deb3..59738b6dce9 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewMap.h +++ b/source/blender/freestyle/intern/python/BPy_ViewMap.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_VIEWMAP_H__ -#define __FREESTYLE_PYTHON_VIEWMAP_H__ +#pragma once extern "C" { #include <Python.h> @@ -53,5 +52,3 @@ int ViewMap_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_VIEWMAP_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.h b/source/blender/freestyle/intern/python/BPy_ViewShape.h index 3158353136f..bd51fd0d5cb 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewShape.h +++ b/source/blender/freestyle/intern/python/BPy_ViewShape.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_VIEWSHAPE_H__ -#define __FREESTYLE_PYTHON_VIEWSHAPE_H__ +#pragma once extern "C" { #include <Python.h> @@ -57,5 +56,3 @@ int ViewShape_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_VIEWSHAPE_H__ */ diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.h b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.h index abb9eca9b30..6d741400caa 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.h +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_FALSEBP1D_H__ -#define __FREESTYLE_PYTHON_FALSEBP1D_H__ +#pragma once #include "../BPy_BinaryPredicate1D.h" @@ -43,5 +42,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_FALSEBP1D_H__ */ diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.h b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.h index 6ad2373c570..755da249855 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.h +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_LENGTH2DBP1D_H__ -#define __FREESTYLE_PYTHON_LENGTH2DBP1D_H__ +#pragma once #include "../BPy_BinaryPredicate1D.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_LENGTH2DBP1D_H__ */ diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.h b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.h index 75fc5eaa271..08326706a53 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.h +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_SAMESHAPEIDBP1D_H__ -#define __FREESTYLE_PYTHON_SAMESHAPEIDBP1D_H__ +#pragma once #include "../BPy_BinaryPredicate1D.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_SAMESHAPEIDBP1D_H__ */ diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.h b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.h index ed6a783fa47..76f3487d7db 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.h +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_TRUEBP1D_H__ -#define __FREESTYLE_PYTHON_TRUEBP1D_H__ +#pragma once #include "../BPy_BinaryPredicate1D.h" @@ -43,5 +42,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_TRUEBP1D_H__ */ diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.h b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.h index 1a451a688fb..b9ce88773a8 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.h +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_VIEWMAPGRADIENTNORMBP1D_H__ -#define __FREESTYLE_PYTHON_VIEWMAPGRADIENTNORMBP1D_H__ +#pragma once #include "../BPy_BinaryPredicate1D.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_VIEWMAPGRADIENTNORMBP1D_H__ */ diff --git a/source/blender/freestyle/intern/python/Director.h b/source/blender/freestyle/intern/python/Director.h index 5c087e411ff..468150524f1 100644 --- a/source/blender/freestyle/intern/python/Director.h +++ b/source/blender/freestyle/intern/python/Director.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_DIRECTOR_H__ -#define __FREESTYLE_PYTHON_DIRECTOR_H__ +#pragma once namespace Freestyle { class UnaryPredicate0D; @@ -63,5 +62,3 @@ int Director_BPy_StrokeShader_shade(StrokeShader *ss, Stroke &s); // ChainingIterator: init, traverse int Director_BPy_ChainingIterator_init(ChainingIterator *c_it); int Director_BPy_ChainingIterator_traverse(ChainingIterator *c_it, AdjacencyIterator &a_it); - -#endif // __FREESTYLE_PYTHON_DIRECTOR_H__ diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.h b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.h index d0f4087f8a6..6a550085817 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.h +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_CURVEPOINT_H__ -#define __FREESTYLE_PYTHON_CURVEPOINT_H__ +#pragma once #include "../BPy_Interface0D.h" @@ -46,5 +45,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CURVEPOINT_H__ */ diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.h b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.h index 20a14f1422c..8d24576a98f 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.h +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_SVERTEX_H__ -#define __FREESTYLE_PYTHON_SVERTEX_H__ +#pragma once #include "../BPy_Interface0D.h" @@ -50,5 +49,3 @@ void SVertex_mathutils_register_callback(); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_SVERTEX_H__ */ diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h index 6769efa4673..cb9815fb3d4 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_VIEWVERTEX_H__ -#define __FREESTYLE_PYTHON_VIEWVERTEX_H__ +#pragma once #include "../BPy_Interface0D.h" @@ -46,5 +45,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_VIEWVERTEX_H__ */ diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.h b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.h index e2eab6ab887..44da0ed212a 100644 --- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.h +++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_STROKEVERTEX_H__ -#define __FREESTYLE_PYTHON_STROKEVERTEX_H__ +#pragma once #include "../BPy_CurvePoint.h" @@ -51,5 +50,3 @@ void StrokeVertex_mathutils_register_callback(); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_STROKEVERTEX_H__ */ diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.h b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.h index fdea985a125..43f2c2b4a5c 100644 --- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.h +++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_NONTVERTEX_H__ -#define __FREESTYLE_PYTHON_NONTVERTEX_H__ +#pragma once #include "../BPy_ViewVertex.h" @@ -46,5 +45,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_NONTVERTEX_H__ */ diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.h b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.h index 165ad976fdf..253934bb4e7 100644 --- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.h +++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_TVERTEX_H__ -#define __FREESTYLE_PYTHON_TVERTEX_H__ +#pragma once #include "../BPy_ViewVertex.h" @@ -46,5 +45,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_TVERTEX_H__ */ diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h index 3ab8c5f8273..25b1bc99860 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_FEDGE_H__ -#define __FREESTYLE_PYTHON_FEDGE_H__ +#pragma once #include "../BPy_Interface1D.h" @@ -46,5 +45,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_FEDGE_H__ */ diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h index aa4fb409076..9bdc3919a38 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_FRSCURVE_H__ -#define __FREESTYLE_PYTHON_FRSCURVE_H__ +#pragma once #include "../BPy_Interface1D.h" @@ -46,5 +45,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_FRSCURVE_H__ */ diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h index a08905e6043..33c6aa70f91 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_STROKE_H__ -#define __FREESTYLE_PYTHON_STROKE_H__ +#pragma once #include "../BPy_Interface1D.h" @@ -46,5 +45,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_STROKE_H__ */ diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h index c02d5d0f21b..519081cedbd 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_VIEWEDGE_H__ -#define __FREESTYLE_PYTHON_VIEWEDGE_H__ +#pragma once #include "../BPy_Interface1D.h" @@ -46,5 +45,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_VIEWEDGE_H__ */ diff --git a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h index a9392cd81bf..73da253688c 100644 --- a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h +++ b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_CHAIN_H__ -#define __FREESTYLE_PYTHON_CHAIN_H__ +#pragma once #include "../BPy_FrsCurve.h" @@ -46,5 +45,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CHAIN_H__ */ diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h index 450539acb16..2b8b09a5990 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_FEDGESHARP_H__ -#define __FREESTYLE_PYTHON_FEDGESHARP_H__ +#pragma once #include "../BPy_FEdge.h" @@ -50,5 +49,3 @@ void FEdgeSharp_mathutils_register_callback(); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_FEDGESHARP_H__ */ diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h index 901741a76ff..97497281310 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_FEDGESMOOTH_H__ -#define __FREESTYLE_PYTHON_FEDGESMOOTH_H__ +#pragma once #include "../BPy_FEdge.h" @@ -51,5 +50,3 @@ void FEdgeSmooth_mathutils_register_callback(); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_FEDGESMOOTH_H__ */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h index 9a360f23f0a..e5332e0d180 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_ADJACENCYITERATOR_H__ -#define __FREESTYLE_PYTHON_ADJACENCYITERATOR_H__ +#pragma once #include "../BPy_Iterator.h" @@ -48,5 +47,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_ADJACENCYITERATOR_H__ */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h index 645e6573257..ece8018d285 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_CHAINPREDICATEITERATOR_H__ -#define __FREESTYLE_PYTHON_CHAINPREDICATEITERATOR_H__ +#pragma once #include "BPy_ChainingIterator.h" @@ -49,5 +48,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CHAINPREDICATEITERATOR_H__ */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h index 72823832441..f91d0fb2585 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_CHAINSILHOUETTEITERATOR_H__ -#define __FREESTYLE_PYTHON_CHAINSILHOUETTEITERATOR_H__ +#pragma once #include "BPy_ChainingIterator.h" @@ -47,5 +46,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CHAINSILHOUETTEITERATOR_H__ */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h index 7e3be0bc6cd..e950824764c 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_CHAININGITERATOR_H__ -#define __FREESTYLE_PYTHON_CHAININGITERATOR_H__ +#pragma once #include "BPy_ViewEdgeIterator.h" @@ -47,5 +46,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CHAININGITERATOR_H__ */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h index aa84b1020ce..db36bf386ec 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_CURVEPOINTITERATOR_H__ -#define __FREESTYLE_PYTHON_CURVEPOINTITERATOR_H__ +#pragma once #include "../BPy_Iterator.h" @@ -47,5 +46,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CURVEPOINTITERATOR_H__ */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h index 3695cda6c76..663193bedee 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_INTERFACE0DITERATOR_H__ -#define __FREESTYLE_PYTHON_INTERFACE0DITERATOR_H__ +#pragma once #include "../BPy_Iterator.h" @@ -49,5 +48,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_INTERFACE0DITERATOR_H__ */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h index 2a3bfa6baf9..a34dc7a63c5 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_SVERTEXITERATOR_H__ -#define __FREESTYLE_PYTHON_SVERTEXITERATOR_H__ +#pragma once #include "../BPy_Iterator.h" @@ -47,5 +46,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_SVERTEXITERATOR_H__ */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h index 04bca16337d..629471a664c 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_STROKEVERTEXITERATOR_H__ -#define __FREESTYLE_PYTHON_STROKEVERTEXITERATOR_H__ +#pragma once #include "../BPy_Iterator.h" @@ -50,5 +49,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_STROKEVERTEXITERATOR_H__ */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h index c9061d30e07..7169a13f328 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_VIEWEDGEITERATOR_H__ -#define __FREESTYLE_PYTHON_VIEWEDGEITERATOR_H__ +#pragma once #include "../BPy_Iterator.h" @@ -47,5 +46,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_VIEWEDGEITERATOR_H__ */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h index 179e315b1be..7a13f6d2c72 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_ORIENTEDVIEWEDGEITERATOR_H__ -#define __FREESTYLE_PYTHON_ORIENTEDVIEWEDGEITERATOR_H__ +#pragma once #include "../BPy_Iterator.h" @@ -49,5 +48,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_ORIENTEDVIEWEDGEITERATOR_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.h index c37d330e4a7..bd63b2fb337 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_BACKBONESTRETCHERSHADER_H__ -#define __FREESTYLE_PYTHON_BACKBONESTRETCHERSHADER_H__ +#pragma once #include "../BPy_StrokeShader.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_BACKBONESTRETCHERSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.h index b38fcec838d..a0b80b401ba 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_BEZIERCURVESHADER_H__ -#define __FREESTYLE_PYTHON_BEZIERCURVESHADER_H__ +#pragma once #include "../BPy_StrokeShader.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_BEZIERCURVESHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.h index 35335ffc023..7147a542467 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_BLENDERTEXTURESHADER_H__ -#define __FREESTYLE_PYTHON_BLENDERTEXTURESHADER_H__ +#pragma once #include "../BPy_StrokeShader.h" @@ -46,5 +45,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_BLENDERTEXTURESHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.h index 35a94a1620d..b64e1b9376e 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_CALLIGRAPHICSHADER_H__ -#define __FREESTYLE_PYTHON_CALLIGRAPHICSHADER_H__ +#pragma once #include "../BPy_StrokeShader.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CALLIGRAPHICSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.h index 054479d916d..ada3165eea9 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_COLORNOISESHADER_H__ -#define __FREESTYLE_PYTHON_COLORNOISESHADER_H__ +#pragma once #include "../BPy_StrokeShader.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_COLORNOISESHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.h index 36b59e6493e..7f58ed53e96 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_CONSTANTCOLORSHADER_H__ -#define __FREESTYLE_PYTHON_CONSTANTCOLORSHADER_H__ +#pragma once #include "../BPy_StrokeShader.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CONSTANTCOLORSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.h index 3a11ab9c9a0..9323e2b9143 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_CONSTANTTHICKNESSSHADER_H__ -#define __FREESTYLE_PYTHON_CONSTANTTHICKNESSSHADER_H__ +#pragma once #include "../BPy_StrokeShader.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CONSTANTTHICKNESSSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h index 04912499c04..e3946c4bedb 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_CONSTRAINEDINCREASINGTHICKNESSSHADER_H__ -#define __FREESTYLE_PYTHON_CONSTRAINEDINCREASINGTHICKNESSSHADER_H__ +#pragma once #include "../BPy_StrokeShader.h" @@ -45,5 +44,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CONSTRAINEDINCREASINGTHICKNESSSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.h index 217acbc4648..51fd37978d5 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GUIDINGLINESSHADER_H__ -#define __FREESTYLE_PYTHON_GUIDINGLINESSHADER_H__ +#pragma once #include "../BPy_StrokeShader.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GUIDINGLINESSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.h index d7d1d053efd..def647abcce 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_INCREASINGCOLORSHADER_H__ -#define __FREESTYLE_PYTHON_INCREASINGCOLORSHADER_H__ +#pragma once #include "../BPy_StrokeShader.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_INCREASINGCOLORSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.h index 28636263813..7ded1c81beb 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_INCREASINGTHICKNESSSHADER_H__ -#define __FREESTYLE_PYTHON_INCREASINGTHICKNESSSHADER_H__ +#pragma once #include "../BPy_StrokeShader.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_INCREASINGTHICKNESSSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.h index e44ca1caa51..c50b388965a 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_POLYGONALIZATIONSHADER_H__ -#define __FREESTYLE_PYTHON_POLYGONALIZATIONSHADER_H__ +#pragma once #include "../BPy_StrokeShader.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_POLYGONALIZATIONSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.h index 50dbae6916e..073c5e8df42 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_SAMPLINGSHADER_H__ -#define __FREESTYLE_PYTHON_SAMPLINGSHADER_H__ +#pragma once #include "../BPy_StrokeShader.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_SAMPLINGSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp index 51a0c670d75..9e2726061c3 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp @@ -35,9 +35,9 @@ static char SmoothingShader___doc__[] = "\n" "[Geometry shader]\n" "\n" - ".. method:: __init__(num_iterations=100, factor_point=0.1,\n" - " factor_curvature=0.0, factor_curvature_difference=0.2,\n" - " aniso_point=0.0, aniso_normal=0.0, aniso_curvature=0.0,\n" + ".. method:: __init__(num_iterations=100, factor_point=0.1, \\\n" + " factor_curvature=0.0, factor_curvature_difference=0.2, \\\n" + " aniso_point=0.0, aniso_normal=0.0, aniso_curvature=0.0, \\\n" " carricature_factor=1.0)\n" "\n" " Builds a SmoothingShader object.\n" diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.h index 4b553d76770..fcd559b661d 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHONSMOOTHINGSHADER_H__ -#define __FREESTYLE_PYTHONSMOOTHINGSHADER_H__ +#pragma once #include "../BPy_StrokeShader.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHONSMOOTHINGSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.h index 7e5e644c46f..59e3e32d6cf 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_SPATIALNOISESHADER_H__ -#define __FREESTYLE_PYTHON_SPATIALNOISESHADER_H__ +#pragma once #include "../BPy_StrokeShader.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_SPATIALNOISESHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.h index d53ca139b2b..ef0ebfad883 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_STROKETEXTURESTEPSHADER_H__ -#define __FREESTYLE_PYTHON_STROKETEXTURESTEPSHADER_H__ +#pragma once #include "../BPy_StrokeShader.h" @@ -46,5 +45,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_STROKETEXTURESTEPSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.h index 1a42985b245..e18f60c033b 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_THICKNESSNOISESHADER_H__ -#define __FREESTYLE_PYTHON_THICKNESSNOISESHADER_H__ +#pragma once #include "../BPy_StrokeShader.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_THICKNESSNOISESHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.h index a82be691c81..bc7c2a2f2f4 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_TIPREMOVERSHADER_H__ -#define __FREESTYLE_PYTHON_TIPREMOVERSHADER_H__ +#pragma once #include "../BPy_StrokeShader.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_TIPREMOVERSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.h index 8abccd27591..60ebc646d74 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DDOUBLE_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION0DDOUBLE_H__ +#pragma once #include "../BPy_UnaryFunction0D.h" @@ -48,5 +47,3 @@ int UnaryFunction0DDouble_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION0DDOUBLE_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.h index 5a92142c88a..9ce4b3bfd0b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DEDGENATURE_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION0DEDGENATURE_H__ +#pragma once #include "../BPy_UnaryFunction0D.h" @@ -50,5 +49,3 @@ int UnaryFunction0DEdgeNature_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION0DEDGENATURE_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.h index 53dc88d0e21..fd221201d99 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DFLOAT_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION0DFLOAT_H__ +#pragma once #include "../BPy_UnaryFunction0D.h" @@ -48,5 +47,3 @@ int UnaryFunction0DFloat_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION0DFLOAT_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.h index a8887b081ce..14e5d48ce43 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DID_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION0DID_H__ +#pragma once #include "../BPy_UnaryFunction0D.h" @@ -50,5 +49,3 @@ int UnaryFunction0DId_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION0DID_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.h index 558719032f8..bbd53c409eb 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DMATERIAL_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION0DMATERIAL_H__ +#pragma once #include "../BPy_UnaryFunction0D.h" @@ -50,5 +49,3 @@ int UnaryFunction0DMaterial_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION0DMATERIAL_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h index ac09b51eceb..1a466ffc673 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DUNSIGNED_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION0DUNSIGNED_H__ +#pragma once #include "../BPy_UnaryFunction0D.h" @@ -48,5 +47,3 @@ int UnaryFunction0DUnsigned_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION0DUNSIGNED_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.h index 1639e1a5356..6c3d5fc85cc 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DVEC2F_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION0DVEC2F_H__ +#pragma once #include "../BPy_UnaryFunction0D.h" @@ -51,5 +50,3 @@ int UnaryFunction0DVec2f_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION0DVEC2F_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.h index 0f3bcc51f2e..4be9b170311 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DVEC3F_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION0DVEC3F_H__ +#pragma once #include "../BPy_UnaryFunction0D.h" @@ -51,5 +50,3 @@ int UnaryFunction0DVec3f_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION0DVEC3F_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.h index 4f559a09ba9..2a36ae21002 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DVECTORVIEWSHAPE_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION0DVECTORVIEWSHAPE_H__ +#pragma once #include "../BPy_UnaryFunction0D.h" @@ -53,5 +52,3 @@ int UnaryFunction0DVectorViewShape_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION0DVECTORVIEWSHAPE_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.h index af3661669bd..8a8dcdceb1f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DVIEWSHAPE_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION0DVIEWSHAPE_H__ +#pragma once #include "../BPy_UnaryFunction0D.h" @@ -50,5 +49,3 @@ int UnaryFunction0DViewShape_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION0DVIEWSHAPE_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.h index 1aea0736c9b..ce4b448df03 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_SHAPEIDF0D_H__ -#define __FREESTYLE_PYTHON_SHAPEIDF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DId.h" @@ -43,5 +42,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_SHAPEIDF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.h index f1520fa63ee..b569b9e1e81 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_MATERIALF0D_H__ -#define __FREESTYLE_PYTHON_MATERIALF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DMaterial.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_MATERIALF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.h index f24e63d09f9..5e29845c6b9 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_CURVENATUREF0D_H__ -#define __FREESTYLE_PYTHON_CURVENATUREF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DEdgeNature.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CURVENATUREF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.h index 45a4ec3124d..c9b10412f34 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_NORMAL2DF0D_H__ -#define __FREESTYLE_PYTHON_NORMAL2DF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DVec2f.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_NORMAL2DF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.h index 8e76c31ff27..036bc82b52a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_VERTEXORIENTATION2DF0D_H__ -#define __FREESTYLE_PYTHON_VERTEXORIENTATION2DF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DVec2f.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_VERTEXORIENTATION2DF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.h index 391f7c9536b..c99c344d470 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_VERTEXORIENTATION3DF0D_H__ -#define __FREESTYLE_PYTHON_VERTEXORIENTATION3DF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DVec3f.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_VERTEXORIENTATION3DF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.h index 45c9524e185..20ca0499a1e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETOCCLUDEEF0D_H__ -#define __FREESTYLE_PYTHON_GETOCCLUDEEF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DViewShape.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETOCCLUDEEF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.h index c1db8c1219a..4e6dd6b9f60 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETSHAPEF0D_H__ -#define __FREESTYLE_PYTHON_GETSHAPEF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DViewShape.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETSHAPEF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.h index b57119257b9..6fcafef8143 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_CURVATURE2DANGLEF0D_H__ -#define __FREESTYLE_PYTHON_CURVATURE2DANGLEF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DDouble.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CURVATURE2DANGLEF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.h index 34bbd8331fb..8df2f67aff3 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_DENSITYF0D_H__ -#define __FREESTYLE_PYTHON_DENSITYF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DDouble.h" @@ -43,5 +42,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_DENSITYF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.h index ddd500f617e..cf5adf216fc 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETPROJECTEDXF0D_H__ -#define __FREESTYLE_PYTHON_GETPROJECTEDXF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DDouble.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETPROJECTEDXF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.h index 8fccf14971f..6293f9daa24 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETPROJECTEDYF0D_H__ -#define __FREESTYLE_PYTHON_GETPROJECTEDYF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DDouble.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETPROJECTEDYF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.h index eecf69adb12..edae33e4c85 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETPROJECTEDZF0D_H__ -#define __FREESTYLE_PYTHON_GETPROJECTEDZF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DDouble.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETPROJECTEDZF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.h index 745bd5c628d..e0427fb1ccd 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETXF0D_H__ -#define __FREESTYLE_PYTHON_GETXF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DDouble.h" @@ -43,5 +42,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETXF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.h index 437ec573585..3f4f3c85dc7 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETYF0D_H__ -#define __FREESTYLE_PYTHON_GETYF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DDouble.h" @@ -43,5 +42,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETYF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.h index 840303fa59d..54a451e81f4 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETZF0D_H__ -#define __FREESTYLE_PYTHON_GETZF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DDouble.h" @@ -43,5 +42,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETZF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.h index f8072427d47..85626895d20 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_LOCALAVERAGEDEPTHF0D_H__ -#define __FREESTYLE_PYTHON_LOCALAVERAGEDEPTHF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DDouble.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_LOCALAVERAGEDEPTHF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.h index d0aed95fc1a..fe2f333da37 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_ZDISCONTINUITYF0D_H__ -#define __FREESTYLE_PYTHON_ZDISCONTINUITYF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DDouble.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_ZDISCONTINUITYF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.h index 72238cfc255..8fffe3fd51d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETCURVILINEARABSCISSAF0D_H__ -#define __FREESTYLE_PYTHON_GETCURVILINEARABSCISSAF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DFloat.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETCURVILINEARABSCISSAF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.h index 4fdb6419f21..3346b519e60 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETPARAMETERF0D_H__ -#define __FREESTYLE_PYTHON_GETPARAMETERF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DFloat.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETPARAMETERF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.h index 6ed42ee8019..de4930912f4 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETVIEWMAPGRADIENTNORMF0D_H__ -#define __FREESTYLE_PYTHON_GETVIEWMAPGRADIENTNORMF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DFloat.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETVIEWMAPGRADIENTNORMF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.h index 48d36543ca0..ceee0151771 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_READCOMPLETEVIEWMAPPIXELF0D_H__ -#define __FREESTYLE_PYTHON_READCOMPLETEVIEWMAPPIXELF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DFloat.h" @@ -45,5 +44,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_READCOMPLETEVIEWMAPPIXELF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.h index 014a4aa2b8e..54c9ac984f9 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_READMAPPIXELF0D_H__ -#define __FREESTYLE_PYTHON_READMAPPIXELF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DFloat.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_READMAPPIXELF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.h index 3cff99be633..f1fa1f1b7a2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_READSTEERABLEVIEWMAPPIXELF0D_H__ -#define __FREESTYLE_PYTHON_READSTEERABLEVIEWMAPPIXELF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DFloat.h" @@ -45,5 +44,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_READSTEERABLEVIEWMAPPIXELF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.h index dd64fb40d85..510cc7ef146 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_QUANTITATIVEINVISIBILITYF0D_H__ -#define __FREESTYLE_PYTHON_QUANTITATIVEINVISIBILITYF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DUnsigned.h" @@ -45,5 +44,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_QUANTITATIVEINVISIBILITYF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.h index 82889b64aba..9e932ff9eff 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETOCCLUDERSF0D_H__ -#define __FREESTYLE_PYTHON_GETOCCLUDERSF0D_H__ +#pragma once #include "../BPy_UnaryFunction0DVectorViewShape.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETOCCLUDERSF0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.h index cfd7f954b54..1fb42a18337 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION1DDOUBLE_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION1DDOUBLE_H__ +#pragma once #include "../BPy_UnaryFunction1D.h" @@ -48,5 +47,3 @@ int UnaryFunction1DDouble_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION1DDOUBLE_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.h index 1a7a5a2d7ee..886eb469d51 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION1DEDGENATURE_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION1DEDGENATURE_H__ +#pragma once #include "../BPy_UnaryFunction1D.h" @@ -50,5 +49,3 @@ int UnaryFunction1DEdgeNature_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION1DEDGENATURE_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.h index 8a5a329b0bf..8b977c9c96a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION1DFLOAT_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION1DFLOAT_H__ +#pragma once #include "../BPy_UnaryFunction1D.h" @@ -48,5 +47,3 @@ int UnaryFunction1DFloat_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION1DFLOAT_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h index b18bf34b27e..9149275b610 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION1DUNSIGNED_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION1DUNSIGNED_H__ +#pragma once #include "../BPy_UnaryFunction1D.h" @@ -48,5 +47,3 @@ int UnaryFunction1DUnsigned_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION1DUNSIGNED_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.h index f4cad92334f..b55f9af7c4d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION1DVEC2F_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION1DVEC2F_H__ +#pragma once #include "../BPy_UnaryFunction1D.h" @@ -51,5 +50,3 @@ int UnaryFunction1DVec2f_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION1DVEC2F_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.h index 253a8d550e3..9e4342979e4 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION1DVEC3F_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION1DVEC3F_H__ +#pragma once #include "../BPy_UnaryFunction1D.h" @@ -51,5 +50,3 @@ int UnaryFunction1DVec3f_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION1DVEC3F_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h index 80511e7c145..bfbcf5e451d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION1DVECTORVIEWSHAPE_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION1DVECTORVIEWSHAPE_H__ +#pragma once #include "../BPy_UnaryFunction1D.h" @@ -53,5 +52,3 @@ int UnaryFunction1DVectorViewShape_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION1DVECTORVIEWSHAPE_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h index 03d949f879d..3a821bc2083 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION1DVOID_H__ -#define __FREESTYLE_PYTHON_UNARYFUNCTION1DVOID_H__ +#pragma once #include "../BPy_UnaryFunction1D.h" @@ -48,5 +47,3 @@ int UnaryFunction1DVoid_Init(PyObject *module); #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_UNARYFUNCTION1DVOID_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.h index 15c381eb279..961c9729e6c 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_CURVENATUREF1D_H__ -#define __FREESTYLE_PYTHON_CURVENATUREF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DEdgeNature.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CURVENATUREF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h index 343c4379b4a..080f26aa753 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_NORMAL2DF1D_H__ -#define __FREESTYLE_PYTHON_NORMAL2DF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DVec2f.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_NORMAL2DF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h index 5b453cbe714..013423003c6 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_ORIENTATION2DF1D_H__ -#define __FREESTYLE_PYTHON_ORIENTATION2DF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DVec2f.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_ORIENTATION2DF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h index 26c6cd845db..2e79559bf43 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_ORIENTATION3DF1D_H__ -#define __FREESTYLE_PYTHON_ORIENTATION3DF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DVec3f.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_ORIENTATION3DF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.h index 7a3a3fcff4b..241c864fdad 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_CURVATURE2DANGLEF1D_H__ -#define __FREESTYLE_PYTHON_CURVATURE2DANGLEF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DDouble.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CURVATURE2DANGLEF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.h index 71daa14069a..1b1040d66c4 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_DENSITYF1D_H__ -#define __FREESTYLE_PYTHON_DENSITYF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DDouble.h" @@ -43,5 +42,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_DENSITYF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.h index dacfb33553e..1bbb4d46fc5 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETCOMPLETEVIEWMAPDENSITYF1D_H__ -#define __FREESTYLE_PYTHON_GETCOMPLETEVIEWMAPDENSITYF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DDouble.h" @@ -45,5 +44,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETCOMPLETEVIEWMAPDENSITYF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.h index b039fadcdca..8e55fc7cc50 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETDIRECTIONALVIEWMAPDENSITYF1D_H__ -#define __FREESTYLE_PYTHON_GETDIRECTIONALVIEWMAPDENSITYF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DDouble.h" @@ -45,5 +44,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETDIRECTIONALVIEWMAPDENSITYF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.h index febb3265f97..66bd3983e45 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETPROJECTEDXF1D_H__ -#define __FREESTYLE_PYTHON_GETPROJECTEDXF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DDouble.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETPROJECTEDXF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.h index 5a0a5f42cb0..b1a1e90f83f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETPROJECTEDYF1D_H__ -#define __FREESTYLE_PYTHON_GETPROJECTEDYF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DDouble.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETPROJECTEDYF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.h index aeb42521d1f..73b01bbf999 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETPROJECTEDZF1D_H__ -#define __FREESTYLE_PYTHON_GETPROJECTEDZF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DDouble.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETPROJECTEDZF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.h index 47f168af2a8..81167d36352 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETSTEERABLEVIEWMAPDENSITYF1D_H__ -#define __FREESTYLE_PYTHON_GETSTEERABLEVIEWMAPDENSITYF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DDouble.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETSTEERABLEVIEWMAPDENSITYF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.h index 4f19b4ac67f..0e4a67cf4df 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETVIEWMAPGRADIENTNORMF1D_H__ -#define __FREESTYLE_PYTHON_GETVIEWMAPGRADIENTNORMF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DDouble.h" @@ -45,5 +44,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETVIEWMAPGRADIENTNORMF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.h index 7db31882381..30218ccd5e5 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETXF1D_H__ -#define __FREESTYLE_PYTHON_GETXF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DDouble.h" @@ -43,5 +42,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETXF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.h index 3f70d64e200..16afac368c1 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETYF1D_H__ -#define __FREESTYLE_PYTHON_GETYF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DDouble.h" @@ -43,5 +42,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETYF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.h index b841bde2a5c..a204f3d6665 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETZF1D_H__ -#define __FREESTYLE_PYTHON_GETZF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DDouble.h" @@ -43,5 +42,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETZF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.h index 258d028bfbd..d472489fb0c 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_LOCALAVERAGEDEPTHF1D_H__ -#define __FREESTYLE_PYTHON_LOCALAVERAGEDEPTHF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DDouble.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_LOCALAVERAGEDEPTHF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h index c336591842b..c1966472377 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_ZDISCONTINUITYF1D_H__ -#define __FREESTYLE_PYTHON_ZDISCONTINUITYF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DDouble.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_ZDISCONTINUITYF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h index 0d4d118995b..c76e5f821f2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_QUANTITATIVEINVISIBILITYF1D_H__ -#define __FREESTYLE_PYTHON_QUANTITATIVEINVISIBILITYF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DUnsigned.h" @@ -45,5 +44,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_QUANTITATIVEINVISIBILITYF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.h index 5a14b5dc35d..2e414446e47 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETOCCLUDEEF1D_H__ -#define __FREESTYLE_PYTHON_GETOCCLUDEEF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DVectorViewShape.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETOCCLUDEEF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h index 29899d443a6..52c78bd7f4c 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETOCCLUDERSF1D_H__ -#define __FREESTYLE_PYTHON_GETOCCLUDERSF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DVectorViewShape.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETOCCLUDERSF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h index b90f3df5831..9c025e3b404 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_GETSHAPEF1D_H__ -#define __FREESTYLE_PYTHON_GETSHAPEF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DVectorViewShape.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_GETSHAPEF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.h index c6423ef434f..0a8650d6794 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_CHAININGTIMESTAMPF1D_H__ -#define __FREESTYLE_PYTHON_CHAININGTIMESTAMPF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DVoid.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CHAININGTIMESTAMPF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h index 0d74b1f7756..e555788f4c9 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_INCREMENTCHAININGTIMESTAMPF1D_H__ -#define __FREESTYLE_PYTHON_INCREMENTCHAININGTIMESTAMPF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DVoid.h" @@ -45,5 +44,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_INCREMENTCHAININGTIMESTAMPF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.h index 4787f35cfc5..117d724d179 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_TIMESTAMPF1D_H__ -#define __FREESTYLE_PYTHON_TIMESTAMPF1D_H__ +#pragma once #include "../BPy_UnaryFunction1DVoid.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CHAININGTIMESTAMPF1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.h b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.h index b947ccf5b95..0c36e770b80 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_FALSEUP0D_H__ -#define __FREESTYLE_PYTHON_FALSEUP0D_H__ +#pragma once #include "../BPy_UnaryPredicate0D.h" @@ -43,5 +42,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_FALSEUP0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.h b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.h index 72acf363992..abdfb4e294d 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_TRUEUP0D_H__ -#define __FREESTYLE_PYTHON_TRUEUP0D_H__ +#pragma once #include "../BPy_UnaryPredicate0D.h" @@ -43,5 +42,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_TRUEUP0D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.h index de6c40fa8ac..be06a0fee33 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_CONTOURUP1D_H__ -#define __FREESTYLE_PYTHON_CONTOURUP1D_H__ +#pragma once #include "../BPy_UnaryPredicate1D.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_CONTOURUP1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.h index fb02b63fa3d..068c7727ec0 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_DENSITYLOWERTHANUP1D_H__ -#define __FREESTYLE_PYTHON_DENSITYLOWERTHANUP1D_H__ +#pragma once #include "../BPy_UnaryPredicate1D.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_DENSITYLOWERTHANUP1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.h index e2ba8b7709b..d103c1356ab 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_EQUALTOCHAININGTIMESTAMPUP1D_H__ -#define __FREESTYLE_PYTHON_EQUALTOCHAININGTIMESTAMPUP1D_H__ +#pragma once #include "../BPy_UnaryPredicate1D.h" @@ -45,5 +44,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_EQUALTOCHAININGTIMESTAMPUP1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.h index 13736242382..9e3d90ab760 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_EQUALTOTIMESTAMPUP1D_H__ -#define __FREESTYLE_PYTHON_EQUALTOTIMESTAMPUP1D_H__ +#pragma once #include "../BPy_UnaryPredicate1D.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_EQUALTOTIMESTAMPUP1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.h index 4d2a22731fa..0576b727f4a 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_EXTERNALCONTOURUP1D_H__ -#define __FREESTYLE_PYTHON_EXTERNALCONTOURUP1D_H__ +#pragma once #include "../BPy_UnaryPredicate1D.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_EXTERNALCONTOURUP1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.h index 57255c2333f..a74d2aba0a6 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_FALSEUP1D_H__ -#define __FREESTYLE_PYTHON_FALSEUP1D_H__ +#pragma once #include "../BPy_UnaryPredicate1D.h" @@ -43,5 +42,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_FALSEUP1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.h index bbb1dce5ed1..970ddd48273 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_QUANTITATIVEINVISIBILITYUP1D_H__ -#define __FREESTYLE_PYTHON_QUANTITATIVEINVISIBILITYUP1D_H__ +#pragma once #include "../BPy_UnaryPredicate1D.h" @@ -45,5 +44,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_QUANTITATIVEINVISIBILITYUP1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.h index a48ed0aa0da..c60aa7aa9cf 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_SHAPEUP1D_H__ -#define __FREESTYLE_PYTHON_SHAPEUP1D_H__ +#pragma once #include "../BPy_UnaryPredicate1D.h" @@ -43,5 +42,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_SHAPEUP1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.h index 49c3dcdacca..e036cfe95ed 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_TRUEUP1D_H__ -#define __FREESTYLE_PYTHON_TRUEUP1D_H__ +#pragma once #include "../BPy_UnaryPredicate1D.h" @@ -43,5 +42,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_TRUEUP1D_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.h index 2481beee78e..1d08f7fb530 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.h @@ -18,8 +18,7 @@ * \ingroup freestyle */ -#ifndef __FREESTYLE_PYTHON_WITHINIMAGEBOUNDARYUP1D_H__ -#define __FREESTYLE_PYTHON_WITHINIMAGEBOUNDARYUP1D_H__ +#pragma once #include "../BPy_UnaryPredicate1D.h" @@ -44,5 +43,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif /* __FREESTYLE_PYTHON_WITHINIMAGEBOUNDARYUP1D_H__ */ diff --git a/source/blender/freestyle/intern/scene_graph/DrawingStyle.h b/source/blender/freestyle/intern/scene_graph/DrawingStyle.h index 631f4b99adc..ca1e2351868 100644 --- a/source/blender/freestyle/intern/scene_graph/DrawingStyle.h +++ b/source/blender/freestyle/intern/scene_graph/DrawingStyle.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_DRAWING_STYLE_H__ -#define __FREESTYLE_DRAWING_STYLE_H__ +#pragma once /** \file * \ingroup freestyle @@ -124,5 +123,3 @@ DrawingStyle &DrawingStyle::operator=(const DrawingStyle &ds) } } /* namespace Freestyle */ - -#endif // __FREESTYLE_DRAWING_STYLE_H__ diff --git a/source/blender/freestyle/intern/scene_graph/FrsMaterial.h b/source/blender/freestyle/intern/scene_graph/FrsMaterial.h index 80cd783f164..18d3c8839dd 100644 --- a/source/blender/freestyle/intern/scene_graph/FrsMaterial.h +++ b/source/blender/freestyle/intern/scene_graph/FrsMaterial.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_MATERIAL_H__ -#define __FREESTYLE_MATERIAL_H__ +#pragma once /** \file * \ingroup freestyle @@ -479,5 +478,3 @@ bool FrsMaterial::operator==(const FrsMaterial &m) const } } /* namespace Freestyle */ - -#endif // __FREESTYLE_MATERIAL_H__ diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h index f8dd25913c1..9d1fc009e37 100644 --- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h +++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_INDEXED_FACE_SET_H__ -#define __FREESTYLE_INDEXED_FACE_SET_H__ +#pragma once /** \file * \ingroup freestyle @@ -311,5 +310,3 @@ class IndexedFaceSet : public Rep { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_INDEXED_FACE_SET_H__ diff --git a/source/blender/freestyle/intern/scene_graph/LineRep.h b/source/blender/freestyle/intern/scene_graph/LineRep.h index e45a33d9fc4..43fd736570f 100644 --- a/source/blender/freestyle/intern/scene_graph/LineRep.h +++ b/source/blender/freestyle/intern/scene_graph/LineRep.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_LINE_REP_H__ -#define __FREESTYLE_LINE_REP_H__ +#pragma once /** \file * \ingroup freestyle @@ -149,5 +148,3 @@ class LineRep : public Rep { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_LINE_REP_H__ diff --git a/source/blender/freestyle/intern/scene_graph/Node.h b/source/blender/freestyle/intern/scene_graph/Node.h index 96072993590..07bf186ea39 100644 --- a/source/blender/freestyle/intern/scene_graph/Node.h +++ b/source/blender/freestyle/intern/scene_graph/Node.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_NODE_H__ -#define __FREESTYLE_NODE_H__ +#pragma once /** \file * \ingroup freestyle @@ -113,5 +112,3 @@ class Node : public BaseObject { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_NODE_H__ diff --git a/source/blender/freestyle/intern/scene_graph/NodeCamera.h b/source/blender/freestyle/intern/scene_graph/NodeCamera.h index 2878e7a834e..cc7b1f7f67c 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeCamera.h +++ b/source/blender/freestyle/intern/scene_graph/NodeCamera.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_NODE_CAMERA_H__ -#define __FREESTYLE_NODE_CAMERA_H__ +#pragma once /** \file * \ingroup freestyle @@ -217,5 +216,3 @@ class NodePerspectiveCamera : public NodeCamera { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_NODE_CAMERA_H__ diff --git a/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.h b/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.h index f1dfad06250..8bbdaf30bad 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.h +++ b/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_NODE_DRAWING_STYLE_H__ -#define __FREESTYLE_NODE_DRAWING_STYLE_H__ +#pragma once /** \file * \ingroup freestyle @@ -106,5 +105,3 @@ class NodeDrawingStyle : public NodeGroup { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_NODE_DRAWING_STYLE_H__ diff --git a/source/blender/freestyle/intern/scene_graph/NodeGroup.h b/source/blender/freestyle/intern/scene_graph/NodeGroup.h index 5ef16255e46..0558e22bed1 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeGroup.h +++ b/source/blender/freestyle/intern/scene_graph/NodeGroup.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_NODE_GROUP_H__ -#define __FREESTYLE_NODE_GROUP_H__ +#pragma once /** \file * \ingroup freestyle @@ -80,5 +79,3 @@ class NodeGroup : public Node { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_NODE_GROUP_H__ diff --git a/source/blender/freestyle/intern/scene_graph/NodeLight.h b/source/blender/freestyle/intern/scene_graph/NodeLight.h index 046b61beaf4..bf8389441b6 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeLight.h +++ b/source/blender/freestyle/intern/scene_graph/NodeLight.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_NODE_LIGHT_H__ -#define __FREESTYLE_NODE_LIGHT_H__ +#pragma once /** \file * \ingroup freestyle @@ -101,5 +100,3 @@ class NodeLight : public Node { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_NODE_LIGHT_H__ diff --git a/source/blender/freestyle/intern/scene_graph/NodeShape.h b/source/blender/freestyle/intern/scene_graph/NodeShape.h index 13ee265ec10..5f7a24b85d5 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeShape.h +++ b/source/blender/freestyle/intern/scene_graph/NodeShape.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_NODE_SHAPE_H__ -#define __FREESTYLE_NODE_SHAPE_H__ +#pragma once /** \file * \ingroup freestyle @@ -93,5 +92,3 @@ class NodeShape : public Node { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_NODE_SHAPE_H__ diff --git a/source/blender/freestyle/intern/scene_graph/NodeTransform.h b/source/blender/freestyle/intern/scene_graph/NodeTransform.h index 1118417657f..9d55046a515 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeTransform.h +++ b/source/blender/freestyle/intern/scene_graph/NodeTransform.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_NODE_TRANSFORM_H__ -#define __FREESTYLE_NODE_TRANSFORM_H__ +#pragma once /** \file * \ingroup freestyle @@ -98,5 +97,3 @@ class NodeTransform : public NodeGroup { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_NODE_TRANSFORM_H__ diff --git a/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h b/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h index 2339abe9aed..d52155eb216 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h +++ b/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_NODE_VIEW_LAYER_H__ -#define __FREESTYLE_NODE_VIEW_LAYER_H__ +#pragma once /** \file * \ingroup freestyle @@ -59,5 +58,3 @@ class NodeViewLayer : public Node { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_NODE_VIEW_LAYER_H__ diff --git a/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h b/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h index 2e39259077e..c33fd529c69 100644 --- a/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h +++ b/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_ORIENTED_LINE_REP_H__ -#define __FREESTYLE_ORIENTED_LINE_REP_H__ +#pragma once /** \file * \ingroup freestyle @@ -62,5 +61,3 @@ class OrientedLineRep : public LineRep { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_ORIENTED_LINE_REP_H__ diff --git a/source/blender/freestyle/intern/scene_graph/Rep.h b/source/blender/freestyle/intern/scene_graph/Rep.h index 58553d257d9..dae5272beed 100644 --- a/source/blender/freestyle/intern/scene_graph/Rep.h +++ b/source/blender/freestyle/intern/scene_graph/Rep.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_REP_H__ -#define __FREESTYLE_REP_H__ +#pragma once /** \file * \ingroup freestyle @@ -181,5 +180,3 @@ class Rep : public BaseObject { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_REP_H__ diff --git a/source/blender/freestyle/intern/scene_graph/SceneHash.h b/source/blender/freestyle/intern/scene_graph/SceneHash.h index 05c0880f806..605e2ddaa84 100644 --- a/source/blender/freestyle/intern/scene_graph/SceneHash.h +++ b/source/blender/freestyle/intern/scene_graph/SceneHash.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_SCENE_HASH_H__ -#define __FREESTYLE_SCENE_HASH_H__ +#pragma once /** \file * \ingroup freestyle @@ -78,5 +77,3 @@ class SceneHash : public SceneVisitor { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_SCENE_HASH_H__ diff --git a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h index f19233bba3b..9436bdccf57 100644 --- a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h +++ b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_SCENE_PRETTY_PRINTER_H__ -#define __FREESTYLE_SCENE_PRETTY_PRINTER_H__ +#pragma once /** \file * \ingroup freestyle @@ -96,5 +95,3 @@ class ScenePrettyPrinter : public SceneVisitor { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_SCENE_PRETTY_PRINTER_H__ diff --git a/source/blender/freestyle/intern/scene_graph/SceneVisitor.h b/source/blender/freestyle/intern/scene_graph/SceneVisitor.h index 81a478e8cf3..72e0f4cbb28 100644 --- a/source/blender/freestyle/intern/scene_graph/SceneVisitor.h +++ b/source/blender/freestyle/intern/scene_graph/SceneVisitor.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_SCENE_VISITOR_H__ -#define __FREESTYLE_SCENE_VISITOR_H__ +#pragma once /** \file * \ingroup freestyle @@ -111,5 +110,3 @@ class SceneVisitor { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_SCENE_VISITOR_H__ diff --git a/source/blender/freestyle/intern/scene_graph/TriangleRep.h b/source/blender/freestyle/intern/scene_graph/TriangleRep.h index e4190faae6f..4461b38d68b 100644 --- a/source/blender/freestyle/intern/scene_graph/TriangleRep.h +++ b/source/blender/freestyle/intern/scene_graph/TriangleRep.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_TRIANGLE_REP_H__ -#define __FREESTYLE_TRIANGLE_REP_H__ +#pragma once /** \file * \ingroup freestyle @@ -142,5 +141,3 @@ class TriangleRep : public Rep { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_TRIANGLE_REP_H__ diff --git a/source/blender/freestyle/intern/scene_graph/VertexRep.h b/source/blender/freestyle/intern/scene_graph/VertexRep.h index 3831be3105a..278cfa694f7 100644 --- a/source/blender/freestyle/intern/scene_graph/VertexRep.h +++ b/source/blender/freestyle/intern/scene_graph/VertexRep.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_VERTEX_REP_H__ -#define __FREESTYLE_VERTEX_REP_H__ +#pragma once /** \file * \ingroup freestyle @@ -129,5 +128,3 @@ class VertexRep : public Rep { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_VERTEX_REP_H__ diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h index dcab48fd12f..17e419bed54 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_ADVANCED_FUNCTIONS_0D_H__ -#define __FREESTYLE_ADVANCED_FUNCTIONS_0D_H__ +#pragma once /** \file * \ingroup freestyle @@ -209,5 +208,3 @@ class GetViewMapGradientNormF0D : public UnaryFunction0D<float> { } // end of namespace Functions0D } /* namespace Freestyle */ - -#endif // __FREESTYLE_ADVANCED_FUNCTIONS_0D_H__ diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h index d14a9836b95..349db393e17 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_ADVANCED_FUNCTIONS_1D_H__ -#define __FREESTYLE_ADVANCED_FUNCTIONS_1D_H__ +#pragma once /** \file * \ingroup freestyle @@ -289,5 +288,3 @@ class GetViewMapGradientNormF1D : public UnaryFunction1D<double> { } // end of namespace Functions1D } /* namespace Freestyle */ - -#endif // __FREESTYLE_ADVANCED_FUNCTIONS_1D_H__ diff --git a/source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h b/source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h index 05fcf7f356f..25a5efcce34 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h +++ b/source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_ADVANCED_PREDICATES_1D_H__ -#define __FREESTYLE_ADVANCED_PREDICATES_1D_H__ +#pragma once /** \file * \ingroup freestyle @@ -82,5 +81,3 @@ class DensityLowerThanUP1D : public UnaryPredicate1D { } // end of namespace Predicates1D } /* namespace Freestyle */ - -#endif // __FREESTYLE_ADVANCED_PREDICATES_1D_H__ diff --git a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h index 544fdee519f..63c7d451599 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h +++ b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_ADVANCED_STROKE_SHADERS_H__ -#define __FREESTYLE_ADVANCED_STROKE_SHADERS_H__ +#pragma once /** \file * \ingroup freestyle @@ -232,5 +231,3 @@ class OmissionShader : public StrokeShader { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_ADVANCED_STROKE_SHADERS_H__ diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp index d969e0e50a3..36234ad619c 100644 --- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp @@ -37,10 +37,8 @@ #include "BKE_global.h" -extern "C" { #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" -} namespace Freestyle { diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h index 5a2d0cbe458..8663cfd42bf 100644 --- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h +++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_BASIC_STROKE_SHADERS_H__ -#define __FREESTYLE_BASIC_STROKE_SHADERS_H__ +#pragma once /** \file * \ingroup freestyle @@ -660,5 +659,3 @@ class StrokeTextureStepShader : public StrokeShader { } // end of namespace StrokeShaders } /* namespace Freestyle */ - -#endif // __FREESTYLE_BASIC_STROKE_SHADERS_H__ diff --git a/source/blender/freestyle/intern/stroke/Canvas.h b/source/blender/freestyle/intern/stroke/Canvas.h index 2a0ebbe17c5..2bbd9c2682f 100644 --- a/source/blender/freestyle/intern/stroke/Canvas.h +++ b/source/blender/freestyle/intern/stroke/Canvas.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_CANVAS_H__ -#define __FREESTYLE_CANVAS_H__ +#pragma once /** \file * \ingroup freestyle @@ -252,5 +251,3 @@ class Canvas { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_CANVAS_H__ diff --git a/source/blender/freestyle/intern/stroke/Chain.h b/source/blender/freestyle/intern/stroke/Chain.h index 7cd0c64cc16..d5dae5c35ba 100644 --- a/source/blender/freestyle/intern/stroke/Chain.h +++ b/source/blender/freestyle/intern/stroke/Chain.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_CHAIN_H__ -#define __FREESTYLE_CHAIN_H__ +#pragma once /** \file * \ingroup freestyle @@ -109,5 +108,3 @@ class Chain : public Curve { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_CHAIN_H__ diff --git a/source/blender/freestyle/intern/stroke/ChainingIterators.h b/source/blender/freestyle/intern/stroke/ChainingIterators.h index 36611a4a009..e3d49c167b5 100644 --- a/source/blender/freestyle/intern/stroke/ChainingIterators.h +++ b/source/blender/freestyle/intern/stroke/ChainingIterators.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_CHAINING_ITERATORS_H__ -#define __FREESTYLE_CHAINING_ITERATORS_H__ +#pragma once /** \file * \ingroup freestyle @@ -415,5 +414,3 @@ class ChainPredicateIterator : public ChainingIterator { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_CHAINING_ITERATORS_H__ diff --git a/source/blender/freestyle/intern/stroke/ContextFunctions.h b/source/blender/freestyle/intern/stroke/ContextFunctions.h index 6897e2b193d..334bdd657c1 100644 --- a/source/blender/freestyle/intern/stroke/ContextFunctions.h +++ b/source/blender/freestyle/intern/stroke/ContextFunctions.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_CONTEXT_FUNCTIONS_H__ -#define __FREESTYLE_CONTEXT_FUNCTIONS_H__ +#pragma once /** \file * \ingroup freestyle @@ -106,5 +105,3 @@ FEdge *GetSelectedFEdgeCF(); } // end of namespace ContextFunctions } /* namespace Freestyle */ - -#endif // __FREESTYLE_CONTEXT_FUNCTIONS_H__ diff --git a/source/blender/freestyle/intern/stroke/Curve.h b/source/blender/freestyle/intern/stroke/Curve.h index 8a233eef4ab..5f0d2a6aed7 100644 --- a/source/blender/freestyle/intern/stroke/Curve.h +++ b/source/blender/freestyle/intern/stroke/Curve.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_CURVE_H__ -#define __FREESTYLE_CURVE_H__ +#pragma once /** \file * \ingroup freestyle @@ -604,5 +603,3 @@ class Curve : public Interface1D { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_CURVE_H__ diff --git a/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h b/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h index 4ac4c04774e..1896a674477 100644 --- a/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h +++ b/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_CURVE_ADVANCED_ITERATORS_H__ -#define __FREESTYLE_CURVE_ADVANCED_ITERATORS_H__ +#pragma once /** \file * \ingroup freestyle @@ -388,5 +387,3 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr } // end of namespace CurveInternal } /* namespace Freestyle */ - -#endif // __FREESTYLE_CURVE_ADVANCED_ITERATORS_H__ diff --git a/source/blender/freestyle/intern/stroke/CurveIterators.h b/source/blender/freestyle/intern/stroke/CurveIterators.h index 3ac7ede0954..9d1cf33ed80 100644 --- a/source/blender/freestyle/intern/stroke/CurveIterators.h +++ b/source/blender/freestyle/intern/stroke/CurveIterators.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_CURVE_ITERATORS_H__ -#define __FREESTYLE_CURVE_ITERATORS_H__ +#pragma once /** \file * \ingroup freestyle @@ -303,5 +302,3 @@ class CurvePointIterator : public Interface0DIteratorNested { } // end of namespace CurveInternal } /* namespace Freestyle */ - -#endif // __FREESTYLE_CURVE_ITERATORS_H__ diff --git a/source/blender/freestyle/intern/stroke/Modifiers.h b/source/blender/freestyle/intern/stroke/Modifiers.h index ecdfd25c499..0aac6f58658 100644 --- a/source/blender/freestyle/intern/stroke/Modifiers.h +++ b/source/blender/freestyle/intern/stroke/Modifiers.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_MODIFIERS_H__ -#define __FREESTYLE_MODIFIERS_H__ +#pragma once /** \file * \ingroup freestyle @@ -71,5 +70,3 @@ template<class Edge> struct TimestampModifier : public EdgeModifier<Edge> { }; } /* namespace Freestyle */ - -#endif // MODIFIERS_H diff --git a/source/blender/freestyle/intern/stroke/Module.h b/source/blender/freestyle/intern/stroke/Module.h index 3e32361eb45..58c44751d91 100644 --- a/source/blender/freestyle/intern/stroke/Module.h +++ b/source/blender/freestyle/intern/stroke/Module.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_MODULE_H__ -#define __FREESTYLE_MODULE_H__ +#pragma once /** \file * \ingroup freestyle @@ -76,5 +75,3 @@ class Module { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_MODULE_H__ diff --git a/source/blender/freestyle/intern/stroke/Operators.h b/source/blender/freestyle/intern/stroke/Operators.h index 2da9d30f172..e721e9fb837 100644 --- a/source/blender/freestyle/intern/stroke/Operators.h +++ b/source/blender/freestyle/intern/stroke/Operators.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_OPERATORS_H__ -#define __FREESTYLE_OPERATORS_H__ +#pragma once /** \file * \ingroup freestyle @@ -290,5 +289,3 @@ class Operators { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_OPERATORS_H__ diff --git a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h index 7ddd3d3e4c0..78aa17d26b6 100644 --- a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h +++ b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_PS_STROKE_RENDERER_H__ -#define __FREESTYLE_PS_STROKE_RENDERER_H__ +#pragma once /** \file * \ingroup freestyle @@ -55,5 +54,3 @@ class PSStrokeRenderer : public StrokeRenderer { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_PS_STROKE_RENDERER_H__ diff --git a/source/blender/freestyle/intern/stroke/Predicates0D.h b/source/blender/freestyle/intern/stroke/Predicates0D.h index 90b6d99f2db..89dbaeb339d 100644 --- a/source/blender/freestyle/intern/stroke/Predicates0D.h +++ b/source/blender/freestyle/intern/stroke/Predicates0D.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_PREDICATES_0D_H__ -#define __FREESTYLE_PREDICATES_0D_H__ +#pragma once /** \file * \ingroup freestyle @@ -178,5 +177,3 @@ class FalseUP0D : public UnaryPredicate0D { } // end of namespace Predicates0D } /* namespace Freestyle */ - -#endif // __FREESTYLE_PREDICATES_0D_H__ diff --git a/source/blender/freestyle/intern/stroke/Predicates1D.h b/source/blender/freestyle/intern/stroke/Predicates1D.h index 0ad4c69f869..a3953950d86 100644 --- a/source/blender/freestyle/intern/stroke/Predicates1D.h +++ b/source/blender/freestyle/intern/stroke/Predicates1D.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_PREDICATES_1D_H__ -#define __FREESTYLE_PREDICATES_1D_H__ +#pragma once /** \file * \ingroup freestyle @@ -580,5 +579,3 @@ class ViewMapGradientNormBP1D : public BinaryPredicate1D { } // end of namespace Predicates1D } /* namespace Freestyle */ - -#endif // __FREESTYLE_PREDICATES_1D_H__ diff --git a/source/blender/freestyle/intern/stroke/QInformationMap.h b/source/blender/freestyle/intern/stroke/QInformationMap.h index d3a4218f9d7..0f651a656bf 100644 --- a/source/blender/freestyle/intern/stroke/QInformationMap.h +++ b/source/blender/freestyle/intern/stroke/QInformationMap.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_Q_INFORMATION_MAP_H__ -#define __FREESTYLE_Q_INFORMATION_MAP_H__ +#pragma once /** \file * \ingroup freestyle @@ -59,5 +58,3 @@ class QInformationMap : public InformationMap { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_Q_INFORMATION_MAP_H__ diff --git a/source/blender/freestyle/intern/stroke/Stroke.h b/source/blender/freestyle/intern/stroke/Stroke.h index 7983e8cdde2..71753b25328 100644 --- a/source/blender/freestyle/intern/stroke/Stroke.h +++ b/source/blender/freestyle/intern/stroke/Stroke.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_STROKE_H__ -#define __FREESTYLE_STROKE_H__ +#pragma once /** \file * \ingroup freestyle @@ -894,5 +893,3 @@ Stroke::Stroke(InputVertexIterator iBegin, InputVertexIterator iEnd) } } /* namespace Freestyle */ - -#endif // __FREESTYLE_STROKE_H__ diff --git a/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h b/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h index b8c96533a1c..4256cdebe86 100644 --- a/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h +++ b/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_STROKE_ADVANCED_ITERATORS_H__ -#define __FREESTYLE_STROKE_ADVANCED_ITERATORS_H__ +#pragma once /** \file * \ingroup freestyle @@ -179,5 +178,3 @@ class vertex_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTa } // end of namespace StrokeInternal } /* namespace Freestyle */ - -#endif // __FREESTYLE_STROKE_ADVANCED_ITERATORS_H__ diff --git a/source/blender/freestyle/intern/stroke/StrokeIO.h b/source/blender/freestyle/intern/stroke/StrokeIO.h index ae38847f8cc..a0e59655eed 100644 --- a/source/blender/freestyle/intern/stroke/StrokeIO.h +++ b/source/blender/freestyle/intern/stroke/StrokeIO.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_STROKE_IO_H__ -#define __FREESTYLE_STROKE_IO_H__ +#pragma once /** \file * \ingroup freestyle @@ -37,5 +36,3 @@ ostream &operator<<(ostream &out, const StrokeVertex &iStrokeVertex); ostream &operator<<(ostream &out, const Stroke &iStroke); } /* namespace Freestyle */ - -#endif // __FREESTYLE_STROKE_IO_H__ diff --git a/source/blender/freestyle/intern/stroke/StrokeIterators.h b/source/blender/freestyle/intern/stroke/StrokeIterators.h index 71932d8487a..d4cbffd535e 100644 --- a/source/blender/freestyle/intern/stroke/StrokeIterators.h +++ b/source/blender/freestyle/intern/stroke/StrokeIterators.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_STROKE_ITERATORS_H__ -#define __FREESTYLE_STROKE_ITERATORS_H__ +#pragma once /** \file * \ingroup freestyle @@ -232,5 +231,3 @@ class StrokeVertexIterator : public Interface0DIteratorNested { } // end of namespace StrokeInternal } /* namespace Freestyle */ - -#endif // __FREESTYLE_STROKE_ITERATORS_H__ diff --git a/source/blender/freestyle/intern/stroke/StrokeLayer.h b/source/blender/freestyle/intern/stroke/StrokeLayer.h index ecb98025875..2101e7732ce 100644 --- a/source/blender/freestyle/intern/stroke/StrokeLayer.h +++ b/source/blender/freestyle/intern/stroke/StrokeLayer.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_STROKE_LAYER_H__ -#define __FREESTYLE_STROKE_LAYER_H__ +#pragma once /** \file * \ingroup freestyle @@ -102,5 +101,3 @@ class StrokeLayer { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_STROKE_LAYER_H__ diff --git a/source/blender/freestyle/intern/stroke/StrokeRenderer.h b/source/blender/freestyle/intern/stroke/StrokeRenderer.h index 67deb5eebf3..2fb08b880d9 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRenderer.h +++ b/source/blender/freestyle/intern/stroke/StrokeRenderer.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_STROKE_RENDERER_H__ -#define __FREESTYLE_STROKE_RENDERER_H__ +#pragma once /** \file * \ingroup freestyle @@ -142,5 +141,3 @@ class StrokeRenderer { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_STROKE_RENDERER_H__ diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.h b/source/blender/freestyle/intern/stroke/StrokeRep.h index d6ee1d01279..09048b8e147 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRep.h +++ b/source/blender/freestyle/intern/stroke/StrokeRep.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_STROKE_REP_H__ -#define __FREESTYLE_STROKE_REP_H__ +#pragma once /** \file * \ingroup freestyle @@ -278,5 +277,3 @@ class StrokeRep { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_STROKE_REP_H__ diff --git a/source/blender/freestyle/intern/stroke/StrokeShader.h b/source/blender/freestyle/intern/stroke/StrokeShader.h index 7b1f12a8c9d..f4984136747 100644 --- a/source/blender/freestyle/intern/stroke/StrokeShader.h +++ b/source/blender/freestyle/intern/stroke/StrokeShader.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_STROKE_SHADERS_H__ -#define __FREESTYLE_STROKE_SHADERS_H__ +#pragma once /** \file * \ingroup freestyle @@ -96,5 +95,3 @@ class StrokeShader { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_STROKE_SHADERS_H__ diff --git a/source/blender/freestyle/intern/stroke/StrokeTesselator.h b/source/blender/freestyle/intern/stroke/StrokeTesselator.h index 8cece705ed4..0c1efb873bc 100644 --- a/source/blender/freestyle/intern/stroke/StrokeTesselator.h +++ b/source/blender/freestyle/intern/stroke/StrokeTesselator.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_STROKE_TESSELATOR_H__ -#define __FREESTYLE_STROKE_TESSELATOR_H__ +#pragma once /** \file * \ingroup freestyle @@ -73,5 +72,3 @@ class StrokeTesselator { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_STROKE_TESSELATOR_H__ diff --git a/source/blender/freestyle/intern/stroke/StyleModule.h b/source/blender/freestyle/intern/stroke/StyleModule.h index 6f03d903045..398e4c7ee77 100644 --- a/source/blender/freestyle/intern/stroke/StyleModule.h +++ b/source/blender/freestyle/intern/stroke/StyleModule.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_STYLE_MODULE_H__ -#define __FREESTYLE_STYLE_MODULE_H__ +#pragma once /** \file * \ingroup freestyle @@ -182,5 +181,3 @@ class StyleModule { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_STYLE_MODULE_H__ diff --git a/source/blender/freestyle/intern/system/BaseIterator.h b/source/blender/freestyle/intern/system/BaseIterator.h index 651f2bf4387..7792fded4cb 100644 --- a/source/blender/freestyle/intern/system/BaseIterator.h +++ b/source/blender/freestyle/intern/system/BaseIterator.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_BASE_ITERATOR_H__ -#define __FREESTYLE_BASE_ITERATOR_H__ +#pragma once /** \file * \ingroup freestyle @@ -103,5 +102,3 @@ template<class Traits, class IteratorTagTraits> class IteratorBase { }; } /* namespace Freestyle */ - -#endif // BASEITERATOR_H diff --git a/source/blender/freestyle/intern/system/BaseObject.h b/source/blender/freestyle/intern/system/BaseObject.h index 335221223dc..76d30aa74e2 100644 --- a/source/blender/freestyle/intern/system/BaseObject.h +++ b/source/blender/freestyle/intern/system/BaseObject.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_BASE_OBJECT_H__ -#define __FREESTYLE_BASE_OBJECT_H__ +#pragma once /** \file * \ingroup freestyle @@ -72,5 +71,3 @@ class BaseObject { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_BASE_OBJECT_H__ diff --git a/source/blender/freestyle/intern/system/Cast.h b/source/blender/freestyle/intern/system/Cast.h index 44fd86a9b43..db0defbae22 100644 --- a/source/blender/freestyle/intern/system/Cast.h +++ b/source/blender/freestyle/intern/system/Cast.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_CAST_H__ -#define __FREESTYLE_CAST_H__ +#pragma once /** \file * \ingroup freestyle @@ -35,5 +34,3 @@ template<class T, class U> U *cast(T *in) } // end of namespace Cast } /* namespace Freestyle */ - -#endif // __FREESTYLE_CAST_H__ diff --git a/source/blender/freestyle/intern/system/Exception.h b/source/blender/freestyle/intern/system/Exception.h index 0efd136af8f..618c2171fb9 100644 --- a/source/blender/freestyle/intern/system/Exception.h +++ b/source/blender/freestyle/intern/system/Exception.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_EXCEPTION_H__ -#define __FREESTYLE_EXCEPTION_H__ +#pragma once /** \file * \ingroup freestyle @@ -62,5 +61,3 @@ class Exception { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_EXCEPTION_H__ diff --git a/source/blender/freestyle/intern/system/FreestyleConfig.h b/source/blender/freestyle/intern/system/FreestyleConfig.h index 34db7121eaf..032da864e6c 100644 --- a/source/blender/freestyle/intern/system/FreestyleConfig.h +++ b/source/blender/freestyle/intern/system/FreestyleConfig.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_CONFIG_H__ -#define __FREESTYLE_CONFIG_H__ +#pragma once /** \file * \ingroup freestyle @@ -43,5 +42,3 @@ static const string PATH_SEP(":"); } // end of namespace Config } /* namespace Freestyle */ - -#endif // __FREESTYLE_CONFIG_H__ diff --git a/source/blender/freestyle/intern/system/Id.h b/source/blender/freestyle/intern/system/Id.h index 549def6cabb..f94e044de29 100644 --- a/source/blender/freestyle/intern/system/Id.h +++ b/source/blender/freestyle/intern/system/Id.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_ID_H__ -#define __FREESTYLE_ID_H__ +#pragma once /** \file * \ingroup freestyle @@ -138,5 +137,3 @@ inline std::ostream &operator<<(std::ostream &s, const Id &id) } } /* namespace Freestyle */ - -#endif // __FREESTYLE_ID_H__ diff --git a/source/blender/freestyle/intern/system/Interpreter.h b/source/blender/freestyle/intern/system/Interpreter.h index 911d03318e5..0a5c0302fe6 100644 --- a/source/blender/freestyle/intern/system/Interpreter.h +++ b/source/blender/freestyle/intern/system/Interpreter.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_INTERPRETER_H__ -#define __FREESTYLE_INTERPRETER_H__ +#pragma once /** \file * \ingroup freestyle @@ -61,5 +60,3 @@ class Interpreter { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_INTERPRETER_H__ diff --git a/source/blender/freestyle/intern/system/Iterator.h b/source/blender/freestyle/intern/system/Iterator.h index 75d49521f96..d2086f637d9 100644 --- a/source/blender/freestyle/intern/system/Iterator.h +++ b/source/blender/freestyle/intern/system/Iterator.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_ITERATOR_H__ -#define __FREESTYLE_ITERATOR_H__ +#pragma once /** \file * \ingroup freestyle @@ -73,5 +72,3 @@ class Iterator { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_ITERATOR_H__ diff --git a/source/blender/freestyle/intern/system/PointerSequence.h b/source/blender/freestyle/intern/system/PointerSequence.h index d136632f060..c2301ee740d 100644 --- a/source/blender/freestyle/intern/system/PointerSequence.h +++ b/source/blender/freestyle/intern/system/PointerSequence.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_POINTER_SEQUENCE_H__ -#define __FREESTYLE_POINTER_SEQUENCE_H__ +#pragma once /** \file * \ingroup freestyle @@ -91,5 +90,3 @@ template<typename C, typename T> class PointerSequence : public C { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_POINTER_SEQUENCE_H__ diff --git a/source/blender/freestyle/intern/system/Precision.h b/source/blender/freestyle/intern/system/Precision.h index c6695f207cc..6a6435299ca 100644 --- a/source/blender/freestyle/intern/system/Precision.h +++ b/source/blender/freestyle/intern/system/Precision.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_PRECISION_H__ -#define __FREESTYLE_PRECISION_H__ +#pragma once /** \file * \ingroup freestyle @@ -31,5 +30,3 @@ static const real M_EPSILON = 0.00000001; #endif // SWIG } /* namespace Freestyle */ - -#endif // __FREESTYLE_PRECISION_H__ diff --git a/source/blender/freestyle/intern/system/ProgressBar.h b/source/blender/freestyle/intern/system/ProgressBar.h index b3a1f98f15e..d7b02c48359 100644 --- a/source/blender/freestyle/intern/system/ProgressBar.h +++ b/source/blender/freestyle/intern/system/ProgressBar.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_PROGRESS_BAR_H__ -#define __FREESTYLE_PROGRESS_BAR_H__ +#pragma once /** \file * \ingroup freestyle @@ -92,5 +91,3 @@ class ProgressBar { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_PROGRESS_BAR_H__ diff --git a/source/blender/freestyle/intern/system/PseudoNoise.h b/source/blender/freestyle/intern/system/PseudoNoise.h index 53fe54754c8..38270016675 100644 --- a/source/blender/freestyle/intern/system/PseudoNoise.h +++ b/source/blender/freestyle/intern/system/PseudoNoise.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_PSEUDO_NOISE_H__ -#define __FREESTYLE_PSEUDO_NOISE_H__ +#pragma once /** \file * \ingroup freestyle @@ -56,5 +55,3 @@ class PseudoNoise { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_PSEUDO_NOISE_H__ diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.h b/source/blender/freestyle/intern/system/PythonInterpreter.h index 4bc6ba9db38..bae69aa0a42 100644 --- a/source/blender/freestyle/intern/system/PythonInterpreter.h +++ b/source/blender/freestyle/intern/system/PythonInterpreter.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_PYTHON_INTERPRETER_H__ -#define __FREESTYLE_PYTHON_INTERPRETER_H__ +#pragma once /** \file * \ingroup freestyle @@ -34,7 +33,6 @@ extern "C" { #include "MEM_guardedalloc.h" // soc -extern "C" { #include "DNA_text_types.h" #include "BKE_context.h" @@ -47,7 +45,6 @@ extern "C" { #include "BPY_extern.h" #include "bpy_capi_utils.h" -} namespace Freestyle { @@ -149,5 +146,3 @@ class PythonInterpreter : public Interpreter { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_PYTHON_INTERPRETER_H__ diff --git a/source/blender/freestyle/intern/system/RandGen.h b/source/blender/freestyle/intern/system/RandGen.h index 43f36b0a2fd..e514f4cfc9f 100644 --- a/source/blender/freestyle/intern/system/RandGen.h +++ b/source/blender/freestyle/intern/system/RandGen.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_RAND_GEN_H__ -#define __FREESTYLE_RAND_GEN_H__ +#pragma once /** \file * \ingroup freestyle @@ -46,5 +45,3 @@ class RandGen { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_RAND_GEN_H__ diff --git a/source/blender/freestyle/intern/system/RenderMonitor.h b/source/blender/freestyle/intern/system/RenderMonitor.h index 709df6c2d8e..5d543f32dfb 100644 --- a/source/blender/freestyle/intern/system/RenderMonitor.h +++ b/source/blender/freestyle/intern/system/RenderMonitor.h @@ -14,17 +14,14 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_RENDER_MONITOR_H__ -#define __FREESTYLE_RENDER_MONITOR_H__ +#pragma once /** \file * \ingroup freestyle * \brief Classes defining the basic "Iterator" design pattern */ -extern "C" { #include "render_types.h" -} #ifdef WITH_CXX_GUARDEDALLOC # include "MEM_guardedalloc.h" @@ -73,5 +70,3 @@ class RenderMonitor { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_RENDER_MONITOR_H__ diff --git a/source/blender/freestyle/intern/system/StringUtils.h b/source/blender/freestyle/intern/system/StringUtils.h index aeacddd64c8..dc63f20f294 100644 --- a/source/blender/freestyle/intern/system/StringUtils.h +++ b/source/blender/freestyle/intern/system/StringUtils.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_STRING_UTILS_H__ -#define __FREESTYLE_STRING_UTILS_H__ +#pragma once /** \file * \ingroup freestyle @@ -28,10 +27,8 @@ #include <string> #include <vector> -extern "C" { #include "BLI_path_util.h" #include "BLI_string.h" -} using namespace std; @@ -52,5 +49,3 @@ struct ltstr { } // end of namespace StringUtils } /* namespace Freestyle */ - -#endif // __FREESTYLE_STRING_UTILS_H__ diff --git a/source/blender/freestyle/intern/system/TimeStamp.h b/source/blender/freestyle/intern/system/TimeStamp.h index 2fbf83d226d..5560bf8be8d 100644 --- a/source/blender/freestyle/intern/system/TimeStamp.h +++ b/source/blender/freestyle/intern/system/TimeStamp.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_TIME_STAMP_H__ -#define __FREESTYLE_TIME_STAMP_H__ +#pragma once /** \file * \ingroup freestyle @@ -70,5 +69,3 @@ class TimeStamp { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_TIME_STAMP_H__ diff --git a/source/blender/freestyle/intern/system/TimeUtils.h b/source/blender/freestyle/intern/system/TimeUtils.h index 6d4c56ab15e..3c8a28e9e43 100644 --- a/source/blender/freestyle/intern/system/TimeUtils.h +++ b/source/blender/freestyle/intern/system/TimeUtils.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_TIME_UTILS_H__ -#define __FREESTYLE_TIME_UTILS_H__ +#pragma once /** \file * \ingroup freestyle @@ -60,5 +59,3 @@ class Chronometer { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_TIME_UTILS_H__ diff --git a/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.h b/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.h index 97aae3d653c..c2d843742df 100644 --- a/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.h +++ b/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_ARBITRARY_GRID_DENSITY_PROVIDER_H__ -#define __FREESTYLE_ARBITRARY_GRID_DENSITY_PROVIDER_H__ +#pragma once /** \file * \ingroup freestyle @@ -66,5 +65,3 @@ class ArbitraryGridDensityProviderFactory : public GridDensityProviderFactory { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_ARBITRARY_GRID_DENSITY_PROVIDER_H__ diff --git a/source/blender/freestyle/intern/view_map/AutoPtrHelper.h b/source/blender/freestyle/intern/view_map/AutoPtrHelper.h index fb2a9d73d13..94fd80bc0fb 100644 --- a/source/blender/freestyle/intern/view_map/AutoPtrHelper.h +++ b/source/blender/freestyle/intern/view_map/AutoPtrHelper.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_AUTOPTR_HELPER_H__ -#define __FREESTYLE_AUTOPTR_HELPER_H__ +#pragma once /** \file * \ingroup freestyle @@ -47,5 +46,3 @@ template<typename T> class AutoPtr : public std::unique_ptr<T> { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_AUTOPTR_HELPER_H__ diff --git a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.h b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.h index f530cf35569..5336cc1ff97 100644 --- a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.h +++ b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_AVERAGE_AREA_GRID_DENSITY_PROVIDER_H__ -#define __FREESTYLE_AVERAGE_AREA_GRID_DENSITY_PROVIDER_H__ +#pragma once /** \file * \ingroup freestyle @@ -63,5 +62,3 @@ class AverageAreaGridDensityProviderFactory : public GridDensityProviderFactory }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_AVERAGE_AREA_GRID_DENSITY_PROVIDER_H__ diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.h b/source/blender/freestyle/intern/view_map/BoxGrid.h index 35b5e4d6b55..581ee0a2340 100644 --- a/source/blender/freestyle/intern/view_map/BoxGrid.h +++ b/source/blender/freestyle/intern/view_map/BoxGrid.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_BOX_GRID_H__ -#define __FREESTYLE_BOX_GRID_H__ +#pragma once /** \file * \ingroup freestyle @@ -422,5 +421,3 @@ inline bool BoxGrid::insertOccluder(OccluderSource &source, OccluderData *&occlu } } /* namespace Freestyle */ - -#endif // __FREESTYLE_BOX_GRID_H__ diff --git a/source/blender/freestyle/intern/view_map/CulledOccluderSource.h b/source/blender/freestyle/intern/view_map/CulledOccluderSource.h index 3457fb6ca10..2bb77bad0f7 100644 --- a/source/blender/freestyle/intern/view_map/CulledOccluderSource.h +++ b/source/blender/freestyle/intern/view_map/CulledOccluderSource.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_CULLED_OCCLUDER_SOURCE_H__ -#define __FREESTYLE_CULLED_OCCLUDER_SOURCE_H__ +#pragma once /** \file * \ingroup freestyle @@ -57,5 +56,3 @@ class CulledOccluderSource : public OccluderSource { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_CULLED_OCCLUDER_SOURCE_H__ diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h index 2bcf2d3bee8..c4115ee00c4 100644 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_FEDGE_X_DETECTOR_H__ -#define __FREESTYLE_FEDGE_X_DETECTOR_H__ +#pragma once /** \file * \ingroup freestyle @@ -246,5 +245,3 @@ class FEdgeXDetector { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_FEDGE_X_DETECTOR_H__ diff --git a/source/blender/freestyle/intern/view_map/Functions0D.h b/source/blender/freestyle/intern/view_map/Functions0D.h index 7149c1909fd..0364069b631 100644 --- a/source/blender/freestyle/intern/view_map/Functions0D.h +++ b/source/blender/freestyle/intern/view_map/Functions0D.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_FUNCTIONS_0D_H__ -#define __FREESTYLE_FUNCTIONS_0D_H__ +#pragma once /** \file * \ingroup freestyle @@ -509,5 +508,3 @@ ViewShape *getOccludeeF0D(Interface0DIterator &it); } // end of namespace Functions0D } /* namespace Freestyle */ - -#endif // __FREESTYLE_FUNCTIONS_0D_H__ diff --git a/source/blender/freestyle/intern/view_map/Functions1D.h b/source/blender/freestyle/intern/view_map/Functions1D.h index 20aa9f2a27f..9cf5527ee19 100644 --- a/source/blender/freestyle/intern/view_map/Functions1D.h +++ b/source/blender/freestyle/intern/view_map/Functions1D.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_FUNCTIONS_1D_H__ -#define __FREESTYLE_FUNCTIONS_1D_H__ +#pragma once /** \file * \ingroup freestyle @@ -638,5 +637,3 @@ void getShapeF1D(Interface1D &inter, set<ViewShape *> &oShapes); } // end of namespace Functions1D } /* namespace Freestyle */ - -#endif // __FREESTYLE_FUNCTIONS_1D_H__ diff --git a/source/blender/freestyle/intern/view_map/GridDensityProvider.h b/source/blender/freestyle/intern/view_map/GridDensityProvider.h index 290d5b0cfba..e663f14d368 100644 --- a/source/blender/freestyle/intern/view_map/GridDensityProvider.h +++ b/source/blender/freestyle/intern/view_map/GridDensityProvider.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_GRID_DENSITY_PROVIDER_H__ -#define __FREESTYLE_GRID_DENSITY_PROVIDER_H__ +#pragma once /** \file * \ingroup freestyle @@ -167,5 +166,3 @@ class GridDensityProviderFactory { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_GRID_DENSITY_PROVIDER_H__ diff --git a/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.h b/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.h index b32a284cb61..0ce62572092 100644 --- a/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.h +++ b/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_HEURISTIC_GRID_DENSITY_PROVIDER_FACTORY_H__ -#define __FREESTYLE_HEURISTIC_GRID_DENSITY_PROVIDER_FACTORY_H__ +#pragma once /** \file * \ingroup freestyle @@ -48,5 +47,3 @@ class HeuristicGridDensityProviderFactory : public GridDensityProviderFactory { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_HEURISTIC_GRID_DENSITY_PROVIDER_FACTORY_H__ diff --git a/source/blender/freestyle/intern/view_map/Interface0D.h b/source/blender/freestyle/intern/view_map/Interface0D.h index 724a98f047f..6b4682cc862 100644 --- a/source/blender/freestyle/intern/view_map/Interface0D.h +++ b/source/blender/freestyle/intern/view_map/Interface0D.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_INTERFACE_0D_H__ -#define __FREESTYLE_INTERFACE_0D_H__ +#pragma once /** \file * \ingroup freestyle @@ -341,5 +340,3 @@ class Interface0DIterator : public Iterator { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_INTERFACE_0D_H__ diff --git a/source/blender/freestyle/intern/view_map/Interface1D.h b/source/blender/freestyle/intern/view_map/Interface1D.h index ab489bff4c9..778deb20a60 100644 --- a/source/blender/freestyle/intern/view_map/Interface1D.h +++ b/source/blender/freestyle/intern/view_map/Interface1D.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_INTERFACE_1D_H__ -#define __FREESTYLE_INTERFACE_1D_H__ +#pragma once /** \file * \ingroup freestyle @@ -203,5 +202,3 @@ class Interface1D { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_INTERFACE_1D_H__ diff --git a/source/blender/freestyle/intern/view_map/OccluderSource.h b/source/blender/freestyle/intern/view_map/OccluderSource.h index 07df3b95347..befde3c1b1b 100644 --- a/source/blender/freestyle/intern/view_map/OccluderSource.h +++ b/source/blender/freestyle/intern/view_map/OccluderSource.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_OCCLUDER_SOURCE_H__ -#define __FREESTYLE_OCCLUDER_SOURCE_H__ +#pragma once /** \file * \ingroup freestyle @@ -70,5 +69,3 @@ class OccluderSource { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_OCCLUDER_SOURCE_H__ diff --git a/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.h b/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.h index 52d57e3030e..fec869e0665 100644 --- a/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.h +++ b/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_POW_23_GRID_DENSITY_PROVIDER_H__ -#define __FREESTYLE_POW_23_GRID_DENSITY_PROVIDER_H__ +#pragma once /** \file * \ingroup freestyle @@ -64,5 +63,3 @@ class Pow23GridDensityProviderFactory : public GridDensityProviderFactory { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_POW_23_GRID_DENSITY_PROVIDER_H__ diff --git a/source/blender/freestyle/intern/view_map/Silhouette.h b/source/blender/freestyle/intern/view_map/Silhouette.h index 8503836e0ca..6463cd7eb3e 100644 --- a/source/blender/freestyle/intern/view_map/Silhouette.h +++ b/source/blender/freestyle/intern/view_map/Silhouette.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_SILHOUETTE_H__ -#define __FREESTYLE_SILHOUETTE_H__ +#pragma once /** \file * \ingroup freestyle @@ -1958,5 +1957,3 @@ class SShape { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_SILHOUETTE_H__ diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h index 79d863e81e7..124ef35e5b9 100644 --- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h +++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_SILHOUETTE_GEOM_ENGINE_H__ -#define __FREESTYLE_SILHOUETTE_GEOM_ENGINE_H__ +#pragma once /** \file * \ingroup freestyle @@ -135,5 +134,3 @@ class SilhouetteGeomEngine { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_SILHOUETTE_GEOM_ENGINE_H__ diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.h b/source/blender/freestyle/intern/view_map/SphericalGrid.h index e9074580fb9..0ef68d073ae 100644 --- a/source/blender/freestyle/intern/view_map/SphericalGrid.h +++ b/source/blender/freestyle/intern/view_map/SphericalGrid.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_SPHERICAL_GRID_H__ -#define __FREESTYLE_SPHERICAL_GRID_H__ +#pragma once /** \file * \ingroup freestyle @@ -434,5 +433,3 @@ inline bool SphericalGrid::insertOccluder(OccluderSource &source, OccluderData * } } /* namespace Freestyle */ - -#endif // __FREESTYLE_SPHERICAL_GRID_H__ diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.h b/source/blender/freestyle/intern/view_map/SteerableViewMap.h index 537f07f44f4..65633fd85d4 100644 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.h +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_STEERABLE_VIEW_MAP_H__ -#define __FREESTYLE_STEERABLE_VIEW_MAP_H__ +#pragma once /** \file * \ingroup freestyle @@ -156,5 +155,3 @@ class SteerableViewMap { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_STEERABLE_VIEW_MAP_H__ diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h index b1934d08376..f6f54a2d87d 100644 --- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h +++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_VIEW_EDGE_X_BUILDER_H__ -#define __FREESTYLE_VIEW_EDGE_X_BUILDER_H__ +#pragma once /** \file * \ingroup freestyle @@ -292,5 +291,3 @@ class ViewEdgeXBuilder { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_VIEW_EDGE_X_BUILDER_H__ diff --git a/source/blender/freestyle/intern/view_map/ViewMap.h b/source/blender/freestyle/intern/view_map/ViewMap.h index 83c45be8c61..e5e49f17ca5 100644 --- a/source/blender/freestyle/intern/view_map/ViewMap.h +++ b/source/blender/freestyle/intern/view_map/ViewMap.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_VIEW_MAP_H__ -#define __FREESTYLE_VIEW_MAP_H__ +#pragma once /** \file * \ingroup freestyle @@ -1830,5 +1829,3 @@ inline real ViewEdge::curvature2d_as_angle(int iCombination) const #endif } /* namespace Freestyle */ - -#endif // __FREESTYLE_VIEW_MAP_H__ diff --git a/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h b/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h index 2ff46e353f3..25d8439173b 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h +++ b/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_VIEW_MAP_ADVANCED_ITERATORS_H__ -#define __FREESTYLE_VIEW_MAP_ADVANCED_ITERATORS_H__ +#pragma once /** \file * \ingroup freestyle @@ -816,5 +815,3 @@ class vertex_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTa } // end of namespace ViewEdgeInternal } /* namespace Freestyle */ - -#endif // __FREESTYLE_VIEW_MAP_ADVANCED_ITERATORS_H__ diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.h b/source/blender/freestyle/intern/view_map/ViewMapBuilder.h index a5d967af331..6d919f5561a 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.h +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_VIEW_MAP_BUILDER_H__ -#define __FREESTYLE_VIEW_MAP_BUILDER_H__ +#pragma once /** \file * \ingroup freestyle @@ -284,5 +283,3 @@ class ViewMapBuilder { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_VIEW_MAP_BUILDER_H__ diff --git a/source/blender/freestyle/intern/view_map/ViewMapIO.h b/source/blender/freestyle/intern/view_map/ViewMapIO.h index 98d27852c8d..e4c42c094d0 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapIO.h +++ b/source/blender/freestyle/intern/view_map/ViewMapIO.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_VIEW_MAP_IO_H__ -#define __FREESTYLE_VIEW_MAP_IO_H__ +#pragma once /** \file * \ingroup freestyle @@ -102,5 +101,3 @@ template<> istream &read<0>(istream &in, char *) } // End of namespace ViewMapIO } /* namespace Freestyle */ - -#endif // __FREESTYLE_VIEW_MAP_IO_H__ diff --git a/source/blender/freestyle/intern/view_map/ViewMapIterators.h b/source/blender/freestyle/intern/view_map/ViewMapIterators.h index 174e25896cc..9956d47469d 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapIterators.h +++ b/source/blender/freestyle/intern/view_map/ViewMapIterators.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_VIEW_MAP_ITERATORS_H__ -#define __FREESTYLE_VIEW_MAP_ITERATORS_H__ +#pragma once /** \file * \ingroup freestyle @@ -590,5 +589,3 @@ class ViewEdgeIterator : public Iterator { } // end of namespace ViewEdgeInternal } /* namespace Freestyle */ - -#endif // __FREESTYLE_VIEW_MAP_ITERATORS_H__ diff --git a/source/blender/freestyle/intern/view_map/ViewMapTesselator.h b/source/blender/freestyle/intern/view_map/ViewMapTesselator.h index b6bf51618d8..c6690b1d9dc 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapTesselator.h +++ b/source/blender/freestyle/intern/view_map/ViewMapTesselator.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_VIEW_MAP_TESSELATOR_H__ -#define __FREESTYLE_VIEW_MAP_TESSELATOR_H__ +#pragma once /** \file * \ingroup freestyle @@ -225,5 +224,3 @@ NodeGroup *ViewMapTesselator::Tesselate(ViewEdgesIterator begin, ViewEdgesIterat } } /* namespace Freestyle */ - -#endif // __FREESTYLE_VIEW_MAP_TESSELATOR_H__ diff --git a/source/blender/freestyle/intern/winged_edge/Curvature.h b/source/blender/freestyle/intern/winged_edge/Curvature.h index 32e9ea8b5cf..9ecc92df2ac 100644 --- a/source/blender/freestyle/intern/winged_edge/Curvature.h +++ b/source/blender/freestyle/intern/winged_edge/Curvature.h @@ -27,8 +27,7 @@ * FRANCE */ -#ifndef __FREESTYLE_CURVATURE_H__ -#define __FREESTYLE_CURVATURE_H__ +#pragma once /** \file * \ingroup freestyle @@ -142,5 +141,3 @@ void compute_curvature_tensor_one_ring(WVertex *start, NormalCycle &nc); } // namespace OGF } /* namespace Freestyle */ - -#endif /* __FREESTYLE_CURVATURE_H__ */ diff --git a/source/blender/freestyle/intern/winged_edge/Nature.h b/source/blender/freestyle/intern/winged_edge/Nature.h index 91f9f63b412..68323d7122c 100644 --- a/source/blender/freestyle/intern/winged_edge/Nature.h +++ b/source/blender/freestyle/intern/winged_edge/Nature.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_NATURE_H__ -#define __FREESTYLE_NATURE_H__ +#pragma once /** \file * \ingroup freestyle @@ -67,5 +66,3 @@ static const EdgeNature EDGE_MARK = (1 << 7); // 128 } // end of namespace Nature } /* namespace Freestyle */ - -#endif // __FREESTYLE_NATURE_H__ diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.h b/source/blender/freestyle/intern/winged_edge/WEdge.h index 424cd76a6b7..42a8e62990f 100644 --- a/source/blender/freestyle/intern/winged_edge/WEdge.h +++ b/source/blender/freestyle/intern/winged_edge/WEdge.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_W_EDGE_H__ -#define __FREESTYLE_W_EDGE_H__ +#pragma once /** \file * \ingroup freestyle @@ -1428,5 +1427,3 @@ inline void WOEdge::setVecAndAngle() } } /* namespace Freestyle */ - -#endif // __FREESTYLE_W_EDGE_H__ diff --git a/source/blender/freestyle/intern/winged_edge/WFillGrid.h b/source/blender/freestyle/intern/winged_edge/WFillGrid.h index 918c1f154f3..095a58675c0 100644 --- a/source/blender/freestyle/intern/winged_edge/WFillGrid.h +++ b/source/blender/freestyle/intern/winged_edge/WFillGrid.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_W_FILL_GRID_H__ -#define __FREESTYLE_W_FILL_GRID_H__ +#pragma once /** \file * \ingroup freestyle @@ -85,5 +84,3 @@ class WFillGrid { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_W_FILL_GRID_H__ diff --git a/source/blender/freestyle/intern/winged_edge/WSFillGrid.h b/source/blender/freestyle/intern/winged_edge/WSFillGrid.h index e3deebcd6c2..5393f57d2cd 100644 --- a/source/blender/freestyle/intern/winged_edge/WSFillGrid.h +++ b/source/blender/freestyle/intern/winged_edge/WSFillGrid.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_WS_FILL_GRID_H__ -#define __FREESTYLE_WS_FILL_GRID_H__ +#pragma once /** \file * \ingroup freestyle @@ -81,5 +80,3 @@ class WSFillGrid { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_WS_FILL_GRID_H__ diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.h b/source/blender/freestyle/intern/winged_edge/WXEdge.h index 21418c44614..8fe99f9bb93 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdge.h +++ b/source/blender/freestyle/intern/winged_edge/WXEdge.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_WX_EDGE_H__ -#define __FREESTYLE_WX_EDGE_H__ +#pragma once /** \file * \ingroup freestyle @@ -845,5 +844,3 @@ bool WXVertex::isFeature() } } /* namespace Freestyle */ - -#endif // __FREESTYLE_WX_EDGE_H__ diff --git a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h index d223cee5e0e..efba18eb084 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h +++ b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_WX_EDGE_BUILDER_H__ -#define __FREESTYLE_WX_EDGE_BUILDER_H__ +#pragma once /** \file * \ingroup freestyle @@ -48,5 +47,3 @@ class WXEdgeBuilder : public WingedEdgeBuilder { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_WX_EDGE_BUILDER_H__ diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h index 5c728dea1d8..8cf86a421b7 100644 --- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h +++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FREESTYLE_WINGED_EDGE_BUILDER_H__ -#define __FREESTYLE_WINGED_EDGE_BUILDER_H__ +#pragma once /** \file * \ingroup freestyle @@ -174,5 +173,3 @@ class WingedEdgeBuilder : public SceneVisitor { }; } /* namespace Freestyle */ - -#endif // __FREESTYLE_WINGED_EDGE_BUILDER_H__ diff --git a/source/blender/functions/FN_array_spans.hh b/source/blender/functions/FN_array_spans.hh index c362fef3630..52325c19c1b 100644 --- a/source/blender/functions/FN_array_spans.hh +++ b/source/blender/functions/FN_array_spans.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FN_ARRAY_SPANS_HH__ -#define __FN_ARRAY_SPANS_HH__ +#pragma once /** \file * \ingroup fn @@ -205,5 +204,3 @@ class GVArraySpan : public VArraySpanBase<void> { }; } // namespace blender::fn - -#endif /* __FN_ARRAY_SPANS_HH__ */ diff --git a/source/blender/functions/FN_attributes_ref.hh b/source/blender/functions/FN_attributes_ref.hh index ed14676731e..fe7e59b5e00 100644 --- a/source/blender/functions/FN_attributes_ref.hh +++ b/source/blender/functions/FN_attributes_ref.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FN_ATTRIBUTES_REF_HH__ -#define __FN_ATTRIBUTES_REF_HH__ +#pragma once /** \file * \ingroup fn @@ -340,5 +339,3 @@ class AttributesRef { }; } // namespace blender::fn - -#endif /* __FN_ATTRIBUTES_REF_HH__ */ diff --git a/source/blender/functions/FN_cpp_type.hh b/source/blender/functions/FN_cpp_type.hh index 594890e353a..1176a705e66 100644 --- a/source/blender/functions/FN_cpp_type.hh +++ b/source/blender/functions/FN_cpp_type.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FN_CPP_TYPE_HH__ -#define __FN_CPP_TYPE_HH__ +#pragma once /** \file * \ingroup fn @@ -795,5 +794,3 @@ inline std::unique_ptr<const CPPType> create_cpp_type(StringRef name, const T &d STRINGIFY(IDENTIFIER), default_value); \ return *cpp_type; \ } - -#endif /* __FN_CPP_TYPE_HH__ */ diff --git a/source/blender/functions/FN_generic_vector_array.hh b/source/blender/functions/FN_generic_vector_array.hh index ee67db000e5..0a173d1fbc6 100644 --- a/source/blender/functions/FN_generic_vector_array.hh +++ b/source/blender/functions/FN_generic_vector_array.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FN_GENERIC_VECTOR_ARRAY_HH__ -#define __FN_GENERIC_VECTOR_ARRAY_HH__ +#pragma once /** \file * \ingroup fn @@ -202,5 +201,3 @@ template<typename T> class GVectorArrayRef { }; } // namespace blender::fn - -#endif /* __FN_GENERIC_VECTOR_ARRAY_HH__ */ diff --git a/source/blender/functions/FN_multi_function.hh b/source/blender/functions/FN_multi_function.hh index eaddcee7964..bf431984946 100644 --- a/source/blender/functions/FN_multi_function.hh +++ b/source/blender/functions/FN_multi_function.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FN_MULTI_FUNCTION_HH__ -#define __FN_MULTI_FUNCTION_HH__ +#pragma once /** \file * \ingroup fn @@ -124,5 +123,3 @@ inline MFParamsBuilder::MFParamsBuilder(const class MultiFunction &fn, int64_t m extern const MultiFunction &dummy_multi_function; } // namespace blender::fn - -#endif /* __FN_MULTI_FUNCTION_HH__ */ diff --git a/source/blender/functions/FN_multi_function_builder.hh b/source/blender/functions/FN_multi_function_builder.hh index 95e216558e7..dee0938eb3a 100644 --- a/source/blender/functions/FN_multi_function_builder.hh +++ b/source/blender/functions/FN_multi_function_builder.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FN_MULTI_FUNCTION_BUILDER_HH__ -#define __FN_MULTI_FUNCTION_BUILDER_HH__ +#pragma once /** \file * \ingroup fn @@ -314,5 +313,3 @@ class CustomMF_DefaultOutput : public MultiFunction { }; } // namespace blender::fn - -#endif /* __FN_MULTI_FUNCTION_BUILDER_HH__ */ diff --git a/source/blender/functions/FN_multi_function_context.hh b/source/blender/functions/FN_multi_function_context.hh index 8492fd86742..eec6b21ae7c 100644 --- a/source/blender/functions/FN_multi_function_context.hh +++ b/source/blender/functions/FN_multi_function_context.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FN_MULTI_FUNCTION_CONTEXT_HH__ -#define __FN_MULTI_FUNCTION_CONTEXT_HH__ +#pragma once /** \file * \ingroup fn @@ -66,5 +65,3 @@ class MFContext { }; } // namespace blender::fn - -#endif /* __FN_MULTI_FUNCTION_CONTEXT_HH__ */ diff --git a/source/blender/functions/FN_multi_function_data_type.hh b/source/blender/functions/FN_multi_function_data_type.hh index 23a1c0e5680..34997703432 100644 --- a/source/blender/functions/FN_multi_function_data_type.hh +++ b/source/blender/functions/FN_multi_function_data_type.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FN_MULTI_FUNCTION_DATA_TYPE_HH__ -#define __FN_MULTI_FUNCTION_DATA_TYPE_HH__ +#pragma once /** \file * \ingroup fn @@ -126,5 +125,3 @@ inline bool operator!=(const MFDataType &a, const MFDataType &b) } } // namespace blender::fn - -#endif /* __FN_MULTI_FUNCTION_DATA_TYPE_HH__ */ diff --git a/source/blender/functions/FN_multi_function_network.hh b/source/blender/functions/FN_multi_function_network.hh index 20f8fb2ee43..7a9f5b4cfaf 100644 --- a/source/blender/functions/FN_multi_function_network.hh +++ b/source/blender/functions/FN_multi_function_network.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FN_MULTI_FUNCTION_NETWORK_HH__ -#define __FN_MULTI_FUNCTION_NETWORK_HH__ +#pragma once /** \file * \ingroup fn @@ -535,5 +534,3 @@ inline int MFNetwork::node_id_amount() const } } // namespace blender::fn - -#endif /* __FN_MULTI_FUNCTION_NETWORK_HH__ */ diff --git a/source/blender/functions/FN_multi_function_network_evaluation.hh b/source/blender/functions/FN_multi_function_network_evaluation.hh index 11606869ca2..2c0d94615b0 100644 --- a/source/blender/functions/FN_multi_function_network_evaluation.hh +++ b/source/blender/functions/FN_multi_function_network_evaluation.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FN_MULTI_FUNCTION_NETWORK_EVALUATION_HH__ -#define __FN_MULTI_FUNCTION_NETWORK_EVALUATION_HH__ +#pragma once /** \file * \ingroup fn @@ -60,5 +59,3 @@ class MFNetworkEvaluator : public MultiFunction { }; } // namespace blender::fn - -#endif /* __FN_MULTI_FUNCTION_NETWORK_EVALUATION_HH__ */ diff --git a/source/blender/functions/FN_multi_function_network_optimization.hh b/source/blender/functions/FN_multi_function_network_optimization.hh index 3cbabd72c2a..6d0165643ce 100644 --- a/source/blender/functions/FN_multi_function_network_optimization.hh +++ b/source/blender/functions/FN_multi_function_network_optimization.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FN_MULTI_FUNCTION_NETWORK_OPTIMIZATION_HH__ -#define __FN_MULTI_FUNCTION_NETWORK_OPTIMIZATION_HH__ +#pragma once #include "FN_multi_function_network.hh" @@ -28,5 +27,3 @@ void constant_folding(MFNetwork &network, ResourceCollector &resources); void common_subnetwork_elimination(MFNetwork &network); } // namespace blender::fn::mf_network_optimization - -#endif /* __FN_MULTI_FUNCTION_NETWORK_OPTIMIZATION_HH__ */ diff --git a/source/blender/functions/FN_multi_function_param_type.hh b/source/blender/functions/FN_multi_function_param_type.hh index 7c16b8cdf10..5b35cbe365b 100644 --- a/source/blender/functions/FN_multi_function_param_type.hh +++ b/source/blender/functions/FN_multi_function_param_type.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FN_MULTI_FUNCTION_PARAM_TYPE_HH__ -#define __FN_MULTI_FUNCTION_PARAM_TYPE_HH__ +#pragma once /** \file * \ingroup fn @@ -164,5 +163,3 @@ inline bool operator!=(const MFParamType &a, const MFParamType &b) } } // namespace blender::fn - -#endif /* __FN_MULTI_FUNCTION_PARAM_TYPE_HH__ */ diff --git a/source/blender/functions/FN_multi_function_params.hh b/source/blender/functions/FN_multi_function_params.hh index 93d7b47af83..71b05754717 100644 --- a/source/blender/functions/FN_multi_function_params.hh +++ b/source/blender/functions/FN_multi_function_params.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FN_MULTI_FUNCTION_PARAMS_HH__ -#define __FN_MULTI_FUNCTION_PARAMS_HH__ +#pragma once /** \file * \ingroup fn @@ -237,5 +236,3 @@ class MFParams { }; } // namespace blender::fn - -#endif /* __FN_MULTI_FUNCTION_PARAMS_HH__ */ diff --git a/source/blender/functions/FN_multi_function_signature.hh b/source/blender/functions/FN_multi_function_signature.hh index ba79dddff16..fd92bb2ff55 100644 --- a/source/blender/functions/FN_multi_function_signature.hh +++ b/source/blender/functions/FN_multi_function_signature.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FN_MULTI_FUNCTION_SIGNATURE_HH__ -#define __FN_MULTI_FUNCTION_SIGNATURE_HH__ +#pragma once /** \file * \ingroup fn @@ -170,5 +169,3 @@ class MFSignatureBuilder { }; } // namespace blender::fn - -#endif /* __FN_MULTI_FUNCTION_SIGNATURE_HH__ */ diff --git a/source/blender/functions/FN_spans.hh b/source/blender/functions/FN_spans.hh index d8b381199cc..3ceb78ea6bd 100644 --- a/source/blender/functions/FN_spans.hh +++ b/source/blender/functions/FN_spans.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FN_SPANS_HH__ -#define __FN_SPANS_HH__ +#pragma once /** \file * \ingroup fn @@ -412,5 +411,3 @@ class GVSpan : public VSpanBase<void> { }; } // namespace blender::fn - -#endif /* __FN_SPANS_HH__ */ diff --git a/source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h b/source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h index a7a4333d82e..3f167ac6785 100644 --- a/source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h +++ b/source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h @@ -18,8 +18,7 @@ * \ingroup modifiers */ -#ifndef __MOD_GPENCIL_MODIFIERTYPES_H__ -#define __MOD_GPENCIL_MODIFIERTYPES_H__ +#pragma once #include "BKE_gpencil_modifier.h" @@ -47,5 +46,3 @@ extern GpencilModifierTypeInfo modifierType_Gpencil_Texture; /* MOD_gpencil_util.c */ void gpencil_modifier_type_init(GpencilModifierTypeInfo *types[]); - -#endif /* __MOD_GPENCIL_MODIFIERTYPES_H__ */ diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.h b/source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.h index 9c6edb51d63..c85e939b13f 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.h +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.h @@ -18,8 +18,7 @@ * \ingroup modifiers */ -#ifndef __MOD_UI_COMMON__GPENCIL_H__ -#define __MOD_UI_COMMON__GPENCIL_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -62,5 +61,3 @@ struct PanelType *gpencil_modifier_subpanel_register(struct ARegionType *region_ #ifdef __cplusplus } #endif - -#endif /* __MOD_UI_COMMON__GPENCIL_H__ */ diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h index 5cc3750639b..e5a6d9e6a8f 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h @@ -21,8 +21,7 @@ * \ingroup modifiers */ -#ifndef __MOD_GPENCIL_UTIL_H__ -#define __MOD_GPENCIL_UTIL_H__ +#pragma once struct GHash; struct MDeformVert; @@ -46,5 +45,3 @@ bool is_stroke_affected_by_modifier(struct Object *ob, const bool inv4); float get_modifier_point_weight(struct MDeformVert *dvert, bool inverse, int def_nr); - -#endif /* __MOD_GPENCIL_UTIL_H__ */ diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c index 175a6d81b1b..557a305d731 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c @@ -195,7 +195,7 @@ static void panel_draw(const bContext *C, Panel *panel) row = uiLayoutRow(layout, true); uiItemR(row, &ptr, "use_edit_position", UI_ITEM_R_TOGGLE, IFACE_("Position"), ICON_NONE); - uiItemR(row, &ptr, "use_edit_strength", UI_ITEM_R_TOGGLE, IFACE_("Stength"), ICON_NONE); + uiItemR(row, &ptr, "use_edit_strength", UI_ITEM_R_TOGGLE, IFACE_("Strength"), ICON_NONE); uiItemR(row, &ptr, "use_edit_thickness", UI_ITEM_R_TOGGLE, IFACE_("Thickness"), ICON_NONE); uiItemR(row, &ptr, "use_edit_uv", UI_ITEM_R_TOGGLE, IFACE_("UV"), ICON_NONE); diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c index 49396f56d26..315f1b9e19b 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c @@ -22,6 +22,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include <string.h> #include "BLI_utildefines.h" diff --git a/source/blender/gpu/GPU_attr_binding.h b/source/blender/gpu/GPU_attr_binding.h index 8093e02cab6..e7c3dcbce05 100644 --- a/source/blender/gpu/GPU_attr_binding.h +++ b/source/blender/gpu/GPU_attr_binding.h @@ -23,8 +23,7 @@ * GPU vertex attribute binding */ -#ifndef __GPU_ATTR_BINDING_H__ -#define __GPU_ATTR_BINDING_H__ +#pragma once #include "GPU_common.h" @@ -42,5 +41,3 @@ typedef struct GPUAttrBinding { #ifdef __cplusplus } #endif - -#endif /* __GPU_ATTR_BINDING_H__ */ diff --git a/source/blender/gpu/GPU_batch.h b/source/blender/gpu/GPU_batch.h index 5f55b512695..ca6aaa90ddc 100644 --- a/source/blender/gpu/GPU_batch.h +++ b/source/blender/gpu/GPU_batch.h @@ -24,8 +24,7 @@ * Contains VAOs + VBOs + Shader representing a drawable entity. */ -#ifndef __GPU_BATCH_H__ -#define __GPU_BATCH_H__ +#pragma once #include "GPU_element.h" #include "GPU_shader.h" @@ -248,5 +247,3 @@ void gpu_batch_exit(void); #ifdef __cplusplus } #endif - -#endif /* __GPU_BATCH_H__ */ diff --git a/source/blender/gpu/GPU_batch_presets.h b/source/blender/gpu/GPU_batch_presets.h index eb803333d98..1674cf776db 100644 --- a/source/blender/gpu/GPU_batch_presets.h +++ b/source/blender/gpu/GPU_batch_presets.h @@ -24,8 +24,7 @@ * This file contains any additions or modifications specific to Blender. */ -#ifndef __GPU_BATCH_PRESETS_H__ -#define __GPU_BATCH_PRESETS_H__ +#pragma once #include "BLI_compiler_attrs.h" #include "BLI_sys_types.h" @@ -50,8 +49,8 @@ bool gpu_batch_presets_unregister(struct GPUBatch *preset_batch); void gpu_batch_presets_reset(void); void gpu_batch_presets_exit(void); +void GPU_batch_presets_reset(void); + #ifdef __cplusplus } #endif - -#endif /* __GPU_BATCH_PRESETS_H__ */ diff --git a/source/blender/gpu/GPU_batch_utils.h b/source/blender/gpu/GPU_batch_utils.h index 8f85ac59aa5..37dccc4621c 100644 --- a/source/blender/gpu/GPU_batch_utils.h +++ b/source/blender/gpu/GPU_batch_utils.h @@ -18,8 +18,7 @@ * \ingroup gpu */ -#ifndef __GPU_BATCH_UTILS_H__ -#define __GPU_BATCH_UTILS_H__ +#pragma once #include "BLI_compiler_attrs.h" #include "BLI_sys_types.h" @@ -44,5 +43,3 @@ struct GPUBatch *gpu_batch_sphere(int lat_res, int lon_res) ATTR_WARN_UNUSED_RES #ifdef __cplusplus } #endif - -#endif /* __GPU_BATCH_UTILS_H__ */ diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h index c7e74040568..23349728f25 100644 --- a/source/blender/gpu/GPU_buffers.h +++ b/source/blender/gpu/GPU_buffers.h @@ -21,8 +21,7 @@ * \ingroup gpu */ -#ifndef __GPU_BUFFERS_H__ -#define __GPU_BUFFERS_H__ +#pragma once #include <stddef.h> @@ -121,5 +120,3 @@ bool GPU_pbvh_buffers_has_overlays(GPU_PBVH_Buffers *buffers); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/gpu/GPU_common.h b/source/blender/gpu/GPU_common.h index dd580ebbdac..8fd1baba2f7 100644 --- a/source/blender/gpu/GPU_common.h +++ b/source/blender/gpu/GPU_common.h @@ -21,8 +21,7 @@ * \ingroup gpu */ -#ifndef __GPU_COMMON_H__ -#define __GPU_COMMON_H__ +#pragma once #define PROGRAM_NO_OPTI 0 @@ -51,5 +50,3 @@ #else # define GPU_INLINE static inline __attribute__((always_inline)) __attribute__((__unused__)) #endif - -#endif /* __GPU_COMMON_H__ */ diff --git a/source/blender/gpu/GPU_context.h b/source/blender/gpu/GPU_context.h index 9876aa6998c..4f0edaf3ac8 100644 --- a/source/blender/gpu/GPU_context.h +++ b/source/blender/gpu/GPU_context.h @@ -23,8 +23,7 @@ * This interface allow GPU to manage VAOs for multiple context and threads. */ -#ifndef __GPU_CONTEXT_H__ -#define __GPU_CONTEXT_H__ +#pragma once #include "GPU_batch.h" #include "GPU_common.h" @@ -42,8 +41,14 @@ void GPU_context_discard(GPUContext *); void GPU_context_active_set(GPUContext *); GPUContext *GPU_context_active_get(void); +/* Legacy GPU (Intel HD4000 series) do not support sharing GPU objects between GPU + * contexts. EEVEE/Workbench can create different contexts for image/preview rendering, baking or + * compiling. When a legacy GPU is detected (`GPU_use_main_context_workaround()`) any worker + * threads should use the draw manager opengl context and make sure that they are the only one + * using it by locking the main context using these two functions. */ +void GPU_context_main_lock(void); +void GPU_context_main_unlock(void); + #ifdef __cplusplus } #endif - -#endif /* __GPU_CONTEXT_H__ */ diff --git a/source/blender/gpu/GPU_debug.h b/source/blender/gpu/GPU_debug.h index 8928581ee08..282c2437640 100644 --- a/source/blender/gpu/GPU_debug.h +++ b/source/blender/gpu/GPU_debug.h @@ -21,8 +21,7 @@ * \ingroup gpu */ -#ifndef __GPU_DEBUG_H__ -#define __GPU_DEBUG_H__ +#pragma once #include "GPU_glew.h" @@ -39,5 +38,3 @@ void GPU_string_marker(const char *str); #ifdef __cplusplus } #endif - -#endif /* __GPU_DEBUG_H__ */ diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h index b364bd0ef95..c0458fec7c3 100644 --- a/source/blender/gpu/GPU_draw.h +++ b/source/blender/gpu/GPU_draw.h @@ -21,8 +21,7 @@ * \ingroup gpu */ -#ifndef __GPU_DRAW_H__ -#define __GPU_DRAW_H__ +#pragma once #include "BLI_utildefines.h" #include "DNA_object_enums.h" @@ -91,5 +90,3 @@ void GPU_free_unused_buffers(void); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/gpu/GPU_element.h b/source/blender/gpu/GPU_element.h index 9aef8d6ed73..3d5195b12fc 100644 --- a/source/blender/gpu/GPU_element.h +++ b/source/blender/gpu/GPU_element.h @@ -23,8 +23,7 @@ * GPU element list (AKA index buffer) */ -#ifndef __GPU_ELEMENT_H__ -#define __GPU_ELEMENT_H__ +#pragma once #include "GPU_primitive.h" @@ -116,5 +115,3 @@ int GPU_indexbuf_primitive_len(GPUPrimType prim_type); #ifdef __cplusplus } #endif - -#endif /* __GPU_ELEMENT_H__ */ diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h index 263deeaf28d..6cb7a297d09 100644 --- a/source/blender/gpu/GPU_extensions.h +++ b/source/blender/gpu/GPU_extensions.h @@ -21,8 +21,7 @@ * \ingroup gpu */ -#ifndef __GPU_EXTENSIONS_H__ -#define __GPU_EXTENSIONS_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -48,7 +47,7 @@ bool GPU_arb_texture_cube_map_array_is_supported(void); bool GPU_mip_render_workaround(void); bool GPU_depth_blitting_workaround(void); bool GPU_unused_fb_slot_workaround(void); -bool GPU_context_local_shaders_workaround(void); +bool GPU_use_main_context_workaround(void); bool GPU_texture_copy_workaround(void); bool GPU_crappy_amd_driver(void); @@ -62,5 +61,3 @@ bool GPU_stereo_quadbuffer_support(void); #ifdef __cplusplus } #endif - -#endif /* __GPU_EXTENSIONS_H__ */ diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h index 1a9fb1bad7a..4958d1eaac8 100644 --- a/source/blender/gpu/GPU_framebuffer.h +++ b/source/blender/gpu/GPU_framebuffer.h @@ -21,15 +21,14 @@ * \ingroup gpu */ -#ifndef __GPU_FRAMEBUFFER_H__ -#define __GPU_FRAMEBUFFER_H__ +#pragma once + +#include "GPU_texture.h" #ifdef __cplusplus extern "C" { #endif -#include "GPU_texture.h" - typedef struct GPUAttachment { struct GPUTexture *tex; int mip, layer; @@ -235,5 +234,3 @@ void GPU_backbuffer_bind(eGPUBackBuffer buffer); #ifdef __cplusplus } #endif - -#endif /* __GPU_FRAMEBUFFER_H__ */ diff --git a/source/blender/gpu/GPU_glew.h b/source/blender/gpu/GPU_glew.h index 744bce9713a..e87a7054e5f 100644 --- a/source/blender/gpu/GPU_glew.h +++ b/source/blender/gpu/GPU_glew.h @@ -21,8 +21,7 @@ * \ingroup gpu */ -#ifndef __GPU_GLEW_H__ -#define __GPU_GLEW_H__ +#pragma once #if defined(WITH_OPENGL) # include "glew-mx.h" @@ -30,5 +29,3 @@ # include "GPU_legacy_stubs.h" # endif #endif - -#endif /* __GPU_GLEW_H__ */ diff --git a/source/blender/gpu/GPU_immediate.h b/source/blender/gpu/GPU_immediate.h index 698c4585d20..08bfcb95942 100644 --- a/source/blender/gpu/GPU_immediate.h +++ b/source/blender/gpu/GPU_immediate.h @@ -23,8 +23,7 @@ * GPU immediate mode work-alike */ -#ifndef __GPU_IMMEDIATE_H__ -#define __GPU_IMMEDIATE_H__ +#pragma once #include "GPU_batch.h" #include "GPU_immediate_util.h" @@ -141,6 +140,7 @@ void immBindBuiltinProgram(eGPUBuiltinShader shader_id); /* Extend immUniformColor to take Blender's themes */ void immUniformThemeColor(int color_id); +void immUniformThemeColorAlpha(int color_id, float a); void immUniformThemeColor3(int color_id); void immUniformThemeColorShade(int color_id, int offset); void immUniformThemeColorShadeAlpha(int color_id, int color_offset, int alpha_offset); @@ -157,5 +157,3 @@ void immDestroy(void); #ifdef __cplusplus } #endif - -#endif /* __GPU_IMMEDIATE_H__ */ diff --git a/source/blender/gpu/GPU_immediate_util.h b/source/blender/gpu/GPU_immediate_util.h index 47b44b59461..7786bcd2d06 100644 --- a/source/blender/gpu/GPU_immediate_util.h +++ b/source/blender/gpu/GPU_immediate_util.h @@ -20,8 +20,7 @@ * Utility drawing functions (rough equivalent to OpenGL's GLU) */ -#ifndef __GPU_IMMEDIATE_UTIL_H__ -#define __GPU_IMMEDIATE_UTIL_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -92,5 +91,3 @@ void imm_draw_cylinder_fill_3d( #ifdef __cplusplus } #endif - -#endif /* __GPU_IMMEDIATE_UTIL_H__ */ diff --git a/source/blender/gpu/GPU_init_exit.h b/source/blender/gpu/GPU_init_exit.h index 3e30a1ddcf5..bd4771e2357 100644 --- a/source/blender/gpu/GPU_init_exit.h +++ b/source/blender/gpu/GPU_init_exit.h @@ -21,8 +21,7 @@ * \ingroup gpu */ -#ifndef __GPU_INIT_EXIT_H__ -#define __GPU_INIT_EXIT_H__ +#pragma once #include "BLI_utildefines.h" @@ -37,5 +36,3 @@ bool GPU_is_initialized(void); #ifdef __cplusplus } #endif - -#endif /* __GPU_INIT_EXIT_H__ */ diff --git a/source/blender/gpu/GPU_legacy_stubs.h b/source/blender/gpu/GPU_legacy_stubs.h index c666ff73bc6..2e21b879907 100644 --- a/source/blender/gpu/GPU_legacy_stubs.h +++ b/source/blender/gpu/GPU_legacy_stubs.h @@ -26,8 +26,7 @@ * This file should be removed in the future */ -#ifndef __GPU_LEGACY_STUBS_H__ -#define __GPU_LEGACY_STUBS_H__ +#pragma once #if defined(__GNUC__) # pragma GCC diagnostic push @@ -512,5 +511,3 @@ _GL_VOID DO_NOT_USE_glClientActiveTexture(GLenum texture) _GL_VOID_RET #if defined(__GNUC__) # pragma GCC diagnostic pop #endif - -#endif /* __GPU_LEGACY_STUBS_H__ */ diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h index c372bfaf218..b2352b3f3b0 100644 --- a/source/blender/gpu/GPU_material.h +++ b/source/blender/gpu/GPU_material.h @@ -21,8 +21,7 @@ * \ingroup gpu */ -#ifndef __GPU_MATERIAL_H__ -#define __GPU_MATERIAL_H__ +#pragma once #include "DNA_customdata_types.h" /* for CustomDataType */ #include "DNA_listBase.h" @@ -255,5 +254,3 @@ ListBase GPU_material_volume_grids(GPUMaterial *material); #ifdef __cplusplus } #endif - -#endif /*__GPU_MATERIAL_H__*/ diff --git a/source/blender/gpu/GPU_matrix.h b/source/blender/gpu/GPU_matrix.h index eabfb5d2dc3..7b94a535a30 100644 --- a/source/blender/gpu/GPU_matrix.h +++ b/source/blender/gpu/GPU_matrix.h @@ -21,8 +21,7 @@ * \ingroup gpu */ -#ifndef __GPU_MATRIX_H__ -#define __GPU_MATRIX_H__ +#pragma once #include "BLI_sys_types.h" @@ -236,5 +235,3 @@ int GPU_matrix_stack_level_get_projection(void); * however we need to check these limits in code that calls into these API's. */ #define GPU_MATRIX_ORTHO_CLIP_NEAR_DEFAULT (-100) #define GPU_MATRIX_ORTHO_CLIP_FAR_DEFAULT (100) - -#endif /* __GPU_MATRIX_H__ */ diff --git a/source/blender/gpu/GPU_platform.h b/source/blender/gpu/GPU_platform.h index f199a748cb5..0848252c788 100644 --- a/source/blender/gpu/GPU_platform.h +++ b/source/blender/gpu/GPU_platform.h @@ -21,8 +21,7 @@ * \ingroup gpu */ -#ifndef __GPU_PLATFORM_H__ -#define __GPU_PLATFORM_H__ +#pragma once #include "BLI_sys_types.h" @@ -71,5 +70,3 @@ const char *GPU_platform_gpu_name(void); #ifdef __cplusplus } #endif - -#endif /* __GPU_PLATFORM_H__ */ diff --git a/source/blender/gpu/GPU_primitive.h b/source/blender/gpu/GPU_primitive.h index 4cd6205c0d1..e910e81fac1 100644 --- a/source/blender/gpu/GPU_primitive.h +++ b/source/blender/gpu/GPU_primitive.h @@ -23,8 +23,7 @@ * GPU geometric primitives */ -#ifndef __GPU_PRIMITIVE_H__ -#define __GPU_PRIMITIVE_H__ +#pragma once #include "GPU_common.h" @@ -63,5 +62,3 @@ bool GPU_primtype_belongs_to_class(GPUPrimType, GPUPrimClass); #ifdef __cplusplus } #endif - -#endif /* __GPU_PRIMITIVE_H__ */ diff --git a/source/blender/gpu/GPU_select.h b/source/blender/gpu/GPU_select.h index d9a8e964a3d..d28363253b1 100644 --- a/source/blender/gpu/GPU_select.h +++ b/source/blender/gpu/GPU_select.h @@ -21,8 +21,7 @@ * \ingroup gpu */ -#ifndef __GPU_SELECT_H__ -#define __GPU_SELECT_H__ +#pragma once #include "BLI_sys_types.h" @@ -63,5 +62,3 @@ void GPU_select_buffer_stride_realign(const struct rcti *src, const struct rcti #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h index a19ed2d84fd..1ec70c1106b 100644 --- a/source/blender/gpu/GPU_shader.h +++ b/source/blender/gpu/GPU_shader.h @@ -21,8 +21,7 @@ * \ingroup gpu */ -#ifndef __GPU_SHADER_H__ -#define __GPU_SHADER_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -372,5 +371,3 @@ void GPU_shader_free_builtin_shaders(void); #ifdef __cplusplus } #endif - -#endif /* __GPU_SHADER_H__ */ diff --git a/source/blender/gpu/GPU_shader_interface.h b/source/blender/gpu/GPU_shader_interface.h index 28ee162bdbd..8aba1236b65 100644 --- a/source/blender/gpu/GPU_shader_interface.h +++ b/source/blender/gpu/GPU_shader_interface.h @@ -23,8 +23,7 @@ * GPU shader interface (C --> GLSL) */ -#ifndef __GPU_SHADER_INTERFACE_H__ -#define __GPU_SHADER_INTERFACE_H__ +#pragma once #include "GPU_common.h" @@ -116,5 +115,3 @@ void GPU_shaderinterface_remove_batch_ref(GPUShaderInterface *, struct GPUBatch #ifdef __cplusplus } #endif - -#endif /* __GPU_SHADER_INTERFACE_H__ */ diff --git a/source/blender/gpu/GPU_state.h b/source/blender/gpu/GPU_state.h index 8d50330ac93..4cf1d9844ae 100644 --- a/source/blender/gpu/GPU_state.h +++ b/source/blender/gpu/GPU_state.h @@ -18,8 +18,7 @@ * \ingroup gpu */ -#ifndef __GPU_STATE_H__ -#define __GPU_STATE_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -108,5 +107,3 @@ void gpuPopAttr(void); #ifdef __cplusplus } #endif - -#endif /* __GPU_STATE_H__ */ diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h index 813ee71eb22..7cbd4b1eee3 100644 --- a/source/blender/gpu/GPU_texture.h +++ b/source/blender/gpu/GPU_texture.h @@ -21,15 +21,11 @@ * \ingroup gpu */ -#ifndef __GPU_TEXTURE_H__ -#define __GPU_TEXTURE_H__ +#pragma once +#include "BLI_utildefines.h" #include "GPU_state.h" -#ifdef __cplusplus -extern "C" { -#endif - struct GPUVertBuf; struct ImBuf; struct Image; @@ -60,6 +56,10 @@ typedef enum eGPUSamplerState { GPU_SAMPLER_MAX = (1 << 8), } eGPUSamplerState; +#ifdef __cplusplus +extern "C" { +#endif + #define GPU_SAMPLER_DEFAULT GPU_SAMPLER_FILTER #define GPU_SAMPLER_REPEAT (GPU_SAMPLER_REPEAT_S | GPU_SAMPLER_REPEAT_T | GPU_SAMPLER_REPEAT_R) @@ -300,5 +300,3 @@ void GPU_sampler_icon_bind(int number); #ifdef __cplusplus } #endif - -#endif /* __GPU_TEXTURE_H__ */ diff --git a/source/blender/gpu/GPU_uniformbuffer.h b/source/blender/gpu/GPU_uniformbuffer.h index b221ae035d3..56e258d8a48 100644 --- a/source/blender/gpu/GPU_uniformbuffer.h +++ b/source/blender/gpu/GPU_uniformbuffer.h @@ -21,8 +21,7 @@ * \ingroup gpu */ -#ifndef __GPU_UNIFORMBUFFER_H__ -#define __GPU_UNIFORMBUFFER_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -53,5 +52,3 @@ bool GPU_uniformbuffer_is_dirty(GPUUniformBuffer *ubo); #ifdef __cplusplus } #endif - -#endif /* __GPU_UNIFORMBUFFER_H__ */ diff --git a/source/blender/gpu/GPU_vertex_buffer.h b/source/blender/gpu/GPU_vertex_buffer.h index f9bdf726930..8f194ed2c36 100644 --- a/source/blender/gpu/GPU_vertex_buffer.h +++ b/source/blender/gpu/GPU_vertex_buffer.h @@ -23,8 +23,7 @@ * GPU vertex buffer */ -#ifndef __GPU_VERTEX_BUFFER_H__ -#define __GPU_VERTEX_BUFFER_H__ +#pragma once #include "GPU_vertex_format.h" @@ -147,5 +146,3 @@ uint GPU_vertbuf_get_memory_usage(void); #ifdef __cplusplus } #endif - -#endif /* __GPU_VERTEX_BUFFER_H__ */ diff --git a/source/blender/gpu/GPU_vertex_format.h b/source/blender/gpu/GPU_vertex_format.h index 34bfbb27823..391eaf61876 100644 --- a/source/blender/gpu/GPU_vertex_format.h +++ b/source/blender/gpu/GPU_vertex_format.h @@ -23,8 +23,7 @@ * GPU vertex format */ -#ifndef __GPU_VERTEX_FORMAT_H__ -#define __GPU_VERTEX_FORMAT_H__ +#pragma once #include "BLI_assert.h" #include "BLI_compiler_compat.h" @@ -197,5 +196,3 @@ BLI_INLINE GPUPackedNormal GPU_normal_convert_i10_s3(const short data[3]) #ifdef __cplusplus } #endif - -#endif /* __GPU_VERTEX_FORMAT_H__ */ diff --git a/source/blender/gpu/GPU_viewport.h b/source/blender/gpu/GPU_viewport.h index 50d265feaad..60b78ecd59b 100644 --- a/source/blender/gpu/GPU_viewport.h +++ b/source/blender/gpu/GPU_viewport.h @@ -21,8 +21,7 @@ * \ingroup gpu */ -#ifndef __GPU_VIEWPORT_H__ -#define __GPU_VIEWPORT_H__ +#pragma once #include <stdbool.h> @@ -41,6 +40,8 @@ extern "C" { typedef struct GPUViewport GPUViewport; +struct GPUFrameBuffer; + /* Contains memory pools information */ typedef struct ViewportMemoryPool { struct BLI_memblock *commands; @@ -151,8 +152,9 @@ GPUTexture *GPU_viewport_texture_pool_query( bool GPU_viewport_engines_data_validate(GPUViewport *viewport, void **engine_handle_array); void GPU_viewport_cache_release(GPUViewport *viewport); +struct GPUFrameBuffer *GPU_viewport_framebuffer_default_get(GPUViewport *viewport); +struct GPUFrameBuffer *GPU_viewport_framebuffer_overlay_get(GPUViewport *viewport); + #ifdef __cplusplus } #endif - -#endif // __GPU_VIEWPORT_H__ diff --git a/source/blender/gpu/intern/gpu_attr_binding_private.h b/source/blender/gpu/intern/gpu_attr_binding_private.h index 301ec3333dd..4f18655ec62 100644 --- a/source/blender/gpu/intern/gpu_attr_binding_private.h +++ b/source/blender/gpu/intern/gpu_attr_binding_private.h @@ -23,8 +23,7 @@ * GPU vertex attribute binding */ -#ifndef __GPU_ATTR_BINDING_PRIVATE_H__ -#define __GPU_ATTR_BINDING_PRIVATE_H__ +#pragma once #include "GPU_shader_interface.h" #include "GPU_vertex_format.h" @@ -35,5 +34,3 @@ void get_attr_locations(const GPUVertFormat *format, GPUAttrBinding *binding, const GPUShaderInterface *shaderface); uint read_attr_location(const GPUAttrBinding *binding, uint a_idx); - -#endif /* __GPU_ATTR_BINDING_PRIVATE_H__ */ diff --git a/source/blender/gpu/intern/gpu_batch_presets.c b/source/blender/gpu/intern/gpu_batch_presets.c index d16edab5ac9..7f842d4d508 100644 --- a/source/blender/gpu/intern/gpu_batch_presets.c +++ b/source/blender/gpu/intern/gpu_batch_presets.c @@ -406,4 +406,17 @@ void gpu_batch_presets_exit(void) BLI_mutex_end(&g_presets_3d.mutex); } +/** + * This function only needs to be accessed externally because + * we are drawing UI batches with the DRW old context. + * + * And now we use it for drawing the entire area. + * + * XXX (Clément) - to cleanup in the upcoming 2.91 refactor. + **/ +void GPU_batch_presets_reset() +{ + gpu_batch_presets_reset(); +} + /** \} */ diff --git a/source/blender/gpu/intern/gpu_batch_private.h b/source/blender/gpu/intern/gpu_batch_private.h index 58d1810ac7a..93745b9ca9b 100644 --- a/source/blender/gpu/intern/gpu_batch_private.h +++ b/source/blender/gpu/intern/gpu_batch_private.h @@ -24,8 +24,7 @@ * Contains VAOs + VBOs + Shader representing a drawable entity. */ -#ifndef __GPU_BATCH_PRIVATE_H__ -#define __GPU_BATCH_PRIVATE_H__ +#pragma once #include "GPU_batch.h" #include "GPU_context.h" @@ -40,5 +39,3 @@ void gpu_batch_remove_interface_ref(GPUBatch *batch, const GPUShaderInterface *i #ifdef __cplusplus } #endif - -#endif /* __GPU_BATCH_PRIVATE_H__ */ diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 0a1d6f560b6..155179205c5 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -1228,21 +1228,9 @@ bool GPU_pass_compile(GPUPass *pass, const char *shname) shader = NULL; } } - else if (!BLI_thread_is_main() && GPU_context_local_shaders_workaround()) { - pass->binary.content = GPU_shader_get_binary( - shader, &pass->binary.format, &pass->binary.len); - GPU_shader_free(shader); - shader = NULL; - } - pass->shader = shader; pass->compiled = true; } - else if (pass->binary.content && BLI_thread_is_main()) { - pass->shader = GPU_shader_load_from_binary( - pass->binary.content, pass->binary.format, pass->binary.len, shname); - MEM_SAFE_FREE(pass->binary.content); - } return success; } @@ -1263,9 +1251,6 @@ static void gpu_pass_free(GPUPass *pass) MEM_SAFE_FREE(pass->geometrycode); MEM_SAFE_FREE(pass->vertexcode); MEM_SAFE_FREE(pass->defines); - if (pass->binary.content) { - MEM_freeN(pass->binary.content); - } MEM_freeN(pass); } diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h index ce20f495ba3..1454edeb1e0 100644 --- a/source/blender/gpu/intern/gpu_codegen.h +++ b/source/blender/gpu/intern/gpu_codegen.h @@ -23,8 +23,7 @@ * Generate shader code from the intermediate node graph. */ -#ifndef __GPU_CODEGEN_H__ -#define __GPU_CODEGEN_H__ +#pragma once struct GPUMaterial; struct GPUNodeGraph; @@ -43,11 +42,6 @@ typedef struct GPUPass { char *defines; uint refcount; /* Orphaned GPUPasses gets freed by the garbage collector. */ uint32_t hash; /* Identity hash generated from all GLSL code. */ - struct { - char *content; - uint format; - int len; - } binary; bool compiled; /* Did we already tried to compile the attached GPUShader. */ } GPUPass; @@ -67,5 +61,3 @@ void GPU_pass_release(GPUPass *pass); void gpu_codegen_init(void); void gpu_codegen_exit(void); - -#endif /* __GPU_CODEGEN_H__ */ diff --git a/source/blender/gpu/intern/gpu_context.cpp b/source/blender/gpu/intern/gpu_context.cpp index 0b9104e5349..e6356580ea3 100644 --- a/source/blender/gpu/intern/gpu_context.cpp +++ b/source/blender/gpu/intern/gpu_context.cpp @@ -62,6 +62,7 @@ static std::vector<GLuint> orphaned_buffer_ids; static std::vector<GLuint> orphaned_texture_ids; static std::mutex orphans_mutex; +static std::mutex main_context_mutex; struct GPUContext { GLuint default_vao; @@ -345,3 +346,13 @@ struct GPUMatrixState *gpu_context_active_matrix_state_get() BLI_assert(active_ctx); return active_ctx->matrix_state; } + +void GPU_context_main_lock(void) +{ + main_context_mutex.lock(); +} + +void GPU_context_main_unlock(void) +{ + main_context_mutex.unlock(); +} diff --git a/source/blender/gpu/intern/gpu_context_private.h b/source/blender/gpu/intern/gpu_context_private.h index f64cdf439a1..08fbefe3b3f 100644 --- a/source/blender/gpu/intern/gpu_context_private.h +++ b/source/blender/gpu/intern/gpu_context_private.h @@ -23,8 +23,7 @@ * This interface allow GPU to manage GL objects for multiple context and threads. */ -#ifndef __GPU_CONTEXT_PRIVATE_H__ -#define __GPU_CONTEXT_PRIVATE_H__ +#pragma once #include "GPU_context.h" @@ -64,5 +63,3 @@ struct GPUMatrixState *gpu_context_active_matrix_state_get(void); #ifdef __cplusplus } #endif - -#endif /* __GPU_CONTEXT_PRIVATE_H__ */ diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 77ad16eeb72..9c37cc32e1d 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -95,7 +95,7 @@ static struct GPUGlobal { bool broken_amd_driver; /* Some crappy Intel drivers don't work well with shaders created in different * rendering contexts. */ - bool context_local_shaders_workaround; + bool use_main_context_workaround; /* Intel drivers exhibit artifacts when using #glCopyImageSubData & workbench anti-aliasing. * (see T76273) */ bool texture_copy_workaround; @@ -222,9 +222,9 @@ bool GPU_unused_fb_slot_workaround(void) return GG.unused_fb_slot_workaround; } -bool GPU_context_local_shaders_workaround(void) +bool GPU_use_main_context_workaround(void) { - return GG.context_local_shaders_workaround; + return GG.use_main_context_workaround; } bool GPU_texture_copy_workaround(void) @@ -350,7 +350,8 @@ void gpu_extensions_init(void) /* Intel Ivy Bridge GPU's seems to have buggy cube-map array support. (see T75943) */ if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_WIN, GPU_DRIVER_OFFICIAL) && - (strstr(renderer, "HD Graphics 4000") || strstr(renderer, "HD Graphics 2500"))) { + (strstr(renderer, "HD Graphics 4000") || strstr(renderer, "HD Graphics 4400") || + strstr(renderer, "HD Graphics 2500"))) { GG.glew_arb_texture_cube_map_array_is_supported = false; } @@ -380,12 +381,12 @@ void gpu_extensions_init(void) /* Maybe not all of these drivers have problems with `GLEW_ARB_base_instance`. * But it's hard to test each case. */ GG.glew_arb_base_instance_is_supported = false; - GG.context_local_shaders_workaround = true; + GG.use_main_context_workaround = true; } if (strstr(version, "Build 20.19.15.4285")) { /* Somehow fixes armature display issues (see T69743). */ - GG.context_local_shaders_workaround = true; + GG.use_main_context_workaround = true; } } else if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE) && diff --git a/source/blender/gpu/intern/gpu_immediate.c b/source/blender/gpu/intern/gpu_immediate.c index 4f5cb3fcc91..1e99371f9a1 100644 --- a/source/blender/gpu/intern/gpu_immediate.c +++ b/source/blender/gpu/intern/gpu_immediate.c @@ -934,6 +934,14 @@ void immUniformThemeColor(int color_id) immUniformColor4fv(color); } +void immUniformThemeColorAlpha(int color_id, float a) +{ + float color[4]; + UI_GetThemeColor3fv(color_id, color); + color[3] = a; + immUniformColor4fv(color); +} + void immUniformThemeColor3(int color_id) { float color[3]; diff --git a/source/blender/gpu/intern/gpu_material_library.h b/source/blender/gpu/intern/gpu_material_library.h index f69c25b9490..da7b1636fa3 100644 --- a/source/blender/gpu/intern/gpu_material_library.h +++ b/source/blender/gpu/intern/gpu_material_library.h @@ -22,8 +22,7 @@ * * Parsing of and code generation using GLSL shaders in gpu/shaders/material. */ -#ifndef __GPU_MATERIAL_LIBRARY_H__ -#define __GPU_MATERIAL_LIBRARY_H__ +#pragma once #include "GPU_material.h" @@ -65,5 +64,3 @@ char *gpu_material_library_generate_code(struct GSet *used_libraries, const char char *gpu_str_skip_token(char *str, char *token, int max); const char *gpu_data_type_to_string(const eGPUType type); - -#endif /* __ __GPU_MATERIAL_LIBRARY_H__ */ diff --git a/source/blender/gpu/intern/gpu_matrix_private.h b/source/blender/gpu/intern/gpu_matrix_private.h index 862ef065481..3448b0a95aa 100644 --- a/source/blender/gpu/intern/gpu_matrix_private.h +++ b/source/blender/gpu/intern/gpu_matrix_private.h @@ -18,8 +18,7 @@ * \ingroup gpu */ -#ifndef __GPU_MATRIX_PRIVATE_H__ -#define __GPU_MATRIX_PRIVATE_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -31,5 +30,3 @@ void GPU_matrix_state_discard(struct GPUMatrixState *state); #ifdef __cplusplus } #endif - -#endif /* __GPU_MATRIX_PRIVATE_H__ */ diff --git a/source/blender/gpu/intern/gpu_node_graph.h b/source/blender/gpu/intern/gpu_node_graph.h index bf59b720cff..21bb139f610 100644 --- a/source/blender/gpu/intern/gpu_node_graph.h +++ b/source/blender/gpu/intern/gpu_node_graph.h @@ -23,8 +23,7 @@ * Intermediate node graph for generating GLSL shaders. */ -#ifndef __GPU_NODE_GRAPH_H__ -#define __GPU_NODE_GRAPH_H__ +#pragma once #include "DNA_customdata_types.h" #include "DNA_listBase.h" @@ -165,5 +164,3 @@ struct GPUTexture **gpu_material_ramp_texture_row_set(struct GPUMaterial *mat, float *row); struct GSet *gpu_material_used_libraries(struct GPUMaterial *material); - -#endif /* __GPU_NODE_GRAPH_H__ */ diff --git a/source/blender/gpu/intern/gpu_primitive_private.h b/source/blender/gpu/intern/gpu_primitive_private.h index abefa6abd20..b3b6bd7fc88 100644 --- a/source/blender/gpu/intern/gpu_primitive_private.h +++ b/source/blender/gpu/intern/gpu_primitive_private.h @@ -23,9 +23,6 @@ * GPU geometric primitives */ -#ifndef __GPU_PRIMITIVE_PRIVATE_H__ -#define __GPU_PRIMITIVE_PRIVATE_H__ +#pragma once GLenum convert_prim_type_to_gl(GPUPrimType); - -#endif /* __GPU_PRIMITIVE_PRIVATE_H__ */ diff --git a/source/blender/gpu/intern/gpu_private.h b/source/blender/gpu/intern/gpu_private.h index 7846bff87f4..a5caa816ef4 100644 --- a/source/blender/gpu/intern/gpu_private.h +++ b/source/blender/gpu/intern/gpu_private.h @@ -18,8 +18,7 @@ * \ingroup gpu */ -#ifndef __GPU_PRIVATE_H__ -#define __GPU_PRIVATE_H__ +#pragma once /* call this before running any of the functions below */ void gpu_platform_init(void); @@ -40,5 +39,3 @@ void gpu_framebuffer_module_exit(void); /* gpu_pbvh.c */ void gpu_pbvh_init(void); void gpu_pbvh_exit(void); - -#endif /* __GPU_PRIVATE_H__ */ diff --git a/source/blender/gpu/intern/gpu_select_private.h b/source/blender/gpu/intern/gpu_select_private.h index a0619bd4293..e364b78bff2 100644 --- a/source/blender/gpu/intern/gpu_select_private.h +++ b/source/blender/gpu/intern/gpu_select_private.h @@ -23,8 +23,7 @@ * Selection implementations. */ -#ifndef __GPU_SELECT_PRIVATE_H__ -#define __GPU_SELECT_PRIVATE_H__ +#pragma once /* gpu_select_pick */ void gpu_select_pick_begin(uint (*buffer)[4], uint bufsize, const rcti *input, char mode); @@ -43,5 +42,3 @@ bool gpu_select_query_load_id(uint id); uint gpu_select_query_end(void); #define SELECT_ID_NONE ((uint)0xffffffff) - -#endif /* __GPU_SELECT_PRIVATE_H__ */ diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c index 9ea798e5669..1578e0e19ce 100644 --- a/source/blender/gpu/intern/gpu_shader.c +++ b/source/blender/gpu/intern/gpu_shader.c @@ -230,6 +230,7 @@ static void gpu_shader_standard_extensions(char defines[MAX_EXT_DEFINE_LENGTH]) } if (GLEW_ARB_shader_draw_parameters) { strcat(defines, "#extension GL_ARB_shader_draw_parameters : enable\n"); + strcat(defines, "#define GPU_ARB_shader_draw_parameters\n"); } if (GPU_arb_texture_cube_map_array_is_supported()) { strcat(defines, "#extension GL_ARB_texture_cube_map_array : enable\n"); diff --git a/source/blender/gpu/intern/gpu_shader_private.h b/source/blender/gpu/intern/gpu_shader_private.h index e4443e79a8d..e04d8655421 100644 --- a/source/blender/gpu/intern/gpu_shader_private.h +++ b/source/blender/gpu/intern/gpu_shader_private.h @@ -18,8 +18,7 @@ * \ingroup gpu */ -#ifndef __GPU_SHADER_PRIVATE_H__ -#define __GPU_SHADER_PRIVATE_H__ +#pragma once #include "GPU_glew.h" #include "GPU_shader_interface.h" @@ -46,5 +45,3 @@ struct GPUShader { /* XXX do not use it. Special hack to use OCIO with batch API. */ void immGetProgram(GLuint *program, GPUShaderInterface **shaderface); - -#endif /* __GPU_SHADER_PRIVATE_H__ */ diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c index 4c847236f09..5bbfd04c114 100644 --- a/source/blender/gpu/intern/gpu_texture.c +++ b/source/blender/gpu/intern/gpu_texture.c @@ -677,6 +677,13 @@ static float *GPU_texture_rescale_3d( static bool gpu_texture_check_capacity( GPUTexture *tex, GLenum proxy, GLenum internalformat, GLenum data_format, GLenum data_type) { + if (proxy == GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB && + GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_MAC, GPU_DRIVER_ANY)) { + /* Special fix for T79703. */ + /* Depth has already been checked. */ + return tex->w <= GPU_max_cube_map_size(); + } + if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_WIN, GPU_DRIVER_ANY) || GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_MAC, GPU_DRIVER_OFFICIAL) || GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OFFICIAL)) { @@ -733,6 +740,7 @@ static bool gpu_texture_check_capacity( break; case GL_PROXY_TEXTURE_1D_ARRAY: case GL_PROXY_TEXTURE_2D: + case GL_PROXY_TEXTURE_CUBE_MAP: glTexImage2D(proxy, 0, internalformat, tex->w, tex->h, 0, data_format, data_type, NULL); break; case GL_PROXY_TEXTURE_2D_ARRAY: @@ -740,6 +748,10 @@ static bool gpu_texture_check_capacity( glTexImage3D( proxy, 0, internalformat, tex->w, tex->h, tex->d, 0, data_format, data_type, NULL); break; + case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB: + glTexImage3D( + proxy, 0, internalformat, tex->w, tex->h, tex->d * 6, 0, data_format, data_type, NULL); + break; } int width = 0; glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &width); @@ -764,8 +776,11 @@ static bool gpu_texture_try_alloc(GPUTexture *tex, ret = gpu_texture_check_capacity(tex, proxy, internalformat, data_format, data_type); if (!ret && try_rescale) { - BLI_assert( - !ELEM(proxy, GL_PROXY_TEXTURE_1D_ARRAY, GL_PROXY_TEXTURE_2D_ARRAY)); // not implemented + BLI_assert(!ELEM(proxy, + GL_PROXY_TEXTURE_1D_ARRAY, + GL_PROXY_TEXTURE_2D_ARRAY, + GL_PROXY_TEXTURE_CUBE_MAP, + GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB)); // not implemented const int w = tex->w, h = tex->h, d = tex->d; @@ -925,14 +940,16 @@ GPUTexture *GPU_texture_create_nD(int w, &rescaled_pixels); if (G.debug & G_DEBUG_GPU || !valid) { - printf("GPUTexture: create : %s, %s, w : %d, h : %d, d : %d, comp : %d, size : %.2f MiB\n", - gl_enum_to_str(tex->target), - gl_enum_to_str(internalformat), - w, - h, - d, - tex->components, - gpu_texture_memory_footprint_compute(tex) / 1048576.0f); + printf( + "GPUTexture: create : %s,\t w : %5d, h : %5d, d : %5d, comp : %4d, size : %.2f " + "MiB,\t %s\n", + gl_enum_to_str(tex->target), + w, + h, + d, + tex->components, + gpu_texture_memory_footprint_compute(tex) / 1048576.0f, + gl_enum_to_str(internalformat)); } if (!valid) { @@ -1014,10 +1031,14 @@ GPUTexture *GPU_texture_cube_create(int w, tex->format_flag = GPU_FORMAT_CUBE; tex->number = -1; + GLenum proxy; + if (d == 0) { + proxy = GL_PROXY_TEXTURE_CUBE_MAP; tex->target_base = tex->target = GL_TEXTURE_CUBE_MAP; } else { + proxy = GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB; tex->target_base = tex->target = GL_TEXTURE_CUBE_MAP_ARRAY_ARB; tex->format_flag |= GPU_FORMAT_ARRAY; @@ -1053,15 +1074,36 @@ GPUTexture *GPU_texture_cube_create(int w, return NULL; } - if (G.debug & G_DEBUG_GPU) { - printf("GPUTexture: create : %s, %s, w : %d, h : %d, d : %d, comp : %d, size : %.2f MiB\n", - gl_enum_to_str(tex->target), - gl_enum_to_str(internalformat), - w, - w, - d, - tex->components, - gpu_texture_memory_footprint_compute(tex) / 1048576.0f); + bool valid = gpu_texture_try_alloc( + tex, proxy, internalformat, data_format, data_type, tex->components, false, NULL, NULL); + + if (G.debug & G_DEBUG_GPU || !valid) { + printf( + "GPUTexture: create : %s,\t w : %5d, h : %5d, d : %5d, comp : %4d, size : %.2f " + "MiB,\t %s\n", + gl_enum_to_str(tex->target), + w, + w, + d * 6, + tex->components, + gpu_texture_memory_footprint_compute(tex) / 1048576.0f, + gl_enum_to_str(internalformat)); + } + + if (!valid) { + if (err_out) { + BLI_strncpy(err_out, "GPUTexture: texture alloc failed\n", 256); + } + else { + fprintf(stderr, + "GPUTexture: texture alloc failed. Likely not enough Video Memory or the requested " + "size is not supported by the implementation.\n"); + fprintf(stderr, + "Current texture memory usage : %.2f MiB.\n", + gpu_texture_memory_footprint_compute(tex) / 1048576.0f); + } + GPU_texture_free(tex); + return NULL; } gpu_texture_memory_footprint_add(tex); @@ -2195,7 +2237,7 @@ void GPU_samplers_init(void) glGenSamplers(1, &GG.icon_sampler); glSamplerParameteri(GG.icon_sampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); glSamplerParameteri(GG.icon_sampler, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glSamplerParameteri(GG.icon_sampler, GL_TEXTURE_LOD_BIAS, -0.5f); + glSamplerParameterf(GG.icon_sampler, GL_TEXTURE_LOD_BIAS, -0.5f); } void GPU_sampler_icon_bind(int unit) diff --git a/source/blender/gpu/intern/gpu_vertex_format_private.h b/source/blender/gpu/intern/gpu_vertex_format_private.h index a850d17a1dd..a80c085b44a 100644 --- a/source/blender/gpu/intern/gpu_vertex_format_private.h +++ b/source/blender/gpu/intern/gpu_vertex_format_private.h @@ -23,11 +23,8 @@ * GPU vertex format */ -#ifndef __GPU_VERTEX_FORMAT_PRIVATE_H__ -#define __GPU_VERTEX_FORMAT_PRIVATE_H__ +#pragma once void VertexFormat_pack(GPUVertFormat *format); uint padding(uint offset, uint alignment); uint vertex_buffer_size(const GPUVertFormat *format, uint vertex_len); - -#endif /* __GPU_VERTEX_FORMAT_PRIVATE_H__ */ diff --git a/source/blender/gpu/intern/gpu_viewport.c b/source/blender/gpu/intern/gpu_viewport.c index 4d31366f53f..7f133ca626d 100644 --- a/source/blender/gpu/intern/gpu_viewport.c +++ b/source/blender/gpu/intern/gpu_viewport.c @@ -1036,3 +1036,15 @@ void GPU_viewport_free(GPUViewport *viewport) MEM_freeN(viewport); } + +GPUFrameBuffer *GPU_viewport_framebuffer_default_get(GPUViewport *viewport) +{ + DefaultFramebufferList *fbl = GPU_viewport_framebuffer_list_get(viewport); + return fbl->default_fb; +} + +GPUFrameBuffer *GPU_viewport_framebuffer_overlay_get(GPUViewport *viewport) +{ + DefaultFramebufferList *fbl = GPU_viewport_framebuffer_list_get(viewport); + return fbl->overlay_fb; +} diff --git a/source/blender/ikplugin/BIK_api.h b/source/blender/ikplugin/BIK_api.h index 2c2053b47a6..fa7d7ff555c 100644 --- a/source/blender/ikplugin/BIK_api.h +++ b/source/blender/ikplugin/BIK_api.h @@ -22,8 +22,7 @@ * \ingroup ikplugin */ -#ifndef __BIK_API_H__ -#define __BIK_API_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -54,5 +53,3 @@ void BIK_test_constraint(struct Object *ob, struct bConstraint *cons); #ifdef __cplusplus } #endif - -#endif /* __BIK_API_H__ */ diff --git a/source/blender/ikplugin/intern/ikplugin_api.h b/source/blender/ikplugin/intern/ikplugin_api.h index faf21cecacd..f61ba7e3a63 100644 --- a/source/blender/ikplugin/intern/ikplugin_api.h +++ b/source/blender/ikplugin/intern/ikplugin_api.h @@ -22,8 +22,7 @@ * \ingroup ikplugin */ -#ifndef __IKPLUGIN_API_H__ -#define __IKPLUGIN_API_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -56,5 +55,3 @@ typedef struct IKPlugin IKPlugin; #ifdef __cplusplus } #endif - -#endif /* __IKPLUGIN_API_H__ */ diff --git a/source/blender/ikplugin/intern/iksolver_plugin.h b/source/blender/ikplugin/intern/iksolver_plugin.h index 20a9e78cc47..28356b4fc9c 100644 --- a/source/blender/ikplugin/intern/iksolver_plugin.h +++ b/source/blender/ikplugin/intern/iksolver_plugin.h @@ -22,8 +22,7 @@ * \ingroup ikplugin */ -#ifndef __IKSOLVER_PLUGIN_H__ -#define __IKSOLVER_PLUGIN_H__ +#pragma once #include "ikplugin_api.h" @@ -46,5 +45,3 @@ void iksolver_clear_data(struct bPose *pose); #ifdef __cplusplus } #endif - -#endif /* __IKSOLVER_PLUGIN_H__ */ diff --git a/source/blender/ikplugin/intern/itasc_plugin.h b/source/blender/ikplugin/intern/itasc_plugin.h index e7a319809b7..89342295b35 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.h +++ b/source/blender/ikplugin/intern/itasc_plugin.h @@ -22,8 +22,7 @@ * \ingroup ikplugin */ -#ifndef __ITASC_PLUGIN_H__ -#define __ITASC_PLUGIN_H__ +#pragma once #include "ikplugin_api.h" @@ -49,5 +48,3 @@ void itasc_test_constraint(struct Object *ob, struct bConstraint *cons); #ifdef __cplusplus } #endif - -#endif /* __ITASC_PLUGIN_H__ */ diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h index 4530f6c9fc0..54f126684ae 100644 --- a/source/blender/imbuf/IMB_colormanagement.h +++ b/source/blender/imbuf/IMB_colormanagement.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __IMB_COLORMANAGEMENT_H__ -#define __IMB_COLORMANAGEMENT_H__ +#pragma once /** \file * \ingroup imbuf @@ -374,5 +373,3 @@ enum { #endif #include "intern/colormanagement_inline.c" - -#endif /* __IMB_COLORMANAGEMENT_H__ */ diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 478297e61b2..0f3d121ff96 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -53,8 +53,7 @@ * posix-compliant. */ -#ifndef __IMB_IMBUF_H__ -#define __IMB_IMBUF_H__ +#pragma once /* for bool */ #include "../blenlib/BLI_sys_types.h" @@ -766,5 +765,3 @@ void IMB_ImBufFromStereo3d(struct Stereo3dFormat *s3d, #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h index ddc8394264a..98e9c34a4ff 100644 --- a/source/blender/imbuf/IMB_imbuf_types.h +++ b/source/blender/imbuf/IMB_imbuf_types.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __IMB_IMBUF_TYPES_H__ -#define __IMB_IMBUF_TYPES_H__ +#pragma once #include "DNA_vec_types.h" /* for rcti */ @@ -353,5 +352,3 @@ enum { #ifdef __cplusplus } #endif - -#endif /* __IMB_IMBUF_TYPES_H__ */ diff --git a/source/blender/imbuf/IMB_metadata.h b/source/blender/imbuf/IMB_metadata.h index edbdd7be482..501bf9dfba1 100644 --- a/source/blender/imbuf/IMB_metadata.h +++ b/source/blender/imbuf/IMB_metadata.h @@ -21,8 +21,7 @@ * \ingroup imbuf */ -#ifndef __IMB_METADATA_H__ -#define __IMB_METADATA_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -84,5 +83,3 @@ void IMB_metadata_foreach(struct ImBuf *ibuf, IMBMetadataForeachCb callback, voi #ifdef __cplusplus } #endif - -#endif /* __IMB_METADATA_H__ */ diff --git a/source/blender/imbuf/IMB_moviecache.h b/source/blender/imbuf/IMB_moviecache.h index 5fb158f0d8b..8e5f15a64a0 100644 --- a/source/blender/imbuf/IMB_moviecache.h +++ b/source/blender/imbuf/IMB_moviecache.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __IMB_MOVIECACHE_H__ -#define __IMB_MOVIECACHE_H__ +#pragma once /** \file * \ingroup imbuf @@ -85,5 +84,3 @@ void *IMB_moviecacheIter_getUserKey(struct MovieCacheIter *iter); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/imbuf/IMB_thumbs.h b/source/blender/imbuf/IMB_thumbs.h index 00e9a810ef3..e8c244aaba7 100644 --- a/source/blender/imbuf/IMB_thumbs.h +++ b/source/blender/imbuf/IMB_thumbs.h @@ -21,8 +21,7 @@ * \ingroup imbuf */ -#ifndef __IMB_THUMBS_H__ -#define __IMB_THUMBS_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -98,5 +97,3 @@ void IMB_thumb_path_unlock(const char *path); #ifdef __cplusplus } #endif /* __cplusplus */ - -#endif /* __IMB_THUMBS_H__ */ diff --git a/source/blender/imbuf/intern/IMB_allocimbuf.h b/source/blender/imbuf/intern/IMB_allocimbuf.h index 9f89969cf1c..08aa1936a6f 100644 --- a/source/blender/imbuf/intern/IMB_allocimbuf.h +++ b/source/blender/imbuf/intern/IMB_allocimbuf.h @@ -21,8 +21,7 @@ * \ingroup imbuf * \brief Header file for allocimbuf.c */ -#ifndef __IMB_ALLOCIMBUF_H__ -#define __IMB_ALLOCIMBUF_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -51,5 +50,3 @@ bool imb_enlargeencodedbufferImBuf(struct ImBuf *ibuf); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/imbuf/intern/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h index 3d1d99963c7..babff5c34cd 100644 --- a/source/blender/imbuf/intern/IMB_anim.h +++ b/source/blender/imbuf/intern/IMB_anim.h @@ -21,8 +21,7 @@ * \ingroup imbuf */ -#ifndef __IMB_ANIM_H__ -#define __IMB_ANIM_H__ +#pragma once #ifdef _WIN32 # define INC_OLE2 @@ -152,5 +151,3 @@ struct anim { struct IDProperty *metadata; }; - -#endif diff --git a/source/blender/imbuf/intern/IMB_colormanagement_intern.h b/source/blender/imbuf/intern/IMB_colormanagement_intern.h index 79abe8472b9..6b505a7171a 100644 --- a/source/blender/imbuf/intern/IMB_colormanagement_intern.h +++ b/source/blender/imbuf/intern/IMB_colormanagement_intern.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __IMB_COLORMANAGEMENT_INTERN_H__ -#define __IMB_COLORMANAGEMENT_INTERN_H__ +#pragma once /** \file * \ingroup imbuf @@ -130,5 +129,3 @@ void colormanage_imbuf_make_linear(struct ImBuf *ibuf, const char *from_colorspa #ifdef __cplusplus } #endif - -#endif /* __IMB_COLORMANAGEMENT_INTERN_H__ */ diff --git a/source/blender/imbuf/intern/IMB_filetype.h b/source/blender/imbuf/intern/IMB_filetype.h index ce731a3a86d..2b00b87d3d2 100644 --- a/source/blender/imbuf/intern/IMB_filetype.h +++ b/source/blender/imbuf/intern/IMB_filetype.h @@ -18,8 +18,7 @@ * \ingroup imbuf */ -#ifndef __IMB_FILETYPE_H__ -#define __IMB_FILETYPE_H__ +#pragma once #include "IMB_imbuf.h" @@ -151,5 +150,3 @@ struct ImBuf *imb_loadtiff(const unsigned char *mem, void imb_loadtiletiff( struct ImBuf *ibuf, const unsigned char *mem, size_t size, int tx, int ty, unsigned int *rect); int imb_savetiff(struct ImBuf *ibuf, const char *name, int flags); - -#endif /* __IMB_FILETYPE_H__ */ diff --git a/source/blender/imbuf/intern/IMB_filter.h b/source/blender/imbuf/intern/IMB_filter.h index 2cd785e6889..556362d78c1 100644 --- a/source/blender/imbuf/intern/IMB_filter.h +++ b/source/blender/imbuf/intern/IMB_filter.h @@ -22,8 +22,7 @@ * \brief Function declarations for filter.c */ -#ifndef __IMB_FILTER_H__ -#define __IMB_FILTER_H__ +#pragma once struct ImBuf; @@ -36,5 +35,3 @@ void IMB_unpremultiply_rect(unsigned int *rect, char planes, int w, int h); void IMB_unpremultiply_rect_float(float *rect_float, int channels, int w, int h); void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1); - -#endif diff --git a/source/blender/imbuf/intern/IMB_indexer.h b/source/blender/imbuf/intern/IMB_indexer.h index 446aaa0655e..7cd11e137c2 100644 --- a/source/blender/imbuf/intern/IMB_indexer.h +++ b/source/blender/imbuf/intern/IMB_indexer.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __IMB_INDEXER_H__ -#define __IMB_INDEXER_H__ +#pragma once /** \file * \ingroup imbuf @@ -113,5 +112,3 @@ struct anim_index *IMB_anim_open_index(struct anim *anim, IMB_Timecode_Type tc); int IMB_proxy_size_to_array_index(IMB_Proxy_Size pr_size); int IMB_timecode_to_array_index(IMB_Timecode_Type tc); - -#endif diff --git a/source/blender/imbuf/intern/cineon/cineonlib.h b/source/blender/imbuf/intern/cineon/cineonlib.h index 040435e44ee..d1225027b4c 100644 --- a/source/blender/imbuf/intern/cineon/cineonlib.h +++ b/source/blender/imbuf/intern/cineon/cineonlib.h @@ -23,8 +23,7 @@ * Also handles DPX files (almost) */ -#ifndef __CINEONLIB_H__ -#define __CINEONLIB_H__ +#pragma once #include "logImageCore.h" @@ -135,5 +134,3 @@ LogImageFile *cineonCreate( #ifdef __cplusplus } #endif - -#endif /* __CINEONLIB_H__ */ diff --git a/source/blender/imbuf/intern/cineon/dpxlib.h b/source/blender/imbuf/intern/cineon/dpxlib.h index 3a7ebe9dddf..6b729dba59a 100644 --- a/source/blender/imbuf/intern/cineon/dpxlib.h +++ b/source/blender/imbuf/intern/cineon/dpxlib.h @@ -22,8 +22,7 @@ * DPX image file format library definitions. */ -#ifndef __DPXLIB_H__ -#define __DPXLIB_H__ +#pragma once #include "logImageCore.h" @@ -160,5 +159,3 @@ LogImageFile *dpxCreate(const char *filename, #ifdef __cplusplus } #endif - -#endif /* __DPXLIB_H__ */ diff --git a/source/blender/imbuf/intern/cineon/logImageCore.h b/source/blender/imbuf/intern/cineon/logImageCore.h index 3d49da7eb42..a2d50f21a98 100644 --- a/source/blender/imbuf/intern/cineon/logImageCore.h +++ b/source/blender/imbuf/intern/cineon/logImageCore.h @@ -27,8 +27,7 @@ * Hmm. I thought the two formats would have more in common! */ -#ifndef __LOGIMAGECORE_H__ -#define __LOGIMAGECORE_H__ +#pragma once #include <stdio.h> @@ -295,5 +294,3 @@ BLI_INLINE unsigned int float_uint(float value, unsigned int max) #ifdef __cplusplus } #endif - -#endif /* __LOGIMAGECORE_H__ */ diff --git a/source/blender/imbuf/intern/cineon/logmemfile.h b/source/blender/imbuf/intern/cineon/logmemfile.h index d0ca03193e5..fd67011ef30 100644 --- a/source/blender/imbuf/intern/cineon/logmemfile.h +++ b/source/blender/imbuf/intern/cineon/logmemfile.h @@ -22,8 +22,7 @@ * Cineon image file format library routines. */ -#ifndef __LOGMEMFILE_H__ -#define __LOGMEMFILE_H__ +#pragma once #include "logImageCore.h" @@ -35,5 +34,3 @@ int logimage_fread(void *buffer, size_t size, unsigned int count, LogImageFile * int logimage_read_uchar(unsigned char *x, LogImageFile *logFile); int logimage_read_ushort(unsigned short *x, LogImageFile *logFile); int logimage_read_uint(unsigned int *x, LogImageFile *logFile); - -#endif /* __LOGMEMFILE_H__ */ diff --git a/source/blender/imbuf/intern/dds/BlockDXT.h b/source/blender/imbuf/intern/dds/BlockDXT.h index 57430dbaea2..70ec8808c61 100644 --- a/source/blender/imbuf/intern/dds/BlockDXT.h +++ b/source/blender/imbuf/intern/dds/BlockDXT.h @@ -48,8 +48,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. -#ifndef __BLOCKDXT_H__ -#define __BLOCKDXT_H__ +#pragma once #include <Color.h> #include <ColorBlock.h> @@ -305,5 +304,3 @@ void mem_read(Stream &mem, BlockDXT5 &block); void mem_read(Stream &mem, BlockATI1 &block); void mem_read(Stream &mem, BlockATI2 &block); void mem_read(Stream &mem, BlockCTX1 &block); - -#endif /* __BLOCKDXT_H__ */ diff --git a/source/blender/imbuf/intern/dds/Color.h b/source/blender/imbuf/intern/dds/Color.h index 36e2615759b..d0b67d4638c 100644 --- a/source/blender/imbuf/intern/dds/Color.h +++ b/source/blender/imbuf/intern/dds/Color.h @@ -27,8 +27,7 @@ // This code is in the public domain -- castanyo@yahoo.es -#ifndef __COLOR_H__ -#define __COLOR_H__ +#pragma once /// 32 bit color stored as BGRA. class Color32 { @@ -116,5 +115,3 @@ class Color16 { unsigned short u; }; }; - -#endif /* __COLOR_H__ */ diff --git a/source/blender/imbuf/intern/dds/ColorBlock.h b/source/blender/imbuf/intern/dds/ColorBlock.h index 2e8a6bbda7f..dd63286e230 100644 --- a/source/blender/imbuf/intern/dds/ColorBlock.h +++ b/source/blender/imbuf/intern/dds/ColorBlock.h @@ -27,8 +27,7 @@ // This code is in the public domain -- castanyo@yahoo.es -#ifndef __COLORBLOCK_H__ -#define __COLORBLOCK_H__ +#pragma once #include <Color.h> #include <Image.h> @@ -91,5 +90,3 @@ inline Color32 &ColorBlock::color(uint x, uint y) { return m_color[y * 4 + x]; } - -#endif /* __COLORBLOCK_H__ */ diff --git a/source/blender/imbuf/intern/dds/Common.h b/source/blender/imbuf/intern/dds/Common.h index 56f5d54cf42..90ec347a9ad 100644 --- a/source/blender/imbuf/intern/dds/Common.h +++ b/source/blender/imbuf/intern/dds/Common.h @@ -18,8 +18,7 @@ * \ingroup imbdds */ -#ifndef __COMMON_H__ -#define __COMMON_H__ +#pragma once #ifndef MIN # define MIN(a, b) ((a) <= (b) ? (a) : (b)) @@ -49,5 +48,3 @@ inline uint computePitch(uint w, uint bitsize, uint alignment) { return ((w * bitsize + 8 * alignment - 1) / (8 * alignment)) * alignment; } - -#endif diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.h b/source/blender/imbuf/intern/dds/DirectDrawSurface.h index f12c45d11df..ac7f893fddd 100644 --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.h +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.h @@ -48,8 +48,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. -#ifndef __DIRECTDRAWSURFACE_H__ -#define __DIRECTDRAWSURFACE_H__ +#pragma once #include <ColorBlock.h> #include <Common.h> @@ -184,5 +183,3 @@ void mem_read(Stream &mem, DDSPixelFormat &pf); void mem_read(Stream &mem, DDSCaps &caps); void mem_read(Stream &mem, DDSHeader &header); void mem_read(Stream &mem, DDSHeader10 &header); - -#endif /* __DIRECTDRAWSURFACE_H__ */ diff --git a/source/blender/imbuf/intern/dds/FlipDXT.h b/source/blender/imbuf/intern/dds/FlipDXT.h index b7056742430..d35157251bd 100644 --- a/source/blender/imbuf/intern/dds/FlipDXT.h +++ b/source/blender/imbuf/intern/dds/FlipDXT.h @@ -14,13 +14,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __FLIPDXT_H__ -#define __FLIPDXT_H__ +#pragma once #include "BLI_sys_types.h" /* flip compressed DXT image vertically to fit OpenGL convention */ int FlipDXTCImage( unsigned int width, unsigned int height, unsigned int levels, int fourcc, uint8_t *data); - -#endif diff --git a/source/blender/imbuf/intern/dds/Image.h b/source/blender/imbuf/intern/dds/Image.h index 2922d5cfda3..4ccfec99445 100644 --- a/source/blender/imbuf/intern/dds/Image.h +++ b/source/blender/imbuf/intern/dds/Image.h @@ -27,8 +27,7 @@ // This code is in the public domain -- castanyo@yahoo.es -#ifndef __IMAGE_H__ -#define __IMAGE_H__ +#pragma once #include "Color.h" #include "Common.h" @@ -89,5 +88,3 @@ inline Color32 &Image::pixel(uint x, uint y) { return pixel(y * width() + x); } - -#endif /* __IMAGE_H__ */ diff --git a/source/blender/imbuf/intern/dds/PixelFormat.h b/source/blender/imbuf/intern/dds/PixelFormat.h index 47585147dfb..a9125c64121 100644 --- a/source/blender/imbuf/intern/dds/PixelFormat.h +++ b/source/blender/imbuf/intern/dds/PixelFormat.h @@ -48,8 +48,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. -#ifndef __PIXELFORMAT_H__ -#define __PIXELFORMAT_H__ +#pragma once #include "Common.h" @@ -126,5 +125,3 @@ inline float quantizeFloor(float f, int bits) #endif } // namespace PixelFormat - -#endif /* __PIXELFORMAT_H__ */ diff --git a/source/blender/imbuf/intern/dds/Stream.h b/source/blender/imbuf/intern/dds/Stream.h index 43cd6b56fb9..ad6b9165801 100644 --- a/source/blender/imbuf/intern/dds/Stream.h +++ b/source/blender/imbuf/intern/dds/Stream.h @@ -20,8 +20,7 @@ /* simple memory stream functions with buffer overflow check */ -#ifndef __STREAM_H__ -#define __STREAM_H__ +#pragma once struct Stream { unsigned char *mem; // location in memory @@ -40,5 +39,3 @@ unsigned int mem_read(Stream &mem, unsigned int &i); unsigned int mem_read(Stream &mem, unsigned short &i); unsigned int mem_read(Stream &mem, unsigned char &i); unsigned int mem_read(Stream &mem, unsigned char *i, unsigned int cnt); - -#endif /* __STREAM_H__ */ diff --git a/source/blender/imbuf/intern/dds/dds_api.h b/source/blender/imbuf/intern/dds/dds_api.h index e6782e217fc..930205c9efb 100644 --- a/source/blender/imbuf/intern/dds/dds_api.h +++ b/source/blender/imbuf/intern/dds/dds_api.h @@ -18,8 +18,7 @@ * \ingroup imbdds */ -#ifndef __DDS_API_H__ -#define __DDS_API_H__ +#pragma once #include "../../IMB_imbuf.h" @@ -37,5 +36,3 @@ struct ImBuf *imb_load_dds(const unsigned char *mem, #ifdef __cplusplus } #endif - -#endif /* __DDS_API_H */ diff --git a/source/blender/imbuf/intern/imbuf.h b/source/blender/imbuf/intern/imbuf.h index 912c25f2616..309a911e9ca 100644 --- a/source/blender/imbuf/intern/imbuf.h +++ b/source/blender/imbuf/intern/imbuf.h @@ -21,8 +21,7 @@ * \ingroup imbuf */ -#ifndef __IMBUF_H__ -#define __IMBUF_H__ +#pragma once #include <stdio.h> #include <stdlib.h> @@ -61,5 +60,3 @@ #endif #define IMB_DPI_DEFAULT 72.0f - -#endif /* __IMBUF_H__ */ diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.h b/source/blender/imbuf/intern/oiio/openimageio_api.h index 3dd089d65cb..3f5f234099c 100644 --- a/source/blender/imbuf/intern/oiio/openimageio_api.h +++ b/source/blender/imbuf/intern/oiio/openimageio_api.h @@ -21,8 +21,7 @@ * \ingroup openimageio */ -#ifndef __OPENIMAGEIO_API_H__ -#define __OPENIMAGEIO_API_H__ +#pragma once #include <stdio.h> @@ -44,5 +43,3 @@ int OIIO_getVersionHex(void); } #endif - -#endif /* __OPENIMAGEIO_API_H__ */ diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 887225f0dc6..9b614eab0dc 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -1723,11 +1723,25 @@ static const char *exr_rgba_channelname(MultiPartInputFile &file, const char *ch return chan; } -static bool exr_has_rgb(MultiPartInputFile &file) +static int exr_has_rgb(MultiPartInputFile &file, const char *rgb_channels[3]) { - return file.header(0).channels().findChannel("R") != NULL && - file.header(0).channels().findChannel("G") != NULL && - file.header(0).channels().findChannel("B") != NULL; + /* Common names for RGB-like channels in order. */ + static const char *channel_names[] = { + "R", "Red", "G", "Green", "B", "Blue", "AR", "RA", "AG", "GA", "AB", "BA", NULL}; + + const Header &header = file.header(0); + int num_channels = 0; + + for (int i = 0; channel_names[i]; i++) { + if (header.channels().findChannel(channel_names[i])) { + rgb_channels[num_channels++] = channel_names[i]; + if (num_channels == 3) { + break; + } + } + } + + return num_channels; } static bool exr_has_luma(MultiPartInputFile &file) @@ -1735,23 +1749,27 @@ static bool exr_has_luma(MultiPartInputFile &file) /* Y channel is the luma and should always present fir luma space images, * optionally it could be also channels for chromas called BY and RY. */ - return file.header(0).channels().findChannel("Y") != NULL; + const Header &header = file.header(0); + return header.channels().findChannel("Y") != NULL; } static bool exr_has_chroma(MultiPartInputFile &file) { - return file.header(0).channels().findChannel("BY") != NULL && - file.header(0).channels().findChannel("RY") != NULL; + const Header &header = file.header(0); + return header.channels().findChannel("BY") != NULL && + header.channels().findChannel("RY") != NULL; } static bool exr_has_zbuffer(MultiPartInputFile &file) { - return !(file.header(0).channels().findChannel("Z") == NULL); + const Header &header = file.header(0); + return !(header.channels().findChannel("Z") == NULL); } static bool exr_has_alpha(MultiPartInputFile &file) { - return !(file.header(0).channels().findChannel("A") == NULL); + const Header &header = file.header(0); + return !(header.channels().findChannel("A") == NULL); } static bool exr_is_half_float(MultiPartInputFile &file) @@ -1957,7 +1975,8 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem, } } else { - const bool has_rgb = exr_has_rgb(*file); + const char *rgb_channels[3]; + const int num_rgb_channels = exr_has_rgb(*file, rgb_channels); const bool has_luma = exr_has_luma(*file); FrameBuffer frameBuffer; float *first; @@ -1972,13 +1991,11 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem, /* but, since we read y-flipped (negative y stride) we move to last scanline */ first += 4 * (height - 1) * width; - if (has_rgb) { - frameBuffer.insert(exr_rgba_channelname(*file, "R"), - Slice(Imf::FLOAT, (char *)first, xstride, ystride)); - frameBuffer.insert(exr_rgba_channelname(*file, "G"), - Slice(Imf::FLOAT, (char *)(first + 1), xstride, ystride)); - frameBuffer.insert(exr_rgba_channelname(*file, "B"), - Slice(Imf::FLOAT, (char *)(first + 2), xstride, ystride)); + if (num_rgb_channels > 0) { + for (int i = 0; i < num_rgb_channels; i++) { + frameBuffer.insert(exr_rgba_channelname(*file, rgb_channels[i]), + Slice(Imf::FLOAT, (char *)(first + i), xstride, ystride)); + } } else if (has_luma) { frameBuffer.insert(exr_rgba_channelname(*file, "Y"), @@ -2021,24 +2038,27 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem, // IMB_rect_from_float(ibuf); // } - if (!has_rgb && has_luma) { - size_t a; - if (exr_has_chroma(*file)) { - for (a = 0; a < (size_t)ibuf->x * ibuf->y; a++) { - float *color = ibuf->rect_float + a * 4; - ycc_to_rgb(color[0] * 255.0f, - color[1] * 255.0f, - color[2] * 255.0f, - &color[0], - &color[1], - &color[2], - BLI_YCC_ITU_BT709); - } + if (num_rgb_channels == 0 && has_luma && exr_has_chroma(*file)) { + for (size_t a = 0; a < (size_t)ibuf->x * ibuf->y; a++) { + float *color = ibuf->rect_float + a * 4; + ycc_to_rgb(color[0] * 255.0f, + color[1] * 255.0f, + color[2] * 255.0f, + &color[0], + &color[1], + &color[2], + BLI_YCC_ITU_BT709); } - else { - for (a = 0; a < (size_t)ibuf->x * ibuf->y; a++) { - float *color = ibuf->rect_float + a * 4; - color[1] = color[2] = color[0]; + } + else if (num_rgb_channels <= 1) { + /* Convert 1 to 3 channels. */ + for (size_t a = 0; a < (size_t)ibuf->x * ibuf->y; a++) { + float *color = ibuf->rect_float + a * 4; + if (num_rgb_channels <= 1) { + color[1] = color[0]; + } + if (num_rgb_channels <= 2) { + color[2] = color[0]; } } } diff --git a/source/blender/imbuf/intern/openexr/openexr_api.h b/source/blender/imbuf/intern/openexr/openexr_api.h index b0835e5082e..73db146849b 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.h +++ b/source/blender/imbuf/intern/openexr/openexr_api.h @@ -21,8 +21,7 @@ * \ingroup openexr */ -#ifndef __OPENEXR_API_H__ -#define __OPENEXR_API_H__ +#pragma once #include <stdio.h> @@ -42,5 +41,3 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem, size_t size, int flags, #ifdef __cplusplus } #endif - -#endif /* __OPENEXR_API_H */ diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h index 58f103aeba0..7008447313d 100644 --- a/source/blender/imbuf/intern/openexr/openexr_multi.h +++ b/source/blender/imbuf/intern/openexr/openexr_multi.h @@ -21,8 +21,7 @@ * \ingroup openexr */ -#ifndef __OPENEXR_MULTI_H__ -#define __OPENEXR_MULTI_H__ +#pragma once /* experiment with more advanced exr api */ @@ -99,5 +98,3 @@ bool IMB_exr_has_multilayer(void *handle); #ifdef __cplusplus } // extern "C" #endif - -#endif /* __OPENEXR_MULTI_H */ diff --git a/source/blender/io/alembic/exporter/abc_export_capi.cc b/source/blender/io/alembic/exporter/abc_export_capi.cc index 98c551c635c..8c5f3d89870 100644 --- a/source/blender/io/alembic/exporter/abc_export_capi.cc +++ b/source/blender/io/alembic/exporter/abc_export_capi.cc @@ -48,6 +48,7 @@ static CLG_LogRef LOG = {"io.alembic"}; #include <algorithm> +#include <memory> struct ExportJobData { Main *bmain; @@ -103,17 +104,41 @@ static void export_startjob(void *customdata, const bool export_animation = (data->params.frame_start != data->params.frame_end); // Create the Alembic archive. - ABCArchive abc_archive(data->bmain, scene, data->params, std::string(data->filename)); + std::unique_ptr<ABCArchive> abc_archive; + try { + abc_archive = std::make_unique<ABCArchive>( + data->bmain, scene, data->params, std::string(data->filename)); + } + catch (const std::exception &ex) { + std::stringstream error_message_stream; + error_message_stream << "Error writing to " << data->filename; + const std::string &error_message = error_message_stream.str(); + + // The exception message can be very cryptic (just "iostream error" on Linux, for example), so + // better not to include it in the report. + CLOG_ERROR(&LOG, "%s: %s", error_message.c_str(), ex.what()); + WM_report(RPT_ERROR, error_message.c_str()); + data->export_ok = false; + return; + } + catch (...) { + // Unknown exception class, so we cannot include its message. + std::stringstream error_message_stream; + error_message_stream << "Unknown error writing to " << data->filename; + WM_report(RPT_ERROR, error_message_stream.str().c_str()); + data->export_ok = false; + return; + } - ABCHierarchyIterator iter(data->depsgraph, &abc_archive, data->params); + ABCHierarchyIterator iter(data->depsgraph, abc_archive.get(), data->params); if (export_animation) { CLOG_INFO(&LOG, 2, "Exporting animation"); // Writing the animated frames is not 100% of the work, but it's our best guess. - const float progress_per_frame = 1.0f / std::max(size_t(1), abc_archive.total_frame_count()); - ABCArchive::Frames::const_iterator frame_it = abc_archive.frames_begin(); - const ABCArchive::Frames::const_iterator frames_end = abc_archive.frames_end(); + const float progress_per_frame = 1.0f / std::max(size_t(1), abc_archive->total_frame_count()); + ABCArchive::Frames::const_iterator frame_it = abc_archive->frames_begin(); + const ABCArchive::Frames::const_iterator frames_end = abc_archive->frames_end(); for (; frame_it != frames_end; frame_it++) { double frame = *frame_it; @@ -128,7 +153,7 @@ static void export_startjob(void *customdata, BKE_scene_graph_update_for_newframe(data->depsgraph, data->bmain); CLOG_INFO(&LOG, 2, "Exporting frame %.2f", frame); - ExportSubset export_subset = abc_archive.export_subset_for_frame(frame); + ExportSubset export_subset = abc_archive->export_subset_for_frame(frame); iter.set_export_subset(export_subset); iter.iterate_and_write(); diff --git a/source/blender/io/alembic/exporter/abc_writer_curves.cc b/source/blender/io/alembic/exporter/abc_writer_curves.cc index f2a46c5e4fe..6f185020b58 100644 --- a/source/blender/io/alembic/exporter/abc_writer_curves.cc +++ b/source/blender/io/alembic/exporter/abc_writer_curves.cc @@ -80,9 +80,9 @@ void ABCCurveWriter::do_write(HierarchyContext &context) std::vector<uint8_t> orders; Imath::V3f temp_vert; - Alembic::AbcGeom::BasisType curve_basis; - Alembic::AbcGeom::CurveType curve_type; - Alembic::AbcGeom::CurvePeriodicity periodicity; + Alembic::AbcGeom::BasisType curve_basis = Alembic::AbcGeom::kNoBasis; + Alembic::AbcGeom::CurveType curve_type = Alembic::AbcGeom::kVariableOrder; + Alembic::AbcGeom::CurvePeriodicity periodicity = Alembic::AbcGeom::kNonPeriodic; Nurb *nurbs = static_cast<Nurb *>(curve->nurb.first); for (; nurbs; nurbs = nurbs->next) { diff --git a/source/blender/io/alembic/exporter/abc_writer_transform.cc b/source/blender/io/alembic/exporter/abc_writer_transform.cc index 65d6b7c5b41..39af99c142c 100644 --- a/source/blender/io/alembic/exporter/abc_writer_transform.cc +++ b/source/blender/io/alembic/exporter/abc_writer_transform.cc @@ -107,6 +107,9 @@ bool ABCTransformWriter::check_is_animated(const HierarchyContext &context) cons * depsgraph whether this object instance has a time source. */ return true; } + if (check_has_physics(context)) { + return true; + } return BKE_object_moves_in_time(context.object, context.animation_check_include_parent); } diff --git a/source/blender/io/avi/AVI_avi.h b/source/blender/io/avi/AVI_avi.h index 4f3aa720da3..ba1ef9261a0 100644 --- a/source/blender/io/avi/AVI_avi.h +++ b/source/blender/io/avi/AVI_avi.h @@ -39,8 +39,7 @@ * code. So we keep it like this. */ -#ifndef __AVI_AVI_H__ -#define __AVI_AVI_H__ +#pragma once #include "BLI_sys_types.h" #include <stdio.h> /* for FILE */ @@ -295,5 +294,3 @@ AviError AVI_write_frame(AviMovie *movie, int frame_num, ...); * Unused but still external */ AviError AVI_print_error(AviError error); - -#endif /* __AVI_AVI_H__ */ diff --git a/source/blender/io/avi/intern/avi_endian.h b/source/blender/io/avi/intern/avi_endian.h index d1253f488e7..88c13d17950 100644 --- a/source/blender/io/avi/intern/avi_endian.h +++ b/source/blender/io/avi/intern/avi_endian.h @@ -23,8 +23,7 @@ * This is external code. */ -#ifndef __AVI_ENDIAN_H__ -#define __AVI_ENDIAN_H__ +#pragma once #define AVI_RAW 0 #define AVI_CHUNK 1 @@ -36,5 +35,3 @@ #define AVI_MJPEGU 7 void awrite(AviMovie *movie, void *datain, int block, int size, FILE *fp, int type); - -#endif /* __AVI_ENDIAN_H__ */ diff --git a/source/blender/io/avi/intern/avi_intern.h b/source/blender/io/avi/intern/avi_intern.h index 6ce91ce7f70..28ab999f6e3 100644 --- a/source/blender/io/avi/intern/avi_intern.h +++ b/source/blender/io/avi/intern/avi_intern.h @@ -21,8 +21,7 @@ * \ingroup avi */ -#ifndef __AVI_INTERN_H__ -#define __AVI_INTERN_H__ +#pragma once #include <stdio.h> /* for FILE */ @@ -61,5 +60,3 @@ int avi_get_data_id(AviFormat format, int stream); int avi_get_format_type(AviFormat format); int avi_get_format_fcc(AviFormat format); int avi_get_format_compression(AviFormat format); - -#endif diff --git a/source/blender/io/avi/intern/avi_mjpeg.h b/source/blender/io/avi/intern/avi_mjpeg.h index 13153fa41f0..3ee1b611f70 100644 --- a/source/blender/io/avi/intern/avi_mjpeg.h +++ b/source/blender/io/avi/intern/avi_mjpeg.h @@ -21,13 +21,10 @@ * \ingroup avi */ -#ifndef __AVI_MJPEG_H__ -#define __AVI_MJPEG_H__ +#pragma once void *avi_converter_from_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, const size_t *size); void *avi_converter_to_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, size_t *size); - -#endif /* __AVI_MJPEG_H__ */ diff --git a/source/blender/io/avi/intern/avi_rgb.h b/source/blender/io/avi/intern/avi_rgb.h index 3a37fad94e1..aac8a2dffbf 100644 --- a/source/blender/io/avi/intern/avi_rgb.h +++ b/source/blender/io/avi/intern/avi_rgb.h @@ -21,13 +21,10 @@ * \ingroup avi */ -#ifndef __AVI_RGB_H__ -#define __AVI_RGB_H__ +#pragma once void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, unsigned char *buffer, const size_t *size); void *avi_converter_to_avi_rgb(AviMovie *movie, int stream, unsigned char *buffer, size_t *size); - -#endif /* __AVI_RGB_H__ */ diff --git a/source/blender/io/avi/intern/avi_rgb32.h b/source/blender/io/avi/intern/avi_rgb32.h index eb4b9ca4e21..675b1ced41e 100644 --- a/source/blender/io/avi/intern/avi_rgb32.h +++ b/source/blender/io/avi/intern/avi_rgb32.h @@ -21,10 +21,7 @@ * \ingroup avi */ -#ifndef __AVI_RGB32_H__ -#define __AVI_RGB32_H__ +#pragma once void *avi_converter_from_rgb32(AviMovie *movie, int stream, unsigned char *buffer, size_t *size); void *avi_converter_to_rgb32(AviMovie *movie, int stream, unsigned char *buffer, size_t *size); - -#endif /* __AVI_RGB32_H__ */ diff --git a/source/blender/io/collada/AnimationClipExporter.h b/source/blender/io/collada/AnimationClipExporter.h index 9d782eac094..a19fcb4d372 100644 --- a/source/blender/io/collada/AnimationClipExporter.h +++ b/source/blender/io/collada/AnimationClipExporter.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __ANIMATIONCLIPEXPORTER_H__ -#define __ANIMATIONCLIPEXPORTER_H__ +#pragma once #include <math.h> #include <stdio.h> @@ -49,5 +48,3 @@ class AnimationClipExporter : COLLADASW::LibraryAnimationClips { void exportAnimationClips(Scene *sce); }; - -#endif /* __ANIMATIONCLIPEXPORTER_H__ */ diff --git a/source/blender/io/collada/AnimationExporter.h b/source/blender/io/collada/AnimationExporter.h index b4564eb7b2d..48279b0c867 100644 --- a/source/blender/io/collada/AnimationExporter.h +++ b/source/blender/io/collada/AnimationExporter.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __ANIMATIONEXPORTER_H__ -#define __ANIMATIONEXPORTER_H__ +#pragma once #include <math.h> #include <stdio.h> @@ -258,5 +257,3 @@ class AnimationExporter : COLLADASW::LibraryAnimations { void export_morph_animation(Object *ob, BCAnimationSampler &sampler); #endif }; - -#endif /* __ANIMATIONEXPORTER_H__ */ diff --git a/source/blender/io/collada/AnimationImporter.h b/source/blender/io/collada/AnimationImporter.h index 51041c6ee3e..5c6f9400286 100644 --- a/source/blender/io/collada/AnimationImporter.h +++ b/source/blender/io/collada/AnimationImporter.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __ANIMATIONIMPORTER_H__ -#define __ANIMATIONIMPORTER_H__ +#pragma once #include <map> #include <vector> @@ -250,5 +249,3 @@ class AnimationImporter : private TransformReader, public AnimationImporterBase void extra_data_importer(std::string elementName); }; - -#endif diff --git a/source/blender/io/collada/ArmatureExporter.h b/source/blender/io/collada/ArmatureExporter.h index 3bc9dfe2639..193dc9cde3a 100644 --- a/source/blender/io/collada/ArmatureExporter.h +++ b/source/blender/io/collada/ArmatureExporter.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __ARMATUREEXPORTER_H__ -#define __ARMATUREEXPORTER_H__ +#pragma once #include <list> #include <string> @@ -103,5 +102,3 @@ class ArmatureExporter : public COLLADASW::LibraryControllers, void write_bone_URLs(COLLADASW::InstanceController &ins, Object *ob_arm, Bone *bone); }; - -#endif diff --git a/source/blender/io/collada/ArmatureImporter.h b/source/blender/io/collada/ArmatureImporter.h index 7393b882f4b..a1c4a25b80f 100644 --- a/source/blender/io/collada/ArmatureImporter.h +++ b/source/blender/io/collada/ArmatureImporter.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __ARMATUREIMPORTER_H__ -#define __ARMATUREIMPORTER_H__ +#pragma once #include "COLLADAFWMorphController.h" #include "COLLADAFWNode.h" @@ -181,5 +180,3 @@ class ArmatureImporter : private TransformReader { void set_tags_map(TagsMap &tags_map); }; - -#endif diff --git a/source/blender/io/collada/BCAnimationCurve.h b/source/blender/io/collada/BCAnimationCurve.h index e0216ee6849..779678bca1d 100644 --- a/source/blender/io/collada/BCAnimationCurve.h +++ b/source/blender/io/collada/BCAnimationCurve.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BCANIMATIONCURVE_H__ -#define __BCANIMATIONCURVE_H__ +#pragma once #include "BCSampleData.h" #include "collada_utils.h" @@ -147,5 +146,3 @@ class BCAnimationCurve { }; typedef std::map<BCCurveKey, BCAnimationCurve *> BCAnimationCurveMap; - -#endif /* __BCANIMATIONCURVE_H__ */ diff --git a/source/blender/io/collada/BCAnimationSampler.h b/source/blender/io/collada/BCAnimationSampler.h index 3273ac8e0a0..5ab4be3722c 100644 --- a/source/blender/io/collada/BCAnimationSampler.h +++ b/source/blender/io/collada/BCAnimationSampler.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BCANIMATIONSAMPLER_H__ -#define __BCANIMATIONSAMPLER_H__ +#pragma once #include "BCAnimationCurve.h" #include "BCSampleData.h" @@ -190,5 +189,3 @@ class BCAnimationSampler { ListBase *conlist, std::set<Object *> &animated_objects); }; - -#endif /* __BCANIMATIONSAMPLER_H__ */ diff --git a/source/blender/io/collada/BCMath.h b/source/blender/io/collada/BCMath.h index 38158751740..79a0ea941cd 100644 --- a/source/blender/io/collada/BCMath.h +++ b/source/blender/io/collada/BCMath.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __BCMATH_H__ -#define __BCMATH_H__ +#pragma once #include "BlenderTypes.h" @@ -105,5 +104,3 @@ class BCMatrix { static void sanitize(DMatrix &matrix, int precision); static void transpose(Matrix &matrix); }; - -#endif /* __BCMATH_H__ */ diff --git a/source/blender/io/collada/BCSampleData.h b/source/blender/io/collada/BCSampleData.h index 6f3ca9135b3..39e34355b72 100644 --- a/source/blender/io/collada/BCSampleData.h +++ b/source/blender/io/collada/BCSampleData.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __BCSAMPLEDATA_H__ -#define __BCSAMPLEDATA_H__ +#pragma once #include <algorithm> #include <map> @@ -62,5 +61,3 @@ class BCSample { typedef std::map<Object *, BCSample *> BCSampleMap; typedef std::map<int, const BCSample *> BCFrameSampleMap; typedef std::map<int, const BCMatrix *> BCMatrixSampleMap; - -#endif /* __BCSAMPLEDATA_H__ */ diff --git a/source/blender/io/collada/BlenderContext.h b/source/blender/io/collada/BlenderContext.h index bf6fde134fa..9163b30c86f 100644 --- a/source/blender/io/collada/BlenderContext.h +++ b/source/blender/io/collada/BlenderContext.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __BLENDERCONTEXT_H__ -#define __BLENDERCONTEXT_H__ +#pragma once #include "BKE_context.h" #include "BKE_main.h" @@ -68,5 +67,3 @@ class BlenderContext { Main *get_main(); }; #endif - -#endif diff --git a/source/blender/io/collada/BlenderTypes.h b/source/blender/io/collada/BlenderTypes.h index 0e024be2374..63b0471ef6f 100644 --- a/source/blender/io/collada/BlenderTypes.h +++ b/source/blender/io/collada/BlenderTypes.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __BLENDERTYPES_H__ -#define __BLENDERTYPES_H__ +#pragma once typedef float(Vector)[3]; typedef float(Quat)[4]; @@ -44,5 +43,3 @@ typedef enum BC_global_up_axis { BC_GLOBAL_UP_MINUS_Y = 4, BC_GLOBAL_UP_MINUS_Z = 5 } BC_global_up_axis; - -#endif diff --git a/source/blender/io/collada/CameraExporter.h b/source/blender/io/collada/CameraExporter.h index 0dda6392d03..cc4f7aee165 100644 --- a/source/blender/io/collada/CameraExporter.h +++ b/source/blender/io/collada/CameraExporter.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __CAMERAEXPORTER_H__ -#define __CAMERAEXPORTER_H__ +#pragma once #include "COLLADASWLibraryCameras.h" #include "COLLADASWStreamWriter.h" @@ -40,5 +39,3 @@ class CamerasExporter : COLLADASW::LibraryCameras { bool exportBlenderProfile(COLLADASW::Camera &cla, Camera *cam); BCExportSettings &export_settings; }; - -#endif diff --git a/source/blender/io/collada/ControllerExporter.h b/source/blender/io/collada/ControllerExporter.h index fb84af6ebc9..753538d8e98 100644 --- a/source/blender/io/collada/ControllerExporter.h +++ b/source/blender/io/collada/ControllerExporter.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __CONTROLLEREXPORTER_H__ -#define __CONTROLLEREXPORTER_H__ +#pragma once #include <list> #include <string> @@ -133,5 +132,3 @@ class ControllerExporter : public COLLADASW::LibraryControllers, void write_bone_URLs(COLLADASW::InstanceController &ins, Object *ob_arm, Bone *bone); }; - -#endif diff --git a/source/blender/io/collada/DocumentExporter.h b/source/blender/io/collada/DocumentExporter.h index 1fe52420534..850eb4fbbb2 100644 --- a/source/blender/io/collada/DocumentExporter.h +++ b/source/blender/io/collada/DocumentExporter.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __DOCUMENTEXPORTER_H__ -#define __DOCUMENTEXPORTER_H__ +#pragma once #include "BlenderContext.h" #include "collada.h" @@ -38,5 +37,3 @@ class DocumentExporter { BCExportSettings export_settings; KeyImageMap key_image_map; }; - -#endif diff --git a/source/blender/io/collada/DocumentImporter.h b/source/blender/io/collada/DocumentImporter.h index d9be4880b35..e382a44c3c2 100644 --- a/source/blender/io/collada/DocumentImporter.h +++ b/source/blender/io/collada/DocumentImporter.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __DOCUMENTIMPORTER_H__ -#define __DOCUMENTIMPORTER_H__ +#pragma once #include "COLLADAFWColor.h" #include "COLLADAFWController.h" @@ -168,5 +167,3 @@ class DocumentImporter : COLLADAFW::IWriter { void report_unknown_reference(const COLLADAFW::Node &node, const std::string object_type); }; - -#endif diff --git a/source/blender/io/collada/EffectExporter.h b/source/blender/io/collada/EffectExporter.h index 36d02bb1c8f..c844d93b040 100644 --- a/source/blender/io/collada/EffectExporter.h +++ b/source/blender/io/collada/EffectExporter.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __EFFECTEXPORTER_H__ -#define __EFFECTEXPORTER_H__ +#pragma once #include <string> #include <vector> @@ -85,5 +84,3 @@ class EffectsExporter : COLLADASW::LibraryEffects { Scene *scene; bContext *mContext; }; - -#endif diff --git a/source/blender/io/collada/ErrorHandler.h b/source/blender/io/collada/ErrorHandler.h index 0c082a3b9dd..60253a08cda 100644 --- a/source/blender/io/collada/ErrorHandler.h +++ b/source/blender/io/collada/ErrorHandler.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __ERRORHANDLER_H__ -#define __ERRORHANDLER_H__ +#pragma once #include <algorithm> // sort() #include <map> @@ -53,5 +52,3 @@ class ErrorHandler : public COLLADASaxFWL::IErrorHandler { /** Hold error status. */ bool mError; }; - -#endif /* __ERRORHANDLER_H__ */ diff --git a/source/blender/io/collada/ExportSettings.h b/source/blender/io/collada/ExportSettings.h index 477f0b8b678..2f647cefa8b 100644 --- a/source/blender/io/collada/ExportSettings.h +++ b/source/blender/io/collada/ExportSettings.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __EXPORTSETTINGS_H__ -#define __EXPORTSETTINGS_H__ +#pragma once #include "BLI_linklist.h" #include "BlenderContext.h" @@ -291,5 +290,3 @@ class BCExportSettings { }; #endif - -#endif diff --git a/source/blender/io/collada/ExtraHandler.h b/source/blender/io/collada/ExtraHandler.h index 04ac963b530..8f98e1dec1b 100644 --- a/source/blender/io/collada/ExtraHandler.h +++ b/source/blender/io/collada/ExtraHandler.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __EXTRAHANDLER_H__ -#define __EXTRAHANDLER_H__ +#pragma once #include <algorithm> // sort() #include <map> @@ -79,5 +78,3 @@ class ExtraHandler : public COLLADASaxFWL::IExtraDataCallbackHandler { ExtraTags *currentExtraTags; std::string currentElement; }; - -#endif /* __EXTRAHANDLER_H__ */ diff --git a/source/blender/io/collada/ExtraTags.h b/source/blender/io/collada/ExtraTags.h index c806b8fa904..a72cdeb32a8 100644 --- a/source/blender/io/collada/ExtraTags.h +++ b/source/blender/io/collada/ExtraTags.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __EXTRATAGS_H__ -#define __EXTRATAGS_H__ +#pragma once #include <map> #include <string> @@ -73,5 +72,3 @@ class ExtraTags { /** Get text data for tag as a string. */ std::string asString(std::string tag, bool *ok); }; - -#endif /* __EXTRATAGS_H__ */ diff --git a/source/blender/io/collada/GeometryExporter.h b/source/blender/io/collada/GeometryExporter.h index 5090158177f..d91f3d1ec5a 100644 --- a/source/blender/io/collada/GeometryExporter.h +++ b/source/blender/io/collada/GeometryExporter.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __GEOMETRYEXPORTER_H__ -#define __GEOMETRYEXPORTER_H__ +#pragma once #include <set> #include <string> @@ -136,5 +135,3 @@ struct GeometryFunctor { } } }; - -#endif diff --git a/source/blender/io/collada/ImageExporter.h b/source/blender/io/collada/ImageExporter.h index 20f9b95a512..e1fdcc12272 100644 --- a/source/blender/io/collada/ImageExporter.h +++ b/source/blender/io/collada/ImageExporter.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __IMAGEEXPORTER_H__ -#define __IMAGEEXPORTER_H__ +#pragma once #include <string> #include <vector> @@ -47,5 +46,3 @@ class ImagesExporter : COLLADASW::LibraryImages { KeyImageMap &key_image_map; void export_UV_Image(Image *image, bool use_texture_copies); }; - -#endif diff --git a/source/blender/io/collada/ImportSettings.h b/source/blender/io/collada/ImportSettings.h index 608d8bff882..e8a5bf8ce81 100644 --- a/source/blender/io/collada/ImportSettings.h +++ b/source/blender/io/collada/ImportSettings.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __IMPORTSETTINGS_H__ -#define __IMPORTSETTINGS_H__ +#pragma once typedef struct ImportSettings { bool import_units; @@ -30,5 +29,3 @@ typedef struct ImportSettings { char *filepath; bool keep_bind_info; } ImportSettings; - -#endif diff --git a/source/blender/io/collada/InstanceWriter.h b/source/blender/io/collada/InstanceWriter.h index cfec1cf7006..c79d6691842 100644 --- a/source/blender/io/collada/InstanceWriter.h +++ b/source/blender/io/collada/InstanceWriter.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __INSTANCEWRITER_H__ -#define __INSTANCEWRITER_H__ +#pragma once #include "COLLADASWBindMaterial.h" @@ -31,5 +30,3 @@ class InstanceWriter { Object *ob, bool active_uv_only); }; - -#endif diff --git a/source/blender/io/collada/LightExporter.h b/source/blender/io/collada/LightExporter.h index a5c7f5c6dee..90256691c06 100644 --- a/source/blender/io/collada/LightExporter.h +++ b/source/blender/io/collada/LightExporter.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __LIGHTEXPORTER_H__ -#define __LIGHTEXPORTER_H__ +#pragma once #include "COLLADASWLibraryLights.h" #include "COLLADASWStreamWriter.h" @@ -40,5 +39,3 @@ class LightsExporter : COLLADASW::LibraryLights { bool exportBlenderProfile(COLLADASW::Light &cla, Light *la); BCExportSettings &export_settings; }; - -#endif diff --git a/source/blender/io/collada/MaterialExporter.h b/source/blender/io/collada/MaterialExporter.h index babb113567f..7d40347097c 100644 --- a/source/blender/io/collada/MaterialExporter.h +++ b/source/blender/io/collada/MaterialExporter.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __MATERIALEXPORTER_H__ -#define __MATERIALEXPORTER_H__ +#pragma once #include <string> #include <vector> @@ -93,5 +92,3 @@ struct MaterialFunctor { gf.forEachMeshObjectInExportSet<ForEachMaterialFunctor<Functor>>(sce, matfunc, export_set); } }; - -#endif diff --git a/source/blender/io/collada/Materials.h b/source/blender/io/collada/Materials.h index e1d12246a2b..f671a00758d 100644 --- a/source/blender/io/collada/Materials.h +++ b/source/blender/io/collada/Materials.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __MATERIALS_H__ -#define __MATERIALS_H__ +#pragma once #include <map> #include <string> @@ -70,5 +69,3 @@ class MaterialNode { COLLADAFW::ColorOrTexture &cot, COLLADAFW::FloatOrParam &val); }; - -#endif /* __MATERIALS_H__ */ diff --git a/source/blender/io/collada/MeshImporter.h b/source/blender/io/collada/MeshImporter.h index 18e56e8f9df..a63cb0da987 100644 --- a/source/blender/io/collada/MeshImporter.h +++ b/source/blender/io/collada/MeshImporter.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __MESHIMPORTER_H__ -#define __MESHIMPORTER_H__ +#pragma once #include <map> #include <vector> @@ -177,5 +176,3 @@ class MeshImporter : public MeshImporterBase { bool write_geometry(const COLLADAFW::Geometry *geom); std::string *get_geometry_name(const std::string &mesh_name); }; - -#endif diff --git a/source/blender/io/collada/SceneExporter.h b/source/blender/io/collada/SceneExporter.h index 3ea6a9fac8e..5b8ec37152f 100644 --- a/source/blender/io/collada/SceneExporter.h +++ b/source/blender/io/collada/SceneExporter.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __SCENEEXPORTER_H__ -#define __SCENEEXPORTER_H__ +#pragma once #include <math.h> #include <stdio.h> @@ -110,5 +109,3 @@ class SceneExporter : COLLADASW::LibraryVisualScenes, void writeNodeList(std::vector<Object *> &child_objects, Object *parent); void writeNode(Object *ob); }; - -#endif diff --git a/source/blender/io/collada/SkinInfo.h b/source/blender/io/collada/SkinInfo.h index e8b13f86e9c..3b94e403b6d 100644 --- a/source/blender/io/collada/SkinInfo.h +++ b/source/blender/io/collada/SkinInfo.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __SKININFO_H__ -#define __SKININFO_H__ +#pragma once #include <map> #include <vector> @@ -126,5 +125,3 @@ class SkinInfo { bool find_node_in_tree(COLLADAFW::Node *node, COLLADAFW::Node *tree_root); }; - -#endif diff --git a/source/blender/io/collada/TransformReader.h b/source/blender/io/collada/TransformReader.h index 5a778e6aba5..f8a73ce3912 100644 --- a/source/blender/io/collada/TransformReader.h +++ b/source/blender/io/collada/TransformReader.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __TRANSFORMREADER_H__ -#define __TRANSFORMREADER_H__ +#pragma once #include "COLLADAFWMatrix.h" #include "COLLADAFWNode.h" @@ -68,5 +67,3 @@ class TransformReader { void dae_scale_to_v3(COLLADAFW::Transformation *tm, float v[3]); void dae_vector3_to_v3(const COLLADABU::Math::Vector3 &v3, float v[3]); }; - -#endif diff --git a/source/blender/io/collada/TransformWriter.h b/source/blender/io/collada/TransformWriter.h index db8ef3f5ee2..200f641b064 100644 --- a/source/blender/io/collada/TransformWriter.h +++ b/source/blender/io/collada/TransformWriter.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __TRANSFORMWRITER_H__ -#define __TRANSFORMWRITER_H__ +#pragma once #include "COLLADASWNode.h" @@ -47,5 +46,3 @@ class TransformWriter { const float rot[3], const float scale[3]); }; - -#endif diff --git a/source/blender/io/collada/collada.h b/source/blender/io/collada/collada.h index d8e498ef4b2..2668be6153b 100644 --- a/source/blender/io/collada/collada.h +++ b/source/blender/io/collada/collada.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __COLLADA_H__ -#define __COLLADA_H__ +#pragma once #include <stdlib.h> @@ -46,5 +45,3 @@ int collada_export(struct bContext *C, ExportSettings *export_settings); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/io/collada/collada_internal.h b/source/blender/io/collada/collada_internal.h index d9fe0ba0b58..de4e1d7e0d4 100644 --- a/source/blender/io/collada/collada_internal.h +++ b/source/blender/io/collada/collada_internal.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __COLLADA_INTERNAL_H__ -#define __COLLADA_INTERNAL_H__ +#pragma once #include <map> #include <string> @@ -94,5 +93,3 @@ extern std::string get_morph_id(Object *ob); extern std::string get_effect_id(Material *mat); extern std::string get_material_id(Material *mat); - -#endif /* __COLLADA_INTERNAL_H__ */ diff --git a/source/blender/io/collada/collada_utils.h b/source/blender/io/collada/collada_utils.h index 11a9376294b..657a82f70d2 100644 --- a/source/blender/io/collada/collada_utils.h +++ b/source/blender/io/collada/collada_utils.h @@ -18,8 +18,7 @@ * \ingroup collada */ -#ifndef __COLLADA_UTILS_H__ -#define __COLLADA_UTILS_H__ +#pragma once #include "COLLADAFWColorOrTexture.h" #include "COLLADAFWFloatOrDoubleArray.h" @@ -393,5 +392,3 @@ COLLADASW::ColorOrTexture bc_get_cot_from_shader(bNode *shader, COLLADASW::ColorOrTexture bc_get_cot(float r, float g, float b, float a); COLLADASW::ColorOrTexture bc_get_cot(Color col, bool with_alpha = true); - -#endif diff --git a/source/blender/io/common/IO_abstract_hierarchy_iterator.h b/source/blender/io/common/IO_abstract_hierarchy_iterator.h index a274847e109..d0d9d72b880 100644 --- a/source/blender/io/common/IO_abstract_hierarchy_iterator.h +++ b/source/blender/io/common/IO_abstract_hierarchy_iterator.h @@ -33,8 +33,7 @@ * Selections like "selected only" or "no hair systems" are left to concrete subclasses. */ -#ifndef __ABSTRACT_HIERARCHY_ITERATOR_H__ -#define __ABSTRACT_HIERARCHY_ITERATOR_H__ +#pragma once #include "IO_dupli_persistent_id.hh" @@ -129,7 +128,14 @@ class AbstractHierarchyWriter { // but wasn't used while exporting the current frame (for example, a particle-instanced mesh of // which the particle is no longer alive). protected: + /* Return true if the data written by this writer changes over time. + * Note that this function assumes this is an object data writer. Transform writers should not + * call this but implement their own logic. */ virtual bool check_is_animated(const HierarchyContext &context) const; + + /* Helper functions for animation checks. */ + static bool check_has_physics(const HierarchyContext &context); + static bool check_has_deforming_physics(const HierarchyContext &context); }; /* Determines which subset of the writers actually gets to write. */ @@ -348,5 +354,3 @@ class AbstractHierarchyIterator { } // namespace io } // namespace blender - -#endif /* __ABSTRACT_HIERARCHY_ITERATOR_H__ */ diff --git a/source/blender/io/common/IO_dupli_persistent_id.hh b/source/blender/io/common/IO_dupli_persistent_id.hh index 5dc54164684..6fabafd9d51 100644 --- a/source/blender/io/common/IO_dupli_persistent_id.hh +++ b/source/blender/io/common/IO_dupli_persistent_id.hh @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2020 Blender Foundation. * All rights reserved. */ -#ifndef __IO_COMMON_DUPLI_PERSISTENT_ID_H__ -#define __IO_COMMON_DUPLI_PERSISTENT_ID_H__ +#pragma once #include "BKE_duplilist.h" @@ -64,5 +63,3 @@ class PersistentID { }; } // namespace blender::io - -#endif // __IO_COMMON_DUPLI_PARENT_FINDER_H__ diff --git a/source/blender/io/common/intern/abstract_hierarchy_iterator.cc b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc index 8e66c069e18..fbefc8c8e7e 100644 --- a/source/blender/io/common/intern/abstract_hierarchy_iterator.cc +++ b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc @@ -39,6 +39,7 @@ #include "DNA_modifier_types.h" #include "DNA_object_types.h" #include "DNA_particle_types.h" +#include "DNA_rigidbody_types.h" #include "DEG_depsgraph_query.h" @@ -127,6 +128,9 @@ bool AbstractHierarchyWriter::check_is_animated(const HierarchyContext &context) if (BKE_key_from_object(object) != nullptr) { return true; } + if (check_has_deforming_physics(context)) { + return true; + } /* Test modifiers. */ /* TODO(Sybren): replace this with a check on the depsgraph to properly check for dependency on @@ -142,6 +146,18 @@ bool AbstractHierarchyWriter::check_is_animated(const HierarchyContext &context) return false; } +bool AbstractHierarchyWriter::check_has_physics(const HierarchyContext &context) +{ + const RigidBodyOb *rbo = context.object->rigidbody_object; + return rbo != nullptr && rbo->type == RBO_TYPE_ACTIVE; +} + +bool AbstractHierarchyWriter::check_has_deforming_physics(const HierarchyContext &context) +{ + const RigidBodyOb *rbo = context.object->rigidbody_object; + return rbo != nullptr && rbo->type == RBO_TYPE_ACTIVE && (rbo->flag & RBO_FLAG_USE_DEFORM) != 0; +} + AbstractHierarchyIterator::AbstractHierarchyIterator(Depsgraph *depsgraph) : depsgraph_(depsgraph), writers_(), export_subset_({true, true}) { diff --git a/source/blender/io/common/intern/dupli_parent_finder.hh b/source/blender/io/common/intern/dupli_parent_finder.hh index e7e628665ee..3dcf037bb5e 100644 --- a/source/blender/io/common/intern/dupli_parent_finder.hh +++ b/source/blender/io/common/intern/dupli_parent_finder.hh @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2020 Blender Foundation. * All rights reserved. */ -#ifndef __IO_COMMON_DUPLI_PARENT_FINDER_H__ -#define __IO_COMMON_DUPLI_PARENT_FINDER_H__ +#pragma once #include "IO_dupli_persistent_id.hh" @@ -58,5 +57,3 @@ class DupliParentFinder final { }; } // namespace blender::io - -#endif
\ No newline at end of file diff --git a/source/blender/io/common/intern/hierarchy_context_order_test.cc b/source/blender/io/common/intern/hierarchy_context_order_test.cc index 7273b92c479..f4e2b81b39b 100644 --- a/source/blender/io/common/intern/hierarchy_context_order_test.cc +++ b/source/blender/io/common/intern/hierarchy_context_order_test.cc @@ -20,9 +20,7 @@ #include "testing/testing.h" -extern "C" { #include "BLI_utildefines.h" -} namespace blender::io { diff --git a/source/blender/io/usd/intern/usd_exporter_context.h b/source/blender/io/usd/intern/usd_exporter_context.h index 07a9d0fc0c5..5513768b527 100644 --- a/source/blender/io/usd/intern/usd_exporter_context.h +++ b/source/blender/io/usd/intern/usd_exporter_context.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2019 Blender Foundation. * All rights reserved. */ -#ifndef __USD_EXPORTER_CONTEXT_H__ -#define __USD_EXPORTER_CONTEXT_H__ +#pragma once #include "usd.h" @@ -44,5 +43,3 @@ struct USDExporterContext { } // namespace usd } // namespace io } // namespace blender - -#endif /* __USD_EXPORTER_CONTEXT_H__ */ diff --git a/source/blender/io/usd/intern/usd_hierarchy_iterator.h b/source/blender/io/usd/intern/usd_hierarchy_iterator.h index 2836ff0b17f..03e80ce735a 100644 --- a/source/blender/io/usd/intern/usd_hierarchy_iterator.h +++ b/source/blender/io/usd/intern/usd_hierarchy_iterator.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2019 Blender Foundation. * All rights reserved. */ -#ifndef __USD_HIERARCHY_ITERATOR_H__ -#define __USD_HIERARCHY_ITERATOR_H__ +#pragma once #include "IO_abstract_hierarchy_iterator.h" #include "usd.h" @@ -75,5 +74,3 @@ class USDHierarchyIterator : public AbstractHierarchyIterator { } // namespace usd } // namespace io } // namespace blender - -#endif /* __USD_HIERARCHY_ITERATOR_H__ */ diff --git a/source/blender/io/usd/intern/usd_writer_abstract.h b/source/blender/io/usd/intern/usd_writer_abstract.h index f81cf5197af..a689deaf0d8 100644 --- a/source/blender/io/usd/intern/usd_writer_abstract.h +++ b/source/blender/io/usd/intern/usd_writer_abstract.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2019 Blender Foundation. * All rights reserved. */ -#ifndef __USD_WRITER_ABSTRACT_H__ -#define __USD_WRITER_ABSTRACT_H__ +#pragma once #include "IO_abstract_hierarchy_iterator.h" #include "usd_exporter_context.h" @@ -78,5 +77,3 @@ class USDAbstractWriter : public AbstractHierarchyWriter { } // namespace usd } // namespace io } // namespace blender - -#endif /* __USD_WRITER_ABSTRACT_H__ */ diff --git a/source/blender/io/usd/intern/usd_writer_camera.h b/source/blender/io/usd/intern/usd_writer_camera.h index 8b5795d7d9f..1c613d7879b 100644 --- a/source/blender/io/usd/intern/usd_writer_camera.h +++ b/source/blender/io/usd/intern/usd_writer_camera.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2019 Blender Foundation. * All rights reserved. */ -#ifndef __USD_WRITER_CAMERA_H__ -#define __USD_WRITER_CAMERA_H__ +#pragma once #include "usd_writer_abstract.h" @@ -38,5 +37,3 @@ class USDCameraWriter : public USDAbstractWriter { } // namespace usd } // namespace io } // namespace blender - -#endif /* __USD_WRITER_CAMERA_H__ */ diff --git a/source/blender/io/usd/intern/usd_writer_hair.h b/source/blender/io/usd/intern/usd_writer_hair.h index cecacd0a355..b9a28013875 100644 --- a/source/blender/io/usd/intern/usd_writer_hair.h +++ b/source/blender/io/usd/intern/usd_writer_hair.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2019 Blender Foundation. * All rights reserved. */ -#ifndef __USD_WRITER_HAIR_H__ -#define __USD_WRITER_HAIR_H__ +#pragma once #include "usd_writer_abstract.h" @@ -38,5 +37,3 @@ class USDHairWriter : public USDAbstractWriter { } // namespace usd } // namespace io } // namespace blender - -#endif /* __USD_WRITER_HAIR_H__ */ diff --git a/source/blender/io/usd/intern/usd_writer_light.h b/source/blender/io/usd/intern/usd_writer_light.h index 73666622af1..082050ad071 100644 --- a/source/blender/io/usd/intern/usd_writer_light.h +++ b/source/blender/io/usd/intern/usd_writer_light.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2019 Blender Foundation. * All rights reserved. */ -#ifndef __USD_WRITER_LIGHT_H__ -#define __USD_WRITER_LIGHT_H__ +#pragma once #include "usd_writer_abstract.h" @@ -37,5 +36,3 @@ class USDLightWriter : public USDAbstractWriter { } // namespace usd } // namespace io } // namespace blender - -#endif /* __USD_WRITER_LIGHT_H__ */ diff --git a/source/blender/io/usd/intern/usd_writer_mesh.h b/source/blender/io/usd/intern/usd_writer_mesh.h index a14ceecfa53..078daa05501 100644 --- a/source/blender/io/usd/intern/usd_writer_mesh.h +++ b/source/blender/io/usd/intern/usd_writer_mesh.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2019 Blender Foundation. * All rights reserved. */ -#ifndef __USD_WRITER_MESH_H__ -#define __USD_WRITER_MESH_H__ +#pragma once #include "usd_writer_abstract.h" @@ -66,5 +65,3 @@ class USDMeshWriter : public USDGenericMeshWriter { } // namespace usd } // namespace io } // namespace blender - -#endif /* __USD_WRITER_MESH_H__ */ diff --git a/source/blender/io/usd/intern/usd_writer_metaball.h b/source/blender/io/usd/intern/usd_writer_metaball.h index 9f51a3314a5..216f5a2638f 100644 --- a/source/blender/io/usd/intern/usd_writer_metaball.h +++ b/source/blender/io/usd/intern/usd_writer_metaball.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2020 Blender Foundation. * All rights reserved. */ -#ifndef __USD_WRITER_METABALL_H__ -#define __USD_WRITER_METABALL_H__ +#pragma once #include "usd_writer_mesh.h" @@ -42,5 +41,3 @@ class USDMetaballWriter : public USDGenericMeshWriter { } // namespace usd } // namespace io } // namespace blender - -#endif /* __USD_WRITER_METABALL_H__ */ diff --git a/source/blender/io/usd/intern/usd_writer_transform.cc b/source/blender/io/usd/intern/usd_writer_transform.cc index 643f1a8f4b1..49983115455 100644 --- a/source/blender/io/usd/intern/usd_writer_transform.cc +++ b/source/blender/io/usd/intern/usd_writer_transform.cc @@ -58,6 +58,9 @@ bool USDTransformWriter::check_is_animated(const HierarchyContext &context) cons * depsgraph whether this object instance has a time source. */ return true; } + if (check_has_physics(context)) { + return true; + } return BKE_object_moves_in_time(context.object, context.animation_check_include_parent); } diff --git a/source/blender/io/usd/intern/usd_writer_transform.h b/source/blender/io/usd/intern/usd_writer_transform.h index 8b4741f1177..39a1f20e7e8 100644 --- a/source/blender/io/usd/intern/usd_writer_transform.h +++ b/source/blender/io/usd/intern/usd_writer_transform.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2019 Blender Foundation. * All rights reserved. */ -#ifndef __USD_WRITER_TRANSFORM_H__ -#define __USD_WRITER_TRANSFORM_H__ +#pragma once #include "usd_writer_abstract.h" @@ -42,5 +41,3 @@ class USDTransformWriter : public USDAbstractWriter { } // namespace usd } // namespace io } // namespace blender - -#endif /* __USD_WRITER_TRANSFORM_H__ */ diff --git a/source/blender/io/usd/tests/usd_stage_creation_test.cc b/source/blender/io/usd/tests/usd_stage_creation_test.cc index 96a98a78497..e6bd0bab6ce 100644 --- a/source/blender/io/usd/tests/usd_stage_creation_test.cc +++ b/source/blender/io/usd/tests/usd_stage_creation_test.cc @@ -61,7 +61,9 @@ TEST_F(USDStageCreationTest, JSONFileLoadingTest) unlink(filename.c_str()); } else { - FAIL() << "unable to find suitable USD plugin to write " << filename; + FAIL() << "unable to find suitable USD plugin to write " << filename + << "; re-run with the environment variable PXR_PATH_DEBUG non-empty to see which paths " + "are considered."; } } diff --git a/source/blender/io/usd/usd.h b/source/blender/io/usd/usd.h index eee98521289..f2826cd1d7c 100644 --- a/source/blender/io/usd/usd.h +++ b/source/blender/io/usd/usd.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __USD_H__ -#define __USD_H__ +#pragma once #include "DEG_depsgraph.h" @@ -59,5 +58,3 @@ int USD_get_version(void); #ifdef __cplusplus } #endif - -#endif /* __USD_H__ */ diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 60cedfe3c8a..feda4ba43eb 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -22,8 +22,7 @@ * \brief ID and Library types, which are fundamental for sdna. */ -#ifndef __DNA_ID_H__ -#define __DNA_ID_H__ +#pragma once #include "DNA_defs.h" #include "DNA_listBase.h" @@ -206,7 +205,10 @@ typedef struct IDOverrideLibraryProperty { /** Runtime, tags are common to both IDOverrideProperty and IDOverridePropertyOperation. */ short tag; - char _pad0[6]; + char _pad[2]; + + /** The property type matching the rna_path. */ + unsigned int rna_prop_type; } IDOverrideLibraryProperty; /* IDOverrideProperty->tag and IDOverridePropertyOperation->tag. */ @@ -215,8 +217,18 @@ enum { IDOVERRIDE_LIBRARY_TAG_UNUSED = 1 << 0, }; -/* We do not need a full struct for that currently, just a GHash. */ -typedef struct GHash IDOverrideLibraryRuntime; +# +# +typedef struct IDOverrideLibraryRuntime { + struct GHash *rna_path_to_override_properties; + uint tag; +} IDOverrideLibraryRuntime; + +/* IDOverrideLibraryRuntime->tag. */ +enum { + /** This override needs to be reloaded. */ + IDOVERRIDE_LIBRARY_RUNTIME_TAG_NEEDS_RELOAD = 1 << 0, +}; /* Main container for all overriding data info of a data-block. */ typedef struct IDOverrideLibrary { @@ -468,7 +480,8 @@ typedef enum ID_Type { /* Note that this is a fairly high-level check, should be used at user interaction level, not in * BKE_library_override typically (especially due to the check on LIB_TAG_EXTERN). */ #define ID_IS_OVERRIDABLE_LIBRARY(_id) \ - (ID_IS_LINKED(_id) && !ID_MISSING(_id) && (((const ID *)(_id))->tag & LIB_TAG_EXTERN) != 0) + (ID_IS_LINKED(_id) && !ID_MISSING(_id) && (((const ID *)(_id))->tag & LIB_TAG_EXTERN) != 0 && \ + (BKE_idtype_get_info_from_id((const ID *)(_id))->flags & IDTYPE_FLAGS_NO_LIBLINKING) == 0) #define ID_IS_OVERRIDE_LIBRARY_REAL(_id) \ (((const ID *)(_id))->override_library != NULL && \ @@ -806,5 +819,3 @@ enum { #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 98e858dbf41..6e590001aff 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -25,11 +25,11 @@ * or sequenced in the non-linear-editor (NLA). */ -#ifndef __DNA_ACTION_TYPES_H__ -#define __DNA_ACTION_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_listBase.h" +#include "DNA_session_uuid_types.h" #include "DNA_userdef_types.h" /* ThemeWireColor */ #include "DNA_vec_types.h" #include "DNA_view2d_types.h" @@ -188,6 +188,8 @@ struct DualQuat; struct Mat4; typedef struct bPoseChannel_Runtime { + SessionUUID session_uuid; + /* Cached dual quaternion for deformation. */ struct DualQuat deform_dual_quat; @@ -953,5 +955,3 @@ typedef struct bActionChannel { #ifdef __cplusplus } #endif - -#endif /* __DNA_ACTION_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index 6a024ec9e7e..858daaac47c 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_ANIM_TYPES_H__ -#define __DNA_ANIM_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_action_types.h" @@ -1141,5 +1140,3 @@ typedef struct IdAdtTemplate { #ifdef __cplusplus }; #endif - -#endif /* __DNA_ANIM_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index 635c155dec6..2e029d041ec 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_ARMATURE_TYPES_H__ -#define __DNA_ARMATURE_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_defs.h" @@ -281,5 +280,3 @@ typedef enum eBone_BBoneHandleType { } eBone_BBoneHandleType; #define MAXBONENAME 64 - -#endif diff --git a/source/blender/makesdna/DNA_boid_types.h b/source/blender/makesdna/DNA_boid_types.h index de93c734bb4..88b2c1e31b8 100644 --- a/source/blender/makesdna/DNA_boid_types.h +++ b/source/blender/makesdna/DNA_boid_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_BOID_TYPES_H__ -#define __DNA_BOID_TYPES_H__ +#pragma once #include "DNA_listBase.h" @@ -223,5 +222,3 @@ typedef struct BoidSettings { //#define BOID_RULE_LAND (1 << 3) /* goal */ //#define BOID_RULE_WITH_BOIDS (1 << 4) /* avoid collision */ //#define BOID_RULE_WITH_DEFLECTORS (1 << 5) /* avoid collision */ - -#endif diff --git a/source/blender/makesdna/DNA_brush_defaults.h b/source/blender/makesdna/DNA_brush_defaults.h index 2ec4f4ee991..b0a35ac783e 100644 --- a/source/blender/makesdna/DNA_brush_defaults.h +++ b/source/blender/makesdna/DNA_brush_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_BRUSH_DEFAULTS_H__ -#define __DNA_BRUSH_DEFAULTS_H__ +#pragma once #include "DNA_texture_defaults.h" @@ -116,5 +115,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_BRUSH_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index e2102abb285..10a7dbcd811 100644 --- a/source/blender/makesdna/DNA_brush_types.h +++ b/source/blender/makesdna/DNA_brush_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_BRUSH_TYPES_H__ -#define __DNA_BRUSH_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_curve_types.h" @@ -190,7 +189,7 @@ typedef enum eGPDbrush_Flag { /* brush use pressure */ GP_BRUSH_USE_PRESSURE = (1 << 0), /* brush use pressure for alpha factor */ - GP_BRUSH_USE_STENGTH_PRESSURE = (1 << 1), + GP_BRUSH_USE_STRENGTH_PRESSURE = (1 << 1), /* brush use pressure for alpha factor */ GP_BRUSH_USE_JITTER_PRESSURE = (1 << 2), /* fill hide transparent */ @@ -915,5 +914,3 @@ enum { #define MAX_BRUSH_PIXEL_RADIUS 500 #define GP_MAX_BRUSH_PIXEL_RADIUS 1000 - -#endif /* __DNA_BRUSH_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_cachefile_defaults.h b/source/blender/makesdna/DNA_cachefile_defaults.h index 4c4ff53ed90..d37994bb488 100644 --- a/source/blender/makesdna/DNA_cachefile_defaults.h +++ b/source/blender/makesdna/DNA_cachefile_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_CACHEFILE_DEFAULTS_H__ -#define __DNA_CACHEFILE_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -45,5 +44,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_CACHEFILE_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_cachefile_types.h b/source/blender/makesdna/DNA_cachefile_types.h index 1175c7f0dc0..581248ed52b 100644 --- a/source/blender/makesdna/DNA_cachefile_types.h +++ b/source/blender/makesdna/DNA_cachefile_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_CACHEFILE_TYPES_H__ -#define __DNA_CACHEFILE_TYPES_H__ +#pragma once #include "DNA_ID.h" @@ -89,5 +88,3 @@ typedef struct CacheFile { #ifdef __cplusplus } #endif - -#endif /* __DNA_CACHEFILE_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_camera_defaults.h b/source/blender/makesdna/DNA_camera_defaults.h index 7a28f673ee4..55fbb59a161 100644 --- a/source/blender/makesdna/DNA_camera_defaults.h +++ b/source/blender/makesdna/DNA_camera_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_CAMERA_DEFAULTS_H__ -#define __DNA_CAMERA_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -63,5 +62,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_CAMERA_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_camera_types.h b/source/blender/makesdna/DNA_camera_types.h index b12d25d74e0..73a55edf05f 100644 --- a/source/blender/makesdna/DNA_camera_types.h +++ b/source/blender/makesdna/DNA_camera_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_CAMERA_TYPES_H__ -#define __DNA_CAMERA_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_defs.h" @@ -226,5 +225,3 @@ enum { #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h index 9d9ee711339..bc6991b3249 100644 --- a/source/blender/makesdna/DNA_cloth_types.h +++ b/source/blender/makesdna/DNA_cloth_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_CLOTH_TYPES_H__ -#define __DNA_CLOTH_TYPES_H__ +#pragma once #include "DNA_defs.h" @@ -210,5 +209,3 @@ typedef struct ClothCollSettings { /** Impulse clamp for self collisions. */ float self_clamp; } ClothCollSettings; - -#endif diff --git a/source/blender/makesdna/DNA_collection_types.h b/source/blender/makesdna/DNA_collection_types.h index 13eb8a762d9..6cf02137fa6 100644 --- a/source/blender/makesdna/DNA_collection_types.h +++ b/source/blender/makesdna/DNA_collection_types.h @@ -23,8 +23,7 @@ * \brief Object groups, one object can be in many groups at once. */ -#ifndef __DNA_COLLECTION_TYPES_H__ -#define __DNA_COLLECTION_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_defs.h" @@ -93,5 +92,3 @@ enum { * Using a generic tag like LIB_TAG_DOIT for this is just impossible, we need our very own. */ COLLECTION_TAG_RELATION_REBUILD = (1 << 0), }; - -#endif /* __DNA_COLLECTION_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_color_types.h b/source/blender/makesdna/DNA_color_types.h index 66adc547cf2..5577a17c0df 100644 --- a/source/blender/makesdna/DNA_color_types.h +++ b/source/blender/makesdna/DNA_color_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_COLOR_TYPES_H__ -#define __DNA_COLOR_TYPES_H__ +#pragma once #include "DNA_defs.h" #include "DNA_vec_types.h" @@ -215,5 +214,3 @@ typedef struct ColorManagedColorspaceSettings { enum { COLORMANAGE_VIEW_USE_CURVES = (1 << 0), }; - -#endif diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index 85d9a04a902..cddc78d7640 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -22,8 +22,7 @@ * \ingroup DNA */ -#ifndef __DNA_CONSTRAINT_TYPES_H__ -#define __DNA_CONSTRAINT_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_defs.h" @@ -1168,5 +1167,3 @@ typedef enum eStretchTo_Flags { #define CONSTRAINT_RB_CONETWIST 4 #define CONSTRAINT_RB_VEHICLE 11 #define CONSTRAINT_RB_GENERIC6DOF 12 - -#endif diff --git a/source/blender/makesdna/DNA_curve_defaults.h b/source/blender/makesdna/DNA_curve_defaults.h index 0fdfd5713e9..0cb3960dbd7 100644 --- a/source/blender/makesdna/DNA_curve_defaults.h +++ b/source/blender/makesdna/DNA_curve_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_CURVE_DEFAULTS_H__ -#define __DNA_CURVE_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -55,5 +54,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_CURVE_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index b2902407a15..c442e160bad 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_CURVE_TYPES_H__ -#define __DNA_CURVE_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_defs.h" @@ -544,5 +543,3 @@ enum { /* indicates point has been seen during surface duplication */ #define SURF_SEEN 4 - -#endif diff --git a/source/blender/makesdna/DNA_curveprofile_types.h b/source/blender/makesdna/DNA_curveprofile_types.h index ca00f783905..b45eb832232 100644 --- a/source/blender/makesdna/DNA_curveprofile_types.h +++ b/source/blender/makesdna/DNA_curveprofile_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_CURVEPROFILE_TYPES_H__ -#define __DNA_CURVEPROFILE_TYPES_H__ +#pragma once #include "DNA_vec_types.h" @@ -99,5 +98,3 @@ typedef enum eCurveProfilePresets { PROF_PRESET_CROWN = 3, /* Second molding example. */ PROF_PRESET_STEPS = 4, /* Dynamic number of steps defined by segments_len. */ } eCurveProfilePresets; - -#endif /* __DNA_CURVEPROFILE_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h index 7a9744ed1c7..2990fa85c27 100644 --- a/source/blender/makesdna/DNA_customdata_types.h +++ b/source/blender/makesdna/DNA_customdata_types.h @@ -23,8 +23,7 @@ * Used for custom mesh data types (stored per vert/edge/loop/face) */ -#ifndef __DNA_CUSTOMDATA_TYPES_H__ -#define __DNA_CUSTOMDATA_TYPES_H__ +#pragma once #include "DNA_defs.h" @@ -254,5 +253,3 @@ enum { #ifdef __cplusplus } #endif - -#endif /* __DNA_CUSTOMDATA_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_defaults.h b/source/blender/makesdna/DNA_defaults.h index ca5ac649e33..1549e33b267 100644 --- a/source/blender/makesdna/DNA_defaults.h +++ b/source/blender/makesdna/DNA_defaults.h @@ -24,8 +24,7 @@ * \see dna_defaults.c for details on how to use this system. */ -#ifndef __DNA_DEFAULTS_H__ -#define __DNA_DEFAULTS_H__ +#pragma once #include "BLI_utildefines.h" @@ -52,5 +51,3 @@ char *_DNA_struct_default_alloc_impl(const char *data_src, size_t size, const ch #ifdef __cplusplus } #endif - -#endif /* __DNA_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_defs.h b/source/blender/makesdna/DNA_defs.h index 092dd9d3bcc..01ee954d0d2 100644 --- a/source/blender/makesdna/DNA_defs.h +++ b/source/blender/makesdna/DNA_defs.h @@ -20,8 +20,7 @@ * Group generic defines for all DNA headers may use in this file. */ -#ifndef __DNA_DEFS_H__ -#define __DNA_DEFS_H__ +#pragma once /* makesdna ignores */ #ifdef DNA_DEPRECATED_ALLOW @@ -61,5 +60,3 @@ /* non-id name variables should use this length */ #define MAX_NAME 64 - -#endif /* __DNA_DEFS_H__ */ diff --git a/source/blender/makesdna/DNA_dynamicpaint_types.h b/source/blender/makesdna/DNA_dynamicpaint_types.h index c97e68a6a6b..94f54a0d200 100644 --- a/source/blender/makesdna/DNA_dynamicpaint_types.h +++ b/source/blender/makesdna/DNA_dynamicpaint_types.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_DYNAMICPAINT_TYPES_H__ -#define __DNA_DYNAMICPAINT_TYPES_H__ +#pragma once #include "DNA_listBase.h" struct PaintSurfaceData; @@ -262,5 +261,3 @@ typedef struct DynamicPaintBrushSettings { float wave_factor, wave_clamp; float max_velocity, smudge_strength; } DynamicPaintBrushSettings; - -#endif diff --git a/source/blender/makesdna/DNA_effect_types.h b/source/blender/makesdna/DNA_effect_types.h index c34b146064e..c25e9d0dded 100644 --- a/source/blender/makesdna/DNA_effect_types.h +++ b/source/blender/makesdna/DNA_effect_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_EFFECT_TYPES_H__ -#define __DNA_EFFECT_TYPES_H__ +#pragma once /* don't forget, new effects also in writefile.c for dna!!! */ @@ -130,5 +129,3 @@ typedef struct WaveEff { float timeoffs, lifetime; } WaveEff; - -#endif diff --git a/source/blender/makesdna/DNA_fileglobal_types.h b/source/blender/makesdna/DNA_fileglobal_types.h index 66f185282a9..bb660fb8eaa 100644 --- a/source/blender/makesdna/DNA_fileglobal_types.h +++ b/source/blender/makesdna/DNA_fileglobal_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_FILEGLOBAL_TYPES_H__ -#define __DNA_FILEGLOBAL_TYPES_H__ +#pragma once /** * FileGlobal stores a part of the current user-interface settings at @@ -54,5 +53,3 @@ typedef struct FileGlobal { /* example: if in 2.43 the meshes lose mesh data, minversion is 2.43 then too */ /* or: in 2.42, subversion 1, same as above, minversion then is 2.42, min subversion 1 */ /* (defines for version are in the BKE_blender_version.h file, for historic reasons) */ - -#endif diff --git a/source/blender/makesdna/DNA_fluid_types.h b/source/blender/makesdna/DNA_fluid_types.h index 909170523a3..6035c43ad57 100644 --- a/source/blender/makesdna/DNA_fluid_types.h +++ b/source/blender/makesdna/DNA_fluid_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_FLUID_TYPES_H__ -#define __DNA_FLUID_TYPES_H__ +#pragma once #include "DNA_listBase.h" @@ -226,8 +225,9 @@ enum { #define FLUID_NAME_GUIDING "fluid_guiding" /* Fluid object names.*/ -#define FLUID_NAME_FLAGS "flags" /* == OpenVDB grid attribute name. */ -#define FLUID_NAME_VELOCITY "velocity" /* == OpenVDB grid attribute name. */ +#define FLUID_NAME_FLAGS "flags" /* == OpenVDB grid attribute name. */ +#define FLUID_NAME_VELOCITY "velocity" /* == OpenVDB grid attribute name. */ +#define FLUID_NAME_VEL "vel" #define FLUID_NAME_VELOCITYTMP "velocity_previous" /* == OpenVDB grid attribute name. */ #define FLUID_NAME_VELOCITYX "x_vel" #define FLUID_NAME_VELOCITYY "y_vel" @@ -368,7 +368,8 @@ enum { #define FLUID_NAME_GUIDEVEL_X "x_guidevel" #define FLUID_NAME_GUIDEVEL_Y "y_guidevel" #define FLUID_NAME_GUIDEVEL_Z "z_guidevel" -#define FLUID_NAME_GUIDEVEL "velocity_guide" +#define FLUID_NAME_GUIDEVEL "guidevel" +#define FLUID_NAME_VELOCITY_GUIDE "velocity_guide" /* Cache file extensions. */ #define FLUID_DOMAIN_EXTENSION_UNI ".uni" @@ -524,8 +525,9 @@ typedef struct FluidDomainSettings { float particle_band_width; float fractions_threshold; float flip_ratio; + int sys_particle_maximum; short simulation_method; - char _pad4[6]; + char _pad4[2]; /* Diffusion options. */ float surface_tension; @@ -783,5 +785,3 @@ typedef struct FluidEffectorSettings { short guide_mode; char _pad2[2]; } FluidEffectorSettings; - -#endif diff --git a/source/blender/makesdna/DNA_freestyle_types.h b/source/blender/makesdna/DNA_freestyle_types.h index 8b3d8090c89..884e11f3a8e 100644 --- a/source/blender/makesdna/DNA_freestyle_types.h +++ b/source/blender/makesdna/DNA_freestyle_types.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __DNA_FREESTYLE_TYPES_H__ -#define __DNA_FREESTYLE_TYPES_H__ +#pragma once /** \file * \ingroup DNA @@ -155,5 +154,3 @@ typedef struct FreestyleConfig { #ifdef __cplusplus } #endif - -#endif /* __DNA_FREESTYLE_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h index db65da6fa75..1cdaba81ffa 100644 --- a/source/blender/makesdna/DNA_genfile.h +++ b/source/blender/makesdna/DNA_genfile.h @@ -22,13 +22,16 @@ * \brief blenloader genfile private function prototypes */ -#ifndef __DNA_GENFILE_H__ -#define __DNA_GENFILE_H__ +#pragma once #include "intern/dna_utils.h" struct SDNA; +#ifdef __cplusplus +extern "C" { +#endif + /** * DNAstr contains the prebuilt SDNA structure defining the layouts of the types * used by this version of Blender. It is defined in a file dna.c, which is @@ -134,4 +137,6 @@ bool DNA_struct_alias_elem_find(const struct SDNA *sdna, const char *name); void DNA_sdna_alias_data_ensure_structs_map(struct SDNA *sdna); -#endif /* __DNA_GENFILE_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h index 5d35db1a960..3049c0f8bab 100644 --- a/source/blender/makesdna/DNA_gpencil_modifier_types.h +++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_GPENCIL_MODIFIER_TYPES_H__ -#define __DNA_GPENCIL_MODIFIER_TYPES_H__ +#pragma once #include "DNA_defs.h" #include "DNA_listBase.h" @@ -800,5 +799,3 @@ typedef enum eTextureGpencil_Mode { FILL = 1, STROKE_AND_FILL = 2, } eTextureGpencil_Mode; - -#endif /* __DNA_GPENCIL_MODIFIER_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h index b6e2910a1b0..222b716a502 100644 --- a/source/blender/makesdna/DNA_gpencil_types.h +++ b/source/blender/makesdna/DNA_gpencil_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_GPENCIL_TYPES_H__ -#define __DNA_GPENCIL_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_brush_types.h" @@ -756,5 +755,3 @@ typedef enum eGP_DrawMode { #define GPENCIL_ANY_VERTEX_MASK(flag) \ ((flag & (GP_VERTEX_MASK_SELECTMODE_POINT | GP_VERTEX_MASK_SELECTMODE_STROKE | \ GP_VERTEX_MASK_SELECTMODE_SEGMENT))) - -#endif /* __DNA_GPENCIL_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_gpu_types.h b/source/blender/makesdna/DNA_gpu_types.h index 7d56baf86a4..b1ace1bda49 100644 --- a/source/blender/makesdna/DNA_gpu_types.h +++ b/source/blender/makesdna/DNA_gpu_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_GPU_TYPES_H__ -#define __DNA_GPU_TYPES_H__ +#pragma once /* Keep for 'Camera' versioning. */ /** Properties for dof effect. */ @@ -37,5 +36,3 @@ typedef struct GPUDOFSettings { int num_blades; int high_quality; } GPUDOFSettings; - -#endif /* __DNA_GPU_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_hair_defaults.h b/source/blender/makesdna/DNA_hair_defaults.h index de7a830885d..095e4fdf583 100644 --- a/source/blender/makesdna/DNA_hair_defaults.h +++ b/source/blender/makesdna/DNA_hair_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_HAIR_DEFAULTS_H__ -#define __DNA_HAIR_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -36,5 +35,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_HAIR_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_hair_types.h b/source/blender/makesdna/DNA_hair_types.h index 98fae91dbe1..d120e61cfef 100644 --- a/source/blender/makesdna/DNA_hair_types.h +++ b/source/blender/makesdna/DNA_hair_types.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_HAIR_TYPES_H__ -#define __DNA_HAIR_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_customdata_types.h" @@ -74,5 +73,3 @@ enum { /* Only one material supported currently. */ #define HAIR_MATERIAL_NR 1 - -#endif /* __DNA_HAIR_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_image_defaults.h b/source/blender/makesdna/DNA_image_defaults.h index e115f9e2b16..ce1296d681f 100644 --- a/source/blender/makesdna/DNA_image_defaults.h +++ b/source/blender/makesdna/DNA_image_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_IMAGE_DEFAULTS_H__ -#define __DNA_IMAGE_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -42,5 +41,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_IMAGE_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h index 0ffb6c8a76a..17f3fe24fbc 100644 --- a/source/blender/makesdna/DNA_image_types.h +++ b/source/blender/makesdna/DNA_image_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_IMAGE_TYPES_H__ -#define __DNA_IMAGE_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_color_types.h" /* for color management */ @@ -265,5 +264,3 @@ enum { IMA_ALPHA_CHANNEL_PACKED = 2, IMA_ALPHA_IGNORE = 3, }; - -#endif diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h index 0f1028f5770..dfd06702b72 100644 --- a/source/blender/makesdna/DNA_ipo_types.h +++ b/source/blender/makesdna/DNA_ipo_types.h @@ -26,8 +26,7 @@ * All defines, etc. are only still maintained to provide backwards compatibility for old files. */ -#ifndef __DNA_IPO_TYPES_H__ -#define __DNA_IPO_TYPES_H__ +#pragma once #include "DNA_curve_types.h" #include "DNA_listBase.h" @@ -517,5 +516,3 @@ typedef struct Ipo { /* driver->flag */ /* invalid flag: currently only used for buggy pydriver expressions */ #define IPO_DRIVER_FLAG_INVALID (1 << 0) - -#endif diff --git a/source/blender/makesdna/DNA_key_types.h b/source/blender/makesdna/DNA_key_types.h index a1cc6f89314..56a164e4f2c 100644 --- a/source/blender/makesdna/DNA_key_types.h +++ b/source/blender/makesdna/DNA_key_types.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. */ -#ifndef __DNA_KEY_TYPES_H__ -#define __DNA_KEY_TYPES_H__ +#pragma once /** \file * \ingroup DNA @@ -159,5 +158,3 @@ enum { #define KEYELEM_ELEM_LEN_BEZTRIPLE 4 #define KEYELEM_FLOAT_LEN_BEZTRIPLE (KEYELEM_ELEM_LEN_BEZTRIPLE * KEYELEM_ELEM_SIZE_CURVE) - -#endif /* __DNA_KEY_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_lattice_defaults.h b/source/blender/makesdna/DNA_lattice_defaults.h index 052aaba51d7..505b853b0ee 100644 --- a/source/blender/makesdna/DNA_lattice_defaults.h +++ b/source/blender/makesdna/DNA_lattice_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_LATTICE_DEFAULTS_H__ -#define __DNA_LATTICE_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -40,5 +39,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_LATTICE_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_lattice_types.h b/source/blender/makesdna/DNA_lattice_types.h index 336726fb28d..797df3bd738 100644 --- a/source/blender/makesdna/DNA_lattice_types.h +++ b/source/blender/makesdna/DNA_lattice_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_LATTICE_TYPES_H__ -#define __DNA_LATTICE_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_defs.h" @@ -83,5 +82,3 @@ typedef struct Lattice { #define LT_DS_EXPAND 4 #define LT_ACTBP_NONE -1 - -#endif diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h index cb604fd6681..3c2d479bea4 100644 --- a/source/blender/makesdna/DNA_layer_types.h +++ b/source/blender/makesdna/DNA_layer_types.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_LAYER_TYPES_H__ -#define __DNA_LAYER_TYPES_H__ +#pragma once #include "DNA_freestyle_types.h" #include "DNA_listBase.h" @@ -216,5 +215,3 @@ typedef struct SceneCollection { #ifdef __cplusplus } #endif - -#endif /* __DNA_LAYER_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_light_defaults.h b/source/blender/makesdna/DNA_light_defaults.h index dceaaf7c278..6ac52c1b356 100644 --- a/source/blender/makesdna/DNA_light_defaults.h +++ b/source/blender/makesdna/DNA_light_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_LIGHT_DEFAULTS_H__ -#define __DNA_LIGHT_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -72,5 +71,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_LIGHT_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_light_types.h b/source/blender/makesdna/DNA_light_types.h index 7a7b5d923e3..1616cf949bd 100644 --- a/source/blender/makesdna/DNA_light_types.h +++ b/source/blender/makesdna/DNA_light_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_LIGHT_TYPES_H__ -#define __DNA_LIGHT_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_defs.h" @@ -155,5 +154,3 @@ typedef struct Light { /* #define LA_AREA_BOX 3 */ /* UNUSED */ #define LA_AREA_DISK 4 #define LA_AREA_ELLIPSE 5 - -#endif /* __DNA_LIGHT_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_lightprobe_defaults.h b/source/blender/makesdna/DNA_lightprobe_defaults.h index 7c7732d17e4..4de94b81b97 100644 --- a/source/blender/makesdna/DNA_lightprobe_defaults.h +++ b/source/blender/makesdna/DNA_lightprobe_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_LIGHTPROBE_DEFAULTS_H__ -#define __DNA_LIGHTPROBE_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -47,5 +46,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_LIGHTPROBE_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_lightprobe_types.h b/source/blender/makesdna/DNA_lightprobe_types.h index 5ddfedfed2d..3830919bfd3 100644 --- a/source/blender/makesdna/DNA_lightprobe_types.h +++ b/source/blender/makesdna/DNA_lightprobe_types.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_LIGHTPROBE_TYPES_H__ -#define __DNA_LIGHTPROBE_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_defs.h" @@ -150,7 +149,7 @@ BLI_STATIC_ASSERT_ALIGN(LightGridCache, 16) typedef struct LightCacheTexture { struct GPUTexture *tex; - /* Copy of GPU datas to create GPUTextures on file read. */ + /** Copy of GPU datas to create GPUTextures on file read. */ char *data; int tex_size[3]; char data_type; @@ -204,6 +203,10 @@ enum { LIGHTCACHE_UPDATE_GRID = (1 << 5), LIGHTCACHE_UPDATE_WORLD = (1 << 6), LIGHTCACHE_UPDATE_AUTO = (1 << 7), + /** Invalid means we tried to alloc it but failed. */ + LIGHTCACHE_INVALID = (1 << 8), + /** The data present in the cache is valid but unusable on this GPU. */ + LIGHTCACHE_NOT_USABLE = (1 << 9), }; /* EEVEE_LightCacheTexture->data_type */ @@ -216,5 +219,3 @@ enum { #ifdef __cplusplus } #endif - -#endif /* __DNA_LIGHTPROBE_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_linestyle_defaults.h b/source/blender/makesdna/DNA_linestyle_defaults.h index 2f9203050d1..47405b4a15f 100644 --- a/source/blender/makesdna/DNA_linestyle_defaults.h +++ b/source/blender/makesdna/DNA_linestyle_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_LINESTYLE_DEFAULTS_H__ -#define __DNA_LINESTYLE_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -57,5 +56,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_LINESTYLE_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_linestyle_types.h b/source/blender/makesdna/DNA_linestyle_types.h index eca5ab5e8ec..867f0995ae9 100644 --- a/source/blender/makesdna/DNA_linestyle_types.h +++ b/source/blender/makesdna/DNA_linestyle_types.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __DNA_LINESTYLE_TYPES_H__ -#define __DNA_LINESTYLE_TYPES_H__ +#pragma once /** \file * \ingroup DNA @@ -576,5 +575,3 @@ typedef struct FreestyleLineStyle { ListBase thickness_modifiers; ListBase geometry_modifiers; } FreestyleLineStyle; - -#endif diff --git a/source/blender/makesdna/DNA_listBase.h b/source/blender/makesdna/DNA_listBase.h index 7d247c99387..0c4054004ea 100644 --- a/source/blender/makesdna/DNA_listBase.h +++ b/source/blender/makesdna/DNA_listBase.h @@ -25,8 +25,7 @@ * with Link. */ -#ifndef __DNA_LISTBASE_H__ -#define __DNA_LISTBASE_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -53,5 +52,3 @@ typedef struct ListBase { #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/makesdna/DNA_mask_types.h b/source/blender/makesdna/DNA_mask_types.h index 9617b3fdf27..5f232036f2a 100644 --- a/source/blender/makesdna/DNA_mask_types.h +++ b/source/blender/makesdna/DNA_mask_types.h @@ -24,8 +24,7 @@ * for image masking in the compositor and sequencer. */ -#ifndef __DNA_MASK_TYPES_H__ -#define __DNA_MASK_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_curve_types.h" @@ -264,5 +263,3 @@ enum { enum { MASK_ANIMF_EXPAND = (1 << 4), }; - -#endif /* __DNA_MASK_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_material_defaults.h b/source/blender/makesdna/DNA_material_defaults.h index cdcb1dd45f7..3f4496ce735 100644 --- a/source/blender/makesdna/DNA_material_defaults.h +++ b/source/blender/makesdna/DNA_material_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_MATERIAL_DEFAULTS_H__ -#define __DNA_MATERIAL_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -51,5 +50,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_MATERIAL_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h index 6a4ec65318b..3d050805f12 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_MATERIAL_TYPES_H__ -#define __DNA_MATERIAL_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_defs.h" @@ -355,4 +354,3 @@ enum { GP_MATERIAL_FOLLOW_OBJ = 1, GP_MATERIAL_FOLLOW_FIXED = 2, }; -#endif diff --git a/source/blender/makesdna/DNA_mesh_defaults.h b/source/blender/makesdna/DNA_mesh_defaults.h index abcdf8bf57b..8326db66049 100644 --- a/source/blender/makesdna/DNA_mesh_defaults.h +++ b/source/blender/makesdna/DNA_mesh_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_MESH_DEFAULTS_H__ -#define __DNA_MESH_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -43,5 +42,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_MESH_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index 9435cb3bd78..a6aef5b08ad 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_MESH_TYPES_H__ -#define __DNA_MESH_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_customdata_types.h" @@ -110,9 +109,12 @@ typedef struct Mesh_Runtime { /** Set by modifier stack if only deformed from original. */ char deformed_only; /** - * Copied from edit-mesh (hint, draw with editmesh data). - * In the future we may leave the mesh-data empty - * since its not needed if we can use edit-mesh data. */ + * Copied from edit-mesh (hint, draw with edit-mesh data when true). + * + * Modifiers that edit the mesh data in-place must set this to false + * (most #eModifierTypeType_NonGeometrical modifiers). Otherwise the edit-mesh + * data will be used for drawing, missing changes from modifiers. See T79517. + */ char is_original; /** #eMeshWrapperType and others. */ @@ -320,5 +322,3 @@ enum { #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h index cc2ba3fb999..57750b15dea 100644 --- a/source/blender/makesdna/DNA_meshdata_types.h +++ b/source/blender/makesdna/DNA_meshdata_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_MESHDATA_TYPES_H__ -#define __DNA_MESHDATA_TYPES_H__ +#pragma once #include "DNA_customdata_types.h" #include "DNA_listBase.h" @@ -570,5 +569,3 @@ typedef struct Multires { /* End multi-res structs. */ /** \} */ - -#endif /* __DNA_MESHDATA_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_meta_defaults.h b/source/blender/makesdna/DNA_meta_defaults.h index 723f178ed58..1bf2caf556d 100644 --- a/source/blender/makesdna/DNA_meta_defaults.h +++ b/source/blender/makesdna/DNA_meta_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_META_DEFAULTS_H__ -#define __DNA_META_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -40,5 +39,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_META_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_meta_types.h b/source/blender/makesdna/DNA_meta_types.h index df4558dac77..de7427bc4dd 100644 --- a/source/blender/makesdna/DNA_meta_types.h +++ b/source/blender/makesdna/DNA_meta_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_META_TYPES_H__ -#define __DNA_META_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_defs.h" @@ -139,5 +138,3 @@ typedef struct MetaBall { #define MB_NEGATIVE 2 #define MB_HIDE 8 #define MB_SCALE_RAD 16 - -#endif diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 8c564bda3d0..93434e64df1 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_MODIFIER_TYPES_H__ -#define __DNA_MODIFIER_TYPES_H__ +#pragma once #include "DNA_defs.h" #include "DNA_listBase.h" @@ -2164,5 +2163,3 @@ typedef struct SimulationModifierData { #ifdef __cplusplus } #endif - -#endif /* __DNA_MODIFIER_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_movieclip_types.h b/source/blender/makesdna/DNA_movieclip_types.h index d750a7f3148..123ff5bfb7e 100644 --- a/source/blender/makesdna/DNA_movieclip_types.h +++ b/source/blender/makesdna/DNA_movieclip_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_MOVIECLIP_TYPES_H__ -#define __DNA_MOVIECLIP_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_color_types.h" /* for color management */ @@ -208,5 +207,3 @@ enum { #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/makesdna/DNA_nla_types.h b/source/blender/makesdna/DNA_nla_types.h index 6bf4a92514e..1cf93464f6a 100644 --- a/source/blender/makesdna/DNA_nla_types.h +++ b/source/blender/makesdna/DNA_nla_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_NLA_TYPES_H__ -#define __DNA_NLA_TYPES_H__ +#pragma once #include "DNA_listBase.h" @@ -106,5 +105,3 @@ typedef enum eActStrip_Flag { ACTSTRIP_REVERSE = (1 << 7), ACTSTRIP_AUTO_BLENDS = (1 << 11), } eActStrip_Flag; - -#endif diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 42ccbc657d8..1d76ebdff2c 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_NODE_TYPES_H__ -#define __DNA_NODE_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_listBase.h" @@ -1439,5 +1438,3 @@ typedef enum NodeSimInputTimeType { NODE_SIM_INPUT_SIMULATION_TIME = 0, NODE_SIM_INPUT_SCENE_TIME = 1, } NodeSimInputTimeType; - -#endif diff --git a/source/blender/makesdna/DNA_object_defaults.h b/source/blender/makesdna/DNA_object_defaults.h index 554d68f2d4a..1bca572b963 100644 --- a/source/blender/makesdna/DNA_object_defaults.h +++ b/source/blender/makesdna/DNA_object_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_OBJECT_DEFAULTS_H__ -#define __DNA_OBJECT_DEFAULTS_H__ +#pragma once #include "DNA_vec_defaults.h" @@ -72,5 +71,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_OBJECT_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_object_enums.h b/source/blender/makesdna/DNA_object_enums.h index f3e69161c85..dbbd72c2075 100644 --- a/source/blender/makesdna/DNA_object_enums.h +++ b/source/blender/makesdna/DNA_object_enums.h @@ -20,8 +20,7 @@ * Enums typedef's for use in public headers. */ -#ifndef __DNA_OBJECT_ENUMS_H__ -#define __DNA_OBJECT_ENUMS_H__ +#pragma once /** #Object.mode */ typedef enum eObjectMode { @@ -69,5 +68,3 @@ typedef enum eDrawType { (OB_MODE_EDIT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_SCULPT | OB_MODE_POSE | \ OB_MODE_PAINT_GPENCIL | OB_MODE_EDIT_GPENCIL | OB_MODE_SCULPT_GPENCIL | \ OB_MODE_WEIGHT_GPENCIL | OB_MODE_VERTEX_GPENCIL) - -#endif /* __DNA_OBJECT_ENUMS_H__ */ diff --git a/source/blender/makesdna/DNA_object_fluidsim_types.h b/source/blender/makesdna/DNA_object_fluidsim_types.h index 1140a837e23..b8848ccc458 100644 --- a/source/blender/makesdna/DNA_object_fluidsim_types.h +++ b/source/blender/makesdna/DNA_object_fluidsim_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_OBJECT_FLUIDSIM_TYPES_H__ -#define __DNA_OBJECT_FLUIDSIM_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_defs.h" @@ -179,5 +178,3 @@ typedef struct FluidsimSettings { #ifdef __cplusplus } #endif - -#endif /* __DNA_OBJECT_FLUIDSIM_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_object_force_types.h b/source/blender/makesdna/DNA_object_force_types.h index 78f645deaa2..3b0640544ae 100644 --- a/source/blender/makesdna/DNA_object_force_types.h +++ b/source/blender/makesdna/DNA_object_force_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_OBJECT_FORCE_TYPES_H__ -#define __DNA_OBJECT_FORCE_TYPES_H__ +#pragma once #include "DNA_defs.h" #include "DNA_listBase.h" @@ -409,5 +408,3 @@ typedef struct SoftBody { #ifdef __cplusplus } #endif - -#endif /* __DNA_OBJECT_FORCE_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 9424100e1c8..6568281a8d4 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -22,8 +22,7 @@ * \brief Object is a sort of wrapper for general info. */ -#ifndef __DNA_OBJECT_TYPES_H__ -#define __DNA_OBJECT_TYPES_H__ +#pragma once #include "DNA_object_enums.h" @@ -495,19 +494,19 @@ enum { ID_VO)) #define OB_DATA_SUPPORT_ID_CASE \ -ID_ME: \ -case ID_CU: \ -case ID_MB: \ -case ID_LA: \ -case ID_SPK: \ -case ID_LP: \ -case ID_CA: \ -case ID_LT: \ -case ID_GD: \ -case ID_AR: \ -case ID_HA: \ -case ID_PT: \ -case ID_VO + ID_ME: \ + case ID_CU: \ + case ID_MB: \ + case ID_LA: \ + case ID_SPK: \ + case ID_LP: \ + case ID_CA: \ + case ID_LT: \ + case ID_GD: \ + case ID_AR: \ + case ID_HA: \ + case ID_PT: \ + case ID_VO /* partype: first 4 bits: type */ enum { @@ -715,5 +714,3 @@ enum { #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/makesdna/DNA_outliner_types.h b/source/blender/makesdna/DNA_outliner_types.h index d8a7599e4cb..46c8b1570e3 100644 --- a/source/blender/makesdna/DNA_outliner_types.h +++ b/source/blender/makesdna/DNA_outliner_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_OUTLINER_TYPES_H__ -#define __DNA_OUTLINER_TYPES_H__ +#pragma once #include "DNA_defs.h" @@ -127,5 +126,3 @@ enum { TSE_KEYMAP_ITEM, \ TSE_ID_BASE, \ TSE_GP_LAYER)) - -#endif diff --git a/source/blender/makesdna/DNA_packedFile_types.h b/source/blender/makesdna/DNA_packedFile_types.h index 8196e3098eb..b74368f767b 100644 --- a/source/blender/makesdna/DNA_packedFile_types.h +++ b/source/blender/makesdna/DNA_packedFile_types.h @@ -21,13 +21,10 @@ * \ingroup DNA */ -#ifndef __DNA_PACKEDFILE_TYPES_H__ -#define __DNA_PACKEDFILE_TYPES_H__ +#pragma once typedef struct PackedFile { int size; int seek; void *data; } PackedFile; - -#endif /* PACKEDFILE_TYPES_H */ diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index 5bd11ab85a5..00f888dde5b 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_PARTICLE_TYPES_H__ -#define __DNA_PARTICLE_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_boid_types.h" @@ -691,5 +690,3 @@ typedef enum eParticleTextureInfluence { PAMAP_CHILD = (PAMAP_CLUMP | PAMAP_KINK_FREQ | PAMAP_KINK_AMP | PAMAP_ROUGH | PAMAP_LENGTH | PAMAP_TWIST), } eParticleTextureInfluence; - -#endif diff --git a/source/blender/makesdna/DNA_pointcache_types.h b/source/blender/makesdna/DNA_pointcache_types.h index 3c7fc9031de..678be7d8297 100644 --- a/source/blender/makesdna/DNA_pointcache_types.h +++ b/source/blender/makesdna/DNA_pointcache_types.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_POINTCACHE_TYPES_H__ -#define __DNA_POINTCACHE_TYPES_H__ +#pragma once #include "DNA_listBase.h" @@ -167,5 +166,3 @@ typedef struct PointCache { #ifdef __cplusplus } #endif - -#endif /* __DNA_POINTCACHE_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_pointcloud_defaults.h b/source/blender/makesdna/DNA_pointcloud_defaults.h index 89df2d3c4be..b5c9396b1dd 100644 --- a/source/blender/makesdna/DNA_pointcloud_defaults.h +++ b/source/blender/makesdna/DNA_pointcloud_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_POINTCLOUD_DEFAULTS_H__ -#define __DNA_POINTCLOUD_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -36,5 +35,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_POINTCLOUD_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_pointcloud_types.h b/source/blender/makesdna/DNA_pointcloud_types.h index 7f42b75fdd1..d3b687c2c68 100644 --- a/source/blender/makesdna/DNA_pointcloud_types.h +++ b/source/blender/makesdna/DNA_pointcloud_types.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_POINTCLOUD_TYPES_H__ -#define __DNA_POINTCLOUD_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_customdata_types.h" @@ -56,5 +55,3 @@ enum { /* Only one material supported currently. */ #define POINTCLOUD_MATERIAL_NR 1 - -#endif /* __DNA_POINTCLOUD_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_rigidbody_types.h b/source/blender/makesdna/DNA_rigidbody_types.h index 7ad50dc04de..3a4925217ff 100644 --- a/source/blender/makesdna/DNA_rigidbody_types.h +++ b/source/blender/makesdna/DNA_rigidbody_types.h @@ -22,8 +22,7 @@ * \brief Types and defines for representing Rigid Body entities */ -#ifndef __DNA_RIGIDBODY_TYPES_H__ -#define __DNA_RIGIDBODY_TYPES_H__ +#pragma once #include "DNA_listBase.h" #include "DNA_object_force_types.h" @@ -369,5 +368,3 @@ typedef enum eRigidBodyCon_Flag { } eRigidBodyCon_Flag; /* ******************************** */ - -#endif /* __DNA_RIGIDBODY_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_scene_defaults.h b/source/blender/makesdna/DNA_scene_defaults.h index 7f01e58f2af..ec64eea0aae 100644 --- a/source/blender/makesdna/DNA_scene_defaults.h +++ b/source/blender/makesdna/DNA_scene_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_SCENE_DEFAULTS_H__ -#define __DNA_SCENE_DEFAULTS_H__ +#pragma once #include "DNA_view3d_defaults.h" @@ -366,4 +365,3 @@ /* clang-format off */ -#endif /* __DNA_SCENE_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index dd62ddb640f..93e690d0aba 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_SCENE_TYPES_H__ -#define __DNA_SCENE_TYPES_H__ +#pragma once #include "DNA_defs.h" @@ -2241,6 +2240,8 @@ enum { #define UVCALC_USESUBSURF (1 << 3) /** adjust UV's while transforming to avoid distortion */ #define UVCALC_TRANSFORM_CORRECT (1 << 4) +/** Keep equal values merged while correcting custom-data. */ +#define UVCALC_TRANSFORM_CORRECT_KEEP_CONNECTED (1 << 5) /* ToolSettings.uv_flag */ #define UV_SYNC_SELECTION 1 @@ -2412,5 +2413,3 @@ enum { #ifdef __cplusplus } #endif - -#endif /* __DNA_SCENE_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index bf5c097322f..d5b828c898d 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_SCREEN_TYPES_H__ -#define __DNA_SCREEN_TYPES_H__ +#pragma once #include "DNA_defs.h" #include "DNA_listBase.h" @@ -705,5 +704,3 @@ enum { /* Only editor overlays (currently gizmos only!) should be redrawn. */ RGN_DRAW_EDITOR_OVERLAYS = 32, }; - -#endif /* __DNA_SCREEN_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_sdna_types.h b/source/blender/makesdna/DNA_sdna_types.h index efa7a308f88..cfb65860b8e 100644 --- a/source/blender/makesdna/DNA_sdna_types.h +++ b/source/blender/makesdna/DNA_sdna_types.h @@ -20,8 +20,7 @@ * \ingroup DNA */ -#ifndef __DNA_SDNA_TYPES_H__ -#define __DNA_SDNA_TYPES_H__ +#pragma once struct MemArena; @@ -101,5 +100,3 @@ typedef struct BHead8 { int64_t old; int SDNAnr, nr; } BHead8; - -#endif diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 9fee839f979..850b906af39 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -28,12 +28,12 @@ * - Meta Strip (SEQ_TYPE_META): Support for nesting Sequences. */ -#ifndef __DNA_SEQUENCE_TYPES_H__ -#define __DNA_SEQUENCE_TYPES_H__ +#pragma once #include "DNA_color_types.h" #include "DNA_defs.h" #include "DNA_listBase.h" +#include "DNA_session_uuid_types.h" #include "DNA_vec_types.h" #include "DNA_vfont_types.h" @@ -119,6 +119,10 @@ typedef struct Strip { ColorManagedColorspaceSettings colorspace_settings; } Strip; +typedef struct SequenceRuntime { + SessionUUID session_uuid; +} SequenceRuntime; + /** * The sequence structure is the basic struct used by any strip. * each of the strips uses a different sequence structure. @@ -237,8 +241,7 @@ typedef struct Sequence { int cache_flag; int _pad2[3]; - struct Sequence *orig_sequence; - void *_pad3; + SequenceRuntime runtime; } Sequence; typedef struct MetaStack { @@ -692,5 +695,3 @@ enum { #ifdef __cplusplus } #endif - -#endif /* __DNA_SEQUENCE_TYPES_H__ */ diff --git a/source/blender/editors/include/ED_logic.h b/source/blender/makesdna/DNA_session_uuid_types.h index ae2d5038321..eaaae101277 100644 --- a/source/blender/editors/include/ED_logic.h +++ b/source/blender/makesdna/DNA_session_uuid_types.h @@ -12,27 +12,32 @@ * 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. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. */ /** \file - * \ingroup editors + * \ingroup DNA */ -#ifndef __ED_LOGIC_H__ -#define __ED_LOGIC_H__ +#pragma once + +#include "BLI_sys_types.h" #ifdef __cplusplus extern "C" { #endif -/* logic_ops.c */ -void ED_operatortypes_logic(void); +/* Is a structure because of the following considerations: + * + * - It is not possible to use custom types in DNA members: makesdna does not recognize them. + * - It allows to add more bits, more than standard fixed-size types can store. For example, if + * we ever need to go 128 bits, it is as simple as adding extra 64bit field. + */ +typedef struct SessionUUID { + /* Never access directly, as it might cause a headache when more bits are needed: if the field + * is used directly it will not be easy to find all places where partial access is used. */ + uint64_t uuid_; +} SessionUUID; #ifdef __cplusplus } #endif - -#endif /* __ED_LOGIC_H__ */ diff --git a/source/blender/makesdna/DNA_shader_fx_types.h b/source/blender/makesdna/DNA_shader_fx_types.h index f19181bf07d..56caac51b94 100644 --- a/source/blender/makesdna/DNA_shader_fx_types.h +++ b/source/blender/makesdna/DNA_shader_fx_types.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_SHADER_FX_TYPES_H__ -#define __DNA_SHADER_FX_TYPES_H__ +#pragma once #include "DNA_defs.h" #include "DNA_listBase.h" @@ -250,4 +249,3 @@ typedef struct WaveShaderFxData { char _pad[4]; ShaderFxData_Runtime runtime; } WaveShaderFxData; -#endif /* __DNA_SHADER_FX_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_simulation_defaults.h b/source/blender/makesdna/DNA_simulation_defaults.h index b4cecd861a9..48d35d5e81f 100644 --- a/source/blender/makesdna/DNA_simulation_defaults.h +++ b/source/blender/makesdna/DNA_simulation_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_SIMULATION_DEFAULTS_H__ -#define __DNA_SIMULATION_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -36,5 +35,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_SIMULATION_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_simulation_types.h b/source/blender/makesdna/DNA_simulation_types.h index 5bb0e50e089..de4c9522334 100644 --- a/source/blender/makesdna/DNA_simulation_types.h +++ b/source/blender/makesdna/DNA_simulation_types.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_SIMULATION_TYPES_H__ -#define __DNA_SIMULATION_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_customdata_types.h" @@ -82,5 +81,3 @@ enum { #define SIM_TYPE_NAME_PARTICLE_SIMULATION "Particle Simulation" #define SIM_TYPE_NAME_PARTICLE_MESH_EMITTER "Particle Mesh Emitter" - -#endif /* __DNA_SIMULATION_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_sound_types.h b/source/blender/makesdna/DNA_sound_types.h index 35ff3a658ba..1d24e655f45 100644 --- a/source/blender/makesdna/DNA_sound_types.h +++ b/source/blender/makesdna/DNA_sound_types.h @@ -20,8 +20,7 @@ * \ingroup DNA */ -#ifndef __DNA_SOUND_TYPES_H__ -#define __DNA_SOUND_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_defs.h" @@ -117,5 +116,3 @@ enum { SOUND_TAGS_WAVEFORM_NO_RELOAD = 1 << 0, SOUND_TAGS_WAVEFORM_LOADING = (1 << 6), }; - -#endif /* __DNA_SOUND_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 0892eff6de9..7d77e8478ae 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -22,8 +22,7 @@ * Structs for each of space type in the user interface. */ -#ifndef __DNA_SPACE_TYPES_H__ -#define __DNA_SPACE_TYPES_H__ +#pragma once #include "DNA_color_types.h" /* for Histogram */ #include "DNA_defs.h" @@ -1735,5 +1734,3 @@ typedef enum eSpace_Type { #define IMG_SIZE_FALLBACK 256 /** \} */ - -#endif /* __DNA_SPACE_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_speaker_defaults.h b/source/blender/makesdna/DNA_speaker_defaults.h index d252a447701..a14e4d687d3 100644 --- a/source/blender/makesdna/DNA_speaker_defaults.h +++ b/source/blender/makesdna/DNA_speaker_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_SPEAKER_DEFAULTS_H__ -#define __DNA_SPEAKER_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -47,5 +46,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_SPEAKER_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_speaker_types.h b/source/blender/makesdna/DNA_speaker_types.h index 9100b37d85e..82693689d68 100644 --- a/source/blender/makesdna/DNA_speaker_types.h +++ b/source/blender/makesdna/DNA_speaker_types.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_SPEAKER_TYPES_H__ -#define __DNA_SPEAKER_TYPES_H__ +#pragma once #include "DNA_ID.h" @@ -58,5 +57,3 @@ typedef struct Speaker { #define SPK_DS_EXPAND (1 << 0) #define SPK_MUTED (1 << 1) // #define SPK_RELATIVE (1 << 2) /* UNUSED */ - -#endif /* __DNA_SPEAKER_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_text_types.h b/source/blender/makesdna/DNA_text_types.h index 27663ffcbdd..2dcb19d19b8 100644 --- a/source/blender/makesdna/DNA_text_types.h +++ b/source/blender/makesdna/DNA_text_types.h @@ -23,8 +23,7 @@ * and arbitrary text data to store in blend files. */ -#ifndef __DNA_TEXT_TYPES_H__ -#define __DNA_TEXT_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_listBase.h" @@ -85,5 +84,3 @@ enum { /** Use space instead of tabs. */ TXT_TABSTOSPACES = 1 << 10, }; - -#endif /* __DNA_TEXT_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_texture_defaults.h b/source/blender/makesdna/DNA_texture_defaults.h index d5097c5ea21..1e790709fd1 100644 --- a/source/blender/makesdna/DNA_texture_defaults.h +++ b/source/blender/makesdna/DNA_texture_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_TEXTURE_DEFAULTS_H__ -#define __DNA_TEXTURE_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -151,5 +150,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_TEXTURE_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index 907fe29263f..63e5f134c19 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_TEXTURE_TYPES_H__ -#define __DNA_TEXTURE_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_defs.h" @@ -529,5 +528,3 @@ enum { #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h index 32a00cc25d1..4cd9034a83b 100644 --- a/source/blender/makesdna/DNA_tracking_types.h +++ b/source/blender/makesdna/DNA_tracking_types.h @@ -23,8 +23,7 @@ * Structs used for camera tracking and the movie-clip editor. */ -#ifndef __DNA_TRACKING_TYPES_H__ -#define __DNA_TRACKING_TYPES_H__ +#pragma once #include "DNA_defs.h" #include "DNA_listBase.h" @@ -617,5 +616,3 @@ enum { PLANE_TRACK_LOCKED = (1 << 2), PLANE_TRACK_AUTOKEY = (1 << 3), }; - -#endif /* __DNA_TRACKING_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index e6f6ce1e208..a632d42fd8b 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_USERDEF_TYPES_H__ -#define __DNA_USERDEF_TYPES_H__ +#pragma once #include "DNA_listBase.h" #include "DNA_texture_types.h" /* ColorBand */ @@ -1339,5 +1338,3 @@ enum { #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/makesdna/DNA_vec_defaults.h b/source/blender/makesdna/DNA_vec_defaults.h index 7242f5ab114..3b980db7838 100644 --- a/source/blender/makesdna/DNA_vec_defaults.h +++ b/source/blender/makesdna/DNA_vec_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_VEC_DEFAULTS_H__ -#define __DNA_VEC_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -51,5 +50,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_VEC_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_vec_types.h b/source/blender/makesdna/DNA_vec_types.h index 72a6056e239..b8cbf85b683 100644 --- a/source/blender/makesdna/DNA_vec_types.h +++ b/source/blender/makesdna/DNA_vec_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_VEC_TYPES_H__ -#define __DNA_VEC_TYPES_H__ +#pragma once /* types */ @@ -91,5 +90,3 @@ typedef struct DualQuat { float scale[4][4]; float scale_weight; } DualQuat; - -#endif diff --git a/source/blender/makesdna/DNA_vfont_types.h b/source/blender/makesdna/DNA_vfont_types.h index 086fb2bc905..4e2a6eba1f5 100644 --- a/source/blender/makesdna/DNA_vfont_types.h +++ b/source/blender/makesdna/DNA_vfont_types.h @@ -24,8 +24,7 @@ * (unrelated to text used to render the GUI). */ -#ifndef __DNA_VFONT_TYPES_H__ -#define __DNA_VFONT_TYPES_H__ +#pragma once #include "DNA_ID.h" @@ -60,5 +59,3 @@ typedef struct VFont { #define FO_CURS_IS_MOTION(mode) (ELEM(mode, FO_CURSUP, FO_CURSDOWN, FO_PAGEUP, FO_PAGEDOWN)) #define FO_BUILTIN_NAME "<builtin>" - -#endif /* __DNA_VFONT_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_view2d_types.h b/source/blender/makesdna/DNA_view2d_types.h index 8734a73c07a..d7a6386d12f 100644 --- a/source/blender/makesdna/DNA_view2d_types.h +++ b/source/blender/makesdna/DNA_view2d_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_VIEW2D_TYPES_H__ -#define __DNA_VIEW2D_TYPES_H__ +#pragma once #include "DNA_vec_types.h" @@ -181,5 +180,3 @@ enum { V2D_ALIGN_NO_POS_Y = (1 << 2), V2D_ALIGN_NO_NEG_Y = (1 << 3), }; - -#endif diff --git a/source/blender/makesdna/DNA_view3d_defaults.h b/source/blender/makesdna/DNA_view3d_defaults.h index 10eadf368ef..62e3d14bd0c 100644 --- a/source/blender/makesdna/DNA_view3d_defaults.h +++ b/source/blender/makesdna/DNA_view3d_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_VIEW3D_DEFAULTS_H__ -#define __DNA_VIEW3D_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -114,5 +113,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_VIEW3D_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_view3d_enums.h b/source/blender/makesdna/DNA_view3d_enums.h index f8c772422bb..fdeebf20808 100644 --- a/source/blender/makesdna/DNA_view3d_enums.h +++ b/source/blender/makesdna/DNA_view3d_enums.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_VIEW3D_ENUMS_H__ -#define __DNA_VIEW3D_ENUMS_H__ +#pragma once /** Settings for offscreen rendering */ typedef enum eV3DOffscreenDrawFlag { @@ -52,5 +51,3 @@ typedef enum eV3DShadingBackgroundType { V3D_SHADING_BACKGROUND_WORLD = 1, V3D_SHADING_BACKGROUND_VIEWPORT = 2, } eV3DShadingBackgroundType; - -#endif diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 4bb32fedd1d..7bfdc14d25c 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_VIEW3D_TYPES_H__ -#define __DNA_VIEW3D_TYPES_H__ +#pragma once struct BoundBox; struct Object; @@ -630,5 +629,3 @@ enum { /** #BKE_screen_view3d_zoom_to_fac() values above */ #define RV3D_CAMZOOM_MIN_FACTOR 0.1657359312880714853f #define RV3D_CAMZOOM_MAX_FACTOR 44.9852813742385702928f - -#endif diff --git a/source/blender/makesdna/DNA_volume_defaults.h b/source/blender/makesdna/DNA_volume_defaults.h index 3a0373851da..8239f263c6c 100644 --- a/source/blender/makesdna/DNA_volume_defaults.h +++ b/source/blender/makesdna/DNA_volume_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_VOLUME_DEFAULTS_H__ -#define __DNA_VOLUME_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -55,5 +54,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_VOLUME_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_volume_types.h b/source/blender/makesdna/DNA_volume_types.h index b3615e87a50..30ac67281e2 100644 --- a/source/blender/makesdna/DNA_volume_types.h +++ b/source/blender/makesdna/DNA_volume_types.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_VOLUME_TYPES_H__ -#define __DNA_VOLUME_TYPES_H__ +#pragma once #include "DNA_ID.h" @@ -122,5 +121,3 @@ typedef enum VolumeRenderSpace { /* Only one material supported currently. */ #define VOLUME_MATERIAL_NR 1 - -#endif /* __DNA_VOLUME_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index a07b8f81d96..4a6d642bcb6 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_WINDOWMANAGER_TYPES_H__ -#define __DNA_WINDOWMANAGER_TYPES_H__ +#pragma once #include "DNA_listBase.h" #include "DNA_screen_types.h" @@ -557,5 +556,3 @@ enum { * (the regiontype is maintained to prevent errors) */ OP_IS_MODAL_CURSOR_REGION = (1 << 3), }; - -#endif /* __DNA_WINDOWMANAGER_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_workspace_types.h b/source/blender/makesdna/DNA_workspace_types.h index d2461657480..170366881c6 100644 --- a/source/blender/makesdna/DNA_workspace_types.h +++ b/source/blender/makesdna/DNA_workspace_types.h @@ -20,8 +20,7 @@ * Use API in BKE_workspace.h to edit these. */ -#ifndef __DNA_WORKSPACE_TYPES_H__ -#define __DNA_WORKSPACE_TYPES_H__ +#pragma once #include "DNA_scene_types.h" @@ -184,5 +183,3 @@ typedef struct WorkSpaceInstanceHook { typedef enum eWorkSpaceFlags { WORKSPACE_USE_FILTER_BY_ORIGIN = (1 << 1), } eWorkSpaceFlags; - -#endif /* __DNA_WORKSPACE_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_world_defaults.h b/source/blender/makesdna/DNA_world_defaults.h index c4d934381b4..52c9551a63e 100644 --- a/source/blender/makesdna/DNA_world_defaults.h +++ b/source/blender/makesdna/DNA_world_defaults.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_WORLD_DEFAULTS_H__ -#define __DNA_WORLD_DEFAULTS_H__ +#pragma once /* Struct members on own line. */ /* clang-format off */ @@ -45,5 +44,3 @@ /** \} */ /* clang-format on */ - -#endif /* __DNA_WORLD_DEFAULTS_H__ */ diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h index dff07f515b1..b1ecf4abf85 100644 --- a/source/blender/makesdna/DNA_world_types.h +++ b/source/blender/makesdna/DNA_world_types.h @@ -21,8 +21,7 @@ * \ingroup DNA */ -#ifndef __DNA_WORLD_TYPES_H__ -#define __DNA_WORLD_TYPES_H__ +#pragma once #include "DNA_ID.h" #include "DNA_defs.h" @@ -111,5 +110,3 @@ enum { * otherwise anim-editors will not read correctly */ #define WO_DS_SHOW_TEXS (1 << 2) - -#endif diff --git a/source/blender/makesdna/DNA_xr_types.h b/source/blender/makesdna/DNA_xr_types.h index a026f7554cb..caa5232788a 100644 --- a/source/blender/makesdna/DNA_xr_types.h +++ b/source/blender/makesdna/DNA_xr_types.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_XR_TYPES_H__ -#define __DNA_XR_TYPES_H__ +#pragma once #include "DNA_view3d_types.h" @@ -54,5 +53,3 @@ typedef enum eXRSessionBasePoseType { XR_BASE_POSE_OBJECT = 1, XR_BASE_POSE_CUSTOM = 2, } eXRSessionBasePoseType; - -#endif /* __DNA_XR_TYPES_H__ */ diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt index 0f2761e311e..9808740e030 100644 --- a/source/blender/makesdna/intern/CMakeLists.txt +++ b/source/blender/makesdna/intern/CMakeLists.txt @@ -35,11 +35,13 @@ blender_include_dirs( set(SRC dna_utils.c makesdna.c + ../../blenlib/intern/BLI_assert.c ../../blenlib/intern/BLI_ghash.c ../../blenlib/intern/BLI_ghash_utils.c ../../blenlib/intern/BLI_memarena.c ../../blenlib/intern/BLI_mempool.c ../../blenlib/intern/hash_mm2a.c # needed by 'BLI_ghash_utils.c', not used directly. + ../../../../intern/guardedalloc/intern/leak_detector.cc ../../../../intern/guardedalloc/intern/mallocn.c ../../../../intern/guardedalloc/intern/mallocn_guarded_impl.c ../../../../intern/guardedalloc/intern/mallocn_lockfree_impl.c @@ -125,6 +127,7 @@ set(INC_SYS ) set(SRC + ../../blenlib/intern/BLI_assert.c ../../blenlib/intern/BLI_ghash.c ../../blenlib/intern/BLI_ghash_utils.c ../../blenlib/intern/BLI_linklist.c diff --git a/source/blender/makesdna/intern/dna_utils.c b/source/blender/makesdna/intern/dna_utils.c index 6708365a4c8..97f4785374a 100644 --- a/source/blender/makesdna/intern/dna_utils.c +++ b/source/blender/makesdna/intern/dna_utils.c @@ -232,6 +232,21 @@ void DNA_alias_maps(enum eDNA_RenameDir version_dir, GHash **r_struct_map, GHash for (int i = 0; i < ARRAY_SIZE(data); i++) { BLI_ghash_insert(struct_map, (void *)data[i][elem_key], (void *)data[i][elem_val]); } + + if (version_dir == DNA_RENAME_STATIC_FROM_ALIAS) { + const char *renames[][2] = { + {"int8_t", "char"}, /* Note that a char is always unsigned in Blender. */ + {"uint8_t", "uchar"}, + {"int16_t", "short"}, + {"uint16_t", "ushort"}, + {"int32_t", "int"}, + {"uint32_t", "int"}, + }; + for (int i = 0; i < ARRAY_SIZE(renames); i++) { + BLI_ghash_insert(struct_map, (void *)renames[i][0], (void *)renames[i][1]); + } + } + *r_struct_map = struct_map; /* We know the direction of this, for local use. */ diff --git a/source/blender/makesdna/intern/dna_utils.h b/source/blender/makesdna/intern/dna_utils.h index 123dd30a2b9..264310ef0fb 100644 --- a/source/blender/makesdna/intern/dna_utils.h +++ b/source/blender/makesdna/intern/dna_utils.h @@ -18,8 +18,7 @@ * \ingroup DNA */ -#ifndef __DNA_UTILS_H__ -#define __DNA_UTILS_H__ +#pragma once struct GHash; struct MemArena; @@ -54,5 +53,3 @@ void DNA_alias_maps(enum eDNA_RenameDir version_dir, const char *DNA_struct_rename_legacy_hack_alias_from_static(const char *name); const char *DNA_struct_rename_legacy_hack_static_from_alias(const char *name); - -#endif /* __DNA_UTILS_H__ */ diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 182296c0ba2..898d2e58e45 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -54,6 +54,7 @@ #include "BLI_ghash.h" #include "BLI_memarena.h" #include "BLI_sys_types.h" /* for intptr_t support */ +#include "BLI_system.h" /* for 'BLI_system_backtrace' stub. */ #include "BLI_utildefines.h" #include "dna_utils.h" @@ -98,6 +99,7 @@ static const char *includefiles[] = { "DNA_sdna_types.h", "DNA_fileglobal_types.h", "DNA_sequence_types.h", + "DNA_session_uuid_types.h", "DNA_effect_types.h", "DNA_outliner_types.h", "DNA_sound_types.h", @@ -1592,6 +1594,7 @@ int main(int argc, char **argv) #include "DNA_screen_types.h" #include "DNA_sdna_types.h" #include "DNA_sequence_types.h" +#include "DNA_session_uuid_types.h" #include "DNA_shader_fx_types.h" #include "DNA_simulation_types.h" #include "DNA_sound_types.h" diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index 1bcf7f434f2..ee1a3fdd539 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __RNA_DEFINE_H__ -#define __RNA_DEFINE_H__ +#pragma once /** \file * \ingroup RNA @@ -531,5 +530,3 @@ extern const float rna_default_scale_3d[3]; #ifdef __cplusplus } #endif - -#endif /* __RNA_DEFINE_H__ */ diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index 0c462ba6766..fb9b62e729a 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __RNA_ENUM_TYPES_H__ -#define __RNA_ENUM_TYPES_H__ +#pragma once /** \file * \ingroup RNA @@ -323,5 +322,3 @@ const EnumPropertyItem *RNA_enum_node_tree_types_itemf_impl(struct bContext *C, #ifdef __cplusplus } #endif - -#endif /* __RNA_ENUM_TYPES_H__ */ diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index a6ed705ec67..0b43a5a6653 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -175,6 +175,7 @@ set(SRC ${DEFSRC} ${APISRC} ../../../../intern/clog/clog.c + ../../../../intern/guardedalloc/intern/leak_detector.cc ../../../../intern/guardedalloc/intern/mallocn.c ../../../../intern/guardedalloc/intern/mallocn_guarded_impl.c ../../../../intern/guardedalloc/intern/mallocn_lockfree_impl.c diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index b34c324bd91..b7f0fb87536 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -29,6 +29,7 @@ #include "MEM_guardedalloc.h" +#include "BLI_system.h" /* for 'BLI_system_backtrace' stub. */ #include "BLI_utildefines.h" #include "RNA_define.h" @@ -5144,7 +5145,10 @@ static void mem_error_cb(const char *errorStr) int main(int argc, char **argv) { - int totblock, return_status = 0; + int return_status = 0; + + MEM_initialize_memleak_detection(); + MEM_set_error_callback(mem_error_cb); CLG_init(); @@ -5166,12 +5170,5 @@ int main(int argc, char **argv) CLG_exit(); - totblock = MEM_get_memory_blocks_in_use(); - if (totblock != 0) { - fprintf(stderr, "Error Totblock: %d\n", totblock); - MEM_set_error_callback(mem_error_cb); - MEM_printmemlist(); - } - return return_status; } diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 8d498ab569b..e9ca0d577ce 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -96,6 +96,7 @@ const EnumPropertyItem rna_enum_id_type_items[] = { # include "BKE_font.h" # include "BKE_global.h" /* XXX, remove me */ # include "BKE_idprop.h" +# include "BKE_idtype.h" # include "BKE_lib_override.h" # include "BKE_lib_query.h" # include "BKE_lib_remap.h" diff --git a/source/blender/makesrna/intern/rna_access_internal.h b/source/blender/makesrna/intern/rna_access_internal.h index a5b554ec7a6..73407123863 100644 --- a/source/blender/makesrna/intern/rna_access_internal.h +++ b/source/blender/makesrna/intern/rna_access_internal.h @@ -18,8 +18,7 @@ * \ingroup RNA */ -#ifndef __RNA_ACCESS_INTERNAL_H__ -#define __RNA_ACCESS_INTERNAL_H__ +#pragma once #include "BLI_utildefines.h" @@ -34,5 +33,3 @@ void rna_property_rna_or_id_get(PropertyRNA *prop, void rna_idproperty_touch(struct IDProperty *idprop); struct IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name); - -#endif /* __ACCESS_RNA_INTERNAL_H__ */ diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 71922eb86b5..84f9ec749cb 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -1519,7 +1519,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna) RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); prop = RNA_def_property(srna, "use_strength_pressure", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_USE_STENGTH_PRESSURE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_USE_STRENGTH_PRESSURE); RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0); RNA_def_property_ui_text( prop, "Use Pressure Strength", "Use tablet pressure for color strength"); @@ -2277,7 +2277,7 @@ static void rna_def_brush(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Wet Persistence", - "Amount of wet paint that stays in the brush after applyig paint to the surface"); + "Amount of wet paint that stays in the brush after applying paint to the surface"); RNA_def_property_update(prop, 0, "rna_Brush_update"); prop = RNA_def_property(srna, "density", PROP_FLOAT, PROP_FACTOR); diff --git a/source/blender/makesrna/intern/rna_curve_api.c b/source/blender/makesrna/intern/rna_curve_api.c index 1207f19b95f..94fdb130026 100644 --- a/source/blender/makesrna/intern/rna_curve_api.c +++ b/source/blender/makesrna/intern/rna_curve_api.c @@ -37,7 +37,7 @@ #ifdef RNA_RUNTIME static void rna_Curve_transform(Curve *cu, float *mat, bool shape_keys) { - BKE_curve_transform(cu, (float(*)[4])mat, shape_keys, true); + BKE_curve_transform(cu, (const float(*)[4])mat, shape_keys, true); DEG_id_tag_update(&cu->id, 0); } diff --git a/source/blender/makesrna/intern/rna_fluid.c b/source/blender/makesrna/intern/rna_fluid.c index 71b8eee9d50..47e0333edb1 100644 --- a/source/blender/makesrna/intern/rna_fluid.c +++ b/source/blender/makesrna/intern/rna_fluid.c @@ -1024,14 +1024,18 @@ static void rna_Fluid_flowtype_set(struct PointerRNA *ptr, int value) FluidFlowSettings *settings = (FluidFlowSettings *)ptr->data; if (value != settings->type) { + short prev_value = settings->type; settings->type = value; - /* Force flow source to mesh */ + /* Force flow source to mesh for liquids. + * Also use different surface emission. Liquids should by default not emit around surface. */ if (value == FLUID_FLOW_TYPE_LIQUID) { rna_Fluid_flowsource_set(ptr, FLUID_FLOW_SOURCE_MESH); settings->surface_distance = 0.0f; } - else { + /* Use some surface emission when switching to a gas emitter. Gases should by default emit a + * bit around surface. */ + if (prev_value == FLUID_FLOW_TYPE_LIQUID) { settings->surface_distance = 1.5f; } } @@ -1683,6 +1687,15 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) "and reduce the boundary smoothening effect)"); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset"); + prop = RNA_def_property(srna, "sys_particle_maximum", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "sys_particle_maximum"); + RNA_def_property_range(prop, 0, INT_MAX); + RNA_def_property_ui_text( + prop, + "System Maximum", + "Maximum number of fluid particles that are allowed in this simulation"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset"); + /* diffusion options */ prop = RNA_def_property(srna, "use_diffusion", PROP_BOOLEAN, PROP_NONE); @@ -2376,7 +2389,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "openvdb_cache_compress_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "openvdb_compression"); RNA_def_property_enum_items(prop, prop_compression_items); - RNA_def_property_ui_text(prop, "Compression", "facession method to be used"); + RNA_def_property_ui_text(prop, "Compression", "Compression method to be used"); prop = RNA_def_property(srna, "openvdb_data_depth", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "openvdb_data_depth"); diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index a8085c00cb3..8045279eef2 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -18,8 +18,7 @@ * \ingroup RNA */ -#ifndef __RNA_INTERNAL_H__ -#define __RNA_INTERNAL_H__ +#pragma once #include "BLI_utildefines.h" @@ -644,5 +643,3 @@ void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values); : -FLT_MAX, double \ : -DBL_MAX) #endif - -#endif /* __RNA_INTERNAL_H__ */ diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index 20c8743f768..01c406104d7 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -18,8 +18,7 @@ * \ingroup RNA */ -#ifndef __RNA_INTERNAL_TYPES_H__ -#define __RNA_INTERNAL_TYPES_H__ +#pragma once #include "DNA_listBase.h" @@ -569,5 +568,3 @@ struct BlenderRNA { }; #define CONTAINER_RNA_ID(cont) (*(const char **)(((ContainerRNA *)(cont)) + 1)) - -#endif /* __RNA_INTERNAL_TYPES_H__ */ diff --git a/source/blender/makesrna/intern/rna_mesh_utils.h b/source/blender/makesrna/intern/rna_mesh_utils.h index 9c5b4f9d5b3..5e11be382ec 100644 --- a/source/blender/makesrna/intern/rna_mesh_utils.h +++ b/source/blender/makesrna/intern/rna_mesh_utils.h @@ -18,8 +18,7 @@ * \ingroup RNA */ -#ifndef __RNA_MESH_UTILS_H__ -#define __RNA_MESH_UTILS_H__ +#pragma once /* Macros to help reduce code clutter in rna_mesh.c */ @@ -123,5 +122,3 @@ BKE_mesh_update_customdata_pointers(me, true); \ } \ } - -#endif /* __RNA_MESH_UTILS_H__ */ diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 6f0192bb810..3eb2c15c053 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -8466,6 +8466,12 @@ static void rna_def_node_socket_interface(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Is Output", "True if the socket is an output, otherwise input"); + prop = RNA_def_property(srna, "hide_value", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_HIDE_VALUE); + RNA_def_property_ui_text( + prop, "Hide Value", "Hide the socket input value even when the socket is not connected"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update"); + /* registration */ prop = RNA_def_property(srna, "bl_socket_idname", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname"); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 2524f590051..bb3756d9cfc 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -809,7 +809,7 @@ static char *rna_EffectorWeight_path(PointerRNA *ptr) if (fmd->domain->effector_weights == ew) { char name_esc[sizeof(md->name) * 2]; BLI_strescape(name_esc, md->name, sizeof(name_esc)); - return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", name_esc); + return BLI_sprintfN("modifiers[\"%s\"].domain_settings.effector_weights", name_esc); } } @@ -935,7 +935,7 @@ static void rna_def_pointcache_common(StructRNA *srna) prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "startframe"); RNA_def_property_range(prop, -MAXFRAME, MAXFRAME); - RNA_def_property_ui_range(prop, 1, MAXFRAME, 1, 1); + RNA_def_property_ui_range(prop, 0, MAXFRAME, 1, 1); RNA_def_property_ui_text(prop, "Start", "Frame on which the simulation starts"); prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME); diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c index 325c4e3caa9..264b0da8e0a 100644 --- a/source/blender/makesrna/intern/rna_rigidbody.c +++ b/source/blender/makesrna/intern/rna_rigidbody.c @@ -35,6 +35,8 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "DEG_depsgraph_build.h" + #include "WM_types.h" /* roles of objects in RigidBody Sims */ @@ -218,6 +220,7 @@ static void rna_RigidBodyOb_shape_update(Main *bmain, Scene *scene, PointerRNA * Object *ob = (Object *)ptr->owner_id; rna_RigidBodyOb_reset(bmain, scene, ptr); + DEG_relations_tag_update(bmain); WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob); } @@ -233,6 +236,16 @@ static void rna_RigidBodyOb_shape_reset(Main *UNUSED(bmain), Scene *scene, Point } } +static void rna_RigidBodyOb_mesh_source_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + Object *ob = (Object *)ptr->owner_id; + + rna_RigidBodyOb_reset(bmain, scene, ptr); + DEG_relations_tag_update(bmain); + + WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob); +} + static char *rna_RigidBodyOb_path(PointerRNA *UNUSED(ptr)) { /* NOTE: this hardcoded path should work as long as only Objects have this */ @@ -1026,7 +1039,7 @@ static void rna_def_rigidbody_object(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Mesh Source", "Source of the mesh used to create collision shape"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset"); + RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_mesh_source_update"); /* booleans */ prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index f9f6defb2f1..9f5440be9f8 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -1250,6 +1250,7 @@ static int rna_property_override_diff_propptr(Main *bmain, IDOverrideLibrary *override, const char *rna_path, size_t rna_path_len, + const uint property_type, const char *rna_itemname_a, const char *rna_itemname_b, const int rna_itemindex_a, @@ -1257,6 +1258,8 @@ static int rna_property_override_diff_propptr(Main *bmain, const int flags, bool *r_override_changed) { + BLI_assert(ELEM(property_type, PROP_POINTER, PROP_COLLECTION)); + const bool do_create = override != NULL && (flags & RNA_OVERRIDE_COMPARE_CREATE) != 0 && rna_path != NULL; @@ -1300,6 +1303,13 @@ static int rna_property_override_diff_propptr(Main *bmain, if (op != NULL) { BKE_lib_override_library_operations_tag(op, IDOVERRIDE_LIBRARY_TAG_UNUSED, false); + if (created || op->rna_prop_type == 0) { + op->rna_prop_type = property_type; + } + else { + BLI_assert(op->rna_prop_type == property_type); + } + if (created || rna_itemname_a != NULL || rna_itemname_b != NULL || rna_itemindex_a != -1 || rna_itemindex_b != -1) { BKE_lib_override_library_property_operation_get(op, @@ -1464,7 +1474,11 @@ int rna_property_override_diff_default(Main *bmain, PROPOVERRIDE_LIBRARY_INSERTION) && do_create; - switch (RNA_property_type(prop_a->rnaprop)) { + const uint rna_prop_type = RNA_property_type(prop_a->rnaprop); + bool created = false; + IDOverrideLibraryProperty *op = NULL; + + switch (rna_prop_type) { case PROP_BOOLEAN: { if (len_a) { bool array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY]; @@ -1482,9 +1496,7 @@ int rna_property_override_diff_default(Main *bmain, if (do_create && comp != 0) { /* XXX TODO this will have to be refined to handle array items */ - bool created = false; - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + op = BKE_lib_override_library_property_get(override, rna_path, &created); if (op != NULL && created) { BKE_lib_override_library_property_operation_get( @@ -1513,9 +1525,7 @@ int rna_property_override_diff_default(Main *bmain, const int comp = (value_a < value_b) ? -1 : (value_a > value_b) ? 1 : 0; if (do_create && comp != 0) { - bool created = false; - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + op = BKE_lib_override_library_property_get(override, rna_path, &created); if (op != NULL && created) { /* If not yet overridden... */ BKE_lib_override_library_property_operation_get( @@ -1547,9 +1557,7 @@ int rna_property_override_diff_default(Main *bmain, if (do_create && comp != 0) { /* XXX TODO this will have to be refined to handle array items */ - bool created = false; - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + op = BKE_lib_override_library_property_get(override, rna_path, &created); if (op != NULL && created) { BKE_lib_override_library_property_operation_get( @@ -1578,9 +1586,7 @@ int rna_property_override_diff_default(Main *bmain, const int comp = (value_a < value_b) ? -1 : (value_a > value_b) ? 1 : 0; if (do_create && comp != 0) { - bool created = false; - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + op = BKE_lib_override_library_property_get(override, rna_path, &created); if (op != NULL && created) { /* If not yet overridden... */ BKE_lib_override_library_property_operation_get( @@ -1612,9 +1618,7 @@ int rna_property_override_diff_default(Main *bmain, if (do_create && comp != 0) { /* XXX TODO this will have to be refined to handle array items */ - bool created = false; - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + op = BKE_lib_override_library_property_get(override, rna_path, &created); if (op != NULL && created) { BKE_lib_override_library_property_operation_get( @@ -1643,9 +1647,7 @@ int rna_property_override_diff_default(Main *bmain, const int comp = (value_a < value_b) ? -1 : (value_a > value_b) ? 1 : 0; if (do_create && comp != 0) { - bool created = false; - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + op = BKE_lib_override_library_property_get(override, rna_path, &created); if (op != NULL && created) { /* If not yet overridden... */ BKE_lib_override_library_property_operation_get( @@ -1666,9 +1668,7 @@ int rna_property_override_diff_default(Main *bmain, const int comp = value_a != value_b; if (do_create && comp != 0) { - bool created = false; - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + op = BKE_lib_override_library_property_get(override, rna_path, &created); if (op != NULL && created) { /* If not yet overridden... */ BKE_lib_override_library_property_operation_get( @@ -1700,9 +1700,7 @@ int rna_property_override_diff_default(Main *bmain, const int comp = strcmp(value_a, value_b); if (do_create && comp != 0) { - bool created = false; - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + op = BKE_lib_override_library_property_get(override, rna_path, &created); if (op != NULL && created) { /* If not yet overridden... */ BKE_lib_override_library_property_operation_get( @@ -1740,6 +1738,7 @@ int rna_property_override_diff_default(Main *bmain, override, rna_path, rna_path_len, + PROP_POINTER, NULL, NULL, -1, @@ -1848,9 +1847,7 @@ int rna_property_override_diff_default(Main *bmain, * pointers), since they do not support removing, only in *some* cases, insertion. We * also assume then that _a data is the one where things are inserted. */ if (is_valid_for_insertion && use_collection_insertion) { - bool created; - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + op = BKE_lib_override_library_property_get(override, rna_path, &created); if (is_first_insert) { /* We need to clean up all possible existing insertion operations, @@ -1883,6 +1880,7 @@ int rna_property_override_diff_default(Main *bmain, prev_propname_a, idx_a - 1); # endif + op = NULL; } else if (is_id || is_valid_for_diffing) { if (equals || do_create) { @@ -1895,6 +1893,7 @@ int rna_property_override_diff_default(Main *bmain, override, rna_path, rna_path_len, + PROP_COLLECTION, propname_a, propname_b, idx_a, @@ -1963,6 +1962,15 @@ int rna_property_override_diff_default(Main *bmain, break; } + if (op != NULL) { + if (created || op->rna_prop_type == 0) { + op->rna_prop_type = rna_prop_type; + } + else { + BLI_assert(op->rna_prop_type == rna_prop_type); + } + } + return 0; } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index a6247474c69..66698d60423 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -3090,6 +3090,15 @@ static void rna_def_tool_settings(BlenderRNA *brna) "Correct data such as UV's and vertex colors when transforming"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + prop = RNA_def_property(srna, "use_transform_correct_keep_connected", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna( + prop, NULL, "uvcalc_flag", UVCALC_TRANSFORM_CORRECT_KEEP_CONNECTED); + RNA_def_property_ui_text( + prop, + "Keep Connected", + "During the Face Attributes correction, merge attributes connected to the same vertex"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + prop = RNA_def_property(srna, "use_mesh_automerge", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "automerge", AUTO_MERGE); RNA_def_property_ui_text( diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 6589ae4b8da..0cfc6fd569c 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -862,6 +862,43 @@ static int rna_Sequence_input_count_get(PointerRNA *ptr) return BKE_sequence_effect_get_num_inputs(seq->type); } +static void rna_Sequence_input_set(PointerRNA *ptr, + PointerRNA ptr_value, + struct ReportList *reports, + int input_num) +{ + + Sequence *seq = ptr->data; + Sequence *input = ptr_value.data; + + if (BKE_sequencer_render_loop_check(input, seq)) { + BKE_report(reports, RPT_ERROR, "Cannot reassign inputs: recursion detected"); + return; + } + + switch (input_num) { + case 1: + seq->seq1 = input; + break; + case 2: + seq->seq2 = input; + break; + } +} + +static void rna_Sequence_input_1_set(PointerRNA *ptr, + PointerRNA ptr_value, + struct ReportList *reports) +{ + rna_Sequence_input_set(ptr, ptr_value, reports, 1); +} + +static void rna_Sequence_input_2_set(PointerRNA *ptr, + PointerRNA ptr_value, + struct ReportList *reports) +{ + rna_Sequence_input_set(ptr, ptr_value, reports, 2); +} # if 0 static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value) { @@ -1272,6 +1309,24 @@ static void rna_Sequence_modifier_clear(Sequence *seq, bContext *C) WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL); } +static void rna_SequenceModifier_strip_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *reports) +{ + SequenceModifierData *smd = ptr->data; + Scene *scene = (Scene *)ptr->owner_id; + Editing *ed = BKE_sequencer_editing_get(scene, false); + Sequence *seq = sequence_get_by_modifier(ed, smd); + Sequence *target = (Sequence *)value.data; + + if (target != NULL && BKE_sequencer_render_loop_check(target, seq)) { + BKE_report(reports, RPT_ERROR, "Recursion detected, can not use this strip"); + return; + } + + smd->mask_sequence = target; +} + static float rna_Sequence_fps_get(PointerRNA *ptr) { Scene *scene = (Scene *)ptr->owner_id; @@ -2193,6 +2248,7 @@ static void rna_def_effect_inputs(StructRNA *srna, int count) prop = RNA_def_property(srna, "input_1", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "seq1"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL); + RNA_def_property_pointer_funcs(prop, NULL, "rna_Sequence_input_1_set", NULL, NULL); RNA_def_property_ui_text(prop, "Input 1", "First input for the effect strip"); } @@ -2200,6 +2256,7 @@ static void rna_def_effect_inputs(StructRNA *srna, int count) prop = RNA_def_property(srna, "input_2", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "seq2"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL); + RNA_def_property_pointer_funcs(prop, NULL, "rna_Sequence_input_2_set", NULL, NULL); RNA_def_property_ui_text(prop, "Input 2", "Second input for the effect strip"); } @@ -3053,8 +3110,11 @@ static void rna_def_modifier(BlenderRNA *brna) prop = RNA_def_property(srna, "input_mask_strip", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "mask_sequence"); - RNA_def_property_pointer_funcs( - prop, NULL, NULL, NULL, "rna_SequenceModifier_otherSequence_poll"); + RNA_def_property_pointer_funcs(prop, + NULL, + "rna_SequenceModifier_strip_set", + NULL, + "rna_SequenceModifier_otherSequence_poll"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Mask Strip", "Strip used as mask input for the modifier"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update"); diff --git a/source/blender/makesrna/intern/rna_shader_fx.c b/source/blender/makesrna/intern/rna_shader_fx.c index e1970a57a91..7b039b91188 100644 --- a/source/blender/makesrna/intern/rna_shader_fx.c +++ b/source/blender/makesrna/intern/rna_shader_fx.c @@ -338,7 +338,7 @@ static void rna_def_shader_fx_pixel(BlenderRNA *brna) prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FX_PIXEL_FILTER_NEAREST); - RNA_def_property_ui_text(prop, "Antialiasing", "Antialiase pixels"); + RNA_def_property_ui_text(prop, "Antialiasing", "Antialias pixels"); RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); } diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 49a21799d5b..494fcec4c31 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -6601,7 +6601,7 @@ static void rna_def_space_clip(BlenderRNA *brna) prop = RNA_def_property(srna, "show_graph_only_selected", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_SEL_ONLY); RNA_def_property_ui_text( - prop, "Only Selected", "Only include channels relating to selected objects and data"); + prop, "Only Show Selected", "Only include channels relating to selected objects and data"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 0); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL); diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index 54fe2e4b513..27297a4d19a 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -2440,7 +2440,7 @@ static void rna_def_trackingDopesheet(BlenderRNA *brna) prop = RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_DOPE_SELECTED_ONLY); RNA_def_property_ui_text( - prop, "Only Selected", "Only include channels relating to selected objects and data"); + prop, "Only Show Selected", "Only include channels relating to selected objects and data"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 0); RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_trackingDopesheet_tagUpdate"); diff --git a/source/blender/modifiers/MOD_modifiertypes.h b/source/blender/modifiers/MOD_modifiertypes.h index ba676bbe459..b011abf336d 100644 --- a/source/blender/modifiers/MOD_modifiertypes.h +++ b/source/blender/modifiers/MOD_modifiertypes.h @@ -18,8 +18,7 @@ * \ingroup modifiers */ -#ifndef __MOD_MODIFIERTYPES_H__ -#define __MOD_MODIFIERTYPES_H__ +#pragma once #include "BKE_modifier.h" @@ -94,5 +93,3 @@ void modifier_type_init(ModifierTypeInfo *types[]); #ifdef __cplusplus } #endif - -#endif /* __MOD_MODIFIERTYPES_H__ */ diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index b62c03d1b03..e7f47a09d95 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -165,10 +165,15 @@ static void deformVerts(ModifierData *md, static void deformVertsEM(ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *em, - Mesh *UNUSED(mesh), + Mesh *mesh, float (*vertexCos)[3], int numVerts) { + if (mesh != NULL) { + deformVerts(md, ctx, mesh, vertexCos, numVerts); + return; + } + ArmatureModifierData *amd = (ArmatureModifierData *)md; MOD_previous_vcos_store(md, vertexCos); /* if next modifier needs original vertices */ diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 1d39aa786a5..08fd7fb229d 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -44,6 +44,7 @@ #include "BKE_lib_query.h" #include "BKE_material.h" #include "BKE_mesh.h" +#include "BKE_mesh_wrapper.h" #include "BKE_modifier.h" #include "BKE_screen.h" @@ -180,6 +181,10 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * if (mesh_other) { Object *object = ctx->object; + /* XXX This is utterly non-optimal, we may go from a bmesh to a mesh back to a bmesh! + * But for 2.90 better not try to be smart here. */ + BKE_mesh_wrapper_ensure_mdata(mesh_other); + /* when one of objects is empty (has got no faces) we could speed up * calculation a bit returning one of objects' derived meshes (or empty one) * Returning mesh is depended on modifiers operation (sergey) */ diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index 760e4717b6d..42adf305ee9 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -150,10 +150,15 @@ static void deformVerts(ModifierData *md, static void deformVertsEM(ModifierData *md, const ModifierEvalContext *ctx, BMEditMesh *em, - Mesh *UNUSED(mesh), + Mesh *mesh, float (*vertexCos)[3], int numVerts) { + if (mesh != NULL) { + deformVerts(md, ctx, mesh, vertexCos, numVerts); + return; + } + CurveModifierData *cmd = (CurveModifierData *)md; bool use_dverts = false; int defgrp_index = -1; diff --git a/source/blender/modifiers/intern/MOD_datatransfer.c b/source/blender/modifiers/intern/MOD_datatransfer.c index 0b205ec4fc5..c8f49694a2f 100644 --- a/source/blender/modifiers/intern/MOD_datatransfer.c +++ b/source/blender/modifiers/intern/MOD_datatransfer.c @@ -204,32 +204,36 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * BKE_reports_init(&reports, RPT_STORE); /* Note: no islands precision for now here. */ - BKE_object_data_transfer_ex(ctx->depsgraph, - scene, - ob_source, - ctx->object, - result, - dtmd->data_types, - false, - dtmd->vmap_mode, - dtmd->emap_mode, - dtmd->lmap_mode, - dtmd->pmap_mode, - space_transform, - false, - max_dist, - dtmd->map_ray_radius, - 0.0f, - dtmd->layers_select_src, - dtmd->layers_select_dst, - dtmd->mix_mode, - dtmd->mix_factor, - dtmd->defgrp_name, - invert_vgroup, - &reports); + if (BKE_object_data_transfer_ex(ctx->depsgraph, + scene, + ob_source, + ctx->object, + result, + dtmd->data_types, + false, + dtmd->vmap_mode, + dtmd->emap_mode, + dtmd->lmap_mode, + dtmd->pmap_mode, + space_transform, + false, + max_dist, + dtmd->map_ray_radius, + 0.0f, + dtmd->layers_select_src, + dtmd->layers_select_dst, + dtmd->mix_mode, + dtmd->mix_factor, + dtmd->defgrp_name, + invert_vgroup, + &reports)) { + result->runtime.is_original = false; + } if (BKE_reports_contain(&reports, RPT_ERROR)) { - BKE_modifier_set_error(md, "%s", BKE_reports_string(&reports, RPT_ERROR)); + const char *report_str = BKE_reports_string(&reports, RPT_ERROR); + BKE_modifier_set_error(md, "%s", report_str); + MEM_freeN((void *)report_str); } else if ((dtmd->data_types & DT_TYPE_LNOR) && !(me->flag & ME_AUTOSMOOTH)) { BKE_modifier_set_error((ModifierData *)dtmd, "Enable 'Auto Smooth' in Object Data Properties"); diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index c8cfc07562f..083348dfb26 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -23,6 +23,7 @@ #include "BLI_utildefines.h" +#include "BLI_bitmap.h" #include "BLI_math.h" #include "BLT_translation.h" @@ -40,6 +41,7 @@ #include "BKE_lib_id.h" #include "BKE_lib_query.h" #include "BKE_mesh.h" +#include "BKE_mesh_wrapper.h" #include "BKE_modifier.h" #include "BKE_screen.h" @@ -139,7 +141,10 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte struct HookData_cb { float (*vertexCos)[3]; - MDeformVert *dvert; + /** + * When anything other than -1, use deform groups. + * This is not the same as checking `dvert` for NULL when we have edit-meshes. + */ int defgrp_index; struct CurveMapping *curfalloff; @@ -160,6 +165,20 @@ struct HookData_cb { bool invert_vgroup; }; +static BLI_bitmap *hook_index_array_to_bitmap(HookModifierData *hmd, const int numVerts) +{ + BLI_bitmap *indexar_used = BLI_BITMAP_NEW(numVerts, __func__); + int i; + int *index_pt; + for (i = 0, index_pt = hmd->indexar; i < hmd->totindex; i++, index_pt++) { + const int j = *index_pt; + if (j < numVerts) { + BLI_BITMAP_ENABLE(indexar_used, i); + } + } + return indexar_used; +} + static float hook_falloff(const struct HookData_cb *hd, const float len_sq) { BLI_assert(hd->falloff_sq); @@ -226,7 +245,7 @@ static float hook_falloff(const struct HookData_cb *hd, const float len_sq) } } -static void hook_co_apply(struct HookData_cb *hd, const int j) +static void hook_co_apply(struct HookData_cb *hd, int j, const MDeformVert *dv) { float *co = hd->vertexCos[j]; float fac; @@ -250,9 +269,9 @@ static void hook_co_apply(struct HookData_cb *hd, const int j) } if (fac) { - if (hd->dvert) { - fac *= hd->invert_vgroup ? 1.0f - BKE_defvert_find_weight(&hd->dvert[j], hd->defgrp_index) : - BKE_defvert_find_weight(&hd->dvert[j], hd->defgrp_index); + if (dv != NULL) { + fac *= hd->invert_vgroup ? 1.0f - BKE_defvert_find_weight(dv, hd->defgrp_index) : + BKE_defvert_find_weight(dv, hd->defgrp_index); } if (fac) { @@ -267,6 +286,7 @@ static void deformVerts_do(HookModifierData *hmd, const ModifierEvalContext *UNUSED(ctx), Object *ob, Mesh *mesh, + BMEditMesh *em, float (*vertexCos)[3], int numVerts) { @@ -274,6 +294,7 @@ static void deformVerts_do(HookModifierData *hmd, bPoseChannel *pchan = BKE_pose_channel_find_name(ob_target->pose, hmd->subtarget); float dmat[4][4]; int i, *index_pt; + MDeformVert *dvert; struct HookData_cb hd; const bool invert_vgroup = (hmd->flag & MOD_HOOK_INVERT_VGROUP) != 0; @@ -288,7 +309,16 @@ static void deformVerts_do(HookModifierData *hmd, /* Generic data needed for applying per-vertex calculations (initialize all members) */ hd.vertexCos = vertexCos; - MOD_get_vgroup(ob, mesh, hmd->name, &hd.dvert, &hd.defgrp_index); + + MOD_get_vgroup(ob, mesh, hmd->name, &dvert, &hd.defgrp_index); + int cd_dvert_offset = -1; + + if ((em != NULL) && (hd.defgrp_index != -1)) { + cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT); + if (cd_dvert_offset == -1) { + hd.defgrp_index = -1; + } + } hd.curfalloff = hmd->curfalloff; @@ -337,32 +367,62 @@ static void deformVerts_do(HookModifierData *hmd, } else if (hmd->indexar) { /* vertex indices? */ const int *origindex_ar; - /* if mesh is present and has original index data, use it */ if (mesh && (origindex_ar = CustomData_get_layer(&mesh->vdata, CD_ORIGINDEX))) { - for (i = 0, index_pt = hmd->indexar; i < hmd->totindex; i++, index_pt++) { - if (*index_pt < numVerts) { - int j; - - for (j = 0; j < numVerts; j++) { - if (origindex_ar[j] == *index_pt) { - hook_co_apply(&hd, j); - } - } + int numVerts_orig = numVerts; + if (ob->type == OB_MESH) { + const Mesh *me_orig = ob->data; + numVerts_orig = me_orig->totvert; + } + BLI_bitmap *indexar_used = hook_index_array_to_bitmap(hmd, numVerts_orig); + for (i = 0; i < numVerts; i++) { + int i_orig = origindex_ar[i]; + BLI_assert(i_orig < numVerts_orig); + if (BLI_BITMAP_TEST(indexar_used, i_orig)) { + hook_co_apply(&hd, i, dvert ? &dvert[i] : NULL); } } + MEM_freeN(indexar_used); } else { /* missing mesh or ORIGINDEX */ - for (i = 0, index_pt = hmd->indexar; i < hmd->totindex; i++, index_pt++) { - if (*index_pt < numVerts) { - hook_co_apply(&hd, *index_pt); + if ((em != NULL) && (hd.defgrp_index != -1)) { + BLI_assert(em->bm->totvert == numVerts); + BLI_bitmap *indexar_used = hook_index_array_to_bitmap(hmd, numVerts); + BMIter iter; + BMVert *v; + BM_ITER_MESH_INDEX (v, &iter, em->bm, BM_VERTS_OF_MESH, i) { + if (BLI_BITMAP_TEST(indexar_used, i)) { + const MDeformVert *dv = BM_ELEM_CD_GET_VOID_P(v, cd_dvert_offset); + hook_co_apply(&hd, i, dv); + } + } + MEM_freeN(indexar_used); + } + else { + for (i = 0, index_pt = hmd->indexar; i < hmd->totindex; i++, index_pt++) { + const int j = *index_pt; + if (j < numVerts) { + hook_co_apply(&hd, j, dvert ? &dvert[j] : NULL); + } } } } } - else if (hd.dvert) { /* vertex group hook */ - for (i = 0; i < numVerts; i++) { - hook_co_apply(&hd, i); + else if (hd.defgrp_index != -1) { /* vertex group hook */ + if (em != NULL) { + BLI_assert(em->bm->totvert == numVerts); + BMIter iter; + BMVert *v; + BM_ITER_MESH_INDEX (v, &iter, em->bm, BM_VERTS_OF_MESH, i) { + const MDeformVert *dv = BM_ELEM_CD_GET_VOID_P(v, cd_dvert_offset); + hook_co_apply(&hd, i, dv); + } + } + else { + BLI_assert(dvert != NULL); + for (i = 0; i < numVerts; i++) { + hook_co_apply(&hd, i, &dvert[i]); + } } } } @@ -376,7 +436,7 @@ static void deformVerts(struct ModifierData *md, HookModifierData *hmd = (HookModifierData *)md; Mesh *mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false); - deformVerts_do(hmd, ctx, ctx->object, mesh_src, vertexCos, numVerts); + deformVerts_do(hmd, ctx, ctx->object, mesh_src, NULL, vertexCos, numVerts); if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); @@ -391,14 +451,8 @@ static void deformVertsEM(struct ModifierData *md, int numVerts) { HookModifierData *hmd = (HookModifierData *)md; - Mesh *mesh_src = MOD_deform_mesh_eval_get( - ctx->object, editData, mesh, NULL, numVerts, false, false); - - deformVerts_do(hmd, ctx, ctx->object, mesh_src, vertexCos, numVerts); - if (!ELEM(mesh_src, NULL, mesh)) { - BKE_id_free(NULL, mesh_src); - } + deformVerts_do(hmd, ctx, ctx->object, mesh, mesh ? NULL : editData, vertexCos, numVerts); } static void panel_draw(const bContext *C, Panel *panel) diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index b1a9258ec51..bf891c4938b 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -130,10 +130,15 @@ static void deformVerts(ModifierData *md, static void deformVertsEM(ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *em, - struct Mesh *UNUSED(mesh), + struct Mesh *mesh, float (*vertexCos)[3], int numVerts) { + if (mesh != NULL) { + deformVerts(md, ctx, mesh, vertexCos, numVerts); + return; + } + LatticeModifierData *lmd = (LatticeModifierData *)md; MOD_previous_vcos_store(md, vertexCos); /* if next modifier needs original vertices */ diff --git a/source/blender/modifiers/intern/MOD_meshcache_util.h b/source/blender/modifiers/intern/MOD_meshcache_util.h index 0a6c0e73632..74131099e3c 100644 --- a/source/blender/modifiers/intern/MOD_meshcache_util.h +++ b/source/blender/modifiers/intern/MOD_meshcache_util.h @@ -18,8 +18,7 @@ * \ingroup modifiers */ -#ifndef __MOD_MESHCACHE_UTIL_H__ -#define __MOD_MESHCACHE_UTIL_H__ +#pragma once /* MOD_meshcache_mdd.c */ bool MOD_meshcache_read_mdd_index(FILE *fp, @@ -73,5 +72,3 @@ void MOD_meshcache_calc_range(const float frame, float *r_factor); #define FRAME_SNAP_EPS 0.0001f - -#endif /* __MOD_MESHCACHE_UTIL_H__ */ diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c b/source/blender/modifiers/intern/MOD_normal_edit.c index 7039b24cfc6..ded7ec132cc 100644 --- a/source/blender/modifiers/intern/MOD_normal_edit.c +++ b/source/blender/modifiers/intern/MOD_normal_edit.c @@ -637,6 +637,8 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd, CustomData_free_layers(pdata, CD_NORMAL, num_polys); MEM_SAFE_FREE(loopnors); + result->runtime.is_original = false; + return result; } diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c index 8f0174fe6d9..228cd4cc4ae 100644 --- a/source/blender/modifiers/intern/MOD_skin.c +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -773,6 +773,11 @@ static EMat *build_edge_mats(const MVertSkin *vs, *has_valid_root = true; } + else if (totedge == 0) { + /* Vertex-only mesh is valid, mark valid root as well (will display error otherwise). */ + *has_valid_root = true; + break; + } } } diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index b03b949c946..deece2b999b 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -147,7 +147,7 @@ static void smoothModifier_do( MDeformVert *dv = dvert; for (int i = 0; i < numVerts; i++, dv++) { float *vco_orig = vertexCos[i]; - if (num_accumulated_vecs[0] > 0) { + if (num_accumulated_vecs[i] > 0) { mul_v3_fl(accumulated_vecs[i], 1.0f / (float)num_accumulated_vecs[i]); } float *vco_new = accumulated_vecs[i]; @@ -174,7 +174,7 @@ static void smoothModifier_do( else { /* no vertex group */ for (int i = 0; i < numVerts; i++) { float *vco_orig = vertexCos[i]; - if (num_accumulated_vecs[0] > 0) { + if (num_accumulated_vecs[i] > 0) { mul_v3_fl(accumulated_vecs[i], 1.0f / (float)num_accumulated_vecs[i]); } float *vco_new = accumulated_vecs[i]; diff --git a/source/blender/modifiers/intern/MOD_solidify_util.h b/source/blender/modifiers/intern/MOD_solidify_util.h index 6ab4734c451..e9f0709f7ea 100644 --- a/source/blender/modifiers/intern/MOD_solidify_util.h +++ b/source/blender/modifiers/intern/MOD_solidify_util.h @@ -18,8 +18,7 @@ * \ingroup modifiers */ -#ifndef __MOD_SOLIDIFY_UTIL_H__ -#define __MOD_SOLIDIFY_UTIL_H__ +#pragma once /* MOD_solidify_extrude.c */ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, @@ -30,5 +29,3 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh); - -#endif /* __MOD_SOLIDIFY_UTIL_H__ */ diff --git a/source/blender/modifiers/intern/MOD_ui_common.h b/source/blender/modifiers/intern/MOD_ui_common.h index 59c0fe1c413..cac8806a2bf 100644 --- a/source/blender/modifiers/intern/MOD_ui_common.h +++ b/source/blender/modifiers/intern/MOD_ui_common.h @@ -18,8 +18,7 @@ * \ingroup modifiers */ -#ifndef __MOD_UI_COMMON_H__ -#define __MOD_UI_COMMON_H__ +#pragma once /* so modifier types match their defines */ #include "MOD_modifiertypes.h" @@ -66,5 +65,3 @@ struct PanelType *modifier_subpanel_register(struct ARegionType *region_type, #ifdef __cplusplus } #endif - -#endif /* __MOD_UI_COMMON_H__ */ diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h index a05e25d204c..05a24b92242 100644 --- a/source/blender/modifiers/intern/MOD_util.h +++ b/source/blender/modifiers/intern/MOD_util.h @@ -18,8 +18,7 @@ * \ingroup modifiers */ -#ifndef __MOD_UTIL_H__ -#define __MOD_UTIL_H__ +#pragma once /* so modifier types match their defines */ #include "MOD_modifiertypes.h" @@ -60,4 +59,3 @@ void MOD_depsgraph_update_object_bone_relation(struct DepsNodeHandle *node, struct Object *object, const char *bonename, const char *description); -#endif /* __MOD_UTIL_H__ */ diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 6f261f9f67a..361c778bb95 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -308,6 +308,8 @@ static Mesh *uvprojectModifier_do(UVProjectModifierData *umd, } } + mesh->runtime.is_original = false; + /* Mark tessellated CD layers as dirty. */ mesh->runtime.cd_dirty_vert |= CD_MASK_TESSLOOPNORMAL; diff --git a/source/blender/modifiers/intern/MOD_uvwarp.c b/source/blender/modifiers/intern/MOD_uvwarp.c index 4aca3c28ed8..1c7c3f6baf1 100644 --- a/source/blender/modifiers/intern/MOD_uvwarp.c +++ b/source/blender/modifiers/intern/MOD_uvwarp.c @@ -233,6 +233,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * /* XXX TODO is this still needed? */ // me_eval->dirty |= DM_DIRTY_TESS_CDLAYERS; + mesh->runtime.is_original = false; + return mesh; } diff --git a/source/blender/modifiers/intern/MOD_weighted_normal.c b/source/blender/modifiers/intern/MOD_weighted_normal.c index f174b6d5aa4..744bab02c56 100644 --- a/source/blender/modifiers/intern/MOD_weighted_normal.c +++ b/source/blender/modifiers/intern/MOD_weighted_normal.c @@ -677,6 +677,9 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * /* Currently Modifier stack assumes there is no poly normal data passed around... */ CustomData_free_layers(pdata, CD_NORMAL, numPolys); + + result->runtime.is_original = false; + return result; } diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.h b/source/blender/modifiers/intern/MOD_weightvg_util.h index 725574dc0a5..c00acd27d38 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.h +++ b/source/blender/modifiers/intern/MOD_weightvg_util.h @@ -21,8 +21,7 @@ * \ingroup modifiers */ -#ifndef __MOD_WEIGHTVG_UTIL_H__ -#define __MOD_WEIGHTVG_UTIL_H__ +#pragma once struct CurveMapping; struct MDeformVert; @@ -92,4 +91,3 @@ void weightvg_update_vg(struct MDeformVert *dvert, const bool do_normalize); void weightvg_ui_common(const bContext *C, PointerRNA *ob_ptr, PointerRNA *ptr, uiLayout *layout); -#endif /* __MOD_WEIGHTVG_UTIL_H__ */ diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c index 8039856172a..e15320afc28 100644 --- a/source/blender/modifiers/intern/MOD_weightvgedit.c +++ b/source/blender/modifiers/intern/MOD_weightvgedit.c @@ -312,6 +312,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * MEM_freeN(new_w); MEM_freeN(dw); + mesh->runtime.is_original = false; + /* Return the vgroup-modified mesh. */ return mesh; } diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index d1c618df68b..cdd0e2c00de 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -456,6 +456,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * MEM_freeN(dw2); MEM_SAFE_FREE(indices); + mesh->runtime.is_original = false; + /* Return the vgroup-modified mesh. */ return mesh; } diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 0668a7a086f..b23eb997f61 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -637,6 +637,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * TIMEIT_END(perf); #endif + mesh->runtime.is_original = false; + /* Return the vgroup-modified mesh. */ return mesh; } diff --git a/source/blender/nodes/NOD_common.h b/source/blender/nodes/NOD_common.h index dcc4f4d0b76..50ed992dcb6 100644 --- a/source/blender/nodes/NOD_common.h +++ b/source/blender/nodes/NOD_common.h @@ -21,8 +21,7 @@ * \ingroup nodes */ -#ifndef __NOD_COMMON_H__ -#define __NOD_COMMON_H__ +#pragma once #include "BKE_node.h" @@ -49,5 +48,3 @@ void node_group_output_update(struct bNodeTree *ntree, struct bNode *node); #ifdef __cplusplus } #endif - -#endif /* __NOD_COMMON_H__ */ diff --git a/source/blender/nodes/NOD_composite.h b/source/blender/nodes/NOD_composite.h index 6b1dd239294..99bcb849ebd 100644 --- a/source/blender/nodes/NOD_composite.h +++ b/source/blender/nodes/NOD_composite.h @@ -21,8 +21,7 @@ * \ingroup nodes */ -#ifndef __NOD_COMPOSITE_H__ -#define __NOD_COMPOSITE_H__ +#pragma once #include "BKE_node.h" @@ -150,5 +149,3 @@ void register_node_type_cmp_custom_group(bNodeType *ntype); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/nodes/NOD_derived_node_tree.hh b/source/blender/nodes/NOD_derived_node_tree.hh index d79bd9031b8..205ba68dd0a 100644 --- a/source/blender/nodes/NOD_derived_node_tree.hh +++ b/source/blender/nodes/NOD_derived_node_tree.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __NOD_DERIVED_NODE_TREE_HH__ -#define __NOD_DERIVED_NODE_TREE_HH__ +#pragma once /** \file * \ingroup nodes @@ -513,5 +512,3 @@ inline Span<const DGroupInput *> DerivedNodeTree::group_inputs() const } } // namespace blender::nodes - -#endif /* __NOD_DERIVED_NODE_TREE_HH__ */ diff --git a/source/blender/nodes/NOD_function.h b/source/blender/nodes/NOD_function.h index 4c05da694f7..5391951debb 100644 --- a/source/blender/nodes/NOD_function.h +++ b/source/blender/nodes/NOD_function.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __NOD_FUNCTION_H__ -#define __NOD_FUNCTION_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -31,5 +30,3 @@ void register_node_type_fn_object_transforms(void); #ifdef __cplusplus } #endif - -#endif /* __NOD_FUNCTION_H__ */ diff --git a/source/blender/nodes/NOD_node_tree_multi_function.hh b/source/blender/nodes/NOD_node_tree_multi_function.hh index 81b467eca3a..f5cb827dc4f 100644 --- a/source/blender/nodes/NOD_node_tree_multi_function.hh +++ b/source/blender/nodes/NOD_node_tree_multi_function.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __NOD_NODE_TREE_FUNCTION_HH__ -#define __NOD_NODE_TREE_FUNCTION_HH__ +#pragma once /** \file * \ingroup nodes @@ -389,5 +388,3 @@ MFNetworkTreeMap insert_node_tree_into_mf_network(fn::MFNetwork &network, ResourceCollector &resources); } // namespace blender::nodes - -#endif /* __NOD_NODE_TREE_FUNCTION_HH__ */ diff --git a/source/blender/nodes/NOD_node_tree_ref.hh b/source/blender/nodes/NOD_node_tree_ref.hh index ebf5709ef50..f18a20d6df9 100644 --- a/source/blender/nodes/NOD_node_tree_ref.hh +++ b/source/blender/nodes/NOD_node_tree_ref.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __NOD_NODE_TREE_REF_HH__ -#define __NOD_NODE_TREE_REF_HH__ +#pragma once /** \file * \ingroup nodes @@ -441,5 +440,3 @@ inline bNodeTree *NodeTreeRef::btree() const } } // namespace blender::nodes - -#endif /* __NOD_NODE_TREE_REF_HH__ */ diff --git a/source/blender/nodes/NOD_shader.h b/source/blender/nodes/NOD_shader.h index bf548aea5f4..2911e0fbea6 100644 --- a/source/blender/nodes/NOD_shader.h +++ b/source/blender/nodes/NOD_shader.h @@ -21,8 +21,7 @@ * \ingroup nodes */ -#ifndef __NOD_SHADER_H__ -#define __NOD_SHADER_H__ +#pragma once #include "BKE_node.h" @@ -146,5 +145,3 @@ void register_node_type_sh_custom_group(bNodeType *ntype); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/nodes/NOD_simulation.h b/source/blender/nodes/NOD_simulation.h index 2947d38fe83..d769bbce204 100644 --- a/source/blender/nodes/NOD_simulation.h +++ b/source/blender/nodes/NOD_simulation.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __NOD_SIMULATION_H__ -#define __NOD_SIMULATION_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -43,5 +42,3 @@ void register_node_type_sim_particle_attribute(void); #ifdef __cplusplus } #endif - -#endif /* __NOD_SIMULATION_H__ */ diff --git a/source/blender/nodes/NOD_socket.h b/source/blender/nodes/NOD_socket.h index ce6f0da4aee..3344a25bdea 100644 --- a/source/blender/nodes/NOD_socket.h +++ b/source/blender/nodes/NOD_socket.h @@ -21,8 +21,7 @@ * \ingroup nodes */ -#ifndef __NOD_SOCKET_H__ -#define __NOD_SOCKET_H__ +#pragma once #include "DNA_listBase.h" @@ -48,10 +47,13 @@ void node_verify_socket_templates(struct bNodeTree *ntree, struct bNode *node); void node_socket_init_default_value(struct bNodeSocket *sock); void node_socket_copy_default_value(struct bNodeSocket *to, const struct bNodeSocket *from); +void node_socket_skip_reroutes(struct ListBase *links, + struct bNode *node, + struct bNodeSocket *socket, + struct bNode **r_node, + struct bNodeSocket **r_socket); void register_standard_node_socket_types(void); #ifdef __cplusplus } #endif - -#endif /* __NOD_SOCKET_H__ */ diff --git a/source/blender/nodes/NOD_texture.h b/source/blender/nodes/NOD_texture.h index 07a05f01bc5..af59fefd925 100644 --- a/source/blender/nodes/NOD_texture.h +++ b/source/blender/nodes/NOD_texture.h @@ -21,8 +21,7 @@ * \ingroup nodes */ -#ifndef __NOD_TEXTURE_H__ -#define __NOD_TEXTURE_H__ +#pragma once #include "BKE_node.h" @@ -78,5 +77,3 @@ void register_node_type_tex_proc_distnoise(void); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/nodes/composite/node_composite_util.h b/source/blender/nodes/composite/node_composite_util.h index 0edc864e98f..8810b760e8c 100644 --- a/source/blender/nodes/composite/node_composite_util.h +++ b/source/blender/nodes/composite/node_composite_util.h @@ -21,8 +21,7 @@ * \ingroup nodes */ -#ifndef __NODE_COMPOSITE_UTIL_H__ -#define __NODE_COMPOSITE_UTIL_H__ +#pragma once #include "DNA_ID.h" #include "DNA_movieclip_types.h" @@ -63,5 +62,3 @@ void cmp_node_type_base( #ifdef __cplusplus } #endif - -#endif /* __NODE_COMPOSITE_UTIL_H__ */ diff --git a/source/blender/nodes/function/node_function_util.hh b/source/blender/nodes/function/node_function_util.hh index 8e09ab0f24f..d57d1383019 100644 --- a/source/blender/nodes/function/node_function_util.hh +++ b/source/blender/nodes/function/node_function_util.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __NODE_FUNCTION_UTIL_H__ -#define __NODE_FUNCTION_UTIL_H__ +#pragma once #include <string.h> @@ -40,5 +39,3 @@ void fn_node_type_base( struct bNodeType *ntype, int type, const char *name, short nclass, short flag); bool fn_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree); - -#endif /* __NODE_FUNCTION_UTIL_H__ */ diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 996fb93eb76..439e41b963b 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -132,6 +132,9 @@ static bNodeSocket *group_verify_socket( if (sock) { strcpy(sock->name, iosock->name); + const int mask = SOCK_HIDE_VALUE; + sock->flag = (sock->flag & ~mask) | (iosock->flag & mask); + if (iosock->typeinfo->interface_verify_socket) { iosock->typeinfo->interface_verify_socket(ntree, iosock, gnode, sock, "interface"); } diff --git a/source/blender/nodes/intern/node_common.h b/source/blender/nodes/intern/node_common.h index 7810e9f1f14..7aad6782640 100644 --- a/source/blender/nodes/intern/node_common.h +++ b/source/blender/nodes/intern/node_common.h @@ -21,8 +21,7 @@ * \ingroup nodes */ -#ifndef __NODE_COMMON_H__ -#define __NODE_COMMON_H__ +#pragma once #include "DNA_listBase.h" @@ -40,5 +39,3 @@ void ntree_update_reroute_nodes(struct bNodeTree *ntree); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/nodes/intern/node_exec.h b/source/blender/nodes/intern/node_exec.h index 87a61f0a490..806dd10d9bf 100644 --- a/source/blender/nodes/intern/node_exec.h +++ b/source/blender/nodes/intern/node_exec.h @@ -21,8 +21,7 @@ * \ingroup nodes */ -#ifndef __NODE_EXEC_H__ -#define __NODE_EXEC_H__ +#pragma once #include "DNA_listBase.h" @@ -105,5 +104,3 @@ void ntreeTexEndExecTree_internal(struct bNodeTreeExec *exec); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/nodes/intern/node_socket.cc b/source/blender/nodes/intern/node_socket.cc index 49868505d68..04d86f5b44e 100644 --- a/source/blender/nodes/intern/node_socket.cc +++ b/source/blender/nodes/intern/node_socket.cc @@ -356,6 +356,54 @@ void node_socket_copy_default_value(bNodeSocket *to, const bNodeSocket *from) to->flag |= (from->flag & SOCK_HIDE_VALUE); } +void node_socket_skip_reroutes( + ListBase *links, bNode *node, bNodeSocket *socket, bNode **r_node, bNodeSocket **r_socket) +{ + const int loop_limit = 100; /* Limit in case there is a connection cycle. */ + + if (socket->in_out == SOCK_IN) { + bNodeLink *first_link = (bNodeLink *)links->first; + + for (int i = 0; node->type == NODE_REROUTE && i < loop_limit; i++) { + bNodeLink *link = first_link; + + for (; link; link = link->next) { + if (link->fromnode == node && link->tonode != node) { + break; + } + } + + if (link) { + node = link->tonode; + socket = link->tosock; + } + else { + break; + } + } + } + else { + for (int i = 0; node->type == NODE_REROUTE && i < loop_limit; i++) { + bNodeSocket *input = (bNodeSocket *)node->inputs.first; + + if (input && input->link) { + node = input->link->fromnode; + socket = input->link->fromsock; + } + else { + break; + } + } + } + + if (r_node) { + *r_node = node; + } + if (r_socket) { + *r_socket = socket; + } +} + static void standard_node_socket_interface_init_socket(bNodeTree *UNUSED(ntree), bNodeSocket *stemp, bNode *UNUSED(node), diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h index 61f8fe6809d..1b542a9420a 100644 --- a/source/blender/nodes/intern/node_util.h +++ b/source/blender/nodes/intern/node_util.h @@ -21,8 +21,7 @@ * \ingroup nodes */ -#ifndef __NODE_UTIL_H__ -#define __NODE_UTIL_H__ +#pragma once #include "DNA_listBase.h" @@ -110,5 +109,3 @@ void node_socket_set_vector(struct bNodeTree *ntree, #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index 179a92ec7bd..758f7edfe49 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -344,15 +344,23 @@ static void ntree_shader_unlink_hidden_value_sockets(bNode *group_node, bNodeSoc bool removed_link = false; for (node = group_ntree->nodes.first; node; node = node->next) { + const bool is_group = ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && (node->id != NULL); + LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) { - if ((sock->flag & SOCK_HIDE_VALUE) == 0) { + if (!is_group && (sock->flag & SOCK_HIDE_VALUE) == 0) { continue; } /* If socket is linked to a group input node and sockets id match. */ if (sock && sock->link && sock->link->fromnode->type == NODE_GROUP_INPUT) { if (STREQ(isock->identifier, sock->link->fromsock->identifier)) { - nodeRemLink(group_ntree, sock->link); - removed_link = true; + if (is_group) { + /* Recursively unlink sockets within the nested group. */ + ntree_shader_unlink_hidden_value_sockets(node, sock); + } + else { + nodeRemLink(group_ntree, sock->link); + removed_link = true; + } } } } diff --git a/source/blender/nodes/shader/node_shader_util.h b/source/blender/nodes/shader/node_shader_util.h index b0ba1ea194f..de192f51a5f 100644 --- a/source/blender/nodes/shader/node_shader_util.h +++ b/source/blender/nodes/shader/node_shader_util.h @@ -21,8 +21,7 @@ * \ingroup nodes */ -#ifndef __NODE_SHADER_UTIL_H__ -#define __NODE_SHADER_UTIL_H__ +#pragma once #include <float.h> #include <math.h> @@ -116,5 +115,3 @@ void ntreeExecGPUNodes(struct bNodeTreeExec *exec, #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/nodes/simulation/node_simulation_util.h b/source/blender/nodes/simulation/node_simulation_util.h index adbe2ad5e8f..76a10715cff 100644 --- a/source/blender/nodes/simulation/node_simulation_util.h +++ b/source/blender/nodes/simulation/node_simulation_util.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __NODE_SIM_UTIL_H__ -#define __NODE_SIM_UTIL_H__ +#pragma once #include <string.h> @@ -36,5 +35,3 @@ void sim_node_type_base( struct bNodeType *ntype, int type, const char *name, short nclass, short flag); bool sim_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree); - -#endif /* __NODE_SIM_UTIL_H__ */ diff --git a/source/blender/nodes/texture/node_texture_util.h b/source/blender/nodes/texture/node_texture_util.h index 7b8581c1f89..17a88ddaf5b 100644 --- a/source/blender/nodes/texture/node_texture_util.h +++ b/source/blender/nodes/texture/node_texture_util.h @@ -21,8 +21,7 @@ * \ingroup nodes */ -#ifndef __NODE_TEXTURE_UTIL_H__ -#define __NODE_TEXTURE_UTIL_H__ +#pragma once #include <math.h> #include <string.h> @@ -131,5 +130,3 @@ void params_from_cdata(TexParams *out, TexCallData *in); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index 5c6e0b0a308..da9b5d642ef 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -18,8 +18,7 @@ * \ingroup python */ -#ifndef __BPY_EXTERN_H__ -#define __BPY_EXTERN_H__ +#pragma once struct AnimationEvalContext; struct ChannelDriver; /* DNA_anim_types.h */ @@ -55,6 +54,7 @@ void BPY_python_start(int argc, const char **argv); void BPY_python_end(void); void BPY_python_reset(struct bContext *C); void BPY_python_use_system_env(void); +void BPY_python_backtrace(/* FILE */ void *file); /* global interpreter lock */ @@ -140,5 +140,3 @@ const char *BPY_app_translations_py_pgettext(const char *msgctxt, const char *ms #ifdef __cplusplus } /* extern "C" */ #endif - -#endif /* __BPY_EXTERN_H__ */ diff --git a/source/blender/python/BPY_extern_clog.h b/source/blender/python/BPY_extern_clog.h index d610dc1c7ba..14b57b4cc5c 100644 --- a/source/blender/python/BPY_extern_clog.h +++ b/source/blender/python/BPY_extern_clog.h @@ -20,11 +20,8 @@ * Logging defines. */ -#ifndef __BPY_EXTERN_CLOG_H__ -#define __BPY_EXTERN_CLOG_H__ +#pragma once /* bpy_interface.c */ extern struct CLG_LogRef *BPY_LOG_RNA; extern struct CLG_LogRef *BPY_LOG_CONTEXT; - -#endif /* __BPY_EXTERN_CLOG_H__ */ diff --git a/source/blender/python/bmesh/bmesh_py_api.h b/source/blender/python/bmesh/bmesh_py_api.h index 9f227b21440..357f416f266 100644 --- a/source/blender/python/bmesh/bmesh_py_api.h +++ b/source/blender/python/bmesh/bmesh_py_api.h @@ -21,9 +21,6 @@ * \ingroup pybmesh */ -#ifndef __BMESH_PY_API_H__ -#define __BMESH_PY_API_H__ +#pragma once PyObject *BPyInit_bmesh(void); - -#endif /* __BMESH_PY_API_H__ */ diff --git a/source/blender/python/bmesh/bmesh_py_geometry.h b/source/blender/python/bmesh/bmesh_py_geometry.h index 98d336828dc..dcb8c59f68b 100644 --- a/source/blender/python/bmesh/bmesh_py_geometry.h +++ b/source/blender/python/bmesh/bmesh_py_geometry.h @@ -21,9 +21,6 @@ * \ingroup pybmesh */ -#ifndef __BMESH_PY_GEOMETRY_H__ -#define __BMESH_PY_GEOMETRY_H__ +#pragma once PyObject *BPyInit_bmesh_geometry(void); - -#endif /* __BMESH_PY_GEOMETRY_H__ */ diff --git a/source/blender/python/bmesh/bmesh_py_ops.h b/source/blender/python/bmesh/bmesh_py_ops.h index a4a12bbef61..442af51fd17 100644 --- a/source/blender/python/bmesh/bmesh_py_ops.h +++ b/source/blender/python/bmesh/bmesh_py_ops.h @@ -21,9 +21,6 @@ * \ingroup pybmesh */ -#ifndef __BMESH_PY_OPS_H__ -#define __BMESH_PY_OPS_H__ +#pragma once PyObject *BPyInit_bmesh_ops(void); - -#endif /* __BMESH_PY_OPS_H__ */ diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.h b/source/blender/python/bmesh/bmesh_py_ops_call.h index 7b6611cd61d..6d9ceec73f6 100644 --- a/source/blender/python/bmesh/bmesh_py_ops_call.h +++ b/source/blender/python/bmesh/bmesh_py_ops_call.h @@ -21,8 +21,7 @@ * \ingroup pybmesh */ -#ifndef __BMESH_PY_OPS_CALL_H__ -#define __BMESH_PY_OPS_CALL_H__ +#pragma once typedef struct { PyObject_HEAD /* required python macro */ @@ -30,5 +29,3 @@ typedef struct { } BPy_BMeshOpFunc; PyObject *BPy_BMO_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw); - -#endif /* __BMESH_PY_OPS_CALL_H__ */ diff --git a/source/blender/python/bmesh/bmesh_py_types.h b/source/blender/python/bmesh/bmesh_py_types.h index 74bfbcec3c7..7ac3c4bf3cc 100644 --- a/source/blender/python/bmesh/bmesh_py_types.h +++ b/source/blender/python/bmesh/bmesh_py_types.h @@ -21,8 +21,7 @@ * \ingroup pybmesh */ -#ifndef __BMESH_PY_TYPES_H__ -#define __BMESH_PY_TYPES_H__ +#pragma once extern PyTypeObject BPy_BMesh_Type; extern PyTypeObject BPy_BMVert_Type; @@ -228,5 +227,3 @@ extern struct PyC_FlagSet bpy_bm_htype_vert_edge_face_flags[]; extern struct PyC_FlagSet bpy_bm_htype_all_flags[]; extern struct PyC_FlagSet bpy_bm_hflag_all_flags[]; #endif - -#endif /* __BMESH_PY_TYPES_H__ */ diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.h b/source/blender/python/bmesh/bmesh_py_types_customdata.h index 95836707e3d..3173813a912 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.h +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.h @@ -21,8 +21,7 @@ * \ingroup pybmesh */ -#ifndef __BMESH_PY_TYPES_CUSTOMDATA_H__ -#define __BMESH_PY_TYPES_CUSTOMDATA_H__ +#pragma once /* all use BPy_BMLayerAccess struct */ extern PyTypeObject BPy_BMLayerAccessVert_Type; @@ -67,5 +66,3 @@ void BPy_BM_init_types_customdata(void); /* __getitem__ / __setitem__ */ PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer); int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObject *value); - -#endif /* __BMESH_PY_TYPES_CUSTOMDATA_H__ */ diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.h b/source/blender/python/bmesh/bmesh_py_types_meshdata.h index 5211c30ec7e..58f31a9807e 100644 --- a/source/blender/python/bmesh/bmesh_py_types_meshdata.h +++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.h @@ -21,8 +21,7 @@ * \ingroup pybmesh */ -#ifndef __BMESH_PY_TYPES_MESHDATA_H__ -#define __BMESH_PY_TYPES_MESHDATA_H__ +#pragma once extern PyTypeObject BPy_BMLoopUV_Type; extern PyTypeObject BPy_BMDeformVert_Type; @@ -51,5 +50,3 @@ int BPy_BMDeformVert_AssignPyObject(struct MDeformVert *dvert, PyObject *value); PyObject *BPy_BMDeformVert_CreatePyObject(struct MDeformVert *dvert); void BPy_BM_init_types_meshdata(void); - -#endif /* __BMESH_PY_TYPES_MESHDATA_H__ */ diff --git a/source/blender/python/bmesh/bmesh_py_types_select.h b/source/blender/python/bmesh/bmesh_py_types_select.h index 593857a5083..c33aa3675c5 100644 --- a/source/blender/python/bmesh/bmesh_py_types_select.h +++ b/source/blender/python/bmesh/bmesh_py_types_select.h @@ -21,8 +21,7 @@ * \ingroup pybmesh */ -#ifndef __BMESH_PY_TYPES_SELECT_H__ -#define __BMESH_PY_TYPES_SELECT_H__ +#pragma once struct BPy_BMesh; @@ -46,5 +45,3 @@ void BPy_BM_init_types_select(void); PyObject *BPy_BMEditSel_CreatePyObject(BMesh *bm); PyObject *BPy_BMEditSelIter_CreatePyObject(BMesh *bm); int BPy_BMEditSel_Assign(struct BPy_BMesh *self, PyObject *value); - -#endif /* __BMESH_PY_SELECT_H__ */ diff --git a/source/blender/python/bmesh/bmesh_py_utils.h b/source/blender/python/bmesh/bmesh_py_utils.h index a6f4f22bf8b..27eccca4535 100644 --- a/source/blender/python/bmesh/bmesh_py_utils.h +++ b/source/blender/python/bmesh/bmesh_py_utils.h @@ -21,9 +21,6 @@ * \ingroup pybmesh */ -#ifndef __BMESH_PY_UTILS_H__ -#define __BMESH_PY_UTILS_H__ +#pragma once PyObject *BPyInit_bmesh_utils(void); - -#endif /* __BMESH_PY_UTILS_H__ */ diff --git a/source/blender/python/generic/bgl.h b/source/blender/python/generic/bgl.h index 8c81dc48340..ee8c293945a 100644 --- a/source/blender/python/generic/bgl.h +++ b/source/blender/python/generic/bgl.h @@ -18,8 +18,7 @@ * \ingroup pygen */ -#ifndef __BGL_H__ -#define __BGL_H__ +#pragma once PyObject *BPyInit_bgl(void); @@ -52,5 +51,3 @@ typedef struct _Buffer { /** The type object */ extern PyTypeObject BGL_bufferType; - -#endif /* __BGL_H__ */ diff --git a/source/blender/python/generic/bl_math_py_api.h b/source/blender/python/generic/bl_math_py_api.h index 9183573abfc..484304948f3 100644 --- a/source/blender/python/generic/bl_math_py_api.h +++ b/source/blender/python/generic/bl_math_py_api.h @@ -19,9 +19,6 @@ * \ingroup pygen */ -#ifndef __BL_MATH_PY_API_H__ -#define __BL_MATH_PY_API_H__ +#pragma once PyMODINIT_FUNC BPyInit_bl_math(void); - -#endif /* __BL_MATH_PY_API_H__ */ diff --git a/source/blender/python/generic/blf_py_api.h b/source/blender/python/generic/blf_py_api.h index 919272df942..c47edd1eaab 100644 --- a/source/blender/python/generic/blf_py_api.h +++ b/source/blender/python/generic/blf_py_api.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BLF_PY_API_H__ -#define __BLF_PY_API_H__ +#pragma once /** \file * \ingroup pygen @@ -24,5 +23,3 @@ #include <Python.h> PyObject *BPyInit_blf(void); - -#endif /* __BLF_PY_API_H__ */ diff --git a/source/blender/python/generic/idprop_py_api.h b/source/blender/python/generic/idprop_py_api.h index 49094f95ecb..478dc99f73d 100644 --- a/source/blender/python/generic/idprop_py_api.h +++ b/source/blender/python/generic/idprop_py_api.h @@ -18,8 +18,7 @@ * \ingroup pygen */ -#ifndef __IDPROP_PY_API_H__ -#define __IDPROP_PY_API_H__ +#pragma once struct BPy_IDGroup_Iter; struct ID; @@ -68,5 +67,3 @@ PyObject *BPyInit_idprop(void); #define IDPROP_ITER_KEYS 0 #define IDPROP_ITER_ITEMS 1 - -#endif /* __IDPROP_PY_API_H__ */ diff --git a/source/blender/python/generic/imbuf_py_api.h b/source/blender/python/generic/imbuf_py_api.h index 2dea925a9f2..897423415b3 100644 --- a/source/blender/python/generic/imbuf_py_api.h +++ b/source/blender/python/generic/imbuf_py_api.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __IMBUF_PY_API_H__ -#define __IMBUF_PY_API_H__ +#pragma once /** \file * \ingroup pygen @@ -24,5 +23,3 @@ PyObject *BPyInit_imbuf(void); extern PyTypeObject Py_ImBuf_Type; - -#endif /* __IMBUF_PY_API_H__ */ diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 9c84a4bb824..37ed96bcaa0 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -360,6 +360,20 @@ void PyC_StackSpit(void) } } +void PyC_StackPrint(/* FILE */ void *fp) +{ + PyThreadState *tstate = PyGILState_GetThisThreadState(); + if (tstate != NULL && tstate->frame != NULL) { + PyFrameObject *frame = tstate->frame; + do { + const int line = PyCode_Addr2Line(frame->f_code, frame->f_lasti); + const char *filename = _PyUnicode_AsString(frame->f_code->co_filename); + const char *funcname = _PyUnicode_AsString(frame->f_code->co_name); + fprintf(fp, " File \"%s\", line %d in %s\n", filename, line, funcname); + } while ((frame = frame->f_back)); + } +} + void PyC_FileAndNum(const char **r_filename, int *r_lineno) { PyFrameObject *frame; diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h index e8b2e8ff502..dde450012d0 100644 --- a/source/blender/python/generic/py_capi_utils.h +++ b/source/blender/python/generic/py_capi_utils.h @@ -28,6 +28,7 @@ void PyC_ObSpit(const char *name, PyObject *var); void PyC_ObSpitStr(char *result, size_t result_len, PyObject *var); void PyC_LineSpit(void); void PyC_StackSpit(void); +void PyC_StackPrint(/* FILE */ void *fp); PyObject *PyC_ExceptionBuffer(void); PyObject *PyC_ExceptionBuffer_Simple(void); PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...); diff --git a/source/blender/python/generic/python_utildefines.h b/source/blender/python/generic/python_utildefines.h index 653122c9c33..1f093e633e4 100644 --- a/source/blender/python/generic/python_utildefines.h +++ b/source/blender/python/generic/python_utildefines.h @@ -20,8 +20,7 @@ * \note light addition to Python.h, use py_capi_utils.h for larger features. */ -#ifndef __PYTHON_UTILDEFINES_H__ -#define __PYTHON_UTILDEFINES_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -57,5 +56,3 @@ Py_LOCAL_INLINE(int) PyList_APPEND(PyObject *op, PyObject *v) #ifdef __cplusplus } #endif - -#endif /* __PYTHON_UTILDEFINES_H__ */ diff --git a/source/blender/python/gpu/gpu_py_api.h b/source/blender/python/gpu/gpu_py_api.h index e278bb63a49..2360bba1f5d 100644 --- a/source/blender/python/gpu/gpu_py_api.h +++ b/source/blender/python/gpu/gpu_py_api.h @@ -18,8 +18,7 @@ * \ingroup bpygpu */ -#ifndef __GPU_PY_API_H__ -#define __GPU_PY_API_H__ +#pragma once int bpygpu_ParsePrimType(PyObject *o, void *p); @@ -36,5 +35,3 @@ bool bpygpu_is_initialized_or_error(void); return -1; \ } \ ((void)0) - -#endif /* __GPU_PY_API_H__ */ diff --git a/source/blender/python/gpu/gpu_py_batch.h b/source/blender/python/gpu/gpu_py_batch.h index 1e916afcc2e..7c882eab8fc 100644 --- a/source/blender/python/gpu/gpu_py_batch.h +++ b/source/blender/python/gpu/gpu_py_batch.h @@ -18,8 +18,7 @@ * \ingroup bpygpu */ -#ifndef __GPU_PY_BATCH_H__ -#define __GPU_PY_BATCH_H__ +#pragma once #include "BLI_compiler_attrs.h" @@ -40,5 +39,3 @@ typedef struct BPyGPUBatch { } BPyGPUBatch; PyObject *BPyGPUBatch_CreatePyObject(struct GPUBatch *batch) ATTR_NONNULL(1); - -#endif /* __GPU_PY_BATCH_H__ */ diff --git a/source/blender/python/gpu/gpu_py_element.h b/source/blender/python/gpu/gpu_py_element.h index 055c9d54ecf..a8e22aae15a 100644 --- a/source/blender/python/gpu/gpu_py_element.h +++ b/source/blender/python/gpu/gpu_py_element.h @@ -18,8 +18,7 @@ * \ingroup bpygpu */ -#ifndef __GPU_PY_ELEMENT_H__ -#define __GPU_PY_ELEMENT_H__ +#pragma once extern PyTypeObject BPyGPUIndexBuf_Type; @@ -30,5 +29,3 @@ typedef struct BPyGPUIndexBuf { } BPyGPUIndexBuf; PyObject *BPyGPUIndexBuf_CreatePyObject(struct GPUIndexBuf *elem); - -#endif /* __GPU_PY_ELEMENT_H__ */ diff --git a/source/blender/python/gpu/gpu_py_matrix.h b/source/blender/python/gpu/gpu_py_matrix.h index cf187dee002..38a7f398b30 100644 --- a/source/blender/python/gpu/gpu_py_matrix.h +++ b/source/blender/python/gpu/gpu_py_matrix.h @@ -18,9 +18,6 @@ * \ingroup bpygpu */ -#ifndef __GPU_PY_MATRIX_H__ -#define __GPU_PY_MATRIX_H__ +#pragma once PyObject *BPyInit_gpu_matrix(void); - -#endif /* __GPU_PY_MATRIX_H__ */ diff --git a/source/blender/python/gpu/gpu_py_offscreen.h b/source/blender/python/gpu/gpu_py_offscreen.h index 61d7bd82abc..efe5b57b22e 100644 --- a/source/blender/python/gpu/gpu_py_offscreen.h +++ b/source/blender/python/gpu/gpu_py_offscreen.h @@ -18,8 +18,7 @@ * \ingroup bpygpu */ -#ifndef __GPU_PY_OFFSCREEN_H__ -#define __GPU_PY_OFFSCREEN_H__ +#pragma once #include "BLI_compiler_attrs.h" @@ -33,5 +32,3 @@ typedef struct BPyGPUOffScreen { } BPyGPUOffScreen; PyObject *BPyGPUOffScreen_CreatePyObject(struct GPUOffScreen *ofs) ATTR_NONNULL(1); - -#endif /* __GPU_PY_OFFSCREEN_H__ */ diff --git a/source/blender/python/gpu/gpu_py_select.h b/source/blender/python/gpu/gpu_py_select.h index 814b6028da1..857cd7bb7f8 100644 --- a/source/blender/python/gpu/gpu_py_select.h +++ b/source/blender/python/gpu/gpu_py_select.h @@ -18,9 +18,6 @@ * \ingroup bpygpu */ -#ifndef __GPU_PY_SELECT_H__ -#define __GPU_PY_SELECT_H__ +#pragma once PyObject *BPyInit_gpu_select(void); - -#endif /* __GPU_PY_SELECT_H__ */ diff --git a/source/blender/python/gpu/gpu_py_shader.h b/source/blender/python/gpu/gpu_py_shader.h index 92873753039..ee26c26acd4 100644 --- a/source/blender/python/gpu/gpu_py_shader.h +++ b/source/blender/python/gpu/gpu_py_shader.h @@ -18,8 +18,7 @@ * \ingroup bpygpu */ -#ifndef __GPU_PY_SHADER_H__ -#define __GPU_PY_SHADER_H__ +#pragma once extern PyTypeObject BPyGPUShader_Type; @@ -32,5 +31,3 @@ typedef struct BPyGPUShader { PyObject *BPyGPUShader_CreatePyObject(struct GPUShader *shader, bool is_builtin); PyObject *BPyInit_gpu_shader(void); - -#endif /* __GPU_PY_SHADER_H__ */ diff --git a/source/blender/python/gpu/gpu_py_types.h b/source/blender/python/gpu/gpu_py_types.h index d8048225604..56f73b8a504 100644 --- a/source/blender/python/gpu/gpu_py_types.h +++ b/source/blender/python/gpu/gpu_py_types.h @@ -18,8 +18,7 @@ * \ingroup bpygpu */ -#ifndef __GPU_PY_TYPES_H__ -#define __GPU_PY_TYPES_H__ +#pragma once #include "gpu_py_batch.h" #include "gpu_py_element.h" @@ -29,5 +28,3 @@ #include "gpu_py_vertex_format.h" PyObject *BPyInit_gpu_types(void); - -#endif /* __GPU_PY_TYPES_H__ */ diff --git a/source/blender/python/gpu/gpu_py_vertex_buffer.h b/source/blender/python/gpu/gpu_py_vertex_buffer.h index b7124d245a9..41791a35e6e 100644 --- a/source/blender/python/gpu/gpu_py_vertex_buffer.h +++ b/source/blender/python/gpu/gpu_py_vertex_buffer.h @@ -18,8 +18,7 @@ * \ingroup bpygpu */ -#ifndef __GPU_PY_VERTEX_BUFFER_H__ -#define __GPU_PY_VERTEX_BUFFER_H__ +#pragma once #include "BLI_compiler_attrs.h" @@ -34,5 +33,3 @@ typedef struct BPyGPUVertBuf { } BPyGPUVertBuf; PyObject *BPyGPUVertBuf_CreatePyObject(struct GPUVertBuf *vbo) ATTR_NONNULL(1); - -#endif /* __GPU_PY_VERTEX_BUFFER_H__ */ diff --git a/source/blender/python/gpu/gpu_py_vertex_format.h b/source/blender/python/gpu/gpu_py_vertex_format.h index 8ef466aa918..54d090e2923 100644 --- a/source/blender/python/gpu/gpu_py_vertex_format.h +++ b/source/blender/python/gpu/gpu_py_vertex_format.h @@ -18,8 +18,7 @@ * \ingroup bpygpu */ -#ifndef __GPU_PY_VERTEX_FORMAT_H__ -#define __GPU_PY_VERTEX_FORMAT_H__ +#pragma once #include "GPU_vertex_format.h" @@ -32,5 +31,3 @@ typedef struct BPyGPUVertFormat { } BPyGPUVertFormat; PyObject *BPyGPUVertFormat_CreatePyObject(struct GPUVertFormat *fmt); - -#endif /* __GPU_PY_VERTEX_FORMAT_H__ */ diff --git a/source/blender/python/intern/bpy.h b/source/blender/python/intern/bpy.h index 88d1db6f8bc..744bf903443 100644 --- a/source/blender/python/intern/bpy.h +++ b/source/blender/python/intern/bpy.h @@ -18,8 +18,11 @@ * \ingroup pythonintern */ -#ifndef __BPY_H__ -#define __BPY_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif void BPy_init_modules(void); extern PyObject *bpy_package_py; @@ -31,4 +34,6 @@ void BPY_atexit_unregister(void); extern struct CLG_LogRef *BPY_LOG_CONTEXT; extern struct CLG_LogRef *BPY_LOG_RNA; -#endif /* __BPY_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_app.h b/source/blender/python/intern/bpy_app.h index b46de025599..0e5b6747543 100644 --- a/source/blender/python/intern/bpy_app.h +++ b/source/blender/python/intern/bpy_app.h @@ -18,9 +18,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_APP_H__ -#define __BPY_APP_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPY_app_struct(void); -#endif /* __BPY_APP_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_app_alembic.h b/source/blender/python/intern/bpy_app_alembic.h index 4cc890ec64d..4288b556172 100644 --- a/source/blender/python/intern/bpy_app_alembic.h +++ b/source/blender/python/intern/bpy_app_alembic.h @@ -21,9 +21,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_APP_ALEMBIC_H__ -#define __BPY_APP_ALEMBIC_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPY_app_alembic_struct(void); -#endif /* __BPY_APP_ALEMBIC_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_app_build_options.h b/source/blender/python/intern/bpy_app_build_options.h index 52c2e57c12a..390e3409fb8 100644 --- a/source/blender/python/intern/bpy_app_build_options.h +++ b/source/blender/python/intern/bpy_app_build_options.h @@ -18,9 +18,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_APP_BUILD_OPTIONS_H__ -#define __BPY_APP_BUILD_OPTIONS_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPY_app_build_options_struct(void); -#endif /* __BPY_APP_BUILD_OPTIONS_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_app_ffmpeg.h b/source/blender/python/intern/bpy_app_ffmpeg.h index 63fff2b1b4b..b189592e03e 100644 --- a/source/blender/python/intern/bpy_app_ffmpeg.h +++ b/source/blender/python/intern/bpy_app_ffmpeg.h @@ -18,9 +18,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_APP_FFMPEG_H__ -#define __BPY_APP_FFMPEG_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPY_app_ffmpeg_struct(void); -#endif /* __BPY_APP_FFMPEG_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_app_handlers.h b/source/blender/python/intern/bpy_app_handlers.h index 426fe376b55..eb8e85fc96e 100644 --- a/source/blender/python/intern/bpy_app_handlers.h +++ b/source/blender/python/intern/bpy_app_handlers.h @@ -18,9 +18,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_APP_HANDLERS_H__ -#define __BPY_APP_HANDLERS_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPY_app_handlers_struct(void); -#endif /* __BPY_APP_HANDLERS_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_app_icons.h b/source/blender/python/intern/bpy_app_icons.h index 2d7cb96aae7..b0dcbe4b0ea 100644 --- a/source/blender/python/intern/bpy_app_icons.h +++ b/source/blender/python/intern/bpy_app_icons.h @@ -18,9 +18,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_APP_ICONS_H__ -#define __BPY_APP_ICONS_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPY_app_icons_module(void); -#endif /* __BPY_APP_ICONS_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_app_ocio.h b/source/blender/python/intern/bpy_app_ocio.h index 66fc03657c1..bc4529a962c 100644 --- a/source/blender/python/intern/bpy_app_ocio.h +++ b/source/blender/python/intern/bpy_app_ocio.h @@ -18,9 +18,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_APP_OCIO_H__ -#define __BPY_APP_OCIO_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPY_app_ocio_struct(void); -#endif /* __BPY_APP_OCIO_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_app_oiio.h b/source/blender/python/intern/bpy_app_oiio.h index 4b08652dff5..47092899eec 100644 --- a/source/blender/python/intern/bpy_app_oiio.h +++ b/source/blender/python/intern/bpy_app_oiio.h @@ -18,9 +18,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_APP_OIIO_H__ -#define __BPY_APP_OIIO_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPY_app_oiio_struct(void); -#endif /* __BPY_APP_OIIO_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_app_opensubdiv.h b/source/blender/python/intern/bpy_app_opensubdiv.h index f04fa6fb44d..e18c827e6d8 100644 --- a/source/blender/python/intern/bpy_app_opensubdiv.h +++ b/source/blender/python/intern/bpy_app_opensubdiv.h @@ -18,9 +18,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_APP_OPENSUBDIV_H__ -#define __BPY_APP_OPENSUBDIV_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPY_app_opensubdiv_struct(void); -#endif /* __BPY_APP_OPENSUBDIV_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_app_openvdb.h b/source/blender/python/intern/bpy_app_openvdb.h index 333d79142f7..ab73d561412 100644 --- a/source/blender/python/intern/bpy_app_openvdb.h +++ b/source/blender/python/intern/bpy_app_openvdb.h @@ -21,9 +21,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_APP_OPENVDB_H__ -#define __BPY_APP_OPENVDB_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPY_app_openvdb_struct(void); -#endif /* __BPY_APP_OPENVDB_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_app_sdl.h b/source/blender/python/intern/bpy_app_sdl.h index 453c1c0c1a3..b1d349c2a59 100644 --- a/source/blender/python/intern/bpy_app_sdl.h +++ b/source/blender/python/intern/bpy_app_sdl.h @@ -18,9 +18,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_APP_SDL_H__ -#define __BPY_APP_SDL_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPY_app_sdl_struct(void); -#endif /* __BPY_APP_SDL_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_app_timers.h b/source/blender/python/intern/bpy_app_timers.h index bc70e85ae12..9e62541c83a 100644 --- a/source/blender/python/intern/bpy_app_timers.h +++ b/source/blender/python/intern/bpy_app_timers.h @@ -18,9 +18,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_APP_TIMERS_H__ -#define __BPY_APP_TIMERS_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPY_app_timers_module(void); -#endif /* __BPY_APP_TIMERS_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c index 190d4eb1855..c152c920453 100644 --- a/source/blender/python/intern/bpy_app_translations.c +++ b/source/blender/python/intern/bpy_app_translations.c @@ -566,7 +566,7 @@ static PyObject *_py_pgettext(PyObject *args, PyDoc_STRVAR( app_translations_pgettext_doc, - ".. method:: pgettext(msgid, msgctxt)\n" + ".. method:: pgettext(msgid, msgctxt=None)\n" "\n" " Try to translate the given msgid (with optional msgctxt).\n" "\n" @@ -600,7 +600,7 @@ static PyObject *app_translations_pgettext(BlenderAppTranslations *UNUSED(self), } PyDoc_STRVAR(app_translations_pgettext_iface_doc, - ".. method:: pgettext_iface(msgid, msgctxt)\n" + ".. method:: pgettext_iface(msgid, msgctxt=None)\n" "\n" " Try to translate the given msgid (with optional msgctxt), if labels' translation " "is enabled.\n" @@ -622,7 +622,7 @@ static PyObject *app_translations_pgettext_iface(BlenderAppTranslations *UNUSED( } PyDoc_STRVAR(app_translations_pgettext_tip_doc, - ".. method:: pgettext_tip(msgid, msgctxt)\n" + ".. method:: pgettext_tip(msgid, msgctxt=None)\n" "\n" " Try to translate the given msgid (with optional msgctxt), if tooltips' " "translation is enabled.\n" @@ -644,7 +644,7 @@ static PyObject *app_translations_pgettext_tip(BlenderAppTranslations *UNUSED(se } PyDoc_STRVAR(app_translations_pgettext_data_doc, - ".. method:: pgettext_data(msgid, msgctxt)\n" + ".. method:: pgettext_data(msgid, msgctxt=None)\n" "\n" " Try to translate the given msgid (with optional msgctxt), if new data name's " "translation is enabled.\n" diff --git a/source/blender/python/intern/bpy_app_translations.h b/source/blender/python/intern/bpy_app_translations.h index e1e82480b49..090cab5917c 100644 --- a/source/blender/python/intern/bpy_app_translations.h +++ b/source/blender/python/intern/bpy_app_translations.h @@ -18,10 +18,15 @@ * \ingroup pythonintern */ -#ifndef __BPY_APP_TRANSLATIONS_H__ -#define __BPY_APP_TRANSLATIONS_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPY_app_translations_struct(void); void BPY_app_translations_end(void); -#endif /* __BPY_APP_TRANSLATIONS_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_app_usd.h b/source/blender/python/intern/bpy_app_usd.h index e3e1d72b366..2801408c2aa 100644 --- a/source/blender/python/intern/bpy_app_usd.h +++ b/source/blender/python/intern/bpy_app_usd.h @@ -21,9 +21,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_APP_USD_H__ -#define __BPY_APP_USD_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPY_app_usd_struct(void); -#endif /* __BPY_APP_USD_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_capi_utils.h b/source/blender/python/intern/bpy_capi_utils.h index 97344ce1326..c021ec14933 100644 --- a/source/blender/python/intern/bpy_capi_utils.h +++ b/source/blender/python/intern/bpy_capi_utils.h @@ -18,13 +18,16 @@ * \ingroup pythonintern */ -#ifndef __BPY_CAPI_UTILS_H__ -#define __BPY_CAPI_UTILS_H__ +#pragma once #if PY_VERSION_HEX < 0x03070000 # error "Python 3.7 or greater is required, you'll need to update your Python." #endif +#ifdef __cplusplus +extern "C" { +#endif + struct EnumPropertyItem; struct ReportList; @@ -50,4 +53,6 @@ void BPy_SetContext(struct bContext *C); extern void bpy_context_set(struct bContext *C, PyGILState_STATE *gilstate); extern void bpy_context_clear(struct bContext *C, const PyGILState_STATE *gilstate); -#endif /* __BPY_CAPI_UTILS_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_driver.h b/source/blender/python/intern/bpy_driver.h index c77815c7e0e..d5064d9fa56 100644 --- a/source/blender/python/intern/bpy_driver.h +++ b/source/blender/python/intern/bpy_driver.h @@ -18,10 +18,15 @@ * \ingroup pythonintern */ -#ifndef __BPY_DRIVER_H__ -#define __BPY_DRIVER_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif int bpy_pydriver_create_dict(void); extern PyObject *bpy_pydriver_Dict; -#endif /* __BPY_DRIVER_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_gizmo_wrap.h b/source/blender/python/intern/bpy_gizmo_wrap.h index d9031282c40..86b56ab2bd9 100644 --- a/source/blender/python/intern/bpy_gizmo_wrap.h +++ b/source/blender/python/intern/bpy_gizmo_wrap.h @@ -18,14 +18,19 @@ * \ingroup pythonintern */ -#ifndef __BPY_GIZMO_WRAP_H__ -#define __BPY_GIZMO_WRAP_H__ +#pragma once struct wmGizmoGroupType; struct wmGizmoType; +#ifdef __cplusplus +extern "C" { +#endif + /* exposed to rna/wm api */ void BPY_RNA_gizmo_wrapper(struct wmGizmoType *gzt, void *userdata); void BPY_RNA_gizmogroup_wrapper(struct wmGizmoGroupType *gzgt, void *userdata); -#endif /* __BPY_GIZMO_WRAP_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index a880d2cd285..4fbe2db3ecd 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -436,6 +436,12 @@ static void python_script_error_jump_text(struct Text *text) } } +void BPY_python_backtrace(/* FILE */ void *fp) +{ + fputs("\n# Python backtrace\n", fp); + PyC_StackPrint(fp); +} + /* super annoying, undo _PyModule_Clear(), bug [#23871] */ #define PYMODULE_CLEAR_WORKAROUND diff --git a/source/blender/python/intern/bpy_intern_string.h b/source/blender/python/intern/bpy_intern_string.h index 14f9607f3b4..0c75b723fb8 100644 --- a/source/blender/python/intern/bpy_intern_string.h +++ b/source/blender/python/intern/bpy_intern_string.h @@ -14,13 +14,16 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BPY_INTERN_STRING_H__ -#define __BPY_INTERN_STRING_H__ +#pragma once /** \file * \ingroup pythonintern */ +#ifdef __cplusplus +extern "C" { +#endif + void bpy_intern_string_init(void); void bpy_intern_string_exit(void); @@ -41,4 +44,6 @@ extern PyObject *bpy_intern_str_register; extern PyObject *bpy_intern_str_self; extern PyObject *bpy_intern_str_unregister; -#endif /* __BPY_INTERN_STRING_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_library.h b/source/blender/python/intern/bpy_library.h index 6840807d2b0..fbcf111e37d 100644 --- a/source/blender/python/intern/bpy_library.h +++ b/source/blender/python/intern/bpy_library.h @@ -18,12 +18,17 @@ * \ingroup pythonintern */ -#ifndef __BPY_LIBRARY_H__ -#define __BPY_LIBRARY_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif int BPY_library_load_type_ready(void); extern PyMethodDef BPY_library_load_method_def; extern PyMethodDef BPY_library_write_method_def; -#endif /* __BPY_LIBRARY_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_msgbus.h b/source/blender/python/intern/bpy_msgbus.h index 2b3cc4cfaf4..8d4846fd707 100644 --- a/source/blender/python/intern/bpy_msgbus.h +++ b/source/blender/python/intern/bpy_msgbus.h @@ -18,9 +18,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_MSGBUS_H__ -#define __BPY_MSGBUS_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPY_msgbus_module(void); -#endif /* __BPY_MSGBUS_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index 4b2b5f129a7..274c1934e9e 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -227,7 +227,14 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args) context_dict_back = CTX_py_dict_get(C); - CTX_py_dict_set(C, (void *)context_dict); + /** + * It might be that there is already a Python context override. We don't want to remove that + * except when this operator call sets a new override explicitly. This is necessary so that + * called operator runs in the same context as the calling code by default. + */ + if (context_dict != NULL) { + CTX_py_dict_set(C, (void *)context_dict); + } Py_XINCREF(context_dict); /* so we done loose it */ if (WM_operator_poll_context((bContext *)C, ot, context) == false) { diff --git a/source/blender/python/intern/bpy_operator.h b/source/blender/python/intern/bpy_operator.h index 37f6b90fbdb..3cb335d5d9a 100644 --- a/source/blender/python/intern/bpy_operator.h +++ b/source/blender/python/intern/bpy_operator.h @@ -18,8 +18,11 @@ * \ingroup pythonintern */ -#ifndef __BPY_OPERATOR_H__ -#define __BPY_OPERATOR_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif extern PyTypeObject pyop_base_Type; @@ -31,4 +34,6 @@ typedef struct { PyObject *BPY_operator_module(void); +#ifdef __cplusplus +} #endif diff --git a/source/blender/python/intern/bpy_operator_wrap.h b/source/blender/python/intern/bpy_operator_wrap.h index 5bb087540cc..9e496cd8d26 100644 --- a/source/blender/python/intern/bpy_operator_wrap.h +++ b/source/blender/python/intern/bpy_operator_wrap.h @@ -18,11 +18,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_OPERATOR_WRAP_H__ -#define __BPY_OPERATOR_WRAP_H__ +#pragma once struct wmOperatorType; +#ifdef __cplusplus +extern "C" { +#endif + /* these are used for operator methods, used by bpy_operator.c */ PyObject *PYOP_wrap_macro_define(PyObject *self, PyObject *args); @@ -30,4 +33,6 @@ PyObject *PYOP_wrap_macro_define(PyObject *self, PyObject *args); void BPY_RNA_operator_wrapper(struct wmOperatorType *ot, void *userdata); void BPY_RNA_operator_macro_wrapper(struct wmOperatorType *ot, void *userdata); +#ifdef __cplusplus +} #endif diff --git a/source/blender/python/intern/bpy_path.h b/source/blender/python/intern/bpy_path.h index 3f102ae2bb9..3e25cb26288 100644 --- a/source/blender/python/intern/bpy_path.h +++ b/source/blender/python/intern/bpy_path.h @@ -18,9 +18,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_PATH_H__ -#define __BPY_PATH_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPyInit__bpy_path(void); +#ifdef __cplusplus +} #endif diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index a1f9d4afc51..830acd987d9 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -2961,7 +2961,7 @@ PyDoc_STRVAR(BPy_StringProperty_doc, "default=\"\", " "maxlen=0, " "options={'ANIMATABLE'}, " - "options=set(), " + "override=set(), " "tags=set(), " "subtype='NONE', " "update=None, " diff --git a/source/blender/python/intern/bpy_props.h b/source/blender/python/intern/bpy_props.h index d559a3493b4..3d7860dcdd8 100644 --- a/source/blender/python/intern/bpy_props.h +++ b/source/blender/python/intern/bpy_props.h @@ -18,8 +18,11 @@ * \ingroup pythonintern */ -#ifndef __BPY_PROPS_H__ -#define __BPY_PROPS_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPY_rna_props(void); @@ -29,4 +32,6 @@ StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix); #define PYRNA_STACK_ARRAY RNA_STACK_ARRAY +#ifdef __cplusplus +} #endif diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index 652d65fe64c..a2c2171d151 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -18,8 +18,7 @@ * \ingroup pythonintern */ -#ifndef __BPY_RNA_H__ -#define __BPY_RNA_H__ +#pragma once /* --- bpy build options --- */ #ifdef WITH_PYTHON_SAFETY @@ -67,6 +66,10 @@ struct ID; +#ifdef __cplusplus +extern "C" { +#endif + extern PyTypeObject pyrna_struct_meta_idprop_Type; extern PyTypeObject pyrna_struct_Type; extern PyTypeObject pyrna_prop_Type; @@ -265,4 +268,6 @@ extern PyMethodDef meth_bpy_owner_id_get; extern BPy_StructRNA *bpy_context_module; +#ifdef __cplusplus +} #endif diff --git a/source/blender/python/intern/bpy_rna_anim.h b/source/blender/python/intern/bpy_rna_anim.h index 7630c268bbe..7c840e616b1 100644 --- a/source/blender/python/intern/bpy_rna_anim.h +++ b/source/blender/python/intern/bpy_rna_anim.h @@ -14,13 +14,16 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BPY_RNA_ANIM_H__ -#define __BPY_RNA_ANIM_H__ +#pragma once /** \file * \ingroup pythonintern */ +#ifdef __cplusplus +extern "C" { +#endif + extern char pyrna_struct_keyframe_insert_doc[]; extern char pyrna_struct_keyframe_delete_doc[]; extern char pyrna_struct_driver_add_doc[]; @@ -31,4 +34,6 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args); PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args); -#endif /* __BPY_RNA_ANIM_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_rna_callback.h b/source/blender/python/intern/bpy_rna_callback.h index 71e1f71f8af..ae42c4cb1a4 100644 --- a/source/blender/python/intern/bpy_rna_callback.h +++ b/source/blender/python/intern/bpy_rna_callback.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BPY_RNA_CALLBACK_H__ -#define __BPY_RNA_CALLBACK_H__ +#pragma once /** \file * \ingroup pythonintern @@ -24,6 +23,10 @@ struct BPy_StructRNA; struct PyObject; +#ifdef __cplusplus +extern "C" { +#endif + #if 0 PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args); PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args); @@ -32,4 +35,6 @@ PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args); PyObject *pyrna_callback_classmethod_add(PyObject *cls, PyObject *args); PyObject *pyrna_callback_classmethod_remove(PyObject *cls, PyObject *args); -#endif /* __BPY_RNA_CALLBACK_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_rna_driver.h b/source/blender/python/intern/bpy_rna_driver.h index 36160d7c867..cc2c4550870 100644 --- a/source/blender/python/intern/bpy_rna_driver.h +++ b/source/blender/python/intern/bpy_rna_driver.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __BPY_RNA_DRIVER_H__ -#define __BPY_RNA_DRIVER_H__ +#pragma once /** \file * \ingroup pythonintern @@ -25,10 +24,16 @@ struct ChannelDriver; struct DriverTarget; struct PathResolvedRNA; +#ifdef __cplusplus +extern "C" { +#endif + PyObject *pyrna_driver_get_variable_value(struct ChannelDriver *driver, struct DriverTarget *dtar); PyObject *pyrna_driver_self_from_anim_rna(struct PathResolvedRNA *anim_rna); bool pyrna_driver_is_equal_anim_rna(const struct PathResolvedRNA *anim_rna, const PyObject *py_anim_rna); -#endif /* __BPY_RNA_DRIVER_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_rna_gizmo.h b/source/blender/python/intern/bpy_rna_gizmo.h index 293ab38a6ab..307b694338c 100644 --- a/source/blender/python/intern/bpy_rna_gizmo.h +++ b/source/blender/python/intern/bpy_rna_gizmo.h @@ -18,9 +18,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_RNA_GIZMO_H__ -#define __BPY_RNA_GIZMO_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif int BPY_rna_gizmo_module(PyObject *); -#endif /* __BPY_RNA_GIZMO_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_rna_id_collection.h b/source/blender/python/intern/bpy_rna_id_collection.h index ee8f4c666a8..320a9e66ff8 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.h +++ b/source/blender/python/intern/bpy_rna_id_collection.h @@ -18,11 +18,16 @@ * \ingroup pythonintern */ -#ifndef __BPY_RNA_ID_COLLECTION_H__ -#define __BPY_RNA_ID_COLLECTION_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif extern PyMethodDef BPY_rna_id_collection_user_map_method_def; extern PyMethodDef BPY_rna_id_collection_batch_remove_method_def; extern PyMethodDef BPY_rna_id_collection_orphans_purge_method_def; -#endif /* __BPY_RNA_ID_COLLECTION_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_rna_types_capi.h b/source/blender/python/intern/bpy_rna_types_capi.h index 1049122e468..eb8dd14d888 100644 --- a/source/blender/python/intern/bpy_rna_types_capi.h +++ b/source/blender/python/intern/bpy_rna_types_capi.h @@ -18,9 +18,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_RNA_TYPES_CAPI_H__ -#define __BPY_RNA_TYPES_CAPI_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif void BPY_rna_types_extend_capi(void); -#endif /* __BPY_RNA_TYPES_CAPI_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_traceback.h b/source/blender/python/intern/bpy_traceback.h index 11295706240..26f6a574439 100644 --- a/source/blender/python/intern/bpy_traceback.h +++ b/source/blender/python/intern/bpy_traceback.h @@ -18,9 +18,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_TRACEBACK_H__ -#define __BPY_TRACEBACK_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif void python_script_error_jump(const char *filepath, int *lineno, int *offset); -#endif /* __BPY_TRACEBACK_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_utils_previews.h b/source/blender/python/intern/bpy_utils_previews.h index e9de8876068..dbe74f619a9 100644 --- a/source/blender/python/intern/bpy_utils_previews.h +++ b/source/blender/python/intern/bpy_utils_previews.h @@ -18,9 +18,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_UTILS_PREVIEWS_H__ -#define __BPY_UTILS_PREVIEWS_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPY_utils_previews_module(void); -#endif /* __BPY_UTILS_PREVIEWS_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/intern/bpy_utils_units.h b/source/blender/python/intern/bpy_utils_units.h index 5a30c1c3dae..7a135bc6163 100644 --- a/source/blender/python/intern/bpy_utils_units.h +++ b/source/blender/python/intern/bpy_utils_units.h @@ -18,9 +18,14 @@ * \ingroup pythonintern */ -#ifndef __BPY_UTILS_UNITS_H__ -#define __BPY_UTILS_UNITS_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif PyObject *BPY_utils_units(void); -#endif /* __BPY_UTILS_UNITS_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/python/mathutils/mathutils.h b/source/blender/python/mathutils/mathutils.h index c59fa75b651..d8d390cfad0 100644 --- a/source/blender/python/mathutils/mathutils.h +++ b/source/blender/python/mathutils/mathutils.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __MATHUTILS_H__ -#define __MATHUTILS_H__ +#pragma once /** \file * \ingroup pymathutils @@ -195,5 +194,3 @@ int column_vector_multiplication(float rvec[4], VectorObject *vec, MatrixObject /* dynstr as python string utility functions */ PyObject *mathutils_dynstr_to_py(struct DynStr *ds); #endif - -#endif /* __MATHUTILS_H__ */ diff --git a/source/blender/python/mathutils/mathutils_Color.h b/source/blender/python/mathutils/mathutils_Color.h index 51e1746ae74..c966bf1e3b2 100644 --- a/source/blender/python/mathutils/mathutils_Color.h +++ b/source/blender/python/mathutils/mathutils_Color.h @@ -18,8 +18,7 @@ * \ingroup pymathutils */ -#ifndef __MATHUTILS_COLOR_H__ -#define __MATHUTILS_COLOR_H__ +#pragma once extern PyTypeObject color_Type; #define ColorObject_Check(v) PyObject_TypeCheck((v), &color_Type) @@ -42,5 +41,3 @@ PyObject *Color_CreatePyObject_wrap(float col[3], PyTypeObject *base_type) ATTR_ PyObject *Color_CreatePyObject_cb(PyObject *cb_user, unsigned char cb_type, unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT; - -#endif /* __MATHUTILS_COLOR_H__ */ diff --git a/source/blender/python/mathutils/mathutils_Euler.h b/source/blender/python/mathutils/mathutils_Euler.h index c56962395e5..0deef3cfdf3 100644 --- a/source/blender/python/mathutils/mathutils_Euler.h +++ b/source/blender/python/mathutils/mathutils_Euler.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __MATHUTILS_EULER_H__ -#define __MATHUTILS_EULER_H__ +#pragma once /** \file * \ingroup pymathutils @@ -50,5 +49,3 @@ PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT; short euler_order_from_string(const char *str, const char *error_prefix); - -#endif /* __MATHUTILS_EULER_H__ */ diff --git a/source/blender/python/mathutils/mathutils_Matrix.h b/source/blender/python/mathutils/mathutils_Matrix.h index a0e2256b1ce..588c0b94891 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.h +++ b/source/blender/python/mathutils/mathutils_Matrix.h @@ -18,8 +18,7 @@ * \ingroup pymathutils */ -#ifndef __MATHUTILS_MATRIX_H__ -#define __MATHUTILS_MATRIX_H__ +#pragma once extern PyTypeObject matrix_Type; extern PyTypeObject matrix_access_Type; @@ -96,5 +95,3 @@ extern struct Mathutils_Callback mathutils_matrix_col_cb; extern struct Mathutils_Callback mathutils_matrix_translation_cb; void matrix_as_3x3(float mat[3][3], MatrixObject *self); - -#endif /* __MATHUTILS_MATRIX_H__ */ diff --git a/source/blender/python/mathutils/mathutils_Quaternion.h b/source/blender/python/mathutils/mathutils_Quaternion.h index bc6bd307ece..7d20558939e 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.h +++ b/source/blender/python/mathutils/mathutils_Quaternion.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __MATHUTILS_QUATERNION_H__ -#define __MATHUTILS_QUATERNION_H__ +#pragma once /** \file * \ingroup pymathutils @@ -44,5 +43,3 @@ PyObject *Quaternion_CreatePyObject_wrap(float quat[4], PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, unsigned char cb_type, unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT; - -#endif /* __MATHUTILS_QUATERNION_H__ */ diff --git a/source/blender/python/mathutils/mathutils_Vector.h b/source/blender/python/mathutils/mathutils_Vector.h index f75702bc54c..09fc429f9cc 100644 --- a/source/blender/python/mathutils/mathutils_Vector.h +++ b/source/blender/python/mathutils/mathutils_Vector.h @@ -18,8 +18,7 @@ * \ingroup pymathutils */ -#ifndef __MATHUTILS_VECTOR_H__ -#define __MATHUTILS_VECTOR_H__ +#pragma once extern PyTypeObject vector_Type; @@ -48,5 +47,3 @@ PyObject *Vector_CreatePyObject_alloc(float *vec, const int size, PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); - -#endif /* __MATHUTILS_VECTOR_H__ */ diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c b/source/blender/python/mathutils/mathutils_bvhtree.c index 5a0dc7d6a5e..6a007502d3e 100644 --- a/source/blender/python/mathutils/mathutils_bvhtree.c +++ b/source/blender/python/mathutils/mathutils_bvhtree.c @@ -549,8 +549,8 @@ static bool py_bvhtree_overlap_cb(void *userdata, int index_a, int index_b, int } } - return (isect_tri_tri_epsilon_v3( - UNPACK3(tri_a_co), UNPACK3(tri_b_co), ix_pair[0], ix_pair[1], data->epsilon) && + return (isect_tri_tri_v3( + UNPACK3(tri_a_co), UNPACK3(tri_b_co), ix_pair[0], ix_pair[1]) && ((verts_shared == 0) || (len_squared_v3v3(ix_pair[0], ix_pair[1]) > data->epsilon))); } diff --git a/source/blender/python/mathutils/mathutils_bvhtree.h b/source/blender/python/mathutils/mathutils_bvhtree.h index 2991982f3a2..82b09f11e5e 100644 --- a/source/blender/python/mathutils/mathutils_bvhtree.h +++ b/source/blender/python/mathutils/mathutils_bvhtree.h @@ -18,8 +18,7 @@ * \ingroup mathutils */ -#ifndef __MATHUTILS_BVHTREE_H__ -#define __MATHUTILS_BVHTREE_H__ +#pragma once PyMODINIT_FUNC PyInit_mathutils_bvhtree(void); @@ -27,5 +26,3 @@ extern PyTypeObject PyBVHTree_Type; #define PyBVHTree_Check(v) PyObject_TypeCheck((v), &PyBVHTree_Type) #define PyBVHTree_CheckExact(v) (Py_TYPE(v) == &PyBVHTree_Type) - -#endif /* __MATHUTILS_BVHTREE_H__ */ diff --git a/source/blender/python/mathutils/mathutils_geometry.h b/source/blender/python/mathutils/mathutils_geometry.h index 5a1198b4a26..4a200ec98ca 100644 --- a/source/blender/python/mathutils/mathutils_geometry.h +++ b/source/blender/python/mathutils/mathutils_geometry.h @@ -14,13 +14,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __MATHUTILS_GEOMETRY_H__ -#define __MATHUTILS_GEOMETRY_H__ +#pragma once /** \file * \ingroup pymathutils */ PyMODINIT_FUNC PyInit_mathutils_geometry(void); - -#endif /* __MATHUTILS_GEOMETRY_H__ */ diff --git a/source/blender/python/mathutils/mathutils_interpolate.h b/source/blender/python/mathutils/mathutils_interpolate.h index 50dee1ee8de..c51d2b6905b 100644 --- a/source/blender/python/mathutils/mathutils_interpolate.h +++ b/source/blender/python/mathutils/mathutils_interpolate.h @@ -14,13 +14,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __MATHUTILS_INTERPOLATE_H__ -#define __MATHUTILS_INTERPOLATE_H__ +#pragma once /** \file * \ingroup pymathutils */ PyMODINIT_FUNC PyInit_mathutils_interpolate(void); - -#endif /* __MATHUTILS_INTERPOLATE_H__ */ diff --git a/source/blender/python/mathutils/mathutils_kdtree.h b/source/blender/python/mathutils/mathutils_kdtree.h index 99411997282..3df3fc8d382 100644 --- a/source/blender/python/mathutils/mathutils_kdtree.h +++ b/source/blender/python/mathutils/mathutils_kdtree.h @@ -18,11 +18,8 @@ * \ingroup mathutils */ -#ifndef __MATHUTILS_KDTREE_H__ -#define __MATHUTILS_KDTREE_H__ +#pragma once PyMODINIT_FUNC PyInit_mathutils_kdtree(void); extern PyTypeObject PyKDTree_Type; - -#endif /* __MATHUTILS_KDTREE_H__ */ diff --git a/source/blender/python/mathutils/mathutils_noise.h b/source/blender/python/mathutils/mathutils_noise.h index 8204c084947..da5e1a99a03 100644 --- a/source/blender/python/mathutils/mathutils_noise.h +++ b/source/blender/python/mathutils/mathutils_noise.h @@ -18,9 +18,6 @@ * \ingroup mathutils */ -#ifndef __MATHUTILS_NOISE_H__ -#define __MATHUTILS_NOISE_H__ +#pragma once PyMODINIT_FUNC PyInit_mathutils_noise(void); - -#endif /* __MATHUTILS_NOISE_H__ */ diff --git a/source/blender/render/extern/include/RE_bake.h b/source/blender/render/extern/include/RE_bake.h index 3bab9179f84..3ed41ede006 100644 --- a/source/blender/render/extern/include/RE_bake.h +++ b/source/blender/render/extern/include/RE_bake.h @@ -21,14 +21,17 @@ * \ingroup render */ -#ifndef __RE_BAKE_H__ -#define __RE_BAKE_H__ +#pragma once struct Depsgraph; struct ImBuf; struct Mesh; struct Render; +#ifdef __cplusplus +extern "C" { +#endif + typedef struct BakeImage { struct Image *image; int width; @@ -120,4 +123,6 @@ void RE_bake_normal_world_to_world(const BakePixel pixel_array[], void RE_bake_ibuf_clear(struct Image *image, const bool is_tangent); -#endif /* __RE_BAKE_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h index 51eb290b0b8..41f65fbda5c 100644 --- a/source/blender/render/extern/include/RE_engine.h +++ b/source/blender/render/extern/include/RE_engine.h @@ -21,8 +21,7 @@ * \ingroup render */ -#ifndef __RE_ENGINE_H__ -#define __RE_ENGINE_H__ +#pragma once #include "DNA_listBase.h" #include "DNA_node_types.h" @@ -48,6 +47,10 @@ struct ViewLayer; struct bNode; struct bNodeTree; +#ifdef __cplusplus +extern "C" { +#endif + /* External Engine */ /* RenderEngineType.flag */ @@ -237,4 +240,6 @@ void RE_bake_engine_set_engine_parameters(struct Render *re, void RE_engine_free_blender_memory(struct RenderEngine *engine); -#endif /* __RE_ENGINE_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/render/extern/include/RE_multires_bake.h b/source/blender/render/extern/include/RE_multires_bake.h index 6abd9be6608..c48ce7bfd6e 100644 --- a/source/blender/render/extern/include/RE_multires_bake.h +++ b/source/blender/render/extern/include/RE_multires_bake.h @@ -21,12 +21,15 @@ * \ingroup render */ -#ifndef __RE_MULTIRES_BAKE_H__ -#define __RE_MULTIRES_BAKE_H__ +#pragma once struct MultiresBakeRender; struct Scene; +#ifdef __cplusplus +extern "C" { +#endif + typedef struct MultiresBakeRender { Scene *scene; DerivedMesh *lores_dm, *hires_dm; @@ -63,4 +66,6 @@ typedef struct MultiresBakeRender { void RE_multires_bake_images(struct MultiresBakeRender *bkr); +#ifdef __cplusplus +} #endif diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index f9d2e915fad..c8cb537af39 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -21,8 +21,7 @@ * \ingroup render */ -#ifndef __RE_PIPELINE_H__ -#define __RE_PIPELINE_H__ +#pragma once #include "DEG_depsgraph.h" #include "DNA_listBase.h" @@ -367,8 +366,8 @@ struct RenderPass *RE_pass_find_by_type(volatile struct RenderLayer *rl, #define RE_BAKE_AO 2 void RE_GetCameraWindow(struct Render *re, struct Object *camera, float mat[4][4]); -void RE_GetCameraWindowWithOverscan(struct Render *re, float mat[4][4], float overscan); -void RE_GetCameraModelMatrix(struct Render *re, struct Object *camera, float r_mat[4][4]); +void RE_GetCameraWindowWithOverscan(struct Render *re, float overscan, float r_winmat[4][4]); +void RE_GetCameraModelMatrix(struct Render *re, struct Object *camera, float r_modelmat[4][4]); struct Scene *RE_GetScene(struct Render *re); void RE_SetScene(struct Render *re, struct Scene *sce); @@ -392,5 +391,3 @@ RenderResult *RE_DuplicateRenderResult(RenderResult *rr); #ifdef __cplusplus } #endif - -#endif /* __RE_PIPELINE_H__ */ diff --git a/source/blender/render/extern/include/RE_render_ext.h b/source/blender/render/extern/include/RE_render_ext.h index bdf81354b8d..76812840c91 100644 --- a/source/blender/render/extern/include/RE_render_ext.h +++ b/source/blender/render/extern/include/RE_render_ext.h @@ -20,8 +20,7 @@ * \ingroup render */ -#ifndef __RE_RENDER_EXT_H__ -#define __RE_RENDER_EXT_H__ +#pragma once /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /* this include is for non-render pipeline exports (still old cruft here) */ @@ -32,6 +31,10 @@ struct Depsgraph; struct ImagePool; struct MTex; +#ifdef __cplusplus +extern "C" { +#endif + /* render_texture.c */ bool RE_texture_evaluate(const struct MTex *mtex, const float vec[3], @@ -72,4 +75,6 @@ void RE_point_density_free(struct PointDensity *pd); void RE_point_density_fix_linking(void); -#endif /* __RE_RENDER_EXT_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/render/extern/include/RE_shader_ext.h b/source/blender/render/extern/include/RE_shader_ext.h index f69ae4dfd5c..dc41afee938 100644 --- a/source/blender/render/extern/include/RE_shader_ext.h +++ b/source/blender/render/extern/include/RE_shader_ext.h @@ -20,8 +20,7 @@ * \ingroup render */ -#ifndef __RE_SHADER_EXT_H__ -#define __RE_SHADER_EXT_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -82,5 +81,3 @@ int multitex_nodes(struct Tex *tex, #ifdef __cplusplus } #endif - -#endif /* __RE_SHADER_EXT_H__ */ diff --git a/source/blender/render/intern/include/initrender.h b/source/blender/render/intern/include/initrender.h index 99282a8e703..f5ac352752f 100644 --- a/source/blender/render/intern/include/initrender.h +++ b/source/blender/render/intern/include/initrender.h @@ -21,8 +21,11 @@ * \ingroup render */ -#ifndef __INITRENDER_H__ -#define __INITRENDER_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif /* Functions */ @@ -30,4 +33,6 @@ void RE_parts_init(Render *re); void RE_parts_free(Render *re); void RE_parts_clamp(Render *re); -#endif /* __INITRENDER_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/render/intern/include/render_result.h b/source/blender/render/intern/include/render_result.h index 0ed8871b224..187685cd464 100644 --- a/source/blender/render/intern/include/render_result.h +++ b/source/blender/render/intern/include/render_result.h @@ -21,8 +21,7 @@ * \ingroup render */ -#ifndef __RENDER_RESULT_H__ -#define __RENDER_RESULT_H__ +#pragma once #define PASS_VECTOR_MAX 10000.0f @@ -44,6 +43,10 @@ struct RenderResult; struct Scene; struct rcti; +#ifdef __cplusplus +extern "C" { +#endif + /* New */ struct RenderResult *render_result_new(struct Render *re, @@ -148,4 +151,6 @@ bool render_result_has_views(struct RenderResult *rr); } \ ((void)0) -#endif /* __RENDER_RESULT_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 3ae4b9c0b90..6be5fb4792c 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -21,8 +21,7 @@ * \ingroup render */ -#ifndef __RENDER_TYPES_H__ -#define __RENDER_TYPES_H__ +#pragma once /* ------------------------------------------------------------------------- */ /* exposed internal in render module only! */ @@ -43,6 +42,10 @@ struct Object; struct RenderEngine; struct ReportList; +#ifdef __cplusplus +extern "C" { +#endif + /* this is handed over to threaded hiding/passes/shading engine */ typedef struct RenderPart { struct RenderPart *next, *prev; @@ -160,4 +163,6 @@ struct Render { /* R.flag */ #define R_ANIMATION 1 -#endif /* __RENDER_TYPES_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/render/intern/include/renderpipeline.h b/source/blender/render/intern/include/renderpipeline.h index 12b231ef55f..062df59bfd3 100644 --- a/source/blender/render/intern/include/renderpipeline.h +++ b/source/blender/render/intern/include/renderpipeline.h @@ -21,8 +21,7 @@ * \ingroup render */ -#ifndef __RENDERPIPELINE_H__ -#define __RENDERPIPELINE_H__ +#pragma once struct ListBase; struct Render; @@ -30,10 +29,16 @@ struct RenderData; struct RenderLayer; struct RenderResult; +#ifdef __cplusplus +extern "C" { +#endif + struct RenderLayer *render_get_active_layer(struct Render *re, struct RenderResult *rr); void render_update_anim_renderdata(struct Render *re, struct RenderData *rd, struct ListBase *render_layers); void render_copy_renderdata(struct RenderData *to, struct RenderData *from); -#endif /* __RENDERPIPELINE_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/render/intern/include/texture.h b/source/blender/render/intern/include/texture.h index f051d3ed318..22023baab95 100644 --- a/source/blender/render/intern/include/texture.h +++ b/source/blender/render/intern/include/texture.h @@ -21,8 +21,11 @@ * \ingroup render */ -#ifndef __TEXTURE_H__ -#define __TEXTURE_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif #define BRICONT \ texres->tin = (texres->tin - 0.5f) * tex->contrast + tex->bright - 0.5f; \ @@ -95,4 +98,6 @@ void image_sample(struct Image *ima, float result[4], struct ImagePool *pool); -#endif /* __TEXTURE_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/include/zbuf.h index bc6addd6c5f..b898ff89ae4 100644 --- a/source/blender/render/intern/include/zbuf.h +++ b/source/blender/render/intern/include/zbuf.h @@ -18,8 +18,11 @@ * \ingroup render */ -#ifndef __ZBUF_H__ -#define __ZBUF_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif /* span fill in method, is also used to localize data for zbuffering */ typedef struct ZSpan { @@ -40,4 +43,6 @@ void zspan_scanconvert(struct ZSpan *zpan, float *v3, void (*func)(void *, int, int, float, float)); +#ifdef __cplusplus +} #endif diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c index 633b9324d9f..075202e8a79 100644 --- a/source/blender/render/intern/source/external_engine.c +++ b/source/blender/render/intern/source/external_engine.c @@ -174,7 +174,8 @@ static RenderResult *render_result_from_bake(RenderEngine *engine, int x, int y, BLI_addtail(&rr->layers, rl); /* Add render passes. */ - render_layer_add_pass(rr, rl, engine->bake.depth, RE_PASSNAME_COMBINED, "", "RGBA"); + RenderPass *result_pass = render_layer_add_pass( + rr, rl, engine->bake.depth, RE_PASSNAME_COMBINED, "", "RGBA"); RenderPass *primitive_pass = render_layer_add_pass(rr, rl, 4, "BakePrimitive", "", "RGBA"); RenderPass *differential_pass = render_layer_add_pass(rr, rl, 4, "BakeDifferential", "", "RGBA"); @@ -210,6 +211,15 @@ static RenderResult *render_result_from_bake(RenderEngine *engine, int x, int y, } } + /* Initialize tile render result from full image bake result. */ + for (int ty = 0; ty < h; ty++) { + size_t offset = ty * w * engine->bake.depth; + size_t bake_offset = ((y + ty) * engine->bake.width + x) * engine->bake.depth; + size_t size = w * engine->bake.depth * sizeof(float); + + memcpy(result_pass->rect + offset, engine->bake.result + bake_offset, size); + } + return rr; } diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c index 2e9f30397db..d631dd1a2ff 100644 --- a/source/blender/render/intern/source/initrender.c +++ b/source/blender/render/intern/source/initrender.c @@ -211,14 +211,14 @@ void RE_SetCamera(Render *re, Object *cam_ob) re_camera_params_get(re, ¶ms); } -void RE_GetCameraWindow(struct Render *re, struct Object *camera, float mat[4][4]) +void RE_GetCameraWindow(struct Render *re, struct Object *camera, float r_winmat[4][4]) { RE_SetCamera(re, camera); - copy_m4_m4(mat, re->winmat); + copy_m4_m4(r_winmat, re->winmat); } /* Must be called after RE_GetCameraWindow(), does not change re->winmat. */ -void RE_GetCameraWindowWithOverscan(struct Render *re, float mat[4][4], float overscan) +void RE_GetCameraWindowWithOverscan(struct Render *re, float overscan, float r_winmat[4][4]) { CameraParams params; params.is_ortho = re->winmat[3][3] != 0.0f; @@ -233,12 +233,12 @@ void RE_GetCameraWindowWithOverscan(struct Render *re, float mat[4][4], float ov params.viewplane.ymin -= overscan; params.viewplane.ymax += overscan; BKE_camera_params_compute_matrix(¶ms); - copy_m4_m4(mat, params.winmat); + copy_m4_m4(r_winmat, params.winmat); } -void RE_GetCameraModelMatrix(Render *re, struct Object *camera, float r_mat[4][4]) +void RE_GetCameraModelMatrix(Render *re, struct Object *camera, float r_modelmat[4][4]) { - BKE_camera_multiview_model_matrix(&re->r, camera, re->viewname, r_mat); + BKE_camera_multiview_model_matrix(&re->r, camera, re->viewname, r_modelmat); } /* ~~~~~~~~~~~~~~~~ part (tile) calculus ~~~~~~~~~~~~~~~~~~~~~~ */ diff --git a/source/blender/shader_fx/FX_shader_types.h b/source/blender/shader_fx/FX_shader_types.h index f338f9bcc2a..54d3f98bdd4 100644 --- a/source/blender/shader_fx/FX_shader_types.h +++ b/source/blender/shader_fx/FX_shader_types.h @@ -18,8 +18,7 @@ * \ingroup shader_fx */ -#ifndef __FX_SHADER_TYPES_H__ -#define __FX_SHADER_TYPES_H__ +#pragma once #include "BKE_shader_fx.h" @@ -38,5 +37,3 @@ extern ShaderFxTypeInfo shaderfx_Type_Wave; /* FX_shaderfx_util.c */ void shaderfx_type_init(ShaderFxTypeInfo *types[]); - -#endif /* __FX_SHADER_TYPES_H__ */ diff --git a/source/blender/shader_fx/intern/FX_shader_rim.c b/source/blender/shader_fx/intern/FX_shader_rim.c index eaaa10af54c..82e1d151cb6 100644 --- a/source/blender/shader_fx/intern/FX_shader_rim.c +++ b/source/blender/shader_fx/intern/FX_shader_rim.c @@ -72,11 +72,11 @@ static void panel_draw(const bContext *C, Panel *panel) uiItemR(layout, &ptr, "mask_color", 0, NULL, ICON_NONE); uiItemR(layout, &ptr, "mode", 0, IFACE_("Blend Mode"), ICON_NONE); - /* Add the X, Z labels manually because offset is a #PROP_PIXEL. */ + /* Add the X, Y labels manually because offset is a #PROP_PIXEL. */ col = uiLayoutColumn(layout, true); PropertyRNA *prop = RNA_struct_find_property(&ptr, "offset"); uiItemFullR(col, &ptr, prop, 0, 0, 0, IFACE_("Offset X"), ICON_NONE); - uiItemFullR(col, &ptr, prop, 1, 0, 0, IFACE_("Z"), ICON_NONE); + uiItemFullR(col, &ptr, prop, 1, 0, 0, IFACE_("Y"), ICON_NONE); shaderfx_panel_end(layout, &ptr); } @@ -91,11 +91,11 @@ static void blur_panel_draw(const bContext *C, Panel *panel) uiLayoutSetPropSep(layout, true); - /* Add the X, Z labels manually because blur is a #PROP_PIXEL. */ + /* Add the X, Y labels manually because blur is a #PROP_PIXEL. */ col = uiLayoutColumn(layout, true); PropertyRNA *prop = RNA_struct_find_property(&ptr, "blur"); uiItemFullR(col, &ptr, prop, 0, 0, 0, IFACE_("Blur X"), ICON_NONE); - uiItemFullR(col, &ptr, prop, 1, 0, 0, IFACE_("Z"), ICON_NONE); + uiItemFullR(col, &ptr, prop, 1, 0, 0, IFACE_("Y"), ICON_NONE); uiItemR(layout, &ptr, "samples", 0, NULL, ICON_NONE); } diff --git a/source/blender/shader_fx/intern/FX_shader_util.h b/source/blender/shader_fx/intern/FX_shader_util.h index 8ff5a6c0d0e..9617cfd2ee0 100644 --- a/source/blender/shader_fx/intern/FX_shader_util.h +++ b/source/blender/shader_fx/intern/FX_shader_util.h @@ -21,7 +21,4 @@ * \ingroup shader_fx */ -#ifndef __FX_SHADER_UTIL_H__ -#define __FX_SHADER_UTIL_H__ - -#endif /* __FX_SHADER_UTIL_H__ */ +#pragma once diff --git a/source/blender/shader_fx/intern/FX_ui_common.h b/source/blender/shader_fx/intern/FX_ui_common.h index 877855b98e4..ce3038776ba 100644 --- a/source/blender/shader_fx/intern/FX_ui_common.h +++ b/source/blender/shader_fx/intern/FX_ui_common.h @@ -18,8 +18,7 @@ * \ingroup modifiers */ -#ifndef __FX_UI_COMMON_H__ -#define __FX_UI_COMMON_H__ +#pragma once #include "FX_shader_types.h" @@ -52,5 +51,3 @@ struct PanelType *shaderfx_subpanel_register(struct ARegionType *region_type, #ifdef __cplusplus } #endif - -#endif /* __FX_UI_COMMON_H__ */ diff --git a/source/blender/simulation/SIM_mass_spring.h b/source/blender/simulation/SIM_mass_spring.h index d30a7160fd8..219ead477c2 100644 --- a/source/blender/simulation/SIM_mass_spring.h +++ b/source/blender/simulation/SIM_mass_spring.h @@ -21,8 +21,7 @@ * \ingroup bph */ -#ifndef __SIM_MASS_SPRING_H__ -#define __SIM_MASS_SPRING_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -58,5 +57,3 @@ void SIM_cloth_solver_set_volume(ClothModifierData *clmd); #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/simulation/SIM_simulation_update.hh b/source/blender/simulation/SIM_simulation_update.hh index 40b62bfb58a..2c64fdec02e 100644 --- a/source/blender/simulation/SIM_simulation_update.hh +++ b/source/blender/simulation/SIM_simulation_update.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __SIM_SIMULATION_UPDATE_HH__ -#define __SIM_SIMULATION_UPDATE_HH__ +#pragma once struct Depsgraph; struct Scene; @@ -28,5 +27,3 @@ void update_simulation_in_depsgraph(Depsgraph *depsgraph, Simulation *simulation_cow); } - -#endif /* __SIM_SIMULATION_UPDATE_HH__ */ diff --git a/source/blender/simulation/intern/ConstrainedConjugateGradient.h b/source/blender/simulation/intern/ConstrainedConjugateGradient.h index c924490f97d..b0f2bb037d2 100644 --- a/source/blender/simulation/intern/ConstrainedConjugateGradient.h +++ b/source/blender/simulation/intern/ConstrainedConjugateGradient.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __CONSTRAINEDCONJUGATEGRADIENT_H__ -#define __CONSTRAINEDCONJUGATEGRADIENT_H__ +#pragma once #include <Eigen/Core> @@ -331,5 +330,3 @@ struct solve_retval<ConstrainedConjugateGradient<_MatrixType, _UpLo, _Filter, _P } // end namespace internal } // end namespace Eigen - -#endif // __CONSTRAINEDCONJUGATEGRADIENT_H__ diff --git a/source/blender/simulation/intern/eigen_utils.h b/source/blender/simulation/intern/eigen_utils.h index c186cf567df..897ba8b2a67 100644 --- a/source/blender/simulation/intern/eigen_utils.h +++ b/source/blender/simulation/intern/eigen_utils.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __EIGEN_UTILS_H__ -#define __EIGEN_UTILS_H__ +#pragma once /** \file * \ingroup bph @@ -232,5 +231,3 @@ BLI_INLINE void print_lmatrix(const lMatrix &m) printf("\n"); } } - -#endif diff --git a/source/blender/simulation/intern/implicit.h b/source/blender/simulation/intern/implicit.h index 17dfb8b88b9..a3c8e5f34c4 100644 --- a/source/blender/simulation/intern/implicit.h +++ b/source/blender/simulation/intern/implicit.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __IMPLICIT_H__ -#define __IMPLICIT_H__ +#pragma once /** \file * \ingroup bph @@ -268,5 +267,3 @@ void SIM_hair_volume_vertex_grid_forces(struct HairGrid *grid, #ifdef __cplusplus } #endif - -#endif diff --git a/source/blender/simulation/intern/particle_allocator.hh b/source/blender/simulation/intern/particle_allocator.hh index 1e7578a75ed..ae23c8c8238 100644 --- a/source/blender/simulation/intern/particle_allocator.hh +++ b/source/blender/simulation/intern/particle_allocator.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __SIM_PARTICLE_ALLOCATOR_HH__ -#define __SIM_PARTICLE_ALLOCATOR_HH__ +#pragma once #include "BLI_array.hh" #include "BLI_vector.hh" @@ -96,5 +95,3 @@ class ParticleAllocator : NonCopyable, NonMovable { }; } // namespace blender::sim - -#endif /* __SIM_PARTICLE_ALLOCATOR_HH__ */ diff --git a/source/blender/simulation/intern/particle_function.hh b/source/blender/simulation/intern/particle_function.hh index eec4a700383..cc8ccbd8243 100644 --- a/source/blender/simulation/intern/particle_function.hh +++ b/source/blender/simulation/intern/particle_function.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __SIM_PARTICLE_FUNCTION_HH__ -#define __SIM_PARTICLE_FUNCTION_HH__ +#pragma once #include "FN_attributes_ref.hh" #include "FN_multi_function.hh" @@ -88,5 +87,3 @@ class ParticleFunctionEvaluator { }; } // namespace blender::sim - -#endif /* __SIM_PARTICLE_FUNCTION_HH__ */ diff --git a/source/blender/simulation/intern/simulation_collect_influences.hh b/source/blender/simulation/intern/simulation_collect_influences.hh index 42cbea6977e..5035461191e 100644 --- a/source/blender/simulation/intern/simulation_collect_influences.hh +++ b/source/blender/simulation/intern/simulation_collect_influences.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __SIM_SIMULATION_COLLECT_INFLUENCES_HH__ -#define __SIM_SIMULATION_COLLECT_INFLUENCES_HH__ +#pragma once #include "NOD_derived_node_tree.hh" @@ -64,5 +63,3 @@ void collect_simulation_influences(Simulation &simulation, RequiredStates &r_required_states); } // namespace blender::sim - -#endif /* __SIM_SIMULATION_COLLECT_INFLUENCES_HH__ */ diff --git a/source/blender/simulation/intern/simulation_solver.hh b/source/blender/simulation/intern/simulation_solver.hh index 2dc0921ad9e..3fc61f579e3 100644 --- a/source/blender/simulation/intern/simulation_solver.hh +++ b/source/blender/simulation/intern/simulation_solver.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __SIM_SIMULATION_SOLVER_HH__ -#define __SIM_SIMULATION_SOLVER_HH__ +#pragma once #include "BLI_float3.hh" #include "BLI_span.hh" @@ -273,5 +272,3 @@ void solve_simulation_time_step(Simulation &simulation, float time_step); } // namespace blender::sim - -#endif /* __SIM_SIMULATION_SOLVER_HH__ */ diff --git a/source/blender/simulation/intern/time_interval.hh b/source/blender/simulation/intern/time_interval.hh index 49600dd10de..6f13634ed06 100644 --- a/source/blender/simulation/intern/time_interval.hh +++ b/source/blender/simulation/intern/time_interval.hh @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __SIM_TIME_INTERVAL_HH__ -#define __SIM_TIME_INTERVAL_HH__ +#pragma once #include "BLI_utildefines.h" @@ -53,5 +52,3 @@ class TimeInterval { }; } // namespace blender::sim - -#endif /* __SIM_TIME_INTERVAL_HH__ */ diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 3d4c84805f9..332f53c9ee7 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -16,8 +16,7 @@ * The Original Code is Copyright (C) 2007 Blender Foundation. * All rights reserved. */ -#ifndef __WM_API_H__ -#define __WM_API_H__ +#pragma once /** \file * \ingroup wm @@ -904,5 +903,3 @@ bool WM_xr_session_state_viewer_pose_matrix_info_get(const wmXrData *xr, #ifdef __cplusplus } #endif - -#endif /* __WM_API_H__ */ diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h index 53a3fd5ebda..15be21bdbc4 100644 --- a/source/blender/windowmanager/WM_keymap.h +++ b/source/blender/windowmanager/WM_keymap.h @@ -17,8 +17,7 @@ * All rights reserved. */ -#ifndef __WM_KEYMAP_H__ -#define __WM_KEYMAP_H__ +#pragma once /** \file * \ingroup wm @@ -194,5 +193,3 @@ const char *WM_bool_as_string(bool test); #ifdef __cplusplus } #endif - -#endif /* __WM_KEYMAP_H__ */ diff --git a/source/blender/windowmanager/WM_message.h b/source/blender/windowmanager/WM_message.h index 1527d514e9b..25d5bae392b 100644 --- a/source/blender/windowmanager/WM_message.h +++ b/source/blender/windowmanager/WM_message.h @@ -18,9 +18,6 @@ * \ingroup wm */ -#ifndef __WM_MESSAGE_H__ -#define __WM_MESSAGE_H__ +#pragma once #include "message_bus/wm_message_bus.h" - -#endif /* __WM_MESSAGE_H__ */ diff --git a/source/blender/windowmanager/WM_toolsystem.h b/source/blender/windowmanager/WM_toolsystem.h index 163f37be974..13d1666dc95 100644 --- a/source/blender/windowmanager/WM_toolsystem.h +++ b/source/blender/windowmanager/WM_toolsystem.h @@ -13,8 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __WM_TOOLSYSTEM_H__ -#define __WM_TOOLSYSTEM_H__ +#pragma once /** \file * \ingroup wm @@ -140,5 +139,3 @@ void WM_toolsystem_refresh_screen_all(struct Main *bmain); #ifdef __cplusplus } #endif - -#endif /* __WM_TOOLSYSTEM_API_H__ */ diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index b4b3d0957af..efe600a846a 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -106,8 +106,7 @@ * \endcode */ -#ifndef __WM_TYPES_H__ -#define __WM_TYPES_H__ +#pragma once struct ID; struct ImBuf; @@ -928,5 +927,3 @@ extern struct CLG_LogRef *WM_LOG_MSGBUS_SUB; #ifdef __cplusplus } #endif - -#endif /* __WM_TYPES_H__ */ diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_api.h b/source/blender/windowmanager/gizmo/WM_gizmo_api.h index 07a3f0445bb..a4412ecce5c 100644 --- a/source/blender/windowmanager/gizmo/WM_gizmo_api.h +++ b/source/blender/windowmanager/gizmo/WM_gizmo_api.h @@ -26,8 +26,7 @@ * Only included in WM_api.h */ -#ifndef __WM_GIZMO_API_H__ -#define __WM_GIZMO_API_H__ +#pragma once struct ARegion; struct GHashIterator; @@ -52,6 +51,10 @@ struct wmWindowManager; #include "wm_gizmo_fn.h" +#ifdef __cplusplus +extern "C" { +#endif + /* -------------------------------------------------------------------- */ /* wmGizmo */ @@ -396,4 +399,6 @@ void WM_gizmo_group_tag_remove(struct wmGizmoGroup *gzgroup); bool WM_gizmo_group_type_poll(const struct bContext *C, const struct wmGizmoGroupType *gzgt); void WM_gizmo_group_refresh(const struct bContext *C, struct wmGizmoGroup *gzgroup); -#endif /* __WM_GIZMO_API_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_types.h b/source/blender/windowmanager/gizmo/WM_gizmo_types.h index 3863e3bd797..bddf54b846f 100644 --- a/source/blender/windowmanager/gizmo/WM_gizmo_types.h +++ b/source/blender/windowmanager/gizmo/WM_gizmo_types.h @@ -26,8 +26,7 @@ * Only included in WM_types.h and lower level files. */ -#ifndef __WM_GIZMO_TYPES_H__ -#define __WM_GIZMO_TYPES_H__ +#pragma once #include "BLI_compiler_attrs.h" @@ -40,6 +39,10 @@ struct wmKeyConfig; #include "DNA_listBase.h" +#ifdef __cplusplus +extern "C" { +#endif + /* -------------------------------------------------------------------- */ /* Enum Typedef's */ @@ -506,4 +509,6 @@ typedef enum eWM_GizmoFlagMapDrawStep { } eWM_GizmoFlagMapDrawStep; #define WM_GIZMOMAP_DRAWSTEP_MAX 2 -#endif /* __WM_GIZMO_TYPES_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h b/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h index 00df6edef22..953722f28e9 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h @@ -18,8 +18,7 @@ * \ingroup wm */ -#ifndef __WM_GIZMO_INTERN_H__ -#define __WM_GIZMO_INTERN_H__ +#pragma once struct BLI_Buffer; struct wmGizmoMap; @@ -142,5 +141,3 @@ bool wm_gizmomap_deselect_all(struct wmGizmoMap *gzmap); void wm_gizmomap_select_array_shrink(struct wmGizmoMap *gzmap, int len_subtract); void wm_gizmomap_select_array_push_back(struct wmGizmoMap *gzmap, wmGizmo *gz); void wm_gizmomap_select_array_remove(struct wmGizmoMap *gzmap, wmGizmo *gz); - -#endif diff --git a/source/blender/windowmanager/gizmo/wm_gizmo_fn.h b/source/blender/windowmanager/gizmo/wm_gizmo_fn.h index 58b58fa01d0..418e848e35b 100644 --- a/source/blender/windowmanager/gizmo/wm_gizmo_fn.h +++ b/source/blender/windowmanager/gizmo/wm_gizmo_fn.h @@ -20,13 +20,16 @@ * Callback function definitions, needed for both Types & API headers. */ -#ifndef __WM_GIZMO_FN_H__ -#define __WM_GIZMO_FN_H__ +#pragma once #include "BLI_compiler_attrs.h" struct wmMsgBus; +#ifdef __cplusplus +extern "C" { +#endif + /* wmGizmoGroup */ typedef bool (*wmGizmoGroupFnPoll)(const struct bContext *, struct wmGizmoGroupType *) ATTR_WARN_UNUSED_RESULT; @@ -85,4 +88,6 @@ typedef struct wmGizmoPropertyFnParams { void *user_data; } wmGizmoPropertyFnParams; -#endif /* __WM_GIZMO_FN_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.h b/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.h index cc9ccc5f4bb..18b3f40aba6 100644 --- a/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.h +++ b/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.h @@ -28,14 +28,17 @@ * Only included in wm.h and lower level files. */ -#ifndef __WM_GIZMO_WMAPI_H__ -#define __WM_GIZMO_WMAPI_H__ +#pragma once struct wmEventHandler_Gizmo; struct wmEventHandler_Op; struct wmGizmoMap; struct wmOperatorType; +#ifdef __cplusplus +extern "C" { +#endif + /* -------------------------------------------------------------------- */ /* wmGizmo */ @@ -92,4 +95,6 @@ struct ListBase *wm_gizmomap_groups_get(wmGizmoMap *gzmap); void wm_gizmomaptypes_free(void); -#endif /* __WM_GIZMO_WMAPI_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 16454e473cc..fdbc7a7d136 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -51,6 +51,7 @@ #include "ED_screen.h" #include "ED_view3d.h" +#include "GPU_context.h" #include "GPU_draw.h" #include "GPU_framebuffer.h" #include "GPU_immediate.h" @@ -999,6 +1000,7 @@ void wm_draw_update(bContext *C) wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win; + GPU_context_main_lock(); GPU_free_unused_buffers(); for (win = wm->windows.first; win; win = win->next) { @@ -1036,6 +1038,8 @@ void wm_draw_update(bContext *C) /* Draw non-windows (surfaces) */ wm_surfaces_iter(C, wm_draw_surface); + + GPU_context_main_unlock(); } void wm_draw_region_clear(wmWindow *win, ARegion *UNUSED(region)) diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 05ef4bfac30..8dbb608cd30 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -387,6 +387,18 @@ void wm_event_do_refresh_wm_and_depsgraph(bContext *C) CTX_wm_window_set(C, NULL); } +static void wm_event_execute_timers(bContext *C) +{ + wmWindowManager *wm = CTX_wm_manager(C); + + /* Set the first window as context, so that there is some minimal context. This avoids crashes + * when calling code that assumes that there is always a window in the context (which many + * operators do). */ + CTX_wm_window_set(C, wm->windows.first); + BLI_timer_execute(); + CTX_wm_window_set(C, NULL); +} + /* called in mainloop */ void wm_event_do_notifiers(bContext *C) { @@ -398,7 +410,7 @@ void wm_event_do_notifiers(bContext *C) return; } - BLI_timer_execute(); + wm_event_execute_timers(C); /* disable? - keep for now since its used for window level notifiers. */ #if 1 diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c index c8574a5a7fb..31d36603505 100644 --- a/source/blender/windowmanager/intern/wm_files_link.c +++ b/source/blender/windowmanager/intern/wm_files_link.c @@ -34,6 +34,7 @@ #include "MEM_guardedalloc.h" #include "DNA_ID.h" +#include "DNA_key_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_windowmanager_types.h" @@ -50,8 +51,10 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_key.h" #include "BKE_layer.h" #include "BKE_lib_id.h" +#include "BKE_lib_override.h" #include "BKE_lib_remap.h" #include "BKE_main.h" #include "BKE_report.h" @@ -694,6 +697,92 @@ static int wm_lib_relocate_invoke(bContext *C, wmOperator *op, const wmEvent *UN return OPERATOR_CANCELLED; } +static void lib_relocate_do_remap(Main *bmain, + ID *old_id, + ID *new_id, + ReportList *reports, + const bool do_reload, + const short remap_flags) +{ + BLI_assert(old_id); + if (do_reload) { + /* Since we asked for placeholders in case of missing IDs, + * we expect to always get a valid one. */ + BLI_assert(new_id); + } + if (new_id) { +#ifdef PRINT_DEBUG + printf("before remap of %s, old_id users: %d, new_id users: %d\n", + old_id->name, + old_id->us, + new_id->us); +#endif + BKE_libblock_remap_locked(bmain, old_id, new_id, remap_flags); + + if (old_id->flag & LIB_FAKEUSER) { + id_fake_user_clear(old_id); + id_fake_user_set(new_id); + } + +#ifdef PRINT_DEBUG + printf("after remap of %s, old_id users: %d, new_id users: %d\n", + old_id->name, + old_id->us, + new_id->us); +#endif + + /* In some cases, new_id might become direct link, remove parent of library in this case. */ + if (new_id->lib->parent && (new_id->tag & LIB_TAG_INDIRECT) == 0) { + if (do_reload) { + BLI_assert(0); /* Should not happen in 'pure' reload case... */ + } + new_id->lib->parent = NULL; + } + } + + if (old_id->us > 0 && new_id && old_id->lib == new_id->lib) { + /* Note that this *should* not happen - but better be safe than sorry in this area, + * at least until we are 100% sure this cannot ever happen. + * Also, we can safely assume names were unique so far, + * so just replacing '.' by '~' should work, + * but this does not totally rules out the possibility of name collision. */ + size_t len = strlen(old_id->name); + size_t dot_pos; + bool has_num = false; + + for (dot_pos = len; dot_pos--;) { + char c = old_id->name[dot_pos]; + if (c == '.') { + break; + } + else if (c < '0' || c > '9') { + has_num = false; + break; + } + has_num = true; + } + + if (has_num) { + old_id->name[dot_pos] = '~'; + } + else { + len = MIN2(len, MAX_ID_NAME - 7); + BLI_strncpy(&old_id->name[len], "~000", 7); + } + + id_sort_by_name(which_libbase(bmain, GS(old_id->name)), old_id, NULL); + + BKE_reportf( + reports, + RPT_WARNING, + "Lib Reload: Replacing all references to old data-block '%s' by reloaded one failed, " + "old one (%d remaining users) had to be kept and was renamed to '%s'", + new_id->name, + old_id->us, + old_id->name); + } +} + static void lib_relocate_do(Main *bmain, Library *library, WMLinkAppendData *lapp_data, @@ -725,6 +814,12 @@ static void lib_relocate_do(Main *bmain, /* We remove it from current Main, and add it to items to link... */ /* Note that non-linkable IDs (like e.g. shapekeys) are also explicitly linked here... */ BLI_remlink(lbarray[lba_idx], id); + /* Usual special code for ShapeKeys snowflakes... */ + Key *old_key = BKE_key_from_id(id); + if (old_key != NULL) { + BLI_remlink(which_libbase(bmain, GS(old_key->id.name)), &old_key->id); + } + item = wm_link_append_data_item_add(lapp_data, id->name + 2, idcode, id); BLI_bitmap_set_all(item->libraries, true, lapp_data->num_libraries); @@ -757,6 +852,12 @@ static void lib_relocate_do(Main *bmain, BLI_assert(old_id); BLI_addtail(which_libbase(bmain, GS(old_id->name)), old_id); + + /* Usual special code for ShapeKeys snowflakes... */ + Key *old_key = BKE_key_from_id(old_id); + if (old_key != NULL) { + BLI_addtail(which_libbase(bmain, GS(old_key->id.name)), &old_key->id); + } } /* Since our (old) reloaded IDs were removed from main, the user count done for them in linking @@ -773,82 +874,20 @@ static void lib_relocate_do(Main *bmain, ID *old_id = item->customdata; ID *new_id = item->new_id; - BLI_assert(old_id); - if (do_reload) { - /* Since we asked for placeholders in case of missing IDs, - * we expect to always get a valid one. */ - BLI_assert(new_id); - } - if (new_id) { -#ifdef PRINT_DEBUG - printf("before remap of %s, old_id users: %d, new_id users: %d\n", - old_id->name, - old_id->us, - new_id->us); -#endif - BKE_libblock_remap_locked(bmain, old_id, new_id, remap_flags); - - if (old_id->flag & LIB_FAKEUSER) { - id_fake_user_clear(old_id); - id_fake_user_set(new_id); - } - -#ifdef PRINT_DEBUG - printf("after remap of %s, old_id users: %d, new_id users: %d\n", - old_id->name, - old_id->us, - new_id->us); -#endif - - /* In some cases, new_id might become direct link, remove parent of library in this case. */ - if (new_id->lib->parent && (new_id->tag & LIB_TAG_INDIRECT) == 0) { - if (do_reload) { - BLI_assert(0); /* Should not happen in 'pure' reload case... */ - } - new_id->lib->parent = NULL; - } + lib_relocate_do_remap(bmain, old_id, new_id, reports, do_reload, remap_flags); + /* Usual special code for ShapeKeys snowflakes... */ + Key **old_key_p = BKE_key_from_id_p(old_id); + if (old_key_p == NULL) { + continue; } - - if (old_id->us > 0 && new_id && old_id->lib == new_id->lib) { - /* Note that this *should* not happen - but better be safe than sorry in this area, - * at least until we are 100% sure this cannot ever happen. - * Also, we can safely assume names were unique so far, - * so just replacing '.' by '~' should work, - * but this does not totally rules out the possibility of name collision. */ - size_t len = strlen(old_id->name); - size_t dot_pos; - bool has_num = false; - - for (dot_pos = len; dot_pos--;) { - char c = old_id->name[dot_pos]; - if (c == '.') { - break; - } - else if (c < '0' || c > '9') { - has_num = false; - break; - } - has_num = true; - } - - if (has_num) { - old_id->name[dot_pos] = '~'; - } - else { - len = MIN2(len, MAX_ID_NAME - 7); - BLI_strncpy(&old_id->name[len], "~000", 7); - } - - id_sort_by_name(which_libbase(bmain, GS(old_id->name)), old_id, NULL); - - BKE_reportf( - reports, - RPT_WARNING, - "Lib Reload: Replacing all references to old data-block '%s' by reloaded one failed, " - "old one (%d remaining users) had to be kept and was renamed to '%s'", - new_id->name, - old_id->us, - old_id->name); + Key *old_key = *old_key_p; + Key *new_key = BKE_key_from_id(new_id); + if (old_key != NULL) { + *old_key_p = NULL; + id_us_min(&old_key->id); + lib_relocate_do_remap(bmain, &old_key->id, &new_key->id, reports, do_reload, remap_flags); + *old_key_p = old_key; + id_us_plus_no_lib(&old_key->id); } } @@ -900,6 +939,23 @@ static void lib_relocate_do(Main *bmain, } } + /* Update overrides of reloaded linked data-blocks. + * Note that this will not necessarily fully update the override, it might need to be manually + * 're-generated' depending on changes in linked data. */ + ID *id; + FOREACH_MAIN_ID_BEGIN (bmain, id) { + if (ID_IS_LINKED(id) || !ID_IS_OVERRIDE_LIBRARY_REAL(id) || + (id->tag & LIB_TAG_PRE_EXISTING) == 0) { + continue; + } + if (id->override_library->reference->lib == library) { + BKE_lib_override_library_update(bmain, id); + } + } + FOREACH_MAIN_ID_END; + + BKE_main_collection_sync(bmain); + BKE_main_lib_objects_recalc_all(bmain); IMB_colormanagement_check_file_config(bmain); diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index aa3f11c2515..945d5fd42e4 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -656,13 +656,6 @@ void WM_exit_ex(bContext *C, const bool do_python) BKE_blender_atexit(); - if (MEM_get_memory_blocks_in_use() != 0) { - size_t mem_in_use = MEM_get_memory_in_use() + MEM_get_memory_in_use(); - printf("Error: Not freed memory blocks: %u, total unfreed memory %f MB\n", - MEM_get_memory_blocks_in_use(), - (double)mem_in_use / 1024 / 1024); - MEM_printmemlist(); - } wm_autosave_delete(); BKE_tempdir_session_purge(); diff --git a/source/blender/windowmanager/intern/wm_keymap_utils.c b/source/blender/windowmanager/intern/wm_keymap_utils.c index 5ab36b15666..460b19ac8d1 100644 --- a/source/blender/windowmanager/intern/wm_keymap_utils.c +++ b/source/blender/windowmanager/intern/wm_keymap_utils.c @@ -217,7 +217,6 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname) * FLUID_OT * TEXTURE_OT * UI_OT - * VIEW2D_OT * WORLD_OT */ @@ -344,6 +343,10 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname) break; } } + /* General 2D View, not bound to a specific spacetype. */ + else if (STRPREFIX(opname, "VIEW2D_OT")) { + km = WM_keymap_find_all(wm, "View2D", 0, 0); + } /* Image Editor */ else if (STRPREFIX(opname, "IMAGE_OT")) { km = WM_keymap_find_all(wm, "Image", sl->spacetype, 0); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index d1f65b6271b..e14b59d77b2 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3722,6 +3722,7 @@ static int wm_xr_session_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); wmWindowManager *wm = CTX_wm_manager(C); + wmWindow *win = CTX_wm_window(C); View3D *v3d = CTX_wm_view3d(C); /* Lazy-create xr context - tries to dynlink to the runtime, reading active_runtime.json. */ @@ -3730,7 +3731,7 @@ static int wm_xr_session_toggle_exec(bContext *C, wmOperator *UNUSED(op)) } v3d->runtime.flag |= V3D_RUNTIME_XR_SESSION_ROOT; - wm_xr_session_toggle(wm, wm_xr_session_update_screen_on_exit_cb); + wm_xr_session_toggle(wm, win, wm_xr_session_update_screen_on_exit_cb); wm_xr_session_update_screen(bmain, &wm->xr); WM_event_add_notifier(C, NC_WM | ND_XR_DATA_CHANGED, NULL); diff --git a/source/blender/windowmanager/intern/wm_platform_support.h b/source/blender/windowmanager/intern/wm_platform_support.h index a8e20f6bcdf..6346f517343 100644 --- a/source/blender/windowmanager/intern/wm_platform_support.h +++ b/source/blender/windowmanager/intern/wm_platform_support.h @@ -20,11 +20,8 @@ /** \file * \ingroup wm */ -#ifndef __WM_PLATFORM_SUPPORT_H__ -#define __WM_PLATFORM_SUPPORT_H__ +#pragma once #include "BLI_sys_types.h" bool WM_platform_support_perform_checks(void); - -#endif diff --git a/source/blender/windowmanager/intern/wm_window_private.h b/source/blender/windowmanager/intern/wm_window_private.h index 115539861d7..c208d07ee37 100644 --- a/source/blender/windowmanager/intern/wm_window_private.h +++ b/source/blender/windowmanager/intern/wm_window_private.h @@ -20,8 +20,7 @@ /** \file * \ingroup wm */ -#ifndef __WM_WINDOW_PRIVATE_H__ -#define __WM_WINDOW_PRIVATE_H__ +#pragma once #include "BLI_sys_types.h" #include "GHOST_Types.h" @@ -38,5 +37,3 @@ void WM_ghost_show_message_box(const char *title, const char *continue_label, const char *link, GHOST_DialogOptions dialog_options); - -#endif diff --git a/source/blender/windowmanager/message_bus/intern/wm_message_bus_intern.h b/source/blender/windowmanager/message_bus/intern/wm_message_bus_intern.h index ccf7034e3e0..24c0192fe14 100644 --- a/source/blender/windowmanager/message_bus/intern/wm_message_bus_intern.h +++ b/source/blender/windowmanager/message_bus/intern/wm_message_bus_intern.h @@ -18,8 +18,7 @@ * \ingroup wm */ -#ifndef __WM_MESSAGE_BUS_INTERN_H__ -#define __WM_MESSAGE_BUS_INTERN_H__ +#pragma once #include "../wm_message_bus.h" @@ -47,5 +46,3 @@ BLI_INLINE wmMsg *wm_msg_subscribe_value_msg_cast_mut(wmMsgSubscribeKey *key) { return &((wmMsgSubscribeKey_Generic *)key)->msg; } - -#endif /* __WM_MESSAGE_BUS_INTERN_H__ */ diff --git a/source/blender/windowmanager/message_bus/wm_message_bus.h b/source/blender/windowmanager/message_bus/wm_message_bus.h index 8020be3017a..23a53eace52 100644 --- a/source/blender/windowmanager/message_bus/wm_message_bus.h +++ b/source/blender/windowmanager/message_bus/wm_message_bus.h @@ -18,8 +18,7 @@ * \ingroup wm */ -#ifndef __WM_MESSAGE_BUS_H__ -#define __WM_MESSAGE_BUS_H__ +#pragma once #include "RNA_types.h" #include <stdio.h> @@ -34,6 +33,10 @@ struct wmMsgSubscribeKey; struct wmMsgSubscribeValue; struct wmMsgSubscribeValueLink; +#ifdef __cplusplus +extern "C" { +#endif + typedef void (*wmMsgNotifyFn)(struct bContext *C, struct wmMsgSubscribeKey *msg_key, struct wmMsgSubscribeValue *msg_val); @@ -287,4 +290,6 @@ void WM_msg_publish_ID(struct wmMsgBus *mbus, struct ID *id); } \ ((void)0) -#endif /* __WM_MESSAGE_BUS_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h index 16aa5cb44db..baa47098bd3 100644 --- a/source/blender/windowmanager/wm.h +++ b/source/blender/windowmanager/wm.h @@ -21,8 +21,7 @@ * \ingroup wm */ -#ifndef __WM_H__ -#define __WM_H__ +#pragma once struct ARegion; struct ReportList; @@ -30,6 +29,10 @@ struct wmWindow; #include "gizmo/wm_gizmo_wmapi.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef struct wmPaintCursor { struct wmPaintCursor *next, *prev; @@ -97,4 +100,6 @@ void wm_stereo3d_set_cancel(bContext *C, wmOperator *op); void wm_open_init_load_ui(wmOperator *op, bool use_prefs); void wm_open_init_use_scripts(wmOperator *op, bool use_prefs); +#ifdef __cplusplus +} #endif diff --git a/source/blender/windowmanager/wm_cursors.h b/source/blender/windowmanager/wm_cursors.h index 7a28aeb3c70..b85616deda5 100644 --- a/source/blender/windowmanager/wm_cursors.h +++ b/source/blender/windowmanager/wm_cursors.h @@ -21,12 +21,15 @@ * \ingroup wm */ -#ifndef __WM_CURSORS_H__ -#define __WM_CURSORS_H__ +#pragma once struct wmEvent; struct wmWindow; +#ifdef __cplusplus +extern "C" { +#endif + typedef enum WMCursorType { WM_CURSOR_DEFAULT = 1, WM_CURSOR_TEXT_EDIT, @@ -77,4 +80,6 @@ typedef enum WMCursorType { void wm_init_cursor_data(void); bool wm_cursor_arrow_move(struct wmWindow *win, const struct wmEvent *event); -#endif /* __WM_CURSORS_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/windowmanager/wm_draw.h b/source/blender/windowmanager/wm_draw.h index ff2fc25333a..a26c02317d0 100644 --- a/source/blender/windowmanager/wm_draw.h +++ b/source/blender/windowmanager/wm_draw.h @@ -21,8 +21,7 @@ * \ingroup wm */ -#ifndef __WM_DRAW_H__ -#define __WM_DRAW_H__ +#pragma once #include "GPU_glew.h" @@ -30,6 +29,10 @@ struct GPUOffScreen; struct GPUTexture; struct GPUViewport; +#ifdef __cplusplus +extern "C" { +#endif + typedef struct wmDrawBuffer { struct GPUOffScreen *offscreen; struct GPUViewport *viewport; @@ -50,4 +53,6 @@ void wm_draw_region_test(struct bContext *C, struct ScrArea *area, struct ARegio struct GPUTexture *wm_draw_region_texture(struct ARegion *region, int view); -#endif /* __WM_DRAW_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h index efcf40d03eb..787c840de8a 100644 --- a/source/blender/windowmanager/wm_event_system.h +++ b/source/blender/windowmanager/wm_event_system.h @@ -21,8 +21,7 @@ * \ingroup wm */ -#ifndef __WM_EVENT_SYSTEM_H__ -#define __WM_EVENT_SYSTEM_H__ +#pragma once /* return value of handler-operator call */ #define WM_HANDLER_CONTINUE 0 @@ -34,6 +33,10 @@ struct ARegion; struct GHOST_TabletData; struct ScrArea; +#ifdef __cplusplus +extern "C" { +#endif + /* wmKeyMap is in DNA_windowmanager.h, it's saveable */ /** Custom types for handlers, for signaling, freeing */ @@ -165,4 +168,6 @@ void wm_dropbox_free(void); void wm_drags_check_ops(bContext *C, const wmEvent *event); void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect); -#endif /* __WM_EVENT_SYSTEM_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h index ffed86abfe7..ed8f39fea48 100644 --- a/source/blender/windowmanager/wm_event_types.h +++ b/source/blender/windowmanager/wm_event_types.h @@ -23,8 +23,11 @@ * Blender copied the conventions quite some, and expanded it with internal new defines (ton) */ -#ifndef __WM_EVENT_TYPES_H__ -#define __WM_EVENT_TYPES_H__ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif /* customdata type */ enum { @@ -489,4 +492,6 @@ enum { GESTURE_MODAL_CIRCLE_SIZE = 11, }; -#endif /* __WM_EVENT_TYPES_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/windowmanager/wm_files.h b/source/blender/windowmanager/wm_files.h index 42eab35cdb9..d54090a6025 100644 --- a/source/blender/windowmanager/wm_files.h +++ b/source/blender/windowmanager/wm_files.h @@ -21,13 +21,16 @@ * \ingroup wm */ -#ifndef __WM_FILES_H__ -#define __WM_FILES_H__ +#pragma once struct Main; struct wmGenericCallback; struct wmOperatorType; +#ifdef __cplusplus +extern "C" { +#endif + /* wm_files.c */ void wm_history_file_read(void); void wm_homefile_read(struct bContext *C, @@ -68,4 +71,6 @@ void WM_OT_append(struct wmOperatorType *ot); void WM_OT_lib_relocate(struct wmOperatorType *ot); void WM_OT_lib_reload(struct wmOperatorType *ot); -#endif /* __WM_FILES_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/windowmanager/wm_surface.h b/source/blender/windowmanager/wm_surface.h index bc1cc825e4b..06c29231361 100644 --- a/source/blender/windowmanager/wm_surface.h +++ b/source/blender/windowmanager/wm_surface.h @@ -22,11 +22,14 @@ * Container to manage painting in an offscreen context. */ -#ifndef __WM_SURFACE_H__ -#define __WM_SURFACE_H__ +#pragma once struct bContext; +#ifdef __cplusplus +extern "C" { +#endif + typedef struct wmSurface { struct wmSurface *next, *prev; @@ -59,4 +62,6 @@ void wm_surface_clear_drawable(void); void wm_surface_set_drawable(wmSurface *surface, bool activate); void wm_surface_reset_drawable(void); -#endif /* __WM_SURFACE_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h index 5ca5711b4f2..336db7edb50 100644 --- a/source/blender/windowmanager/wm_window.h +++ b/source/blender/windowmanager/wm_window.h @@ -21,11 +21,14 @@ * \ingroup wm */ -#ifndef __WM_WINDOW_H__ -#define __WM_WINDOW_H__ +#pragma once struct wmOperator; +#ifdef __cplusplus +extern "C" { +#endif + /* *************** internal api ************** */ void wm_ghost_init(bContext *C); void wm_ghost_exit(void); @@ -85,4 +88,6 @@ int wm_window_new_main_exec(bContext *C, struct wmOperator *op); void wm_test_autorun_warning(bContext *C); -#endif /* __WM_WINDOW_H__ */ +#ifdef __cplusplus +} +#endif diff --git a/source/blender/windowmanager/xr/intern/wm_xr_draw.c b/source/blender/windowmanager/xr/intern/wm_xr_draw.c index 684e59eb8b2..6f96d2ea6a0 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_draw.c +++ b/source/blender/windowmanager/xr/intern/wm_xr_draw.c @@ -55,7 +55,7 @@ static void wm_xr_draw_matrices_create(const wmXrDrawData *draw_data, copy_qt_qt(eye_pose.orientation_quat, draw_view->eye_pose.orientation_quat); copy_v3_v3(eye_pose.position, draw_view->eye_pose.position); - add_v3_v3(eye_pose.position, draw_data->eye_position_ofs); + sub_v3_v3(eye_pose.position, draw_data->eye_position_ofs); if ((session_settings->flag & XR_SESSION_USE_POSITION_TRACKING) == 0) { sub_v3_v3(eye_pose.position, draw_view->local_pose.position); } diff --git a/source/blender/windowmanager/xr/intern/wm_xr_intern.h b/source/blender/windowmanager/xr/intern/wm_xr_intern.h index 9b7e9a15948..25e3da3ffb4 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_intern.h +++ b/source/blender/windowmanager/xr/intern/wm_xr_intern.h @@ -18,8 +18,7 @@ * \ingroup wm */ -#ifndef __WM_XR_INTERN_H__ -#define __WM_XR_INTERN_H__ +#pragma once #include "CLG_log.h" @@ -50,7 +49,11 @@ typedef struct wmXrSessionState { typedef struct wmXrRuntimeData { GHOST_XrContextHandle context; - /* Although this struct is internal, RNA gets a handle to this for state information queries. */ + /** The window the session was started in. Stored to be able to follow its view-layer. This may + * be an invalid reference, i.e. the window may have been closed. */ + wmWindow *session_root_win; + + /** Although this struct is internal, RNA gets a handle to this for state information queries. */ wmXrSessionState session_state; wmXrSessionExitFn exit_fn; } wmXrRuntimeData; @@ -71,6 +74,8 @@ typedef struct wmXrDrawData { * space). With positional tracking enabled, it should be the same as the base pose, when * disabled it also contains a location delta from the moment the option was toggled. */ GHOST_XrPose base_pose; + /** Offset to _substract_ from the OpenXR eye and viewer pose to get the wanted effective pose + * (e.g. a pose exactly at the landmark position). */ float eye_position_ofs[3]; /* Local/view space. */ } wmXrDrawData; @@ -92,5 +97,3 @@ void wm_xr_session_gpu_binding_context_destroy(GHOST_ContextHandle context); void wm_xr_pose_to_viewmat(const GHOST_XrPose *pose, float r_viewmat[4][4]); void wm_xr_draw_view(const GHOST_XrDrawViewInfo *draw_view, void *customdata); - -#endif diff --git a/source/blender/windowmanager/xr/intern/wm_xr_session.c b/source/blender/windowmanager/xr/intern/wm_xr_session.c index 5d85045e8fa..9c6b8e8fbda 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_session.c +++ b/source/blender/windowmanager/xr/intern/wm_xr_session.c @@ -19,7 +19,10 @@ */ #include "BKE_context.h" +#include "BKE_main.h" +#include "BKE_scene.h" +#include "BLI_listbase.h" #include "BLI_math.h" #include "DEG_depsgraph.h" @@ -41,8 +44,8 @@ #include "wm_window.h" #include "wm_xr_intern.h" -wmSurface *g_xr_surface = NULL; -CLG_LogRef LOG = {"wm.xr"}; +static wmSurface *g_xr_surface = NULL; +static CLG_LogRef LOG = {"wm.xr"}; /* -------------------------------------------------------------------- */ @@ -68,7 +71,9 @@ static void wm_xr_session_begin_info_create(wmXrData *xr_data, r_begin_info->exit_customdata = xr_data; } -void wm_xr_session_toggle(wmWindowManager *wm, wmXrSessionExitFn session_exit_fn) +void wm_xr_session_toggle(wmWindowManager *wm, + wmWindow *session_root_win, + wmXrSessionExitFn session_exit_fn) { wmXrData *xr_data = &wm->xr; @@ -78,6 +83,7 @@ void wm_xr_session_toggle(wmWindowManager *wm, wmXrSessionExitFn session_exit_fn else { GHOST_XrSessionBeginInfo begin_info; + xr_data->runtime->session_root_win = session_root_win; xr_data->runtime->session_state.is_started = true; xr_data->runtime->exit_fn = session_exit_fn; @@ -159,6 +165,43 @@ static void wm_xr_session_draw_data_populate(wmXrData *xr_data, wm_xr_session_base_pose_calc(r_draw_data->scene, settings, &r_draw_data->base_pose); } +static wmWindow *wm_xr_session_root_window_or_fallback_get(const wmWindowManager *wm, + const wmXrRuntimeData *runtime_data) +{ + if (runtime_data->session_root_win && + BLI_findindex(&wm->windows, runtime_data->session_root_win) != -1) { + /* Root window is still valid, use it. */ + return runtime_data->session_root_win; + } + /* Otherwise, fallback. */ + return wm->windows.first; +} + +/** + * Get the scene and depsgraph shown in the VR session's root window (the window the session was + * started from) if still available. If it's not available, use some fallback window. + * + * It's important that the VR session follows some existing window, otherwise it would need to have + * an own depsgraph, which is an expense we should avoid. + */ +static void wm_xr_session_scene_and_evaluated_depsgraph_get(Main *bmain, + const wmWindowManager *wm, + Scene **r_scene, + Depsgraph **r_depsgraph) +{ + const wmWindow *root_win = wm_xr_session_root_window_or_fallback_get(wm, wm->xr.runtime); + + /* Follow the scene & view layer shown in the root 3D View. */ + Scene *scene = WM_window_get_active_scene(root_win); + ViewLayer *view_layer = WM_window_get_active_view_layer(root_win); + + Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, false); + BLI_assert(scene && view_layer && depsgraph); + BKE_scene_graph_evaluated_ensure(depsgraph, bmain); + *r_scene = scene; + *r_depsgraph = depsgraph; +} + typedef enum wmXrSessionStateEvent { SESSION_STATE_EVENT_NONE = 0, SESSION_STATE_EVENT_START, @@ -177,8 +220,8 @@ static bool wm_xr_session_draw_data_needs_reset_to_base_pose(const wmXrSessionSt (state->prev_base_pose_object != settings->base_pose_object)); } -wmXrSessionStateEvent wm_xr_session_state_to_event(const wmXrSessionState *state, - const XrSessionSettings *settings) +static wmXrSessionStateEvent wm_xr_session_state_to_event(const wmXrSessionState *state, + const XrSessionSettings *settings) { if (!state->is_view_data_set) { return SESSION_STATE_EVENT_START; @@ -208,8 +251,9 @@ void wm_xr_session_draw_data_update(const wmXrSessionState *state, switch (event) { case SESSION_STATE_EVENT_START: - /* Always use the exact base pose with no offset when starting the session. */ - copy_v3_fl(draw_data->eye_position_ofs, 0.0f); + /* We want to start the session exactly at landmark position. Runtimes may have a non-[0,0,0] + * starting position that we have to substract for that. */ + copy_v3_v3(draw_data->eye_position_ofs, draw_view->local_pose.position); break; /* This should be triggered by the VR add-on if a landmark changes. */ case SESSION_STATE_EVENT_RESET_TO_BASE_POSE: @@ -256,9 +300,9 @@ void wm_xr_session_state_update(const XrSessionSettings *settings, copy_v3_v3(viewer_pose.position, draw_data->base_pose.position); /* The local pose and the eye pose (which is copied from an earlier local pose) both are view * space, so Y-up. In this case we need them in regular Z-up. */ - viewer_pose.position[0] += draw_data->eye_position_ofs[0]; - viewer_pose.position[1] -= draw_data->eye_position_ofs[2]; - viewer_pose.position[2] += draw_data->eye_position_ofs[1]; + viewer_pose.position[0] -= draw_data->eye_position_ofs[0]; + viewer_pose.position[1] += draw_data->eye_position_ofs[2]; + viewer_pose.position[2] -= draw_data->eye_position_ofs[1]; if (use_position_tracking) { viewer_pose.position[0] += draw_view->local_pose.position[0]; viewer_pose.position[1] -= draw_view->local_pose.position[2]; @@ -278,6 +322,8 @@ void wm_xr_session_state_update(const XrSessionSettings *settings, state->prev_base_pose_type = settings->base_pose_type; state->prev_base_pose_object = settings->base_pose_object; state->is_view_data_set = true; + /* Assume this was already done through wm_xr_session_draw_data_update(). */ + state->force_reset_to_base_pose = false; } wmXrSessionState *WM_xr_session_state_handle_get(const wmXrData *xr) @@ -342,13 +388,17 @@ static void wm_xr_session_surface_draw(bContext *C) { wmXrSurfaceData *surface_data = g_xr_surface->customdata; wmWindowManager *wm = CTX_wm_manager(C); + Main *bmain = CTX_data_main(C); wmXrDrawData draw_data; if (!GHOST_XrSessionIsRunning(wm->xr.runtime->context)) { return; } - wm_xr_session_draw_data_populate( - &wm->xr, CTX_data_scene(C), CTX_data_ensure_evaluated_depsgraph(C), &draw_data); + + Scene *scene; + Depsgraph *depsgraph; + wm_xr_session_scene_and_evaluated_depsgraph_get(bmain, wm, &scene, &depsgraph); + wm_xr_session_draw_data_populate(&wm->xr, scene, depsgraph, &draw_data); GHOST_XrSessionDrawViews(wm->xr.runtime->context, &draw_data); diff --git a/source/blender/windowmanager/xr/wm_xr.h b/source/blender/windowmanager/xr/wm_xr.h index 33f79bc75b2..0f0fbe8bc00 100644 --- a/source/blender/windowmanager/xr/wm_xr.h +++ b/source/blender/windowmanager/xr/wm_xr.h @@ -18,8 +18,7 @@ * \ingroup wm */ -#ifndef __WM_XR_H__ -#define __WM_XR_H__ +#pragma once struct wmWindowManager; struct wmXrData; @@ -29,7 +28,5 @@ typedef void (*wmXrSessionExitFn)(const wmXrData *xr_data); /* wm_xr.c */ bool wm_xr_init(wmWindowManager *wm); void wm_xr_exit(wmWindowManager *wm); -void wm_xr_session_toggle(wmWindowManager *wm, wmXrSessionExitFn session_exit_fn); +void wm_xr_session_toggle(wmWindowManager *wm, wmWindow *win, wmXrSessionExitFn session_exit_fn); bool wm_xr_events_handle(wmWindowManager *wm); - -#endif diff --git a/source/creator/creator.c b/source/creator/creator.c index abc443425a8..9268ed15923 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -295,6 +295,7 @@ int main(int argc, break; } } + MEM_initialize_memleak_detection(); } #ifdef BUILD_DATE diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index 20a75ebe3b9..b8e99899821 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -2192,6 +2192,12 @@ void main_args_setup(bContext *C, bArgs *ba) BLI_argsAdd(ba, 1, NULL, + "--debug-depsgraph-uuid", + CB_EX(arg_handle_debug_mode_generic_set, depsgraph_build), + (void *)G_DEBUG_DEPSGRAPH_UUID); + BLI_argsAdd(ba, + 1, + NULL, "--debug-gpumem", CB_EX(arg_handle_debug_mode_generic_set, gpumem), (void *)G_DEBUG_GPU_MEM); diff --git a/source/creator/creator_intern.h b/source/creator/creator_intern.h index 9c7d3d95498..7ff3247e17e 100644 --- a/source/creator/creator_intern.h +++ b/source/creator/creator_intern.h @@ -14,8 +14,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef __CREATOR_INTERN_H__ -#define __CREATOR_INTERN_H__ +#pragma once /** \file * \ingroup creator @@ -82,5 +81,3 @@ extern char build_cxxflags[]; extern char build_linkflags[]; extern char build_system[]; #endif - -#endif /* __CREATOR_INTERN_H__ */ diff --git a/source/creator/creator_signals.c b/source/creator/creator_signals.c index dbf947a86fd..ad0b7b2547d 100644 --- a/source/creator/creator_signals.c +++ b/source/creator/creator_signals.c @@ -59,6 +59,10 @@ # include <signal.h> +# ifdef WITH_PYTHON +# include "BPY_extern.h" /* BPY_python_backtrace */ +# endif + # include "creator_intern.h" /* own include */ // #define USE_WRITE_CRASH_BLEND @@ -174,6 +178,11 @@ static void sig_handle_crash(int signum) sig_handle_crash_backtrace(fp); +# ifdef WITH_PYTHON + /* Generate python back-trace if Python is currently active. */ + BPY_python_backtrace(fp); +# endif + fclose(fp); } diff --git a/source/tools b/source/tools -Subproject 44ae9d181c734c14ae22feb0d33ad39a626f8ce +Subproject 896c5f78952adb2d091d28c65086d46992dabda diff --git a/tests/gtests/alembic/abc_export_test.cc b/tests/gtests/alembic/abc_export_test.cc index cdc98178550..5c2b505958e 100644 --- a/tests/gtests/alembic/abc_export_test.cc +++ b/tests/gtests/alembic/abc_export_test.cc @@ -4,13 +4,11 @@ #include "exporter/abc_archive.h" #include "intern/abc_util.h" -extern "C" { #include "BKE_main.h" #include "BLI_fileops.h" #include "BLI_math.h" #include "BLI_utildefines.h" #include "DNA_scene_types.h" -} #include "DEG_depsgraph.h" diff --git a/tests/gtests/alembic/abc_matrix_test.cc b/tests/gtests/alembic/abc_matrix_test.cc index fe0635ea7ab..b58e989b1a1 100644 --- a/tests/gtests/alembic/abc_matrix_test.cc +++ b/tests/gtests/alembic/abc_matrix_test.cc @@ -3,10 +3,8 @@ // Keep first since utildefines defines AT which conflicts with STL #include "intern/abc_axis_conversion.h" -extern "C" { #include "BLI_math.h" #include "BLI_utildefines.h" -} namespace blender { namespace io { diff --git a/tests/gtests/blenlib/BLI_array_store_test.cc b/tests/gtests/blenlib/BLI_array_store_test.cc index 5e8548911a2..a1ec8ec7bb3 100644 --- a/tests/gtests/blenlib/BLI_array_store_test.cc +++ b/tests/gtests/blenlib/BLI_array_store_test.cc @@ -4,7 +4,6 @@ #include "MEM_guardedalloc.h" -extern "C" { #include "BLI_array_store.h" #include "BLI_array_utils.h" #include "BLI_listbase.h" @@ -13,7 +12,6 @@ extern "C" { #include "BLI_string.h" #include "BLI_sys_types.h" #include "BLI_utildefines.h" -} /* print memory savings */ // #define DEBUG_PRINT diff --git a/tests/gtests/blenlib/BLI_array_utils_test.cc b/tests/gtests/blenlib/BLI_array_utils_test.cc index d6da9787768..33b4cd35d52 100644 --- a/tests/gtests/blenlib/BLI_array_utils_test.cc +++ b/tests/gtests/blenlib/BLI_array_utils_test.cc @@ -2,11 +2,9 @@ #include "testing/testing.h" -extern "C" { #include "BLI_array_utils.h" #include "BLI_utildefines.h" #include "BLI_utildefines_stack.h" -} /* -------------------------------------------------------------------- */ /* tests */ diff --git a/tests/gtests/blenlib/BLI_delaunay_2d_test.cc b/tests/gtests/blenlib/BLI_delaunay_2d_test.cc index 6065ccc4e57..8d62b111e12 100644 --- a/tests/gtests/blenlib/BLI_delaunay_2d_test.cc +++ b/tests/gtests/blenlib/BLI_delaunay_2d_test.cc @@ -4,13 +4,11 @@ #include "MEM_guardedalloc.h" -extern "C" { #include "BLI_math.h" #include "BLI_rand.h" #include "PIL_time.h" #include "BLI_delaunay_2d.h" -} #include <fstream> #include <iostream> diff --git a/tests/gtests/blenlib/BLI_expr_pylike_eval_test.cc b/tests/gtests/blenlib/BLI_expr_pylike_eval_test.cc index 1b17e6d839e..aad21ae4ad4 100644 --- a/tests/gtests/blenlib/BLI_expr_pylike_eval_test.cc +++ b/tests/gtests/blenlib/BLI_expr_pylike_eval_test.cc @@ -4,10 +4,8 @@ #include <string.h> -extern "C" { #include "BLI_expr_pylike_eval.h" #include "BLI_math.h" -}; #define TRUE_VAL 1.0 #define FALSE_VAL 0.0 diff --git a/tests/gtests/blenlib/BLI_ghash_performance_test.cc b/tests/gtests/blenlib/BLI_ghash_performance_test.cc index 201598869e8..afabbcaae80 100644 --- a/tests/gtests/blenlib/BLI_ghash_performance_test.cc +++ b/tests/gtests/blenlib/BLI_ghash_performance_test.cc @@ -7,13 +7,11 @@ #include "MEM_guardedalloc.h" -extern "C" { #include "BLI_ghash.h" #include "BLI_rand.h" #include "BLI_string.h" #include "BLI_utildefines.h" #include "PIL_time_utildefines.h" -} /* Using http://corpora.uni-leipzig.de/downloads/eng_wikipedia_2010_1M-text.tar.gz * (1 million of words, about 122MB of text) from diff --git a/tests/gtests/blenlib/BLI_ghash_test.cc b/tests/gtests/blenlib/BLI_ghash_test.cc index a4b727e82aa..fcc0512cb9e 100644 --- a/tests/gtests/blenlib/BLI_ghash_test.cc +++ b/tests/gtests/blenlib/BLI_ghash_test.cc @@ -4,11 +4,9 @@ #define GHASH_INTERNAL_API -extern "C" { #include "BLI_ghash.h" #include "BLI_rand.h" #include "BLI_utildefines.h" -} #define TESTCASE_SIZE 10000 diff --git a/tests/gtests/blenlib/BLI_hash_mm2a_test.cc b/tests/gtests/blenlib/BLI_hash_mm2a_test.cc index 4f6570d93ad..c7bea8e15de 100644 --- a/tests/gtests/blenlib/BLI_hash_mm2a_test.cc +++ b/tests/gtests/blenlib/BLI_hash_mm2a_test.cc @@ -2,9 +2,7 @@ #include "testing/testing.h" -extern "C" { #include "BLI_hash_mm2a.h" -} /* Note: Reference results are taken from reference implementation * (cpp code, CMurmurHash2A variant): diff --git a/tests/gtests/blenlib/BLI_heap_simple_test.cc b/tests/gtests/blenlib/BLI_heap_simple_test.cc index f4d614def9e..e717a6e2653 100644 --- a/tests/gtests/blenlib/BLI_heap_simple_test.cc +++ b/tests/gtests/blenlib/BLI_heap_simple_test.cc @@ -5,13 +5,11 @@ #include "MEM_guardedalloc.h" -extern "C" { #include "BLI_compiler_attrs.h" #include "BLI_heap_simple.h" #include "BLI_rand.h" #include "BLI_sys_types.h" #include "BLI_utildefines.h" -}; #define SIZE 1024 diff --git a/tests/gtests/blenlib/BLI_heap_test.cc b/tests/gtests/blenlib/BLI_heap_test.cc index cda13e62bb8..87e68c175a2 100644 --- a/tests/gtests/blenlib/BLI_heap_test.cc +++ b/tests/gtests/blenlib/BLI_heap_test.cc @@ -5,12 +5,10 @@ #include "MEM_guardedalloc.h" -extern "C" { #include "BLI_compiler_attrs.h" #include "BLI_heap.h" #include "BLI_rand.h" #include "BLI_utildefines.h" -}; #define SIZE 1024 diff --git a/tests/gtests/blenlib/BLI_kdopbvh_test.cc b/tests/gtests/blenlib/BLI_kdopbvh_test.cc index 333f7ffbf44..f8a4fc1290a 100644 --- a/tests/gtests/blenlib/BLI_kdopbvh_test.cc +++ b/tests/gtests/blenlib/BLI_kdopbvh_test.cc @@ -6,12 +6,10 @@ #include "MEM_guardedalloc.h" -extern "C" { #include "BLI_compiler_attrs.h" #include "BLI_kdopbvh.h" #include "BLI_math_vector.h" #include "BLI_rand.h" -} #include "stubs/bf_intern_eigen_stubs.h" diff --git a/tests/gtests/blenlib/BLI_listbase_test.cc b/tests/gtests/blenlib/BLI_listbase_test.cc index 32dbd49c8fc..e5b504a0040 100644 --- a/tests/gtests/blenlib/BLI_listbase_test.cc +++ b/tests/gtests/blenlib/BLI_listbase_test.cc @@ -4,13 +4,11 @@ #include "MEM_guardedalloc.h" -extern "C" { #include "BLI_array_utils.h" #include "BLI_listbase.h" #include "BLI_path_util.h" #include "BLI_ressource_strings.h" #include "BLI_string.h" -} /* local validation function */ static bool listbase_is_valid(const ListBase *listbase) diff --git a/tests/gtests/blenlib/BLI_memiter_test.cc b/tests/gtests/blenlib/BLI_memiter_test.cc index 05602dcc1c8..3cc86630005 100644 --- a/tests/gtests/blenlib/BLI_memiter_test.cc +++ b/tests/gtests/blenlib/BLI_memiter_test.cc @@ -4,13 +4,11 @@ #include "MEM_guardedalloc.h" -extern "C" { #include "BLI_array_utils.h" #include "BLI_memiter.h" #include "BLI_ressource_strings.h" #include "BLI_string.h" -} TEST(memiter, Nop) { diff --git a/tests/gtests/blenlib/BLI_path_util_test.cc b/tests/gtests/blenlib/BLI_path_util_test.cc index 734bbc2b31e..c9e6f3357ff 100644 --- a/tests/gtests/blenlib/BLI_path_util_test.cc +++ b/tests/gtests/blenlib/BLI_path_util_test.cc @@ -2,7 +2,6 @@ #include "testing/testing.h" -extern "C" { #include "../../../source/blender/imbuf/IMB_imbuf.h" #include "BLI_fileops.h" #include "BLI_path_util.h" @@ -11,7 +10,6 @@ extern "C" { #ifdef _WIN32 # include "../../../source/blender/blenkernel/BKE_global.h" #endif -} /* -------------------------------------------------------------------- */ /* stubs */ diff --git a/tests/gtests/blenlib/BLI_polyfill_2d_test.cc b/tests/gtests/blenlib/BLI_polyfill_2d_test.cc index 911137bb83b..527a23ac3a8 100644 --- a/tests/gtests/blenlib/BLI_polyfill_2d_test.cc +++ b/tests/gtests/blenlib/BLI_polyfill_2d_test.cc @@ -11,7 +11,6 @@ #include "MEM_guardedalloc.h" -extern "C" { #include "BLI_array_utils.h" #include "BLI_edgehash.h" #include "BLI_math.h" @@ -27,7 +26,6 @@ extern "C" { # include "BLI_memarena.h" # include "BLI_polyfill_2d_beautify.h" #endif -} #include "stubs/bf_intern_eigen_stubs.h" diff --git a/tests/gtests/blenlib/BLI_session_uuid_test.cc b/tests/gtests/blenlib/BLI_session_uuid_test.cc new file mode 100644 index 00000000000..1a5f17be06c --- /dev/null +++ b/tests/gtests/blenlib/BLI_session_uuid_test.cc @@ -0,0 +1,20 @@ +/* Apache License, Version 2.0 */ + +#include "testing/testing.h" + +#include "BLI_session_uuid.h" + +TEST(SessionUUID, GenerateBasic) +{ + { + const SessionUUID uuid = BLI_session_uuid_generate(); + EXPECT_TRUE(BLI_session_uuid_is_generated(&uuid)); + } + + { + const SessionUUID uuid1 = BLI_session_uuid_generate(); + const SessionUUID uuid2 = BLI_session_uuid_generate(); + + EXPECT_FALSE(BLI_session_uuid_is_equal(&uuid1, &uuid2)); + } +} diff --git a/tests/gtests/blenlib/BLI_stack_test.cc b/tests/gtests/blenlib/BLI_stack_test.cc index 359e61c6f47..211916e3193 100644 --- a/tests/gtests/blenlib/BLI_stack_test.cc +++ b/tests/gtests/blenlib/BLI_stack_test.cc @@ -3,11 +3,9 @@ #include "testing/testing.h" #include <string.h> -extern "C" { #include "BLI_array.h" #include "BLI_stack.h" #include "BLI_utildefines.h" -}; #define SIZE 1024 diff --git a/tests/gtests/blenlib/BLI_string_test.cc b/tests/gtests/blenlib/BLI_string_test.cc index aae0c12c8b2..0358a1611f2 100644 --- a/tests/gtests/blenlib/BLI_string_test.cc +++ b/tests/gtests/blenlib/BLI_string_test.cc @@ -9,12 +9,10 @@ #include <utility> #include <vector> -extern "C" { #include "BLI_string.h" #include "BLI_string_utf8.h" #include "BLI_string_utils.h" #include "BLI_utildefines.h" -} using std::initializer_list; using std::pair; diff --git a/tests/gtests/blenlib/BLI_string_utf8_test.cc b/tests/gtests/blenlib/BLI_string_utf8_test.cc index 3e2ade40019..c496f918dc0 100644 --- a/tests/gtests/blenlib/BLI_string_utf8_test.cc +++ b/tests/gtests/blenlib/BLI_string_utf8_test.cc @@ -2,11 +2,9 @@ #include "testing/testing.h" -extern "C" { #include "BLI_string.h" #include "BLI_string_utf8.h" #include "BLI_utildefines.h" -} /* Note that 'common' utf-8 variants of string functions (like copy, etc.) are tested in * BLI_string_test.cc However, tests below are specific utf-8 conformance ones, and since they eat diff --git a/tests/gtests/blenlib/BLI_task_performance_test.cc b/tests/gtests/blenlib/BLI_task_performance_test.cc index 06e832bdb5e..208f168b599 100644 --- a/tests/gtests/blenlib/BLI_task_performance_test.cc +++ b/tests/gtests/blenlib/BLI_task_performance_test.cc @@ -9,7 +9,6 @@ #include "MEM_guardedalloc.h" -extern "C" { #include "BLI_utildefines.h" #include "BLI_listbase.h" @@ -17,7 +16,6 @@ extern "C" { #include "BLI_task.h" #include "PIL_time.h" -} #define NUM_RUN_AVERAGED 100 diff --git a/tests/gtests/blenlib/BLI_task_test.cc b/tests/gtests/blenlib/BLI_task_test.cc index ed300b3f238..3abaf6a6c0b 100644 --- a/tests/gtests/blenlib/BLI_task_test.cc +++ b/tests/gtests/blenlib/BLI_task_test.cc @@ -7,13 +7,11 @@ #include "MEM_guardedalloc.h" -extern "C" { #include "BLI_utildefines.h" #include "BLI_listbase.h" #include "BLI_mempool.h" #include "BLI_task.h" -}; #define NUM_ITEMS 10000 diff --git a/tests/gtests/blenlib/CMakeLists.txt b/tests/gtests/blenlib/CMakeLists.txt index d151dacd7a4..937279bceb9 100644 --- a/tests/gtests/blenlib/CMakeLists.txt +++ b/tests/gtests/blenlib/CMakeLists.txt @@ -68,6 +68,7 @@ BLENDER_TEST(BLI_memiter "bf_blenlib") BLENDER_TEST(BLI_memory_utils "bf_blenlib") BLENDER_TEST(BLI_path_util "${BLI_path_util_extra_libs}") BLENDER_TEST(BLI_polyfill_2d "bf_blenlib") +BLENDER_TEST(BLI_session_uuid "bf_blenlib") BLENDER_TEST(BLI_set "bf_blenlib") BLENDER_TEST(BLI_span "bf_blenlib") BLENDER_TEST(BLI_stack "bf_blenlib") diff --git a/tests/gtests/blenloader/blendfile_loading_base_test.cc b/tests/gtests/blenloader/blendfile_loading_base_test.cc index f15ae615e8a..d74bab4b31c 100644 --- a/tests/gtests/blenloader/blendfile_loading_base_test.cc +++ b/tests/gtests/blenloader/blendfile_loading_base_test.cc @@ -19,7 +19,6 @@ #include "MEM_guardedalloc.h" -extern "C" { #include "BKE_appdir.h" #include "BKE_blender.h" #include "BKE_context.h" @@ -48,7 +47,6 @@ extern "C" { #include "WM_api.h" #include "wm.h" -} BlendfileLoadingBaseTest::~BlendfileLoadingBaseTest() { @@ -100,14 +98,6 @@ void BlendfileLoadingBaseTest::TearDownTestCase() BKE_blender_atexit(); - if (MEM_get_memory_blocks_in_use() != 0) { - size_t mem_in_use = MEM_get_memory_in_use() + MEM_get_memory_in_use(); - printf("Error: Not freed memory blocks: %u, total unfreed memory %f MB\n", - MEM_get_memory_blocks_in_use(), - (double)mem_in_use / 1024 / 1024); - MEM_printmemlist(); - } - BKE_tempdir_session_purge(); testing::Test::TearDownTestCase(); diff --git a/tests/gtests/guardedalloc/guardedalloc_alignment_test.cc b/tests/gtests/guardedalloc/guardedalloc_alignment_test.cc index 4866ac44e3c..4c676c6cc76 100644 --- a/tests/gtests/guardedalloc/guardedalloc_alignment_test.cc +++ b/tests/gtests/guardedalloc/guardedalloc_alignment_test.cc @@ -2,9 +2,7 @@ #include "testing/testing.h" -extern "C" { #include "BLI_utildefines.h" -} #include "MEM_guardedalloc.h" diff --git a/tests/gtests/runner/CMakeLists.txt b/tests/gtests/runner/CMakeLists.txt index 4da0bce09a4..18d8f57364f 100644 --- a/tests/gtests/runner/CMakeLists.txt +++ b/tests/gtests/runner/CMakeLists.txt @@ -69,5 +69,5 @@ gtest_discover_tests(blender_test # So that unit tests know where to find files: EXTRA_ARGS --test-assets-dir "${CMAKE_SOURCE_DIR}/../lib/tests" - --test-release-dir "$<TARGET_FILE_DIR:blender>/${BLENDER_VERSION}" + --test-release-dir "${CMAKE_INSTALL_PREFIX}/${BLENDER_VERSION}" ) diff --git a/tests/gtests/testing/CMakeLists.txt b/tests/gtests/testing/CMakeLists.txt index c8a7f487c5d..d557b27f272 100644 --- a/tests/gtests/testing/CMakeLists.txt +++ b/tests/gtests/testing/CMakeLists.txt @@ -28,6 +28,7 @@ set(INC ${GLOG_INCLUDE_DIRS} ${GFLAGS_INCLUDE_DIRS} ../../../extern/gtest/include + ../../../intern/guardedalloc ) set(INC_SYS @@ -40,6 +41,7 @@ set(SRC ) set(LIB + bf_intern_guardedalloc ) blender_add_lib(bf_testing_main "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/tests/gtests/testing/testing_main.cc b/tests/gtests/testing/testing_main.cc index 0acdcf3a8a5..9816e71526b 100644 --- a/tests/gtests/testing/testing_main.cc +++ b/tests/gtests/testing/testing_main.cc @@ -19,6 +19,8 @@ #include "testing/testing.h" +#include "MEM_guardedalloc.h" + DEFINE_string(test_assets_dir, "", "lib/tests directory from SVN containing the test assets."); DEFINE_string(test_release_dir, "", "bin/{blender version} directory of the current build."); @@ -46,6 +48,7 @@ const std::string &flags_test_release_dir() int main(int argc, char **argv) { + MEM_initialize_memleak_detection(); testing::InitGoogleTest(&argc, argv); BLENDER_GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); google::InitGoogleLogging(argv[0]); diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt index a3df01fdbe2..1b78a938a04 100644 --- a/tests/python/CMakeLists.txt +++ b/tests/python/CMakeLists.txt @@ -337,7 +337,7 @@ add_blender_test( --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/io_tests/export_ply_vertices.ply'\) --md5_source=${TEST_OUT_DIR}/io_tests/export_ply_vertices.ply - --md5=37faba0aa2014451b27f951afa92f870 --md5_method=FILE + --md5=ee6ce2e69c1d9a7418ff0548f6338f70 --md5_method=FILE ) diff --git a/tests/python/cycles_render_tests.py b/tests/python/cycles_render_tests.py index 79ba11fdd44..bdf4283eb3e 100644 --- a/tests/python/cycles_render_tests.py +++ b/tests/python/cycles_render_tests.py @@ -7,6 +7,7 @@ import shlex import shutil import subprocess import sys +from pathlib import Path def get_arguments(filepath, output_filepath): @@ -63,6 +64,12 @@ def main(): report.set_pixelated(True) report.set_reference_dir("cycles_renders") report.set_compare_engines('cycles', 'eevee') + + # Increase threshold for motion blur, see T78777. + test_dir_name = Path(test_dir).name + if test_dir_name == 'motion_blur': + report.set_fail_threshold(0.032) + ok = report.run(test_dir, blender, get_arguments, batch=True) sys.exit(not ok) diff --git a/tests/python/modules/render_report.py b/tests/python/modules/render_report.py index 0cce1791a88..506c1a1518a 100755 --- a/tests/python/modules/render_report.py +++ b/tests/python/modules/render_report.py @@ -104,6 +104,8 @@ class Report: 'reference_dir', 'idiff', 'pixelated', + 'fail_threshold', + 'fail_percent', 'verbose', 'update', 'failed_tests', @@ -118,6 +120,8 @@ class Report: self.reference_dir = 'reference_renders' self.idiff = idiff self.compare_engines = None + self.fail_threshold = 0.016 + self.fail_percent = 1 self.pixelated = False self.verbose = os.environ.get("BLENDER_VERBOSE") is not None @@ -136,6 +140,9 @@ class Report: def set_pixelated(self, pixelated): self.pixelated = pixelated + def set_fail_threshold(self, threshold): + self.fail_threshold = threshold + def set_reference_dir(self, reference_dir): self.reference_dir = reference_dir @@ -366,8 +373,8 @@ class Report: # Diff images test with threshold. command = ( self.idiff, - "-fail", "0.016", - "-failpercent", "1", + "-fail", str(self.fail_threshold), + "-failpercent", str(self.fail_percent), ref_img, tmp_filepath, ) |