diff options
author | Yiming Wu <xp8110@outlook.com> | 2022-06-02 16:27:09 +0300 |
---|---|---|
committer | Yiming Wu <xp8110@outlook.com> | 2022-06-02 16:27:28 +0300 |
commit | 04f67fb2dbf38e05d9c4855d2b214d545913c850 (patch) | |
tree | c7875a5a8ee51a8448210498363ed8e8ac5b4b68 | |
parent | e3363451667299b1cbc85b04bcec3f106e5dc216 (diff) | |
parent | 432c4c74ebe6f66b83e06ff7fca70c96d0526d6a (diff) |
Merge remote-tracking branch 'origin/master' into temp-lineart-containedtemp-lineart-contained
294 files changed, 1330 insertions, 2236 deletions
diff --git a/build_files/cmake/cmake_netbeans_project.py b/build_files/cmake/cmake_netbeans_project.py index e3fc9fd86ac..1abef605480 100755 --- a/build_files/cmake/cmake_netbeans_project.py +++ b/build_files/cmake/cmake_netbeans_project.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - """ Example linux usage python3 ~/blender-git/blender/build_files/cmake/cmake_netbeans_project.py ~/blender-git/cmake diff --git a/build_files/cmake/cmake_qtcreator_project.py b/build_files/cmake/cmake_qtcreator_project.py index 395d24370da..45957e35817 100755 --- a/build_files/cmake/cmake_qtcreator_project.py +++ b/build_files/cmake/cmake_qtcreator_project.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - r""" Example Linux usage: python ~/blender-git/blender/build_files/cmake/cmake_qtcreator_project.py --build-dir ~/blender-git/cmake diff --git a/build_files/cmake/cmake_static_check_clang_array.py b/build_files/cmake/cmake_static_check_clang_array.py index d98ab3d58e2..d3b6b971e05 100644 --- a/build_files/cmake/cmake_static_check_clang_array.py +++ b/build_files/cmake/cmake_static_check_clang_array.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import project_source_info import subprocess import sys diff --git a/build_files/cmake/cmake_static_check_cppcheck.py b/build_files/cmake/cmake_static_check_cppcheck.py index 75c5ac79ff5..79f9498ce2e 100644 --- a/build_files/cmake/cmake_static_check_cppcheck.py +++ b/build_files/cmake/cmake_static_check_cppcheck.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import project_source_info import subprocess import sys diff --git a/build_files/cmake/cmake_static_check_smatch.py b/build_files/cmake/cmake_static_check_smatch.py index b7c2e7817c6..63d8b524231 100644 --- a/build_files/cmake/cmake_static_check_smatch.py +++ b/build_files/cmake/cmake_static_check_smatch.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - CHECKER_IGNORE_PREFIX = [ "extern", "intern/moto", diff --git a/build_files/cmake/cmake_static_check_sparse.py b/build_files/cmake/cmake_static_check_sparse.py index 51204e4de2e..35641f5f8d1 100644 --- a/build_files/cmake/cmake_static_check_sparse.py +++ b/build_files/cmake/cmake_static_check_sparse.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - CHECKER_IGNORE_PREFIX = [ "extern", "intern/moto", diff --git a/build_files/cmake/cmake_static_check_splint.py b/build_files/cmake/cmake_static_check_splint.py index 3ee3617e7a8..238377e58cf 100644 --- a/build_files/cmake/cmake_static_check_splint.py +++ b/build_files/cmake/cmake_static_check_splint.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - CHECKER_IGNORE_PREFIX = [ "extern", "intern/moto", diff --git a/build_files/cmake/project_info.py b/build_files/cmake/project_info.py index 0661db3a18c..12f92235b2a 100755 --- a/build_files/cmake/project_info.py +++ b/build_files/cmake/project_info.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - """ Module for accessing project file data for Blender. diff --git a/build_files/cmake/project_source_info.py b/build_files/cmake/project_source_info.py index 7a00f756e03..a544f5733f0 100644 --- a/build_files/cmake/project_source_info.py +++ b/build_files/cmake/project_source_info.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - __all__ = ( "build_info", "SOURCE_DIR", diff --git a/build_files/package_spec/build_archive.py b/build_files/package_spec/build_archive.py index 06d11aef0e3..df7399942f3 100755 --- a/build_files/package_spec/build_archive.py +++ b/build_files/package_spec/build_archive.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import os import shutil import subprocess diff --git a/doc/manpage/blender.1.py b/doc/manpage/blender.1.py index 6cf2f54b26f..7d35dc0abb1 100755 --- a/doc/manpage/blender.1.py +++ b/doc/manpage/blender.1.py @@ -11,8 +11,6 @@ where <path-to-blender> is the path to the Blender executable, and <output-filename> is where to write the generated man page. ''' -# <pep8 compliant> - import argparse import os import subprocess diff --git a/doc/python_api/rst/info_best_practice.rst b/doc/python_api/rst/info_best_practice.rst index e88adcc0d70..6342680e149 100644 --- a/doc/python_api/rst/info_best_practice.rst +++ b/doc/python_api/rst/info_best_practice.rst @@ -40,15 +40,6 @@ As well as pep8 we have additional conventions used for Blender Python scripts: - pep8 also defines that lines should not exceed 79 characters, we have decided that this is too restrictive so it is optional per script. -Periodically we run checks for pep8 compliance on Blender scripts, -for scripts to be included in this check add this line as a comment at the top of the script: - -``# <pep8 compliant>`` - -To enable line length checks use this instead: - -``# <pep8-80 compliant>`` - User Interface Layout ===================== diff --git a/doc/python_api/rst_from_bmesh_opdefines.py b/doc/python_api/rst_from_bmesh_opdefines.py index c97b05b96b3..3d8ff1e6248 100644 --- a/doc/python_api/rst_from_bmesh_opdefines.py +++ b/doc/python_api/rst_from_bmesh_opdefines.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # This is a quite stupid script which extracts bmesh api docs from # 'bmesh_opdefines.c' in order to avoid having to add a lot of introspection # data access into the api. diff --git a/doc/python_api/sphinx_changelog_gen.py b/doc/python_api/sphinx_changelog_gen.py index 6c06178d603..a782c6483b6 100644 --- a/doc/python_api/sphinx_changelog_gen.py +++ b/doc/python_api/sphinx_changelog_gen.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - """ Dump the python API into a text file so we can generate changelogs. diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index bba5430cd95..8d4320917fc 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - """ API dump in RST files --------------------- @@ -1814,11 +1812,16 @@ def write_sphinx_conf_py(basepath): fw("extensions = ['sphinx.ext.intersphinx']\n\n") fw("intersphinx_mapping = {'blender_manual': ('https://docs.blender.org/manual/en/dev/', None)}\n\n") fw("project = 'Blender %s Python API'\n" % BLENDER_VERSION_STRING) - fw("master_doc = 'index'\n") - fw("copyright = u'Blender Foundation'\n") + fw("root_doc = 'index'\n") + fw("copyright = 'Blender Foundation'\n") fw("version = '%s'\n" % BLENDER_VERSION_DOTS) fw("release = '%s'\n" % BLENDER_VERSION_DOTS) + # Set this as the default is a super-set of Python3. + fw("highlight_language = 'python3'\n") + # No need to detect encoding. + fw("highlight_options = {'default': {'encoding': 'utf-8'}}\n\n") + # Quiet file not in table-of-contents warnings. fw("exclude_patterns = [\n") fw(" 'include__bmesh.rst',\n") diff --git a/doc/python_api/sphinx_doc_gen_monkeypatch.py b/doc/python_api/sphinx_doc_gen_monkeypatch.py index 09911e9b8a1..e3fba024446 100644 --- a/doc/python_api/sphinx_doc_gen_monkeypatch.py +++ b/doc/python_api/sphinx_doc_gen_monkeypatch.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - bpy_types_Operator_bl_property__doc__ = ( """ The name of a property to use as this operators primary property. diff --git a/doc/python_api/static/css/theme_overrides.css b/doc/python_api/static/css/theme_overrides.css index 0fea27a8ebd..5ab449044db 100644 --- a/doc/python_api/static/css/theme_overrides.css +++ b/doc/python_api/static/css/theme_overrides.css @@ -1,10 +1,3 @@ -/* T76453: Prevent Long enum lists */ -.field-list > dd p { - max-height: 245px; - overflow-y: auto !important; - word-break: break-word; -} - /* Hide home icon in search area */ .wy-side-nav-search > a:hover {background: none; opacity: 0.9} .wy-side-nav-search > a.icon::before {content: none} diff --git a/intern/cycles/blender/addon/__init__.py b/intern/cycles/blender/addon/__init__.py index 74b28b8ea21..05f27bdbd4d 100644 --- a/intern/cycles/blender/addon/__init__.py +++ b/intern/cycles/blender/addon/__init__.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright 2011-2022 Blender Foundation - -# <pep8 compliant> from __future__ import annotations bl_info = { diff --git a/intern/cycles/blender/addon/camera.py b/intern/cycles/blender/addon/camera.py index 0e78112699e..3c821c98128 100644 --- a/intern/cycles/blender/addon/camera.py +++ b/intern/cycles/blender/addon/camera.py @@ -1,8 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright 2011-2022 Blender Foundation -# <pep8 compliant> - # Fit to match default projective camera with focal_length 50 and sensor_width 36. default_fisheye_polynomial = [ -1.1735143712967577e-05, diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py index 724e1b8f727..e211f53cf31 100644 --- a/intern/cycles/blender/addon/engine.py +++ b/intern/cycles/blender/addon/engine.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright 2011-2022 Blender Foundation - -# <pep8 compliant> from __future__ import annotations diff --git a/intern/cycles/blender/addon/operators.py b/intern/cycles/blender/addon/operators.py index e5d7f00a381..ab474cda0ab 100644 --- a/intern/cycles/blender/addon/operators.py +++ b/intern/cycles/blender/addon/operators.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright 2011-2022 Blender Foundation - -# <pep8 compliant> from __future__ import annotations import bpy diff --git a/intern/cycles/blender/addon/osl.py b/intern/cycles/blender/addon/osl.py index 9430dc5d115..1ee7ae421e3 100644 --- a/intern/cycles/blender/addon/osl.py +++ b/intern/cycles/blender/addon/osl.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright 2011-2022 Blender Foundation - -# <pep8 compliant> from __future__ import annotations import bpy diff --git a/intern/cycles/blender/addon/presets.py b/intern/cycles/blender/addon/presets.py index 5eaa592a9de..cc6d574da99 100644 --- a/intern/cycles/blender/addon/presets.py +++ b/intern/cycles/blender/addon/presets.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright 2011-2022 Blender Foundation - -# <pep8 compliant> from __future__ import annotations from bl_operators.presets import AddPresetBase diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 9acc9e99ad0..b444a806f8d 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright 2011-2022 Blender Foundation - -# <pep8 compliant> from __future__ import annotations import bpy diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 9d2dbdf6732..5e918af322e 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright 2011-2022 Blender Foundation - -# <pep8 compliant> from __future__ import annotations import bpy diff --git a/intern/cycles/blender/addon/version_update.py b/intern/cycles/blender/addon/version_update.py index 531ecc177da..12880496dfd 100644 --- a/intern/cycles/blender/addon/version_update.py +++ b/intern/cycles/blender/addon/version_update.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright 2011-2022 Blender Foundation - -# <pep8 compliant> from __future__ import annotations import bpy diff --git a/release/datafiles/alert_icons_update.py b/release/datafiles/alert_icons_update.py index 8c5d66e803a..bb4140d1ec2 100755 --- a/release/datafiles/alert_icons_update.py +++ b/release/datafiles/alert_icons_update.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # This script updates icons from the SVG file import os import subprocess diff --git a/release/datafiles/blender_icons_geom_update.py b/release/datafiles/blender_icons_geom_update.py index 6f7508a8e7c..3fd3164c324 100755 --- a/release/datafiles/blender_icons_geom_update.py +++ b/release/datafiles/blender_icons_geom_update.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # This script updates icons from the BLEND file import os import subprocess diff --git a/release/datafiles/blender_icons_update.py b/release/datafiles/blender_icons_update.py index c1cf8d6fcb0..e2c72e1d0b7 100755 --- a/release/datafiles/blender_icons_update.py +++ b/release/datafiles/blender_icons_update.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # This script updates icons from the SVG file import os import subprocess diff --git a/release/datafiles/ctodata.py b/release/datafiles/ctodata.py index dabdd6d4ea6..b6420d5c9a2 100755 --- a/release/datafiles/ctodata.py +++ b/release/datafiles/ctodata.py @@ -2,8 +2,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later # Copyright 2009 Blender Foundation. All rights reserved. -# <pep8 compliant> - import sys argv = sys.argv[:] diff --git a/release/datafiles/prvicons_update.py b/release/datafiles/prvicons_update.py index d93a2cec113..0092942ea3b 100755 --- a/release/datafiles/prvicons_update.py +++ b/release/datafiles/prvicons_update.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # This script updates icons from the SVG file import os import subprocess diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py index 3e823f2b6b7..9d820b8c9de 100644 --- a/release/scripts/modules/addon_utils.py +++ b/release/scripts/modules/addon_utils.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - __all__ = ( "paths", "modules", diff --git a/release/scripts/modules/animsys_refactor.py b/release/scripts/modules/animsys_refactor.py index 35072885deb..0ab486efa11 100644 --- a/release/scripts/modules/animsys_refactor.py +++ b/release/scripts/modules/animsys_refactor.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - """ This module has utility functions for renaming rna values in fcurves and drivers. diff --git a/release/scripts/modules/bl_app_override/__init__.py b/release/scripts/modules/bl_app_override/__init__.py index e60c123ead5..4d6194e71cd 100644 --- a/release/scripts/modules/bl_app_override/__init__.py +++ b/release/scripts/modules/bl_app_override/__init__.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - """ Module to manage overriding various parts of Blender. diff --git a/release/scripts/modules/bl_app_override/helpers.py b/release/scripts/modules/bl_app_override/helpers.py index dd17e8aa7c6..4759e0ae8e5 100644 --- a/release/scripts/modules/bl_app_override/helpers.py +++ b/release/scripts/modules/bl_app_override/helpers.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - # ----------------------------------------------------------------------------- # AppOverrideState diff --git a/release/scripts/modules/bl_app_template_utils.py b/release/scripts/modules/bl_app_template_utils.py index 9d71664e513..985dbc22be6 100644 --- a/release/scripts/modules/bl_app_template_utils.py +++ b/release/scripts/modules/bl_app_template_utils.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - """ Similar to ``addon_utils``, except we can only have one active at a time. diff --git a/release/scripts/modules/bl_console_utils/autocomplete/__init__.py b/release/scripts/modules/bl_console_utils/autocomplete/__init__.py index 5fa5b11f4bf..0da40331835 100644 --- a/release/scripts/modules/bl_console_utils/autocomplete/__init__.py +++ b/release/scripts/modules/bl_console_utils/autocomplete/__init__.py @@ -2,6 +2,4 @@ # Copyright (c) 2009 www.stani.be -# <pep8 compliant> - """Package for console specific modules.""" diff --git a/release/scripts/modules/bl_console_utils/autocomplete/complete_calltip.py b/release/scripts/modules/bl_console_utils/autocomplete/complete_calltip.py index 6c7b0611ee2..07ccac81f91 100644 --- a/release/scripts/modules/bl_console_utils/autocomplete/complete_calltip.py +++ b/release/scripts/modules/bl_console_utils/autocomplete/complete_calltip.py @@ -2,8 +2,6 @@ # Copyright (c) 2009 www.stani.be -# <pep8-80 compliant> - import inspect import re diff --git a/release/scripts/modules/bl_console_utils/autocomplete/complete_import.py b/release/scripts/modules/bl_console_utils/autocomplete/complete_import.py index 2339e79c8f1..2f321fee0b2 100644 --- a/release/scripts/modules/bl_console_utils/autocomplete/complete_import.py +++ b/release/scripts/modules/bl_console_utils/autocomplete/complete_import.py @@ -10,8 +10,6 @@ # the file COPYING, distributed as part of this software. # **************************************************************************** -# <pep8 compliant> - """Completer for import statements Original code was from IPython/Extensions/ipy_completers.py. The following diff --git a/release/scripts/modules/bl_console_utils/autocomplete/complete_namespace.py b/release/scripts/modules/bl_console_utils/autocomplete/complete_namespace.py index 7bfa2aac1c1..4ba446d6832 100644 --- a/release/scripts/modules/bl_console_utils/autocomplete/complete_namespace.py +++ b/release/scripts/modules/bl_console_utils/autocomplete/complete_namespace.py @@ -2,8 +2,6 @@ # Copyright (c) 2009 www.stani.be -# <pep8-80 compliant> - """Autocomplete with the standard library""" import re diff --git a/release/scripts/modules/bl_console_utils/autocomplete/intellisense.py b/release/scripts/modules/bl_console_utils/autocomplete/intellisense.py index 9484f825f9f..e53e38dbc53 100644 --- a/release/scripts/modules/bl_console_utils/autocomplete/intellisense.py +++ b/release/scripts/modules/bl_console_utils/autocomplete/intellisense.py @@ -2,8 +2,6 @@ # Copyright (c) 2009 www.stani.be -# <pep8-80 compliant> - """This module provides intellisense features such as: * autocompletion diff --git a/release/scripts/modules/bl_i18n_utils/__init__.py b/release/scripts/modules/bl_i18n_utils/__init__.py index b07a993c12e..d4af1270369 100644 --- a/release/scripts/modules/bl_i18n_utils/__init__.py +++ b/release/scripts/modules/bl_i18n_utils/__init__.py @@ -1,5 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - """Package for translation (i18n) tools.""" diff --git a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py index 604a577eec9..319fd3396a0 100644 --- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py +++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Populate a template file (POT format currently) from Blender RNA/py/C data. # XXX: This script is meant to be used from inside Blender! # You should not directly use this script, rather use update_msg.py! diff --git a/release/scripts/modules/bl_i18n_utils/merge_po.py b/release/scripts/modules/bl_i18n_utils/merge_po.py index d048f8f5c42..3cc5046fe3c 100755 --- a/release/scripts/modules/bl_i18n_utils/merge_po.py +++ b/release/scripts/modules/bl_i18n_utils/merge_po.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Merge one or more .po files into the first dest one. # If a msgkey is present in more than one merged po, the one in the first file wins, unless # it’s marked as fuzzy and one later is not. diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py index 57722d06ce5..b317eec7f06 100644 --- a/release/scripts/modules/bl_i18n_utils/settings.py +++ b/release/scripts/modules/bl_i18n_utils/settings.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Global settings used by all scripts in this dir. # XXX Before any use of the tools in this dir, please make a copy of this file # named "setting.py" diff --git a/release/scripts/modules/bl_i18n_utils/settings_user.py b/release/scripts/modules/bl_i18n_utils/settings_user.py index a7aa8a80af8..3c29a0d743a 100644 --- a/release/scripts/modules/bl_i18n_utils/settings_user.py +++ b/release/scripts/modules/bl_i18n_utils/settings_user.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import os import settings diff --git a/release/scripts/modules/bl_i18n_utils/utils.py b/release/scripts/modules/bl_i18n_utils/utils.py index ec5465549b3..b1e3fa07ac5 100644 --- a/release/scripts/modules/bl_i18n_utils/utils.py +++ b/release/scripts/modules/bl_i18n_utils/utils.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Some misc utilities... import collections diff --git a/release/scripts/modules/bl_i18n_utils/utils_cli.py b/release/scripts/modules/bl_i18n_utils/utils_cli.py index dd75ac11ac4..4b00816d132 100644 --- a/release/scripts/modules/bl_i18n_utils/utils_cli.py +++ b/release/scripts/modules/bl_i18n_utils/utils_cli.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Some useful operations from utils' I18nMessages class exposed as a CLI. import os diff --git a/release/scripts/modules/bl_i18n_utils/utils_languages_menu.py b/release/scripts/modules/bl_i18n_utils/utils_languages_menu.py index da4183d457c..833c46a732e 100755 --- a/release/scripts/modules/bl_i18n_utils/utils_languages_menu.py +++ b/release/scripts/modules/bl_i18n_utils/utils_languages_menu.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Update "languages" text file used by Blender at runtime to build translations menu. diff --git a/release/scripts/modules/bl_i18n_utils/utils_rtl.py b/release/scripts/modules/bl_i18n_utils/utils_rtl.py index beec2659df8..6e3d25cfc3f 100755 --- a/release/scripts/modules/bl_i18n_utils/utils_rtl.py +++ b/release/scripts/modules/bl_i18n_utils/utils_rtl.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Pre-process right-to-left languages. # You can use it either standalone, or through import_po_from_branches or # update_trunk. diff --git a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py index f9208bbe3ee..74785c81bfd 100644 --- a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py +++ b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import enchant import os import pickle diff --git a/release/scripts/modules/bl_keymap_utils/__init__.py b/release/scripts/modules/bl_keymap_utils/__init__.py index e00776d3466..950314cd74c 100644 --- a/release/scripts/modules/bl_keymap_utils/__init__.py +++ b/release/scripts/modules/bl_keymap_utils/__init__.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - __all__ = ( "io", "keymap_from_toolbar", diff --git a/release/scripts/modules/bl_keymap_utils/io.py b/release/scripts/modules/bl_keymap_utils/io.py index 6631461eaba..5d74ffbcf56 100644 --- a/release/scripts/modules/bl_keymap_utils/io.py +++ b/release/scripts/modules/bl_keymap_utils/io.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # ----------------------------------------------------------------------------- # Export Functions diff --git a/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py b/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py index 2cfba52d688..f75a38c1c66 100644 --- a/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py +++ b/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Dynamically create a keymap which is used by the popup toolbar # for accelerator key access. diff --git a/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py b/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py index 6389efba049..a648375557a 100644 --- a/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py +++ b/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - __all__ = ( "generate", ) diff --git a/release/scripts/modules/bl_keymap_utils/versioning.py b/release/scripts/modules/bl_keymap_utils/versioning.py index ba83892c12c..65febf2c399 100644 --- a/release/scripts/modules/bl_keymap_utils/versioning.py +++ b/release/scripts/modules/bl_keymap_utils/versioning.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Update Blender version this key-map was written in: # # When the version is `(0, 0, 0)`, the key-map being loaded didn't contain any versioning information. diff --git a/release/scripts/modules/bl_previews_utils/bl_previews_render.py b/release/scripts/modules/bl_previews_utils/bl_previews_render.py index bf2b9fe1a76..bafc62330ea 100644 --- a/release/scripts/modules/bl_previews_utils/bl_previews_render.py +++ b/release/scripts/modules/bl_previews_utils/bl_previews_render.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Populate a template file (POT format currently) from Blender RNA/py/C data. # Note: This script is meant to be used from inside Blender! diff --git a/release/scripts/modules/bl_rna_utils/data_path.py b/release/scripts/modules/bl_rna_utils/data_path.py index e15d9bc2d1c..d0c1fa57db8 100644 --- a/release/scripts/modules/bl_rna_utils/data_path.py +++ b/release/scripts/modules/bl_rna_utils/data_path.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - __all__ = ( "property_definition_from_data_path", "decompose_data_path", diff --git a/release/scripts/modules/bl_ui_utils/bug_report_url.py b/release/scripts/modules/bl_ui_utils/bug_report_url.py index 28af7aaa013..6755c2bad9d 100644 --- a/release/scripts/modules/bl_ui_utils/bug_report_url.py +++ b/release/scripts/modules/bl_ui_utils/bug_report_url.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - def url_prefill_from_blender(*, addon_info=None): import bpy diff --git a/release/scripts/modules/blend_render_info.py b/release/scripts/modules/blend_render_info.py index f8d22052290..461ea877383 100755 --- a/release/scripts/modules/blend_render_info.py +++ b/release/scripts/modules/blend_render_info.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # This module can get render info without running from inside blender. # # This struct won't change according to Ton. diff --git a/release/scripts/modules/bpy/__init__.py b/release/scripts/modules/bpy/__init__.py index 35848602f9d..fd7a573dc06 100644 --- a/release/scripts/modules/bpy/__init__.py +++ b/release/scripts/modules/bpy/__init__.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - """ Give access to blender data and utility functions. """ diff --git a/release/scripts/modules/bpy/ops.py b/release/scripts/modules/bpy/ops.py index e19128e41a9..cb6ea0318a4 100644 --- a/release/scripts/modules/bpy/ops.py +++ b/release/scripts/modules/bpy/ops.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - # for slightly faster access from _bpy import ops as _ops_module diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py index 88c34be6906..60b8159b896 100644 --- a/release/scripts/modules/bpy/path.py +++ b/release/scripts/modules/bpy/path.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - """ This module has a similar scope to os.path, containing utility functions for dealing with paths in Blender. diff --git a/release/scripts/modules/bpy/utils/__init__.py b/release/scripts/modules/bpy/utils/__init__.py index 5cd2bd2f076..54fcb4cdc67 100644 --- a/release/scripts/modules/bpy/utils/__init__.py +++ b/release/scripts/modules/bpy/utils/__init__.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - """ This module contains utility functions specific to blender but not associated with blenders internal data. diff --git a/release/scripts/modules/bpy/utils/previews.py b/release/scripts/modules/bpy/utils/previews.py index 1f398176643..5826de725c8 100644 --- a/release/scripts/modules/bpy/utils/previews.py +++ b/release/scripts/modules/bpy/utils/previews.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - """ This module contains utility functions to handle custom previews. diff --git a/release/scripts/modules/bpy/utils/toolsystem.py b/release/scripts/modules/bpy/utils/toolsystem.py index dbcf56900a1..6aa7f885239 100644 --- a/release/scripts/modules/bpy/utils/toolsystem.py +++ b/release/scripts/modules/bpy/utils/toolsystem.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Until we untangle ToolDef from bl_ui internals, # use this module to document ToolDef. from bl_ui.space_toolsystem_common import ToolDef diff --git a/release/scripts/modules/bpy_extras/__init__.py b/release/scripts/modules/bpy_extras/__init__.py index 15a8d00cddc..f018789d858 100644 --- a/release/scripts/modules/bpy_extras/__init__.py +++ b/release/scripts/modules/bpy_extras/__init__.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - """ Utility modules associated with the bpy module. """ diff --git a/release/scripts/modules/bpy_extras/anim_utils.py b/release/scripts/modules/bpy_extras/anim_utils.py index 1b1df41d2c6..f66dfd6eb0a 100644 --- a/release/scripts/modules/bpy_extras/anim_utils.py +++ b/release/scripts/modules/bpy_extras/anim_utils.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - __all__ = ( "bake_action", "bake_action_objects", diff --git a/release/scripts/modules/bpy_extras/asset_utils.py b/release/scripts/modules/bpy_extras/asset_utils.py index 70c02272fd2..a6f2a709977 100644 --- a/release/scripts/modules/bpy_extras/asset_utils.py +++ b/release/scripts/modules/bpy_extras/asset_utils.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - """ Helpers for asset management tasks. """ diff --git a/release/scripts/modules/bpy_extras/id_map_utils.py b/release/scripts/modules/bpy_extras/id_map_utils.py index cf39f2185c6..9aa7cc9e07c 100644 --- a/release/scripts/modules/bpy_extras/id_map_utils.py +++ b/release/scripts/modules/bpy_extras/id_map_utils.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - from typing import Dict, Set import bpy from bpy.types import ID diff --git a/release/scripts/modules/bpy_extras/image_utils.py b/release/scripts/modules/bpy_extras/image_utils.py index eaf5922a199..48a50d52e60 100644 --- a/release/scripts/modules/bpy_extras/image_utils.py +++ b/release/scripts/modules/bpy_extras/image_utils.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - __all__ = ( "load_image", ) diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py index 3a73603ba85..0497d69162e 100644 --- a/release/scripts/modules/bpy_extras/io_utils.py +++ b/release/scripts/modules/bpy_extras/io_utils.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - __all__ = ( "ExportHelper", "ImportHelper", diff --git a/release/scripts/modules/bpy_extras/keyconfig_utils.py b/release/scripts/modules/bpy_extras/keyconfig_utils.py index 1b8f3ac3fd8..b87641874cd 100644 --- a/release/scripts/modules/bpy_extras/keyconfig_utils.py +++ b/release/scripts/modules/bpy_extras/keyconfig_utils.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # ----------------------------------------------------------------------------- # Add-on helpers to properly (un)register their own keymaps. diff --git a/release/scripts/modules/bpy_extras/mesh_utils.py b/release/scripts/modules/bpy_extras/mesh_utils.py index a6f71dc0a2a..f6dc33e4f02 100644 --- a/release/scripts/modules/bpy_extras/mesh_utils.py +++ b/release/scripts/modules/bpy_extras/mesh_utils.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - __all__ = ( "mesh_linked_uv_islands", "mesh_linked_triangles", diff --git a/release/scripts/modules/bpy_extras/node_shader_utils.py b/release/scripts/modules/bpy_extras/node_shader_utils.py index 522357296fd..cda291c6c90 100644 --- a/release/scripts/modules/bpy_extras/node_shader_utils.py +++ b/release/scripts/modules/bpy_extras/node_shader_utils.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - from mathutils import Color, Vector __all__ = ( diff --git a/release/scripts/modules/bpy_extras/node_utils.py b/release/scripts/modules/bpy_extras/node_utils.py index 639ebc46e16..3fec65db5a5 100644 --- a/release/scripts/modules/bpy_extras/node_utils.py +++ b/release/scripts/modules/bpy_extras/node_utils.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - __all__ = ( "find_node_input", ) diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py index 6829aed5565..ab678ba27c8 100644 --- a/release/scripts/modules/bpy_extras/object_utils.py +++ b/release/scripts/modules/bpy_extras/object_utils.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8-80 compliant> from __future__ import annotations __all__ = ( diff --git a/release/scripts/modules/bpy_extras/view3d_utils.py b/release/scripts/modules/bpy_extras/view3d_utils.py index 7de363483e5..c661d017ca0 100644 --- a/release/scripts/modules/bpy_extras/view3d_utils.py +++ b/release/scripts/modules/bpy_extras/view3d_utils.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - __all__ = ( "region_2d_to_vector_3d", "region_2d_to_origin_3d", diff --git a/release/scripts/modules/bpy_extras/wm_utils/progress_report.py b/release/scripts/modules/bpy_extras/wm_utils/progress_report.py index da9ef735e0d..637d60838db 100644 --- a/release/scripts/modules/bpy_extras/wm_utils/progress_report.py +++ b/release/scripts/modules/bpy_extras/wm_utils/progress_report.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import time diff --git a/release/scripts/modules/bpy_restrict_state.py b/release/scripts/modules/bpy_restrict_state.py index 78d4b4be972..31a0c52ecf5 100644 --- a/release/scripts/modules/bpy_restrict_state.py +++ b/release/scripts/modules/bpy_restrict_state.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - """ This module contains RestrictBlend context manager. """ diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 4c6e2508859..aaa2ae59a0d 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - from _bpy import types as bpy_types StructRNA = bpy_types.bpy_struct diff --git a/release/scripts/modules/console_python.py b/release/scripts/modules/console_python.py index b7e86d5c673..2aa4caab7f6 100644 --- a/release/scripts/modules/console_python.py +++ b/release/scripts/modules/console_python.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8-80 compliant> import sys import bpy diff --git a/release/scripts/modules/console_shell.py b/release/scripts/modules/console_shell.py index ff8a30557d2..194f636a97e 100644 --- a/release/scripts/modules/console_shell.py +++ b/release/scripts/modules/console_shell.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import os import bpy diff --git a/release/scripts/modules/graphviz_export.py b/release/scripts/modules/graphviz_export.py index a121cc3ed06..b6e73590386 100644 --- a/release/scripts/modules/graphviz_export.py +++ b/release/scripts/modules/graphviz_export.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import bpy header = ''' diff --git a/release/scripts/modules/keyingsets_utils.py b/release/scripts/modules/keyingsets_utils.py index e48be9a95ea..b566889bfb9 100644 --- a/release/scripts/modules/keyingsets_utils.py +++ b/release/scripts/modules/keyingsets_utils.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - # This file defines a set of methods that are useful for various # Relative Keying Set (RKS) related operations, such as: callbacks # for polling, iterator callbacks, and also generate callbacks. diff --git a/release/scripts/modules/nodeitems_utils.py b/release/scripts/modules/nodeitems_utils.py index 819deec8cc0..231720ea519 100644 --- a/release/scripts/modules/nodeitems_utils.py +++ b/release/scripts/modules/nodeitems_utils.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy diff --git a/release/scripts/modules/rna_info.py b/release/scripts/modules/rna_info.py index 4788ed6a5fa..e2bbc4077a1 100644 --- a/release/scripts/modules/rna_info.py +++ b/release/scripts/modules/rna_info.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # classes for extracting info from blenders internal classes import bpy diff --git a/release/scripts/modules/rna_keymap_ui.py b/release/scripts/modules/rna_keymap_ui.py index 5da98cd783d..a7ad162ba66 100644 --- a/release/scripts/modules/rna_keymap_ui.py +++ b/release/scripts/modules/rna_keymap_ui.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - __all__ = ( "draw_entry", "draw_km", diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py index a6842dc0005..8b8cfaaccc5 100644 --- a/release/scripts/modules/rna_prop_ui.py +++ b/release/scripts/modules/rna_prop_ui.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import bpy from mathutils import Vector diff --git a/release/scripts/modules/rna_xml.py b/release/scripts/modules/rna_xml.py index d576aeec860..9e3e1a3430b 100644 --- a/release/scripts/modules/rna_xml.py +++ b/release/scripts/modules/rna_xml.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import bpy diff --git a/release/scripts/modules/sys_info.py b/release/scripts/modules/sys_info.py index 80f518e4aee..a5bae1b97af 100644 --- a/release/scripts/modules/sys_info.py +++ b/release/scripts/modules/sys_info.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # classes for extracting info from blenders internal classes diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index adaebf7ce7b..1cdb2c8e679 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -4720,6 +4720,10 @@ def _template_view3d_select(*, type, value, legacy, select_passthrough, exclude_ # NOTE: `exclude_mod` is needed since we don't want this tool to exclude Control-RMB actions when this is used # as a tool key-map with RMB-select and `use_fallback_tool_rmb` is enabled. See T92467. + props_vert_without_handles = () + if select_passthrough: + props_vert_without_handles = ("vert_without_handles",) + # See: `use_tweak_select_passthrough` doc-string. if select_passthrough and (value in {'CLICK', 'RELEASE'}): select_passthrough = False @@ -4729,9 +4733,9 @@ def _template_view3d_select(*, type, value, legacy, select_passthrough, exclude_ {"type": type, "value": value, **{m: True for m in mods}}, {"properties": [(c, True) for c in props]}, ) for props, mods in ( - ((("deselect_all", "select_passthrough") if select_passthrough else - ("deselect_all",)) if not legacy else (), ()), - (("toggle",), ("shift",)), + ((("deselect_all", "select_passthrough", *props_vert_without_handles) if select_passthrough else + ("deselect_all", *props_vert_without_handles)) if not legacy else (), ()), + (("toggle", *props_vert_without_handles), ("shift",)), (("center", "object"), ("ctrl",)), (("enumerate",), ("alt",)), (("toggle", "center"), ("shift", "ctrl")), @@ -4746,7 +4750,10 @@ def _template_view3d_select(*, type, value, legacy, select_passthrough, exclude_ items.append(( "view3d.select", {"type": type, "value": 'CLICK'}, - {"properties": [("deselect_all", True)]}, + {"properties": [ + (c, True) + for c in ("deselect_all", *props_vert_without_handles) + ]}, )) return items @@ -6564,7 +6571,10 @@ def km_node_editor_tool_select(params, *, fallback): _fallback_id("Node Tool: Tweak", fallback), {"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'}, {"items": [ - *([] if (fallback and (params.select_mouse == 'RIGHTMOUSE')) else + # The node key-map already selects, leave this empty. + # NOTE: intentionally don't check `fallback` here (unlike other tweak tool checks). + # as this should only be used on LMB select which would otherwise activate on click, not press. + *([] if (params.select_mouse == 'RIGHTMOUSE') else _template_node_select(type=params.select_mouse, value='PRESS', select_passthrough=True)), ]}, ) diff --git a/release/scripts/startup/bl_operators/__init__.py b/release/scripts/startup/bl_operators/__init__.py index bf7783ef958..14dc72336f6 100644 --- a/release/scripts/startup/bl_operators/__init__.py +++ b/release/scripts/startup/bl_operators/__init__.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> from __future__ import annotations # support reloading sub-modules diff --git a/release/scripts/startup/bl_operators/add_mesh_torus.py b/release/scripts/startup/bl_operators/add_mesh_torus.py index be5ce60af2f..90d1326e1a2 100644 --- a/release/scripts/startup/bl_operators/add_mesh_torus.py +++ b/release/scripts/startup/bl_operators/add_mesh_torus.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8-80 compliant> from __future__ import annotations import bpy diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py index dfe3b3ba57c..539cf838f9c 100644 --- a/release/scripts/startup/bl_operators/anim.py +++ b/release/scripts/startup/bl_operators/anim.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8-80 compliant> from __future__ import annotations if "bpy" in locals(): diff --git a/release/scripts/startup/bl_operators/assets.py b/release/scripts/startup/bl_operators/assets.py index eaf44442c8a..088f4189ca5 100644 --- a/release/scripts/startup/bl_operators/assets.py +++ b/release/scripts/startup/bl_operators/assets.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> from __future__ import annotations import bpy diff --git a/release/scripts/startup/bl_operators/bmesh/find_adjacent.py b/release/scripts/startup/bl_operators/bmesh/find_adjacent.py index 5e8b125e060..a6c4a3169d5 100644 --- a/release/scripts/startup/bl_operators/bmesh/find_adjacent.py +++ b/release/scripts/startup/bl_operators/bmesh/find_adjacent.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Utilities to detect the next matching element (vert/edge/face) # based on an existing pair of elements. diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index 23bf8a5cb60..71617a76243 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Operator from bpy.props import FloatProperty diff --git a/release/scripts/startup/bl_operators/console.py b/release/scripts/startup/bl_operators/console.py index 3982f140fec..eb8c4c371c5 100644 --- a/release/scripts/startup/bl_operators/console.py +++ b/release/scripts/startup/bl_operators/console.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8-80 compliant> from __future__ import annotations import bpy diff --git a/release/scripts/startup/bl_operators/constraint.py b/release/scripts/startup/bl_operators/constraint.py index 444452ad2c5..6d040c29b62 100644 --- a/release/scripts/startup/bl_operators/constraint.py +++ b/release/scripts/startup/bl_operators/constraint.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8-80 compliant> from __future__ import annotations from bpy.types import ( diff --git a/release/scripts/startup/bl_operators/file.py b/release/scripts/startup/bl_operators/file.py index 0fafb09f672..490fab113c6 100644 --- a/release/scripts/startup/bl_operators/file.py +++ b/release/scripts/startup/bl_operators/file.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import bpy from bpy.types import ( Operator, diff --git a/release/scripts/startup/bl_operators/freestyle.py b/release/scripts/startup/bl_operators/freestyle.py index c5eda7249e1..02b784357b0 100644 --- a/release/scripts/startup/bl_operators/freestyle.py +++ b/release/scripts/startup/bl_operators/freestyle.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import bpy from bpy.types import ( diff --git a/release/scripts/startup/bl_operators/image.py b/release/scripts/startup/bl_operators/image.py index 42f7b1730a8..97308b6894f 100644 --- a/release/scripts/startup/bl_operators/image.py +++ b/release/scripts/startup/bl_operators/image.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - import bpy from bpy.types import Operator from bpy.props import StringProperty diff --git a/release/scripts/startup/bl_operators/mesh.py b/release/scripts/startup/bl_operators/mesh.py index f3f69530c87..f68df9845ef 100644 --- a/release/scripts/startup/bl_operators/mesh.py +++ b/release/scripts/startup/bl_operators/mesh.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - import bpy from bpy.types import Operator diff --git a/release/scripts/startup/bl_operators/node.py b/release/scripts/startup/bl_operators/node.py index 60a684ae5e8..c64898fdfb9 100644 --- a/release/scripts/startup/bl_operators/node.py +++ b/release/scripts/startup/bl_operators/node.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8-80 compliant> from __future__ import annotations import bpy diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py index 0b146d689f5..f5759255e22 100644 --- a/release/scripts/startup/bl_operators/object.py +++ b/release/scripts/startup/bl_operators/object.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - import bpy from bpy.types import Operator from bpy.props import ( diff --git a/release/scripts/startup/bl_operators/object_align.py b/release/scripts/startup/bl_operators/object_align.py index f645d8618da..5171f088dd2 100644 --- a/release/scripts/startup/bl_operators/object_align.py +++ b/release/scripts/startup/bl_operators/object_align.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - from bpy.types import Operator from mathutils import Vector diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py b/release/scripts/startup/bl_operators/object_quick_effects.py index 9f3dd75a316..cd9fd9af472 100644 --- a/release/scripts/startup/bl_operators/object_quick_effects.py +++ b/release/scripts/startup/bl_operators/object_quick_effects.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - from mathutils import Vector import bpy from bpy.types import Operator diff --git a/release/scripts/startup/bl_operators/object_randomize_transform.py b/release/scripts/startup/bl_operators/object_randomize_transform.py index f1864174db7..0b8b2868349 100644 --- a/release/scripts/startup/bl_operators/object_randomize_transform.py +++ b/release/scripts/startup/bl_operators/object_randomize_transform.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - from bpy.types import Operator from mathutils import Vector diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py index 704693a1469..cde4348977f 100644 --- a/release/scripts/startup/bl_operators/presets.py +++ b/release/scripts/startup/bl_operators/presets.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import bpy from bpy.types import ( Menu, diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py index 5aab842d672..fffd010b768 100644 --- a/release/scripts/startup/bl_operators/rigidbody.py +++ b/release/scripts/startup/bl_operators/rigidbody.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - import bpy from bpy.types import Operator from bpy.props import ( diff --git a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py index 78efe9c4af0..39c95e3ed5e 100644 --- a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py +++ b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - # Originally written by Matt Ebb import bpy diff --git a/release/scripts/startup/bl_operators/sequencer.py b/release/scripts/startup/bl_operators/sequencer.py index 0d4cc53173d..8b12bbb78a9 100644 --- a/release/scripts/startup/bl_operators/sequencer.py +++ b/release/scripts/startup/bl_operators/sequencer.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import bpy from bpy.types import Operator diff --git a/release/scripts/startup/bl_operators/userpref.py b/release/scripts/startup/bl_operators/userpref.py index 49bc2d0a2da..54de9c28144 100644 --- a/release/scripts/startup/bl_operators/userpref.py +++ b/release/scripts/startup/bl_operators/userpref.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import bpy from bpy.types import ( Operator, diff --git a/release/scripts/startup/bl_operators/uvcalc_follow_active.py b/release/scripts/startup/bl_operators/uvcalc_follow_active.py index fd5cf5303b3..a5c91f238d2 100644 --- a/release/scripts/startup/bl_operators/uvcalc_follow_active.py +++ b/release/scripts/startup/bl_operators/uvcalc_follow_active.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - from bpy.types import Operator from bpy.props import ( diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py index f62b98462dc..93c72c97129 100644 --- a/release/scripts/startup/bl_operators/uvcalc_lightmap.py +++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import bpy from bpy.types import Operator import mathutils diff --git a/release/scripts/startup/bl_operators/vertexpaint_dirt.py b/release/scripts/startup/bl_operators/vertexpaint_dirt.py index 8089a65960c..a3c0b73fc0e 100644 --- a/release/scripts/startup/bl_operators/vertexpaint_dirt.py +++ b/release/scripts/startup/bl_operators/vertexpaint_dirt.py @@ -1,8 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later # Copyright Campbell Barton. -# <pep8 compliant> - def get_vcolor_layer_data(me): for lay in me.vertex_colors: diff --git a/release/scripts/startup/bl_operators/view3d.py b/release/scripts/startup/bl_operators/view3d.py index 50cdf1a530e..59e668d81ea 100644 --- a/release/scripts/startup/bl_operators/view3d.py +++ b/release/scripts/startup/bl_operators/view3d.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - import bpy from bpy.types import Operator from bpy.props import ( diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 37d7ef19a28..0eaada7249b 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> from __future__ import annotations import bpy diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py index b3b4ab8e52c..c61dde87d7c 100644 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # note, properties_animviz is a helper module only. # support reloading sub-modules diff --git a/release/scripts/startup/bl_ui/properties_animviz.py b/release/scripts/startup/bl_ui/properties_animviz.py index 9aac33eb5de..3062b84bd70 100644 --- a/release/scripts/startup/bl_ui/properties_animviz.py +++ b/release/scripts/startup/bl_ui/properties_animviz.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Generic Panels (Independent of DataType) # NOTE: diff --git a/release/scripts/startup/bl_ui/properties_collection.py b/release/scripts/startup/bl_ui/properties_collection.py index 88c6a4c217d..78e9c60a752 100644 --- a/release/scripts/startup/bl_ui/properties_collection.py +++ b/release/scripts/startup/bl_ui/properties_collection.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> from bpy.types import Panel diff --git a/release/scripts/startup/bl_ui/properties_constraint.py b/release/scripts/startup/bl_ui/properties_constraint.py index bd63368bdfd..d949ee779e1 100644 --- a/release/scripts/startup/bl_ui/properties_constraint.py +++ b/release/scripts/startup/bl_ui/properties_constraint.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> from bpy.types import Panel diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py index 58ccaffaf50..22d6a45c48c 100644 --- a/release/scripts/startup/bl_ui/properties_data_armature.py +++ b/release/scripts/startup/bl_ui/properties_data_armature.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Panel, Menu from rna_prop_ui import PropertyPanel diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py b/release/scripts/startup/bl_ui/properties_data_bone.py index 9a790663581..c842af9af88 100644 --- a/release/scripts/startup/bl_ui/properties_data_bone.py +++ b/release/scripts/startup/bl_ui/properties_data_bone.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import bpy from bpy.types import Panel from rna_prop_ui import PropertyPanel diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py index 696143494fe..8213a865990 100644 --- a/release/scripts/startup/bl_ui/properties_data_camera.py +++ b/release/scripts/startup/bl_ui/properties_data_camera.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Panel from rna_prop_ui import PropertyPanel diff --git a/release/scripts/startup/bl_ui/properties_data_curve.py b/release/scripts/startup/bl_ui/properties_data_curve.py index a421428c067..4da7cd0283b 100644 --- a/release/scripts/startup/bl_ui/properties_data_curve.py +++ b/release/scripts/startup/bl_ui/properties_data_curve.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Panel from rna_prop_ui import PropertyPanel diff --git a/release/scripts/startup/bl_ui/properties_data_curves.py b/release/scripts/startup/bl_ui/properties_data_curves.py index cf7117f2c85..231e6634c68 100644 --- a/release/scripts/startup/bl_ui/properties_data_curves.py +++ b/release/scripts/startup/bl_ui/properties_data_curves.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Menu, Panel, UIList from rna_prop_ui import PropertyPanel diff --git a/release/scripts/startup/bl_ui/properties_data_empty.py b/release/scripts/startup/bl_ui/properties_data_empty.py index 6c5c94e9d6a..8dd7f8312ae 100644 --- a/release/scripts/startup/bl_ui/properties_data_empty.py +++ b/release/scripts/startup/bl_ui/properties_data_empty.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> from bpy.types import Panel diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py b/release/scripts/startup/bl_ui/properties_data_gpencil.py index df72b1182df..9d95332a901 100644 --- a/release/scripts/startup/bl_ui/properties_data_gpencil.py +++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Menu, Panel, UIList from rna_prop_ui import PropertyPanel diff --git a/release/scripts/startup/bl_ui/properties_data_lattice.py b/release/scripts/startup/bl_ui/properties_data_lattice.py index b4bf09107c5..618f73ecc06 100644 --- a/release/scripts/startup/bl_ui/properties_data_lattice.py +++ b/release/scripts/startup/bl_ui/properties_data_lattice.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Panel from rna_prop_ui import PropertyPanel diff --git a/release/scripts/startup/bl_ui/properties_data_light.py b/release/scripts/startup/bl_ui/properties_data_light.py index aab37ff89ad..df3ad43e6de 100644 --- a/release/scripts/startup/bl_ui/properties_data_light.py +++ b/release/scripts/startup/bl_ui/properties_data_light.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Panel from rna_prop_ui import PropertyPanel diff --git a/release/scripts/startup/bl_ui/properties_data_lightprobe.py b/release/scripts/startup/bl_ui/properties_data_lightprobe.py index 64ef4c17150..60f8dcc0946 100644 --- a/release/scripts/startup/bl_ui/properties_data_lightprobe.py +++ b/release/scripts/startup/bl_ui/properties_data_lightprobe.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> from bpy.types import Panel diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index 9c15dec9b94..15d25f71419 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Menu, Panel, UIList from rna_prop_ui import PropertyPanel diff --git a/release/scripts/startup/bl_ui/properties_data_metaball.py b/release/scripts/startup/bl_ui/properties_data_metaball.py index 6c56b44bcb2..defb6d55169 100644 --- a/release/scripts/startup/bl_ui/properties_data_metaball.py +++ b/release/scripts/startup/bl_ui/properties_data_metaball.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Panel from rna_prop_ui import PropertyPanel diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 8750bce5923..a2f0e3d410a 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> from bpy.types import Panel diff --git a/release/scripts/startup/bl_ui/properties_data_pointcloud.py b/release/scripts/startup/bl_ui/properties_data_pointcloud.py index 88d686b32f9..b492a87c741 100644 --- a/release/scripts/startup/bl_ui/properties_data_pointcloud.py +++ b/release/scripts/startup/bl_ui/properties_data_pointcloud.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Menu, Panel, UIList from rna_prop_ui import PropertyPanel diff --git a/release/scripts/startup/bl_ui/properties_data_shaderfx.py b/release/scripts/startup/bl_ui/properties_data_shaderfx.py index 4883a9a2a03..4bf41865177 100644 --- a/release/scripts/startup/bl_ui/properties_data_shaderfx.py +++ b/release/scripts/startup/bl_ui/properties_data_shaderfx.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> from bpy.types import Panel diff --git a/release/scripts/startup/bl_ui/properties_data_speaker.py b/release/scripts/startup/bl_ui/properties_data_speaker.py index 449ae9f1d25..7934aa0bc92 100644 --- a/release/scripts/startup/bl_ui/properties_data_speaker.py +++ b/release/scripts/startup/bl_ui/properties_data_speaker.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Panel from rna_prop_ui import PropertyPanel diff --git a/release/scripts/startup/bl_ui/properties_data_volume.py b/release/scripts/startup/bl_ui/properties_data_volume.py index 98855d4b516..460fcd7124b 100644 --- a/release/scripts/startup/bl_ui/properties_data_volume.py +++ b/release/scripts/startup/bl_ui/properties_data_volume.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Panel, UIList from rna_prop_ui import PropertyPanel diff --git a/release/scripts/startup/bl_ui/properties_freestyle.py b/release/scripts/startup/bl_ui/properties_freestyle.py index 98fcf3247a1..e74e1725aa2 100644 --- a/release/scripts/startup/bl_ui/properties_freestyle.py +++ b/release/scripts/startup/bl_ui/properties_freestyle.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Menu, Panel, UIList diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py index f186fca0849..8e5050be07e 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import bpy from bpy.types import Menu, UIList, Operator from bpy.app.translations import pgettext_iface as iface_ @@ -250,6 +248,7 @@ class GPENCIL_MT_move_to_layer(Menu): layout.separator() + layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("gpencil.move_to_layer", text="New Layer", icon='ADD').layer = -1 diff --git a/release/scripts/startup/bl_ui/properties_mask_common.py b/release/scripts/startup/bl_ui/properties_mask_common.py index d9f833e391e..3131833454b 100644 --- a/release/scripts/startup/bl_ui/properties_mask_common.py +++ b/release/scripts/startup/bl_ui/properties_mask_common.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - # panels get subclassed (not registered directly) # menus are referenced `as is` diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py index 9532d1d4ab0..44fa93054d3 100644 --- a/release/scripts/startup/bl_ui/properties_material.py +++ b/release/scripts/startup/bl_ui/properties_material.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Menu, Panel, UIList from rna_prop_ui import PropertyPanel diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py index 47c61984cbe..de1df732b7e 100644 --- a/release/scripts/startup/bl_ui/properties_material_gpencil.py +++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Menu, Panel, UIList from rna_prop_ui import PropertyPanel diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index 44c30cf4372..904c2af3a5e 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> from bl_ui.properties_animviz import ( MotionPathButtonsPanel, MotionPathButtonsPanel_display, diff --git a/release/scripts/startup/bl_ui/properties_output.py b/release/scripts/startup/bl_ui/properties_output.py index 312a580bf7d..b80a49cddbb 100644 --- a/release/scripts/startup/bl_ui/properties_output.py +++ b/release/scripts/startup/bl_ui/properties_output.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Menu, Panel, UIList from bl_ui.utils import PresetPanel diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py index d7325257084..5a9a8882bd9 100644 --- a/release/scripts/startup/bl_ui/properties_paint_common.py +++ b/release/scripts/startup/bl_ui/properties_paint_common.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> from bpy.types import Menu diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index 3d6ad2ece9b..db4e609be65 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Panel, Menu from rna_prop_ui import PropertyPanel diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py index c041534a652..dd1a1fb59d6 100644 --- a/release/scripts/startup/bl_ui/properties_physics_cloth.py +++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - from bpy.types import ( Panel, ) diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py index e9df4622cde..bb9fe6e114a 100644 --- a/release/scripts/startup/bl_ui/properties_physics_common.py +++ b/release/scripts/startup/bl_ui/properties_physics_common.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import bpy from bpy.types import ( Panel, diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py index d9d2a529693..5ab96bdd2c5 100644 --- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py +++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - from bpy.types import ( Panel, UIList, diff --git a/release/scripts/startup/bl_ui/properties_physics_field.py b/release/scripts/startup/bl_ui/properties_physics_field.py index 2e7e68f02ef..8a1bd1a0c54 100644 --- a/release/scripts/startup/bl_ui/properties_physics_field.py +++ b/release/scripts/startup/bl_ui/properties_physics_field.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - from bpy.types import ( Panel, ) diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index 88f8658035b..f1162d8935a 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import bpy from bpy.types import Panel from bl_ui.utils import PresetPanel diff --git a/release/scripts/startup/bl_ui/properties_physics_rigidbody.py b/release/scripts/startup/bl_ui/properties_physics_rigidbody.py index bf8ab90147b..ad8f539d62c 100644 --- a/release/scripts/startup/bl_ui/properties_physics_rigidbody.py +++ b/release/scripts/startup/bl_ui/properties_physics_rigidbody.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - from bpy.types import ( Panel, ) diff --git a/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py b/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py index 21c3b8b0805..5dc98674b99 100644 --- a/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py +++ b/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - from bpy.types import ( Panel, ) diff --git a/release/scripts/startup/bl_ui/properties_physics_softbody.py b/release/scripts/startup/bl_ui/properties_physics_softbody.py index 1b941100db2..bde7778e54c 100644 --- a/release/scripts/startup/bl_ui/properties_physics_softbody.py +++ b/release/scripts/startup/bl_ui/properties_physics_softbody.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - from bpy.types import ( Panel, ) diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py index 2a904bf1084..c20992166ad 100644 --- a/release/scripts/startup/bl_ui/properties_render.py +++ b/release/scripts/startup/bl_ui/properties_render.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> from bpy.types import Panel from bl_ui.space_view3d import ( VIEW3D_PT_shading_lighting, diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index 912f0c8bcaf..2e2d7fbe261 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import bpy from bpy.types import ( Panel, diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py index 1f9362f02b5..106ea76ccc8 100644 --- a/release/scripts/startup/bl_ui/properties_texture.py +++ b/release/scripts/startup/bl_ui/properties_texture.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import bpy from bpy.types import ( Menu, diff --git a/release/scripts/startup/bl_ui/properties_view_layer.py b/release/scripts/startup/bl_ui/properties_view_layer.py index 44d764f1a2d..01ded1ceb9b 100644 --- a/release/scripts/startup/bl_ui/properties_view_layer.py +++ b/release/scripts/startup/bl_ui/properties_view_layer.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> from bpy.types import Menu, Panel, UIList diff --git a/release/scripts/startup/bl_ui/properties_workspace.py b/release/scripts/startup/bl_ui/properties_workspace.py index cb4f768ac4f..542d770c062 100644 --- a/release/scripts/startup/bl_ui/properties_workspace.py +++ b/release/scripts/startup/bl_ui/properties_workspace.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import ( Panel, diff --git a/release/scripts/startup/bl_ui/properties_world.py b/release/scripts/startup/bl_ui/properties_world.py index 47e990e8573..eb0fc473e64 100644 --- a/release/scripts/startup/bl_ui/properties_world.py +++ b/release/scripts/startup/bl_ui/properties_world.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Panel from rna_prop_ui import PropertyPanel diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index c1ecfaceee7..d8d387036ff 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - import bpy from bpy.types import Panel, Header, Menu, UIList from bpy.app.translations import pgettext_iface as iface_ diff --git a/release/scripts/startup/bl_ui/space_console.py b/release/scripts/startup/bl_ui/space_console.py index 323bee8a125..e9d1fc516ae 100644 --- a/release/scripts/startup/bl_ui/space_console.py +++ b/release/scripts/startup/bl_ui/space_console.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Header, Menu diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index 437f20b9473..3d792eec3e0 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import bpy from bpy.types import ( Header, diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py index e69a1024712..96ce731306f 100644 --- a/release/scripts/startup/bl_ui/space_filebrowser.py +++ b/release/scripts/startup/bl_ui/space_filebrowser.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import bpy from bpy.types import Header, Panel, Menu, UIList diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py index a78ad72cada..a5ad13ad5d8 100644 --- a/release/scripts/startup/bl_ui/space_graph.py +++ b/release/scripts/startup/bl_ui/space_graph.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - from bpy.types import Header, Menu, Panel from bl_ui.space_dopesheet import ( DopesheetFilterPopoverBase, diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index d61055c9024..1f02e0f64d4 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - from bpy.types import ( Header, Menu, diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py index 41c8b99b78c..3a9e4841749 100644 --- a/release/scripts/startup/bl_ui/space_info.py +++ b/release/scripts/startup/bl_ui/space_info.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> from bpy.types import Header, Menu diff --git a/release/scripts/startup/bl_ui/space_nla.py b/release/scripts/startup/bl_ui/space_nla.py index 77a472d844e..d6f26880d20 100644 --- a/release/scripts/startup/bl_ui/space_nla.py +++ b/release/scripts/startup/bl_ui/space_nla.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - from bpy.types import Header, Menu, Panel from bpy.app.translations import contexts as i18n_contexts from bl_ui.space_dopesheet import ( diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py index 813a799db24..427d0696c20 100644 --- a/release/scripts/startup/bl_ui/space_node.py +++ b/release/scripts/startup/bl_ui/space_node.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Header, Menu, Panel from bpy.app.translations import pgettext_iface as iface_ diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py index f953095b9bb..fff252ade01 100644 --- a/release/scripts/startup/bl_ui/space_outliner.py +++ b/release/scripts/startup/bl_ui/space_outliner.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Header, Menu, Panel diff --git a/release/scripts/startup/bl_ui/space_properties.py b/release/scripts/startup/bl_ui/space_properties.py index c15611fd375..28342d28ac8 100644 --- a/release/scripts/startup/bl_ui/space_properties.py +++ b/release/scripts/startup/bl_ui/space_properties.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> from bpy.types import Header, Panel diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 40da0b03f76..84725d9e781 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import ( Header, diff --git a/release/scripts/startup/bl_ui/space_statusbar.py b/release/scripts/startup/bl_ui/space_statusbar.py index 90e685ac559..a281492aba8 100644 --- a/release/scripts/startup/bl_ui/space_statusbar.py +++ b/release/scripts/startup/bl_ui/space_statusbar.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> from bpy.types import Header diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py index 18c309a3456..52d66e48d1c 100644 --- a/release/scripts/startup/bl_ui/space_text.py +++ b/release/scripts/startup/bl_ui/space_text.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8-80 compliant> import bpy from bpy.types import Header, Menu, Panel from bpy.app.translations import pgettext_iface as iface_ diff --git a/release/scripts/startup/bl_ui/space_time.py b/release/scripts/startup/bl_ui/space_time.py index 13ab6e67b00..115f61a7c19 100644 --- a/release/scripts/startup/bl_ui/space_time.py +++ b/release/scripts/startup/bl_ui/space_time.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Menu, Panel diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py index 36d801154ca..0c796b899af 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_common.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import ( Menu, diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index 1c526cc89e4..31f25d016a6 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # For documentation on tool definitions: see "bl_ui.space_toolsystem_common.ToolDef" # where there are comments for each field and their use. diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index 2cf50bdbf95..ba1e9aa019e 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import Header, Menu, Panel diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index ee3e7b7df8f..191066df89f 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import ( Header, diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 116dd280b5c..b7fe715ca90 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy from bpy.types import ( Header, diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 1b714a40d03..892dc9a1e42 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> from bpy.types import Menu, Panel, UIList from bl_ui.properties_grease_pencil_common import ( GreasePencilSculptAdvancedPanel, diff --git a/release/scripts/startup/bl_ui/utils.py b/release/scripts/startup/bl_ui/utils.py index 02d2448af66..87f44601ff3 100644 --- a/release/scripts/startup/bl_ui/utils.py +++ b/release/scripts/startup/bl_ui/utils.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - from bpy.types import Menu diff --git a/release/scripts/startup/keyingsets_builtins.py b/release/scripts/startup/keyingsets_builtins.py index fb287183c99..4390e6f0959 100644 --- a/release/scripts/startup/keyingsets_builtins.py +++ b/release/scripts/startup/keyingsets_builtins.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - """ Built-In Keying Sets None of these Keying Sets should be removed, as these are needed by various parts of Blender in order for them diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py index f5282123ce8..48ba7ea99f2 100644 --- a/release/scripts/startup/nodeitems_builtins.py +++ b/release/scripts/startup/nodeitems_builtins.py @@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> import bpy import nodeitems_utils from nodeitems_utils import ( diff --git a/source/blender/blenkernel/BKE_callbacks.h b/source/blender/blenkernel/BKE_callbacks.h index 8b2af96a063..d8c67c52edc 100644 --- a/source/blender/blenkernel/BKE_callbacks.h +++ b/source/blender/blenkernel/BKE_callbacks.h @@ -97,6 +97,9 @@ typedef enum { BKE_CB_EVT_XR_SESSION_START_PRE, BKE_CB_EVT_ANNOTATION_PRE, BKE_CB_EVT_ANNOTATION_POST, + BKE_CB_EVT_OBJECT_BAKE_PRE, + BKE_CB_EVT_OBJECT_BAKE_COMPLETE, + BKE_CB_EVT_OBJECT_BAKE_CANCEL, BKE_CB_EVT_TOT, } eCbEvent; diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h index a3bbcc8687a..41d369ae9b2 100644 --- a/source/blender/blenkernel/BKE_collection.h +++ b/source/blender/blenkernel/BKE_collection.h @@ -115,6 +115,18 @@ bool BKE_collection_is_empty(const struct Collection *collection); bool BKE_collection_object_add(struct Main *bmain, struct Collection *collection, struct Object *ob); + +/** + * Add object to given collection, similar to #BKE_collection_object_add. + * + * However, it additionnally ensures that the selected collection is also part of the given + * `view_layer`, if non-NULL. Otherwise, the object is not added to any collection. + */ +bool BKE_collection_viewlayer_object_add(struct Main *bmain, + const struct ViewLayer *view_layer, + struct Collection *collection, + struct Object *ob); + /** * Same as #BKE_collection_object_add, but unconditionally adds the object to the given collection. * diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index 78d80ce200e..30c73e0fcc6 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -259,6 +259,18 @@ struct FCurve *BKE_fcurve_iter_step(struct FCurve *fcu_iter, const char rna_path /** * High level function to get an f-curve from C without having the RNA. + * + * If there is an action assigned to the `id`'s #AnimData, it will be searched for a matching + * F-curve first. Drivers are searched only if no valid action F-curve could be found. + * + * \note: Return pointer parameter (`r_driven`) is optional and may be NULL. + * + * \warning: In case no animation (from an Action) F-curve is found, returned value is always NULL. + * This means that this function will set `r_driven` to True in case a valid driver F-curve is + * found, but will not return said F-curve. In other words: + * - Animated with FCurve: returns the `FCurve*` and `*r_driven = false`. + * - Animated with driver: returns `NULL` and `*r_driven = true`. + * - Not animated: returns `NULL` and `*r_driven = false`. */ struct FCurve *id_data_find_fcurve( ID *id, void *data, struct StructRNA *type, const char *prop_name, int index, bool *r_driven); @@ -279,6 +291,25 @@ struct FCurve *id_data_find_fcurve( int BKE_fcurves_filter(ListBase *dst, ListBase *src, const char *dataPrefix, const char *dataName); /** + * Find an F-Curve from its rna path and index. + * + * If there is an action assigned to the `animdata`, it will be searched for a matching F-curve + * first. Drivers are searched only if no valid action F-curve could be found. + * + * \note: Typically, indices in RNA arrays are stored separately in F-curves, so the rna_path + * should not include them (e.g. `rna_path='location[0]'` will not match any F-Curve on an Object, + * but `rna_path='location', rna_index=0` will if it exists). + * + * \note: Return pointer parameters (`r_action`, `r_driven` and `r_special`) are all optional and + * may be NULL. + */ +struct FCurve *BKE_animadata_fcurve_find_by_rna_path(struct AnimData *animdata, + const char *rna_path, + const int rna_index, + struct bAction **r_action, + bool *r_driven); + +/** * Find an f-curve based on an rna property. */ struct FCurve *BKE_fcurve_find_by_rna(struct PointerRNA *ptr, @@ -291,7 +322,9 @@ struct FCurve *BKE_fcurve_find_by_rna(struct PointerRNA *ptr, /** * Same as above, but takes a context data, * temp hack needed for complex paths like texture ones. - */ + * + * \param r_special Optional, ignored when NULL. Set to `true` if the given RNA `ptr` is a NLA + * strip, and the returned F-curve comes from this NLA strip. */ struct FCurve *BKE_fcurve_find_by_rna_context_ui(struct bContext *C, const struct PointerRNA *ptr, struct PropertyRNA *prop, diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index edb301f06bf..9965b6f1351 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -136,7 +136,7 @@ void BKE_sound_remove_scene_sound(struct Scene *scene, void *handle); void BKE_sound_mute_scene_sound(void *handle, char mute); -void BKE_sound_move_scene_sound(struct Scene *scene, +void BKE_sound_move_scene_sound(const struct Scene *scene, void *handle, int startframe, int endframe, diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 76c6dc1d5e7..b71bcef229a 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -996,9 +996,11 @@ static void collection_tag_update_parent_recursive(Main *bmain, } } -static Collection *collection_parent_editable_find_recursive(Collection *collection) +static Collection *collection_parent_editable_find_recursive(const ViewLayer *view_layer, + Collection *collection) { - if (!ID_IS_LINKED(collection) && !ID_IS_OVERRIDE_LIBRARY(collection)) { + if (!ID_IS_LINKED(collection) && !ID_IS_OVERRIDE_LIBRARY(collection) && + (view_layer == NULL || BKE_view_layer_has_collection(view_layer, collection))) { return collection; } @@ -1009,10 +1011,16 @@ static Collection *collection_parent_editable_find_recursive(Collection *collect LISTBASE_FOREACH (CollectionParent *, collection_parent, &collection->parents) { if (!ID_IS_LINKED(collection_parent->collection) && !ID_IS_OVERRIDE_LIBRARY(collection_parent->collection)) { + if (view_layer != NULL && + !BKE_view_layer_has_collection(view_layer, collection_parent->collection)) { + /* In case this parent collection is not in given view_layer, there is no point in + * searching in its ancestors either, we can skip that whole parenting branch. */ + continue; + } return collection_parent->collection; } Collection *editable_collection = collection_parent_editable_find_recursive( - collection_parent->collection); + view_layer, collection_parent->collection); if (editable_collection != NULL) { return editable_collection; } @@ -1110,11 +1118,23 @@ bool BKE_collection_object_add_notest(Main *bmain, Collection *collection, Objec bool BKE_collection_object_add(Main *bmain, Collection *collection, Object *ob) { + return BKE_collection_viewlayer_object_add(bmain, NULL, collection, ob); +} + +bool BKE_collection_viewlayer_object_add(Main *bmain, + const ViewLayer *view_layer, + Collection *collection, + Object *ob) +{ if (collection == NULL) { return false; } - collection = collection_parent_editable_find_recursive(collection); + collection = collection_parent_editable_find_recursive(view_layer, collection); + + if (collection == NULL) { + return false; + } return BKE_collection_object_add_notest(bmain, collection, ob); } diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 952d5df299c..98a2b977d4e 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -229,16 +229,13 @@ FCurve *id_data_find_fcurve( return NULL; } - /* Animation takes priority over drivers. */ - if (adt->action && adt->action->curves.first) { - fcu = BKE_fcurve_find(&adt->action->curves, path, index); - } - - /* If not animated, check if driven. */ - if (fcu == NULL && adt->drivers.first) { - fcu = BKE_fcurve_find(&adt->drivers, path, index); - if (fcu && r_driven) { - *r_driven = true; + /* FIXME: The way drivers are handled here (always NULL-ifying `fcu`) is very weird, this needs + * to be re-checked I think?. */ + bool is_driven = false; + fcu = BKE_animadata_fcurve_find_by_rna_path(adt, path, index, NULL, &is_driven); + if (is_driven) { + if (r_driven != NULL) { + *r_driven = is_driven; } fcu = NULL; } @@ -339,6 +336,47 @@ int BKE_fcurves_filter(ListBase *dst, ListBase *src, const char *dataPrefix, con return matches; } +FCurve *BKE_animadata_fcurve_find_by_rna_path( + AnimData *animdata, const char *rna_path, int rna_index, bAction **r_action, bool *r_driven) +{ + if (r_driven != NULL) { + *r_driven = false; + } + if (r_action != NULL) { + *r_action = NULL; + } + + const bool has_action_fcurves = animdata->action != NULL && + !BLI_listbase_is_empty(&animdata->action->curves); + const bool has_drivers = !BLI_listbase_is_empty(&animdata->drivers); + + /* Animation takes priority over drivers. */ + if (has_action_fcurves) { + FCurve *fcu = BKE_fcurve_find(&animdata->action->curves, rna_path, rna_index); + + if (fcu != NULL) { + if (r_action != NULL) { + *r_action = animdata->action; + } + return fcu; + } + } + + /* If not animated, check if driven. */ + if (has_drivers) { + FCurve *fcu = BKE_fcurve_find(&animdata->drivers, rna_path, rna_index); + + if (fcu != NULL) { + if (r_driven != NULL) { + *r_driven = true; + } + return fcu; + } + } + + return NULL; +} + FCurve *BKE_fcurve_find_by_rna(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, @@ -360,17 +398,18 @@ FCurve *BKE_fcurve_find_by_rna_context_ui(bContext *UNUSED(C), bool *r_driven, bool *r_special) { - FCurve *fcu = NULL; - - *r_driven = false; - *r_special = false; - - if (r_animdata) { + if (r_animdata != NULL) { *r_animdata = NULL; } - if (r_action) { + if (r_action != NULL) { *r_action = NULL; } + if (r_driven != NULL) { + *r_driven = false; + } + if (r_special) { + *r_special = false; + } /* Special case for NLA Control Curves... */ if (BKE_nlastrip_has_curves_for_property(ptr, prop)) { @@ -379,59 +418,46 @@ FCurve *BKE_fcurve_find_by_rna_context_ui(bContext *UNUSED(C), /* Set the special flag, since it cannot be a normal action/driver * if we've been told to start looking here... */ - *r_special = true; + if (r_special) { + *r_special = true; + } + + *r_driven = false; + if (r_animdata) { + *r_animdata = NULL; + } + if (r_action) { + *r_action = NULL; + } /* The F-Curve either exists or it doesn't here... */ - fcu = BKE_fcurve_find(&strip->fcurves, RNA_property_identifier(prop), rnaindex); - return fcu; + return BKE_fcurve_find(&strip->fcurves, RNA_property_identifier(prop), rnaindex); } /* There must be some RNA-pointer + property combo. */ if (!prop || !ptr->owner_id || !RNA_property_animateable(ptr, prop)) { - return fcu; + return NULL; } AnimData *adt = BKE_animdata_from_id(ptr->owner_id); if (adt == NULL) { - return fcu; + return NULL; } - const bool has_action_fcurves = adt->action != NULL && - !BLI_listbase_is_empty(&adt->action->curves); - const bool has_drivers = !BLI_listbase_is_empty(&adt->drivers); - /* XXX This function call can become a performance bottleneck. */ - char *path = RNA_path_from_ID_to_property(ptr, prop); - - /* Standard F-Curve - Animation (Action) or Drivers. */ - /* Animation takes priority over drivers. */ - /* XXX: The logic here is duplicated with a function up above. */ - if (has_action_fcurves) { - fcu = BKE_fcurve_find(&adt->action->curves, path, rnaindex); - - if (fcu) { - if (r_action) { - *r_action = adt->action; - } - if (r_animdata) { - *r_animdata = adt; - } - } + char *rna_path = RNA_path_from_ID_to_property(ptr, prop); + if (rna_path == NULL) { + return NULL; } - /* If not animated, check if driven. */ - if (fcu == NULL && has_drivers) { - fcu = BKE_fcurve_find(&adt->drivers, path, rnaindex); + /* Standard F-Curve from animdata - Animation (Action) or Drivers. */ + FCurve *fcu = BKE_animadata_fcurve_find_by_rna_path(adt, rna_path, rnaindex, r_action, r_driven); - if (fcu) { - if (r_animdata) { - *r_animdata = adt; - } - *r_driven = true; - } + if (fcu != NULL && r_animdata != NULL) { + *r_animdata = adt; } - MEM_SAFE_FREE(path); + MEM_freeN(rna_path); return fcu; } diff --git a/source/blender/blenkernel/intern/object.cc b/source/blender/blenkernel/intern/object.cc index 55b9951c52d..52b25399e32 100644 --- a/source/blender/blenkernel/intern/object.cc +++ b/source/blender/blenkernel/intern/object.cc @@ -2271,10 +2271,14 @@ Object *BKE_object_add(Main *bmain, ViewLayer *view_layer, int type, const char Object *ob = object_add_common(bmain, view_layer, type, name); LayerCollection *layer_collection = BKE_layer_collection_get_active(view_layer); - BKE_collection_object_add(bmain, layer_collection->collection, ob); + BKE_collection_viewlayer_object_add(bmain, view_layer, layer_collection->collection, ob); + /* Note: There is no way to be sure that #BKE_collection_viewlayer_object_add will actually + * manage to find a valid collection in given `view_layer` to add the new object to. */ Base *base = BKE_view_layer_base_find(view_layer, ob); - BKE_view_layer_base_select_and_set_active(view_layer, base); + if (base != nullptr) { + BKE_view_layer_base_select_and_set_active(view_layer, base); + } return ob; } diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index de5589cf5dc..5bafce15b34 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -54,6 +54,7 @@ #include "SEQ_sequencer.h" #include "SEQ_sound.h" +#include "SEQ_time.h" static void sound_free_audio(bSound *sound); @@ -719,8 +720,8 @@ void *BKE_sound_scene_add_scene_sound_defaults(Scene *scene, Sequence *sequence) { return BKE_sound_scene_add_scene_sound(scene, sequence, - sequence->startdisp, - sequence->enddisp, + SEQ_time_left_handle_frame_get(sequence), + SEQ_time_right_handle_frame_get(sequence), sequence->startofs + sequence->anim_startofs); } @@ -745,8 +746,8 @@ void *BKE_sound_add_scene_sound_defaults(Scene *scene, Sequence *sequence) { return BKE_sound_add_scene_sound(scene, sequence, - sequence->startdisp, - sequence->enddisp, + SEQ_time_left_handle_frame_get(sequence), + SEQ_time_right_handle_frame_get(sequence), sequence->startofs + sequence->anim_startofs); } @@ -760,8 +761,12 @@ void BKE_sound_mute_scene_sound(void *handle, char mute) AUD_SequenceEntry_setMuted(handle, mute); } -void BKE_sound_move_scene_sound( - Scene *scene, void *handle, int startframe, int endframe, int frameskip, double audio_offset) +void BKE_sound_move_scene_sound(const Scene *scene, + void *handle, + int startframe, + int endframe, + int frameskip, + double audio_offset) { sound_verify_evaluated_id(&scene->id); const double fps = FPS; @@ -774,8 +779,8 @@ void BKE_sound_move_scene_sound_defaults(Scene *scene, Sequence *sequence) if (sequence->scene_sound) { BKE_sound_move_scene_sound(scene, sequence->scene_sound, - sequence->startdisp, - sequence->enddisp, + SEQ_time_left_handle_frame_get(sequence), + SEQ_time_right_handle_frame_get(sequence), sequence->startofs + sequence->anim_startofs, 0.0); } @@ -1344,7 +1349,7 @@ void BKE_sound_remove_scene_sound(Scene *UNUSED(scene), void *UNUSED(handle)) void BKE_sound_mute_scene_sound(void *UNUSED(handle), char UNUSED(mute)) { } -void BKE_sound_move_scene_sound(Scene *UNUSED(scene), +void BKE_sound_move_scene_sound(const Scene *UNUSED(scene), void *UNUSED(handle), int UNUSED(startframe), int UNUSED(endframe), diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index 585ada3b2d8..cd56adfe60c 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -347,8 +347,9 @@ static void seq_convert_transform_crop_lb_2(const Scene *scene, } } -static void seq_update_meta_disp_range(Editing *ed) +static void seq_update_meta_disp_range(Scene *scene) { + Editing *ed = SEQ_editing_get(scene); if (ed == NULL) { return; } @@ -356,21 +357,14 @@ static void seq_update_meta_disp_range(Editing *ed) LISTBASE_FOREACH_BACKWARD (MetaStack *, ms, &ed->metastack) { /* Update ms->disp_range from meta. */ if (ms->disp_range[0] == ms->disp_range[1]) { - copy_v2_v2_int(ms->disp_range, &ms->parseq->startdisp); + ms->disp_range[0] = SEQ_time_left_handle_frame_get(ms->parseq); + ms->disp_range[1] = SEQ_time_right_handle_frame_get(ms->parseq); } /* Update meta strip endpoints. */ - SEQ_time_left_handle_frame_set(ms->parseq, ms->disp_range[0]); - SEQ_time_right_handle_frame_set(ms->parseq, ms->disp_range[1]); - SEQ_transform_fix_single_image_seq_offsets(ms->parseq); - - /* Recalculate effects using meta strip. */ - LISTBASE_FOREACH (Sequence *, seq, ms->oldbasep) { - if (seq->seq2) { - seq->start = seq->startdisp = max_ii(seq->seq1->startdisp, seq->seq2->startdisp); - seq->enddisp = min_ii(seq->seq1->enddisp, seq->seq2->enddisp); - } - } + SEQ_time_left_handle_frame_set(scene, ms->parseq, ms->disp_range[0]); + SEQ_time_right_handle_frame_set(scene, ms->parseq, ms->disp_range[1]); + SEQ_transform_fix_single_image_seq_offsets(scene, ms->parseq); /* Ensure that active seqbase points to active meta strip seqbase. */ MetaStack *active_ms = SEQ_meta_stack_active_get(ed); @@ -647,7 +641,7 @@ void do_versions_after_linking_290(Main *bmain, ReportList *UNUSED(reports)) if (!MAIN_VERSION_ATLEAST(bmain, 293, 16)) { LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { - seq_update_meta_disp_range(SEQ_editing_get(scene)); + seq_update_meta_disp_range(scene); } /* Add a separate socket for Grid node X and Y size. */ diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index cce1c757c0b..e13d747914e 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -405,7 +405,9 @@ static void do_versions_sequencer_speed_effect_recursive(Scene *scene, const Lis v->speed_control_type = SEQ_SPEED_MULTIPLY; v->speed_fader = globalSpeed * ((float)seq->seq1->len / - max_ff((float)(seq->seq1->enddisp - seq->seq1->start), 1.0f)); + max_ff((float)(SEQ_time_right_handle_frame_get(seq->seq1) - + seq->seq1->start), + 1.0f)); } } else if (v->flags & SEQ_SPEED_INTEGRATE) { diff --git a/source/blender/datatoc/datatoc_icon.py b/source/blender/datatoc/datatoc_icon.py index cce464dbc41..7373df71318 100755 --- a/source/blender/datatoc/datatoc_icon.py +++ b/source/blender/datatoc/datatoc_icon.py @@ -1,7 +1,5 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later - -# <pep8 compliant> _IS_BIG_ENDIAN = (__import__("sys").byteorder != 'little') diff --git a/source/blender/datatoc/datatoc_icon_split.py b/source/blender/datatoc/datatoc_icon_split.py index fcfd63f8707..8edafeda328 100755 --- a/source/blender/datatoc/datatoc_icon_split.py +++ b/source/blender/datatoc/datatoc_icon_split.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - """ This script dices up PNG into small files to store in version control. diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 9da9845116d..dc49a5ed531 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -4729,6 +4729,7 @@ void CURVE_OT_make_segment(wmOperatorType *ot) bool ED_curve_editnurb_select_pick(bContext *C, const int mval[2], const int dist_px, + const bool vert_without_handles, const struct SelectPick_Params *params) { Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); @@ -4744,6 +4745,9 @@ bool ED_curve_editnurb_select_pick(bContext *C, ED_view3d_viewcontext_init(C, &vc, depsgraph); copy_v2_v2_int(vc.mval, mval); + const bool use_handle_select = vert_without_handles && + (vc.v3d->overlay.handle_display != CURVE_HANDLE_NONE); + bool found = ED_curve_pick_vert_ex(&vc, 1, dist_px, &nu, &bezt, &bp, &hand, &basact); if (params->sel_op == SEL_OP_SET) { @@ -4779,7 +4783,12 @@ bool ED_curve_editnurb_select_pick(bContext *C, case SEL_OP_ADD: { if (bezt) { if (hand == 1) { - select_beztriple(bezt, SELECT, SELECT, HIDDEN); + if (use_handle_select) { + bezt->f2 |= SELECT; + } + else { + select_beztriple(bezt, SELECT, SELECT, HIDDEN); + } } else { if (hand == 0) { @@ -4800,7 +4809,12 @@ bool ED_curve_editnurb_select_pick(bContext *C, case SEL_OP_SUB: { if (bezt) { if (hand == 1) { - select_beztriple(bezt, DESELECT, SELECT, HIDDEN); + if (use_handle_select) { + bezt->f2 &= ~SELECT; + } + else { + select_beztriple(bezt, DESELECT, SELECT, HIDDEN); + } if (bezt == vert) { cu->actvert = CU_ACT_NONE; } @@ -4824,13 +4838,23 @@ bool ED_curve_editnurb_select_pick(bContext *C, if (bezt) { if (hand == 1) { if (bezt->f2 & SELECT) { - select_beztriple(bezt, DESELECT, SELECT, HIDDEN); + if (use_handle_select) { + bezt->f2 &= ~SELECT; + } + else { + select_beztriple(bezt, DESELECT, SELECT, HIDDEN); + } if (bezt == vert) { cu->actvert = CU_ACT_NONE; } } else { - select_beztriple(bezt, SELECT, SELECT, HIDDEN); + if (use_handle_select) { + bezt->f2 |= SELECT; + } + else { + select_beztriple(bezt, SELECT, SELECT, HIDDEN); + } BKE_curve_nurb_vert_active_set(cu, nu, bezt); } } @@ -4861,7 +4885,12 @@ bool ED_curve_editnurb_select_pick(bContext *C, if (bezt) { if (hand == 1) { - select_beztriple(bezt, SELECT, SELECT, HIDDEN); + if (use_handle_select) { + bezt->f2 |= SELECT; + } + else { + select_beztriple(bezt, SELECT, SELECT, HIDDEN); + } } else { if (hand == 0) { diff --git a/source/blender/editors/curve/editcurve_pen.c b/source/blender/editors/curve/editcurve_pen.c index fca850076ae..a98b165e99d 100644 --- a/source/blender/editors/curve/editcurve_pen.c +++ b/source/blender/editors/curve/editcurve_pen.c @@ -1655,7 +1655,7 @@ static int curve_pen_modal(bContext *C, wmOperator *op, const wmEvent *event) else if (ELEM(event->type, LEFTMOUSE)) { if (ELEM(event->val, KM_RELEASE, KM_DBL_CLICK)) { if (delete_point && !cpd->new_point && !cpd->dragging) { - if (ED_curve_editnurb_select_pick(C, event->mval, threshold_dist_px, ¶ms)) { + if (ED_curve_editnurb_select_pick(C, event->mval, threshold_dist_px, false, ¶ms)) { cpd->acted = delete_point_under_mouse(&vc, event); } } @@ -1714,7 +1714,7 @@ static int curve_pen_modal(bContext *C, wmOperator *op, const wmEvent *event) } } else if (select_point) { - ED_curve_editnurb_select_pick(C, event->mval, threshold_dist_px, ¶ms); + ED_curve_editnurb_select_pick(C, event->mval, threshold_dist_px, false, ¶ms); } } diff --git a/source/blender/editors/curves/intern/curves_ops.cc b/source/blender/editors/curves/intern/curves_ops.cc index 0e12257be58..85214e1608d 100644 --- a/source/blender/editors/curves/intern/curves_ops.cc +++ b/source/blender/editors/curves/intern/curves_ops.cc @@ -848,10 +848,21 @@ static int select_all_exec(bContext *C, wmOperator *op) for (Curves *curves_id : unique_curves) { if (action == SEL_SELECT) { + /* The optimization to avoid storing the selection when everything is selected causes too + * many problems at the moment, since there is no proper visualization yet. Keep the code but + * disable it for now. */ +#if 0 CurveComponent component; component.replace(curves_id, GeometryOwnershipType::Editable); component.attribute_try_delete(".selection_point_float"); component.attribute_try_delete(".selection_curve_float"); +#else + CurvesGeometry &curves = CurvesGeometry::wrap(curves_id->geometry); + MutableSpan<float> selection = curves_id->selection_domain == ATTR_DOMAIN_POINT ? + curves.selection_point_float_for_write() : + curves.selection_curve_float_for_write(); + selection.fill(1.0f); +#endif } else { CurvesGeometry &curves = CurvesGeometry::wrap(curves_id->geometry); diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 3c8e6d6e5f5..5028baf1589 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -1811,7 +1811,16 @@ static int gpencil_move_to_layer_exec(bContext *C, wmOperator *op) } else { /* Create a new layer. */ - target_layer = BKE_gpencil_layer_addnew(gpd, "GP_Layer", true, false); + PropertyRNA *prop; + char name[128]; + prop = RNA_struct_find_property(op->ptr, "new_layer_name"); + if (RNA_property_is_set(op->ptr, prop)) { + RNA_property_string_get(op->ptr, prop, name); + } + else { + strcpy(name, "GP_Layer"); + } + target_layer = BKE_gpencil_layer_addnew(gpd, name, true, false); } if (target_layer == NULL) { @@ -1888,8 +1897,46 @@ static int gpencil_move_to_layer_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } +static void layer_new_name_get(bGPdata *gpd, char *rname) +{ + int index = 0; + LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { + if (strstr(gpl->info, "GP_Layer")) { + index++; + } + } + + if (index == 0) { + BLI_strncpy(rname, "GP_Layer", 128); + return; + } + char *name = BLI_sprintfN("%.*s.%03d", 128, "GP_Layer", index); + BLI_strncpy(rname, name, 128); + MEM_freeN(name); +} + +static int gpencil_move_to_layer_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) +{ + Object *ob = CTX_data_active_object(C); + PropertyRNA *prop; + if (RNA_int_get(op->ptr, "layer") == -1) { + prop = RNA_struct_find_property(op->ptr, "new_layer_name"); + if (!RNA_property_is_set(op->ptr, prop)) { + char name[MAX_NAME]; + bGPdata *gpd = ob->data; + layer_new_name_get(gpd, name); + RNA_property_string_set(op->ptr, prop, name); + return WM_operator_props_dialog_popup(C, op, 200); + } + } + + return gpencil_move_to_layer_exec(C, op); +} + void GPENCIL_OT_move_to_layer(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name = "Move Strokes to Layer"; ot->idname = "GPENCIL_OT_move_to_layer"; @@ -1898,15 +1945,20 @@ void GPENCIL_OT_move_to_layer(wmOperatorType *ot) /* callbacks */ ot->exec = gpencil_move_to_layer_exec; - ot->poll = gpencil_stroke_edit_poll; /* XXX? */ + ot->invoke = gpencil_move_to_layer_invoke; + ot->poll = gpencil_stroke_edit_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* GPencil layer to use. */ - ot->prop = RNA_def_int( - ot->srna, "layer", 0, -1, INT_MAX, "Grease Pencil Layer", "", -1, INT_MAX); - RNA_def_property_flag(ot->prop, PROP_HIDDEN | PROP_SKIP_SAVE); + prop = RNA_def_int(ot->srna, "layer", 0, -1, INT_MAX, "Grease Pencil Layer", "", -1, INT_MAX); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + + prop = RNA_def_string( + ot->srna, "new_layer_name", NULL, MAX_NAME, "Name", "Name of the newly added layer"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + ot->prop = prop; } /** \} */ diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h index 9f4833bf1d7..061b783797d 100644 --- a/source/blender/editors/include/ED_curve.h +++ b/source/blender/editors/include/ED_curve.h @@ -49,10 +49,12 @@ void ED_curve_editnurb_free(struct Object *obedit); /** * \param dist_px: Maximum distance to pick (in pixels). + * \param vert_without_handles: When true, selecting the knot doesn't select the handles. */ bool ED_curve_editnurb_select_pick(struct bContext *C, const int mval[2], int dist_px, + bool vert_without_handles, const struct SelectPick_Params *params); struct Nurb *ED_curve_add_nurbs_primitive( diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 5b3487b0a33..c16b82e34bd 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -4672,6 +4672,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event) case MOUSEMOVE: /* Mouse moved somewhere to select another loop. */ if (kcd->mode != MODE_PANNING) { knifetool_update_mval_i(kcd, event->mval); + knife_update_header(C, op, kcd); if (kcd->is_drag_hold) { if (kcd->totlinehit >= 2) { @@ -4754,6 +4755,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event) /* We don't really need to update mval, * but this happens to be the best way to refresh at the moment. */ knifetool_update_mval_i(kcd, event->mval); + knife_update_header(C, op, kcd); } /* Keep going until the user confirms. */ diff --git a/source/blender/editors/object/object_add.cc b/source/blender/editors/object/object_add.cc index dc404c28d16..81aa4150530 100644 --- a/source/blender/editors/object/object_add.cc +++ b/source/blender/editors/object/object_add.cc @@ -621,9 +621,16 @@ Object *ED_object_add_type_with_obdata(bContext *C, else { ob = BKE_object_add(bmain, view_layer, type, name); } - BASACT(view_layer)->local_view_bits = local_view_bits; - /* editor level activate, notifiers */ - ED_object_base_activate(C, view_layer->basact); + + Base *ob_base_act = BASACT(view_layer); + /* While not getting a valid base is not a good thing, it can happen in convoluted corner cases, + * better not crash on it in releases. */ + BLI_assert(ob_base_act != nullptr); + if (ob_base_act != nullptr) { + ob_base_act->local_view_bits = local_view_bits; + /* editor level activate, notifiers */ + ED_object_base_activate(C, ob_base_act); + } /* more editor stuff */ ED_object_base_init_transform_on_add(ob, loc, rot); diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c index 114b2ce8102..4c1e90255f6 100644 --- a/source/blender/editors/object/object_bake_api.c +++ b/source/blender/editors/object/object_bake_api.c @@ -21,6 +21,7 @@ #include "BLI_path_util.h" #include "BLI_string.h" +#include "BKE_callbacks.h" #include "BKE_context.h" #include "BKE_global.h" #include "BKE_image.h" @@ -1806,6 +1807,17 @@ static void bake_startjob(void *bkv, short *UNUSED(stop), short *do_update, floa RE_SetReports(bkr->render, NULL); } +static void bake_job_complete(void *bkv) +{ + BakeAPIRender *bkr = (BakeAPIRender *)bkv; + BKE_callback_exec_id(bkr->main, &bkr->ob->id, BKE_CB_EVT_OBJECT_BAKE_COMPLETE); +} +static void bake_job_canceled(void *bkv) +{ + BakeAPIRender *bkr = (BakeAPIRender *)bkv; + BKE_callback_exec_id(bkr->main, &bkr->ob->id, BKE_CB_EVT_OBJECT_BAKE_CANCEL); +} + static void bake_freejob(void *bkv) { BakeAPIRender *bkr = (BakeAPIRender *)bkv; @@ -1941,6 +1953,7 @@ static int bake_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event) /* init bake render */ bake_init_api_data(op, C, bkr); + BKE_callback_exec_id(CTX_data_main(C), &bkr->ob->id, BKE_CB_EVT_OBJECT_BAKE_PRE); re = bkr->render; /* setup new render */ @@ -1958,7 +1971,8 @@ static int bake_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event) /* TODO: only draw bake image, can we enforce this. */ WM_jobs_timer( wm_job, 0.5, (bkr->target == R_BAKE_TARGET_VERTEX_COLORS) ? NC_GEOM | ND_DATA : NC_IMAGE, 0); - WM_jobs_callbacks(wm_job, bake_startjob, NULL, NULL, NULL); + WM_jobs_callbacks_ex( + wm_job, bake_startjob, NULL, NULL, NULL, bake_job_complete, bake_job_canceled); G.is_break = false; G.is_rendering = true; diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 10c6e828e96..ea6d3351eaa 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -191,10 +191,11 @@ static int sequencer_generic_invoke_xy_guess_channel(bContext *C, int type) } for (seq = ed->seqbasep->first; seq; seq = seq->next) { - if ((ELEM(type, -1, seq->type)) && (seq->enddisp < timeline_frame) && - (timeline_frame - seq->enddisp < proximity)) { + const int strip_end = SEQ_time_right_handle_frame_get(seq); + if ((ELEM(type, -1, seq->type)) && (strip_end < timeline_frame) && + (timeline_frame - strip_end < proximity)) { tgt = seq; - proximity = timeline_frame - seq->enddisp; + proximity = timeline_frame - strip_end; } } @@ -785,7 +786,6 @@ static void seq_build_proxy(bContext *C, SeqCollection *movie_strips) } static void sequencer_add_movie_clamp_sound_strip_length(Scene *scene, - ListBase *seqbase, Sequence *seq_movie, Sequence *seq_sound) { @@ -793,9 +793,8 @@ static void sequencer_add_movie_clamp_sound_strip_length(Scene *scene, return; } - SEQ_time_right_handle_frame_set(seq_sound, SEQ_time_right_handle_frame_get(seq_movie)); - SEQ_time_left_handle_frame_set(seq_sound, SEQ_time_left_handle_frame_get(seq_movie)); - SEQ_time_update_sequence(scene, seqbase, seq_sound); + SEQ_time_right_handle_frame_set(scene, seq_sound, SEQ_time_right_handle_frame_get(seq_movie)); + SEQ_time_left_handle_frame_set(scene, seq_sound, SEQ_time_left_handle_frame_get(seq_movie)); } static void sequencer_add_movie_multiple_strips(bContext *C, @@ -833,7 +832,7 @@ static void sequencer_add_movie_multiple_strips(bContext *C, else { if (RNA_boolean_get(op->ptr, "sound")) { seq_sound = SEQ_add_sound_strip(bmain, scene, ed->seqbasep, load_data); - sequencer_add_movie_clamp_sound_strip_length(scene, ed->seqbasep, seq_movie, seq_sound); + sequencer_add_movie_clamp_sound_strip_length(scene, seq_movie, seq_sound); if (seq_sound) { /* The video has sound, shift the video strip up a channel to make room for the sound @@ -842,7 +841,8 @@ static void sequencer_add_movie_multiple_strips(bContext *C, } } - load_data->start_frame += seq_movie->enddisp - seq_movie->startdisp; + load_data->start_frame += SEQ_time_right_handle_frame_get(seq_movie) - + SEQ_time_left_handle_frame_get(seq_movie); if (overlap_shuffle_override) { has_seq_overlap |= seq_load_apply_generic_options_only_test_overlap( C, op, seq_sound, strip_col); @@ -890,7 +890,7 @@ static bool sequencer_add_movie_single_strip(bContext *C, } if (RNA_boolean_get(op->ptr, "sound")) { seq_sound = SEQ_add_sound_strip(bmain, scene, ed->seqbasep, load_data); - sequencer_add_movie_clamp_sound_strip_length(scene, ed->seqbasep, seq_movie, seq_sound); + sequencer_add_movie_clamp_sound_strip_length(scene, seq_movie, seq_sound); if (seq_sound) { /* The video has sound, shift the video strip up a channel to make room for the sound * strip. */ @@ -1073,7 +1073,8 @@ static void sequencer_add_sound_multiple_strips(bContext *C, } else { seq_load_apply_generic_options(C, op, seq); - load_data->start_frame += seq->enddisp - seq->startdisp; + load_data->start_frame += SEQ_time_right_handle_frame_get(seq) - + SEQ_time_left_handle_frame_get(seq); } } RNA_END; @@ -1300,8 +1301,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) /* Adjust length. */ if (load_data.image.len == 1) { - SEQ_time_right_handle_frame_set(seq, load_data.image.end_frame); - SEQ_time_update_sequence(scene, SEQ_active_seqbase_get(ed), seq); + SEQ_time_right_handle_frame_set(scene, seq, load_data.image.end_frame); } seq_load_apply_generic_options(C, op, seq); diff --git a/source/blender/editors/space_sequencer/sequencer_drag_drop.c b/source/blender/editors/space_sequencer/sequencer_drag_drop.c index 645c0dc9a1d..8dadb9360e3 100644 --- a/source/blender/editors/space_sequencer/sequencer_drag_drop.c +++ b/source/blender/editors/space_sequencer/sequencer_drag_drop.c @@ -231,9 +231,8 @@ static void update_overlay_strip_poistion_data(bContext *C, const int mval[2]) else { /* Check if there is a strip that would intersect with the new strip(s). */ coords->is_intersecting = false; - Sequence dummy_seq = {.machine = coords->channel, - .startdisp = coords->start_frame, - .enddisp = coords->start_frame + coords->strip_len}; + Sequence dummy_seq = { + .machine = coords->channel, .start = coords->start_frame, .len = coords->strip_len}; Editing *ed = SEQ_editing_get(scene); for (int i = 0; i < coords->channel_len && !coords->is_intersecting; i++) { diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 02e77732e02..08e42a5b4c4 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -617,8 +617,8 @@ static void drawmeta_contents(Scene *scene, /* Draw only immediate children (1 level depth). */ for (seq = meta_seqbase->first; seq; seq = seq->next) { - const int startdisp = seq->startdisp + offset; - const int enddisp = seq->enddisp + offset; + const int startdisp = SEQ_time_left_handle_frame_get(seq) + offset; + const int enddisp = SEQ_time_right_handle_frame_get(seq) + offset; if ((startdisp > x2 || enddisp < x1) == 0) { float y_chan = (seq->machine - chan_min) / (float)(chan_range)*draw_range; @@ -668,7 +668,7 @@ float sequence_handle_size_get_clamped(Sequence *seq, const float pixelx) const float maxhandle = (pixelx * SEQ_HANDLE_SIZE) * U.pixelsize; /* Ensure that handle is not wider, than quarter of strip. */ - return min_ff(maxhandle, ((float)(seq->enddisp - seq->startdisp) / 4.0f)); + return min_ff(maxhandle, ((float)(SEQ_time_right_handle_frame_get(seq) - SEQ_time_left_handle_frame_get(seq)) / 4.0f)); } /* Draw a handle, on left or right side of strip. */ @@ -686,8 +686,8 @@ static void draw_seq_handle(View2D *v2d, uint whichsel = 0; uchar col[4]; - x1 = seq->startdisp; - x2 = seq->enddisp; + x1 = SEQ_time_left_handle_frame_get(seq); + x2 = SEQ_time_right_handle_frame_get(seq); y1 = seq->machine + SEQ_STRIP_OFSBOTTOM; y2 = seq->machine + SEQ_STRIP_OFSTOP; @@ -739,7 +739,7 @@ static void draw_seq_handle(View2D *v2d, BLF_set_default(); /* Calculate if strip is wide enough for showing the labels. */ - numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d%d", seq->startdisp, seq->enddisp); + numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d%d", SEQ_time_left_handle_frame_get(seq), SEQ_time_right_handle_frame_get(seq)); float tot_width = BLF_width(fontid, numstr, numstr_len); if ((x2 - x1) / pixelx > 20 + tot_width) { @@ -747,12 +747,12 @@ static void draw_seq_handle(View2D *v2d, float text_margin = 1.2f * handsize_clamped; if (direction == SEQ_LEFTHANDLE) { - numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", seq->startdisp); + numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", SEQ_time_left_handle_frame_get(seq)); x1 += text_margin; y1 += 0.09f; } else { - numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", seq->enddisp - 1); + numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", SEQ_time_right_handle_frame_get(seq) - 1); x1 = x2 - (text_margin + pixelx * BLF_width(fontid, numstr, numstr_len)); y1 += 0.09f; } @@ -913,7 +913,7 @@ static size_t draw_seq_text_get_overlay_string(SpaceSeq *sseq, char strip_duration_text[16]; if (sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_STRIP_DURATION) { - const int strip_duration = seq->enddisp - seq->startdisp; + const int strip_duration = SEQ_time_right_handle_frame_get(seq) - SEQ_time_left_handle_frame_get(seq); SNPRINTF(strip_duration_text, "%d", strip_duration); if (i != 0) { text_array[i++] = text_sep; @@ -980,8 +980,8 @@ static void draw_sequence_extensions_overlay( float x1, x2, y1, y2; uchar col[4], blend_col[3]; - x1 = seq->startdisp; - x2 = seq->enddisp; + x1 = SEQ_time_left_handle_frame_get(seq); + x2 = SEQ_time_right_handle_frame_get(seq); y1 = seq->machine + SEQ_STRIP_OFSBOTTOM; y2 = seq->machine + SEQ_STRIP_OFSTOP; @@ -1038,15 +1038,15 @@ static void draw_color_strip_band( immUniformColor4ubv(col); - immRectf(pos, seq->startdisp, y1, seq->enddisp, text_margin_y); + immRectf(pos, SEQ_time_left_handle_frame_get(seq), y1, SEQ_time_right_handle_frame_get(seq), text_margin_y); /* 1px line to better separate the color band. */ UI_GetColorPtrShade3ubv(col, col, -20); immUniformColor4ubv(col); immBegin(GPU_PRIM_LINES, 2); - immVertex2f(pos, seq->startdisp, text_margin_y); - immVertex2f(pos, seq->enddisp, text_margin_y); + immVertex2f(pos, SEQ_time_left_handle_frame_get(seq), text_margin_y); + immVertex2f(pos, SEQ_time_right_handle_frame_get(seq), text_margin_y); immEnd(); GPU_blend(GPU_BLEND_NONE); @@ -1111,12 +1111,12 @@ static void draw_seq_background(Scene *scene, immUniformColor4ubv(col); if (SEQ_time_has_left_still_frames(seq)) { - const float content_start = min_ff(seq->enddisp, seq->start); - immRectf(pos, seq->startdisp, y1, content_start, y2); + const float content_start = min_ff(SEQ_time_right_handle_frame_get(seq), seq->start); + immRectf(pos, SEQ_time_left_handle_frame_get(seq), y1, content_start, y2); } if (SEQ_time_has_right_still_frames(seq)) { - const float content_end = max_ff(seq->startdisp, seq->start + seq->len); - immRectf(pos, content_end, y1, seq->enddisp, y2); + const float content_end = max_ff(SEQ_time_left_handle_frame_get(seq), seq->start + seq->len); + immRectf(pos, content_end, y1, SEQ_time_right_handle_frame_get(seq), y2); } } @@ -1333,14 +1333,14 @@ static void draw_seq_strip(const bContext *C, SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG); /* Draw strip body. */ - x1 = SEQ_time_has_left_still_frames(seq) ? seq->start : seq->startdisp; + x1 = SEQ_time_has_left_still_frames(seq) ? seq->start : SEQ_time_left_handle_frame_get(seq); y1 = seq->machine + SEQ_STRIP_OFSBOTTOM; - x2 = SEQ_time_has_right_still_frames(seq) ? (seq->start + seq->len) : seq->enddisp; + x2 = SEQ_time_has_right_still_frames(seq) ? (seq->start + seq->len) : SEQ_time_right_handle_frame_get(seq); y2 = seq->machine + SEQ_STRIP_OFSTOP; /* Limit body to strip bounds. Meta strip can end up with content outside of strip range. */ - x1 = min_ff(x1, seq->enddisp); - x2 = max_ff(x2, seq->startdisp); + x1 = min_ff(x1, SEQ_time_right_handle_frame_get(seq)); + x2 = max_ff(x2, SEQ_time_left_handle_frame_get(seq)); float text_margin_y; bool y_threshold; @@ -1380,8 +1380,8 @@ static void draw_seq_strip(const bContext *C, } immUnbindProgram(); - x1 = seq->startdisp; - x2 = seq->enddisp; + x1 = SEQ_time_left_handle_frame_get(seq); + x2 = SEQ_time_right_handle_frame_get(seq); if ((seq->type == SEQ_TYPE_META) || ((seq->type == SEQ_TYPE_SCENE) && (seq->flag & SEQ_SCENE_STRIPS))) { @@ -1471,23 +1471,23 @@ static void draw_effect_inputs_highlight(Sequence *seq) immUniformColor4ub(255, 255, 255, 48); immRectf(pos, - seq1->startdisp, + SEQ_time_left_handle_frame_get(seq1), seq1->machine + SEQ_STRIP_OFSBOTTOM, - seq1->enddisp, + SEQ_time_right_handle_frame_get(seq1), seq1->machine + SEQ_STRIP_OFSTOP); if (seq2 && seq2 != seq1) { immRectf(pos, - seq2->startdisp, + SEQ_time_left_handle_frame_get(seq2), seq2->machine + SEQ_STRIP_OFSBOTTOM, - seq2->enddisp, + SEQ_time_right_handle_frame_get(seq2), seq2->machine + SEQ_STRIP_OFSTOP); } if (seq3 && !ELEM(seq3, seq1, seq2)) { immRectf(pos, - seq3->startdisp, + SEQ_time_left_handle_frame_get(seq3), seq3->machine + SEQ_STRIP_OFSBOTTOM, - seq3->enddisp, + SEQ_time_right_handle_frame_get(seq3), seq3->machine + SEQ_STRIP_OFSTOP); } immUnbindProgram(); @@ -2081,10 +2081,10 @@ static int sequencer_draw_get_transform_preview_frame(Scene *scene) int preview_frame; if (last_seq->flag & SEQ_RIGHTSEL) { - preview_frame = last_seq->enddisp - 1; + preview_frame = SEQ_time_right_handle_frame_get(last_seq) - 1; } else { - preview_frame = last_seq->startdisp; + preview_frame = SEQ_time_left_handle_frame_get(last_seq); } return preview_frame; @@ -2310,10 +2310,10 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region) if (seq == last_seq && (last_seq->flag & SELECT)) { continue; } - if (min_ii(seq->startdisp, seq->start) > v2d->cur.xmax) { + if (min_ii(SEQ_time_left_handle_frame_get(seq), seq->start) > v2d->cur.xmax) { continue; } - if (max_ii(seq->enddisp, seq->start + seq->len) < v2d->cur.xmin) { + if (max_ii(SEQ_time_right_handle_frame_get(seq), seq->start + seq->len) < v2d->cur.xmin) { continue; } if (seq->machine + 1.0f < v2d->cur.ymin) { @@ -2368,9 +2368,9 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region) immUniformColor4ub(255, 255, 255, 48); immRectf(pos, - seq->startdisp, + SEQ_time_left_handle_frame_get(seq), seq->machine + SEQ_STRIP_OFSBOTTOM, - seq->enddisp, + SEQ_time_right_handle_frame_get(seq), seq->machine + SEQ_STRIP_OFSTOP); immUnbindProgram(); @@ -2597,7 +2597,7 @@ static void draw_cache_view(const bContext *C) continue; } - if (seq->startdisp > v2d->cur.xmax || seq->enddisp < v2d->cur.xmin) { + if (SEQ_time_left_handle_frame_get(seq) > v2d->cur.xmax || SEQ_time_right_handle_frame_get(seq) < v2d->cur.xmin) { continue; } @@ -2607,7 +2607,7 @@ static void draw_cache_view(const bContext *C) if (scene->ed->cache_flag & SEQ_CACHE_VIEW_RAW) { const float bg_color[4] = {1.0f, 0.1f, 0.02f, 0.1f}; immUniformColor4f(bg_color[0], bg_color[1], bg_color[2], bg_color[3]); - immRectf(pos, seq->startdisp, stripe_bot, seq->enddisp, stripe_top); + immRectf(pos, SEQ_time_left_handle_frame_get(seq), stripe_bot, SEQ_time_right_handle_frame_get(seq), stripe_top); } stripe_bot += stripe_ht + stripe_ofs_y; @@ -2616,7 +2616,7 @@ static void draw_cache_view(const bContext *C) if (scene->ed->cache_flag & SEQ_CACHE_VIEW_PREPROCESSED) { const float bg_color[4] = {0.1f, 0.1f, 0.75f, 0.1f}; immUniformColor4f(bg_color[0], bg_color[1], bg_color[2], bg_color[3]); - immRectf(pos, seq->startdisp, stripe_bot, seq->enddisp, stripe_top); + immRectf(pos, SEQ_time_left_handle_frame_get(seq), stripe_bot, SEQ_time_right_handle_frame_get(seq), stripe_top); } stripe_top = seq->machine + SEQ_STRIP_OFSTOP - stripe_ofs_y; @@ -2625,7 +2625,7 @@ static void draw_cache_view(const bContext *C) if (scene->ed->cache_flag & SEQ_CACHE_VIEW_COMPOSITE) { const float bg_color[4] = {1.0f, 0.6f, 0.0f, 0.1f}; immUniformColor4f(bg_color[0], bg_color[1], bg_color[2], bg_color[3]); - immRectf(pos, seq->startdisp, stripe_bot, seq->enddisp, stripe_top); + immRectf(pos, SEQ_time_left_handle_frame_get(seq), stripe_bot, SEQ_time_right_handle_frame_get(seq), stripe_top); } } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 08f98dfb161..75966d4f070 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -77,7 +77,6 @@ typedef struct TransSeq { int start, machine; - int startdisp, enddisp; int startofs, endofs; int anim_startofs, anim_endofs; /* int final_left, final_right; */ /* UNUSED */ @@ -345,7 +344,6 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); Editing *ed = SEQ_editing_get(scene); - ListBase *seqbase = SEQ_active_seqbase_get(ed); ListBase *channels = SEQ_channels_displayed_get(ed); Sequence *seq; int snap_frame; @@ -361,15 +359,15 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op) } else { if (seq->flag & SEQ_LEFTSEL) { - SEQ_time_left_handle_frame_set(seq, snap_frame); + SEQ_time_left_handle_frame_set(scene, seq, snap_frame); } else { /* SEQ_RIGHTSEL */ - SEQ_time_right_handle_frame_set(seq, snap_frame); + SEQ_time_right_handle_frame_set(scene, seq, snap_frame); } - SEQ_transform_handle_xlimits(seq, seq->flag & SEQ_LEFTSEL, seq->flag & SEQ_RIGHTSEL); - SEQ_transform_fix_single_image_seq_offsets(seq); + SEQ_transform_handle_xlimits( + scene, seq, seq->flag & SEQ_LEFTSEL, seq->flag & SEQ_RIGHTSEL); + SEQ_transform_fix_single_image_seq_offsets(scene, seq); } - SEQ_time_update_sequence(scene, seqbase, seq); } } @@ -390,27 +388,22 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op) if (seq->seq1 && (seq->seq1->flag & SELECT)) { if (!either_handle_selected) { - SEQ_offset_animdata(scene, seq, (snap_frame - seq->startdisp)); + SEQ_offset_animdata(scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(seq))); } - SEQ_time_update_sequence(scene, seqbase, seq); } else if (seq->seq2 && (seq->seq2->flag & SELECT)) { if (!either_handle_selected) { - SEQ_offset_animdata(scene, seq, (snap_frame - seq->startdisp)); + SEQ_offset_animdata(scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(seq))); } - SEQ_time_update_sequence(scene, seqbase, seq); } else if (seq->seq3 && (seq->seq3->flag & SELECT)) { if (!either_handle_selected) { - SEQ_offset_animdata(scene, seq, (snap_frame - seq->startdisp)); + SEQ_offset_animdata(scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(seq))); } - SEQ_time_update_sequence(scene, seqbase, seq); } } } - SEQ_sort(SEQ_active_seqbase_get(ed)); - DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -477,8 +470,6 @@ static void transseq_backup(TransSeq *ts, Sequence *seq) { ts->start = seq->start; ts->machine = seq->machine; - ts->startdisp = seq->startdisp; - ts->enddisp = seq->enddisp; ts->startofs = seq->startofs; ts->endofs = seq->endofs; ts->anim_startofs = seq->anim_startofs; @@ -490,8 +481,6 @@ static void transseq_restore(TransSeq *ts, Sequence *seq) { seq->start = ts->start; seq->machine = ts->machine; - seq->startdisp = ts->startdisp; - seq->enddisp = ts->enddisp; seq->startofs = ts->startofs; seq->endofs = ts->endofs; seq->anim_startofs = ts->anim_startofs; @@ -605,22 +594,8 @@ static void sequencer_slip_recursively(Scene *scene, SlipData *data, int offset) endframe = seq->start + seq->len; /* Compute the sequence offsets. */ - seq->endofs = endframe - seq->enddisp; - seq->startofs = seq->startdisp - seq->start; - } - else { - /* No transform data (likely effect strip). Only move start and end. */ - seq->startdisp = data->ts[i].startdisp + offset; - seq->enddisp = data->ts[i].enddisp + offset; - } - - /* Effects are only added if we they are in a meta-strip. - * In this case, dependent strips will just be transformed and - * we can skip calculating for effects. - * This way we can avoid an extra loop just for effects. */ - if (!(seq->type & SEQ_TYPE_EFFECT)) { - ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); - SEQ_time_update_sequence(scene, seqbase, seq); + seq->endofs = endframe - SEQ_time_right_handle_frame_get(seq); + seq->startofs = SEQ_time_left_handle_frame_get(seq) - seq->start; } } @@ -640,12 +615,12 @@ static void sequencer_slip_apply_limits(SlipData *data, int *offset) int seq_content_end = seq_content_start + seq->len + seq->anim_startofs + seq->anim_endofs; int diff = 0; - if (seq_content_start >= seq->enddisp) { - diff = seq->enddisp - seq_content_start - 1; + if (seq_content_start >= SEQ_time_right_handle_frame_get(seq)) { + diff = SEQ_time_right_handle_frame_get(seq) - seq_content_start - 1; } - if (seq_content_end <= seq->startdisp) { - diff = seq->startdisp - seq_content_end + 1; + if (seq_content_end <= SEQ_time_left_handle_frame_get(seq)) { + diff = SEQ_time_left_handle_frame_get(seq) - seq_content_end + 1; } *offset += diff; } @@ -791,8 +766,6 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even for (int i = 0; i < data->num_seq; i++) { Sequence *seq = data->seq_array[i]; SEQ_add_reload_new_file(bmain, scene, seq, false); - ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); - SEQ_time_update_sequence(scene, seqbase, seq); } MEM_freeN(data->seq_array); @@ -1288,7 +1261,6 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op) last_seq->seq3 = seq3; int old_start = last_seq->start; - SEQ_time_update_recursive(scene, last_seq); SEQ_relations_invalidate_cache_preprocessed(scene, last_seq); SEQ_offset_animdata(scene, last_seq, (last_seq->start - old_start)); @@ -1446,13 +1418,15 @@ static int sequencer_split_exec(bContext *C, wmOperator *op) if (ignore_selection) { if (use_cursor_position) { LISTBASE_FOREACH (Sequence *, seq, SEQ_active_seqbase_get(ed)) { - if (seq->enddisp == split_frame && seq->machine == split_channel) { + if (SEQ_time_right_handle_frame_get(seq) == split_frame && + seq->machine == split_channel) { seq_selected = seq->flag & SEQ_ALLSEL; } } if (!seq_selected) { LISTBASE_FOREACH (Sequence *, seq, SEQ_active_seqbase_get(ed)) { - if (seq->startdisp == split_frame && seq->machine == split_channel) { + if (SEQ_time_left_handle_frame_get(seq) == split_frame && + seq->machine == split_channel) { seq->flag &= ~SEQ_ALLSEL; } } @@ -1463,20 +1437,18 @@ static int sequencer_split_exec(bContext *C, wmOperator *op) if (split_side != SEQ_SIDE_BOTH) { LISTBASE_FOREACH (Sequence *, seq, SEQ_active_seqbase_get(ed)) { if (split_side == SEQ_SIDE_LEFT) { - if (seq->startdisp >= split_frame) { + if (SEQ_time_left_handle_frame_get(seq) >= split_frame) { seq->flag &= ~SEQ_ALLSEL; } } else { - if (seq->enddisp <= split_frame) { + if (SEQ_time_right_handle_frame_get(seq) <= split_frame) { seq->flag &= ~SEQ_ALLSEL; } } } } } - - SEQ_sort(SEQ_active_seqbase_get(ed)); } if (changed) { WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -1791,8 +1763,6 @@ static int sequencer_offset_clear_exec(bContext *C, wmOperator *UNUSED(op)) /* Update lengths, etc. */ seq = ed->seqbasep->first; while (seq) { - ListBase *seqbase = SEQ_active_seqbase_get(ed); - SEQ_time_update_sequence(scene, seqbase, seq); SEQ_relations_invalidate_cache_preprocessed(scene, seq); seq = seq->next; } @@ -1883,8 +1853,6 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) BLI_strncpy(se_new->name, se->name, sizeof(se_new->name)); strip_new->stripdata = se_new; - SEQ_time_update_sequence(scene, seqbase, seq_new); - if (step > 1) { seq_new->flag &= ~SEQ_OVERLAP; if (SEQ_transform_test_overlap(seqbase, seq_new)) { @@ -1908,9 +1876,6 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) } SEQ_edit_remove_flagged_sequences(scene, seqbase); - - SEQ_sort(seqbase); - WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -2020,8 +1985,8 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) BLI_addtail(&seqm->seqbase, seq); SEQ_relations_invalidate_cache_preprocessed(scene, seq); channel_max = max_ii(seq->machine, channel_max); - meta_start_frame = min_ii(seq->startdisp, meta_start_frame); - meta_end_frame = max_ii(seq->enddisp, meta_end_frame); + meta_start_frame = min_ii(SEQ_time_left_handle_frame_get(seq), meta_start_frame); + meta_end_frame = max_ii(SEQ_time_right_handle_frame_get(seq), meta_end_frame); } } @@ -2030,7 +1995,6 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) SEQ_sequence_base_unique_name_recursive(scene, &ed->seqbase, seqm); seqm->start = meta_start_frame; seqm->len = meta_end_frame - meta_start_frame; - SEQ_time_update_sequence(scene, active_seqbase, seqm); SEQ_select_active_set(scene, seqm); if (SEQ_transform_test_overlap(active_seqbase, seqm)) { SEQ_transform_seqbase_shuffle(active_seqbase, seqm, scene); @@ -2098,7 +2062,6 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) } } - SEQ_sort(active_seqbase); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -2204,19 +2167,18 @@ static const EnumPropertyItem prop_side_lr_types[] = { static void swap_sequence(Scene *scene, Sequence *seqa, Sequence *seqb) { - ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); - int gap = seqb->startdisp - seqa->enddisp; + int gap = SEQ_time_left_handle_frame_get(seqb) - SEQ_time_right_handle_frame_get(seqa); int seq_a_start; int seq_b_start; - seq_b_start = (seqb->start - seqb->startdisp) + seqa->startdisp; + seq_b_start = (seqb->start - SEQ_time_left_handle_frame_get(seqb)) + + SEQ_time_left_handle_frame_get(seqa); SEQ_transform_translate_sequence(scene, seqb, seq_b_start - seqb->start); - SEQ_time_update_sequence(scene, seqbase, seqb); SEQ_relations_invalidate_cache_preprocessed(scene, seqb); - seq_a_start = (seqa->start - seqa->startdisp) + seqb->enddisp + gap; + seq_a_start = (seqa->start - SEQ_time_left_handle_frame_get(seqa)) + + SEQ_time_right_handle_frame_get(seqb) + gap; SEQ_transform_translate_sequence(scene, seqa, seq_a_start - seqa->start); - SEQ_time_update_sequence(scene, seqbase, seqa); SEQ_relations_invalidate_cache_preprocessed(scene, seqa); } @@ -2241,13 +2203,13 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i switch (lr) { case SEQ_SIDE_LEFT: - if (seq->enddisp <= test->startdisp) { - dist = test->enddisp - seq->startdisp; + if (SEQ_time_right_handle_frame_get(seq) <= SEQ_time_left_handle_frame_get(test)) { + dist = SEQ_time_right_handle_frame_get(test) - SEQ_time_left_handle_frame_get(seq); } break; case SEQ_SIDE_RIGHT: - if (seq->startdisp >= test->enddisp) { - dist = seq->startdisp - test->enddisp; + if (SEQ_time_left_handle_frame_get(seq) >= SEQ_time_right_handle_frame_get(test)) { + dist = SEQ_time_left_handle_frame_get(seq) - SEQ_time_right_handle_frame_get(test); } break; } @@ -2307,14 +2269,6 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op) break; } - /* XXX: Should be a generic function. */ - for (iseq = seqbase->first; iseq; iseq = iseq->next) { - if ((iseq->type & SEQ_TYPE_EFFECT) && - (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) { - SEQ_time_update_sequence(scene, seqbase, iseq); - } - } - /* Do this in a new loop since both effects need to be calculated first. */ for (iseq = seqbase->first; iseq; iseq = iseq->next) { if ((iseq->type & SEQ_TYPE_EFFECT) && @@ -2326,10 +2280,7 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op) } } - SEQ_sort(SEQ_active_seqbase_get(ed)); - WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); - return OPERATOR_FINISHED; } @@ -2576,8 +2527,8 @@ static int sequencer_paste_exec(bContext *C, wmOperator *op) else { int min_seq_startdisp = INT_MAX; LISTBASE_FOREACH (Sequence *, seq, &seqbase_clipboard) { - if (seq->startdisp < min_seq_startdisp) { - min_seq_startdisp = seq->startdisp; + if (SEQ_time_left_handle_frame_get(seq) < min_seq_startdisp) { + min_seq_startdisp = SEQ_time_left_handle_frame_get(seq); } } /* Paste strips relative to the current-frame. */ @@ -2608,13 +2559,17 @@ static int sequencer_paste_exec(bContext *C, wmOperator *op) * in the new list. */ BLI_movelisttolist(ed->seqbasep, &nseqbase); + /* Make sure, that pasted strips have unique names. This has to be done immediately after adding + * strips to seqbase, for lookup cache to work correctly. */ + for (iseq = iseq_first; iseq; iseq = iseq->next) { + SEQ_ensure_unique_name(iseq, scene); + } + for (iseq = iseq_first; iseq; iseq = iseq->next) { if (SEQ_clipboard_pasted_seq_was_active(iseq)) { SEQ_select_active_set(scene, iseq); } - /* Make sure, that pasted strips have unique names. */ - SEQ_ensure_unique_name(iseq, scene); /* Translate after name has been changed, otherwise this will affect animdata of original * strip. */ SEQ_transform_translate_sequence(scene, iseq, ofs); @@ -2692,10 +2647,6 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op) seq_act->scene_sound = NULL; seq_other->scene_sound = NULL; - ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); - SEQ_time_update_sequence(scene, seqbase, seq_act); - SEQ_time_update_sequence(scene, seqbase, seq_other); - if (seq_act->sound) { BKE_sound_add_scene_sound_defaults(scene, seq_act); } @@ -2938,9 +2889,6 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) /* Correct start/end frames so we don't move. * Important not to set seq->len = len; allow the function to handle it. */ SEQ_add_reload_new_file(bmain, scene, seq, true); - - ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); - SEQ_time_update_sequence(scene, seqbase, seq); } else if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) { bSound *sound = seq->sound; @@ -3160,7 +3108,7 @@ static bool seq_get_text_strip_cb(Sequence *seq, void *user_data) ListBase *channels = SEQ_channels_displayed_get(ed); /* Only text strips that are not muted and don't end with negative frame. */ if ((seq->type == SEQ_TYPE_TEXT) && !SEQ_render_is_muted(channels, seq) && - (seq->enddisp > cd->scene->r.sfra)) { + (SEQ_time_right_handle_frame_get(seq) > cd->scene->r.sfra)) { BLI_addtail(cd->text_seq, MEM_dupallocN(seq)); } return true; @@ -3218,16 +3166,17 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op) char timecode_str_end[32]; /* Write time-code relative to start frame of scene. Don't allow negative time-codes. */ - BLI_timecode_string_from_time(timecode_str_start, - sizeof(timecode_str_start), - -2, - FRA2TIME(max_ii(seq->startdisp - scene->r.sfra, 0)), - FPS, - USER_TIMECODE_SUBRIP); + BLI_timecode_string_from_time( + timecode_str_start, + sizeof(timecode_str_start), + -2, + FRA2TIME(max_ii(SEQ_time_left_handle_frame_get(seq) - scene->r.sfra, 0)), + FPS, + USER_TIMECODE_SUBRIP); BLI_timecode_string_from_time(timecode_str_end, sizeof(timecode_str_end), -2, - FRA2TIME(seq->enddisp - scene->r.sfra), + FRA2TIME(SEQ_time_right_handle_frame_get(seq) - scene->r.sfra), FPS, USER_TIMECODE_SUBRIP); @@ -3295,8 +3244,8 @@ static int sequencer_set_range_to_strips_exec(bContext *C, wmOperator *op) for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT) { selected = true; - sfra = min_ii(sfra, seq->startdisp); - efra = max_ii(efra, seq->enddisp - 1); + sfra = min_ii(sfra, SEQ_time_left_handle_frame_get(seq)); + efra = max_ii(efra, SEQ_time_right_handle_frame_get(seq) - 1); } } diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 074be0fd120..f237fbc0a12 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -116,13 +116,13 @@ static void select_active_side(ListBase *seqbase, int sel_side, int channel, int if (channel == seq->machine) { switch (sel_side) { case SEQ_SIDE_LEFT: - if (frame > (seq->startdisp)) { + if (frame > (SEQ_time_left_handle_frame_get(seq))) { seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); seq->flag |= SELECT; } break; case SEQ_SIDE_RIGHT: - if (frame < (seq->startdisp)) { + if (frame < (SEQ_time_left_handle_frame_get(seq))) { seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); seq->flag |= SELECT; } @@ -152,13 +152,13 @@ static void select_active_side_range(ListBase *seqbase, } switch (sel_side) { case SEQ_SIDE_LEFT: - if (frame > (seq->startdisp)) { + if (frame > (SEQ_time_left_handle_frame_get(seq))) { seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); seq->flag |= SELECT; } break; case SEQ_SIDE_RIGHT: - if (frame < (seq->startdisp)) { + if (frame < (SEQ_time_left_handle_frame_get(seq))) { seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); seq->flag |= SELECT; } @@ -179,8 +179,8 @@ static void select_linked_time(ListBase *seqbase, Sequence *seq_link) for (seq = seqbase->first; seq; seq = seq->next) { if (seq_link->machine != seq->machine) { - int left_match = (seq->startdisp == seq_link->startdisp) ? 1 : 0; - int right_match = (seq->enddisp == seq_link->enddisp) ? 1 : 0; + int left_match = (SEQ_time_left_handle_frame_get(seq) == seq_link->startdisp) ? 1 : 0; + int right_match = (SEQ_time_right_handle_frame_get(seq) == seq_link->enddisp) ? 1 : 0; if (left_match && right_match) { /* Direct match, copy the selection settings. */ @@ -247,8 +247,8 @@ void ED_sequencer_select_sequence_single(Scene *scene, Sequence *seq, bool desel void seq_rectf(Sequence *seq, rctf *rect) { - rect->xmin = seq->startdisp; - rect->xmax = seq->enddisp; + rect->xmin = SEQ_time_left_handle_frame_get(seq); + rect->xmax = SEQ_time_right_handle_frame_get(seq); rect->ymin = seq->machine + SEQ_STRIP_OFSBOTTOM; rect->ymax = seq->machine + SEQ_STRIP_OFSTOP; } @@ -273,12 +273,12 @@ Sequence *find_neighboring_sequence(Scene *scene, Sequence *test, int lr, int se (sel == 0 && (seq->flag & SELECT) == 0))) { switch (lr) { case SEQ_SIDE_LEFT: - if (test->startdisp == (seq->enddisp)) { + if (SEQ_time_left_handle_frame_get(test) == (SEQ_time_right_handle_frame_get(seq))) { return seq; } break; case SEQ_SIDE_RIGHT: - if (test->enddisp == (seq->startdisp)) { + if (SEQ_time_right_handle_frame_get(test) == (SEQ_time_left_handle_frame_get(seq))) { return seq; } break; @@ -311,13 +311,18 @@ Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[ while (seq) { if (seq->machine == (int)y) { /* Check for both normal strips, and strips that have been flipped horizontally. */ - if (((seq->startdisp < seq->enddisp) && (seq->startdisp <= x && seq->enddisp >= x)) || - ((seq->startdisp > seq->enddisp) && (seq->startdisp >= x && seq->enddisp <= x))) { + if (((SEQ_time_left_handle_frame_get(seq) < SEQ_time_right_handle_frame_get(seq)) && + (SEQ_time_left_handle_frame_get(seq) <= x && + SEQ_time_right_handle_frame_get(seq) >= x)) || + ((SEQ_time_left_handle_frame_get(seq) > SEQ_time_right_handle_frame_get(seq)) && + (SEQ_time_left_handle_frame_get(seq) >= x && + SEQ_time_right_handle_frame_get(seq) <= x))) { if (SEQ_transform_sequence_can_be_translated(seq)) { /* Clamp handles to defined size in pixel space. */ handsize = 2.0f * sequence_handle_size_get_clamped(seq, pixelx); - displen = (float)abs(seq->startdisp - seq->enddisp); + displen = (float)abs(SEQ_time_left_handle_frame_get(seq) - + SEQ_time_right_handle_frame_get(seq)); /* Don't even try to grab the handles of small strips. */ if (displen / pixelx > 16) { @@ -332,10 +337,10 @@ Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[ CLAMP(handsize, 7 * pixelx, 30 * pixelx); } - if (handsize + seq->startdisp >= x) { + if (handsize + SEQ_time_left_handle_frame_get(seq) >= x) { *hand = SEQ_SIDE_LEFT; } - else if (-handsize + seq->enddisp <= x) { + else if (-handsize + SEQ_time_right_handle_frame_get(seq) <= x) { *hand = SEQ_SIDE_RIGHT; } } @@ -578,8 +583,8 @@ static void sequencer_select_side_of_frame(const bContext *C, const float x = UI_view2d_region_to_view_x(v2d, mval[0]); LISTBASE_FOREACH (Sequence *, seq_iter, SEQ_active_seqbase_get(ed)) { - if (((x < CFRA) && (seq_iter->enddisp <= CFRA)) || - ((x >= CFRA) && (seq_iter->startdisp >= CFRA))) { + if (((x < CFRA) && (SEQ_time_right_handle_frame_get(seq_iter) <= CFRA)) || + ((x >= CFRA) && (SEQ_time_left_handle_frame_get(seq_iter) >= CFRA))) { /* Select left or right. */ seq_iter->flag |= SELECT; recurs_sel_seq(seq_iter); @@ -634,7 +639,8 @@ static void sequencer_select_linked_handle(const bContext *C, case SEQ_SIDE_LEFT: if ((seq->flag & SEQ_LEFTSEL) && (neighbor->flag & SEQ_RIGHTSEL)) { seq->flag |= SELECT; - select_active_side(ed->seqbasep, SEQ_SIDE_LEFT, seq->machine, seq->startdisp); + select_active_side( + ed->seqbasep, SEQ_SIDE_LEFT, seq->machine, SEQ_time_left_handle_frame_get(seq)); } else { seq->flag |= SELECT; @@ -647,7 +653,8 @@ static void sequencer_select_linked_handle(const bContext *C, case SEQ_SIDE_RIGHT: if ((seq->flag & SEQ_RIGHTSEL) && (neighbor->flag & SEQ_LEFTSEL)) { seq->flag |= SELECT; - select_active_side(ed->seqbasep, SEQ_SIDE_RIGHT, seq->machine, seq->startdisp); + select_active_side( + ed->seqbasep, SEQ_SIDE_RIGHT, seq->machine, SEQ_time_left_handle_frame_get(seq)); } else { seq->flag |= SELECT; @@ -661,7 +668,8 @@ static void sequencer_select_linked_handle(const bContext *C, } else { - select_active_side(ed->seqbasep, sel_side, seq->machine, seq->startdisp); + select_active_side( + ed->seqbasep, sel_side, seq->machine, SEQ_time_left_handle_frame_get(seq)); } } } @@ -1428,10 +1436,10 @@ static int sequencer_select_side_of_frame_exec(bContext *C, wmOperator *op) bool test = false; switch (side) { case -1: - test = (timeline_frame >= seq->enddisp); + test = (timeline_frame >= SEQ_time_right_handle_frame_get(seq)); break; case 1: - test = (timeline_frame <= seq->startdisp); + test = (timeline_frame <= SEQ_time_left_handle_frame_get(seq)); break; case 2: test = SEQ_time_strip_intersects_frame(seq, timeline_frame); @@ -1505,10 +1513,10 @@ static int sequencer_select_side_exec(bContext *C, wmOperator *op) if (seq->flag & SELECT) { selected = true; if (sel_side == SEQ_SIDE_LEFT) { - *frame_limit_p = max_ii(*frame_limit_p, seq->startdisp); + *frame_limit_p = max_ii(*frame_limit_p, SEQ_time_left_handle_frame_get(seq)); } else { - *frame_limit_p = min_ii(*frame_limit_p, seq->startdisp); + *frame_limit_p = min_ii(*frame_limit_p, SEQ_time_left_handle_frame_get(seq)); } } } @@ -1648,7 +1656,7 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op) float handsize = sequence_handle_size_get_clamped(seq, pixelx); /* Right handle. */ - if (rectf.xmax > (seq->enddisp - handsize)) { + if (rectf.xmax > (SEQ_time_right_handle_frame_get(seq) - handsize)) { if (select) { seq->flag |= SELECT | SEQ_RIGHTSEL; } @@ -1661,7 +1669,7 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op) } } /* Left handle. */ - if (rectf.xmin < (seq->startdisp + handsize)) { + if (rectf.xmin < (SEQ_time_left_handle_frame_get(seq) + handsize)) { if (select) { seq->flag |= SELECT | SEQ_LEFTSEL; } @@ -1953,7 +1961,8 @@ static bool select_grouped_time_overlap(SeqCollection *strips, Sequence *seq; SEQ_ITERATOR_FOREACH (seq, strips) { - if (seq->startdisp < actseq->enddisp && seq->enddisp > actseq->startdisp) { + if (SEQ_time_left_handle_frame_get(seq) < SEQ_time_right_handle_frame_get(actseq) && + SEQ_time_right_handle_frame_get(seq) > SEQ_time_left_handle_frame_get(actseq)) { seq->flag |= SELECT; changed = true; } @@ -1971,8 +1980,10 @@ static void query_lower_channel_strips(Sequence *seq_reference, if (seq_test->machine > seq_reference->machine) { continue; /* Not lower channel. */ } - if (seq_test->enddisp <= seq_reference->startdisp || - seq_test->startdisp >= seq_reference->enddisp) { + if (SEQ_time_right_handle_frame_get(seq_test) <= + SEQ_time_left_handle_frame_get(seq_reference) || + SEQ_time_left_handle_frame_get(seq_test) >= + SEQ_time_right_handle_frame_get(seq_reference)) { continue; /* Not intersecting in time. */ } SEQ_collection_append_strip(seq_test, collection); diff --git a/source/blender/editors/space_sequencer/sequencer_thumbnails.c b/source/blender/editors/space_sequencer/sequencer_thumbnails.c index eab17d876f3..984d3b1f374 100644 --- a/source/blender/editors/space_sequencer/sequencer_thumbnails.c +++ b/source/blender/editors/space_sequencer/sequencer_thumbnails.c @@ -74,10 +74,10 @@ static bool check_seq_need_thumbnails(Sequence *seq, rctf *view_area) if (!ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE)) { return false; } - if (min_ii(seq->startdisp, seq->start) > view_area->xmax) { + if (min_ii(SEQ_time_left_handle_frame_get(seq), seq->start) > view_area->xmax) { return false; } - if (max_ii(seq->enddisp, seq->start + seq->len) < view_area->xmin) { + if (max_ii(SEQ_time_right_handle_frame_get(seq), seq->start + seq->len) < view_area->xmin) { return false; } if (seq->machine + 1.0f < view_area->ymin) { @@ -206,7 +206,7 @@ static GHash *sequencer_thumbnail_ghash_init(const bContext *C, View2D *v2d, Edi else { if (val_need_update != NULL) { val_need_update->seq_dupli->start = seq->start; - val_need_update->seq_dupli->startdisp = seq->startdisp; + val_need_update->seq_dupli->startdisp = SEQ_time_left_handle_frame_get(seq); } } } @@ -363,15 +363,16 @@ static int sequencer_thumbnail_closest_previous_frame_get(int timeline_frame, static int sequencer_thumbnail_closest_guaranteed_frame_get(Sequence *seq, int timeline_frame) { - if (timeline_frame <= seq->startdisp) { - return seq->startdisp; + if (timeline_frame <= SEQ_time_left_handle_frame_get(seq)) { + return SEQ_time_left_handle_frame_get(seq); } /* Set of "guaranteed" thumbnails. */ - const int frame_index = timeline_frame - seq->startdisp; + const int frame_index = timeline_frame - SEQ_time_left_handle_frame_get(seq); const int frame_step = SEQ_render_thumbnails_guaranteed_set_frame_step_get(seq); const int relative_base_frame = round_fl_to_int((frame_index / (float)frame_step)) * frame_step; - const int nearest_guaranted_absolute_frame = relative_base_frame + seq->startdisp; + const int nearest_guaranted_absolute_frame = relative_base_frame + + SEQ_time_left_handle_frame_get(seq); return nearest_guaranted_absolute_frame; } @@ -444,10 +445,11 @@ void draw_seq_strip_thumbnail(View2D *v2d, float thumb_y_end = y1 + thumb_height; float cut_off = 0; - float upper_thumb_bound = SEQ_time_has_right_still_frames(seq) ? (seq->start + seq->len) : - seq->enddisp; + float upper_thumb_bound = SEQ_time_has_right_still_frames(seq) ? + (seq->start + seq->len) : + SEQ_time_right_handle_frame_get(seq); if (seq->type == SEQ_TYPE_IMAGE) { - upper_thumb_bound = seq->enddisp; + upper_thumb_bound = SEQ_time_right_handle_frame_get(seq); } float timeline_frame = SEQ_render_thumbnail_first_frame_get(seq, thumb_width, &v2d->cur); @@ -473,8 +475,8 @@ void draw_seq_strip_thumbnail(View2D *v2d, } /* Set the clipping bound to show the left handle moving over thumbs and not shift thumbs. */ - if (IN_RANGE_INCL(seq->startdisp, timeline_frame, thumb_x_end)) { - cut_off = seq->startdisp - timeline_frame; + if (IN_RANGE_INCL(SEQ_time_left_handle_frame_get(seq), timeline_frame, thumb_x_end)) { + cut_off = SEQ_time_left_handle_frame_get(seq) - timeline_frame; clipped = true; } diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c index 93641375d42..857ca6d989b 100644 --- a/source/blender/editors/space_sequencer/sequencer_view.c +++ b/source/blender/editors/space_sequencer/sequencer_view.c @@ -306,8 +306,8 @@ static void seq_view_collection_rect_timeline(Scene *scene, SeqCollection *strip int xmargin = FPS; SEQ_ITERATOR_FOREACH (seq, strips) { - xmin = min_ii(xmin, seq->startdisp); - xmax = max_ii(xmax, seq->enddisp); + xmin = min_ii(xmin, SEQ_time_left_handle_frame_get(seq)); + xmax = max_ii(xmax, SEQ_time_right_handle_frame_get(seq)); ymin = min_ii(ymin, seq->machine); ymax = max_ii(ymax, seq->machine); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index efe89621e7b..fc817b43a8b 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -2878,6 +2878,7 @@ static int view3d_select_exec(bContext *C, wmOperator *op) struct SelectPick_Params params = {0}; ED_select_pick_params_from_operator(op->ptr, ¶ms); + const bool vert_without_handles = RNA_boolean_get(op->ptr, "vert_without_handles"); bool center = RNA_boolean_get(op->ptr, "center"); bool enumerate = RNA_boolean_get(op->ptr, "enumerate"); /* Only force object select for edit-mode to support vertex parenting, @@ -2932,7 +2933,8 @@ static int view3d_select_exec(bContext *C, wmOperator *op) changed = ED_lattice_select_pick(C, mval, ¶ms); } else if (ELEM(obedit->type, OB_CURVES_LEGACY, OB_SURF)) { - changed = ED_curve_editnurb_select_pick(C, mval, ED_view3d_select_dist_px(), ¶ms); + changed = ED_curve_editnurb_select_pick( + C, mval, ED_view3d_select_dist_px(), vert_without_handles, ¶ms); } else if (obedit->type == OB_MBALL) { changed = ED_mball_select_pick(C, mval, ¶ms); @@ -3009,6 +3011,15 @@ void VIEW3D_OT_select(wmOperatorType *ot) prop = RNA_def_boolean(ot->srna, "object", 0, "Object", "Use object selection (edit mode only)"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); + /* Needed for select-through to usefully drag handles, see: T98254. + * NOTE: this option may be removed and become default behavior, see design task: T98552. */ + prop = RNA_def_boolean(ot->srna, + "vert_without_handles", + 0, + "Control Point Without Handles", + "Only select the curve control point, not it's handles"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + prop = RNA_def_int_vector(ot->srna, "location", 2, diff --git a/source/blender/editors/transform/transform_convert_sequencer.c b/source/blender/editors/transform/transform_convert_sequencer.c index 3735ff0727c..68f04aab969 100644 --- a/source/blender/editors/transform/transform_convert_sequencer.c +++ b/source/blender/editors/transform/transform_convert_sequencer.c @@ -278,8 +278,6 @@ static void seq_transform_cancel(TransInfo *t, SeqCollection *transformed_strips if (SEQ_transform_test_overlap(seqbase, seq)) { SEQ_transform_seqbase_shuffle(seqbase, seq, t->scene); } - - SEQ_time_update_sequence(t->scene, seqbase, seq); } } @@ -313,43 +311,19 @@ static SeqCollection *query_right_side_strips(ListBase *seqbase, SeqCollection * { Sequence *seq; SEQ_ITERATOR_FOREACH (seq, transformed_strips) { - minframe = min_ii(minframe, seq->startdisp); + minframe = min_ii(minframe, SEQ_time_left_handle_frame_get(seq)); } } SeqCollection *collection = SEQ_collection_create(__func__); LISTBASE_FOREACH (Sequence *, seq, seqbase) { - if ((seq->flag & SELECT) == 0 && seq->startdisp >= minframe) { + if ((seq->flag & SELECT) == 0 && SEQ_time_left_handle_frame_get(seq) >= minframe) { SEQ_collection_append_strip(seq, collection); } } return collection; } -static void seq_transform_update_effects(Scene *scene, - ListBase *seqbasep, - SeqCollection *collection) -{ - Sequence *seq; - SEQ_ITERATOR_FOREACH (seq, collection) { - if ((seq->type & SEQ_TYPE_EFFECT) && (seq->seq1 || seq->seq2 || seq->seq3)) { - SEQ_time_update_sequence(scene, seqbasep, seq); - } - } -} - -/* Check if effect strips with input are transformed. */ -static bool seq_transform_check_strip_effects(SeqCollection *transformed_strips) -{ - Sequence *seq; - SEQ_ITERATOR_FOREACH (seq, transformed_strips) { - if ((seq->type & SEQ_TYPE_EFFECT) && (seq->seq1 || seq->seq2 || seq->seq3)) { - return true; - } - } - return false; -} - static ListBase *seqbase_active_get(const TransInfo *t) { Editing *ed = SEQ_editing_get(t->scene); @@ -388,7 +362,6 @@ static void seq_transform_handle_expand_to_fit(Scene *scene, * SEQ_transform_handle_overlap. */ SEQ_transform_seqbase_shuffle_time( right_side_strips, seqbasep, scene, markers, use_sync_markers); - seq_transform_update_effects(scene, seqbasep, right_side_strips); SEQ_collection_free(right_side_strips); } @@ -434,16 +407,20 @@ typedef enum eOvelapDescrition { static eOvelapDescrition overlap_description_get(const Sequence *transformed, const Sequence *target) { - if (transformed->startdisp <= target->startdisp && transformed->enddisp >= target->enddisp) { + if (SEQ_time_left_handle_frame_get(transformed) <= SEQ_time_left_handle_frame_get(target) && + SEQ_time_right_handle_frame_get(transformed) >= SEQ_time_right_handle_frame_get(target)) { return STRIP_OVERLAP_IS_FULL; } - if (transformed->startdisp > target->startdisp && transformed->enddisp < target->enddisp) { + if (SEQ_time_left_handle_frame_get(transformed) > SEQ_time_left_handle_frame_get(target) && + SEQ_time_right_handle_frame_get(transformed) < SEQ_time_right_handle_frame_get(target)) { return STRIP_OVERLAP_IS_INSIDE; } - if (transformed->startdisp <= target->startdisp && target->startdisp <= transformed->enddisp) { + if (SEQ_time_left_handle_frame_get(transformed) <= SEQ_time_left_handle_frame_get(target) && + SEQ_time_left_handle_frame_get(target) <= SEQ_time_right_handle_frame_get(transformed)) { return STRIP_OVERLAP_LEFT_SIDE; } - if (transformed->startdisp <= target->enddisp && target->enddisp <= transformed->enddisp) { + if (SEQ_time_left_handle_frame_get(transformed) <= SEQ_time_right_handle_frame_get(target) && + SEQ_time_right_handle_frame_get(target) <= SEQ_time_right_handle_frame_get(transformed)) { return STRIP_OVERLAP_RIGHT_SIDE; } return STRIP_OVERLAP_NONE; @@ -459,10 +436,20 @@ static void seq_transform_handle_overwrite_split(Scene *scene, * NULL here. */ Main *bmain = NULL; - Sequence *split_strip = SEQ_edit_strip_split( - bmain, scene, seqbasep, target, transformed->startdisp, SEQ_SPLIT_SOFT, NULL); - SEQ_edit_strip_split( - bmain, scene, seqbasep, split_strip, transformed->enddisp, SEQ_SPLIT_SOFT, NULL); + Sequence *split_strip = SEQ_edit_strip_split(bmain, + scene, + seqbasep, + target, + SEQ_time_left_handle_frame_get(transformed), + SEQ_SPLIT_SOFT, + NULL); + SEQ_edit_strip_split(bmain, + scene, + seqbasep, + split_strip, + SEQ_time_right_handle_frame_get(transformed), + SEQ_SPLIT_SOFT, + NULL); SEQ_edit_flag_for_removal(scene, seqbasep, split_strip); SEQ_edit_remove_flagged_sequences(scene, seqbasep); } @@ -489,14 +476,12 @@ static void seq_transform_handle_overwrite_trim(Scene *scene, continue; } if (overlap == STRIP_OVERLAP_LEFT_SIDE) { - SEQ_time_left_handle_frame_set(seq, transformed->enddisp); + SEQ_time_left_handle_frame_set(scene, seq, SEQ_time_right_handle_frame_get(transformed)); } else { BLI_assert(overlap == STRIP_OVERLAP_RIGHT_SIDE); - SEQ_time_right_handle_frame_set(seq, transformed->startdisp); + SEQ_time_right_handle_frame_set(scene, seq, SEQ_time_left_handle_frame_get(transformed)); } - - SEQ_time_update_sequence(scene, seqbasep, seq); } SEQ_collection_free(targets); } @@ -577,11 +562,6 @@ void SEQ_transform_handle_overlap(Scene *scene, break; } - if (seq_transform_check_strip_effects(transformed_strips)) { - /* Update effect strips based on strips just moved in time. */ - seq_transform_update_effects(scene, seqbasep, transformed_strips); - } - /* If any effects still overlap, we need to move them up. * In some cases other strips can be overlapping still, see T90646. */ Sequence *seq; @@ -635,10 +615,7 @@ static void freeSeqData(TransInfo *t, TransDataContainer *tc, TransCustomData *c SEQ_transform_handle_overlap(scene, seqbasep, transformed_strips, use_sync_markers); } - seq_transform_update_effects(scene, seqbasep, transformed_strips); SEQ_collection_free(transformed_strips); - - SEQ_sort(ed->seqbasep); DEG_id_tag_update(&t->scene->id, ID_RECALC_SEQUENCER_STRIPS); free_transform_custom_data(custom_data); } @@ -662,7 +639,10 @@ typedef enum SeqInputSide { static Sequence *effect_input_get(Sequence *effect, SeqInputSide side) { Sequence *input = effect->seq1; - if (effect->seq2 && (effect->seq2->startdisp - effect->seq1->startdisp) * side > 0) { + if (effect->seq2 && (SEQ_time_left_handle_frame_get(effect->seq2) - + SEQ_time_left_handle_frame_get(effect->seq1)) * + side > + 0) { input = effect->seq2; } return input; @@ -825,23 +805,6 @@ void createTransSeqData(TransInfo *t) /** \name UVs Transform Flush * \{ */ -/* commented _only_ because the meta may have animation data which - * needs moving too T28158. */ - -BLI_INLINE void trans_update_seq(Scene *sce, Sequence *seq, int old_start, int sel_flag) -{ - /* Calculate this strip and all nested strips. - * Children are ALWAYS transformed first so we don't need to do this in another loop. - */ - - ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(sce)); - SEQ_time_update_sequence(sce, seqbase, seq); - - if (sel_flag == SELECT) { - SEQ_offset_animdata(sce, seq, seq->start - old_start); - } -} - static void view2d_edge_pan_loc_compensate(TransInfo *t, float loc_in[2], float r_loc[2]) { TransSeq *ts = (TransSeq *)TRANS_DATA_CONTAINER_FIRST_SINGLE(t)->custom.type.data; @@ -914,24 +877,24 @@ static void flushTransSeq(TransInfo *t) break; } case SEQ_LEFTSEL: { /* No vertical transform. */ - int old_startdisp = seq->startdisp; - SEQ_time_left_handle_frame_set(seq, new_frame); - SEQ_transform_handle_xlimits(seq, tdsq->flag & SEQ_LEFTSEL, tdsq->flag & SEQ_RIGHTSEL); - SEQ_transform_fix_single_image_seq_offsets(seq); - SEQ_time_update_sequence(t->scene, seqbasep, seq); - if (abs(seq->startdisp - old_startdisp) > abs(max_offset)) { - max_offset = seq->startdisp - old_startdisp; + int old_startdisp = SEQ_time_left_handle_frame_get(seq); + SEQ_time_left_handle_frame_set(t->scene, seq, new_frame); + SEQ_transform_handle_xlimits( + t->scene, seq, tdsq->flag & SEQ_LEFTSEL, tdsq->flag & SEQ_RIGHTSEL); + SEQ_transform_fix_single_image_seq_offsets(t->scene, seq); + if (abs(SEQ_time_left_handle_frame_get(seq) - old_startdisp) > abs(max_offset)) { + max_offset = SEQ_time_left_handle_frame_get(seq) - old_startdisp; } break; } case SEQ_RIGHTSEL: { /* No vertical transform. */ - int old_enddisp = seq->enddisp; - SEQ_time_right_handle_frame_set(seq, new_frame); - SEQ_transform_handle_xlimits(seq, tdsq->flag & SEQ_LEFTSEL, tdsq->flag & SEQ_RIGHTSEL); - SEQ_transform_fix_single_image_seq_offsets(seq); - SEQ_time_update_sequence(t->scene, seqbasep, seq); - if (abs(seq->enddisp - old_enddisp) > abs(max_offset)) { - max_offset = seq->enddisp - old_enddisp; + int old_enddisp = SEQ_time_right_handle_frame_get(seq); + SEQ_time_right_handle_frame_set(t->scene, seq, new_frame); + SEQ_transform_handle_xlimits( + t->scene, seq, tdsq->flag & SEQ_LEFTSEL, tdsq->flag & SEQ_RIGHTSEL); + SEQ_transform_fix_single_image_seq_offsets(t->scene, seq); + if (abs(SEQ_time_right_handle_frame_get(seq) - old_enddisp) > abs(max_offset)) { + max_offset = SEQ_time_right_handle_frame_get(seq) - old_enddisp; } break; } @@ -945,15 +908,6 @@ static void flushTransSeq(TransInfo *t) SEQ_offset_animdata(t->scene, seq, max_offset); } - /* Update effect length and position. */ - if (ELEM(t->mode, TFM_SEQ_SLIDE, TFM_TIME_TRANSLATE)) { - for (seq = seqbasep->first; seq; seq = seq->next) { - if (seq->seq1 || seq->seq2 || seq->seq3) { - SEQ_time_update_sequence(t->scene, seqbasep, seq); - } - } - } - /* need to do the overlap check in a new loop otherwise adjacent strips * will not be updated and we'll get false positives */ SeqCollection *transformed_strips = seq_transform_collection_from_transdata(tc); diff --git a/source/blender/editors/transform/transform_snap_sequencer.c b/source/blender/editors/transform/transform_snap_sequencer.c index 7dc361ff5bb..dbcae2b6320 100644 --- a/source/blender/editors/transform/transform_snap_sequencer.c +++ b/source/blender/editors/transform/transform_snap_sequencer.c @@ -25,6 +25,7 @@ #include "SEQ_relations.h" #include "SEQ_render.h" #include "SEQ_sequencer.h" +#include "SEQ_time.h" #include "transform.h" #include "transform_snap.h" @@ -65,14 +66,14 @@ static void seq_snap_source_points_build(TransSeqSnapData *snap_data, SeqCollect SEQ_ITERATOR_FOREACH (seq, snap_sources) { int left = 0, right = 0; if (seq->flag & SEQ_LEFTSEL) { - left = right = seq->startdisp; + left = right = SEQ_time_left_handle_frame_get(seq); } else if (seq->flag & SEQ_RIGHTSEL) { - left = right = seq->enddisp; + left = right = SEQ_time_right_handle_frame_get(seq); } else { - left = seq->startdisp; - right = seq->enddisp; + left = SEQ_time_left_handle_frame_get(seq); + right = SEQ_time_right_handle_frame_get(seq); } snap_data->source_snap_points[i] = left; @@ -193,21 +194,24 @@ static void seq_snap_target_points_build(Scene *scene, Sequence *seq; SEQ_ITERATOR_FOREACH (seq, snap_targets) { - snap_data->target_snap_points[i] = seq->startdisp; - snap_data->target_snap_points[i + 1] = seq->enddisp; + snap_data->target_snap_points[i] = SEQ_time_left_handle_frame_get(seq); + snap_data->target_snap_points[i + 1] = SEQ_time_right_handle_frame_get(seq); i += 2; if (snap_mode & SEQ_SNAP_TO_STRIP_HOLD) { - int content_start = min_ii(seq->enddisp, seq->start); - int content_end = max_ii(seq->startdisp, seq->start + seq->len); + int content_start = min_ii(SEQ_time_right_handle_frame_get(seq), seq->start); + int content_end = max_ii(SEQ_time_left_handle_frame_get(seq), seq->start + seq->len); /* Effects and single image strips produce incorrect content length. Skip these strips. */ if ((seq->type & SEQ_TYPE_EFFECT) != 0 || seq->len == 1) { - content_start = seq->startdisp; - content_end = seq->enddisp; + content_start = SEQ_time_left_handle_frame_get(seq); + content_end = SEQ_time_right_handle_frame_get(seq); } - CLAMP(content_start, seq->startdisp, seq->enddisp); - CLAMP(content_end, seq->startdisp, seq->enddisp); + CLAMP(content_start, + SEQ_time_left_handle_frame_get(seq), + SEQ_time_right_handle_frame_get(seq)); + CLAMP( + content_end, SEQ_time_left_handle_frame_get(seq), SEQ_time_right_handle_frame_get(seq)); snap_data->target_snap_points[i] = content_start; snap_data->target_snap_points[i + 1] = content_end; diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index f24057920d7..cbc9b2a8d06 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -301,22 +301,19 @@ void ED_uvedit_get_aspect(Object *ob, float *r_aspx, float *r_aspy) static void construct_param_handle_face_add(ParamHandle *handle, const Scene *scene, BMFace *efa, - int face_index, + ParamKey face_index, const int cd_loop_uv_offset) { - ParamKey key; ParamKey *vkeys = BLI_array_alloca(vkeys, efa->len); - ParamBool *pin = BLI_array_alloca(pin, efa->len); - ParamBool *select = BLI_array_alloca(select, efa->len); - float **co = BLI_array_alloca(co, efa->len); + bool *pin = BLI_array_alloca(pin, efa->len); + bool *select = BLI_array_alloca(select, efa->len); + const float **co = BLI_array_alloca(co, efa->len); float **uv = BLI_array_alloca(uv, efa->len); int i; BMIter liter; BMLoop *l; - key = (ParamKey)face_index; - /* let parametrizer split the ngon, it can make better decisions * about which split is best for unwrapping than poly-fill. */ BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) { @@ -329,7 +326,7 @@ static void construct_param_handle_face_add(ParamHandle *handle, select[i] = uvedit_uv_select_test(scene, l, cd_loop_uv_offset); } - GEO_uv_parametrizer_face_add(handle, key, i, vkeys, co, uv, pin, select); + GEO_uv_parametrizer_face_add(handle, face_index, i, vkeys, co, uv, pin, select); } /* See: construct_param_handle_multi to handle multiple objects at once. */ @@ -500,8 +497,8 @@ static void texface_from_original_index(const Scene *scene, BMFace *efa, int index, float **r_uv, - ParamBool *r_pin, - ParamBool *r_select) + bool *r_pin, + bool *r_select) { BMLoop *l; BMIter liter; @@ -633,8 +630,8 @@ static ParamHandle *construct_param_handle_subsurfed(const Scene *scene, /* Prepare and feed faces to the solver */ for (i = 0, mpoly = subsurfedPolys; i < numOfFaces; i++, mpoly++) { ParamKey key, vkeys[4]; - ParamBool pin[4], select[4]; - float *co[4]; + bool pin[4], select[4]; + const float *co[4]; float *uv[4]; BMFace *origFace = faceMap[i]; @@ -1245,7 +1242,7 @@ void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit) handle = construct_param_handle(scene, obedit, em->bm, &options, NULL); } - GEO_uv_parametrizer_lscm_begin(handle, PARAM_TRUE, abf); + GEO_uv_parametrizer_lscm_begin(handle, true, abf); /* Create or increase size of g_live_unwrap.handles array */ if (g_live_unwrap.handles == NULL) { @@ -1796,7 +1793,7 @@ static void uvedit_unwrap(const Scene *scene, handle = construct_param_handle(scene, obedit, em->bm, options, result_info); } - GEO_uv_parametrizer_lscm_begin(handle, PARAM_FALSE, scene->toolsettings->unwrapper == 0); + GEO_uv_parametrizer_lscm_begin(handle, false, scene->toolsettings->unwrapper == 0); GEO_uv_parametrizer_lscm_solve(handle, result_info ? &result_info->count_changed : NULL, result_info ? &result_info->count_failed : NULL); diff --git a/source/blender/geometry/GEO_uv_parametrizer.h b/source/blender/geometry/GEO_uv_parametrizer.h index 624b0695aa3..7fe60a3a855 100644 --- a/source/blender/geometry/GEO_uv_parametrizer.h +++ b/source/blender/geometry/GEO_uv_parametrizer.h @@ -14,10 +14,6 @@ extern "C" { typedef struct ParamHandle ParamHandle; /* Handle to an array of charts. */ typedef intptr_t ParamKey; /* Key (hash) for identifying verts and faces. */ -typedef enum ParamBool { - PARAM_TRUE = 1, - PARAM_FALSE = 0, -} ParamBool; /* -------------------------------------------------------------------- */ /** \name Chart Construction: @@ -39,19 +35,19 @@ ParamHandle *GEO_uv_parametrizer_construct_begin(void); void GEO_uv_parametrizer_aspect_ratio(ParamHandle *handle, float aspx, float aspy); void GEO_uv_parametrizer_face_add(ParamHandle *handle, - ParamKey key, - int nverts, - ParamKey *vkeys, - float *co[4], - float *uv[4], - ParamBool *pin, - ParamBool *select); + const ParamKey key, + const int nverts, + const ParamKey *vkeys, + const float **co, + float **uv, /* Output will eventually be written to `uv`. */ + const bool *pin, + const bool *select); void GEO_uv_parametrizer_edge_set_seam(ParamHandle *handle, ParamKey *vkeys); void GEO_uv_parametrizer_construct_end(ParamHandle *handle, - ParamBool fill, - ParamBool topology_from_uvs, + bool fill, + bool topology_from_uvs, int *count_fail); void GEO_uv_parametrizer_delete(ParamHandle *handle); @@ -70,7 +66,7 @@ void GEO_uv_parametrizer_delete(ParamHandle *handle); * * \{ */ -void GEO_uv_parametrizer_lscm_begin(ParamHandle *handle, ParamBool live, ParamBool abf); +void GEO_uv_parametrizer_lscm_begin(ParamHandle *handle, bool live, bool abf); void GEO_uv_parametrizer_lscm_solve(ParamHandle *handle, int *count_changed, int *count_failed); void GEO_uv_parametrizer_lscm_end(ParamHandle *handle); @@ -88,14 +84,6 @@ void GEO_uv_parametrizer_stretch_end(ParamHandle *handle); /** \} */ /* -------------------------------------------------------------------- */ -/** \name Area Smooth - * \{ */ - -void GEO_uv_parametrizer_smooth_area(ParamHandle *handle); - -/** \} */ - -/* -------------------------------------------------------------------- */ /** \name Packing * \{ */ diff --git a/source/blender/geometry/intern/uv_parametrizer.c b/source/blender/geometry/intern/uv_parametrizer.c index ad4b051a6c2..af3bcc3bdec 100644 --- a/source/blender/geometry/intern/uv_parametrizer.c +++ b/source/blender/geometry/intern/uv_parametrizer.c @@ -36,11 +36,6 @@ #define param_warning(message) \ {/*printf("Warning %s:%d: %s\n", __FILE__, __LINE__, message);*/}(void)0 -typedef enum PBool { - P_TRUE = 1, - P_FALSE = 0, -} PBool; - /* Special Purpose Hash */ typedef intptr_t PHashKey; @@ -509,53 +504,26 @@ static void UNUSED_FUNCTION(p_chart_uv_from_array)(PChart *chart, float (*points } } -static PBool p_intersect_line_2d_dir(const float v1[2], - const float dir1[2], - const float v2[2], - const float dir2[2], - float r_isect[2]) +static bool p_intersect_line_2d_dir(const float v1[2], + const float dir1[2], + const float v2[2], + const float dir2[2], + float r_isect[2]) { float lmbda, div; div = dir2[0] * dir1[1] - dir2[1] * dir1[0]; if (div == 0.0f) { - return P_FALSE; + return false; } lmbda = ((v1[1] - v2[1]) * dir1[0] - (v1[0] - v2[0]) * dir1[1]) / div; r_isect[0] = v1[0] + lmbda * dir2[0]; r_isect[1] = v1[1] + lmbda * dir2[1]; - return P_TRUE; -} - -#if 0 -static PBool p_intersect_line_2d(const float v1[2], - const float v2[2], - const float v3[2], - const float v4[2], - const float r_isect[2]) -{ - float dir1[2], dir2[2]; - - dir1[0] = v4[0] - v3[0]; - dir1[1] = v4[1] - v3[1]; - - dir2[0] = v2[0] - v1[0]; - dir2[1] = v2[1] - v1[1]; - - if (!p_intersect_line_2d_dir(v1, dir1, v2, dir2, isect)) { - /* parallel - should never happen in theory for polygon kernel, but - * let's give a point nearby in case things go wrong */ - isect[0] = (v1[0] + v2[0]) * 0.5f; - isect[1] = (v1[1] + v2[1]) * 0.5f; - return P_FALSE; - } - - return P_TRUE; + return true; } -#endif /* Topological Utilities */ @@ -586,9 +554,9 @@ static PEdge *p_boundary_edge_prev(PEdge *e) return last->next->next; } -static PBool p_vert_interior(PVert *v) +static bool p_vert_interior(PVert *v) { - return (v->edge->pair != NULL); + return v->edge->pair; } static void p_face_flip(PFace *f) @@ -807,7 +775,7 @@ static PEdge *p_edge_lookup(ParamHandle *handle, const PHashKey *vkeys) return NULL; } -static int p_face_exists(ParamHandle *handle, ParamKey *pvkeys, int i1, int i2, int i3) +static int p_face_exists(ParamHandle *handle, const ParamKey *pvkeys, int i1, int i2, int i3) { PHashKey *vkeys = (PHashKey *)pvkeys; PHashKey key = PHASH_edge(vkeys[i1], vkeys[i2]); @@ -816,19 +784,19 @@ static int p_face_exists(ParamHandle *handle, ParamKey *pvkeys, int i1, int i2, while (e) { if ((e->vert->u.key == vkeys[i1]) && (e->next->vert->u.key == vkeys[i2])) { if (e->next->next->vert->u.key == vkeys[i3]) { - return P_TRUE; + return true; } } else if ((e->vert->u.key == vkeys[i2]) && (e->next->vert->u.key == vkeys[i1])) { if (e->next->next->vert->u.key == vkeys[i3]) { - return P_TRUE; + return true; } } e = (PEdge *)phash_next(handle->hash_edges, key, (PHashLink *)e); } - return P_FALSE; + return false; } static PChart *p_chart_new(ParamHandle *handle) @@ -845,7 +813,7 @@ static void p_chart_delete(PChart *chart) MEM_freeN(chart); } -static PBool p_edge_implicit_seam(PEdge *e, PEdge *ep) +static bool p_edge_implicit_seam(PEdge *e, PEdge *ep) { float *uv1, *uv2, *uvp1, *uvp2; float limit[2]; @@ -868,21 +836,18 @@ static PBool p_edge_implicit_seam(PEdge *e, PEdge *ep) if ((fabsf(uv1[0] - uvp1[0]) > limit[0]) || (fabsf(uv1[1] - uvp1[1]) > limit[1])) { e->flag |= PEDGE_SEAM; ep->flag |= PEDGE_SEAM; - return P_TRUE; + return true; } if ((fabsf(uv2[0] - uvp2[0]) > limit[0]) || (fabsf(uv2[1] - uvp2[1]) > limit[1])) { e->flag |= PEDGE_SEAM; ep->flag |= PEDGE_SEAM; - return P_TRUE; + return true; } - return P_FALSE; + return false; } -static PBool p_edge_has_pair(ParamHandle *handle, - PEdge *e, - PBool topology_from_uvs, - PEdge **r_pair) +static bool p_edge_has_pair(ParamHandle *handle, PEdge *e, bool topology_from_uvs, PEdge **r_pair) { PHashKey key; PEdge *pe; @@ -891,7 +856,7 @@ static PBool p_edge_has_pair(ParamHandle *handle, PHashKey key2 = e->next->vert->u.key; if (e->flag & PEDGE_SEAM) { - return P_FALSE; + return false; } key = PHASH_edge(key1, key2); @@ -910,7 +875,7 @@ static PBool p_edge_has_pair(ParamHandle *handle, if ((pe->flag & PEDGE_SEAM) || *r_pair || (topology_from_uvs && p_edge_implicit_seam(e, pe))) { *r_pair = NULL; - return P_FALSE; + return false; } *r_pair = pe; @@ -924,17 +889,17 @@ static PBool p_edge_has_pair(ParamHandle *handle, if ((*r_pair)->next->pair || (*r_pair)->next->next->pair) { /* non unfoldable, maybe mobius ring or klein bottle */ *r_pair = NULL; - return P_FALSE; + return false; } } return (*r_pair != NULL); } -static PBool p_edge_connect_pair(ParamHandle *handle, - PEdge *e, - PBool topology_from_uvs, - PEdge ***stack) +static bool p_edge_connect_pair(ParamHandle *handle, + PEdge *e, + bool topology_from_uvs, + PEdge ***stack) { PEdge *pair = NULL; @@ -955,7 +920,7 @@ static PBool p_edge_connect_pair(ParamHandle *handle, return (e->pair != NULL); } -static int p_connect_pairs(ParamHandle *handle, PBool topology_from_uvs) +static int p_connect_pairs(ParamHandle *handle, bool topology_from_uvs) { PEdge **stackbase = MEM_mallocN(sizeof(*stackbase) * phash_size(handle->hash_faces), "Pstackbase"); @@ -1009,7 +974,7 @@ static void p_split_vert(PChart *chart, PEdge *e) { PEdge *we, *lastwe = NULL; PVert *v = e->vert; - PBool copy = P_TRUE; + bool copy = true; if (e->flag & PEDGE_PIN) { chart->flag |= PCHART_HAS_PINS; @@ -1035,7 +1000,7 @@ static void p_split_vert(PChart *chart, PEdge *e) if (we == v->edge) { /* found it, no need to copy */ - copy = P_FALSE; + copy = false; v->nextlink = chart->verts; chart->verts = v; chart->nverts++; @@ -1136,13 +1101,13 @@ static PFace *p_face_add(ParamHandle *handle) static PFace *p_face_add_construct(ParamHandle *handle, ParamKey key, const ParamKey *vkeys, - float *co[4], - float *uv[4], + const float **co, + float **uv, int i1, int i2, int i3, - const ParamBool *pin, - const ParamBool *select) + const bool *pin, + const bool *select) { PFace *f = p_face_add(handle); PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next; @@ -1179,7 +1144,6 @@ static PFace *p_face_add_construct(ParamHandle *handle, } } - /* insert into hash */ f->u.key = key; phash_insert(handle->hash_faces, (PHashLink *)f); @@ -1220,14 +1184,14 @@ static PFace *p_face_add_fill(PChart *chart, PVert *v1, PVert *v2, PVert *v3) return f; } -static PBool p_quad_split_direction(ParamHandle *handle, float **co, PHashKey *vkeys) +static bool p_quad_split_direction(ParamHandle *handle, const float **co, const ParamKey *vkeys) { /* Slight bias to prefer one edge over the other in case they are equal, so * that in symmetric models we choose the same split direction instead of * depending on floating point errors to decide. */ float bias = 1.0f + 1e-6f; float fac = len_v3v3(co[0], co[2]) * bias - len_v3v3(co[1], co[3]); - PBool dir = (fac <= 0.0f); + bool dir = (fac <= 0.0f); /* The face exists check is there because of a special case: * when two quads share three vertices, they can each be split into two triangles, @@ -1566,22 +1530,22 @@ static float p_vert_cotan(const float v1[3], const float v2[3], const float v3[3 return dot_v3v3(a, b) / clen; } -static PBool p_vert_flipped_wheel_triangle(PVert *v) +static bool p_vert_flipped_wheel_triangle(PVert *v) { PEdge *e = v->edge; do { if (p_face_uv_area_signed(e->face) < 0.0f) { - return P_TRUE; + return true; } e = p_wheel_edge_next(e); } while (e && (e != v->edge)); - return P_FALSE; + return false; } -static PBool p_vert_map_harmonic_weights(PVert *v) +static bool p_vert_map_harmonic_weights(PVert *v) { float weightsum, positionsum[2], olduv[2]; @@ -1647,10 +1611,10 @@ static PBool p_vert_map_harmonic_weights(PVert *v) v->uv[0] = olduv[0]; v->uv[1] = olduv[1]; - return P_FALSE; + return false; } - return P_TRUE; + return true; } static void p_vert_harmonic_insert(PVert *v) @@ -1883,7 +1847,7 @@ static void p_split_vertex(PEdge *edge, PEdge *pair) } while (e && (e != newv->edge)); } -static PBool p_collapse_allowed_topologic(PEdge *edge, PEdge *pair) +static bool p_collapse_allowed_topologic(PEdge *edge, PEdge *pair) { PVert *oldv, *keepv; @@ -1893,22 +1857,22 @@ static PBool p_collapse_allowed_topologic(PEdge *edge, PEdge *pair) if (!edge || !pair) { /* avoid collapsing chart into an edge */ if (edge && !edge->next->pair && !edge->next->next->pair) { - return P_FALSE; + return false; } else if (pair && !pair->next->pair && !pair->next->next->pair) { - return P_FALSE; + return false; } } /* avoid merging two boundaries (oldv and keepv are on the 'other side' of * the chart) */ else if (!p_vert_interior(oldv) && !p_vert_interior(keepv)) { - return P_FALSE; + return false; } - return P_TRUE; + return true; } -static PBool p_collapse_normal_flipped(float *v1, float *v2, float *vold, float *vnew) +static bool p_collapse_normal_flipped(float *v1, float *v2, float *vold, float *vnew) { float nold[3], nnew[3], sub1[3], sub2[3]; @@ -1923,7 +1887,7 @@ static PBool p_collapse_normal_flipped(float *v1, float *v2, float *vold, float return (dot_v3v3(nold, nnew) <= 0.0f); } -static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair) +static bool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair) { PVert *oldv, *keepv; PEdge *e; @@ -1950,7 +1914,7 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair) } if (p_collapse_normal_flipped(v1->co, v2->co, oldv->co, keepv->co)) { - return P_FALSE; + return false; } a[0] = angle; @@ -1967,10 +1931,10 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair) for (i = 0; i < 3; i++) { if ((b[i] < a[i]) && (b[i] < minangle)) { - return P_FALSE; + return false; } else if ((b[i] > a[i]) && (b[i] > maxangle)) { - return P_FALSE; + return false; } } @@ -1980,7 +1944,7 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair) if (p_vert_interior(oldv)) { /* HLSCM criterion: angular defect smaller than threshold. */ if (fabsf(angulardefect) > (float)(M_PI * 30.0 / 180.0)) { - return P_FALSE; + return false; } } else { @@ -1989,27 +1953,27 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair) /* ABF++ criterion 2: avoid collapsing verts inwards. */ if (p_vert_interior(keepv)) { - return P_FALSE; + return false; } /* Don't collapse significant boundary changes. */ angle = p_vec_angle(v1->co, oldv->co, v2->co); if (angle < (M_PI * 160.0 / 180.0)) { - return P_FALSE; + return false; } } - return P_TRUE; + return true; } -static PBool p_collapse_allowed(PEdge *edge, PEdge *pair) +static bool p_collapse_allowed(PEdge *edge, PEdge *pair) { PVert *oldv, *keepv; p_collapsing_verts(edge, pair, &oldv, &keepv); if (oldv->flag & PVERT_PIN) { - return P_FALSE; + return false; } return (p_collapse_allowed_topologic(edge, pair) && p_collapse_allowed_geometric(edge, pair)); @@ -2572,21 +2536,17 @@ static float p_abf_compute_gradient(PAbfSystem *sys, PChart *chart) return norm; } -static PBool p_abf_matrix_invert(PAbfSystem *sys, PChart *chart) +static bool p_abf_matrix_invert(PAbfSystem *sys, PChart *chart) { - PFace *f; - PEdge *e; - int i, j, ninterior = sys->ninterior, nvar = 2 * sys->ninterior; - PBool success; - LinearSolver *context; - - context = EIG_linear_solver_new(0, nvar, 1); + int ninterior = sys->ninterior; + int nvar = 2 * ninterior; + LinearSolver *context = EIG_linear_solver_new(0, nvar, 1); - for (i = 0; i < nvar; i++) { + for (int i = 0; i < nvar; i++) { EIG_linear_solver_right_hand_side_add(context, 0, i, sys->bInterior[i]); } - for (f = chart->faces; f; f = f->nextlink) { + for (PFace *f = chart->faces; f; f = f->nextlink) { float wi1, wi2, wi3, b, si, beta[3], j2[3][3], W[3][3]; float row1[6], row2[6], row3[6]; int vid[6]; @@ -2691,14 +2651,14 @@ static PBool p_abf_matrix_invert(PAbfSystem *sys, PChart *chart) row3[5] = j2[0][2] * W[2][0] + j2[1][2] * W[2][1]; } - for (i = 0; i < 3; i++) { + for (int i = 0; i < 3; i++) { int r = vid[i]; if (r == -1) { continue; } - for (j = 0; j < 6; j++) { + for (int j = 0; j < 6; j++) { int c = vid[j]; if (c == -1) { @@ -2729,10 +2689,10 @@ static PBool p_abf_matrix_invert(PAbfSystem *sys, PChart *chart) } } - success = EIG_linear_solver_solve(context); + bool success = EIG_linear_solver_solve(context); if (success) { - for (f = chart->faces; f; f = f->nextlink) { + for (PFace *f = chart->faces; f; f = f->nextlink) { float dlambda1, pre[3], dalpha; PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next; PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert; @@ -2778,7 +2738,7 @@ static PBool p_abf_matrix_invert(PAbfSystem *sys, PChart *chart) sys->alpha[e3->u.id] += dalpha / sys->weight[e3->u.id] - pre[2]; /* clamp */ - e = f->edge; + PEdge *e = f->edge; do { if (sys->alpha[e->u.id] > (float)M_PI) { sys->alpha[e->u.id] = (float)M_PI; @@ -2789,7 +2749,7 @@ static PBool p_abf_matrix_invert(PAbfSystem *sys, PChart *chart) } while (e != f->edge); } - for (i = 0; i < ninterior; i++) { + for (int i = 0; i < ninterior; i++) { sys->lambdaPlanar[i] += (float)EIG_linear_solver_variable_get(context, 0, i); sys->lambdaLength[i] += (float)EIG_linear_solver_variable_get(context, 0, ninterior + i); } @@ -2800,7 +2760,7 @@ static PBool p_abf_matrix_invert(PAbfSystem *sys, PChart *chart) return success; } -static PBool p_chart_abf_solve(PChart *chart) +static bool p_chart_abf_solve(PChart *chart) { PVert *v; PFace *f; @@ -2911,7 +2871,7 @@ static PBool p_chart_abf_solve(PChart *chart) if (!p_abf_matrix_invert(&sys, chart)) { param_warning("ABF failed to invert matrix"); p_abf_free_system(&sys); - return P_FALSE; + return false; } p_abf_compute_sines(&sys); @@ -2920,14 +2880,14 @@ static PBool p_chart_abf_solve(PChart *chart) if (i == ABF_MAX_ITER) { param_warning("ABF maximum iterations reached"); p_abf_free_system(&sys); - return P_FALSE; + return false; } } chart->u.lscm.abf_alpha = MEM_dupallocN(sys.alpha); p_abf_free_system(&sys); - return P_TRUE; + return true; } /* Least Squares Conformal Maps */ @@ -2983,7 +2943,7 @@ static void p_chart_pin_positions(PChart *chart, PVert **pin1, PVert **pin2) } } -static PBool p_chart_symmetry_pins(PChart *chart, PEdge *outer, PVert **pin1, PVert **pin2) +static bool p_chart_symmetry_pins(PChart *chart, PEdge *outer, PVert **pin1, PVert **pin2) { PEdge *be, *lastbe = NULL, *maxe1 = NULL, *maxe2 = NULL, *be1, *be2; PEdge *cure = NULL, *firste1 = NULL, *firste2 = NULL, *nextbe; @@ -3044,7 +3004,7 @@ static PBool p_chart_symmetry_pins(PChart *chart, PEdge *outer, PVert **pin1, PV } if (!maxe1 || !maxe2 || (maxlen < 0.5f * totlen)) { - return P_FALSE; + return false; } /* find pin1 in the split vertices */ @@ -3144,10 +3104,10 @@ static void p_chart_lscm_load_solution(PChart *chart) } } -static void p_chart_lscm_begin(PChart *chart, PBool live, PBool abf) +static void p_chart_lscm_begin(PChart *chart, bool live, bool abf) { PVert *v, *pin1, *pin2; - PBool select = P_FALSE, deselect = P_FALSE; + bool select = false, deselect = false; int npins = 0, id = 0; /* give vertices matrix indices and count pins */ @@ -3155,12 +3115,12 @@ static void p_chart_lscm_begin(PChart *chart, PBool live, PBool abf) if (v->flag & PVERT_PIN) { npins++; if (v->flag & PVERT_SELECT) { - select = P_TRUE; + select = true; } } if (!(v->flag & PVERT_SELECT)) { - deselect = P_TRUE; + deselect = true; } } @@ -3213,7 +3173,7 @@ static void p_chart_lscm_begin(PChart *chart, PBool live, PBool abf) } } -static PBool p_chart_lscm_solve(ParamHandle *handle, PChart *chart) +static bool p_chart_lscm_solve(ParamHandle *handle, PChart *chart) { LinearSolver *context = chart->u.lscm.context; PVert *v, *pin1 = chart->u.lscm.pin1, *pin2 = chart->u.lscm.pin2; @@ -3350,7 +3310,7 @@ static PBool p_chart_lscm_solve(ParamHandle *handle, PChart *chart) if (EIG_linear_solver_solve(context)) { p_chart_lscm_load_solution(chart); - return P_TRUE; + return true; } for (v = chart->verts; v; v = v->nextlink) { @@ -3358,7 +3318,7 @@ static PBool p_chart_lscm_solve(ParamHandle *handle, PChart *chart) v->uv[1] = 0.0f; } - return P_FALSE; + return false; } static void p_chart_lscm_transform_single_pin(PChart *chart) @@ -3570,7 +3530,7 @@ static int p_compare_geometric_uv(const void *a, const void *b) return 1; } -static PBool p_chart_convex_hull(PChart *chart, PVert ***r_verts, int *r_nverts, int *r_right) +static bool p_chart_convex_hull(PChart *chart, PVert ***r_verts, int *r_nverts, int *r_right) { /* Graham algorithm, taken from: * http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/117225 */ @@ -3582,7 +3542,7 @@ static PBool p_chart_convex_hull(PChart *chart, PVert ***r_verts, int *r_nverts, p_chart_boundaries(chart, NULL, &be); if (!be) { - return P_FALSE; + return false; } e = be; @@ -3636,7 +3596,7 @@ static PBool p_chart_convex_hull(PChart *chart, PVert ***r_verts, int *r_nverts, MEM_freeN(U); MEM_freeN(L); - return P_TRUE; + return true; } static float p_rectangle_area(float *p1, float *dir, float *p2, float *p3, float *p4) @@ -3819,545 +3779,6 @@ static void p_chart_rotate_fit_aabb(PChart *chart) } } -/* Area Smoothing */ - -/* 2d BSP tree for inverse mapping - that's a bit silly. */ - -typedef struct SmoothTriangle { - float co1[2], co2[2], co3[2]; - float oco1[2], oco2[2], oco3[2]; -} SmoothTriangle; - -typedef struct SmoothNode { - struct SmoothNode *c1, *c2; - SmoothTriangle **tri; - float split; - int axis, ntri; -} SmoothNode; - -static void p_barycentric_2d( - const float v1[2], const float v2[2], const float v3[2], const float p[2], float b[3]) -{ - float a[2], c[2], h[2], div; - - a[0] = v2[0] - v1[0]; - a[1] = v2[1] - v1[1]; - c[0] = v3[0] - v1[0]; - c[1] = v3[1] - v1[1]; - - div = a[0] * c[1] - a[1] * c[0]; - - if (div == 0.0f) { - b[0] = 1.0f / 3.0f; - b[1] = 1.0f / 3.0f; - b[2] = 1.0f / 3.0f; - } - else { - h[0] = p[0] - v1[0]; - h[1] = p[1] - v1[1]; - - div = 1.0f / div; - - b[1] = (h[0] * c[1] - h[1] * c[0]) * div; - b[2] = (a[0] * h[1] - a[1] * h[0]) * div; - b[0] = 1.0f - b[1] - b[2]; - } -} - -static PBool p_triangle_inside(SmoothTriangle *t, float co[2]) -{ - float b[3]; - - p_barycentric_2d(t->co1, t->co2, t->co3, co, b); - - if ((b[0] >= 0.0f) && (b[1] >= 0.0f) && (b[2] >= 0.0f)) { - co[0] = t->oco1[0] * b[0] + t->oco2[0] * b[1] + t->oco3[0] * b[2]; - co[1] = t->oco1[1] * b[0] + t->oco2[1] * b[1] + t->oco3[1] * b[2]; - return P_TRUE; - } - - return P_FALSE; -} - -static SmoothNode *p_node_new( - MemArena *arena, SmoothTriangle **tri, int ntri, float *bmin, float *bmax, int depth) -{ - SmoothNode *node = BLI_memarena_alloc(arena, sizeof(*node)); - int axis, i, t1size = 0, t2size = 0; - float split, /* mi, */ /* UNUSED */ mx; - SmoothTriangle **t1, **t2, *t; - - node->tri = tri; - node->ntri = ntri; - - if (ntri <= 10 || depth >= 15) { - return node; - } - - t1 = MEM_mallocN(sizeof(*t1) * ntri, "PNodeTri1"); - t2 = MEM_mallocN(sizeof(*t2) * ntri, "PNodeTri1"); - - axis = (bmax[0] - bmin[0] > bmax[1] - bmin[1]) ? 0 : 1; - split = 0.5f * (bmin[axis] + bmax[axis]); - - for (i = 0; i < ntri; i++) { - t = tri[i]; - - if ((t->co1[axis] <= split) || (t->co2[axis] <= split) || (t->co3[axis] <= split)) { - t1[t1size] = t; - t1size++; - } - if ((t->co1[axis] >= split) || (t->co2[axis] >= split) || (t->co3[axis] >= split)) { - t2[t2size] = t; - t2size++; - } - } - - if ((t1size == t2size) && (t1size == ntri)) { - MEM_freeN(t1); - MEM_freeN(t2); - return node; - } - - node->tri = NULL; - node->ntri = 0; - MEM_freeN(tri); - - node->axis = axis; - node->split = split; - - /* mi = bmin[axis]; */ /* UNUSED */ - mx = bmax[axis]; - bmax[axis] = split; - node->c1 = p_node_new(arena, t1, t1size, bmin, bmax, depth + 1); - - bmin[axis] = bmax[axis]; - bmax[axis] = mx; - node->c2 = p_node_new(arena, t2, t2size, bmin, bmax, depth + 1); - - return node; -} - -static void p_node_delete(SmoothNode *node) -{ - if (node->c1) { - p_node_delete(node->c1); - } - if (node->c2) { - p_node_delete(node->c2); - } - if (node->tri) { - MEM_freeN(node->tri); - } -} - -static PBool p_node_intersect(SmoothNode *node, float co[2]) -{ - int i; - - if (node->tri) { - for (i = 0; i < node->ntri; i++) { - if (p_triangle_inside(node->tri[i], co)) { - return P_TRUE; - } - } - - return P_FALSE; - } - - if (co[node->axis] < node->split) { - return p_node_intersect(node->c1, co); - } - return p_node_intersect(node->c2, co); -} - -/* smoothing */ - -static int p_compare_float(const void *a_, const void *b_) -{ - const float a = *(const float *)a_; - const float b = *(const float *)b_; - - if (a < b) { - return -1; - } - if (a == b) { - return 0; - } - return 1; -} - -static float p_smooth_median_edge_length(PChart *chart) -{ - PEdge *e; - float *lengths = MEM_mallocN(sizeof(chart->edges) * chart->nedges, "PMedianLength"); - float median; - int i; - - /* ok, so I'm lazy */ - for (i = 0, e = chart->edges; e; e = e->nextlink, i++) { - lengths[i] = p_edge_length(e); - } - - qsort(lengths, i, sizeof(float), p_compare_float); - - median = lengths[i / 2]; - MEM_freeN(lengths); - - return median; -} - -static float p_smooth_distortion(PEdge *e, float avg2d, float avg3d) -{ - float len2d = p_edge_uv_length(e) * avg3d; - float len3d = p_edge_length(e) * avg2d; - - return (len3d == 0.0f) ? 0.0f : len2d / len3d; -} - -static void p_smooth(PChart *chart) -{ - PEdge *e; - PVert *v; - PFace *f; - int j, it2, maxiter2, it; - int nedges = chart->nedges, nwheel, gridx, gridy; - int edgesx, edgesy, nsize, esize, i, x, y, maxiter; - float minv[2], maxv[2], median, invmedian, avglen2d, avglen3d; - float center[2], dx, dy, *nodes, dlimit, d, *oldnodesx, *oldnodesy; - float *nodesx, *nodesy, *hedges, *vedges, climit, moved, padding; - SmoothTriangle *triangles, *t, *t2, **tri, **trip; - SmoothNode *root; - MemArena *arena; - - if (nedges == 0) { - return; - } - - p_chart_uv_bbox(chart, minv, maxv); - median = p_smooth_median_edge_length(chart) * 0.10f; - - if (median == 0.0f) { - return; - } - - invmedian = 1.0f / median; - - /* compute edge distortion */ - avglen2d = avglen3d = 0.0; - - for (e = chart->edges; e; e = e->nextlink) { - avglen2d += p_edge_uv_length(e); - avglen3d += p_edge_length(e); - } - - avglen2d /= nedges; - avglen3d /= nedges; - - for (v = chart->verts; v; v = v->nextlink) { - v->u.distortion = 0.0; - nwheel = 0; - - e = v->edge; - do { - v->u.distortion += p_smooth_distortion(e, avglen2d, avglen3d); - nwheel++; - - e = e->next->next->pair; - } while (e && (e != v->edge)); - - v->u.distortion /= nwheel; - } - - /* need to do excessive grid size checking still */ - center[0] = 0.5f * (minv[0] + maxv[0]); - center[1] = 0.5f * (minv[1] + maxv[1]); - - dx = 0.5f * (maxv[0] - minv[0]); - dy = 0.5f * (maxv[1] - minv[1]); - - padding = 0.15f; - dx += padding * dx + 2.0f * median; - dy += padding * dy + 2.0f * median; - - gridx = (int)(dx * invmedian); - gridy = (int)(dy * invmedian); - - minv[0] = center[0] - median * gridx; - minv[1] = center[1] - median * gridy; - maxv[0] = center[0] + median * gridx; - maxv[1] = center[1] + median * gridy; - - /* create grid */ - gridx = gridx * 2 + 1; - gridy = gridy * 2 + 1; - - if ((gridx <= 2) || (gridy <= 2)) { - return; - } - - edgesx = gridx - 1; - edgesy = gridy - 1; - nsize = gridx * gridy; - esize = edgesx * edgesy; - - nodes = MEM_mallocN(sizeof(float) * nsize, "PSmoothNodes"); - nodesx = MEM_mallocN(sizeof(float) * nsize, "PSmoothNodesX"); - nodesy = MEM_mallocN(sizeof(float) * nsize, "PSmoothNodesY"); - oldnodesx = MEM_mallocN(sizeof(float) * nsize, "PSmoothOldNodesX"); - oldnodesy = MEM_mallocN(sizeof(float) * nsize, "PSmoothOldNodesY"); - hedges = MEM_mallocN(sizeof(float) * esize, "PSmoothHEdges"); - vedges = MEM_mallocN(sizeof(float) * esize, "PSmoothVEdges"); - - if (!nodes || !nodesx || !nodesy || !oldnodesx || !oldnodesy || !hedges || !vedges) { - if (nodes) { - MEM_freeN(nodes); - } - if (nodesx) { - MEM_freeN(nodesx); - } - if (nodesy) { - MEM_freeN(nodesy); - } - if (oldnodesx) { - MEM_freeN(oldnodesx); - } - if (oldnodesy) { - MEM_freeN(oldnodesy); - } - if (hedges) { - MEM_freeN(hedges); - } - if (vedges) { - MEM_freeN(vedges); - } - - // printf("Not enough memory for area smoothing grid"); - return; - } - - for (x = 0; x < gridx; x++) { - for (y = 0; y < gridy; y++) { - i = x + y * gridx; - - nodesx[i] = minv[0] + median * x; - nodesy[i] = minv[1] + median * y; - - nodes[i] = 1.0f; - } - } - - /* embed in grid */ - for (f = chart->faces; f; f = f->nextlink) { - PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next; - float fmin[2], fmax[2]; - int bx1, by1, bx2, by2; - - INIT_MINMAX2(fmin, fmax); - - minmax_v2v2_v2(fmin, fmax, e1->vert->uv); - minmax_v2v2_v2(fmin, fmax, e2->vert->uv); - minmax_v2v2_v2(fmin, fmax, e3->vert->uv); - - bx1 = (int)((fmin[0] - minv[0]) * invmedian); - by1 = (int)((fmin[1] - minv[1]) * invmedian); - bx2 = (int)((fmax[0] - minv[0]) * invmedian + 2); - by2 = (int)((fmax[1] - minv[1]) * invmedian + 2); - - for (x = bx1; x < bx2; x++) { - for (y = by1; y < by2; y++) { - float p[2], b[3]; - - i = x + y * gridx; - - p[0] = nodesx[i]; - p[1] = nodesy[i]; - - p_barycentric_2d(e1->vert->uv, e2->vert->uv, e3->vert->uv, p, b); - - if ((b[0] > 0.0f) && (b[1] > 0.0f) && (b[2] > 0.0f)) { - nodes[i] = e1->vert->u.distortion * b[0]; - nodes[i] += e2->vert->u.distortion * b[1]; - nodes[i] += e3->vert->u.distortion * b[2]; - } - } - } - } - - /* smooth the grid */ - maxiter = 10; - climit = 0.00001f * nsize; - - for (it = 0; it < maxiter; it++) { - moved = 0.0f; - - for (x = 0; x < edgesx; x++) { - for (y = 0; y < edgesy; y++) { - i = x + y * gridx; - j = x + y * edgesx; - - hedges[j] = (nodes[i] + nodes[i + 1]) * 0.5f; - vedges[j] = (nodes[i] + nodes[i + gridx]) * 0.5f; - - /* we do *inverse* mapping */ - hedges[j] = 1.0f / hedges[j]; - vedges[j] = 1.0f / vedges[j]; - } - } - - maxiter2 = 50; - dlimit = 0.0001f; - - for (it2 = 0; it2 < maxiter2; it2++) { - d = 0.0f; - - memcpy(oldnodesx, nodesx, sizeof(float) * nsize); - memcpy(oldnodesy, nodesy, sizeof(float) * nsize); - - for (x = 1; x < gridx - 1; x++) { - for (y = 1; y < gridy - 1; y++) { - float p[2], oldp[2], sum1, sum2, diff[2], length; - - i = x + gridx * y; - j = x + edgesx * y; - - oldp[0] = oldnodesx[i]; - oldp[1] = oldnodesy[i]; - - sum1 = hedges[j - 1] * oldnodesx[i - 1]; - sum1 += hedges[j] * oldnodesx[i + 1]; - sum1 += vedges[j - edgesx] * oldnodesx[i - gridx]; - sum1 += vedges[j] * oldnodesx[i + gridx]; - - sum2 = hedges[j - 1]; - sum2 += hedges[j]; - sum2 += vedges[j - edgesx]; - sum2 += vedges[j]; - - nodesx[i] = sum1 / sum2; - - sum1 = hedges[j - 1] * oldnodesy[i - 1]; - sum1 += hedges[j] * oldnodesy[i + 1]; - sum1 += vedges[j - edgesx] * oldnodesy[i - gridx]; - sum1 += vedges[j] * oldnodesy[i + gridx]; - - nodesy[i] = sum1 / sum2; - - p[0] = nodesx[i]; - p[1] = nodesy[i]; - - diff[0] = p[0] - oldp[0]; - diff[1] = p[1] - oldp[1]; - - length = len_v2(diff); - d = max_ff(d, length); - moved += length; - } - } - - if (d < dlimit) { - break; - } - } - - if (moved < climit) { - break; - } - } - - MEM_freeN(oldnodesx); - MEM_freeN(oldnodesy); - MEM_freeN(hedges); - MEM_freeN(vedges); - - /* Create BSP. */ - t = triangles = MEM_mallocN(sizeof(SmoothTriangle) * esize * 2, "PSmoothTris"); - trip = tri = MEM_mallocN(sizeof(SmoothTriangle *) * esize * 2, "PSmoothTriP"); - - if (!triangles || !tri) { - MEM_freeN(nodes); - MEM_freeN(nodesx); - MEM_freeN(nodesy); - - if (triangles) { - MEM_freeN(triangles); - } - if (tri) { - MEM_freeN(tri); - } - - // printf("Not enough memory for area smoothing grid"); - return; - } - - for (x = 0; x < edgesx; x++) { - for (y = 0; y < edgesy; y++) { - i = x + y * gridx; - - t->co1[0] = nodesx[i]; - t->co1[1] = nodesy[i]; - - t->co2[0] = nodesx[i + 1]; - t->co2[1] = nodesy[i + 1]; - - t->co3[0] = nodesx[i + gridx]; - t->co3[1] = nodesy[i + gridx]; - - t->oco1[0] = minv[0] + x * median; - t->oco1[1] = minv[1] + y * median; - - t->oco2[0] = minv[0] + (x + 1) * median; - t->oco2[1] = minv[1] + y * median; - - t->oco3[0] = minv[0] + x * median; - t->oco3[1] = minv[1] + (y + 1) * median; - - t2 = t + 1; - - t2->co1[0] = nodesx[i + gridx + 1]; - t2->co1[1] = nodesy[i + gridx + 1]; - - t2->oco1[0] = minv[0] + (x + 1) * median; - t2->oco1[1] = minv[1] + (y + 1) * median; - - t2->co2[0] = t->co2[0]; - t2->co2[1] = t->co2[1]; - t2->oco2[0] = t->oco2[0]; - t2->oco2[1] = t->oco2[1]; - - t2->co3[0] = t->co3[0]; - t2->co3[1] = t->co3[1]; - t2->oco3[0] = t->oco3[0]; - t2->oco3[1] = t->oco3[1]; - - *trip = t; - trip++; - t++; - *trip = t; - trip++; - t++; - } - } - - MEM_freeN(nodes); - MEM_freeN(nodesx); - MEM_freeN(nodesy); - - arena = BLI_memarena_new(MEM_SIZE_OPTIMAL(1 << 16), "param smooth arena"); - root = p_node_new(arena, tri, esize * 2, minv, maxv, 0); - - for (v = chart->verts; v; v = v->nextlink) { - if (!p_node_intersect(root, v->uv)) { - param_warning("area smoothing error: couldn't find mapping triangle\n"); - } - } - - p_node_delete(root); - BLI_memarena_free(arena); - - MEM_freeN(triangles); -} - /* Exported */ ParamHandle *GEO_uv_parametrizer_construct_begin(void) @@ -4415,13 +3836,13 @@ void GEO_uv_parametrizer_delete(ParamHandle *phandle) } static void p_add_ngon(ParamHandle *handle, - ParamKey key, - int nverts, - ParamKey *vkeys, - float **co, - float **uv, - ParamBool *pin, - ParamBool *select) + const ParamKey key, + const int nverts, + const ParamKey *vkeys, + const float **co, + float **uv, /* Output will eventually be written to `uv`. */ + const bool *pin, + const bool *select) { /* Allocate memory for polyfill. */ MemArena *arena = handle->polyfill_arena; @@ -4463,11 +3884,11 @@ static void p_add_ngon(ParamHandle *handle, uint v1 = tri[1]; uint v2 = tri[2]; - ParamKey tri_vkeys[3] = {vkeys[v0], vkeys[v1], vkeys[v2]}; - float *tri_co[3] = {co[v0], co[v1], co[v2]}; + const ParamKey tri_vkeys[3] = {vkeys[v0], vkeys[v1], vkeys[v2]}; + const float *tri_co[3] = {co[v0], co[v1], co[v2]}; float *tri_uv[3] = {uv[v0], uv[v1], uv[v2]}; - ParamBool tri_pin[3] = {pin[v0], pin[v1], pin[v2]}; - ParamBool tri_select[3] = {select[v0], select[v1], select[v2]}; + bool tri_pin[3] = {pin[v0], pin[v1], pin[v2]}; + bool tri_select[3] = {select[v0], select[v1], select[v2]}; GEO_uv_parametrizer_face_add(handle, key, 3, tri_vkeys, tri_co, tri_uv, tri_pin, tri_select); } @@ -4476,13 +3897,13 @@ static void p_add_ngon(ParamHandle *handle, } void GEO_uv_parametrizer_face_add(ParamHandle *phandle, - ParamKey key, - int nverts, - ParamKey *vkeys, - float *co[4], - float *uv[4], - ParamBool *pin, - ParamBool *select) + const ParamKey key, + const int nverts, + const ParamKey *vkeys, + const float **co, + float **uv, + const bool *pin, + const bool *select) { param_assert(phash_lookup(phandle->hash_faces, key) == NULL); param_assert(phandle->state == PHANDLE_STATE_ALLOCATED); @@ -4522,8 +3943,8 @@ void GEO_uv_parametrizer_edge_set_seam(ParamHandle *phandle, ParamKey *vkeys) } void GEO_uv_parametrizer_construct_end(ParamHandle *phandle, - ParamBool fill, - ParamBool topology_from_uvs, + bool fill, + bool topology_from_uvs, int *count_fail) { PChart *chart = phandle->construction_chart; @@ -4532,7 +3953,7 @@ void GEO_uv_parametrizer_construct_end(ParamHandle *phandle, param_assert(phandle->state == PHANDLE_STATE_ALLOCATED); - phandle->ncharts = p_connect_pairs(phandle, (PBool)topology_from_uvs); + phandle->ncharts = p_connect_pairs(phandle, topology_from_uvs); phandle->charts = p_split_charts(phandle, chart, phandle->ncharts); p_chart_delete(phandle->construction_chart); @@ -4574,7 +3995,7 @@ void GEO_uv_parametrizer_construct_end(ParamHandle *phandle, phandle->state = PHANDLE_STATE_CONSTRUCTED; } -void GEO_uv_parametrizer_lscm_begin(ParamHandle *phandle, ParamBool live, ParamBool abf) +void GEO_uv_parametrizer_lscm_begin(ParamHandle *phandle, bool live, bool abf) { PFace *f; int i; @@ -4586,7 +4007,7 @@ void GEO_uv_parametrizer_lscm_begin(ParamHandle *phandle, ParamBool live, ParamB for (f = phandle->charts[i]->faces; f; f = f->nextlink) { p_face_backup_uvs(f); } - p_chart_lscm_begin(phandle->charts[i], (PBool)live, (PBool)abf); + p_chart_lscm_begin(phandle->charts[i], live, abf); } } @@ -4601,7 +4022,7 @@ void GEO_uv_parametrizer_lscm_solve(ParamHandle *phandle, int *count_changed, in chart = phandle->charts[i]; if (chart->u.lscm.context) { - const PBool result = p_chart_lscm_solve(phandle, chart); + const bool result = p_chart_lscm_solve(phandle, chart); if (result && !(chart->flag & PCHART_HAS_PINS)) { p_chart_rotate_minimum_area(chart); @@ -4702,24 +4123,6 @@ void GEO_uv_parametrizer_stretch_end(ParamHandle *phandle) phandle->rng = NULL; } -void GEO_uv_parametrizer_smooth_area(ParamHandle *phandle) -{ - int i; - - param_assert(phandle->state == PHANDLE_STATE_CONSTRUCTED); - - for (i = 0; i < phandle->ncharts; i++) { - PChart *chart = phandle->charts[i]; - PVert *v; - - for (v = chart->verts; v; v = v->nextlink) { - v->flag &= ~PVERT_PIN; - } - - p_smooth(chart); - } -} - /* don't pack, just rotate (used for better packing) */ static void GEO_uv_parametrizer_pack_rotate(ParamHandle *phandle, bool ignore_pinned) { diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h index 8b934bcabbe..f803cc2e1af 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h +++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h @@ -443,7 +443,6 @@ typedef struct LineartBoundingArea { ListBase up; ListBase bp; - /* Need uint32 for the atomic cas instruction. */ uint32_t triangle_count; uint32_t max_triangle_count; uint32_t line_count; diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c index b40be609677..9d5cf608c5a 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c @@ -53,8 +53,6 @@ #include "lineart_intern.h" -#include "atomic_ops.h" - typedef struct LineartIsecSingle { float v1[3], v2[3]; LineartTriangle *tri1, *tri2; @@ -124,14 +122,14 @@ static bool lineart_triangle_edge_image_space_occlusion(SpinLock *spl, static void lineart_add_edge_to_array(LineartPendingEdges *pe, LineartEdge *e); -static void lineart_bounding_area_link_triangle_cas(LineartRenderBuffer *rb, - LineartBoundingArea *root_ba, - LineartTriangle *tri, - double *LRUB, - int recursive, - int recursive_level, - bool do_intersection, - struct LineartIsecThread *th); +static void lineart_bounding_area_link_triangle(LineartRenderBuffer *rb, + LineartBoundingArea *root_ba, + LineartTriangle *tri, + double *LRUB, + int recursive, + int recursive_level, + bool do_intersection, + struct LineartIsecThread *th); static void lineart_free_bounding_area_memory(LineartBoundingArea *ba, bool recursive); @@ -352,12 +350,9 @@ BLI_INLINE bool lineart_occlusion_is_adjacent_intersection(LineartEdge *e, Linea static void lineart_bounding_area_triangle_reallocate(LineartBoundingArea *ba) { - LineartTriangle **new_array = MEM_callocN(sizeof(LineartTriangle *) * ba->max_triangle_count * 2, - "new ba_triangle_array"); - memcpy(new_array, ba->linked_triangles, sizeof(LineartTriangle *) * ba->max_triangle_count); ba->max_triangle_count *= 2; - MEM_freeN(ba->linked_triangles); - ba->linked_triangles = new_array; + ba->linked_triangles = MEM_recallocN(ba->linked_triangles, + sizeof(LineartTriangle *) * ba->max_triangle_count); } static void lineart_bounding_area_line_add(LineartBoundingArea *ba, LineartEdge *e) @@ -3215,7 +3210,7 @@ static bool lineart_schedule_new_triangle_task(LineartIsecThread *th) } /* This function initializes two things: - * 1) Triangle array scheduling info, for each worker thread to get it's chunk from the scheduler. + * 1) Triangle array scheduling info, for each worker thread to get its chunk from the scheduler. * 2) Per-thread intersection result array. Does not store actual #LineartEdge, these results will * be finalized by #lineart_create_edges_from_isec_data */ @@ -3258,20 +3253,14 @@ static void lineart_triangle_intersect_in_bounding_area(LineartTriangle *tri, return; } - /* Testing_triangle->testing[0] is used to store pairing triangle reference. - * See definition of LineartTriangleThread for more info. */ - LineartTriangle *testing_triangle; - LineartTriangleThread *tt; - double *G0 = tri->v[0]->gloc, *G1 = tri->v[1]->gloc, *G2 = tri->v[2]->gloc; /* If this _is_ the smallest subdiv bounding area, then do the intersections there. */ for (int i = 0; i < up_to; i++) { - do { - testing_triangle = (LineartTriangle *)atomic_load_z((size_t *)&ba->linked_triangles[i]); - } while (UNLIKELY(testing_triangle == NULL)); - - tt = (LineartTriangleThread *)testing_triangle; + /* Testing_triangle->testing[0] is used to store pairing triangle reference. + * See definition of LineartTriangleThread for more info. */ + LineartTriangle *testing_triangle = ba->linked_triangles[i]; + LineartTriangleThread *tt = (LineartTriangleThread *)testing_triangle; if (testing_triangle == tri || tt->testing_e[th->thread_id] == (LineartEdge *)tri) { continue; @@ -3804,9 +3793,6 @@ static void lineart_bounding_area_split(LineartRenderBuffer *rb, LineartBoundingArea *ba = lineart_mem_acquire_thread(&rb->render_data_pool, sizeof(LineartBoundingArea) * 4); - LineartTriangle *tri; - LineartBoundingArea *ba = root->child; - ba[0].l = root->cx; ba[0].r = root->r; ba[0].u = root->u; @@ -3847,10 +3833,8 @@ static void lineart_bounding_area_split(LineartRenderBuffer *rb, } for (int i = 0; i < root->triangle_count; i++) { - do { - tri = (LineartTriangle *)atomic_load_z((size_t *)&root->linked_triangles[i]); - /* Need to wait for worker threads to fill in the last few triangles. */ - } while (UNLIKELY(tri == NULL)); + LineartTriangle *tri = root->linked_triangles[i]; + double b[4]; b[0] = MIN3(tri->v[0]->fbcoord[0], tri->v[1]->fbcoord[0], tri->v[2]->fbcoord[0]); b[1] = MAX3(tri->v[0]->fbcoord[0], tri->v[1]->fbcoord[0], tri->v[2]->fbcoord[0]); @@ -3860,25 +3844,21 @@ static void lineart_bounding_area_split(LineartRenderBuffer *rb, /* Re-link triangles into child tiles, not doing intersection lines during this because this * batch of triangles are all tested with each other for intersecctions. */ if (LRT_BOUND_AREA_CROSSES(b, &ba[0].l)) { - lineart_bounding_area_link_triangle_cas( - rb, &ba[0], tri, b, 0, recursive_level + 1, false, NULL); + lineart_bounding_area_link_triangle(rb, &ba[0], tri, b, 0, recursive_level + 1, false, NULL); } if (LRT_BOUND_AREA_CROSSES(b, &ba[1].l)) { - lineart_bounding_area_link_triangle_cas( - rb, &ba[1], tri, b, 0, recursive_level + 1, false, NULL); + lineart_bounding_area_link_triangle(rb, &ba[1], tri, b, 0, recursive_level + 1, false, NULL); } if (LRT_BOUND_AREA_CROSSES(b, &ba[2].l)) { - lineart_bounding_area_link_triangle_cas( - rb, &ba[2], tri, b, 0, recursive_level + 1, false, NULL); + lineart_bounding_area_link_triangle(rb, &ba[2], tri, b, 0, recursive_level + 1, false, NULL); } if (LRT_BOUND_AREA_CROSSES(b, &ba[3].l)) { - lineart_bounding_area_link_triangle_cas( - rb, &ba[3], tri, b, 0, recursive_level + 1, false, NULL); + lineart_bounding_area_link_triangle(rb, &ba[3], tri, b, 0, recursive_level + 1, false, NULL); } } /* At this point the child tiles are fully initialized and it's safe for new triangles to be - * inserted, so assign root->child for #lineart_bounding_area_link_triangle_cas to use. */ + * inserted, so assign root->child for #lineart_bounding_area_link_triangle to use. */ root->child = ba; } @@ -3972,14 +3952,14 @@ static bool lineart_bounding_area_triangle_intersect(LineartRenderBuffer *fb, * duplicated intersection lines. * */ -static void lineart_bounding_area_link_triangle_cas(LineartRenderBuffer *rb, - LineartBoundingArea *root_ba, - LineartTriangle *tri, - double *LRUB, - int recursive, - int recursive_level, - bool do_intersection, - struct LineartIsecThread *th) +static void lineart_bounding_area_link_triangle(LineartRenderBuffer *rb, + LineartBoundingArea *root_ba, + LineartTriangle *tri, + double *LRUB, + int recursive, + int recursive_level, + bool do_intersection, + struct LineartIsecThread *th) { if (!lineart_bounding_area_triangle_intersect(rb, tri, root_ba)) { return; @@ -3999,71 +3979,59 @@ static void lineart_bounding_area_link_triangle_cas(LineartRenderBuffer *rb, b[3] = MIN3(tri->v[0]->fbcoord[1], tri->v[1]->fbcoord[1], tri->v[2]->fbcoord[1]); B1 = b; } - /* Continue adding into the child. */ for (int iba = 0; iba < 4; iba++) { if (LRT_BOUND_AREA_CROSSES(B1, &old_ba->child[iba].l)) { - lineart_bounding_area_link_triangle_cas( + lineart_bounding_area_link_triangle( rb, &old_ba->child[iba], tri, B1, recursive, recursive_level + 1, do_intersection, th); } } return; } - while (1) { - uint32_t old_tri_index = old_ba->triangle_count; - uint32_t new_tri_index = old_tri_index + 1; - uint32_t max_triangles = old_ba->max_triangle_count; - - /* If there are still space left in this tile for insertion. */ - if (old_tri_index < max_triangles) { - - /* Use atomic compare and swap to get a index, we can't use atomic increment here because it - * could overflow the index when multiple threads are incrementing. */ - uint32_t success_old_index = atomic_cas_uint32( - &old_ba->triangle_count, old_tri_index, new_tri_index); + /* When splitting tiles, triangles are relinked into new tiles by a single thread, #th is NULL + * in that situation. */ + if (th) { + BLI_spin_lock(&old_ba->lock); + } - if (success_old_index != old_tri_index) { - /* Too bad, other threads grabbed this index, we retry. */ - continue; - } + /* If there are still space left in this tile for insertion. */ + if (old_ba->triangle_count < old_ba->max_triangle_count) { + const uint32_t old_tri_count = old_ba->triangle_count; - /* Successfully grabbed a viable index to insert the triangle into. - * Insert into [old_tri_index] for correct array offset starting from [0]. */ - atomic_store_z((size_t *)&old_ba->linked_triangles[old_tri_index], (size_t)tri); + old_ba->linked_triangles[old_ba->triangle_count++] = tri; - /* Do intersections in place. */ - if (do_intersection && rb->use_intersections) { - lineart_triangle_intersect_in_bounding_area(tri, old_ba, th, old_tri_index); - } - break; + /* Do intersections in place. */ + if (do_intersection && rb->use_intersections) { + lineart_triangle_intersect_in_bounding_area(tri, old_ba, th, old_tri_count); } - else { /* We need to wait for either splitting or array extension to be done. */ - /* Splitting/extending can only be operated by one thread. */ - BLI_spin_lock(&old_ba->lock); - - if (recursive_level < rb->tile_recursive_level) { - if (!old_ba->child) { - /* old_ba->child==NULL, means we are the thread that's doing the splitting. */ - lineart_bounding_area_split(rb, old_ba, recursive_level); - } /* Otherwise other thread has completed the splitting process. */ - } - else { - if (max_triangles == old_ba->max_triangle_count) { - /* Means we are the thread that's doing the extension. */ - lineart_bounding_area_triangle_reallocate(old_ba); - } /* Otherwise other thread has completed the extending the array. */ - } - - /* Job done, allow other threads to add into new tile. */ + if (th) { BLI_spin_unlock(&old_ba->lock); + } + } + else { /* We need to wait for either splitting or array extension to be done. */ - /* Of course we still have our own triangle needs to be added. */ - lineart_bounding_area_link_triangle_cas( - rb, root_ba, tri, LRUB, recursive, recursive_level, do_intersection, th); + if (recursive_level < rb->tile_recursive_level) { + if (!old_ba->child) { + /* old_ba->child==NULL, means we are the thread that's doing the splitting. */ + lineart_bounding_area_split(rb, old_ba, recursive_level); + } /* Otherwise other thread has completed the splitting process. */ + } + else { + if (old_ba->triangle_count == old_ba->max_triangle_count) { + /* Means we are the thread that's doing the extension. */ + lineart_bounding_area_triangle_reallocate(old_ba); + } /* Otherwise other thread has completed the extending the array. */ + } - break; + /* Unlock before going into recursive call. */ + if (th) { + BLI_spin_unlock(&old_ba->lock); } + + /* Of course we still have our own triangle needs to be added. */ + lineart_bounding_area_link_triangle( + rb, root_ba, tri, LRUB, recursive, recursive_level, do_intersection, th); } } @@ -4332,7 +4300,7 @@ static void lineart_add_triangles_worker(TaskPool *__restrict UNUSED(pool), Line _dir_control++; for (co = x1; co <= x2; co++) { for (r = y1; r <= y2; r++) { - lineart_bounding_area_link_triangle_cas( + lineart_bounding_area_link_triangle( rb, &rb->initial_bounding_areas[r * rb->tile_count_x + co], tri, @@ -4450,11 +4418,6 @@ static void lineart_main_add_triangles(LineartRenderBuffer *rb) double t_elapsed = PIL_check_seconds_timer() - t_start; printf("Line art intersection time: %f\n", t_elapsed); } - - if (G.debug_value == 4000) { - double t_elapsed = PIL_check_seconds_timer() - t_start; - printf("Line art intersection time: %f\n", t_elapsed); - } } /** diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h b/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h index 65ba3a003f1..778bb8d0ae5 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h @@ -85,7 +85,7 @@ void lineart_count_and_print_render_buffer_memory(struct LineartRenderBuffer *rb ((b1)[0] < (b2)[1] && (b1)[1] > (b2)[0] && (b1)[3] < (b2)[2] && (b1)[2] > (b2)[3]) /* Initial bounding area row/column count, setting 10 is tested to be realitvely optimal for the - * performance under current CAS algorithm. */ + * performance under current algorithm. */ #define LRT_BA_ROWS 10 #ifdef __cplusplus diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_geometry.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_geometry.glsl index 4c9ff31622f..fed7ac7df66 100644 --- a/source/blender/gpu/shaders/material/gpu_shader_material_geometry.glsl +++ b/source/blender/gpu/shaders/material/gpu_shader_material_geometry.glsl @@ -1,6 +1,6 @@ #pragma BLENDER_REQUIRE(gpu_shader_material_tangent.glsl) -void node_geometry(vec3 orco, +void node_geometry(vec3 orco_attr, out vec3 position, out vec3 normal, out vec3 tangent, @@ -21,8 +21,8 @@ void node_geometry(vec3 orco, tangent = g_data.curve_T; } else { - tangent_orco_z(orco, orco); - node_tangent(orco, tangent); + tangent_orco_z(orco_attr, orco_attr); + node_tangent(orco_attr, tangent); } parametric = vec3(g_data.barycentric_coords, 0.0); diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index a54fd838bbe..db24a775edb 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -161,11 +161,11 @@ typedef struct Sequence { * Frames that use the first frame before data begins, * frames that use the last frame after data ends. */ - int startstill DNA_DEPRECATED, endstill DNA_DEPRECATED; + int startstill, endstill; /** Machine: the strip channel */ int machine; int _pad3; - /** Starting and ending points of the strip in the sequence. */ + /** Starting and ending points of the effect strip. Undefined for other strip types. */ int startdisp, enddisp; float sat; float mul; diff --git a/source/blender/makesrna/RNA_enum_items.h b/source/blender/makesrna/RNA_enum_items.h index 37af598729b..fd264932363 100644 --- a/source/blender/makesrna/RNA_enum_items.h +++ b/source/blender/makesrna/RNA_enum_items.h @@ -147,6 +147,7 @@ DEF_ENUM(rna_enum_keymap_propvalue_items) DEF_ENUM(rna_enum_operator_context_items) DEF_ENUM(rna_enum_wm_report_items) +DEF_ENUM(rna_enum_wm_job_type_items) DEF_ENUM(rna_enum_property_type_items) DEF_ENUM(rna_enum_property_subtype_items) diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 8acc31cd71a..100d90df5d6 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -240,7 +240,7 @@ static int rna_SequenceEditor_sequences_all_lookup_string(PointerRNA *ptr, ID *id = ptr->owner_id; Scene *scene = (Scene *)id; - Sequence *seq = SEQ_sequence_lookup_by_name(scene, key); + Sequence *seq = SEQ_sequence_lookup_seq_by_name(scene, key); if (seq) { RNA_pointer_create(ptr->owner_id, &RNA_Sequence, seq, r_ptr); return true; @@ -289,26 +289,11 @@ static void rna_Sequence_views_format_update(Main *bmain, Scene *scene, PointerR static void do_sequence_frame_change_update(Scene *scene, Sequence *seq) { - Editing *ed = SEQ_editing_get(scene); - ListBase *seqbase = SEQ_get_seqbase_by_seq(&ed->seqbase, seq); - Sequence *tseq; - SEQ_time_update_sequence(scene, seqbase, seq); - - /* ensure effects are always fit in length to their input */ - - /* TODO(sergey): probably could be optimized. - * in terms skipping update of non-changing strips - */ - for (tseq = seqbase->first; tseq; tseq = tseq->next) { - if (tseq->seq1 || tseq->seq2 || tseq->seq3) { - SEQ_time_update_sequence(scene, seqbase, tseq); - } - } + ListBase *seqbase = SEQ_get_seqbase_by_seq(scene, seq); if (SEQ_transform_test_overlap(seqbase, seq)) { - SEQ_transform_seqbase_shuffle(seqbase, seq, scene); /* XXX: BROKEN!, uses context seqbasep. */ + SEQ_transform_seqbase_shuffle(seqbase, seq, scene); } - SEQ_sort(seqbase); if (seq->type == SEQ_TYPE_SOUND_RAM) { DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); @@ -341,8 +326,8 @@ static void rna_Sequence_start_frame_final_set(PointerRNA *ptr, int value) Sequence *seq = (Sequence *)ptr->data; Scene *scene = (Scene *)ptr->owner_id; - SEQ_time_left_handle_frame_set(seq, value); - SEQ_transform_fix_single_image_seq_offsets(seq); + SEQ_time_left_handle_frame_set(scene, seq, value); + SEQ_transform_fix_single_image_seq_offsets(scene, seq); do_sequence_frame_change_update(scene, seq); SEQ_relations_invalidate_cache_composite(scene, seq); } @@ -352,8 +337,8 @@ static void rna_Sequence_end_frame_final_set(PointerRNA *ptr, int value) Sequence *seq = (Sequence *)ptr->data; Scene *scene = (Scene *)ptr->owner_id; - SEQ_time_right_handle_frame_set(seq, value); - SEQ_transform_fix_single_image_seq_offsets(seq); + SEQ_time_right_handle_frame_set(scene, seq, value); + SEQ_transform_fix_single_image_seq_offsets(scene, seq); do_sequence_frame_change_update(scene, seq); SEQ_relations_invalidate_cache_composite(scene, seq); } @@ -437,7 +422,7 @@ static void rna_Sequence_frame_length_set(PointerRNA *ptr, int value) Sequence *seq = (Sequence *)ptr->data; Scene *scene = (Scene *)ptr->owner_id; - SEQ_time_right_handle_frame_set(seq, SEQ_time_left_handle_frame_get(seq) + value); + SEQ_time_right_handle_frame_set(scene, seq, SEQ_time_left_handle_frame_get(seq) + value); do_sequence_frame_change_update(scene, seq); SEQ_relations_invalidate_cache_composite(scene, seq); } @@ -459,18 +444,15 @@ static void rna_Sequence_channel_set(PointerRNA *ptr, int value) { Sequence *seq = (Sequence *)ptr->data; Scene *scene = (Scene *)ptr->owner_id; - Editing *ed = SEQ_editing_get(scene); - ListBase *seqbase = SEQ_get_seqbase_by_seq(&ed->seqbase, seq); + ListBase *seqbase = SEQ_get_seqbase_by_seq(scene, seq); /* check channel increment or decrement */ const int channel_delta = (value >= seq->machine) ? 1 : -1; seq->machine = value; if (SEQ_transform_test_overlap(seqbase, seq)) { - /* XXX: BROKEN!, uses context seqbasep. */ SEQ_transform_seqbase_shuffle_ex(seqbase, seq, scene, channel_delta); } - SEQ_sort(seqbase); SEQ_relations_invalidate_cache_composite(scene, seq); } @@ -722,8 +704,6 @@ static IDProperty **rna_Sequence_idprops(PointerRNA *ptr) static bool rna_MovieSequence_reload_if_needed(ID *scene_id, Sequence *seq, Main *bmain) { Scene *scene = (Scene *)scene_id; - Editing *ed = SEQ_editing_get(scene); - ListBase *seqbase = SEQ_get_seqbase_by_seq(&ed->seqbase, seq); bool has_reloaded; bool can_produce_frames; @@ -731,7 +711,6 @@ static bool rna_MovieSequence_reload_if_needed(ID *scene_id, Sequence *seq, Main SEQ_add_movie_reload_if_needed(bmain, scene, seq, &has_reloaded, &can_produce_frames); if (has_reloaded && can_produce_frames) { - SEQ_time_update_sequence(scene, seqbase, seq); SEQ_relations_invalidate_cache_raw(scene, seq); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); @@ -919,9 +898,6 @@ static void rna_Sequence_filepath_update(Main *bmain, Scene *UNUSED(scene), Poin Scene *scene = (Scene *)ptr->owner_id; Sequence *seq = (Sequence *)(ptr->data); SEQ_add_reload_new_file(bmain, scene, seq, true); - Editing *ed = SEQ_editing_get(scene); - ListBase *seqbase = SEQ_get_seqbase_by_seq(&ed->seqbase, seq); - SEQ_time_update_sequence(scene, seqbase, seq); rna_Sequence_invalidate_raw_update(bmain, scene, ptr); } @@ -1337,8 +1313,7 @@ static void rna_Sequence_separate(ID *id, Sequence *seqm, Main *bmain) Scene *scene = (Scene *)id; /* Find the appropriate seqbase */ - Editing *ed = SEQ_editing_get(scene); - ListBase *seqbase = SEQ_get_seqbase_by_seq(&ed->seqbase, seqm); + ListBase *seqbase = SEQ_get_seqbase_by_seq(scene, seqm); LISTBASE_FOREACH_MUTABLE (Sequence *, seq, &seqm->seqbase) { SEQ_edit_move_strip_to_seqbase(scene, &seqm->seqbase, seq, seqbase); diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index 36bc50e73fb..52de98be502 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -49,20 +49,6 @@ # include "WM_api.h" -static void rna_Sequence_update_rnafunc(ID *id, Sequence *self, bool do_data) -{ - Scene *scene = (Scene *)id; - Editing *ed = SEQ_editing_get(scene); - ListBase *seqbase = SEQ_get_seqbase_by_seq(&ed->seqbase, self); - - if (do_data) { - SEQ_time_update_recursive(scene, self); - // new_tstripdata(self); /* need 2.6x version of this. */ - } - - SEQ_time_update_sequence(scene, seqbase, self); -} - static void rna_Sequence_swap_internal(Sequence *seq_self, ReportList *reports, Sequence *seq_other) @@ -96,8 +82,7 @@ static Sequence *rna_Sequence_split( ID *id, Sequence *seq, Main *bmain, ReportList *reports, int frame, int split_method) { Scene *scene = (Scene *)id; - Editing *ed = SEQ_editing_get(scene); - ListBase *seqbase = SEQ_get_seqbase_by_seq(&ed->seqbase, seq); + ListBase *seqbase = SEQ_get_seqbase_by_seq(scene, seq); const char *error_msg = NULL; Sequence *r_seq = SEQ_edit_strip_split( @@ -576,8 +561,6 @@ static void rna_Sequences_meta_remove( static StripElem *rna_SequenceElements_append(ID *id, Sequence *seq, const char *filename) { Scene *scene = (Scene *)id; - Editing *ed = SEQ_editing_get(scene); - ListBase *seqbase = SEQ_get_seqbase_by_seq(&ed->seqbase, seq); StripElem *se; seq->strip->stripdata = se = MEM_reallocN(seq->strip->stripdata, @@ -586,7 +569,6 @@ static StripElem *rna_SequenceElements_append(ID *id, Sequence *seq, const char BLI_strncpy(se->name, filename, sizeof(se->name)); seq->len++; - SEQ_time_update_sequence(scene, seqbase, seq); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); return se; @@ -595,8 +577,6 @@ static StripElem *rna_SequenceElements_append(ID *id, Sequence *seq, const char static void rna_SequenceElements_pop(ID *id, Sequence *seq, ReportList *reports, int index) { Scene *scene = (Scene *)id; - Editing *ed = SEQ_editing_get(scene); - ListBase *seqbase = SEQ_get_seqbase_by_seq(&ed->seqbase, seq); StripElem *new_seq, *se; if (seq->len == 1) { @@ -629,8 +609,6 @@ static void rna_SequenceElements_pop(ID *id, Sequence *seq, ReportList *reports, MEM_freeN(seq->strip->stripdata); seq->strip->stripdata = new_seq; - SEQ_time_update_sequence(scene, seqbase, seq); - WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); } @@ -669,11 +647,6 @@ void RNA_api_sequence_strip(StructRNA *srna) {0, NULL, 0, NULL, NULL}, }; - func = RNA_def_function(srna, "update", "rna_Sequence_update_rnafunc"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID); - RNA_def_function_ui_description(func, "Update the strip dimensions"); - parm = RNA_def_boolean(func, "data", false, "Data", "Update strip data"); - func = RNA_def_function(srna, "strip_elem_from_frame", "SEQ_render_give_stripelem"); RNA_def_function_ui_description(func, "Return the strip element from a given frame or None"); parm = RNA_def_int(func, diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index 2714b4157fd..e38481a845a 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -15,7 +15,7 @@ #include "BKE_sound.h" /* Enumeration for Audio Channels, compatible with eSoundChannels */ -const EnumPropertyItem rna_enum_audio_channels_items[] = { +static const EnumPropertyItem rna_enum_audio_channels_items[] = { {SOUND_CHANNELS_INVALID, "INVALID", ICON_NONE, "Invalid", "Invalid"}, {SOUND_CHANNELS_MONO, "MONO", ICON_NONE, "Mono", "Mono"}, {SOUND_CHANNELS_STEREO, "STEREO", ICON_NONE, "Stereo", "Stereo"}, diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 1dc2cbe9e69..92be6310716 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -24,6 +24,7 @@ #include "rna_internal.h" +#include "WM_api.h" #include "WM_types.h" #ifdef RNA_RUNTIME @@ -123,6 +124,22 @@ static const EnumPropertyItem event_ndof_type_items[] = { }; #endif /* RNA_RUNTIME */ +/** + * Job types for use in the `bpy.app.is_job_running(job_type)` call. + * + * This is a subset of the `WM_JOB_TYPE_...` anonymous enum defined in `WM_api.h`. It is + * intentionally kept as a subset, such that by default how jobs are handled is kept as an + * "internal implementation detail" of Blender, rather than a public, reliable part of the API. + * + * This array can be expanded on a case-by-case basis, when there is a clear and testable use case. + */ +const EnumPropertyItem rna_enum_wm_job_type_items[] = { + {WM_JOB_TYPE_RENDER, "RENDER", 0, "Regular rendering", ""}, + {WM_JOB_TYPE_RENDER_PREVIEW, "RENDER_PREVIEW", 0, "Rendering previews", ""}, + {WM_JOB_TYPE_OBJECT_BAKE, "OBJECT_BAKE", 0, "Object Baking", ""}, + {0, NULL, 0, NULL, NULL}, +}; + const EnumPropertyItem rna_enum_event_type_items[] = { /* - Note we abuse 'tooltip' message here to store a 'compact' form of some (too) long names. * - Intentionally excluded: #CAPSLOCKKEY, #UNKNOWNKEY. diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 5da65510399..b9f36d35ee8 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -23,6 +23,7 @@ #include "wm_cursors.h" #include "wm_event_types.h" +#include "WM_api.h" #include "WM_types.h" #include "rna_internal.h" /* own include */ diff --git a/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc b/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc index 57f8ee395a9..cde40319388 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc @@ -701,12 +701,12 @@ static void copy_stable_id_edges(const Mesh &mesh, VArray_Span<int> src{src_attribute.varray.typed<int>()}; MutableSpan<int> dst = dst_attribute.as_span<int>(); threading::parallel_for(IndexRange(selection.size()), 1024, [&](IndexRange range) { - for (const int i_edge : range) { - const IndexRange edge_range = range_for_offsets_index(edge_offsets, i_edge); + for (const int i_selection : range) { + const IndexRange edge_range = range_for_offsets_index(edge_offsets, i_selection); if (edge_range.size() == 0) { continue; } - const MEdge &edge = edges[i_edge]; + const MEdge &edge = edges[selection[i_selection]]; const IndexRange vert_range = {edge_range.start() * 2, edge_range.size() * 2}; dst[vert_range[0]] = src[edge.v1]; @@ -750,9 +750,9 @@ static void duplicate_edges(GeometrySet &geometry_set, Array<int> vert_orig_indices(edge_offsets.last() * 2); threading::parallel_for(selection.index_range(), 1024, [&](IndexRange range) { - for (const int i_edge : range) { - const MEdge &edge = edges[i_edge]; - const IndexRange edge_range = range_for_offsets_index(edge_offsets, i_edge); + for (const int i_selection : range) { + const MEdge &edge = edges[selection[i_selection]]; + const IndexRange edge_range = range_for_offsets_index(edge_offsets, i_selection); const IndexRange vert_range(edge_range.start() * 2, edge_range.size() * 2); for (const int i_duplicate : IndexRange(edge_range.size())) { @@ -763,8 +763,8 @@ static void duplicate_edges(GeometrySet &geometry_set, }); threading::parallel_for(selection.index_range(), 1024, [&](IndexRange range) { - for (const int i_edge : range) { - const IndexRange edge_range = range_for_offsets_index(edge_offsets, i_edge); + for (const int i_selection : range) { + const IndexRange edge_range = range_for_offsets_index(edge_offsets, i_selection); const IndexRange vert_range(edge_range.start() * 2, edge_range.size() * 2); for (const int i_duplicate : IndexRange(edge_range.size())) { MEdge &new_edge = new_edges[edge_range[i_duplicate]]; diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 621cc79a8db..939473ceaa0 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -36,15 +36,19 @@ #include "BKE_appdir.h" #include "BKE_blender_version.h" #include "BKE_global.h" +#include "BKE_main.h" #include "DNA_ID.h" #include "UI_interface_icons.h" +#include "RNA_enum_types.h" /* For `rna_enum_wm_job_type_items`. */ + /* for notifiers */ #include "WM_api.h" #include "WM_types.h" +#include "../generic/py_capi_rna.h" #include "../generic/py_capi_utils.h" #include "../generic/python_utildefines.h" @@ -450,6 +454,44 @@ static PyGetSetDef bpy_app_getsets[] = { {NULL, NULL, NULL, NULL, NULL}, }; +PyDoc_STRVAR(bpy_app_is_job_running_doc, + ".. staticmethod:: is_job_running(job_type)\n" + "\n" + " Check whether a job of the given type is running.\n" + "\n" + " :arg job_type: job type in :ref:`rna_enum_wm_job_type_items`.\n" + " :type job_type: str\n" + " :return: Whether a job of the given type is currently running.\n" + " :rtype: bool.\n"); +static PyObject *bpy_app_is_job_running(PyObject *UNUSED(self), PyObject *args, PyObject *kwds) +{ + struct BPy_EnumProperty_Parse job_type_enum = { + .items = rna_enum_wm_job_type_items, + .value = 0, + }; + static const char *_keywords[] = {"job_type", NULL}; + static _PyArg_Parser _parser = { + "O&" /* `job_type` */ + ":is_job_running", + _keywords, + 0, + }; + if (!_PyArg_ParseTupleAndKeywordsFast( + args, kwds, &_parser, pyrna_enum_value_parse_string, &job_type_enum)) { + return NULL; + } + wmWindowManager *wm = G_MAIN->wm.first; + return PyBool_FromLong(WM_jobs_has_running_type(wm, job_type_enum.value)); +} + +static struct PyMethodDef bpy_app_methods[] = { + {"is_job_running", + (PyCFunction)bpy_app_is_job_running, + METH_VARARGS | METH_KEYWORDS | METH_STATIC, + bpy_app_is_job_running_doc}, + {NULL, NULL, 0, NULL}, +}; + static void py_struct_seq_getset_init(void) { /* tricky dynamic members, not to py-spec! */ @@ -459,6 +501,17 @@ static void py_struct_seq_getset_init(void) Py_DECREF(item); } } + +static void py_struct_seq_method_init(void) +{ + for (PyMethodDef *method = bpy_app_methods; method->ml_name; method++) { + BLI_assert_msg(method->ml_flags & METH_STATIC, "Only static methods make sense for 'bpy.app'"); + PyObject *item = PyCFunction_New(method, NULL); + PyDict_SetItemString(BlenderAppType.tp_dict, method->ml_name, item); + Py_DECREF(item); + } +} + /* end dynamic bpy.app */ PyObject *BPY_app_struct(void) @@ -477,6 +530,7 @@ PyObject *BPY_app_struct(void) /* kindof a hack ontop of PyStructSequence */ py_struct_seq_getset_init(); + py_struct_seq_method_init(); return ret; } diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index bf427d9639a..40f4b8af1cc 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -67,6 +67,10 @@ static PyStructSequence_Field app_cb_info_fields[] = { {"annotation_pre", "on drawing an annotation (before)"}, {"annotation_post", "on drawing an annotation (after)"}, + {"object_bake_pre", "before starting a bake job"}, + {"object_bake_complete", "on completing a bake job; will be called in the main thread"}, + {"object_bake_cancel", "on canceling a bake job; will be called in the main thread"}, + /* sets the permanent tag */ #define APP_CB_OTHER_FIELDS 1 {"persistent", diff --git a/source/blender/python/rna_dump.py b/source/blender/python/rna_dump.py index 61df784336c..b4e23547c62 100644 --- a/source/blender/python/rna_dump.py +++ b/source/blender/python/rna_dump.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - if 1: # Print once every 1000 GEN_PATH = True diff --git a/source/blender/sequencer/SEQ_add.h b/source/blender/sequencer/SEQ_add.h index c195165a792..dea5151598c 100644 --- a/source/blender/sequencer/SEQ_add.h +++ b/source/blender/sequencer/SEQ_add.h @@ -183,9 +183,6 @@ void SEQ_add_image_load_file(struct Sequence *seq, size_t strip_frame, char *fil * \param seq: image strip to be changed */ void SEQ_add_image_init_alpha_mode(struct Sequence *seq); -/** - * \note caller should run `SEQ_time_update_sequence(scene, seq)` after.. - */ void SEQ_add_reload_new_file(struct Main *bmain, struct Scene *scene, struct Sequence *seq, diff --git a/source/blender/sequencer/SEQ_iterator.h b/source/blender/sequencer/SEQ_iterator.h index 8cb20d41ba2..1f94574513c 100644 --- a/source/blender/sequencer/SEQ_iterator.h +++ b/source/blender/sequencer/SEQ_iterator.h @@ -131,6 +131,9 @@ bool SEQ_collection_remove_strip(struct Sequence *seq, SeqCollection *collection * \param collection: collection to be freed */ void SEQ_collection_free(SeqCollection *collection); +/** Quiet compiler warning for free function. */ +#define SEQ_collection_free_void_p ((GHashValFreeFP)SEQ_collection_free) + /** * Move strips from collection_src to collection_dst. Source collection will be freed. * diff --git a/source/blender/sequencer/SEQ_sequencer.h b/source/blender/sequencer/SEQ_sequencer.h index 8ded6d99a8d..70cba58007f 100644 --- a/source/blender/sequencer/SEQ_sequencer.h +++ b/source/blender/sequencer/SEQ_sequencer.h @@ -143,7 +143,8 @@ typedef enum eSequenceLookupTag { * * \return pointer to Sequence */ -struct Sequence *SEQ_sequence_lookup_by_name(const struct Scene *scene, const char *key); +struct Sequence *SEQ_sequence_lookup_seq_by_name(const struct Scene *scene, const char *key); + /** * Free lookup hash data. * diff --git a/source/blender/sequencer/SEQ_time.h b/source/blender/sequencer/SEQ_time.h index 1da6efb1d04..eab10f2e852 100644 --- a/source/blender/sequencer/SEQ_time.h +++ b/source/blender/sequencer/SEQ_time.h @@ -47,8 +47,6 @@ int SEQ_time_find_next_prev_edit(struct Scene *scene, bool do_skip_mute, bool do_center, bool do_unselected); -void SEQ_time_update_sequence(struct Scene *scene, struct ListBase *seqbase, struct Sequence *seq); -void SEQ_time_update_recursive(struct Scene *scene, struct Sequence *changed_seq); /** * Test if strip intersects with timeline frame. * \note This checks if strip would be rendered at this frame. For rendering it is assumed, that @@ -59,14 +57,15 @@ void SEQ_time_update_recursive(struct Scene *scene, struct Sequence *changed_seq * \return true if strip intersects with timeline frame. */ bool SEQ_time_strip_intersects_frame(const struct Sequence *seq, int timeline_frame); -void SEQ_time_update_meta_strip_range(struct Scene *scene, struct Sequence *seq_meta); bool SEQ_time_has_still_frames(const struct Sequence *seq); bool SEQ_time_has_left_still_frames(const struct Sequence *seq); bool SEQ_time_has_right_still_frames(const struct Sequence *seq); -int SEQ_time_left_handle_frame_get(struct Sequence *seq); -int SEQ_time_right_handle_frame_get(struct Sequence *seq); -void SEQ_time_left_handle_frame_set(struct Sequence *seq, int val); -void SEQ_time_right_handle_frame_set(struct Sequence *seq, int val); + +int SEQ_time_left_handle_frame_get(const struct Sequence *seq); +int SEQ_time_right_handle_frame_get(const struct Sequence *seq); +void SEQ_time_left_handle_frame_set(const struct Scene *scene, struct Sequence *seq, int val); +void SEQ_time_right_handle_frame_set(const struct Scene *scene, struct Sequence *seq, int val); +void SEQ_time_update_meta_strip_range(const struct Scene *scene, struct Sequence *seq_meta); #ifdef __cplusplus } diff --git a/source/blender/sequencer/SEQ_transform.h b/source/blender/sequencer/SEQ_transform.h index bd4258bfdb1..93ce6873d3b 100644 --- a/source/blender/sequencer/SEQ_transform.h +++ b/source/blender/sequencer/SEQ_transform.h @@ -21,14 +21,17 @@ struct Sequence; * Use to impose limits when dragging/extending - so impossible situations don't happen. * Can't use the #SEQ_LEFTSEL and #SEQ_LEFTSEL directly because the strip may be in a meta-strip. */ -void SEQ_transform_handle_xlimits(struct Sequence *seq, int leftflag, int rightflag); +void SEQ_transform_handle_xlimits(const struct Scene *scene, + struct Sequence *seq, + int leftflag, + int rightflag); bool SEQ_transform_sequence_can_be_translated(struct Sequence *seq); /** * Used so we can do a quick check for single image seq * since they work a bit differently to normal image seq's (during transform). */ bool SEQ_transform_single_image_check(struct Sequence *seq); -void SEQ_transform_fix_single_image_seq_offsets(struct Sequence *seq); +void SEQ_transform_fix_single_image_seq_offsets(const struct Scene *scene, struct Sequence *seq); bool SEQ_transform_test_overlap(struct ListBase *seqbasep, struct Sequence *test); bool SEQ_transform_test_overlap_seq_seq(struct Sequence *seq1, struct Sequence *seq2); void SEQ_transform_translate_sequence(struct Scene *scene, struct Sequence *seq, int delta); diff --git a/source/blender/sequencer/SEQ_utils.h b/source/blender/sequencer/SEQ_utils.h index ce3c81606ea..24ca7559166 100644 --- a/source/blender/sequencer/SEQ_utils.h +++ b/source/blender/sequencer/SEQ_utils.h @@ -20,14 +20,6 @@ struct SeqRenderData; struct Sequence; struct StripElem; -/** - * Sort strips in provided seqbase. Effect strips are trailing the list and they are sorted by - * channel position as well. - * This is important for SEQ_time_update_sequence to work properly - * - * \param seqbase: ListBase with strips - */ -void SEQ_sort(struct ListBase *seqbase); void SEQ_sequence_base_unique_name_recursive(struct Scene *scene, struct ListBase *seqbasep, struct Sequence *seq); @@ -39,7 +31,7 @@ const struct Sequence *SEQ_get_topmost_sequence(const struct Scene *scene, int f /** * In cases where we don't know the sequence's listbase. */ -struct ListBase *SEQ_get_seqbase_by_seq(struct ListBase *seqbase, struct Sequence *seq); +struct ListBase *SEQ_get_seqbase_by_seq(const struct Scene *scene, struct Sequence *seq); /** * Only use as last resort when the StripElem is available but no the Sequence. * (needed for RNA) diff --git a/source/blender/sequencer/intern/disk_cache.c b/source/blender/sequencer/intern/disk_cache.c index f8e8fc32a5d..cc34066c432 100644 --- a/source/blender/sequencer/intern/disk_cache.c +++ b/source/blender/sequencer/intern/disk_cache.c @@ -37,6 +37,7 @@ #include "SEQ_relations.h" #include "SEQ_render.h" #include "SEQ_sequencer.h" +#include "SEQ_time.h" #include "disk_cache.h" #include "image_cache.h" @@ -411,8 +412,8 @@ void seq_disk_cache_invalidate(SeqDiskCache *disk_cache, BLI_mutex_lock(&disk_cache->read_write_mutex); - start = seq_changed->startdisp - DCACHE_IMAGES_PER_FILE; - end = seq_changed->enddisp; + start = SEQ_time_left_handle_frame_get(seq_changed) - DCACHE_IMAGES_PER_FILE; + end = SEQ_time_right_handle_frame_get(seq_changed); seq_disk_cache_delete_invalid_files(disk_cache, scene, seq, invalidate_types, start, end); diff --git a/source/blender/sequencer/intern/effects.c b/source/blender/sequencer/intern/effects.c index d9d21ee3b05..0e5e56908b0 100644 --- a/source/blender/sequencer/intern/effects.c +++ b/source/blender/sequencer/intern/effects.c @@ -49,6 +49,7 @@ #include "SEQ_proxy.h" #include "SEQ_relations.h" #include "SEQ_render.h" +#include "SEQ_time.h" #include "SEQ_utils.h" #include "BLF_api.h" @@ -2431,7 +2432,7 @@ static ImBuf *do_multicam(const SeqRenderData *context, if (!ed) { return NULL; } - ListBase *seqbasep = SEQ_get_seqbase_by_seq(&ed->seqbase, seq); + ListBase *seqbasep = SEQ_get_seqbase_by_seq(context->scene, seq); ListBase *channels = SEQ_get_channels_by_seq(&ed->seqbase, &ed->channels, seq); if (!seqbasep) { return NULL; @@ -2467,13 +2468,15 @@ static ImBuf *do_adjustment_impl(const SeqRenderData *context, Sequence *seq, fl ed = context->scene->ed; - ListBase *seqbasep = SEQ_get_seqbase_by_seq(&ed->seqbase, seq); + ListBase *seqbasep = SEQ_get_seqbase_by_seq(context->scene, seq); ListBase *channels = SEQ_get_channels_by_seq(&ed->seqbase, &ed->channels, seq); /* Clamp timeline_frame to strip range so it behaves as if it had "still frame" offset (last * frame is static after end of strip). This is how most strips behave. This way transition * effects that doesn't overlap or speed effect can't fail rendering outside of strip range. */ - timeline_frame = clamp_i(timeline_frame, seq->startdisp, seq->enddisp - 1); + timeline_frame = clamp_i(timeline_frame, + SEQ_time_left_handle_frame_get(seq), + SEQ_time_right_handle_frame_get(seq) - 1); if (seq->machine > 1) { i = seq_render_give_ibuf_seqbase( @@ -2583,7 +2586,7 @@ static int early_out_speed(Sequence *UNUSED(seq), float UNUSED(fac)) static int seq_effect_speed_get_strip_content_length(const Sequence *seq) { if ((seq->type & SEQ_TYPE_EFFECT) != 0 && SEQ_effect_get_num_inputs(seq->type) == 0) { - return seq->enddisp - seq->startdisp; + return SEQ_time_right_handle_frame_get(seq) - SEQ_time_left_handle_frame_get(seq); } return seq->len; @@ -2610,13 +2613,14 @@ void seq_effect_speed_rebuild_map(Scene *scene, Sequence *seq) MEM_freeN(v->frameMap); } - const int effect_strip_length = seq->enddisp - seq->startdisp; + const int effect_strip_length = SEQ_time_right_handle_frame_get(seq) - + SEQ_time_left_handle_frame_get(seq); v->frameMap = MEM_mallocN(sizeof(float) * effect_strip_length, __func__); v->frameMap[0] = 0.0f; float target_frame = 0; for (int frame_index = 1; frame_index < effect_strip_length; frame_index++) { - target_frame += evaluate_fcurve(fcu, seq->startdisp + frame_index); + target_frame += evaluate_fcurve(fcu, SEQ_time_left_handle_frame_get(seq) + frame_index); CLAMP(target_frame, 0, seq->seq1->len); v->frameMap[frame_index] = target_frame; } @@ -2652,7 +2656,8 @@ float seq_speed_effect_target_frame_get(Scene *scene, /* Only right handle controls effect speed! */ const float target_content_length = seq_effect_speed_get_strip_content_length(source) - source->startofs; - const float speed_effetct_length = seq_speed->enddisp - seq_speed->startdisp; + const float speed_effetct_length = SEQ_time_right_handle_frame_get(seq_speed) - + SEQ_time_left_handle_frame_get(seq_speed); const float ratio = frame_index / speed_effetct_length; target_frame = target_content_length * ratio; break; @@ -3509,7 +3514,7 @@ static void get_default_fac_noop(Sequence *UNUSED(seq), float UNUSED(timeline_fr static void get_default_fac_fade(Sequence *seq, float timeline_frame, float *fac) { - *fac = (float)(timeline_frame - seq->startdisp); + *fac = (float)(timeline_frame - SEQ_time_left_handle_frame_get(seq)); *fac /= seq->len; } diff --git a/source/blender/sequencer/intern/image_cache.c b/source/blender/sequencer/intern/image_cache.c index e1ff0ff64b3..59de24930d6 100644 --- a/source/blender/sequencer/intern/image_cache.c +++ b/source/blender/sequencer/intern/image_cache.c @@ -36,6 +36,7 @@ #include "SEQ_prefetch.h" #include "SEQ_relations.h" #include "SEQ_sequencer.h" +#include "SEQ_time.h" #include "disk_cache.h" #include "image_cache.h" @@ -558,8 +559,9 @@ void seq_cache_free_temp_cache(Scene *scene, short id, int timeline_frame) /* Use frame_index here to avoid freeing raw images if they are used for multiple frames. */ float frame_index = seq_cache_timeline_frame_to_frame_index( key->seq, timeline_frame, key->type); - if (frame_index != key->frame_index || timeline_frame > key->seq->enddisp || - timeline_frame < key->seq->startdisp) { + if (frame_index != key->frame_index || + timeline_frame > SEQ_time_right_handle_frame_get(key->seq) || + timeline_frame < SEQ_time_left_handle_frame_get(key->seq)) { BLI_ghash_remove(cache->hash, key, seq_cache_keyfree, seq_cache_valfree); } } @@ -634,8 +636,8 @@ void seq_cache_cleanup_sequence(Scene *scene, seq_cache_lock(scene); - int range_start = seq_changed->startdisp; - int range_end = seq_changed->enddisp; + int range_start = SEQ_time_left_handle_frame_get(seq_changed); + int range_end = SEQ_time_right_handle_frame_get(seq_changed); if (!force_seq_changed_range) { if (seq->startdisp > range_start) { @@ -668,8 +670,8 @@ void seq_cache_cleanup_sequence(Scene *scene, } if (key->type & invalidate_source && key->seq == seq && - key->timeline_frame >= seq_changed->startdisp && - key->timeline_frame <= seq_changed->enddisp) { + key->timeline_frame >= SEQ_time_left_handle_frame_get(seq_changed) && + key->timeline_frame <= SEQ_time_right_handle_frame_get(seq_changed)) { if (key->link_next || key->link_prev) { seq_cache_relink_keys(key->link_next, key->link_prev); } @@ -700,11 +702,12 @@ void seq_cache_thumbnail_cleanup(Scene *scene, rctf *view_area_safe) SeqCacheKey *key = BLI_ghashIterator_getKey(&gh_iter); BLI_ghashIterator_step(&gh_iter); - const int frame_index = key->timeline_frame - key->seq->startdisp; + const int frame_index = key->timeline_frame - SEQ_time_left_handle_frame_get(key->seq); const int frame_step = SEQ_render_thumbnails_guaranteed_set_frame_step_get(key->seq); const int relative_base_frame = round_fl_to_int((frame_index / (float)frame_step)) * frame_step; - const int nearest_guaranted_absolute_frame = relative_base_frame + key->seq->startdisp; + const int nearest_guaranted_absolute_frame = relative_base_frame + + SEQ_time_left_handle_frame_get(key->seq); if (nearest_guaranted_absolute_frame == key->timeline_frame) { continue; diff --git a/source/blender/sequencer/intern/proxy.c b/source/blender/sequencer/intern/proxy.c index 59b4c6de1ef..464580f5bed 100644 --- a/source/blender/sequencer/intern/proxy.c +++ b/source/blender/sequencer/intern/proxy.c @@ -43,6 +43,7 @@ #include "SEQ_relations.h" #include "SEQ_render.h" #include "SEQ_sequencer.h" +#include "SEQ_time.h" #include "multiview.h" #include "proxy.h" @@ -523,7 +524,9 @@ void SEQ_proxy_rebuild(SeqIndexBuildContext *context, SeqRenderState state; seq_render_state_init(&state); - for (timeline_frame = seq->startdisp; timeline_frame < seq->enddisp; timeline_frame++) { + for (timeline_frame = SEQ_time_left_handle_frame_get(seq); + timeline_frame < SEQ_time_right_handle_frame_get(seq); + timeline_frame++) { if (context->size_flags & IMB_PROXY_25) { seq_proxy_build_frame(&render_context, &state, seq, timeline_frame, 25, overwrite); } @@ -537,7 +540,8 @@ void SEQ_proxy_rebuild(SeqIndexBuildContext *context, seq_proxy_build_frame(&render_context, &state, seq, timeline_frame, 100, overwrite); } - *progress = (float)(timeline_frame - seq->startdisp) / (seq->enddisp - seq->startdisp); + *progress = (float)(timeline_frame - SEQ_time_left_handle_frame_get(seq)) / + (SEQ_time_right_handle_frame_get(seq) - SEQ_time_left_handle_frame_get(seq)); *do_update = true; if (*stop || G.is_break) { diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c index b0898be3765..e7a1bbeb9d0 100644 --- a/source/blender/sequencer/intern/render.c +++ b/source/blender/sequencer/intern/render.c @@ -1994,11 +1994,12 @@ ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData *context, float SEQ_render_thumbnail_first_frame_get(Sequence *seq, float frame_step, rctf *view_area) { - int first_drawable_frame = max_iii(seq->startdisp, seq->start, view_area->xmin); + int first_drawable_frame = max_iii( + SEQ_time_left_handle_frame_get(seq), seq->start, view_area->xmin); /* First frame should correspond to handle position. */ - if (first_drawable_frame == seq->startdisp) { - return seq->startdisp; + if (first_drawable_frame == SEQ_time_left_handle_frame_get(seq)) { + return SEQ_time_left_handle_frame_get(seq); } float aligned_frame_offset = (int)((first_drawable_frame - seq->start) / frame_step) * @@ -2011,7 +2012,7 @@ float SEQ_render_thumbnail_next_frame_get(Sequence *seq, float last_frame, float float next_frame = last_frame + frame_step; /* If handle position was displayed, align next frame with `seq->start`. */ - if (last_frame == seq->startdisp) { + if (last_frame == SEQ_time_left_handle_frame_get(seq)) { next_frame = seq->start + ((int)((last_frame - seq->start) / frame_step) + 1) * frame_step; } @@ -2088,8 +2089,9 @@ void SEQ_render_thumbnails(const SeqRenderData *context, /* Adding the hold offset value (seq->anim_startofs) to the start frame. Position of image not * affected, but frame loaded affected. */ - float upper_thumb_bound = SEQ_time_has_right_still_frames(seq) ? (seq->start + seq->len) : - seq->enddisp; + float upper_thumb_bound = SEQ_time_has_right_still_frames(seq) ? + (seq->start + seq->len) : + SEQ_time_right_handle_frame_get(seq); upper_thumb_bound = (upper_thumb_bound > view_area->xmax) ? view_area->xmax + frame_step : upper_thumb_bound; @@ -2122,8 +2124,8 @@ void SEQ_render_thumbnails(const SeqRenderData *context, int SEQ_render_thumbnails_guaranteed_set_frame_step_get(const Sequence *seq) { - const int content_start = max_ii(seq->startdisp, seq->start); - const int content_end = min_ii(seq->enddisp, seq->start + seq->len); + const int content_start = max_ii(SEQ_time_left_handle_frame_get(seq), seq->start); + const int content_end = min_ii(SEQ_time_right_handle_frame_get(seq), seq->start + seq->len); const int content_len = content_end - content_start; /* Arbitrary, but due to performance reasons should be as low as possible. */ @@ -2143,10 +2145,10 @@ void SEQ_render_thumbnails_base_set(const SeqRenderData *context, SeqRenderState state; seq_render_state_init(&state); - int timeline_frame = seq->startdisp; + int timeline_frame = SEQ_time_left_handle_frame_get(seq); const int frame_step = SEQ_render_thumbnails_guaranteed_set_frame_step_get(seq); - while (timeline_frame < seq->enddisp && !*stop) { + while (timeline_frame < SEQ_time_right_handle_frame_get(seq) && !*stop) { ImBuf *ibuf = seq_cache_get( context, seq_orig, roundf(timeline_frame), SEQ_CACHE_STORE_THUMBNAIL); if (ibuf) { diff --git a/source/blender/sequencer/intern/sequence_lookup.c b/source/blender/sequencer/intern/sequence_lookup.c index 2a2626d8abf..8d18e381171 100644 --- a/source/blender/sequencer/intern/sequence_lookup.c +++ b/source/blender/sequencer/intern/sequence_lookup.c @@ -6,6 +6,7 @@ */ #include "SEQ_sequencer.h" +#include "sequencer.h" #include "DNA_listBase.h" #include "DNA_scene_types.h" @@ -14,6 +15,7 @@ #include "SEQ_iterator.h" #include "BLI_ghash.h" +#include "BLI_listbase.h" #include "BLI_string.h" #include "BLI_sys_types.h" #include "BLI_threads.h" @@ -24,24 +26,66 @@ static ThreadMutex lookup_lock = BLI_MUTEX_INITIALIZER; typedef struct SequenceLookup { - GHash *by_name; + GHash *seq_by_name; + GHash *meta_by_seq; + GHash *effects_by_seq; eSequenceLookupTag tag; } SequenceLookup; static void seq_sequence_lookup_init(struct SequenceLookup *lookup) { - lookup->by_name = BLI_ghash_str_new(__func__); + lookup->seq_by_name = BLI_ghash_str_new(__func__); + lookup->meta_by_seq = BLI_ghash_ptr_new(__func__); + lookup->effects_by_seq = BLI_ghash_ptr_new(__func__); lookup->tag |= SEQ_LOOKUP_TAG_INVALID; } -static void seq_sequence_lookup_build(const struct Scene *scene, struct SequenceLookup *lookup) +static void seq_sequence_lookup_append_effect(Sequence *input, + Sequence *effect, + struct SequenceLookup *lookup) +{ + if (input == NULL) { + return; + } + + SeqCollection *effects = BLI_ghash_lookup(lookup->effects_by_seq, input); + if (effects == NULL) { + effects = SEQ_collection_create(__func__); + BLI_ghash_insert(lookup->effects_by_seq, input, effects); + } + + SEQ_collection_append_strip(effect, effects); +} + +static void seq_sequence_lookup_build_effect(Sequence *seq, struct SequenceLookup *lookup) { - SeqCollection *all_strips = SEQ_query_all_strips_recursive(&scene->ed->seqbase); - Sequence *seq; - SEQ_ITERATOR_FOREACH (seq, all_strips) { - BLI_ghash_insert(lookup->by_name, seq->name + 2, seq); + if ((seq->type & SEQ_TYPE_EFFECT) == 0) { + return; } - SEQ_collection_free(all_strips); + + seq_sequence_lookup_append_effect(seq->seq1, seq, lookup); + seq_sequence_lookup_append_effect(seq->seq2, seq, lookup); +} + +static void seq_sequence_lookup_build_from_seqbase(Sequence *parent_meta, + const ListBase *seqbase, + struct SequenceLookup *lookup) +{ + LISTBASE_FOREACH (Sequence *, seq, seqbase) { + BLI_ghash_insert(lookup->seq_by_name, seq->name + 2, seq); + BLI_ghash_insert(lookup->meta_by_seq, seq, parent_meta); + seq_sequence_lookup_build_effect(seq, lookup); + + if (seq->type == SEQ_TYPE_META) { + seq_sequence_lookup_build_from_seqbase(seq, &seq->seqbase, lookup); + } + } +} + +static void seq_sequence_lookup_build(const struct Scene *scene, struct SequenceLookup *lookup) +{ + Editing *ed = SEQ_editing_get(scene); + seq_sequence_lookup_build_from_seqbase(NULL, &ed->seqbase, lookup); lookup->tag &= ~SEQ_LOOKUP_TAG_INVALID; } @@ -58,8 +102,12 @@ static void seq_sequence_lookup_free(struct SequenceLookup **lookup) return; } - BLI_ghash_free((*lookup)->by_name, NULL, NULL); - (*lookup)->by_name = NULL; + BLI_ghash_free((*lookup)->seq_by_name, NULL, NULL); + BLI_ghash_free((*lookup)->meta_by_seq, NULL, NULL); + BLI_ghash_free((*lookup)->effects_by_seq, NULL, SEQ_collection_free_void_p); + (*lookup)->seq_by_name = NULL; + (*lookup)->meta_by_seq = NULL; + (*lookup)->effects_by_seq = NULL; MEM_freeN(*lookup); *lookup = NULL; } @@ -98,17 +146,39 @@ void SEQ_sequence_lookup_free(const Scene *scene) BLI_mutex_unlock(&lookup_lock); } -Sequence *SEQ_sequence_lookup_by_name(const Scene *scene, const char *key) +Sequence *SEQ_sequence_lookup_seq_by_name(const Scene *scene, const char *key) +{ + BLI_assert(scene->ed); + BLI_mutex_lock(&lookup_lock); + seq_sequence_lookup_update_if_needed(scene, &scene->ed->runtime.sequence_lookup); + SequenceLookup *lookup = scene->ed->runtime.sequence_lookup; + Sequence *seq = BLI_ghash_lookup(lookup->seq_by_name, key); + BLI_mutex_unlock(&lookup_lock); + return seq; +} + +Sequence *seq_sequence_lookup_meta_by_seq(const Scene *scene, const Sequence *key) { BLI_assert(scene->ed); BLI_mutex_lock(&lookup_lock); seq_sequence_lookup_update_if_needed(scene, &scene->ed->runtime.sequence_lookup); SequenceLookup *lookup = scene->ed->runtime.sequence_lookup; - Sequence *seq = BLI_ghash_lookup(lookup->by_name, key); + Sequence *seq = BLI_ghash_lookup(lookup->meta_by_seq, key); BLI_mutex_unlock(&lookup_lock); return seq; } +SeqCollection *seq_sequence_lookup_effects_by_seq(const Scene *scene, const Sequence *key) +{ + BLI_assert(scene->ed); + BLI_mutex_lock(&lookup_lock); + seq_sequence_lookup_update_if_needed(scene, &scene->ed->runtime.sequence_lookup); + SequenceLookup *lookup = scene->ed->runtime.sequence_lookup; + SeqCollection *effects = BLI_ghash_lookup(lookup->effects_by_seq, key); + BLI_mutex_unlock(&lookup_lock); + return effects; +} + void SEQ_sequence_lookup_tag(const Scene *scene, eSequenceLookupTag tag) { if (!scene->ed) { diff --git a/source/blender/sequencer/intern/sequencer.h b/source/blender/sequencer/intern/sequencer.h index 9f5bdf672c0..5e78c8c6f96 100644 --- a/source/blender/sequencer/intern/sequencer.h +++ b/source/blender/sequencer/intern/sequencer.h @@ -14,13 +14,37 @@ extern "C" { struct Scene; struct Sequence; struct StripProxy; +struct SeqCollection; /** * Cache must be freed before calling this function * since it leaves the seqbase in an invalid state. */ void seq_free_sequence_recurse(struct Scene *scene, struct Sequence *seq, bool do_id_user); struct StripProxy *seq_strip_proxy_alloc(void); - +/** + * Find meta strip, that contains strip `key`. + * If lookup hash doesn't exist, it will be created. If hash is tagged as invalid, it will be + * rebuilt. + * + * \param scene: scene that owns lookup hash + * \param key: pointer to Sequence inside of meta strip + * + * \return pointer to meta strip + */ +struct Sequence *seq_sequence_lookup_meta_by_seq(const struct Scene *scene, + const struct Sequence *key); +/** + * Find effect strips, that use strip `seq` as one of inputs. + * If lookup hash doesn't exist, it will be created. If hash is tagged as invalid, it will be + * rebuilt. + * + * \param scene: scene that owns lookup hash + * \param key: pointer to Sequence inside of meta strip + * + * \return collection of effect strips + */ +struct SeqCollection *seq_sequence_lookup_effects_by_seq(const struct Scene *scene, + const struct Sequence *key); #ifdef __cplusplus } #endif diff --git a/source/blender/sequencer/intern/sound.c b/source/blender/sequencer/intern/sound.c index 8076c600560..50c8b76a9a0 100644 --- a/source/blender/sequencer/intern/sound.c +++ b/source/blender/sequencer/intern/sound.c @@ -35,7 +35,6 @@ static bool sequencer_refresh_sound_length_recursive(Main *bmain, Scene *scene, for (seq = seqbase->first; seq; seq = seq->next) { if (seq->type == SEQ_TYPE_META) { if (sequencer_refresh_sound_length_recursive(bmain, scene, &seq->seqbase)) { - SEQ_time_update_sequence(scene, seqbase, seq); changed = true; } } @@ -55,7 +54,6 @@ static bool sequencer_refresh_sound_length_recursive(Main *bmain, Scene *scene, seq->endofs *= fac; seq->start += (old - seq->startofs); /* So that visual/"real" start frame does not change! */ - SEQ_time_update_sequence(scene, seqbase, seq); changed = true; } } @@ -99,8 +97,12 @@ void SEQ_sound_update_bounds(Scene *scene, Sequence *seq) /* We have to take into account start frame of the sequence's scene! */ int startofs = seq->startofs + seq->anim_startofs + seq->scene->r.sfra; - BKE_sound_move_scene_sound( - scene, seq->scene_sound, seq->startdisp, seq->enddisp, startofs, 0.0); + BKE_sound_move_scene_sound(scene, + seq->scene_sound, + SEQ_time_left_handle_frame_get(seq), + SEQ_time_right_handle_frame_get(seq), + startofs, + 0.0); } } else { diff --git a/source/blender/sequencer/intern/strip_add.c b/source/blender/sequencer/intern/strip_add.c index 77b0fc946d9..4f0b2e38f56 100644 --- a/source/blender/sequencer/intern/strip_add.c +++ b/source/blender/sequencer/intern/strip_add.c @@ -51,6 +51,8 @@ #include "multiview.h" #include "proxy.h" +#include "sequencer.h" +#include "strip_time.h" #include "utils.h" void SEQ_add_load_data_init(SeqLoadData *load_data, @@ -70,12 +72,12 @@ void SEQ_add_load_data_init(SeqLoadData *load_data, load_data->channel = channel; } -static void seq_add_generic_update(Scene *scene, ListBase *seqbase, Sequence *seq) +static void seq_add_generic_update(Scene *scene, Sequence *seq) { SEQ_sequence_base_unique_name_recursive(scene, &scene->ed->seqbase, seq); - SEQ_time_update_sequence(scene, seqbase, seq); - SEQ_sort(seqbase); SEQ_relations_invalidate_cache_composite(scene, seq); + SEQ_sequence_lookup_tag(scene, SEQ_LOOKUP_TAG_INVALID); + SEQ_time_update_meta_strip_range(scene, seq_sequence_lookup_meta_by_seq(scene, seq)); } static void seq_add_set_name(Scene *scene, Sequence *seq, SeqLoadData *load_data) @@ -128,7 +130,7 @@ Sequence *SEQ_add_scene_strip(Scene *scene, ListBase *seqbase, struct SeqLoadDat seq->len = load_data->scene->r.efra - load_data->scene->r.sfra + 1; id_us_ensure_real((ID *)load_data->scene); seq_add_set_name(scene, seq, load_data); - seq_add_generic_update(scene, seqbase, seq); + seq_add_generic_update(scene, seq); return seq; } @@ -140,7 +142,7 @@ Sequence *SEQ_add_movieclip_strip(Scene *scene, ListBase *seqbase, struct SeqLoa seq->len = BKE_movieclip_get_duration(load_data->clip); id_us_ensure_real((ID *)load_data->clip); seq_add_set_name(scene, seq, load_data); - seq_add_generic_update(scene, seqbase, seq); + seq_add_generic_update(scene, seq); return seq; } @@ -152,7 +154,7 @@ Sequence *SEQ_add_mask_strip(Scene *scene, ListBase *seqbase, struct SeqLoadData seq->len = BKE_mask_get_duration(load_data->mask); id_us_ensure_real((ID *)load_data->mask); seq_add_set_name(scene, seq, load_data); - seq_add_generic_update(scene, seqbase, seq); + seq_add_generic_update(scene, seq); return seq; } @@ -174,11 +176,12 @@ Sequence *SEQ_add_effect_strip(Scene *scene, ListBase *seqbase, struct SeqLoadDa if (!load_data->effect.seq1) { seq->len = 1; /* Effect is generator, set non zero length. */ - SEQ_time_right_handle_frame_set(seq, load_data->effect.end_frame); + SEQ_time_right_handle_frame_set(scene, seq, load_data->effect.end_frame); } seq_add_set_name(scene, seq, load_data); - seq_add_generic_update(scene, seqbase, seq); + seq_add_generic_update(scene, seq); + seq_time_effect_range_set(seq); return seq; } @@ -264,7 +267,7 @@ Sequence *SEQ_add_image_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqL BLI_strncpy(scene->ed->act_imagedir, seq->strip->dir, sizeof(scene->ed->act_imagedir)); seq_add_set_view_transform(scene, seq, load_data); seq_add_set_name(scene, seq, load_data); - seq_add_generic_update(scene, seqbase, seq); + seq_add_generic_update(scene, seq); return seq; } @@ -335,7 +338,7 @@ Sequence *SEQ_add_sound_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqL /* Set Last active directory. */ BLI_strncpy(scene->ed->act_sounddir, strip->dir, FILE_MAXDIR); seq_add_set_name(scene, seq, load_data); - seq_add_generic_update(scene, seqbase, seq); + seq_add_generic_update(scene, seq); return seq; } @@ -362,7 +365,6 @@ Sequence *SEQ_add_meta_strip(Scene *scene, ListBase *seqbase, SeqLoadData *load_ /* Set frames start and length. */ seqm->start = load_data->start_frame; seqm->len = 1; - SEQ_time_update_sequence(scene, seqbase, seqm); return seqm; } @@ -484,7 +486,7 @@ Sequence *SEQ_add_movie_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqL seq_add_set_view_transform(scene, seq, load_data); seq_add_set_name(scene, seq, load_data); - seq_add_generic_update(scene, seqbase, seq); + seq_add_generic_update(scene, seq); MEM_freeN(anim_arr); return seq; @@ -509,11 +511,8 @@ void SEQ_add_reload_new_file(Main *bmain, Scene *scene, Sequence *seq, const boo if (lock_range) { /* keep so we don't have to move the actual start and end points (only the data) */ - Editing *ed = SEQ_editing_get(scene); - ListBase *seqbase = SEQ_get_seqbase_by_seq(&ed->seqbase, seq); - SEQ_time_update_sequence(scene, seqbase, seq); - prev_startdisp = seq->startdisp; - prev_enddisp = seq->enddisp; + prev_startdisp = SEQ_time_left_handle_frame_get(seq); + prev_enddisp = SEQ_time_right_handle_frame_get(seq); } switch (seq->type) { @@ -656,13 +655,11 @@ void SEQ_add_reload_new_file(Main *bmain, Scene *scene, Sequence *seq, const boo free_proxy_seq(seq); if (lock_range) { - SEQ_time_left_handle_frame_set(seq, prev_startdisp); - SEQ_time_right_handle_frame_set(seq, prev_enddisp); - SEQ_transform_fix_single_image_seq_offsets(seq); + SEQ_time_left_handle_frame_set(scene, seq, prev_startdisp); + SEQ_time_right_handle_frame_set(scene, seq, prev_enddisp); + SEQ_transform_fix_single_image_seq_offsets(scene, seq); } - ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); - SEQ_time_update_sequence(scene, seqbase, seq); SEQ_relations_invalidate_cache_raw(scene, seq); } diff --git a/source/blender/sequencer/intern/strip_edit.c b/source/blender/sequencer/intern/strip_edit.c index 96bfce8f740..bd439e3c9f8 100644 --- a/source/blender/sequencer/intern/strip_edit.c +++ b/source/blender/sequencer/intern/strip_edit.c @@ -84,8 +84,8 @@ int SEQ_edit_sequence_swap(Sequence *seq_a, Sequence *seq_b, const char **error_ SWAP(int, seq_a->startofs, seq_b->startofs); SWAP(int, seq_a->endofs, seq_b->endofs); SWAP(int, seq_a->machine, seq_b->machine); - SWAP(int, seq_a->startdisp, seq_b->startdisp); - SWAP(int, seq_a->enddisp, seq_b->enddisp); + seq_time_effect_range_set(seq_a); + seq_time_effect_range_set(seq_b); return 1; } @@ -230,7 +230,7 @@ bool SEQ_edit_move_strip_to_meta(Scene *scene, { /* Find the appropriate seqbase */ Editing *ed = SEQ_editing_get(scene); - ListBase *seqbase = SEQ_get_seqbase_by_seq(&ed->seqbase, src_seq); + ListBase *seqbase = SEQ_get_seqbase_by_seq(scene, src_seq); if (dst_seqm->type != SEQ_TYPE_META) { *error_str = N_("Can not move strip to non-meta strip"); @@ -272,11 +272,11 @@ bool SEQ_edit_move_strip_to_meta(Scene *scene, return true; } -static void seq_split_set_left_hold_offset(Sequence *seq, int timeline_frame) +static void seq_split_set_left_hold_offset(const Scene *scene, Sequence *seq, int timeline_frame) { /* Adjust within range of extended stillframes before strip. */ if (timeline_frame < seq->start) { - SEQ_time_left_handle_frame_set(seq, timeline_frame); + SEQ_time_left_handle_frame_set(scene, seq, timeline_frame); } /* Adjust within range of strip contents. */ else if ((timeline_frame >= seq->start) && (timeline_frame <= (seq->start + seq->len))) { @@ -290,19 +290,19 @@ static void seq_split_set_left_hold_offset(Sequence *seq, int timeline_frame) seq->start += timeline_frame - seq->start; seq->anim_startofs += seq->len - 1; seq->len = 1; - SEQ_time_left_handle_frame_set(seq, timeline_frame); - SEQ_time_right_handle_frame_set(seq, right_handle_backup); + SEQ_time_left_handle_frame_set(scene, seq, timeline_frame); + SEQ_time_right_handle_frame_set(scene, seq, right_handle_backup); } } -static void seq_split_set_right_hold_offset(Sequence *seq, int timeline_frame) +static void seq_split_set_right_hold_offset(const Scene *scene, Sequence *seq, int timeline_frame) { /* Adjust within range of extended stillframes before strip. */ if (timeline_frame < seq->start) { const int left_handle_backup = SEQ_time_left_handle_frame_get(seq); seq->start = timeline_frame - 1; - SEQ_time_left_handle_frame_set(seq, left_handle_backup); - SEQ_time_right_handle_frame_set(seq, timeline_frame); + SEQ_time_left_handle_frame_set(scene, seq, left_handle_backup); + SEQ_time_right_handle_frame_set(scene, seq, timeline_frame); } /* Adjust within range of strip contents. */ else if ((timeline_frame >= seq->start) && (timeline_frame <= (seq->start + seq->len))) { @@ -311,11 +311,11 @@ static void seq_split_set_right_hold_offset(Sequence *seq, int timeline_frame) } /* Adjust within range of extended stillframes after strip. */ else if ((seq->start + seq->len) < timeline_frame) { - SEQ_time_right_handle_frame_set(seq, timeline_frame); + SEQ_time_right_handle_frame_set(scene, seq, timeline_frame); } } -static void seq_split_set_right_offset(Sequence *seq, int timeline_frame) +static void seq_split_set_right_offset(const Scene *scene, Sequence *seq, int timeline_frame) { /* Adjust within range of extended stillframes before strip. */ if (timeline_frame < seq->start) { @@ -324,10 +324,10 @@ static void seq_split_set_right_offset(Sequence *seq, int timeline_frame) seq->startofs += content_offset; } - SEQ_time_right_handle_frame_set(seq, timeline_frame); + SEQ_time_right_handle_frame_set(scene, seq, timeline_frame); } -static void seq_split_set_left_offset(Sequence *seq, int timeline_frame) +static void seq_split_set_left_offset(const Scene *scene, Sequence *seq, int timeline_frame) { /* Adjust within range of extended stillframes after strip. */ if (timeline_frame > seq->start + seq->len) { @@ -336,17 +336,17 @@ static void seq_split_set_left_offset(Sequence *seq, int timeline_frame) seq->endofs += content_offset; } - SEQ_time_left_handle_frame_set(seq, timeline_frame); + SEQ_time_left_handle_frame_set(scene, seq, timeline_frame); } static bool seq_edit_split_effect_intersect_check(const Sequence *seq, const int timeline_frame) { - return timeline_frame > seq->startdisp && timeline_frame < seq->enddisp; + return timeline_frame > SEQ_time_left_handle_frame_get(seq) && + timeline_frame < SEQ_time_right_handle_frame_get(seq); } static void seq_edit_split_handle_strip_offsets(Main *bmain, Scene *scene, - ListBase *seqbase, Sequence *left_seq, Sequence *right_seq, const int timeline_frame, @@ -355,27 +355,25 @@ static void seq_edit_split_handle_strip_offsets(Main *bmain, if (seq_edit_split_effect_intersect_check(right_seq, timeline_frame)) { switch (method) { case SEQ_SPLIT_SOFT: - seq_split_set_left_offset(right_seq, timeline_frame); + seq_split_set_left_offset(scene, right_seq, timeline_frame); break; case SEQ_SPLIT_HARD: - seq_split_set_left_hold_offset(right_seq, timeline_frame); + seq_split_set_left_hold_offset(scene, right_seq, timeline_frame); SEQ_add_reload_new_file(bmain, scene, right_seq, false); break; } - SEQ_time_update_sequence(scene, seqbase, right_seq); } if (seq_edit_split_effect_intersect_check(left_seq, timeline_frame)) { switch (method) { case SEQ_SPLIT_SOFT: - seq_split_set_right_offset(left_seq, timeline_frame); + seq_split_set_right_offset(scene, left_seq, timeline_frame); break; case SEQ_SPLIT_HARD: - seq_split_set_right_hold_offset(left_seq, timeline_frame); + seq_split_set_right_hold_offset(scene, left_seq, timeline_frame); SEQ_add_reload_new_file(bmain, scene, left_seq, false); break; } - SEQ_time_update_sequence(scene, seqbase, left_seq); } } @@ -468,10 +466,6 @@ Sequence *SEQ_edit_strip_split(Main *bmain, SEQ_collection_free(collection); - /* Sort list, so that no strip can depend on next strip in list. - * This is important for SEQ_time_update_sequence functionality. */ - SEQ_sort(&left_strips); - /* Duplicate ListBase. */ ListBase right_strips = {NULL, NULL}; SEQ_sequence_base_dupli_recursive(scene, scene, &right_strips, &left_strips, SEQ_DUPE_ALL, 0); @@ -480,18 +474,23 @@ Sequence *SEQ_edit_strip_split(Main *bmain, Sequence *right_seq = right_strips.first; Sequence *return_seq = NULL; - /* Move strips from detached `ListBase`, otherwise they can't be flagged for removal, - * SEQ_time_update_sequence can fail to update meta strips and they can't be renamed. - * This is because these functions check all strips in `Editing` to manage relationships. */ + /* Move strips from detached `ListBase`, otherwise they can't be flagged for removal. */ BLI_movelisttolist(seqbase, &left_strips); BLI_movelisttolist(seqbase, &right_strips); + /* Rename duplicated strips. This has to be done immediately after adding + * strips to seqbase, for lookup cache to work correctly. */ + Sequence *seq_rename = right_seq; + for (; seq_rename; seq_rename = seq_rename->next) { + SEQ_ensure_unique_name(seq_rename, scene); + } + /* Split strips. */ while (left_seq && right_seq) { - if (left_seq->startdisp >= timeline_frame) { + if (SEQ_time_left_handle_frame_get(left_seq) >= timeline_frame) { SEQ_edit_flag_for_removal(scene, seqbase, left_seq); } - if (right_seq->enddisp <= timeline_frame) { + else if (SEQ_time_right_handle_frame_get(right_seq) <= timeline_frame) { SEQ_edit_flag_for_removal(scene, seqbase, right_seq); } else if (return_seq == NULL) { @@ -499,20 +498,12 @@ Sequence *SEQ_edit_strip_split(Main *bmain, return_seq = right_seq; } - seq_edit_split_handle_strip_offsets( - bmain, scene, seqbase, left_seq, right_seq, timeline_frame, method); + seq_edit_split_handle_strip_offsets(bmain, scene, left_seq, right_seq, timeline_frame, method); left_seq = left_seq->next; right_seq = right_seq->next; } SEQ_edit_remove_flagged_sequences(scene, seqbase); - - /* Rename duplicated strips. */ - Sequence *seq_rename = return_seq; - for (; seq_rename; seq_rename = seq_rename->next) { - SEQ_ensure_unique_name(seq_rename, scene); - } - SEQ_animation_restore_original(scene, &fcurves_original_backup); return return_seq; diff --git a/source/blender/sequencer/intern/strip_relations.c b/source/blender/sequencer/intern/strip_relations.c index 1899cc99263..4acf2763ce5 100644 --- a/source/blender/sequencer/intern/strip_relations.c +++ b/source/blender/sequencer/intern/strip_relations.c @@ -47,7 +47,8 @@ static bool seq_relations_check_depend(Sequence *seq, Sequence *cur) } /* sequences are not intersecting in time, assume no dependency exists between them */ - if (cur->enddisp < seq->startdisp || cur->startdisp > seq->enddisp) { + if (SEQ_time_right_handle_frame_get(cur) < SEQ_time_left_handle_frame_get(seq) || + SEQ_time_left_handle_frame_get(cur) > SEQ_time_right_handle_frame_get(seq)) { return false; } @@ -290,8 +291,8 @@ static void sequencer_all_free_anim_ibufs(Editing *ed, } else { /* Limit frame range to meta strip. */ - meta_range[0] = max_ii(frame_range[0], seq->startdisp); - meta_range[1] = min_ii(frame_range[1], seq->enddisp); + meta_range[0] = max_ii(frame_range[0], SEQ_time_left_handle_frame_get(seq)); + meta_range[1] = min_ii(frame_range[1], SEQ_time_right_handle_frame_get(seq)); } sequencer_all_free_anim_ibufs(ed, &seq->seqbase, timeline_frame, meta_range); @@ -345,7 +346,7 @@ bool SEQ_relations_check_scene_recursion(Scene *scene, ReportList *reports) RPT_WARNING, "Recursion detected in video sequencer. Strip %s at frame %d will not be rendered", recursive_seq->name + 2, - recursive_seq->startdisp); + SEQ_time_left_handle_frame_get(recursive_seq)); LISTBASE_FOREACH (Sequence *, seq, &ed->seqbase) { if (seq->type != SEQ_TYPE_SCENE && sequencer_seq_generates_image(seq)) { diff --git a/source/blender/sequencer/intern/strip_time.c b/source/blender/sequencer/intern/strip_time.c index e4f7a5e87e8..25d4f08be82 100644 --- a/source/blender/sequencer/intern/strip_time.c +++ b/source/blender/sequencer/intern/strip_time.c @@ -27,6 +27,7 @@ #include "SEQ_time.h" #include "SEQ_transform.h" +#include "sequencer.h" #include "strip_time.h" #include "utils.h" @@ -37,7 +38,7 @@ float seq_give_frame_index(Sequence *seq, float timeline_frame) int end = seq->start + seq->len - 1; if (seq->type & SEQ_TYPE_EFFECT) { - end = seq->enddisp; + end = SEQ_time_right_handle_frame_get(seq); } if (end < sta) { @@ -89,7 +90,7 @@ static int metaseq_end(Sequence *metaseq) return metaseq->start + metaseq->len - metaseq->endofs; } -static void seq_update_sound_bounds_recursive_impl(Scene *scene, +static void seq_update_sound_bounds_recursive_impl(const Scene *scene, Sequence *metaseq, int start, int end) @@ -131,33 +132,31 @@ static void seq_update_sound_bounds_recursive_impl(Scene *scene, } } -void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq) +void seq_update_sound_bounds_recursive(const Scene *scene, Sequence *metaseq) { seq_update_sound_bounds_recursive_impl( scene, metaseq, metaseq_start(metaseq), metaseq_end(metaseq)); } -static void seq_time_update_sequence_bounds(Scene *scene, Sequence *seq) +/* Update meta strip content start and end, update sound playback range. */ +void SEQ_time_update_meta_strip_range(const Scene *scene, Sequence *seq_meta) { - seq->startdisp = seq->start + seq->startofs; - seq->enddisp = seq->start + seq->len - seq->endofs; - - if (seq->type == SEQ_TYPE_META) { - seq_update_sound_bounds_recursive(scene, seq); + if (seq_meta == NULL) { + return; } -} -static void seq_time_update_meta_strip(Scene *scene, Sequence *seq_meta) -{ if (BLI_listbase_is_empty(&seq_meta->seqbase)) { return; } + const int strip_start = SEQ_time_left_handle_frame_get(seq_meta); + const int strip_end = SEQ_time_right_handle_frame_get(seq_meta); + int min = MAXFRAME * 2; int max = -MAXFRAME * 2; LISTBASE_FOREACH (Sequence *, seq, &seq_meta->seqbase) { - min = min_ii(seq->startdisp, min); - max = max_ii(seq->enddisp, max); + min = min_ii(SEQ_time_left_handle_frame_get(seq), min); + max = max_ii(SEQ_time_right_handle_frame_get(seq), max); } seq_meta->start = min + seq_meta->anim_startofs; @@ -166,144 +165,54 @@ static void seq_time_update_meta_strip(Scene *scene, Sequence *seq_meta) seq_meta->len -= seq_meta->anim_endofs; seq_update_sound_bounds_recursive(scene, seq_meta); -} - -void SEQ_time_update_meta_strip_range(Scene *scene, Sequence *seq_meta) -{ - if (seq_meta == NULL) { - return; - } - - seq_time_update_meta_strip(scene, seq_meta); /* Prevent meta-strip to move in timeline. */ - SEQ_time_left_handle_frame_set(seq_meta, seq_meta->startdisp); - SEQ_time_right_handle_frame_set(seq_meta, seq_meta->enddisp); + SEQ_time_left_handle_frame_set(scene, seq_meta, strip_start); + SEQ_time_right_handle_frame_set(scene, seq_meta, strip_end); } -void SEQ_time_update_sequence(Scene *scene, ListBase *seqbase, Sequence *seq) +void seq_time_effect_range_set(Sequence *seq) { - Sequence *seqm; - - /* Check all meta-strips recursively. */ - seqm = seq->seqbase.first; - while (seqm) { - if (seqm->seqbase.first) { - SEQ_time_update_sequence(scene, &seqm->seqbase, seqm); - } - seqm = seqm->next; + if (seq->seq1 && seq->seq2) { /* 2 - input effect. */ + seq->startdisp = max_ii(SEQ_time_left_handle_frame_get(seq->seq1), + SEQ_time_left_handle_frame_get(seq->seq2)); + seq->enddisp = min_ii(SEQ_time_right_handle_frame_get(seq->seq1), + SEQ_time_right_handle_frame_get(seq->seq2)); } - - /* effects and meta: automatic start and end */ - if (seq->type & SEQ_TYPE_EFFECT) { - if (seq->seq1) { - seq->startofs = seq->endofs = 0; - if (seq->seq3) { - seq->start = seq->startdisp = max_iii( - seq->seq1->startdisp, seq->seq2->startdisp, seq->seq3->startdisp); - seq->enddisp = min_iii(seq->seq1->enddisp, seq->seq2->enddisp, seq->seq3->enddisp); - } - else if (seq->seq2) { - seq->start = seq->startdisp = max_ii(seq->seq1->startdisp, seq->seq2->startdisp); - seq->enddisp = min_ii(seq->seq1->enddisp, seq->seq2->enddisp); - } - else { - seq->start = seq->startdisp = seq->seq1->startdisp; - seq->enddisp = seq->seq1->enddisp; - } - /* we can't help if strips don't overlap, it won't give useful results. - * but at least ensure 'len' is never negative which causes bad bugs elsewhere. */ - if (seq->enddisp < seq->startdisp) { - /* simple start/end swap */ - seq->start = seq->enddisp; - seq->enddisp = seq->startdisp; - seq->startdisp = seq->start; - seq->flag |= SEQ_INVALID_EFFECT; - } - else { - seq->flag &= ~SEQ_INVALID_EFFECT; - } - - seq->len = seq->enddisp - seq->startdisp; - } - else { - seq_time_update_sequence_bounds(scene, seq); - } + else if (seq->seq1) { /* Single input effect. */ + seq->startdisp = SEQ_time_right_handle_frame_get(seq->seq1); + seq->enddisp = SEQ_time_left_handle_frame_get(seq->seq1); } - else if (seq->type == SEQ_TYPE_META) { - seq_time_update_meta_strip(scene, seq); + else if (seq->seq2) { /* Strip may be missing one of inputs. */ + seq->startdisp = SEQ_time_right_handle_frame_get(seq->seq2); + seq->enddisp = SEQ_time_left_handle_frame_get(seq->seq2); } - else { - seq_time_update_sequence_bounds(scene, seq); - } - - Editing *ed = SEQ_editing_get(scene); - /* Strip is inside meta strip */ - if (seqbase != &ed->seqbase) { - Sequence *meta = SEQ_get_meta_by_seqbase(&ed->seqbase, seqbase); - SEQ_time_update_meta_strip_range(scene, meta); + if (seq->startdisp > seq->enddisp) { + SWAP(int, seq->startdisp, seq->enddisp); } - seq_time_update_sequence_bounds(scene, seq); + /* Values unusable for effects, these should be always 0. */ + seq->startofs = seq->endofs = seq->anim_startofs = seq->anim_endofs = 0; } -static bool update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *changed_seq) +/* Update strip startdisp and enddisp (n-input effects have no len to calculate these). */ +void seq_time_update_effects_strip_range(const Scene *scene, SeqCollection *effects) { - Sequence *subseq; - bool do_update = false; - - /* recurse downwards to see if this seq depends on the changed seq */ - - if (seq == NULL) { - return false; - } - - if (seq == changed_seq) { - do_update = true; - } - - for (subseq = seq->seqbase.first; subseq; subseq = subseq->next) { - if (update_changed_seq_recurs(scene, subseq, changed_seq)) { - do_update = true; - } - } - - if (seq->seq1) { - if (update_changed_seq_recurs(scene, seq->seq1, changed_seq)) { - do_update = true; - } - } - if (seq->seq2 && (seq->seq2 != seq->seq1)) { - if (update_changed_seq_recurs(scene, seq->seq2, changed_seq)) { - do_update = true; - } - } - if (seq->seq3 && (seq->seq3 != seq->seq1) && (seq->seq3 != seq->seq2)) { - if (update_changed_seq_recurs(scene, seq->seq3, changed_seq)) { - do_update = true; - } - } - - if (do_update) { - ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); - SEQ_time_update_sequence(scene, seqbase, seq); + if (effects == NULL) { + return; } - return do_update; -} - -void SEQ_time_update_recursive(Scene *scene, Sequence *changed_seq) -{ - Editing *ed = SEQ_editing_get(scene); Sequence *seq; - - if (ed == NULL) { - return; + /* First pass: Update length of immediate effects. */ + SEQ_ITERATOR_FOREACH (seq, effects) { + seq_time_effect_range_set(seq); } - for (seq = ed->seqbase.first; seq; seq = seq->next) { - update_changed_seq_recurs(scene, seq, changed_seq); + /* Second pass: Recursive call to update effects in chain and in order, so they inherit length + * correctly. */ + SEQ_ITERATOR_FOREACH (seq, effects) { + seq_time_update_effects_strip_range(scene, seq_sequence_lookup_effects_by_seq(scene, seq)); } } @@ -342,12 +251,14 @@ int SEQ_time_find_next_prev_edit(Scene *scene, } if (do_center) { - seq_frames[0] = (seq->startdisp + seq->enddisp) / 2; + seq_frames[0] = (SEQ_time_left_handle_frame_get(seq) + + SEQ_time_right_handle_frame_get(seq)) / + 2; seq_frames_tot = 1; } else { - seq_frames[0] = seq->startdisp; - seq_frames[1] = seq->enddisp; + seq_frames[0] = SEQ_time_left_handle_frame_get(seq); + seq_frames[1] = SEQ_time_right_handle_frame_get(seq); seq_frames_tot = 2; } @@ -431,11 +342,11 @@ void SEQ_timeline_expand_boundbox(const ListBase *seqbase, rctf *rect) } LISTBASE_FOREACH (Sequence *, seq, seqbase) { - if (rect->xmin > seq->startdisp - 1) { - rect->xmin = seq->startdisp - 1; + if (rect->xmin > SEQ_time_left_handle_frame_get(seq) - 1) { + rect->xmin = SEQ_time_left_handle_frame_get(seq) - 1; } - if (rect->xmax < seq->enddisp + 1) { - rect->xmax = seq->enddisp + 1; + if (rect->xmax < SEQ_time_right_handle_frame_get(seq) + 1) { + rect->xmax = SEQ_time_right_handle_frame_get(seq) + 1; } if (rect->ymax < seq->machine) { rect->ymax = seq->machine; @@ -507,7 +418,8 @@ void seq_time_gap_info_get(const Scene *scene, bool SEQ_time_strip_intersects_frame(const Sequence *seq, const int timeline_frame) { - return (seq->startdisp <= timeline_frame) && (seq->enddisp > timeline_frame); + return (SEQ_time_left_handle_frame_get(seq) <= timeline_frame) && + (SEQ_time_right_handle_frame_get(seq) > timeline_frame); } bool SEQ_time_has_left_still_frames(const Sequence *seq) @@ -525,21 +437,36 @@ bool SEQ_time_has_still_frames(const Sequence *seq) return SEQ_time_has_right_still_frames(seq) || SEQ_time_has_left_still_frames(seq); } -int SEQ_time_left_handle_frame_get(Sequence *seq) +int SEQ_time_left_handle_frame_get(const Sequence *seq) { + if (seq->seq1 || seq->seq2) { + return seq->startdisp; + } + return seq->start + seq->startofs; } -int SEQ_time_right_handle_frame_get(Sequence *seq) + +int SEQ_time_right_handle_frame_get(const Sequence *seq) { + if (seq->seq1 || seq->seq2) { + return seq->enddisp; + } + return seq->start + seq->len - seq->endofs; } -void SEQ_time_left_handle_frame_set(Sequence *seq, int val) +void SEQ_time_left_handle_frame_set(const Scene *scene, Sequence *seq, int val) { seq->startofs = val - seq->start; + seq->startdisp = val; /* Only to make files usable in older versions. */ + SEQ_time_update_meta_strip_range(scene, seq_sequence_lookup_meta_by_seq(scene, seq)); + seq_time_update_effects_strip_range(scene, seq_sequence_lookup_effects_by_seq(scene, seq)); } -void SEQ_time_right_handle_frame_set(Sequence *seq, int val) +void SEQ_time_right_handle_frame_set(const Scene *scene, Sequence *seq, int val) { seq->endofs = seq->start + seq->len - val; + seq->enddisp = val; /* Only to make files usable in older versions. */ + SEQ_time_update_meta_strip_range(scene, seq_sequence_lookup_meta_by_seq(scene, seq)); + seq_time_update_effects_strip_range(scene, seq_sequence_lookup_effects_by_seq(scene, seq)); } diff --git a/source/blender/sequencer/intern/strip_time.h b/source/blender/sequencer/intern/strip_time.h index c96a016e646..7a75aeac1a6 100644 --- a/source/blender/sequencer/intern/strip_time.h +++ b/source/blender/sequencer/intern/strip_time.h @@ -14,9 +14,10 @@ extern "C" { struct ListBase; struct Scene; struct Sequence; +struct SeqCollection; float seq_give_frame_index(struct Sequence *seq, float timeline_frame); -void seq_update_sound_bounds_recursive(struct Scene *scene, struct Sequence *metaseq); +void seq_update_sound_bounds_recursive(const struct Scene *scene, struct Sequence *metaseq); /* Describes gap between strips in timeline. */ typedef struct GapInfo { @@ -37,6 +38,8 @@ void seq_time_gap_info_get(const struct Scene *scene, struct ListBase *seqbase, int initial_frame, struct GapInfo *r_gap_info); +void seq_time_effect_range_set(Sequence *seq); +void seq_time_update_effects_strip_range(const struct Scene *scene, struct SeqCollection *effects); #ifdef __cplusplus } diff --git a/source/blender/sequencer/intern/strip_transform.c b/source/blender/sequencer/intern/strip_transform.c index 8ff577240d6..051dc3961ba 100644 --- a/source/blender/sequencer/intern/strip_transform.c +++ b/source/blender/sequencer/intern/strip_transform.c @@ -25,6 +25,9 @@ #include "SEQ_time.h" #include "SEQ_transform.h" +#include "strip_time.h" +#include "sequencer.h" + #include "CLG_log.h" static CLG_LogRef LOG = {"seq.strip_transform"}; @@ -86,16 +89,16 @@ bool SEQ_transform_seqbase_isolated_sel_check(ListBase *seqbase) return true; } -void SEQ_transform_handle_xlimits(Sequence *seq, int leftflag, int rightflag) +void SEQ_transform_handle_xlimits(const Scene *scene, Sequence *seq, int leftflag, int rightflag) { if (leftflag) { if (SEQ_time_left_handle_frame_get(seq) >= SEQ_time_right_handle_frame_get(seq)) { - SEQ_time_left_handle_frame_set(seq, SEQ_time_right_handle_frame_get(seq) - 1); + SEQ_time_left_handle_frame_set(scene, seq, SEQ_time_right_handle_frame_get(seq) - 1); } if (SEQ_transform_single_image_check(seq) == 0) { if (SEQ_time_left_handle_frame_get(seq) >= seq_tx_get_end(seq)) { - SEQ_time_left_handle_frame_set(seq, seq_tx_get_end(seq) - 1); + SEQ_time_left_handle_frame_set(scene, seq, seq_tx_get_end(seq) - 1); } /* TODO: This doesn't work at the moment. */ @@ -112,12 +115,12 @@ void SEQ_transform_handle_xlimits(Sequence *seq, int leftflag, int rightflag) if (rightflag) { if (SEQ_time_right_handle_frame_get(seq) <= SEQ_time_left_handle_frame_get(seq)) { - SEQ_time_right_handle_frame_set(seq, SEQ_time_left_handle_frame_get(seq) + 1); + SEQ_time_right_handle_frame_set(scene, seq, SEQ_time_left_handle_frame_get(seq) + 1); } if (SEQ_transform_single_image_check(seq) == 0) { if (SEQ_time_right_handle_frame_get(seq) <= seq_tx_get_start(seq)) { - SEQ_time_right_handle_frame_set(seq, seq_tx_get_start(seq) + 1); + SEQ_time_right_handle_frame_set(scene, seq, seq_tx_get_start(seq) + 1); } } } @@ -129,7 +132,7 @@ void SEQ_transform_handle_xlimits(Sequence *seq, int leftflag, int rightflag) } } -void SEQ_transform_fix_single_image_seq_offsets(Sequence *seq) +void SEQ_transform_fix_single_image_seq_offsets(const Scene *scene, Sequence *seq) { int left, start, offset; if (!SEQ_transform_single_image_check(seq)) { @@ -142,8 +145,8 @@ void SEQ_transform_fix_single_image_seq_offsets(Sequence *seq) start = seq->start; if (start != left) { offset = left - start; - SEQ_time_left_handle_frame_set(seq, SEQ_time_left_handle_frame_get(seq) - offset); - SEQ_time_right_handle_frame_set(seq, SEQ_time_right_handle_frame_get(seq) - offset); + SEQ_time_left_handle_frame_set(scene, seq, SEQ_time_left_handle_frame_get(seq) - offset); + SEQ_time_right_handle_frame_set(scene, seq, SEQ_time_right_handle_frame_get(seq) - offset); seq->start += offset; } } @@ -156,7 +159,8 @@ bool SEQ_transform_sequence_can_be_translated(Sequence *seq) bool SEQ_transform_test_overlap_seq_seq(Sequence *seq1, Sequence *seq2) { return (seq1 != seq2 && seq1->machine == seq2->machine && - ((seq1->enddisp <= seq2->startdisp) || (seq1->startdisp >= seq2->enddisp)) == 0); + ((SEQ_time_right_handle_frame_get(seq1) <= SEQ_time_left_handle_frame_get(seq2)) || + (SEQ_time_left_handle_frame_get(seq1) >= SEQ_time_right_handle_frame_get(seq2))) == 0); } bool SEQ_transform_test_overlap(ListBase *seqbasep, Sequence *test) @@ -180,9 +184,6 @@ void SEQ_transform_translate_sequence(Scene *evil_scene, Sequence *seq, int delt return; } - SEQ_offset_animdata(evil_scene, seq, delta); - seq->start += delta; - /* Meta strips requires special handling: their content is to be translated, and then frame range * of the meta is to be updated for the updated content. */ if (seq->type == SEQ_TYPE_META) { @@ -190,16 +191,21 @@ void SEQ_transform_translate_sequence(Scene *evil_scene, Sequence *seq, int delt for (seq_child = seq->seqbase.first; seq_child; seq_child = seq_child->next) { SEQ_transform_translate_sequence(evil_scene, seq_child, delta); } - /* Ensure that meta bounds are updated, but this function prevents resets seq->start and - * start/end point in timeline. */ - SEQ_time_update_meta_strip_range(evil_scene, seq); /* Move meta start/end points. */ - SEQ_time_left_handle_frame_set(seq, seq->startdisp + delta); - SEQ_time_right_handle_frame_set(seq, seq->enddisp + delta); + SEQ_time_left_handle_frame_set(evil_scene, seq, SEQ_time_left_handle_frame_get(seq) + delta); + SEQ_time_right_handle_frame_set(evil_scene, seq, SEQ_time_right_handle_frame_get(seq) + delta); + } + else { /* All other strip types. */ + seq->start += delta; + /* Only to make files usable in older versions. */ + seq->startdisp = SEQ_time_left_handle_frame_get(seq); + seq->enddisp = SEQ_time_right_handle_frame_get(seq); } - ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(evil_scene)); - SEQ_time_update_sequence(evil_scene, seqbase, seq); + SEQ_offset_animdata(evil_scene, seq, delta); + SEQ_time_update_meta_strip_range(evil_scene, seq_sequence_lookup_meta_by_seq(evil_scene, seq)); + seq_time_update_effects_strip_range(evil_scene, + seq_sequence_lookup_effects_by_seq(evil_scene, seq)); } bool SEQ_transform_seqbase_shuffle_ex(ListBase *seqbasep, @@ -211,16 +217,12 @@ bool SEQ_transform_seqbase_shuffle_ex(ListBase *seqbasep, BLI_assert(ELEM(channel_delta, -1, 1)); test->machine += channel_delta; - SEQ_time_update_sequence(evil_scene, seqbasep, test); while (SEQ_transform_test_overlap(seqbasep, test)) { if ((channel_delta > 0) ? (test->machine >= MAXSEQ) : (test->machine < 1)) { break; } test->machine += channel_delta; - - /* XXX: I don't think this is needed since were only moving vertically, Campbell. */ - SEQ_time_update_sequence(evil_scene, seqbasep, test); } if (!SEQ_valid_strip_channel(test)) { @@ -228,19 +230,18 @@ bool SEQ_transform_seqbase_shuffle_ex(ListBase *seqbasep, * nicer to move it to the end */ Sequence *seq; - int new_frame = test->enddisp; + int new_frame = SEQ_time_right_handle_frame_get(test); for (seq = seqbasep->first; seq; seq = seq->next) { if (seq->machine == orig_machine) { - new_frame = max_ii(new_frame, seq->enddisp); + new_frame = max_ii(new_frame, SEQ_time_right_handle_frame_get(seq)); } } test->machine = orig_machine; - new_frame = new_frame + (test->start - test->startdisp); /* adjust by the startdisp */ + new_frame = new_frame + + (test->start - SEQ_time_left_handle_frame_get(test)); /* adjust by the startdisp */ SEQ_transform_translate_sequence(evil_scene, test, new_frame - test->start); - - SEQ_time_update_sequence(evil_scene, seqbasep, test); return false; } @@ -252,61 +253,57 @@ bool SEQ_transform_seqbase_shuffle(ListBase *seqbasep, Sequence *test, Scene *ev return SEQ_transform_seqbase_shuffle_ex(seqbasep, test, evil_scene, 1); } -static int shuffle_seq_time_offset_test(SeqCollection *strips_to_shuffle, - ListBase *seqbasep, - char dir) +static bool shuffle_seq_test_overlap(const Sequence *seq1, const Sequence *seq2, const int offset) { - int offset = 0; - Sequence *seq; - - SEQ_ITERATOR_FOREACH (seq, strips_to_shuffle) { - LISTBASE_FOREACH (Sequence *, seq_other, seqbasep) { - if (!SEQ_transform_test_overlap_seq_seq(seq, seq_other)) { - continue; - } - if (SEQ_relation_is_effect_of_strip(seq_other, seq)) { - continue; - } - if (UNLIKELY(SEQ_collection_has_strip(seq_other, strips_to_shuffle))) { - CLOG_WARN(&LOG, - "Strip overlaps with itself or another strip, that is to be shuffled. " - "This should never happen."); - continue; - } - if (dir == 'L') { - offset = min_ii(offset, seq_other->startdisp - seq->enddisp); - } - else { - offset = max_ii(offset, seq_other->enddisp - seq->startdisp); - } - } - } - return offset; + return ( + seq1 != seq2 && seq1->machine == seq2->machine && + ((SEQ_time_right_handle_frame_get(seq1) + offset <= SEQ_time_left_handle_frame_get(seq2)) || + (SEQ_time_left_handle_frame_get(seq1) + offset >= SEQ_time_right_handle_frame_get(seq2))) == + 0); } -static int shuffle_seq_time_offset(SeqCollection *strips_to_shuffle, - ListBase *seqbasep, - Scene *scene, - char dir) +static int shuffle_seq_time_offset_get(SeqCollection *strips_to_shuffle, + ListBase *seqbasep, + char dir) { - int ofs = 0; - int tot_ofs = 0; + int offset = 0; Sequence *seq; - while ((ofs = shuffle_seq_time_offset_test(strips_to_shuffle, seqbasep, dir))) { + bool all_conflicts_resolved = false; + + while (!all_conflicts_resolved) { + all_conflicts_resolved = true; SEQ_ITERATOR_FOREACH (seq, strips_to_shuffle) { - /* seq_test_overlap only tests display values */ - seq->startdisp += ofs; - seq->enddisp += ofs; - } + LISTBASE_FOREACH (Sequence *, seq_other, seqbasep) { + if (!shuffle_seq_test_overlap(seq, seq_other, offset)) { + continue; + } + if (SEQ_relation_is_effect_of_strip(seq_other, seq)) { + continue; + } + if (UNLIKELY(SEQ_collection_has_strip(seq_other, strips_to_shuffle))) { + CLOG_WARN(&LOG, + "Strip overlaps with itself or another strip, that is to be shuffled. " + "This should never happen."); + continue; + } - tot_ofs += ofs; - } + all_conflicts_resolved = false; - SEQ_ITERATOR_FOREACH (seq, strips_to_shuffle) { - SEQ_time_update_sequence(scene, seqbasep, seq); /* corrects dummy startdisp/enddisp values */ + if (dir == 'L') { + offset = min_ii(offset, + SEQ_time_left_handle_frame_get(seq_other) - + SEQ_time_right_handle_frame_get(seq)); + } + else { + offset = max_ii(offset, + SEQ_time_right_handle_frame_get(seq_other) - + SEQ_time_left_handle_frame_get(seq)); + } + } + } } - return tot_ofs; + return offset; } bool SEQ_transform_seqbase_shuffle_time(SeqCollection *strips_to_shuffle, @@ -315,8 +312,8 @@ bool SEQ_transform_seqbase_shuffle_time(SeqCollection *strips_to_shuffle, ListBase *markers, const bool use_sync_markers) { - int offset_l = shuffle_seq_time_offset(strips_to_shuffle, seqbasep, evil_scene, 'L'); - int offset_r = shuffle_seq_time_offset(strips_to_shuffle, seqbasep, evil_scene, 'R'); + int offset_l = shuffle_seq_time_offset_get(strips_to_shuffle, seqbasep, 'L'); + int offset_r = shuffle_seq_time_offset_get(strips_to_shuffle, seqbasep, 'R'); int offset = (-offset_l < offset_r) ? offset_l : offset_r; if (offset) { @@ -346,9 +343,8 @@ void SEQ_transform_offset_after_frame(Scene *scene, const int timeline_frame) { LISTBASE_FOREACH (Sequence *, seq, seqbase) { - if (seq->startdisp >= timeline_frame) { + if (SEQ_time_left_handle_frame_get(seq) >= timeline_frame) { SEQ_transform_translate_sequence(scene, seq, delta); - SEQ_time_update_sequence(scene, seqbase, seq); SEQ_relations_invalidate_cache_preprocessed(scene, seq); } } diff --git a/source/blender/sequencer/intern/utils.c b/source/blender/sequencer/intern/utils.c index 0cf47420d8f..260f82310fb 100644 --- a/source/blender/sequencer/intern/utils.c +++ b/source/blender/sequencer/intern/utils.c @@ -39,55 +39,9 @@ #include "multiview.h" #include "proxy.h" +#include "sequencer.h" #include "utils.h" -void SEQ_sort(ListBase *seqbase) -{ - if (seqbase == NULL) { - return; - } - - /* all strips together per kind, and in order of y location ("machine") */ - ListBase inputbase, effbase; - Sequence *seq, *seqt; - - BLI_listbase_clear(&inputbase); - BLI_listbase_clear(&effbase); - - while ((seq = BLI_pophead(seqbase))) { - - if (seq->type & SEQ_TYPE_EFFECT) { - seqt = effbase.first; - while (seqt) { - if (seqt->machine >= seq->machine) { - BLI_insertlinkbefore(&effbase, seqt, seq); - break; - } - seqt = seqt->next; - } - if (seqt == NULL) { - BLI_addtail(&effbase, seq); - } - } - else { - seqt = inputbase.first; - while (seqt) { - if (seqt->machine >= seq->machine) { - BLI_insertlinkbefore(&inputbase, seqt, seq); - break; - } - seqt = seqt->next; - } - if (seqt == NULL) { - BLI_addtail(&inputbase, seq); - } - } - } - - BLI_movelisttolist(seqbase, &inputbase); - BLI_movelisttolist(seqbase, &effbase); -} - typedef struct SeqUniqueInfo { Sequence *seq; char name_src[SEQ_NAME_MAXSTR]; @@ -414,20 +368,18 @@ const Sequence *SEQ_get_topmost_sequence(const Scene *scene, int frame) return best_seq; } -ListBase *SEQ_get_seqbase_by_seq(ListBase *seqbase, Sequence *seq) +ListBase *SEQ_get_seqbase_by_seq(const Scene *scene, Sequence *seq) { - Sequence *iseq; - ListBase *lb = NULL; + Editing *ed = SEQ_editing_get(scene); + ListBase *main_seqbase = &ed->seqbase; + Sequence *seq_meta = seq_sequence_lookup_meta_by_seq(scene, seq); - for (iseq = seqbase->first; iseq; iseq = iseq->next) { - if (seq == iseq) { - return seqbase; - } - if (iseq->seqbase.first && (lb = SEQ_get_seqbase_by_seq(&iseq->seqbase, seq))) { - return lb; - } + if (seq_meta != NULL) { + return &seq_meta->seqbase; + } + if (BLI_findindex(main_seqbase, seq) >= 0) { + return main_seqbase; } - return NULL; } diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 890872a06bc..dec1260ad1d 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -1400,6 +1400,14 @@ void WM_jobs_callbacks(struct wmJob *, void (*update)(void *), void (*endjob)(void *)); +void WM_jobs_callbacks_ex(wmJob *wm_job, + wm_jobs_start_callback startjob, + void (*initjob)(void *), + void (*update)(void *), + void (*endjob)(void *), + void (*completed)(void *), + void (*canceled)(void *)); + /** * If job running, the same owner gave it a new job. * if different owner starts existing startjob, it suspends itself @@ -1426,6 +1434,7 @@ void WM_jobs_kill_all_except(struct wmWindowManager *wm, const void *owner); void WM_jobs_kill_type(struct wmWindowManager *wm, const void *owner, int job_type); bool WM_jobs_has_running(const struct wmWindowManager *wm); +bool WM_jobs_has_running_type(const struct wmWindowManager *wm, int job_type); void WM_job_main_thread_lock_acquire(struct wmJob *job); void WM_job_main_thread_lock_release(struct wmJob *job); diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c index b44cf9e48b8..bc80f56ee13 100644 --- a/source/blender/windowmanager/intern/wm_jobs.c +++ b/source/blender/windowmanager/intern/wm_jobs.c @@ -87,6 +87,16 @@ struct wmJob { * Executed in main thread. */ void (*endjob)(void *); + /** + * Called when job is stopped normally, i.e. by simply completing the startjob function. + * Executed in main thread. + */ + void (*completed)(void *); + /** + * Called when job is stopped abnormally, i.e. when stop=true but ready=false. + * Executed in main thread. + */ + void (*canceled)(void *); /** Running jobs each have own timer */ double timestep; @@ -344,10 +354,23 @@ void WM_jobs_callbacks(wmJob *wm_job, void (*update)(void *), void (*endjob)(void *)) { + WM_jobs_callbacks_ex(wm_job, startjob, initjob, update, endjob, NULL, NULL); +} + +void WM_jobs_callbacks_ex(wmJob *wm_job, + wm_jobs_start_callback startjob, + void (*initjob)(void *), + void (*update)(void *), + void (*endjob)(void *), + void (*completed)(void *), + void (*canceled)(void *)) +{ wm_job->startjob = startjob; wm_job->initjob = initjob; wm_job->update = update; wm_job->endjob = endjob; + wm_job->completed = completed; + wm_job->canceled = canceled; } static void *do_job_thread(void *job_v) @@ -465,6 +488,25 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job) } } +static void wm_job_end(wmJob *wm_job) +{ + BLI_assert_msg(BLI_thread_is_main(), "wm_job_end should only be called from the main thread"); + if (wm_job->endjob) { + wm_job->endjob(wm_job->run_customdata); + } + + /* Do the final callback based on whether the job was run to completion or not. + * Not all jobs have the same way of signalling cancellation (f.e. rendering + * stops when G.is_break=true, but doesn't set any wm_job properties to cancel + * the WM job). */ + const bool was_canceled = wm_job->stop || G.is_break; + void (*final_callback)(void *) = (wm_job->ready && !was_canceled) ? wm_job->completed : + wm_job->canceled; + if (final_callback) { + final_callback(wm_job->run_customdata); + } +} + static void wm_job_free(wmWindowManager *wm, wmJob *wm_job) { BLI_remlink(&wm->jobs, wm_job); @@ -485,10 +527,7 @@ static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *wm_job) WM_job_main_thread_lock_release(wm_job); BLI_threadpool_end(&wm_job->threads); WM_job_main_thread_lock_acquire(wm_job); - - if (wm_job->endjob) { - wm_job->endjob(wm_job->run_customdata); - } + wm_job_end(wm_job); } if (wm_job->wt) { @@ -600,9 +639,7 @@ void wm_jobs_timer(wmWindowManager *wm, wmTimer *wt) } if (wm_job->ready) { - if (wm_job->endjob) { - wm_job->endjob(wm_job->run_customdata); - } + wm_job_end(wm_job); /* free own data */ wm_job->run_free(wm_job->run_customdata); @@ -670,3 +707,13 @@ bool WM_jobs_has_running(const wmWindowManager *wm) return false; } + +bool WM_jobs_has_running_type(const struct wmWindowManager *wm, int job_type) +{ + LISTBASE_FOREACH (wmJob *, wm_job, &wm->jobs) { + if (wm_job->running && wm_job->job_type == job_type) { + return true; + } + } + return false; +} diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 1fa5e64093f..acacbd77f9e 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -445,7 +445,10 @@ bool WM_keymap_poll(bContext *C, wmKeyMap *keymap) * When developing a customized Blender though you may want empty keymaps. */ if (!U.app_template[0] && /* Fallback key-maps may be intentionally empty, don't flood the output. */ - !BLI_str_endswith(keymap->idname, " (fallback)")) { + !BLI_str_endswith(keymap->idname, " (fallback)") && + /* This is an exception which may be empty. + * Longer term we might want a flag to indicate an empty key-map is intended. */ + !STREQ(keymap->idname, "Node Tool: Tweak")) { CLOG_WARN(WM_LOG_KEYMAPS, "empty keymap '%s'", keymap->idname); } } diff --git a/tests/python/alembic_export_tests.py b/tests/python/alembic_export_tests.py index f6c05d955c9..95ae3ee9feb 100644 --- a/tests/python/alembic_export_tests.py +++ b/tests/python/alembic_export_tests.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - """ Alembic Export Tests diff --git a/tests/python/batch_import.py b/tests/python/batch_import.py index a6b44bc7478..811b070b0ca 100644 --- a/tests/python/batch_import.py +++ b/tests/python/batch_import.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - """ Example Usage: diff --git a/tests/python/bl_alembic_io_test.py b/tests/python/bl_alembic_io_test.py index f3480380911..4cfda239bd1 100644 --- a/tests/python/bl_alembic_io_test.py +++ b/tests/python/bl_alembic_io_test.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - """ ./blender.bin --background -noaudio --factory-startup --python tests/python/bl_alembic_io_test.py -- --testdir /path/to/lib/tests/alembic """ diff --git a/tests/python/bl_animation_fcurves.py b/tests/python/bl_animation_fcurves.py index 449f17ebfec..931db3f2d22 100644 --- a/tests/python/bl_animation_fcurves.py +++ b/tests/python/bl_animation_fcurves.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - """ blender -b -noaudio --factory-startup --python tests/python/bl_animation_fcurves.py -- --testdir /path/to/lib/tests/animation """ diff --git a/tests/python/bl_bundled_modules.py b/tests/python/bl_bundled_modules.py index 4a055960f83..7728a2deb47 100644 --- a/tests/python/bl_bundled_modules.py +++ b/tests/python/bl_bundled_modules.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Test that modules we ship with our Python installation are available import bz2 diff --git a/tests/python/bl_keymap_completeness.py b/tests/python/bl_keymap_completeness.py index ee24a531f53..97335a94c01 100644 --- a/tests/python/bl_keymap_completeness.py +++ b/tests/python/bl_keymap_completeness.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # simple script to test 'bl_keymap_utils.keymap_hierarchy' contains correct values. # Needed for 'bl_keymap_utils.keymap_hierarchy' which inspects tools. diff --git a/tests/python/bl_keymap_validate.py b/tests/python/bl_keymap_validate.py index b87eed0c0df..83d41c8a9f6 100644 --- a/tests/python/bl_keymap_validate.py +++ b/tests/python/bl_keymap_validate.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # ./blender.bin --background -noaudio --factory-startup --python tests/python/bl_keymap_validate.py # diff --git a/tests/python/bl_load_addons.py b/tests/python/bl_load_addons.py index 8fee31f7a2b..b94c56541af 100644 --- a/tests/python/bl_load_addons.py +++ b/tests/python/bl_load_addons.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # simple script to enable all addons, and disable """ diff --git a/tests/python/bl_load_py_modules.py b/tests/python/bl_load_py_modules.py index 4d4196d1f64..7ad5895ce86 100644 --- a/tests/python/bl_load_py_modules.py +++ b/tests/python/bl_load_py_modules.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # simple script to enable all addons, and disable """ diff --git a/tests/python/bl_mesh_modifiers.py b/tests/python/bl_mesh_modifiers.py index 3b653402083..640cf1c30f2 100644 --- a/tests/python/bl_mesh_modifiers.py +++ b/tests/python/bl_mesh_modifiers.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Currently this script only generates images from different modifier # combinations and does not validate they work correctly, # this is because we don't get 1:1 match with bmesh. diff --git a/tests/python/bl_mesh_validate.py b/tests/python/bl_mesh_validate.py index 9a9384ce777..9e093608406 100644 --- a/tests/python/bl_mesh_validate.py +++ b/tests/python/bl_mesh_validate.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Simple script to check mash validate code. # XXX Should be extended with many more "wrong cases"! diff --git a/tests/python/bl_rigging_symmetrize.py b/tests/python/bl_rigging_symmetrize.py index 6531b4df85f..963be6d41d3 100644 --- a/tests/python/bl_rigging_symmetrize.py +++ b/tests/python/bl_rigging_symmetrize.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - """ blender -b -noaudio --factory-startup --python tests/python/bl_rigging_symmetrize.py -- --testdir /path/to/lib/tests/animation """ diff --git a/tests/python/bl_rna_manual_reference.py b/tests/python/bl_rna_manual_reference.py index 70f218f0bb2..257c8b7601a 100644 --- a/tests/python/bl_rna_manual_reference.py +++ b/tests/python/bl_rna_manual_reference.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Use for validating our manual interlinking. # ./blender.bin --background -noaudio --python tests/python/bl_rna_manual_reference.py # diff --git a/tests/python/bl_rst_completeness.py b/tests/python/bl_rst_completeness.py index 59e532c433b..4846e65b78f 100644 --- a/tests/python/bl_rst_completeness.py +++ b/tests/python/bl_rst_completeness.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # run this script in the game engine. # or on the command line with... # ./blender.bin --background -noaudio --python tests/python/bl_rst_completeness.py diff --git a/tests/python/bl_run_operators.py b/tests/python/bl_run_operators.py index 7e73ec163a4..a2478bd7547 100644 --- a/tests/python/bl_run_operators.py +++ b/tests/python/bl_run_operators.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # semi-useful script, runs all operators in a number of different # contexts, cheap way to find misc small bugs but is in no way a complete test. # diff --git a/tests/python/bl_run_operators_event_simulate.py b/tests/python/bl_run_operators_event_simulate.py index 56f96847d0b..d218e6b1bc0 100644 --- a/tests/python/bl_run_operators_event_simulate.py +++ b/tests/python/bl_run_operators_event_simulate.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - r""" Overview ======== diff --git a/tests/python/bl_test.py b/tests/python/bl_test.py index 7e79639a226..b71ebd2a7a7 100644 --- a/tests/python/bl_test.py +++ b/tests/python/bl_test.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import sys import os diff --git a/tests/python/bl_usd_import_test.py b/tests/python/bl_usd_import_test.py index 1ba9b4f1edf..95b2328b2aa 100644 --- a/tests/python/bl_usd_import_test.py +++ b/tests/python/bl_usd_import_test.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import pathlib import sys import unittest diff --git a/tests/python/boolean_operator.py b/tests/python/boolean_operator.py index fed0b2bddfd..8b93226ab93 100644 --- a/tests/python/boolean_operator.py +++ b/tests/python/boolean_operator.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # To run all tests, use # BLENDER_VERBOSE=1 blender path/to/bool_regression.blend --python path/to/boolean_operator.py -- --run-all-tests # To run one test, use diff --git a/tests/python/deform_modifiers.py b/tests/python/deform_modifiers.py index 40cd9d4839c..e5be133a3ef 100644 --- a/tests/python/deform_modifiers.py +++ b/tests/python/deform_modifiers.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # To run the test type: blender -b /path/to/the/blend/file --python path/to/this/py/file -- --run-all-tests -- --verbose # Type the above line in cmd/terminal, for example, look below # blender -b c:\blender-lib\deform_modifiers.blend --python c:\deform_modifiers.py -- --run-all-tests -- --verbose diff --git a/tests/python/ffmpeg_tests.py b/tests/python/ffmpeg_tests.py index abbe38193b5..b40b8030f7e 100644 --- a/tests/python/ffmpeg_tests.py +++ b/tests/python/ffmpeg_tests.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import argparse import pathlib import sys diff --git a/tests/python/geo_node_test.py b/tests/python/geo_node_test.py index 9d7c634db76..0842dd001da 100644 --- a/tests/python/geo_node_test.py +++ b/tests/python/geo_node_test.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import os import sys diff --git a/tests/python/modifiers.py b/tests/python/modifiers.py index 8f8b5c6498c..827cc80393a 100644 --- a/tests/python/modifiers.py +++ b/tests/python/modifiers.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import math import os import sys diff --git a/tests/python/modules/mesh_test.py b/tests/python/modules/mesh_test.py index 873ab779d65..5b01bfeee94 100644 --- a/tests/python/modules/mesh_test.py +++ b/tests/python/modules/mesh_test.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # A framework to run regression tests on mesh modifiers and operators based on howardt's mesh_ops_test.py # # General idea: diff --git a/tests/python/modules/test_utils.py b/tests/python/modules/test_utils.py index d5cd743cde9..6aba3a75263 100755 --- a/tests/python/modules/test_utils.py +++ b/tests/python/modules/test_utils.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import functools import shutil import pathlib diff --git a/tests/python/operators.py b/tests/python/operators.py index 6ccc96dba5d..548a2b50b05 100644 --- a/tests/python/operators.py +++ b/tests/python/operators.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import bpy import os import sys diff --git a/tests/python/pep8.py b/tests/python/pep8.py index 9a2871c9ed5..2583bec8256 100644 --- a/tests/python/pep8.py +++ b/tests/python/pep8.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8-80 compliant> - import os import subprocess import shutil @@ -22,7 +20,6 @@ import shutil # how many lines to read into the file, pep8 comment # should be directly after the license header, ~20 in most cases -PEP8_SEEK_COMMENT = 40 SKIP_PREFIX = "./tools", "./config", "./extern" SKIP_ADDONS = True FORCE_PEP8_ALL = False @@ -39,22 +36,8 @@ def is_pep8(path): print(path) if open(path, 'rb').read(3) == b'\xef\xbb\xbf': print("\nfile contains BOM, remove first 3 bytes: %r\n" % path) - - # templates don't have a header but should be pep8 - for d in ("presets", "templates_py", "examples"): - if ("%s%s%s" % (os.sep, d, os.sep)) in path: - return 1 - - f = open(path, 'r', encoding="utf8") - for _ in range(PEP8_SEEK_COMMENT): - line = f.readline() - if line.startswith("# <pep8"): - if line.startswith("# <pep8 compliant>"): - return 1 - elif line.startswith("# <pep8-80 compliant>"): - return 2 - f.close() - return 0 + # Currently all scripts assumed to be pep8. + return 1 def check_files_flake8(files): diff --git a/tests/python/physics_cloth.py b/tests/python/physics_cloth.py index e453b4dd68b..fbd33392371 100644 --- a/tests/python/physics_cloth.py +++ b/tests/python/physics_cloth.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import os import sys diff --git a/tests/python/physics_dynamic_paint.py b/tests/python/physics_dynamic_paint.py index 57b96ccffba..132c7b8c46d 100644 --- a/tests/python/physics_dynamic_paint.py +++ b/tests/python/physics_dynamic_paint.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import os import sys diff --git a/tests/python/physics_ocean.py b/tests/python/physics_ocean.py index 20d563f782b..54cf8d65a9d 100644 --- a/tests/python/physics_ocean.py +++ b/tests/python/physics_ocean.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import os import sys diff --git a/tests/python/physics_particle_instance.py b/tests/python/physics_particle_instance.py index 353c0d868c8..3cd52fd9fa0 100644 --- a/tests/python/physics_particle_instance.py +++ b/tests/python/physics_particle_instance.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import os import sys diff --git a/tests/python/physics_particle_system.py b/tests/python/physics_particle_system.py index 37e3df781b0..51afae68a7b 100644 --- a/tests/python/physics_particle_system.py +++ b/tests/python/physics_particle_system.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import os import sys import bpy diff --git a/tests/python/physics_softbody.py b/tests/python/physics_softbody.py index 00d2a637cf7..ebb9fbb724f 100644 --- a/tests/python/physics_softbody.py +++ b/tests/python/physics_softbody.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import os import sys diff --git a/tests/python/rna_info_dump.py b/tests/python/rna_info_dump.py index afedf670f2f..af00ef54de9 100644 --- a/tests/python/rna_info_dump.py +++ b/tests/python/rna_info_dump.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Used for generating API diffs between releases # ./blender.bin --background -noaudio --python tests/python/rna_info_dump.py diff --git a/tests/python/rst_to_doctree_mini.py b/tests/python/rst_to_doctree_mini.py index 3466c915aa0..43116922fe5 100644 --- a/tests/python/rst_to_doctree_mini.py +++ b/tests/python/rst_to_doctree_mini.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Module with function to extract a doctree from an reStructuredText file. # Named 'Mini' because we only parse the minimum data needed to check # Python classes, methods and attributes match up to those in existing modules. |