diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2019-09-03 16:39:09 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2019-09-03 16:39:09 +0300 |
commit | 37590a6a11d2d8db5b1dd4cc6fd900ece021ed7f (patch) | |
tree | f52323422cfb040ba5d74f4c9f99cbca4a15ad16 | |
parent | d35efde18163fd0820cafd4f19be1ebaad8cdc92 (diff) | |
parent | 51d8facbc3275211841fc90e93875e1af88ca4a0 (diff) |
Merge branch 'master' into filebrowser_redesignfilebrowser_redesign
64 files changed, 744 insertions, 628 deletions
diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index ab8c2254251..f594add3a5b 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -1114,7 +1114,7 @@ run_ldconfig() { WARNING "--no-sudo enabled, impossible to run ldconfig for $1, you'll have to do it yourself..." else INFO "Running ldconfig for $1..." - $SUDO sh -c "echo -e \"$_lib_path\n$_lib64_path\" > $_ldconf_path" + $SUDO sh -c "/bin/echo -e \"$_lib_path\n$_lib64_path\" > $_ldconf_path" $SUDO /sbin/ldconfig # XXX OpenSuse does not include sbin in command path with sudo!!! fi PRINT "" diff --git a/build_files/buildbot/buildbot_utils.py b/build_files/buildbot/buildbot_utils.py new file mode 100644 index 00000000000..6891b91aa1e --- /dev/null +++ b/build_files/buildbot/buildbot_utils.py @@ -0,0 +1,112 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# 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. +# +# ##### END GPL LICENSE BLOCK ##### + +# <pep8 compliant> + +import argparse +import os +import subprocess +import sys + +class Builder: + def __init__(self, name, branch): + self.name = name + self.branch = branch + + # Buildbot runs from build/ directory + self.blender_dir = os.path.abspath(os.path.join('..', 'blender.git')) + self.build_dir = os.path.abspath(os.path.join('..', 'build', name)) + self.install_dir = os.path.abspath(os.path.join('..', 'install', name)) + self.upload_dir = os.path.abspath(os.path.join('..', 'install')) + + # Detect platform + if name.startswith('mac'): + self.platform = 'mac' + self.command_prefix = [] + elif name.startswith('linux'): + self.platform = 'linux' + self.command_prefix = ['scl', 'enable', 'devtoolset-6', '--'] + elif name.startswith('win'): + self.platform = 'win' + self.command_prefix = [] + else: + raise ValueError('Unkonw platform for builder ' + self.platform) + + # Always 64 bit now + self.bits = 64 + +def create_builder_from_arguments(): + parser = argparse.ArgumentParser() + parser.add_argument('builder_name') + parser.add_argument('branch', default='master', nargs='?') + args = parser.parse_args() + return Builder(args.builder_name, args.branch) + + +class VersionInfo: + def __init__(self, builder): + # Get version information + buildinfo_h = os.path.join(builder.build_dir, "source", "creator", "buildinfo.h") + blender_h = os.path.join(builder.blender_dir, "source", "blender", "blenkernel", "BKE_blender_version.h") + + version_number = int(self._parse_header_file(blender_h, 'BLENDER_VERSION')) + self.version = "%d.%d" % (version_number // 100, version_number % 100) + self.version_char = self._parse_header_file(blender_h, 'BLENDER_VERSION_CHAR') + self.version_cycle = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE') + self.version_cycle_number = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE_NUMBER') + self.hash = self._parse_header_file(buildinfo_h, 'BUILD_HASH')[1:-1] + + if self.version_cycle == "release": + # Final release + self.full_version = self.version + self.version_char + self.is_development_build = False + elif self.version_cycle == "rc": + # Release candidate + version_cycle = self.version_cycle + self.version_cycle_number + if len(self.version_char) == 0: + self.full_version = self.version + version_cycle + else: + self.full_version = self.version + self.version_char + '-' + version_cycle + self.is_development_build = False + else: + # Development build + self.full_version = self.version + '-' + self.hash + self.is_development_build = True + + def _parse_header_file(self, filename, define): + import re + regex = re.compile("^#\s*define\s+%s\s+(.*)" % define) + with open(filename, "r") as file: + for l in file: + match = regex.match(l) + if match: + return match.group(1) + return None + + +def call(cmd, env=None, exit_on_error=True): + print(' '.join(cmd)) + + # Flush to ensure correct order output on Windows. + sys.stdout.flush() + sys.stderr.flush() + + retcode = subprocess.call(cmd, env=env) + if exit_on_error and retcode != 0: + sys.exit(retcode) + return retcode diff --git a/build_files/buildbot/slave_compile.py b/build_files/buildbot/slave_compile.py index 55543055e5b..84667e663f6 100644 --- a/build_files/buildbot/slave_compile.py +++ b/build_files/buildbot/slave_compile.py @@ -18,149 +18,80 @@ # <pep8 compliant> +import buildbot_utils import os -import subprocess -import sys import shutil -# get builder name -if len(sys.argv) < 2: - sys.stderr.write("Not enough arguments, expecting builder name\n") - sys.exit(1) - -builder = sys.argv[1] - -# we run from build/ directory -blender_dir = os.path.join('..', 'blender.git') - - -def parse_header_file(filename, define): - import re - regex = re.compile("^#\s*define\s+%s\s+(.*)" % define) - with open(filename, "r") as file: - for l in file: - match = regex.match(l) - if match: - return match.group(1) - return None - -if 'cmake' in builder: - # cmake - - # Some fine-tuning configuration - blender_dir = os.path.abspath(blender_dir) - build_dir = os.path.abspath(os.path.join('..', 'build', builder)) - install_dir = os.path.abspath(os.path.join('..', 'install', builder)) - targets = ['blender'] - command_prefix = [] - - bits = 64 - - # Config file to be used (relative to blender's sources root) - cmake_config_file = "build_files/cmake/config/blender_release.cmake" - - # Set build options. - cmake_options = [] - cmake_extra_options = ['-DCMAKE_BUILD_TYPE:STRING=Release', - '-DWITH_GTESTS=ON'] - - if builder.startswith('mac'): - # Set up OSX architecture - if builder.endswith('x86_64_10_9_cmake'): - cmake_extra_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64') - cmake_extra_options.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9') - - elif builder.startswith('win'): - if builder.startswith('win64'): - cmake_options.extend(['-G', 'Visual Studio 15 2017 Win64']) - elif builder.startswith('win32'): - bits = 32 - cmake_options.extend(['-G', 'Visual Studio 15 2017']) - - elif builder.startswith('linux'): - cmake_config_file = "build_files/buildbot/config/blender_linux.cmake" - tokens = builder.split("_") - glibc = tokens[1] - if glibc == 'glibc224': - deb_name = "stretch" - if builder.endswith('x86_64_cmake'): - chroot_name = 'buildbot_' + deb_name + '_x86_64' - elif builder.endswith('i686_cmake'): - bits = 32 - chroot_name = 'buildbot_' + deb_name + '_i686' - command_prefix = ['schroot', '-c', chroot_name, '--'] - elif glibc == 'glibc217': - command_prefix = ['scl', 'enable', 'devtoolset-6', '--'] - - cmake_options.append("-C" + os.path.join(blender_dir, cmake_config_file)) - - # Prepare CMake options needed to configure cuda binaries compilation, 64bit only. - if bits == 64: - cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=ON") - cmake_options.append("-DCUDA_64_BIT_DEVICE_CODE=ON") - else: - cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=OFF") +def get_cmake_options(builder): + config_file = "build_files/cmake/config/blender_release.cmake" + options = ['-DCMAKE_BUILD_TYPE:STRING=Release', '-DWITH_GTESTS=ON'] + + if builder.platform == 'mac': + options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64') + options.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9') + elif builder.platform == 'win': + options.extend(['-G', 'Visual Studio 15 2017 Win64']) + elif builder.platform == 'linux': + config_file = "build_files/buildbot/config/blender_linux.cmake" + + options.append("-C" + os.path.join(builder.blender_dir, config_file)) + options.append("-DCMAKE_INSTALL_PREFIX=%s" % (builder.install_dir)) + + return options - cmake_options.append("-DCMAKE_INSTALL_PREFIX=%s" % (install_dir)) +def update_git(builder): + # Do extra git fetch because not all platform/git/buildbot combinations + # update the origin remote, causing buildinfo to detect local changes. + os.chdir(builder.blender_dir) - cmake_options += cmake_extra_options + print("Fetching remotes") + command = ['git', 'fetch', '--all'] + buildbot_utils.call(builder.command_prefix + command) +def clean_directories(builder): # Make sure no garbage remained from the previous run - if os.path.isdir(install_dir): - shutil.rmtree(install_dir) - - for target in targets: - print("Building target %s" % (target)) - # Construct build directory name based on the target - target_build_dir = build_dir - target_command_prefix = command_prefix[:] - if target != 'blender': - target_build_dir += '_' + target - target_name = 'install' - # Tweaking CMake options to respect the target - target_cmake_options = cmake_options[:] - # Do extra git fetch because not all platform/git/buildbot combinations - # update the origin remote, causing buildinfo to detect local changes. - os.chdir(blender_dir) - print("Fetching remotes") - command = ['git', 'fetch', '--all'] - print(command) - retcode = subprocess.call(target_command_prefix + command) - if retcode != 0: - sys.exit(retcode) - # Make sure build directory exists and enter it - if not os.path.isdir(target_build_dir): - os.mkdir(target_build_dir) - os.chdir(target_build_dir) - # Configure the build - print("CMake options:") - print(target_cmake_options) - if os.path.exists('CMakeCache.txt'): - print("Removing CMake cache") - os.remove('CMakeCache.txt') - # Remove buildinfo files to force buildbot to re-generate them. - for buildinfo in ('buildinfo.h', 'buildinfo.h.txt', ): - full_path = os.path.join('source', 'creator', buildinfo) - if os.path.exists(full_path): - print("Removing {}" . format(buildinfo)) - os.remove(full_path) - retcode = subprocess.call(target_command_prefix + ['cmake', blender_dir] + target_cmake_options) - if retcode != 0: - print('Configuration FAILED!') - sys.exit(retcode) - - if 'win32' in builder or 'win64' in builder: - command = ['cmake', '--build', '.', '--target', target_name, '--config', 'Release'] - else: - command = ['make', '-s', '-j2', target_name] - - print("Executing command:") - print(command) - retcode = subprocess.call(target_command_prefix + command) - - if retcode != 0: - sys.exit(retcode) - -else: - print("Unknown building system") - sys.exit(1) + if os.path.isdir(builder.install_dir): + shutil.rmtree(builder.install_dir) + + # Make sure build directory exists and enter it + os.makedirs(builder.build_dir, exist_ok=True) + + # Remove buildinfo files to force buildbot to re-generate them. + for buildinfo in ('buildinfo.h', 'buildinfo.h.txt', ): + full_path = os.path.join(builder.build_dir, 'source', 'creator', buildinfo) + if os.path.exists(full_path): + print("Removing {}" . format(buildinfo)) + os.remove(full_path) + +def cmake_configure(builder): + # CMake configuration + os.chdir(builder.build_dir) + + cmake_cache = os.path.join(builder.build_dir, 'CMakeCache.txt') + if os.path.exists(cmake_cache): + print("Removing CMake cache") + os.remove(cmake_cache) + + print("CMake configure:") + cmake_options = get_cmake_options(builder) + command = ['cmake', builder.blender_dir] + cmake_options + buildbot_utils.call(builder.command_prefix + command) + +def cmake_build(builder): + # CMake build + os.chdir(builder.build_dir) + + if builder.platform == 'win': + command = ['cmake', '--build', '.', '--target', 'install', '--config', 'Release'] + else: + command = ['make', '-s', '-j2', 'install'] + + print("CMake build:") + buildbot_utils.call(builder.command_prefix + command) + +if __name__ == "__main__": + builder = buildbot_utils.create_builder_from_arguments() + update_git(builder) + clean_directories(builder) + cmake_configure(builder) + cmake_build(builder) diff --git a/build_files/buildbot/slave_pack.py b/build_files/buildbot/slave_pack.py index b29b078ca85..45331cce61f 100644 --- a/build_files/buildbot/slave_pack.py +++ b/build_files/buildbot/slave_pack.py @@ -22,47 +22,36 @@ # system and zipping it into buildbot_upload.zip. This is then uploaded # to the master in the next buildbot step. +import buildbot_utils import os -import subprocess import sys -import zipfile -# get builder name -if len(sys.argv) < 2: - sys.stderr.write("Not enough arguments, expecting builder name\n") - sys.exit(1) +def get_package_name(builder, platform=None): + info = buildbot_utils.VersionInfo(builder) -builder = sys.argv[1] -# Never write branch if it is master. -branch = sys.argv[2] if (len(sys.argv) >= 3 and sys.argv[2] != 'master') else '' + package_name = 'blender-' + info.full_version + if platform: + package_name += '-' + platform + if builder.branch != 'master' and info.is_development_build: + package_name = builder.branch + "-" + package_name -blender_dir = os.path.join('..', 'blender.git') -build_dir = os.path.join('..', 'build', builder) -install_dir = os.path.join('..', 'install', builder) -buildbot_upload_zip = os.path.abspath(os.path.join(os.path.dirname(install_dir), "buildbot_upload.zip")) + return package_name -upload_filename = None # Name of the archive to be uploaded - # (this is the name of archive which will appear on the - # download page) -upload_filepath = None # Filepath to be uploaded to the server - # (this folder will be packed) +def create_buildbot_upload_zip(builder, package_files): + import zipfile + buildbot_upload_zip = os.path.join(builder.upload_dir, "buildbot_upload.zip") + if os.path.exists(buildbot_upload_zip): + os.remove(buildbot_upload_zip) -def parse_header_file(filename, define): - import re - regex = re.compile("^#\s*define\s+%s\s+(.*)" % define) - with open(filename, "r") as file: - for l in file: - match = regex.match(l) - if match: - return match.group(1) - return None - - -# Make sure install directory always exists -if not os.path.exists(install_dir): - os.makedirs(install_dir) - + try: + z = zipfile.ZipFile(buildbot_upload_zip, "w", compression=zipfile.ZIP_STORED) + for filepath, filename in package_files: + z.write(filepath, arcname=filename) + z.close() + except Exception as ex: + sys.stderr.write('Create buildbot_upload.zip failed: ' + str(ex) + '\n') + sys.exit(1) def create_tar_bz2(src, dest, package_name): # One extra to remove leading os.sep when cleaning root for package_root @@ -80,163 +69,120 @@ def create_tar_bz2(src, dest, package_name): package.add(entry[0], entry[1], recursive=False) package.close() +def cleanup_files(dirpath, extension): + for f in os.listdir(dirpath): + filepath = os.path.join(dirpath, f) + if os.path.isfile(filepath) and f.endswith(extension): + os.remove(filepath) -if builder.find('cmake') != -1: - # CMake - if 'win' in builder or 'mac' in builder: - os.chdir(build_dir) - - files = [f for f in os.listdir('.') if os.path.isfile(f) and f.endswith('.zip')] - for f in files: - os.remove(f) - retcode = subprocess.call(['cpack', '-G', 'ZIP']) - result_file = [f for f in os.listdir('.') if os.path.isfile(f) and f.endswith('.zip')][0] - - # TODO(sergey): Such magic usually happens in SCon's packaging but we don't have it - # in the CMake yet. For until then we do some magic here. - tokens = result_file.split('-') - blender_version = tokens[1].split('.') - blender_full_version = '.'.join(blender_version[0:2]) - git_hash = tokens[2].split('.')[1] - platform = builder.split('_')[0] - if platform == 'mac': - # Special exception for OSX - platform = 'OSX-10.9-' - if builder.endswith('x86_64_10_9_cmake'): - platform += 'x86_64' - if builder.endswith('vc2015'): - platform += "-vc14" - builderified_name = 'blender-{}-{}-{}'.format(blender_full_version, git_hash, platform) - # NOTE: Blender 2.7 is already respected by blender_full_version. - if branch != '' and branch != 'blender2.7': - builderified_name = branch + "-" + builderified_name - - os.rename(result_file, "{}.zip".format(builderified_name)) - # create zip file - try: - if os.path.exists(buildbot_upload_zip): - os.remove(buildbot_upload_zip) - z = zipfile.ZipFile(buildbot_upload_zip, "w", compression=zipfile.ZIP_STORED) - z.write("{}.zip".format(builderified_name)) - z.close() - sys.exit(retcode) - except Exception as ex: - sys.stderr.write('Create buildbot_upload.zip failed' + str(ex) + '\n') - sys.exit(1) - - elif builder.startswith('linux_'): - blender = os.path.join(install_dir, 'blender') - - buildinfo_h = os.path.join(build_dir, "source", "creator", "buildinfo.h") - blender_h = os.path.join(blender_dir, "source", "blender", "blenkernel", "BKE_blender_version.h") - - # Get version information - blender_version = int(parse_header_file(blender_h, 'BLENDER_VERSION')) - blender_version = "%d.%d" % (blender_version // 100, blender_version % 100) - blender_hash = parse_header_file(buildinfo_h, 'BUILD_HASH')[1:-1] - blender_glibc = builder.split('_')[1] - command_prefix = [] - bits = 64 - blender_arch = 'x86_64' - - if blender_glibc == 'glibc224': - if builder.endswith('x86_64_cmake'): - chroot_name = 'buildbot_stretch_x86_64' - elif builder.endswith('i686_cmake'): - chroot_name = 'buildbot_stretch_i686' - bits = 32 - blender_arch = 'i686' - command_prefix = ['schroot', '-c', chroot_name, '--'] - elif blender_glibc == 'glibc217': - command_prefix = ['scl', 'enable', 'devtoolset-6', '--'] - - # Strip all unused symbols from the binaries - print("Stripping binaries...") - subprocess.call(command_prefix + ['strip', '--strip-all', blender]) - - print("Stripping python...") - py_target = os.path.join(install_dir, blender_version) - subprocess.call(command_prefix + ['find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';']) - - # Copy all specific files which are too specific to be copied by - # the CMake rules themselves - print("Copying extra scripts and libs...") - - extra = '/' + os.path.join('home', 'sources', 'release-builder', 'extra') - mesalibs = os.path.join(extra, 'mesalibs' + str(bits) + '.tar.bz2') - software_gl = os.path.join(blender_dir, 'release', 'bin', 'blender-softwaregl') - icons = os.path.join(blender_dir, 'release', 'freedesktop', 'icons') - - os.system('tar -xpf %s -C %s' % (mesalibs, install_dir)) - os.system('cp %s %s' % (software_gl, install_dir)) - os.system('cp -r %s %s' % (icons, install_dir)) - os.system('chmod 755 %s' % (os.path.join(install_dir, 'blender-softwaregl'))) - - # Construct archive name - package_name = 'blender-%s-%s-linux-%s-%s' % (blender_version, - blender_hash, - blender_glibc, - blender_arch) - # NOTE: Blender 2.7 is already respected by blender_full_version. - if branch != '' and branch != 'blender2.7': - package_name = branch + "-" + package_name - - upload_filename = package_name + ".tar.bz2" - - print("Creating .tar.bz2 archive") - upload_filepath = install_dir + '.tar.bz2' - create_tar_bz2(install_dir, upload_filepath, package_name) -else: - print("Unknown building system") - sys.exit(1) - - -if upload_filepath is None: - # clean release directory if it already exists - release_dir = 'release' - - if os.path.exists(release_dir): - for f in os.listdir(release_dir): - if os.path.isfile(os.path.join(release_dir, f)): - os.remove(os.path.join(release_dir, f)) - - # create release package - try: - subprocess.call(['make', 'package_archive']) - except Exception as ex: - sys.stderr.write('Make package release failed' + str(ex) + '\n') - sys.exit(1) - # find release directory, must exist this time - if not os.path.exists(release_dir): - sys.stderr.write("Failed to find release directory %r.\n" % release_dir) - sys.exit(1) +def pack_mac(builder): + info = buildbot_utils.VersionInfo(builder) - # find release package - file = None - filepath = None + os.chdir(builder.build_dir) + cleanup_files(builder.build_dir, '.dmg') - for f in os.listdir(release_dir): - rf = os.path.join(release_dir, f) - if os.path.isfile(rf) and f.startswith('blender'): - file = f - filepath = rf + package_name = get_package_name(builder, 'macOS') + package_filename = package_name + '.dmg' + package_filepath = os.path.join(builder.build_dir, package_filename) - if not file: - sys.stderr.write("Failed to find release package.\n") - sys.exit(1) + release_dir = os.path.join(builder.blender_dir, 'release', 'darwin') + bundle_sh = os.path.join(release_dir, 'bundle.sh') + if info.is_development_build: + background_image = os.path.join(release_dir, 'buildbot', 'background.tif') + + command = [bundle_sh] + command += ['--source', builder.install_dir] + command += ['--dmg', package_filepath] + command += ['--background-image', background_image] + buildbot_utils.call(command) + + create_buildbot_upload_zip(builder, [(package_filepath, package_filename)]) + + +def pack_win(builder): + info = buildbot_utils.VersionInfo(builder) + + os.chdir(builder.build_dir) + cleanup_files(builder.build_dir, '.zip') + + # CPack will add the platform name + cpack_name = get_package_name(builder, None) + package_name = get_package_name(builder, 'windows' + str(builder.bits)) + + command = ['cmake', '-DCPACK_OVERRIDE_PACKAGENAME:STRING=' + cpack_name, '.'] + buildbot_utils.call(builder.command_prefix + command) + command = ['cpack', '-G', 'ZIP'] + buildbot_utils.call(builder.command_prefix + command) + + package_filename = package_name + '.zip' + package_filepath = os.path.join(builder.build_dir, package_filename) + package_files = [(package_filepath, package_filename)] + + if info.version_cycle == 'release': + # Installer only for final release builds, otherwise will get + # 'this product is already installed' messages. + command = ['cpack', '-G', 'WIX'] + buildbot_utils.call(builder.command_prefix + command) + + package_filename = package_name + '.msi' + package_filepath = os.path.join(builder.build_dir, package_filename) + package_files += [(package_filepath, package_filename)] + + create_buildbot_upload_zip(builder, package_files) + + +def pack_linux(builder): + blender_executable = os.path.join(builder.install_dir, 'blender') + + info = buildbot_utils.VersionInfo(builder) + blender_glibc = builder.name.split('_')[1] + blender_arch = 'x86_64' + + # Strip all unused symbols from the binaries + print("Stripping binaries...") + buildbot_utils.call(builder.command_prefix + ['strip', '--strip-all', blender_executable]) + + print("Stripping python...") + py_target = os.path.join(builder.install_dir, info.version) + buildbot_utils.call(builder.command_prefix + ['find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';']) + + # Copy all specific files which are too specific to be copied by + # the CMake rules themselves + print("Copying extra scripts and libs...") + + extra = '/' + os.path.join('home', 'sources', 'release-builder', 'extra') + mesalibs = os.path.join(extra, 'mesalibs' + str(builder.bits) + '.tar.bz2') + software_gl = os.path.join(builder.blender_dir, 'release', 'bin', 'blender-softwaregl') + icons = os.path.join(builder.blender_dir, 'release', 'freedesktop', 'icons') + + os.system('tar -xpf %s -C %s' % (mesalibs, builder.install_dir)) + os.system('cp %s %s' % (software_gl, builder.install_dir)) + os.system('cp -r %s %s' % (icons, builder.install_dir)) + os.system('chmod 755 %s' % (os.path.join(builder.install_dir, 'blender-softwaregl'))) + + # Construct package name + platform_name = 'linux-' + blender_glibc + '-' + blender_arch + package_name = get_package_name(builder, platform_name) + package_filename = package_name + ".tar.bz2" + + print("Creating .tar.bz2 archive") + package_filepath = builder.install_dir + '.tar.bz2' + create_tar_bz2(builder.install_dir, package_filepath, package_name) + + # Create buildbot_upload.zip + create_buildbot_upload_zip(builder, [(package_filepath, package_filename)]) + + +if __name__ == "__main__": + builder = buildbot_utils.create_builder_from_arguments() + + # Make sure install directory always exists + os.makedirs(builder.install_dir, exist_ok=True) - upload_filename = file - upload_filepath = filepath - -# create zip file -try: - upload_zip = os.path.join(buildbot_upload_zip) - if os.path.exists(upload_zip): - os.remove(upload_zip) - z = zipfile.ZipFile(upload_zip, "w", compression=zipfile.ZIP_STORED) - z.write(upload_filepath, arcname=upload_filename) - z.close() -except Exception as ex: - sys.stderr.write('Create buildbot_upload.zip failed' + str(ex) + '\n') - sys.exit(1) + if builder.platform == 'mac': + pack_mac(builder) + elif builder.platform == 'win': + pack_win(builder) + elif builder.platform == 'linux': + pack_linux(builder) diff --git a/build_files/buildbot/slave_rsync.py b/build_files/buildbot/slave_rsync.py index 6936232a495..19f1e67408d 100644 --- a/build_files/buildbot/slave_rsync.py +++ b/build_files/buildbot/slave_rsync.py @@ -21,23 +21,17 @@ # Runs on buildbot slave, rsync zip directly to buildbot server rather # than using upload which is much slower +import buildbot_utils import os import sys -# get builder name -if len(sys.argv) < 2: - sys.stderr.write("Not enough arguments, expecting builder name\n") - sys.exit(1) +if __name__ == "__main__": + builder = buildbot_utils.create_builder_from_arguments() -builder = sys.argv[1] + # rsync, this assumes ssh keys are setup so no password is needed + local_zip = "buildbot_upload.zip" + remote_folder = "builder.blender.org:/data/buildbot-master/uploaded/" + remote_zip = remote_folder + "buildbot_upload_" + builder.name + ".zip" -# rsync, this assumes ssh keys are setup so no password is needed -local_zip = "buildbot_upload.zip" -remote_folder = "builder.blender.org:/data/buildbot-master/uploaded/" -remote_zip = remote_folder + "buildbot_upload_" + builder + ".zip" -command = "rsync -avz %s %s" % (local_zip, remote_zip) - -print(command) - -ret = os.system(command) -sys.exit(ret) + command = ["rsync", "-avz", local_zip, remote_zip] + buildbot_utils.call(command) diff --git a/build_files/buildbot/slave_test.py b/build_files/buildbot/slave_test.py index ff186d8cd45..1b6b426b621 100644 --- a/build_files/buildbot/slave_test.py +++ b/build_files/buildbot/slave_test.py @@ -18,59 +18,39 @@ # <pep8 compliant> -import subprocess +import buildbot_utils import os import sys -# get builder name -if len(sys.argv) < 2: - sys.stderr.write("Not enough arguments, expecting builder name\n") - sys.exit(1) +def get_ctest_environment(builder): + info = buildbot_utils.VersionInfo(builder) + blender_version_dir = os.path.join(builder.install_dir, info.version) -builder = sys.argv[1] + env = os.environ.copy() + env['BLENDER_SYSTEM_SCRIPTS'] = os.path.join(blender_version_dir, 'scripts') + env['BLENDER_SYSTEM_DATAFILES'] = os.path.join(blender_version_dir, 'datafiles') + return env -# we run from build/ directory -blender_dir = '../blender.git' +def get_ctest_arguments(builder): + args = ['--output-on-failure'] + if builder.platform == 'win': + args += ['-C', 'Release'] + return args -if "cmake" in builder: - print("Automated tests are still DISABLED!") - sys.exit(0) - - build_dir = os.path.abspath(os.path.join('..', 'build', builder)) - install_dir = os.path.abspath(os.path.join('..', 'install', builder)) - # NOTE: For quick test only to see if the approach work. - # n the future must be replaced with an actual blender version. - blender_version = '2.80' - blender_version_dir = os.path.join(install_dir, blender_version) - command_prefix = [] - extra_ctest_args = [] +def test(builder): + os.chdir(builder.build_dir) - if builder.startswith('win'): - extra_ctest_args += ['-C', 'Release'] - elif builder.startswith('linux'): - tokens = builder.split("_") - glibc = tokens[1] - if glibc == 'glibc224': - deb_name = "stretch" - if builder.endswith('x86_64_cmake'): - chroot_name = 'buildbot_' + deb_name + '_x86_64' - elif builder.endswith('i686_cmake'): - chroot_name = 'buildbot_' + deb_name + '_i686' - command_prefix = ['schroot', '--preserve-environment', '-c', chroot_name, '--'] - elif glibc == 'glibc217': - command_prefix = ['scl', 'enable', 'devtoolset-6', '--'] + command = builder.command_prefix + ['ctest'] + get_ctest_arguments(builder) + ctest_env = get_ctest_environment(builder) + buildbot_utils.call(command, env=ctest_env, exit_on_error=False) - ctest_env = os.environ.copy() - ctest_env['BLENDER_SYSTEM_SCRIPTS'] = os.path.join(blender_version_dir, 'scripts') - ctest_env['BLENDER_SYSTEM_DATAFILES'] = os.path.join(blender_version_dir, 'datafiles') +if __name__ == "__main__": + print("Automated tests are still DISABLED!") + sys.exit(0) - os.chdir(build_dir) - retcode = subprocess.call(command_prefix + ['ctest', '--output-on-failure'] + extra_ctest_args, - env=ctest_env) + builder = buildbot_utils.create_builder_from_arguments() + test(builder) # Always exit with a success, for until we know all the tests are passing # on all builders. sys.exit(0) -else: - print("Unknown building system") - sys.exit(1) diff --git a/build_files/buildbot/slave_update.py b/build_files/buildbot/slave_update.py index b602cdb9b2f..16b18de3a5d 100644 --- a/build_files/buildbot/slave_update.py +++ b/build_files/buildbot/slave_update.py @@ -18,14 +18,14 @@ # <pep8 compliant> +import buildbot_utils import os -import runpy +import sys -# We run from build/ directory. -blender_dir = os.path.join('..', 'blender.git') -blender_dir = os.path.abspath(blender_dir) -os.chdir(blender_dir) +if __name__ == "__main__": + builder = buildbot_utils.create_builder_from_arguments() + os.chdir(builder.blender_dir) -# Run make update which handles all libraries and submodules. -make_update = os.path.join(blender_dir, "build_files", "utils", "make_update.py") -runpy.run_path(make_update) + # Run make update which handles all libraries and submodules. + make_update = os.path.join(builder.blender_dir, "build_files", "utils", "make_update.py") + buildbot_utils.call([sys.executable, make_update]) diff --git a/release/darwin/buildbot/background.tif b/release/darwin/buildbot/background.tif Binary files differnew file mode 100644 index 00000000000..5253a6bf439 --- /dev/null +++ b/release/darwin/buildbot/background.tif diff --git a/release/darwin/bundle.sh b/release/darwin/bundle.sh index b0f489e6fc2..91ce4f61d37 100755 --- a/release/darwin/bundle.sh +++ b/release/darwin/bundle.sh @@ -54,6 +54,11 @@ while [[ $# -gt 0 ]]; do shift shift ;; + --background-image) + _background_image="$2" + shift + shift + ;; -h|--help) echo "Usage:" echo " $(basename "$0") --source DIR --dmg IMAGENAME " diff --git a/release/datafiles/locale b/release/datafiles/locale -Subproject 61cb42387d1356c168d0e89acaef44a5e365520 +Subproject 6a6b84fd50538a65276c729b5d396be615bc79f diff --git a/release/scripts/addons b/release/scripts/addons -Subproject cbb11b1a597366deabfa1cac11989621bf9075c +Subproject 8d11c9e82893e231b2abc093d815deb79866e03 diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib -Subproject e479f81053badb6548ca9cb8a6f2b22e0a242cb +Subproject 2769f4b5f5f4769cf9115fa7cdd1287540a795b diff --git a/release/scripts/startup/bl_ui/properties_data_empty.py b/release/scripts/startup/bl_ui/properties_data_empty.py index 6650aef61aa..4ce87b85410 100644 --- a/release/scripts/startup/bl_ui/properties_data_empty.py +++ b/release/scripts/startup/bl_ui/properties_data_empty.py @@ -60,6 +60,7 @@ class DATA_PT_empty(DataButtonsPanel, Panel): col.row().prop(ob, "empty_image_side", text="Side", expand=True) col.prop(ob, "show_empty_image_orthographic", text="Display Orthographic") col.prop(ob, "show_empty_image_perspective", text="Display Perspective") + col.prop(ob, "show_empty_image_only_axis_aligned") class DATA_PT_empty_image(DataButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index 836ec53e2e5..f66a363e6ca 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -349,7 +349,7 @@ class TOPBAR_MT_app_about(Menu): layout.separator() layout.operator("wm.url_open_preset", text="Blender Website", icon='URL').type = 'BLENDER' - layout.operator("wm.url_open", text="Credits", icon='URL').type = 'CREDITS' + layout.operator("wm.url_open_preset", text="Credits", icon='URL').type = 'CREDITS' layout.separator() diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index e0f89024420..65086f57616 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -27,7 +27,7 @@ * \note Use #STRINGIFY() rather than defining with quotes. */ #define BLENDER_VERSION 281 -#define BLENDER_SUBVERSION 4 +#define BLENDER_SUBVERSION 5 /** Several breakages with 280, e.g. collections vs layers. */ #define BLENDER_MINVERSION 280 #define BLENDER_MINSUBVERSION 0 @@ -37,6 +37,8 @@ #define BLENDER_VERSION_CHAR /** alpha/beta/rc/release, docs use this. */ #define BLENDER_VERSION_CYCLE alpha +/** Optionally set to 1,2,... for example to to get alpha1 or rc2. */ +#define BLENDER_VERSION_CYCLE_NUMBER /** Defined in from blender.c */ extern char versionstr[]; diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h index 757b1c64db3..0d33d86ec16 100644 --- a/source/blender/blenkernel/BKE_collection.h +++ b/source/blender/blenkernel/BKE_collection.h @@ -70,13 +70,9 @@ struct Collection *BKE_collection_duplicate(struct Main *bmain, const bool do_hierarchy, const bool do_objects, const bool do_obdata); -struct Collection *BKE_collection_copy_master(struct Main *bmain, - struct Collection *collection, - const int flag); /* Master Collection for Scene */ -struct Collection *BKE_collection_master(const struct Scene *scene); struct Collection *BKE_collection_master_add(void); struct Scene *BKE_collection_master_scene_search(const struct Main *bmain, const struct Collection *master_collection); @@ -225,7 +221,7 @@ void BKE_scene_objects_iterator_end(struct BLI_Iterator *iter); bool is_scene_collection = (_scene) != NULL; \ \ if (_scene) { \ - _instance_next = BKE_collection_master(_scene); \ + _instance_next = _scene->master_collection; \ } \ else { \ _instance_next = (_bmain)->collections.first; \ diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index 6bd7440eeea..105f8e82343 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -96,7 +96,7 @@ typedef struct bContextStore { /* for the context's rna mode enum * keep aligned with data_mode_strings in context.c */ -enum eContextObjectMode { +typedef enum eContextObjectMode { CTX_MODE_EDIT_MESH = 0, CTX_MODE_EDIT_CURVE, CTX_MODE_EDIT_SURFACE, @@ -115,7 +115,7 @@ enum eContextObjectMode { CTX_MODE_EDIT_GPENCIL, CTX_MODE_SCULPT_GPENCIL, CTX_MODE_WEIGHT_GPENCIL, -}; +} eContextObjectMode; #define CTX_MODE_NUM (CTX_MODE_WEIGHT_GPENCIL + 1) /* Context */ diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index c8d85cd0c87..261416dc025 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -114,10 +114,7 @@ enum { LIB_ID_CREATE_NO_DEG_TAG | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_CACHES, }; -void BKE_libblock_copy_ex(struct Main *bmain, - const struct ID *id, - struct ID **r_newid, - const int flag); +void BKE_libblock_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, int flag); void *BKE_libblock_copy(struct Main *bmain, const struct ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /* Special version. sued by datablock localization. */ diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 2031576190e..f2098cc2430 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -203,6 +203,9 @@ void BKE_collection_copy_data(Main *bmain, const Collection *collection_src, const int flag) { + BLI_assert(((collection_src->flag & COLLECTION_IS_MASTER) != 0) == + ((collection_src->id.flag & LIB_PRIVATE_DATA) != 0)); + /* Do not copy collection's preview (same behavior as for objects). */ if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0 && false) { /* XXX TODO temp hack */ BKE_previewimg_id_copy(&collection_dst->id, &collection_src->id); @@ -338,8 +341,9 @@ Collection *BKE_collection_duplicate(Main *bmain, const bool do_obdata) { /* It's not allowed to copy the master collection. */ + BLI_assert((collection->id.flag & LIB_PRIVATE_DATA) == 0); + BLI_assert((collection->flag & COLLECTION_IS_MASTER) == 0); if (collection->flag & COLLECTION_IS_MASTER) { - BLI_assert("!Master collection can't be duplicated"); return NULL; } @@ -365,15 +369,6 @@ Collection *BKE_collection_duplicate(Main *bmain, return collection_new; } -Collection *BKE_collection_copy_master(Main *bmain, Collection *collection, const int flag) -{ - BLI_assert(collection->flag & COLLECTION_IS_MASTER); - - Collection *collection_dst = MEM_dupallocN(collection); - BKE_collection_copy_data(bmain, collection_dst, collection, flag); - return collection_dst; -} - void BKE_collection_make_local(Main *bmain, Collection *collection, const bool lib_local) { BKE_id_make_local_generic(bmain, &collection->id, true, lib_local); @@ -499,15 +494,11 @@ Collection *BKE_collection_master_add() /* Not an actual datablock, but owned by scene. */ Collection *master_collection = MEM_callocN(sizeof(Collection), "Master Collection"); STRNCPY(master_collection->id.name, "GRMaster Collection"); + master_collection->id.flag |= LIB_PRIVATE_DATA; master_collection->flag |= COLLECTION_IS_MASTER; return master_collection; } -Collection *BKE_collection_master(const Scene *scene) -{ - return scene->master_collection; -} - Scene *BKE_collection_master_scene_search(const Main *bmain, const Collection *master_collection) { BLI_assert((master_collection->flag & COLLECTION_IS_MASTER) != 0); @@ -584,7 +575,7 @@ bool BKE_collection_has_object_recursive(Collection *collection, Object *ob) static Collection *collection_next_find(Main *bmain, Scene *scene, Collection *collection) { - if (scene && collection == BKE_collection_master(scene)) { + if (scene && collection == scene->master_collection) { return bmain->collections.first; } else { @@ -601,7 +592,7 @@ Collection *BKE_collection_object_find(Main *bmain, collection = collection_next_find(bmain, scene, collection); } else if (scene) { - collection = BKE_collection_master(scene); + collection = scene->master_collection; } else { collection = bmain->collections.first; @@ -743,7 +734,7 @@ void BKE_collection_object_add_from(Main *bmain, Scene *scene, Object *ob_src, O if (!is_instantiated) { /* In case we could not find any non-linked collections in which instantiate our ob_dst, * fallback to scene's master collection... */ - collection_object_add(bmain, BKE_collection_master(scene), ob_dst, 0, true); + collection_object_add(bmain, scene->master_collection, ob_dst, 0, true); } BKE_main_collection_sync(bmain); @@ -885,7 +876,7 @@ void BKE_collections_child_remove_nulls(Main *bmain, Collection *collection) collection_null_children_remove(collection); } for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) { - collection_null_children_remove(BKE_collection_master(scene)); + collection_null_children_remove(scene->master_collection); } for (collection = bmain->collections.first; collection != NULL; @@ -893,7 +884,7 @@ void BKE_collections_child_remove_nulls(Main *bmain, Collection *collection) collection_missing_parents_remove(collection); } for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) { - collection_missing_parents_remove(BKE_collection_master(scene)); + collection_missing_parents_remove(scene->master_collection); } } else { @@ -1169,7 +1160,7 @@ static Collection *collection_from_index_recursive(Collection *collection, Collection *BKE_collection_from_index(Scene *scene, const int index) { int index_current = 0; - Collection *master_collection = BKE_collection_master(scene); + Collection *master_collection = scene->master_collection; return collection_from_index_recursive(master_collection, index, &index_current); } @@ -1363,7 +1354,7 @@ static void scene_collections_array(Scene *scene, Collection ***collections_arra return; } - collection = BKE_collection_master(scene); + collection = scene->master_collection; BLI_assert(collection != NULL); scene_collection_callback(collection, scene_collections_count, tot); diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index f536f21c3e5..bcf6bb338ff 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -1053,7 +1053,7 @@ Collection *CTX_data_collection(const bContext *C) /* fallback */ Scene *scene = CTX_data_scene(C); - return BKE_collection_master(scene); + return scene->master_collection; } enum eContextObjectMode CTX_data_mode_enum_ex(const Object *obedit, diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 0244f11b6f8..4e564b805cc 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -2808,80 +2808,102 @@ static void gpencil_convert_spline(Main *bmain, /* Add stroke to frame.*/ BLI_addtail(&gpf->strokes, gps); - /* Read all segments of the curve. */ float *coord_array = NULL; float init_co[3]; - if (nu->type == CU_BEZIER) { - /* Allocate memory for storage points. */ - gps->totpoints = totpoints; - gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points"); - - int init = 0; - resolu = nu->resolu + 1; - segments = nu->pntsu; - if (((nu->flagu & CU_NURB_CYCLIC) == 0) || (nu->pntsu == 2)) { - segments--; - } - /* Get all interpolated curve points of Beziert */ - for (int s = 0; s < segments; s++) { - int inext = (s + 1) % nu->pntsu; - BezTriple *prevbezt = &nu->bezt[s]; - BezTriple *bezt = &nu->bezt[inext]; - bool last = (bool)(s == segments - 1); - - coord_array = MEM_callocN((size_t)3 * resolu * sizeof(float), __func__); - - for (int j = 0; j < 3; j++) { - BKE_curve_forward_diff_bezier(prevbezt->vec[1][j], - prevbezt->vec[2][j], - bezt->vec[0][j], - bezt->vec[1][j], - coord_array + j, - resolu - 1, - 3 * sizeof(float)); - } - /* Save first point coordinates. */ - if (s == 0) { - copy_v3_v3(init_co, &coord_array[0]); + switch (nu->type) { + case CU_POLY: { + /* Allocate memory for storage points. */ + gps->totpoints = nu->pntsu; + gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points"); + /* Increase thickness for this type. */ + gps->thickness = 10.0f; + + /* Get all curve points */ + for (int s = 0; s < gps->totpoints; s++) { + BPoint *bp = &nu->bp[s]; + bGPDspoint *pt = &gps->points[s]; + copy_v3_v3(&pt->x, bp->vec); + pt->pressure = bp->radius; + pt->strength = 1.0f; } - /* Add points to the stroke */ - gpencil_add_new_points(gps, coord_array, bezt->radius, init, resolu, init_co, last); - /* Free memory. */ - MEM_SAFE_FREE(coord_array); - - /* As the last point of segment is the first point of next segment, back one array - * element to avoid duplicated points on the same location. - */ - init += resolu - 1; + break; } - } - else if (nu->type == CU_NURBS) { - if (nu->pntsv == 1) { + case CU_BEZIER: { + /* Allocate memory for storage points. */ + gps->totpoints = totpoints; + gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points"); - int nurb_points; - if (nu->flagu & CU_NURB_CYCLIC) { - resolu++; - nurb_points = nu->pntsu * resolu; + int init = 0; + resolu = nu->resolu + 1; + segments = nu->pntsu; + if (((nu->flagu & CU_NURB_CYCLIC) == 0) || (nu->pntsu == 2)) { + segments--; } - else { - nurb_points = (nu->pntsu - 1) * resolu; + /* Get all interpolated curve points of Beziert */ + for (int s = 0; s < segments; s++) { + int inext = (s + 1) % nu->pntsu; + BezTriple *prevbezt = &nu->bezt[s]; + BezTriple *bezt = &nu->bezt[inext]; + bool last = (bool)(s == segments - 1); + + coord_array = MEM_callocN((size_t)3 * resolu * sizeof(float), __func__); + + for (int j = 0; j < 3; j++) { + BKE_curve_forward_diff_bezier(prevbezt->vec[1][j], + prevbezt->vec[2][j], + bezt->vec[0][j], + bezt->vec[1][j], + coord_array + j, + resolu - 1, + 3 * sizeof(float)); + } + /* Save first point coordinates. */ + if (s == 0) { + copy_v3_v3(init_co, &coord_array[0]); + } + /* Add points to the stroke */ + gpencil_add_new_points(gps, coord_array, bezt->radius, init, resolu, init_co, last); + /* Free memory. */ + MEM_SAFE_FREE(coord_array); + + /* As the last point of segment is the first point of next segment, back one array + * element to avoid duplicated points on the same location. + */ + init += resolu - 1; } - /* Get all curve points. */ - coord_array = MEM_callocN(sizeof(float[3]) * nurb_points, __func__); - BKE_nurb_makeCurve(nu, coord_array, NULL, NULL, NULL, resolu, sizeof(float[3])); + break; + } + case CU_NURBS: { + if (nu->pntsv == 1) { - /* Allocate memory for storage points. */ - gps->totpoints = nurb_points - 1; - gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points"); + int nurb_points; + if (nu->flagu & CU_NURB_CYCLIC) { + resolu++; + nurb_points = nu->pntsu * resolu; + } + else { + nurb_points = (nu->pntsu - 1) * resolu; + } + /* Get all curve points. */ + coord_array = MEM_callocN(sizeof(float[3]) * nurb_points, __func__); + BKE_nurb_makeCurve(nu, coord_array, NULL, NULL, NULL, resolu, sizeof(float[3])); - /* Add points. */ - gpencil_add_new_points(gps, coord_array, 1.0f, 0, gps->totpoints, init_co, false); + /* Allocate memory for storage points. */ + gps->totpoints = nurb_points - 1; + gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points"); - MEM_SAFE_FREE(coord_array); + /* Add points. */ + gpencil_add_new_points(gps, coord_array, 1.0f, 0, gps->totpoints, init_co, false); + + MEM_SAFE_FREE(coord_array); + } + break; + } + default: { + break; } } - /* Cyclic curve, close stroke. */ if ((cyclic) && (!do_stroke)) { BKE_gpencil_close_stroke(gps); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 5dbc9c318a3..f45eba2b53f 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1408,24 +1408,24 @@ void *BKE_id_new_nomain(const short type, const char *name) return id; } -void BKE_libblock_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag) +void BKE_libblock_copy_ex(Main *bmain, const ID *id, ID **r_newid, int flag) { ID *new_id = *r_newid; - /* Grrrrrrrrr... Not adding 'root' nodetrees to bmain.... grrrrrrrrrrrrrrrrrrrr! */ - /* This is taken from original ntree copy code, might be weak actually? */ - const bool use_nodetree_alloc_exception = ((GS(id->name) == ID_NT) && (bmain != NULL) && - (BLI_findindex(&bmain->nodetrees, id) < 0)); - - /* The id->flag bits to copy over. */ - const int copy_flag_mask = LIB_PRIVATE_DATA; - BLI_assert((flag & LIB_ID_CREATE_NO_MAIN) != 0 || bmain != NULL); BLI_assert((flag & LIB_ID_CREATE_NO_MAIN) != 0 || (flag & LIB_ID_CREATE_NO_ALLOCATE) == 0); BLI_assert((flag & LIB_ID_CREATE_NO_MAIN) == 0 || (flag & LIB_ID_CREATE_NO_USER_REFCOUNT) != 0); /* Never implicitly copy shapekeys when generating temp data outside of Main database. */ BLI_assert((flag & LIB_ID_CREATE_NO_MAIN) == 0 || (flag & LIB_ID_COPY_SHAPEKEY) == 0); + /* 'Private ID' data handling. */ + if ((bmain != NULL) && (id->flag & LIB_PRIVATE_DATA) != 0) { + flag |= LIB_ID_CREATE_NO_MAIN; + } + + /* The id->flag bits to copy over. */ + const int copy_flag_mask = LIB_PRIVATE_DATA; + if ((flag & LIB_ID_CREATE_NO_ALLOCATE) != 0) { /* r_newid already contains pointer to allocated memory. */ /* TODO do we want to memset(0) whole mem before filling it? */ @@ -1435,10 +1435,7 @@ void BKE_libblock_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int fla /* TODO Do we want/need to copy more from ID struct itself? */ } else { - new_id = BKE_libblock_alloc(bmain, - GS(id->name), - id->name + 2, - flag | (use_nodetree_alloc_exception ? LIB_ID_CREATE_NO_MAIN : 0)); + new_id = BKE_libblock_alloc(bmain, GS(id->name), id->name + 2, flag); } BLI_assert(new_id != NULL); diff --git a/source/blender/blenkernel/intern/light.c b/source/blender/blenkernel/intern/light.c index 75c9e0e42a5..07ec8d70af1 100644 --- a/source/blender/blenkernel/intern/light.c +++ b/source/blender/blenkernel/intern/light.c @@ -108,12 +108,15 @@ Light *BKE_light_add(Main *bmain, const char *name) */ void BKE_light_copy_data(Main *bmain, Light *la_dst, const Light *la_src, const int flag) { + /* We never handle usercount here for own data. */ + const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT; + /* We always need allocation of our private ID data. */ + const int flag_private_id_data = flag_subdata & ~LIB_ID_CREATE_NO_ALLOCATE; + la_dst->curfalloff = BKE_curvemapping_copy(la_src->curfalloff); if (la_src->nodetree) { - /* Note: nodetree is *not* in bmain, however this specific case is handled at lower level - * (see BKE_libblock_copy_ex()). */ - BKE_id_copy_ex(bmain, (ID *)la_src->nodetree, (ID **)&la_dst->nodetree, flag); + BKE_id_copy_ex(bmain, (ID *)la_src->nodetree, (ID **)&la_dst->nodetree, flag_private_id_data); } if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) { diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index 7bfe5a7c8ff..e5fa5ff08b0 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -167,6 +167,8 @@ void BKE_linestyle_copy_data(struct Main *bmain, { /* We never handle usercount here for own data. */ const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT; + /* We always need allocation of our private ID data. */ + const int flag_private_id_data = flag_subdata & ~LIB_ID_CREATE_NO_ALLOCATE; for (int a = 0; a < MAX_MTEX; a++) { if (linestyle_src->mtex[a]) { @@ -176,9 +178,10 @@ void BKE_linestyle_copy_data(struct Main *bmain, } if (linestyle_src->nodetree) { - /* Note: nodetree is *not* in bmain, however this specific case is handled at lower level - * (see BKE_libblock_copy_ex()). */ - BKE_id_copy_ex(bmain, (ID *)linestyle_src->nodetree, (ID **)&linestyle_dst->nodetree, flag); + BKE_id_copy_ex(bmain, + (ID *)linestyle_src->nodetree, + (ID **)&linestyle_dst->nodetree, + flag_private_id_data); } LineStyleModifier *m; diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index a2d13ea182b..c12541b3b22 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -198,10 +198,13 @@ Material *BKE_material_add_gpencil(Main *bmain, const char *name) */ void BKE_material_copy_data(Main *bmain, Material *ma_dst, const Material *ma_src, const int flag) { + /* We never handle usercount here for own data. */ + const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT; + /* We always need allocation of our private ID data. */ + const int flag_private_id_data = flag_subdata & ~LIB_ID_CREATE_NO_ALLOCATE; + if (ma_src->nodetree) { - /* Note: nodetree is *not* in bmain, however this specific case is handled at lower level - * (see BKE_libblock_copy_ex()). */ - BKE_id_copy_ex(bmain, (ID *)ma_src->nodetree, (ID **)&ma_dst->nodetree, flag); + BKE_id_copy_ex(bmain, (ID *)ma_src->nodetree, (ID **)&ma_dst->nodetree, flag_private_id_data); } if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) { diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index ae091f32fbf..ed517bfc513 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2985,6 +2985,15 @@ bool BKE_object_empty_image_data_is_visible_in_view3d(const Object *ob, const Re } } + if (visibility_flag & OB_EMPTY_IMAGE_HIDE_NON_AXIS_ALIGNED) { + float proj[3]; + project_plane_v3_v3v3(proj, ob->obmat[2], rv3d->viewinv[2]); + const float proj_length_sq = len_squared_v3(proj); + if (proj_length_sq > 1e-5f) { + return false; + } + } + return true; } @@ -3871,7 +3880,7 @@ int BKE_object_scenes_users_get(Main *bmain, Object *ob) { int num_scenes = 0; for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) { - if (BKE_collection_has_object_recursive(BKE_collection_master(scene), ob)) { + if (BKE_collection_has_object_recursive(scene->master_collection, ob)) { num_scenes++; } } diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index ec73406c14c..514f000d73d 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -1452,7 +1452,7 @@ void BKE_rigidbody_remove_object(Main *bmain, Scene *scene, Object *ob) /* Some users seems to find it funny to use a view-layer instancing collection * as RBW collection... Despite this being a bad (ab)use of the system, avoid losing objects * when we remove them from RB simulation. */ - BKE_collection_object_add(bmain, BKE_collection_master(scene), ob); + BKE_collection_object_add(bmain, scene->master_collection, ob); } BKE_collection_object_remove(bmain, rbw->group, ob, false); } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index ef49c958d37..885ce415ade 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -239,6 +239,8 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons { /* We never handle usercount here for own data. */ const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT; + /* We always need allocation of our private ID data. */ + const int flag_private_id_data = flag_subdata & ~LIB_ID_CREATE_NO_ALLOCATE; sce_dst->ed = NULL; sce_dst->depsgraph_hash = NULL; @@ -246,8 +248,10 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons /* Master Collection */ if (sce_src->master_collection) { - sce_dst->master_collection = BKE_collection_copy_master( - bmain, sce_src->master_collection, flag); + BKE_id_copy_ex(bmain, + (ID *)sce_src->master_collection, + (ID **)&sce_dst->master_collection, + flag_private_id_data); } /* View Layers */ @@ -265,9 +269,8 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons BKE_keyingsets_copy(&(sce_dst->keyingsets), &(sce_src->keyingsets)); if (sce_src->nodetree) { - /* Note: nodetree is *not* in bmain, however this specific case is handled at lower level - * (see BKE_libblock_copy_ex()). */ - BKE_id_copy_ex(bmain, (ID *)sce_src->nodetree, (ID **)&sce_dst->nodetree, flag); + BKE_id_copy_ex( + bmain, (ID *)sce_src->nodetree, (ID **)&sce_dst->nodetree, flag_private_id_data); BKE_libblock_relink_ex(bmain, sce_dst->nodetree, (void *)(&sce_src->id), diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index ad7c5e3f660..5c03b7730aa 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -423,6 +423,11 @@ MTex *BKE_texture_mtex_add_id(ID *id, int slot) */ void BKE_texture_copy_data(Main *bmain, Tex *tex_dst, const Tex *tex_src, const int flag) { + /* We never handle usercount here for own data. */ + const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT; + /* We always need allocation of our private ID data. */ + const int flag_private_id_data = flag_subdata & ~LIB_ID_CREATE_NO_ALLOCATE; + if (!BKE_texture_is_image_user(tex_src)) { tex_dst->ima = NULL; } @@ -434,9 +439,8 @@ void BKE_texture_copy_data(Main *bmain, Tex *tex_dst, const Tex *tex_src, const if (tex_src->nodetree->execdata) { ntreeTexEndExecTree(tex_src->nodetree->execdata); } - /* Note: nodetree is *not* in bmain, however this specific case is handled at lower level - * (see BKE_libblock_copy_ex()). */ - BKE_id_copy_ex(bmain, (ID *)tex_src->nodetree, (ID **)&tex_dst->nodetree, flag); + BKE_id_copy_ex( + bmain, (ID *)tex_src->nodetree, (ID **)&tex_dst->nodetree, flag_private_id_data); } if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) { diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index 109d615ae83..31fc87d7021 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -106,10 +106,14 @@ World *BKE_world_add(Main *bmain, const char *name) */ void BKE_world_copy_data(Main *bmain, World *wrld_dst, const World *wrld_src, const int flag) { + /* We never handle usercount here for own data. */ + const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT; + /* We always need allocation of our private ID data. */ + const int flag_private_id_data = flag_subdata & ~LIB_ID_CREATE_NO_ALLOCATE; + if (wrld_src->nodetree) { - /* Note: nodetree is *not* in bmain, however this specific case is handled at lower level - * (see BKE_libblock_copy_ex()). */ - BKE_id_copy_ex(bmain, (ID *)wrld_src->nodetree, (ID **)&wrld_dst->nodetree, flag); + BKE_id_copy_ex( + bmain, (ID *)wrld_src->nodetree, (ID **)&wrld_dst->nodetree, flag_private_id_data); } BLI_listbase_clear(&wrld_dst->gpumaterial); diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 6bf39ee6e5d..a9f369908e7 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -406,7 +406,7 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) } /* Create collections from layers. */ - Collection *collection_master = BKE_collection_master(scene); + Collection *collection_master = scene->master_collection; Collection *collections[20] = {NULL}; for (int layer = 0; layer < 20; layer++) { @@ -3704,14 +3704,25 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) FOREACH_MAIN_ID_END; } - { - /* Versioning code until next subversion bump goes here. */ + if (!MAIN_VERSION_ATLEAST(bmain, 281, 5)) { for (Brush *br = bmain->brushes.first; br; br = br->id.next) { if (br->ob_mode & OB_MODE_SCULPT && br->normal_radius_factor == 0.0f) { br->normal_radius_factor = 0.5f; } } + LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { + /* Older files do not hqve a msater collection, which is then added through + * `BKE_collection_master_add()`, so everything is fine. */ + if (scene->master_collection != NULL) { + scene->master_collection->id.flag |= LIB_PRIVATE_DATA; + } + } + } + + { + /* Versioning code until next subversion bump goes here. */ + for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h index fd12f90016b..7553eca9b64 100644 --- a/source/blender/depsgraph/DEG_depsgraph.h +++ b/source/blender/depsgraph/DEG_depsgraph.h @@ -108,6 +108,8 @@ void DEG_graph_on_visible_update(struct Main *bmain, Depsgraph *depsgraph, const /* Update all dependency graphs when visible scenes/layers changes. */ void DEG_on_visible_update(struct Main *bmain, const bool do_time); +/* NOTE: Will return NULL if the flag is not known, allowing to gracefully handle situations + * when recalc flag has been removed. */ const char *DEG_update_tag_as_string(IDRecalcFlag flag); void DEG_id_tag_update(struct ID *id, int flag); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index ba6a4756313..c7b545e9feb 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -807,13 +807,25 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) { Object *parent = object->parent; ID *parent_id = &object->parent->id; - ComponentKey ob_key(&object->id, NodeType::TRANSFORM); - /* Type-specific links/ */ + ComponentKey object_transform_key(&object->id, NodeType::TRANSFORM); + /* Type-specific links. */ switch (object->partype) { /* Armature Deform (Virtual Modifier) */ case PARSKEL: { - ComponentKey parent_key(parent_id, NodeType::TRANSFORM); - add_relation(parent_key, ob_key, "Armature Deform Parent"); + ComponentKey parent_transform_key(parent_id, NodeType::TRANSFORM); + add_relation(parent_transform_key, object_transform_key, "Parent Armature Transform"); + + if (parent->type == OB_ARMATURE) { + ComponentKey object_geometry_key(&object->id, NodeType::GEOMETRY); + ComponentKey parent_pose_key(parent_id, NodeType::EVAL_POSE); + add_relation( + parent_transform_key, object_geometry_key, "Parent Armature Transform -> Geometry"); + add_relation(parent_pose_key, object_geometry_key, "Parent Armature Pose -> Geometry"); + + add_depends_on_transform_relation( + &object->id, object_geometry_key, "Virtual Armature Modifier"); + } + break; } @@ -821,7 +833,7 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) case PARVERT1: case PARVERT3: { ComponentKey parent_key(parent_id, NodeType::GEOMETRY); - add_relation(parent_key, ob_key, "Vertex Parent"); + add_relation(parent_key, object_transform_key, "Vertex Parent"); /* Original index is used for optimizations of lookups for subdiv * only meshes. * TODO(sergey): This optimization got lost at 2.8, so either verify @@ -833,7 +845,7 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) DEGCustomDataMeshMasks::MaskFace(CD_MASK_ORIGINDEX) | DEGCustomDataMeshMasks::MaskPoly(CD_MASK_ORIGINDEX)); ComponentKey transform_key(parent_id, NodeType::TRANSFORM); - add_relation(transform_key, ob_key, "Vertex Parent TFM"); + add_relation(transform_key, object_transform_key, "Vertex Parent TFM"); break; } @@ -842,8 +854,8 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) ComponentKey parent_bone_key(parent_id, NodeType::BONE, object->parsubstr); OperationKey parent_transform_key( parent_id, NodeType::TRANSFORM, OperationCode::TRANSFORM_FINAL); - add_relation(parent_bone_key, ob_key, "Bone Parent"); - add_relation(parent_transform_key, ob_key, "Armature Parent"); + add_relation(parent_bone_key, object_transform_key, "Bone Parent"); + add_relation(parent_transform_key, object_transform_key, "Armature Parent"); break; } @@ -852,8 +864,8 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) /* Lattice Deform Parent - Virtual Modifier. */ ComponentKey parent_key(parent_id, NodeType::TRANSFORM); ComponentKey geom_key(parent_id, NodeType::GEOMETRY); - add_relation(parent_key, ob_key, "Lattice Deform Parent"); - add_relation(geom_key, ob_key, "Lattice Deform Parent Geom"); + add_relation(parent_key, object_transform_key, "Lattice Deform Parent"); + add_relation(geom_key, object_transform_key, "Lattice Deform Parent Geom"); } else if (object->parent->type == OB_CURVE) { Curve *cu = (Curve *)object->parent->data; @@ -861,20 +873,20 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) if (cu->flag & CU_PATH) { /* Follow Path. */ ComponentKey parent_key(parent_id, NodeType::GEOMETRY); - add_relation(parent_key, ob_key, "Curve Follow Parent"); + add_relation(parent_key, object_transform_key, "Curve Follow Parent"); ComponentKey transform_key(parent_id, NodeType::TRANSFORM); - add_relation(transform_key, ob_key, "Curve Follow TFM"); + add_relation(transform_key, object_transform_key, "Curve Follow TFM"); } else { /* Standard Parent. */ ComponentKey parent_key(parent_id, NodeType::TRANSFORM); - add_relation(parent_key, ob_key, "Curve Parent"); + add_relation(parent_key, object_transform_key, "Curve Parent"); } } else { /* Standard Parent. */ ComponentKey parent_key(parent_id, NodeType::TRANSFORM); - add_relation(parent_key, ob_key, "Parent"); + add_relation(parent_key, object_transform_key, "Parent"); } break; } @@ -887,7 +899,7 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object) ComponentKey parent_geometry_key(parent_id, NodeType::GEOMETRY); /* NOTE: Metaballs are evaluating geometry only after their transform, * so we only hook up to transform channel here. */ - add_relation(parent_geometry_key, ob_key, "Parent"); + add_relation(parent_geometry_key, object_transform_key, "Parent"); } /* Dupliverts uses original vertex index. */ diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index b73a3c08e10..72ef495f1d5 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -412,11 +412,15 @@ static void graph_id_tag_update_single_flag(Main *bmain, string stringify_append_bit(const string &str, IDRecalcFlag tag) { + const char *tag_name = DEG_update_tag_as_string(tag); + if (tag_name == NULL) { + return str; + } string result = str; if (!result.empty()) { result += ", "; } - result += DEG_update_tag_as_string(tag); + result += tag_name; return result; } @@ -717,8 +721,7 @@ const char *DEG_update_tag_as_string(IDRecalcFlag flag) case ID_RECALC_ALL: return "ALL"; } - BLI_assert(!"Unhandled update flag, should never happen!"); - return "UNKNOWN"; + return NULL; } /* Data-Based Tagging */ diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 3d8a7bb1e30..b64b6f9a788 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -33,6 +33,7 @@ #include "BKE_anim.h" #include "BKE_colortools.h" +#include "BKE_context.h" #include "BKE_curve.h" #include "BKE_editmesh.h" #include "BKE_global.h" @@ -41,6 +42,7 @@ #include "BKE_main.h" #include "BKE_mball.h" #include "BKE_mesh.h" +#include "BKE_modifier.h" #include "BKE_object.h" #include "BKE_particle.h" #include "BKE_paint.h" @@ -2204,24 +2206,43 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, drw_state_prepare_clean_for_draw(&DST); bool use_obedit = false; - int obedit_mode = 0; + /* obedit_ctx_mode is used for selecting the right draw engines */ + eContextObjectMode obedit_ctx_mode; + /* object_mode is used for filtering objects in the depsgraph */ + eObjectMode object_mode; + int object_type = 0; if (obedit != NULL) { + object_type = obedit->type; + object_mode = obedit->mode; if (obedit->type == OB_MBALL) { use_obedit = true; - obedit_mode = CTX_MODE_EDIT_METABALL; + obedit_ctx_mode = CTX_MODE_EDIT_METABALL; } else if (obedit->type == OB_ARMATURE) { use_obedit = true; - obedit_mode = CTX_MODE_EDIT_ARMATURE; + obedit_ctx_mode = CTX_MODE_EDIT_ARMATURE; } } if (v3d->overlay.flag & V3D_OVERLAY_BONE_SELECT) { if (!(v3d->flag2 & V3D_HIDE_OVERLAYS)) { /* Note: don't use "BKE_object_pose_armature_get" here, it breaks selection. */ Object *obpose = OBPOSE_FROM_OBACT(obact); + if (obpose == NULL) { + Object *obweight = OBWEIGHTPAINT_FROM_OBACT(obact); + if (obweight) { + /* Only use Armature pose selection, when connected armature is in pose mode. */ + Object *ob_armature = modifiers_isDeformedByArmature(obweight); + if (ob_armature && ob_armature->mode == OB_MODE_POSE) { + obpose = ob_armature; + } + } + } + if (obpose) { use_obedit = true; - obedit_mode = CTX_MODE_POSE; + object_type = obpose->type; + object_mode = obpose->mode; + obedit_ctx_mode = CTX_MODE_POSE; } } } @@ -2235,8 +2256,8 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, /* Get list of enabled engines */ if (use_obedit) { - drw_engines_enable_from_paint_mode(obedit_mode); - drw_engines_enable_from_mode(obedit_mode); + drw_engines_enable_from_paint_mode(obedit_ctx_mode); + drw_engines_enable_from_mode(obedit_ctx_mode); } else if (!draw_surface) { /* grease pencil selection */ @@ -2283,7 +2304,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, drw_engines_world_update(scene); if (use_obedit) { - FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, obact->type, obact->mode, ob_iter) { + FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, object_type, object_mode, ob_iter) { drw_engines_cache_populate(ob_iter); } FOREACH_OBJECT_IN_MODE_END; diff --git a/source/blender/draw/modes/shaders/object_empty_image_frag.glsl b/source/blender/draw/modes/shaders/object_empty_image_frag.glsl index 7dfbf469adc..e33aa6cdcc1 100644 --- a/source/blender/draw/modes/shaders/object_empty_image_frag.glsl +++ b/source/blender/draw/modes/shaders/object_empty_image_frag.glsl @@ -37,9 +37,15 @@ void main() if (depthMode == DEPTH_BACK) { gl_FragDepth = 0.999999; +#ifdef USE_WIRE + gl_FragDepth -= 1e-5; +#endif } else if (depthMode == DEPTH_FRONT) { gl_FragDepth = 0.000001; +#ifdef USE_WIRE + gl_FragDepth -= 1e-5; +#endif } else if (depthMode == DEPTH_UNCHANGED) { gl_FragDepth = gl_FragCoord.z; diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index f2ef3a60bc5..ee4798430ef 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -139,13 +139,13 @@ bool BMBVH_EdgeVisible(struct BMBVHTree *tree, struct Object *obedit); /* editmesh_automerge.c */ -void EDBM_automerge(struct Scene *scene, struct Object *ob, bool update, const char hflag); -void EDBM_automerge_and_split(struct Scene *scene, - struct Object *ob, +void EDBM_automerge(struct Object *ob, bool update, const char hflag, const float dist); +void EDBM_automerge_and_split(struct Object *ob, bool split_edges, bool split_faces, bool update, - const char hflag); + const char hflag, + const float dist); /* editmesh_undo.c */ void ED_mesh_undosys_type(struct UndoType *ut); diff --git a/source/blender/editors/mesh/editmesh_automerge.c b/source/blender/editors/mesh/editmesh_automerge.c index 62f4fc6bb7d..82f53aafad8 100644 --- a/source/blender/editors/mesh/editmesh_automerge.c +++ b/source/blender/editors/mesh/editmesh_automerge.c @@ -54,7 +54,7 @@ * Used after transform operations. * \{ */ -void EDBM_automerge(Scene *scene, Object *obedit, bool update, const char hflag) +void EDBM_automerge(Object *obedit, bool update, const char hflag, const float dist) { BMEditMesh *em = BKE_editmesh_from_object(obedit); BMesh *bm = em->bm; @@ -69,7 +69,7 @@ void EDBM_automerge(Scene *scene, Object *obedit, bool update, const char hflag) BMO_FLAG_DEFAULTS, "find_doubles verts=%av keep_verts=%Hv dist=%f", hflag, - scene->toolsettings->doublimit); + dist); BMO_op_exec(bm, &findop); @@ -286,18 +286,17 @@ static int edbm_automerge_and_split_sort_cmp_by_keys_cb(const void *index1_v, } } -void EDBM_automerge_and_split(Scene *scene, - Object *obedit, +void EDBM_automerge_and_split(Object *obedit, bool split_edges, bool split_faces, bool update, - const char hflag) + const char hflag, + const float dist) { bool ok = false; BMEditMesh *em = BKE_editmesh_from_object(obedit); BMesh *bm = em->bm; - float dist = scene->toolsettings->doublimit; BMOperator findop, weldop; BMOpSlot *slot_targetmap; BMIter iter; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index b88b6cbb3a6..e5023068100 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -3131,12 +3131,7 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op) BM_mesh_elem_hflag_enable_test(em->bm, htype_select, BM_ELEM_TAG, true, true, BM_ELEM_SELECT); if (use_unselected) { - EDBM_op_init(em, &bmop, op, "automerge verts=%hv dist=%f", BM_ELEM_SELECT, threshold); - BMO_op_exec(em->bm, &bmop); - - if (!EDBM_op_finish(em, &bmop, op, true)) { - continue; - } + EDBM_automerge(obedit, false, BM_ELEM_SELECT, threshold); } else { EDBM_op_init(em, &bmop, op, "find_doubles verts=%hv dist=%f", BM_ELEM_SELECT, threshold); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 0c2b5292716..33c7ffefb8b 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1691,7 +1691,7 @@ static int move_to_collection_invoke(bContext *C, wmOperator *op, const wmEvent return move_to_collection_exec(C, op); } - Collection *master_collection = BKE_collection_master(scene); + Collection *master_collection = scene->master_collection; /* We need the data to be allocated so it's available during menu drawing. * Technically we could use wmOperator->customdata. However there is no free callback diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index df684bfc210..06c360ed1cd 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1434,7 +1434,7 @@ static int make_links_scene_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - Collection *collection_to = BKE_collection_master(scene_to); + Collection *collection_to = scene_to->master_collection; CTX_DATA_BEGIN (C, Base *, base, selected_bases) { BKE_collection_object_add(bmain, collection_to, base->object); } @@ -1771,7 +1771,7 @@ static void single_object_users( Main *bmain, Scene *scene, View3D *v3d, const int flag, const bool copy_collections) { /* duplicate all the objects of the scene (and matching collections, if required). */ - Collection *master_collection = BKE_collection_master(scene); + Collection *master_collection = scene->master_collection; single_object_users_collection(bmain, scene, master_collection, flag, copy_collections, true); /* duplicate collections that consist entirely of duplicated objects */ diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 525b73dd71b..b37aa47aba6 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -309,22 +309,26 @@ int area_getorientation(ScrArea *sa, ScrArea *sb) int tolerance = U.pixelsize * 4; if (saBL->vec.x == sbBR->vec.x && saTL->vec.x == sbTR->vec.x) { /* sa to right of sb = W */ - if (ABS(saBL->vec.y - sbBR->vec.y) <= tolerance) { + if ((ABS(saBL->vec.y - sbBR->vec.y) <= tolerance) && + (ABS(saTL->vec.y - sbTR->vec.y) <= tolerance)) { return 0; } } else if (saTL->vec.y == sbBL->vec.y && saTR->vec.y == sbBR->vec.y) { /* sa to bottom of sb = N */ - if (ABS(saTL->vec.x - sbBL->vec.x) <= tolerance) { + if ((ABS(saTL->vec.x - sbBL->vec.x) <= tolerance) && + (ABS(saTR->vec.x - sbBR->vec.x) <= tolerance)) { return 1; } } else if (saTR->vec.x == sbTL->vec.x && saBR->vec.x == sbBL->vec.x) { /* sa to left of sb = E */ - if (ABS(saTR->vec.y - sbTL->vec.y) <= tolerance) { + if ((ABS(saTR->vec.y - sbTL->vec.y) <= tolerance) && + (ABS(saBR->vec.y - sbBL->vec.y) <= tolerance)) { return 2; } } else if (saBL->vec.y == sbTL->vec.y && saBR->vec.y == sbTR->vec.y) { /* sa on top of sb = S*/ - if (ABS(saBL->vec.x - sbTL->vec.x) <= tolerance) { + if ((ABS(saBL->vec.x - sbTL->vec.x) <= tolerance) && + (ABS(saBR->vec.x - sbTR->vec.x) <= tolerance)) { return 3; } } diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c index 4740c412083..309446db83b 100644 --- a/source/blender/editors/space_outliner/outliner_collections.c +++ b/source/blender/editors/space_outliner/outliner_collections.c @@ -89,7 +89,7 @@ Collection *outliner_collection_from_tree_element(const TreeElement *te) } else if (ELEM(tselem->type, TSE_SCENE_COLLECTION_BASE, TSE_VIEW_COLLECTION_BASE)) { Scene *scene = (Scene *)tselem->id; - return BKE_collection_master(scene); + return scene->master_collection; } else if (tselem->type == 0 && te->idcode == ID_GR) { return (Collection *)tselem->id; @@ -199,7 +199,7 @@ static int collection_new_exec(bContext *C, wmOperator *op) } if (data.collection == NULL || ID_IS_LINKED(data.collection)) { - data.collection = BKE_collection_master(scene); + data.collection = scene->master_collection; } if (ID_IS_LINKED(scene)) { @@ -514,14 +514,14 @@ static int collection_duplicate_exec(bContext *C, wmOperator *op) * This can happen when a whole scene is linked e.g. */ if (parent != NULL && ID_IS_LINKED(parent)) { Scene *scene = CTX_data_scene(C); - parent = ID_IS_LINKED(scene) ? NULL : BKE_collection_master(scene); + parent = ID_IS_LINKED(scene) ? NULL : scene->master_collection; } else if (parent != NULL && (parent->flag & COLLECTION_IS_MASTER) != 0) { Scene *scene = BKE_collection_master_scene_search(bmain, parent); BLI_assert(scene != NULL); if (ID_IS_LINKED(scene)) { scene = CTX_data_scene(C); - parent = ID_IS_LINKED(scene) ? NULL : BKE_collection_master(scene); + parent = ID_IS_LINKED(scene) ? NULL : scene->master_collection; } } diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c index 6031ba5cffc..6e30157d216 100644 --- a/source/blender/editors/space_outliner/outliner_dragdrop.c +++ b/source/blender/editors/space_outliner/outliner_dragdrop.c @@ -537,7 +537,7 @@ static int scene_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent Collection *collection; if (scene != CTX_data_scene(C)) { /* when linking to an inactive scene link to the master collection */ - collection = BKE_collection_master(scene); + collection = scene->master_collection; } else { collection = CTX_data_collection(C); @@ -967,7 +967,7 @@ static int outliner_item_drag_drop_invoke(bContext *C, } else { Scene *scene = CTX_data_scene(C); - parent = BKE_collection_master(scene); + parent = scene->master_collection; } WM_drag_add_ID(drag, id, &parent->id); diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 002926c55d2..a2d988f1142 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -299,7 +299,7 @@ static void unlink_collection_cb(bContext *C, } else if (GS(tsep->id->name) == ID_SCE) { Scene *scene = (Scene *)tsep->id; - Collection *parent = BKE_collection_master(scene); + Collection *parent = scene->master_collection; id_fake_user_set(&collection->id); BKE_collection_child_remove(bmain, parent, collection); DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE); @@ -338,7 +338,7 @@ static void unlink_object_cb(bContext *C, } else if (GS(tsep->id->name) == ID_SCE) { Scene *scene = (Scene *)tsep->id; - Collection *parent = BKE_collection_master(scene); + Collection *parent = scene->master_collection; BKE_collection_object_remove(bmain, parent, ob, true); DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE); DEG_relations_tag_update(bmain); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 6478928a6b6..c344b6c8649 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -3520,7 +3520,7 @@ static void initShear_mouseInputMode(TransInfo *t) copy_v3_v3(dir, t->orient_matrix[t->orient_axis_ortho]); } else { - cross_v3_v3v3(dir, t->orient_matrix[t->orient_axis_ortho], t->orient_matrix[t->orient_axis]); + cross_v3_v3v3(dir, t->orient_matrix[t->orient_axis], t->orient_matrix[t->orient_axis_ortho]); } /* Without this, half the gizmo handles move in the opposite direction. */ diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 887d4bcf0e8..328cb1d1bbf 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -7128,10 +7128,11 @@ static void special_aftertrans_update__mesh(bContext *UNUSED(C), TransInfo *t) if (t->scene->toolsettings->automerge & AUTO_MERGE) { if (t->scene->toolsettings->automerge & AUTO_MERGE_AND_SPLIT) { - EDBM_automerge_and_split(t->scene, tc->obedit, true, true, true, hflag); + EDBM_automerge_and_split( + tc->obedit, true, true, true, hflag, t->scene->toolsettings->doublimit); } else { - EDBM_automerge(t->scene, tc->obedit, true, hflag); + EDBM_automerge(tc->obedit, true, hflag, t->scene->toolsettings->doublimit); } } diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 1be206e921a..604c5bbc083 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -573,7 +573,7 @@ void Transform_Properties(struct wmOperatorType *ot, int flags) if (flags & P_ORIENT_AXIS_ORTHO) { prop = RNA_def_property(ot->srna, "orient_axis_ortho", PROP_ENUM, PROP_NONE); RNA_def_property_ui_text(prop, "Axis Ortho", ""); - RNA_def_property_enum_default(prop, 1); + RNA_def_property_enum_default(prop, 0); RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items); RNA_def_property_flag(prop, PROP_SKIP_SAVE); } diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index 984a2d01a68..98da8e8f6d3 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -865,7 +865,7 @@ Object *BlenderStrokeRenderer::NewMesh() const BLI_snprintf(name, MAX_ID_NAME, "0%08xME", mesh_id); ob->data = BKE_mesh_add(freestyle_bmain, name); - Collection *collection_master = BKE_collection_master(freestyle_scene); + Collection *collection_master = freestyle_scene->master_collection; BKE_collection_object_add(freestyle_bmain, collection_master, ob); DEG_graph_tag_relations_update(freestyle_depsgraph); diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 613871b1fee..ff1839f997c 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -686,6 +686,7 @@ enum { OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC = 1 << 1, OB_EMPTY_IMAGE_HIDE_BACK = 1 << 2, OB_EMPTY_IMAGE_HIDE_FRONT = 1 << 3, + OB_EMPTY_IMAGE_HIDE_NON_AXIS_ALIGNED = 1 << 4, }; /** #Object.empty_image_flag */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 5f5bd3142c4..5e96759bc90 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -2002,6 +2002,8 @@ extern const char *RE_engine_id_CYCLES; (((workspace)->object_mode & OD_MODE_EDIT) ? OBACT(_view_layer) : NULL) #define OBEDIT_FROM_OBACT(ob) ((ob) ? (((ob)->mode & OB_MODE_EDIT) ? ob : NULL) : NULL) #define OBPOSE_FROM_OBACT(ob) ((ob) ? (((ob)->mode & OB_MODE_POSE) ? ob : NULL) : NULL) +#define OBWEIGHTPAINT_FROM_OBACT(ob) \ + ((ob) ? (((ob)->mode & OB_MODE_WEIGHT_PAINT) ? ob : NULL) : NULL) #define OBEDIT_FROM_VIEW_LAYER(view_layer) OBEDIT_FROM_OBACT(OBACT(view_layer)) #define V3D_CAMERA_LOCAL(v3d) ((!(v3d)->scenelock && (v3d)->camera) ? (v3d)->camera : NULL) diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index c1199ac94b6..f9f05348c5c 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -1168,7 +1168,7 @@ char *RNA_path_from_real_ID_to_property_index(struct Main *bmain, PropertyRNA *prop, int array_dim, int index, - struct ID **r_real); + struct ID **r_real_id); char *RNA_path_resolve_from_type_to_property(struct PointerRNA *ptr, struct PropertyRNA *prop, diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index bc015a378cc..61634a84d41 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -41,6 +41,7 @@ #include "BLT_translation.h" #include "BKE_animsys.h" +#include "BKE_collection.h" #include "BKE_context.h" #include "BKE_idcode.h" #include "BKE_idprop.h" @@ -5778,6 +5779,11 @@ ID *RNA_find_real_ID_and_path(Main *bmain, ID *id, const char **r_path) *r_path = "node_tree"; } return BKE_node_tree_find_owner_ID(bmain, (bNodeTree *)id); + case ID_GR: + if (r_path) { + *r_path = "collection"; + } + return (ID *)BKE_collection_master_scene_search(bmain, (Collection *)id); default: return NULL; @@ -5788,15 +5794,23 @@ ID *RNA_find_real_ID_and_path(Main *bmain, ID *id, const char **r_path) } } -static char *rna_prepend_real_ID_path(Main *bmain, ID *id, char *path, ID **r_real) +static char *rna_prepend_real_ID_path(Main *bmain, ID *id, char *path, ID **r_real_id) { - if (path) { - const char *prefix; - char *new_path = NULL; + if (r_real_id != NULL) { + *r_real_id = NULL; + } - *r_real = RNA_find_real_ID_and_path(bmain, id, &prefix); + const char *prefix; + ID *real_id = RNA_find_real_ID_and_path(bmain, id, &prefix); - if (*r_real) { + if (r_real_id != NULL) { + *r_real_id = real_id; + } + + if (path != NULL) { + char *new_path = NULL; + + if (real_id) { if (prefix[0]) { new_path = BLI_sprintfN("%s%s%s", prefix, path[0] == '[' ? "" : ".", path); } @@ -5809,7 +5823,7 @@ static char *rna_prepend_real_ID_path(Main *bmain, ID *id, char *path, ID **r_re return new_path; } else { - return NULL; + return prefix[0] != '\0' ? BLI_strdup(prefix) : NULL; } } @@ -5969,11 +5983,11 @@ char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop) } char *RNA_path_from_real_ID_to_property_index( - Main *bmain, PointerRNA *ptr, PropertyRNA *prop, int index_dim, int index, ID **r_real) + Main *bmain, PointerRNA *ptr, PropertyRNA *prop, int index_dim, int index, ID **r_real_id) { char *path = RNA_path_from_ID_to_property_index(ptr, prop, index_dim, index); - return rna_prepend_real_ID_path(bmain, ptr->owner_id, path, r_real); + return rna_prepend_real_ID_path(bmain, ptr->owner_id, path, r_real_id); } /** diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index b6b759882b3..4f8e63e975f 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -1683,10 +1683,12 @@ static void rna_def_drivertarget(BlenderRNA *brna) {DTAR_TRANSCHAN_LOCX, "LOC_X", 0, "X Location", ""}, {DTAR_TRANSCHAN_LOCY, "LOC_Y", 0, "Y Location", ""}, {DTAR_TRANSCHAN_LOCZ, "LOC_Z", 0, "Z Location", ""}, + {0, "", 0, NULL, NULL}, {DTAR_TRANSCHAN_ROTX, "ROT_X", 0, "X Rotation", ""}, {DTAR_TRANSCHAN_ROTY, "ROT_Y", 0, "Y Rotation", ""}, {DTAR_TRANSCHAN_ROTZ, "ROT_Z", 0, "Z Rotation", ""}, {DTAR_TRANSCHAN_ROTW, "ROT_W", 0, "W Rotation", ""}, + {0, "", 0, NULL, NULL}, {DTAR_TRANSCHAN_SCALEX, "SCALE_X", 0, "X Scale", ""}, {DTAR_TRANSCHAN_SCALEY, "SCALE_Y", 0, "Y Scale", ""}, {DTAR_TRANSCHAN_SCALEZ, "SCALE_Z", 0, "Z Scale", ""}, diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 3c0fd282b17..c8a0d543b70 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -2821,6 +2821,14 @@ static void rna_def_object(BlenderRNA *brna) prop, "Display in Orthographic Mode", "Display image in orthographic mode"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); + prop = RNA_def_property(srna, "show_empty_image_only_axis_aligned", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna( + prop, NULL, "empty_image_visibility_flag", OB_EMPTY_IMAGE_HIDE_NON_AXIS_ALIGNED); + RNA_def_property_ui_text(prop, + "Display Only Axis Aligned", + "Only display the image when it is aligned with the view axis"); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); + prop = RNA_def_property(srna, "use_empty_image_alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "empty_image_flag", OB_EMPTY_IMAGE_USE_ALPHA_BLEND); RNA_def_property_ui_text( diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 2ab08c82b63..2015356d071 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -835,7 +835,7 @@ static void rna_def_texture_clouds(BlenderRNA *brna) prop = RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "noisedepth"); RNA_def_property_range(prop, 0, 30); - RNA_def_property_ui_range(prop, 0, 24, 0, 2); + RNA_def_property_ui_range(prop, 0, 24, 1, 2); RNA_def_property_ui_text(prop, "Noise Depth", "Depth of the cloud calculation"); RNA_def_property_update(prop, 0, "rna_Texture_nodes_update"); @@ -974,7 +974,7 @@ static void rna_def_texture_marble(BlenderRNA *brna) prop = RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "noisedepth"); RNA_def_property_range(prop, 0, 30); - RNA_def_property_ui_range(prop, 0, 24, 0, 2); + RNA_def_property_ui_range(prop, 0, 24, 1, 2); RNA_def_property_ui_text(prop, "Noise Depth", "Depth of the cloud calculation"); RNA_def_property_update(prop, 0, "rna_Texture_update"); @@ -1028,7 +1028,7 @@ static void rna_def_texture_magic(BlenderRNA *brna) prop = RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "noisedepth"); RNA_def_property_range(prop, 0, 30); - RNA_def_property_ui_range(prop, 0, 24, 0, 2); + RNA_def_property_ui_range(prop, 0, 24, 1, 2); RNA_def_property_ui_text(prop, "Noise Depth", "Depth of the noise"); RNA_def_property_update(prop, 0, "rna_Texture_update"); } diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 5116fefde94..1ae1f891e6f 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -141,6 +141,10 @@ if(WITH_MOD_OCEANSIM) add_definitions(-DWITH_OCEANSIM) endif() +if(WITH_OPENSUBDIV) + add_definitions(-DWITH_OPENSUBDIV) +endif() + if(WITH_BULLET) list(APPEND LIB extern_bullet diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index c64d9be1158..dd7c001931c 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -168,6 +168,10 @@ static Mesh *multires_as_ccg(MultiresModifierData *mmd, static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh) { Mesh *result = mesh; +#if !defined(WITH_OPENSUBDIV) + modifier_setError(md, "Disabled, built without OpenSubdiv"); + return result; +#endif MultiresModifierData *mmd = (MultiresModifierData *)md; SubdivSettings subdiv_settings; BKE_multires_subdiv_settings_init(&subdiv_settings, mmd); diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index 0b1249e263c..08a884fa879 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -208,6 +208,10 @@ static SubsurfRuntimeData *subsurf_ensure_runtime(SubsurfModifierData *smd) static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh) { Mesh *result = mesh; +#if !defined(WITH_OPENSUBDIV) + modifier_setError(md, "Disabled, built without OpenSubdiv"); + return result; +#endif SubsurfModifierData *smd = (SubsurfModifierData *)md; SubdivSettings subdiv_settings; subdiv_settings_init(&subdiv_settings, smd); diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index fc945562c98..a5f71e92438 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -231,6 +231,10 @@ if(WITH_OPENAL) add_definitions(-DWITH_OPENAL) endif() +if(WITH_OPENSUBDIV) + add_definitions(-DWITH_OPENSUBDIV) +endif() + if(WITH_SDL) list(APPEND INC_SYS ${SDL_INCLUDE_DIR} diff --git a/source/blender/python/intern/bpy_app_build_options.c b/source/blender/python/intern/bpy_app_build_options.c index a841e974e85..afb2f6b3636 100644 --- a/source/blender/python/intern/bpy_app_build_options.c +++ b/source/blender/python/intern/bpy_app_build_options.c @@ -46,6 +46,7 @@ static PyStructSequence_Field app_builtopts_info_fields[] = { {(char *)"audaspace", NULL}, {(char *)"international", NULL}, {(char *)"openal", NULL}, + {(char *)"opensubdiv", NULL}, {(char *)"sdl", NULL}, {(char *)"sdl_dynload", NULL}, {(char *)"jack", NULL}, @@ -190,6 +191,12 @@ static PyObject *make_builtopts_info(void) SetObjIncref(Py_False); #endif +#ifdef WITH_OPENSUBDIV + SetObjIncref(Py_True); +#else + SetObjIncref(Py_False); +#endif + #ifdef WITH_SDL SetObjIncref(Py_True); #else diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index b85d48b67da..12005b92388 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -918,21 +918,21 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self) tmp_str = PyUnicode_FromString(id->name + 2); - if (RNA_struct_is_ID(self->ptr.type)) { + if (RNA_struct_is_ID(self->ptr.type) && (id->flag & LIB_PRIVATE_DATA) == 0) { ret = PyUnicode_FromFormat( "bpy.data.%s[%R]", BKE_idcode_to_name_plural(GS(id->name)), tmp_str); } else { const char *path; - path = RNA_path_from_ID_to_struct(&self->ptr); + ID *real_id = NULL; + path = RNA_path_from_real_ID_to_struct(G_MAIN, &self->ptr, &real_id); if (path) { - if (GS(id->name) == ID_NT) { /* Nodetree paths are not accurate. */ - ret = PyUnicode_FromFormat("bpy.data...%s", path); - } - else { - ret = PyUnicode_FromFormat( - "bpy.data.%s[%R].%s", BKE_idcode_to_name_plural(GS(id->name)), tmp_str, path); + if (real_id != id) { + Py_DECREF(tmp_str); + tmp_str = PyUnicode_FromString(real_id->name + 2); } + ret = PyUnicode_FromFormat( + "bpy.data.%s[%R].%s", BKE_idcode_to_name_plural(GS(real_id->name)), tmp_str, path); MEM_freeN((void *)path); } @@ -1033,20 +1033,23 @@ static PyObject *pyrna_prop_repr_ex(BPy_PropertyRNA *self, const int index_dim, tmp_str = PyUnicode_FromString(id->name + 2); - path = RNA_path_from_ID_to_property_index(&self->ptr, self->prop, index_dim, index); + /* Note that using G_MAIN is absolutely not ideal, but we have no access to actual Main DB from + * here. */ + ID *real_id = NULL; + path = RNA_path_from_real_ID_to_property_index( + G_MAIN, &self->ptr, self->prop, index_dim, index, &real_id); if (path) { - const char *data_delim = (path[0] == '[') ? "" : "."; - if (GS(id->name) == ID_NT) { /* Nodetree paths are not accurate. */ - ret = PyUnicode_FromFormat("bpy.data...%s", path); - } - else { - ret = PyUnicode_FromFormat("bpy.data.%s[%R]%s%s", - BKE_idcode_to_name_plural(GS(id->name)), - tmp_str, - data_delim, - path); + if (real_id != id) { + Py_DECREF(tmp_str); + tmp_str = PyUnicode_FromString(real_id->name + 2); } + const char *data_delim = (path[0] == '[') ? "" : "."; + ret = PyUnicode_FromFormat("bpy.data.%s[%R]%s%s", + BKE_idcode_to_name_plural(GS(real_id->name)), + tmp_str, + data_delim, + path); MEM_freeN((void *)path); } diff --git a/source/blender/windowmanager/intern/wm_splash_screen.c b/source/blender/windowmanager/intern/wm_splash_screen.c index 8629997030f..d3f7661a008 100644 --- a/source/blender/windowmanager/intern/wm_splash_screen.c +++ b/source/blender/windowmanager/intern/wm_splash_screen.c @@ -113,31 +113,37 @@ static void wm_block_splash_add_label(uiBlock *block, const char *label, int x, static void wm_block_splash_add_labels(uiBlock *block, int x, int y) { /* Version number. */ - const char *version_suffix = NULL; + const char *version_cycle = NULL; bool show_build_info = true; if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "alpha")) { - version_suffix = " Alpha"; + version_cycle = " Alpha"; } else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "beta")) { - version_suffix = " Beta"; + version_cycle = " Beta"; } else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "rc")) { - version_suffix = " Release Candidate"; + version_cycle = " Release Candidate"; show_build_info = false; } else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "release")) { - version_suffix = STRINGIFY(BLENDER_VERSION_CHAR); + version_cycle = STRINGIFY(BLENDER_VERSION_CHAR); show_build_info = false; } + const char *version_cycle_number = ""; + if (strlen(STRINGIFY(BLENDER_VERSION_CYCLE_NUMBER))) { + version_cycle_number = " " STRINGIFY(BLENDER_VERSION_CYCLE_NUMBER); + } + char version_buf[256] = "\0"; BLI_snprintf(version_buf, sizeof(version_buf), - "v %d.%d%s", + "v %d.%d%s%s", BLENDER_VERSION / 100, BLENDER_VERSION % 100, - version_suffix); + version_cycle, + version_cycle_number); wm_block_splash_add_label(block, version_buf, x, &y); diff --git a/source/tools b/source/tools -Subproject 2550eda6bcefad45289acbb4b8e52107e742ce1 +Subproject 8598818108ddaf35e30d2a2dbd408ad371e41eb |