From bab9de2a52929fe2b45ecddb1eb09da3378e303b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 2 Oct 2020 10:10:01 +1000 Subject: [PATCH] Cleanup: pep8, blank lines --- build_files/buildbot/buildbot_utils.py | 2 + build_files/buildbot/worker_compile.py | 6 +++ build_files/buildbot/worker_pack.py | 4 ++ build_files/buildbot/worker_test.py | 3 ++ build_files/cmake/clang_array_check.py | 2 + .../cmake/cmake_print_build_options.py | 1 + .../cmake/example_scripts/make_quicky.py | 1 + build_files/cmake/project_source_info.py | 1 + build_files/utils/make_test.py | 2 + build_files/utils/make_update.py | 6 +++ build_files/utils/make_utils.py | 7 ++++ doc/python_api/sphinx_doc_gen.py | 1 + intern/cycles/blender/addon/engine.py | 3 ++ intern/cycles/blender/addon/operators.py | 1 + intern/cycles/blender/addon/properties.py | 6 ++- release/datafiles/blender_icons_geom.py | 1 + release/datafiles/blender_icons_update.py | 2 + .../modules/freestyle/chainingiterators.py | 4 ++ .../freestyle/modules/parameter_editor.py | 35 ++++++++++++++++- .../bl_keymap_utils/keymap_from_toolbar.py | 4 +- .../bl_keymap_utils/keymap_hierarchy.py | 1 + release/scripts/modules/bpy/utils/__init__.py | 1 - .../modules/bpy_extras/keyconfig_utils.py | 1 + .../modules/bpy_extras/node_shader_utils.py | 38 ++----------------- release/scripts/modules/bpy_types.py | 1 + .../scripts/presets/keyconfig/blender_27x.py | 3 +- .../keyconfig/keymap_data/blender_default.py | 3 ++ .../2D_Animation/__init__.py | 1 + .../scripts/startup/bl_operators/object.py | 1 - .../startup/bl_operators/simulation.py | 2 + .../scripts/startup/bl_operators/userpref.py | 3 ++ release/scripts/startup/bl_operators/wm.py | 1 - .../startup/bl_ui/properties_constraint.py | 7 ++-- .../startup/bl_ui/properties_data_camera.py | 1 + .../startup/bl_ui/properties_paint_common.py | 2 + .../startup/bl_ui/properties_particle.py | 1 - .../bl_ui/properties_physics_common.py | 1 + .../startup/bl_ui/properties_physics_fluid.py | 2 + .../startup/bl_ui/properties_view_layer.py | 1 + .../startup/bl_ui/space_filebrowser.py | 1 - .../startup/bl_ui/space_toolsystem_toolbar.py | 1 - .../scripts/startup/bl_ui/space_userpref.py | 3 ++ release/scripts/startup/bl_ui/space_view3d.py | 5 ++- .../startup/bl_ui/space_view3d_toolbar.py | 5 +-- release/scripts/startup/nodeitems_builtins.py | 2 + release/windows/msix/create_msix_package.py | 2 +- tests/python/bl_animation_fcurves.py | 1 + tests/python/bl_blendfile_io.py | 1 - tests/python/bl_blendfile_liblink.py | 1 - tests/python/cycles_render_tests.py | 1 + tests/python/eevee_render_tests.py | 1 + tests/python/modules/global_report.py | 1 + tests/python/modules/mesh_test.py | 2 +- tests/python/modules/render_report.py | 1 + 54 files changed, 132 insertions(+), 59 deletions(-) diff --git a/build_files/buildbot/buildbot_utils.py b/build_files/buildbot/buildbot_utils.py index a0c33155da1..919b197b380 100644 --- a/build_files/buildbot/buildbot_utils.py +++ b/build_files/buildbot/buildbot_utils.py @@ -24,6 +24,7 @@ import re import subprocess import sys + def is_tool(name): """Check whether `name` is on PATH and marked as executable.""" @@ -32,6 +33,7 @@ def is_tool(name): return which(name) is not None + class Builder: def __init__(self, name, branch, codesign): self.name = name diff --git a/build_files/buildbot/worker_compile.py b/build_files/buildbot/worker_compile.py index 8e19c9436f8..e569a1cf568 100644 --- a/build_files/buildbot/worker_compile.py +++ b/build_files/buildbot/worker_compile.py @@ -23,6 +23,7 @@ import shutil import buildbot_utils + def get_cmake_options(builder): codesign_script = os.path.join( builder.blender_dir, 'build_files', 'buildbot', 'worker_codesign.cmake') @@ -49,6 +50,7 @@ def get_cmake_options(builder): return options + def update_git(builder): # Do extra git fetch because not all platform/git/buildbot combinations # update the origin remote, causing buildinfo to detect local changes. @@ -58,6 +60,7 @@ def update_git(builder): command = ['git', 'fetch', '--all'] buildbot_utils.call(builder.command_prefix + command) + def clean_directories(builder): # Make sure no garbage remained from the previous run if os.path.isdir(builder.install_dir): @@ -73,6 +76,7 @@ def clean_directories(builder): print("Removing {}" . format(buildinfo)) os.remove(full_path) + def cmake_configure(builder): # CMake configuration os.chdir(builder.build_dir) @@ -87,6 +91,7 @@ def cmake_configure(builder): command = ['cmake', builder.blender_dir] + cmake_options buildbot_utils.call(builder.command_prefix + command) + def cmake_build(builder): # CMake build os.chdir(builder.build_dir) @@ -109,6 +114,7 @@ def cmake_build(builder): print("CMake build:") buildbot_utils.call(builder.command_prefix + command) + if __name__ == "__main__": builder = buildbot_utils.create_builder_from_arguments() update_git(builder) diff --git a/build_files/buildbot/worker_pack.py b/build_files/buildbot/worker_pack.py index 96c8db8e6c8..82b406cd42d 100644 --- a/build_files/buildbot/worker_pack.py +++ b/build_files/buildbot/worker_pack.py @@ -29,6 +29,7 @@ from pathlib import Path import buildbot_utils + def get_package_name(builder, platform=None): info = buildbot_utils.VersionInfo(builder) @@ -41,6 +42,7 @@ def get_package_name(builder, platform=None): return package_name + def sign_file_or_directory(path): from codesign.simple_code_signer import SimpleCodeSigner code_signer = SimpleCodeSigner() @@ -64,6 +66,7 @@ def create_buildbot_upload_zip(builder, package_files): sys.stderr.write('Create buildbot_upload.zip failed: ' + str(ex) + '\n') sys.exit(1) + def create_tar_xz(src, dest, package_name): # One extra to remove leading os.sep when cleaning root for package_root ln = len(src) + 1 @@ -91,6 +94,7 @@ def create_tar_xz(src, dest, package_name): package.add(entry[0], entry[1], recursive=False, filter=_fakeroot) package.close() + def cleanup_files(dirpath, extension): for f in os.listdir(dirpath): filepath = os.path.join(dirpath, f) diff --git a/build_files/buildbot/worker_test.py b/build_files/buildbot/worker_test.py index b959568a5c6..db02801007e 100644 --- a/build_files/buildbot/worker_test.py +++ b/build_files/buildbot/worker_test.py @@ -22,18 +22,21 @@ import buildbot_utils import os import sys + def get_ctest_arguments(builder): args = ['--output-on-failure'] if builder.platform == 'win': args += ['-C', 'Release'] return args + def test(builder): os.chdir(builder.build_dir) command = builder.command_prefix + ['ctest'] + get_ctest_arguments(builder) buildbot_utils.call(command) + if __name__ == "__main__": builder = buildbot_utils.create_builder_from_arguments() test(builder) diff --git a/build_files/cmake/clang_array_check.py b/build_files/cmake/clang_array_check.py index de0b55c70e0..2456f099640 100644 --- a/build_files/cmake/clang_array_check.py +++ b/build_files/cmake/clang_array_check.py @@ -355,6 +355,8 @@ def recursive_arg_sizes(node, ): # print("adding", node.spelling) for c in node.get_children(): recursive_arg_sizes(c) + + # cache function sizes recursive_arg_sizes(tu.cursor) _defs.update(defs_precalc) diff --git a/build_files/cmake/cmake_print_build_options.py b/build_files/cmake/cmake_print_build_options.py index fb7a5b33bf0..e41a1d2f873 100644 --- a/build_files/cmake/cmake_print_build_options.py +++ b/build_files/cmake/cmake_print_build_options.py @@ -8,6 +8,7 @@ import sys cmakelists_file = sys.argv[-1] + def main(): options = [] for l in open(cmakelists_file, 'r').readlines(): diff --git a/build_files/cmake/example_scripts/make_quicky.py b/build_files/cmake/example_scripts/make_quicky.py index a1334d6fc83..51985e930ae 100755 --- a/build_files/cmake/example_scripts/make_quicky.py +++ b/build_files/cmake/example_scripts/make_quicky.py @@ -114,5 +114,6 @@ def main(): import subprocess subprocess.call(cmd) + if __name__ == "__main__": main() diff --git a/build_files/cmake/project_source_info.py b/build_files/cmake/project_source_info.py index f8067c216fd..83cc979ca30 100644 --- a/build_files/cmake/project_source_info.py +++ b/build_files/cmake/project_source_info.py @@ -242,5 +242,6 @@ def main(): for s in build_info(): print(s) + if __name__ == "__main__": main() diff --git a/build_files/utils/make_test.py b/build_files/utils/make_test.py index 15bd6dde352..7f15195f8f9 100755 --- a/build_files/utils/make_test.py +++ b/build_files/utils/make_test.py @@ -12,6 +12,7 @@ from make_utils import call # Parse arguments + def parse_arguments(): parser = argparse.ArgumentParser() parser.add_argument("--ctest-command", default="ctest") @@ -22,6 +23,7 @@ def parse_arguments(): parser.add_argument("build_directory") return parser.parse_args() + args = parse_arguments() git_command = args.git_command svn_command = args.svn_command diff --git a/build_files/utils/make_update.py b/build_files/utils/make_update.py index 324bb6944bf..ae7269b07cd 100755 --- a/build_files/utils/make_update.py +++ b/build_files/utils/make_update.py @@ -14,12 +14,15 @@ import sys import make_utils from make_utils import call, check_output + def print_stage(text): print("") print(text) print("") # Parse arguments + + def parse_arguments(): parser = argparse.ArgumentParser() parser.add_argument("--no-libraries", action="store_true") @@ -31,10 +34,13 @@ def parse_arguments(): parser.add_argument("--use-centos-libraries", action="store_true") return parser.parse_args() + def get_blender_git_root(): return check_output([args.git_command, "rev-parse", "--show-toplevel"]) # Setup for precompiled libraries and tests from svn. + + def svn_update(args, release_version): svn_non_interactive = [args.svn_command, '--non-interactive'] diff --git a/build_files/utils/make_utils.py b/build_files/utils/make_utils.py index e94c8e3550a..ce87bdd46e4 100755 --- a/build_files/utils/make_utils.py +++ b/build_files/utils/make_utils.py @@ -7,6 +7,7 @@ import shutil import subprocess import sys + def call(cmd, exit_on_error=True): print(" ".join(cmd)) @@ -19,6 +20,7 @@ def call(cmd, exit_on_error=True): sys.exit(retcode) return retcode + def check_output(cmd, exit_on_error=True): # Flush to ensure correct order output on Windows. sys.stdout.flush() @@ -35,6 +37,7 @@ def check_output(cmd, exit_on_error=True): return output.strip() + def git_branch(git_command): # Get current branch name. try: @@ -45,6 +48,7 @@ def git_branch(git_command): return branch.strip().decode('utf8') + def git_tag(git_command): # Get current tag name. try: @@ -54,6 +58,7 @@ def git_tag(git_command): return tag.strip().decode('utf8') + def git_branch_release_version(branch, tag): release_version = re.search("^blender-v(.*)-release$", branch) if release_version: @@ -64,6 +69,7 @@ def git_branch_release_version(branch, tag): release_version = release_version.group(1) return release_version + def svn_libraries_base_url(release_version): if release_version: svn_branch = "tags/blender-" + release_version + "-release" @@ -71,6 +77,7 @@ def svn_libraries_base_url(release_version): svn_branch = "trunk" return "https://svn.blender.org/svnroot/bf-blender/" + svn_branch + "/lib/" + def command_missing(command): # Support running with Python 2 for macOS if sys.version_info >= (3, 0): diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index ed1663582b9..0a63949145a 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -99,6 +99,7 @@ SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) # See: D6261 for reference. USE_ONLY_BUILTIN_RNA_TYPES = True + def handle_args(): ''' Parse the args passed to Blender after "--", ignored by Blender diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py index 67e448db859..a50b733eda2 100644 --- a/intern/cycles/blender/addon/engine.py +++ b/intern/cycles/blender/addon/engine.py @@ -224,6 +224,7 @@ def system_info(): import _cycles return _cycles.system_info() + def list_render_passes(scene, srl): # Builtin Blender passes. yield ("Combined", "RGBA", 'COLOR') @@ -298,6 +299,7 @@ def list_render_passes(scene, srl): else: yield (aov.name, "RGBA", 'COLOR') + def register_passes(engine, scene, view_layer): # Detect duplicate render pass names, first one wins. listed = set() @@ -306,6 +308,7 @@ def register_passes(engine, scene, view_layer): engine.register_pass(scene, view_layer, name, len(channelids), channelids, channeltype) listed.add(name) + def detect_conflicting_passes(scene, view_layer): # Detect conflicting render pass names for UI. counter = {} diff --git a/intern/cycles/blender/addon/operators.py b/intern/cycles/blender/addon/operators.py index 3c8e79eaba5..895e1a83c66 100644 --- a/intern/cycles/blender/addon/operators.py +++ b/intern/cycles/blender/addon/operators.py @@ -203,6 +203,7 @@ classes = ( CYCLES_OT_merge_images ) + def register(): from bpy.utils import register_class for cls in classes: diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 45d25720aff..3d4dafb43ad 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -188,11 +188,13 @@ def enum_openimagedenoise_denoiser(self, context): return [('OPENIMAGEDENOISE', "OpenImageDenoise", "Use Intel OpenImageDenoise AI denoiser running on the CPU", 4)] return [] + def enum_optix_denoiser(self, context): if not context or bool(context.preferences.addons[__package__].preferences.get_devices_for_type('OPTIX')): return [('OPTIX', "OptiX", "Use the OptiX AI denoiser with GPU acceleration, only available on NVIDIA GPUs", 2)] return [] + def enum_preview_denoiser(self, context): optix_items = enum_optix_denoiser(self, context) oidn_items = enum_openimagedenoise_denoiser(self, context) @@ -206,12 +208,14 @@ def enum_preview_denoiser(self, context): items += oidn_items return items + def enum_denoiser(self, context): items = [('NLM', "NLM", "Cycles native non-local means denoiser, running on any compute device", 1)] items += enum_optix_denoiser(self, context) items += enum_openimagedenoise_denoiser(self, context) return items + enum_denoising_input_passes = ( ('RGB', "Color", "Use only color as input", 1), ('RGB_ALBEDO', "Color + Albedo", "Use color and albedo data as input", 2), @@ -1325,6 +1329,7 @@ class CyclesAOVPass(bpy.types.PropertyGroup): default="" ) + class CyclesRenderLayerSettings(bpy.types.PropertyGroup): pass_debug_bvh_traversed_nodes: BoolProperty( @@ -1644,7 +1649,6 @@ class CyclesPreferences(bpy.types.AddonPreferences): col.label(text="OptiX support is experimental", icon='INFO') col.label(text="Not all Cycles features are supported yet", icon='BLANK1') - def draw_impl(self, layout, context): row = layout.row() row.prop(self, "compute_device_type", expand=True) diff --git a/release/datafiles/blender_icons_geom.py b/release/datafiles/blender_icons_geom.py index b2f029ee511..82d4f813062 100644 --- a/release/datafiles/blender_icons_geom.py +++ b/release/datafiles/blender_icons_geom.py @@ -45,6 +45,7 @@ import bpy # Generic functions + def area_tri_signed_2x_v2(v1, v2, v3): return (v1[0] - v2[0]) * (v2[1] - v3[1]) + (v1[1] - v2[1]) * (v3[0] - v2[0]) diff --git a/release/datafiles/blender_icons_update.py b/release/datafiles/blender_icons_update.py index c3b1e36f7fd..ed96afd7ea6 100755 --- a/release/datafiles/blender_icons_update.py +++ b/release/datafiles/blender_icons_update.py @@ -5,10 +5,12 @@ import os import subprocess import sys + def run(cmd): print(" ", " ".join(cmd)) subprocess.check_call(cmd) + BASEDIR = os.path.abspath(os.path.dirname(__file__)) inkscape_bin = os.environ.get("INKSCAPE_BIN", "inkscape") diff --git a/release/scripts/freestyle/modules/freestyle/chainingiterators.py b/release/scripts/freestyle/modules/freestyle/chainingiterators.py index 22606b1402c..990a97db3f2 100644 --- a/release/scripts/freestyle/modules/freestyle/chainingiterators.py +++ b/release/scripts/freestyle/modules/freestyle/chainingiterators.py @@ -88,6 +88,7 @@ class pyChainSilhouetteIterator(ChainingIterator): silhouettes, then borders, then suggestive contours, then all other edge types. A ViewEdge is only chained once. """ + def __init__(self, stayInSelection=True): ChainingIterator.__init__(self, stayInSelection, True, None, True) @@ -279,6 +280,7 @@ class pySketchyChainingIterator(ChainingIterator): ViewEdge several times in order to produce multiple strokes per ViewEdge. """ + def __init__(self, nRounds=3, stayInSelection=True): ChainingIterator.__init__(self, stayInSelection, False, None, True) self._timeStamp = CF.get_time_stamp() + nRounds @@ -396,6 +398,7 @@ class pyFillOcclusionsAbsoluteChainingIterator(ChainingIterator): :arg length: The maximum length of the occluded part in pixels. :type length: int """ + def __init__(self, length): ChainingIterator.__init__(self, False, True, None, True) self._length = float(length) @@ -530,6 +533,7 @@ class pyFillQi0AbsoluteAndRelativeChainingIterator(ChainingIterator): :arg l: Absolute length. :type l: float """ + def __init__(self, percent, l): ChainingIterator.__init__(self, False, True, None, True) self._length = 0.0 diff --git a/release/scripts/freestyle/modules/parameter_editor.py b/release/scripts/freestyle/modules/parameter_editor.py index 534ee7d65be..0b8ccf387fd 100644 --- a/release/scripts/freestyle/modules/parameter_editor.py +++ b/release/scripts/freestyle/modules/parameter_editor.py @@ -128,6 +128,7 @@ callbacks_lineset_post = [] class ColorRampModifier(StrokeShader): """Primitive for the color modifiers.""" + def __init__(self, blend, influence, ramp): StrokeShader.__init__(self) self.blend = blend @@ -144,6 +145,7 @@ class ColorRampModifier(StrokeShader): class ScalarBlendModifier(StrokeShader): """Primitive for alpha and thickness modifiers.""" + def __init__(self, blend_type, influence): StrokeShader.__init__(self) self.blend_type = blend_type @@ -304,6 +306,7 @@ class BaseThicknessShader(StrokeShader, ThicknessModifierMixIn): class ColorAlongStrokeShader(ColorRampModifier): """Maps a ramp to the color of the stroke, using the curvilinear abscissa (t).""" + def shade(self, stroke): for svert, t in zip(stroke, iter_t2d_along_stroke(stroke)): a = svert.attribute.color @@ -313,6 +316,7 @@ class ColorAlongStrokeShader(ColorRampModifier): class AlphaAlongStrokeShader(CurveMappingModifier): """Maps a curve to the alpha/transparency of the stroke, using the curvilinear abscissa (t).""" + def shade(self, stroke): for svert, t in zip(stroke, iter_t2d_along_stroke(stroke)): a = svert.attribute.alpha @@ -322,6 +326,7 @@ class AlphaAlongStrokeShader(CurveMappingModifier): class ThicknessAlongStrokeShader(ThicknessBlenderMixIn, CurveMappingModifier): """Maps a curve to the thickness of the stroke, using the curvilinear abscissa (t).""" + def __init__(self, thickness_position, thickness_ratio, blend, influence, mapping, invert, curve, value_min, value_max): ThicknessBlenderMixIn.__init__(self, thickness_position, thickness_ratio) @@ -338,6 +343,7 @@ class ThicknessAlongStrokeShader(ThicknessBlenderMixIn, CurveMappingModifier): class ColorDistanceFromCameraShader(ColorRampModifier): """Picks a color value from a ramp based on the vertex' distance from the camera.""" + def __init__(self, blend, influence, ramp, range_min, range_max): ColorRampModifier.__init__(self, blend, influence, ramp) self.range = BoundedProperty(range_min, range_max) @@ -352,6 +358,7 @@ class ColorDistanceFromCameraShader(ColorRampModifier): class AlphaDistanceFromCameraShader(CurveMappingModifier): """Picks an alpha value from a curve based on the vertex' distance from the camera""" + def __init__(self, blend, influence, mapping, invert, curve, range_min, range_max): CurveMappingModifier.__init__(self, blend, influence, mapping, invert, curve) self.range = BoundedProperty(range_min, range_max) @@ -366,6 +373,7 @@ class AlphaDistanceFromCameraShader(CurveMappingModifier): class ThicknessDistanceFromCameraShader(ThicknessBlenderMixIn, CurveMappingModifier): """Picks a thickness value from a curve based on the vertex' distance from the camera.""" + def __init__(self, thickness_position, thickness_ratio, blend, influence, mapping, invert, curve, range_min, range_max, value_min, value_max): ThicknessBlenderMixIn.__init__(self, thickness_position, thickness_ratio) @@ -383,6 +391,7 @@ class ThicknessDistanceFromCameraShader(ThicknessBlenderMixIn, CurveMappingModif class ColorDistanceFromObjectShader(ColorRampModifier): """Picks a color value from a ramp based on the vertex' distance from a given object.""" + def __init__(self, blend, influence, ramp, target, range_min, range_max): ColorRampModifier.__init__(self, blend, influence, ramp) if target is None: @@ -403,6 +412,7 @@ class ColorDistanceFromObjectShader(ColorRampModifier): class AlphaDistanceFromObjectShader(CurveMappingModifier): """Picks an alpha value from a curve based on the vertex' distance from a given object.""" + def __init__(self, blend, influence, mapping, invert, curve, target, range_min, range_max): CurveMappingModifier.__init__(self, blend, influence, mapping, invert, curve) if target is None: @@ -423,6 +433,7 @@ class AlphaDistanceFromObjectShader(CurveMappingModifier): class ThicknessDistanceFromObjectShader(ThicknessBlenderMixIn, CurveMappingModifier): """Picks a thickness value from a curve based on the vertex' distance from a given object.""" + def __init__(self, thickness_position, thickness_ratio, blend, influence, mapping, invert, curve, target, range_min, range_max, value_min, value_max): ThicknessBlenderMixIn.__init__(self, thickness_position, thickness_ratio) @@ -446,6 +457,7 @@ class ThicknessDistanceFromObjectShader(ThicknessBlenderMixIn, CurveMappingModif # Material modifiers class ColorMaterialShader(ColorRampModifier): """Assigns a color to the vertices based on their underlying material.""" + def __init__(self, blend, influence, ramp, material_attribute, use_ramp): ColorRampModifier.__init__(self, blend, influence, ramp) self.attribute = material_attribute @@ -474,6 +486,7 @@ class ColorMaterialShader(ColorRampModifier): class AlphaMaterialShader(CurveMappingModifier): """Assigns an alpha value to the vertices based on their underlying material.""" + def __init__(self, blend, influence, mapping, invert, curve, material_attribute): CurveMappingModifier.__init__(self, blend, influence, mapping, invert, curve) self.attribute = material_attribute @@ -488,6 +501,7 @@ class AlphaMaterialShader(CurveMappingModifier): class ThicknessMaterialShader(ThicknessBlenderMixIn, CurveMappingModifier): """Assigns a thickness value to the vertices based on their underlying material.""" + def __init__(self, thickness_position, thickness_ratio, blend, influence, mapping, invert, curve, material_attribute, value_min, value_max): ThicknessBlenderMixIn.__init__(self, thickness_position, thickness_ratio) @@ -506,6 +520,7 @@ class ThicknessMaterialShader(ThicknessBlenderMixIn, CurveMappingModifier): class CalligraphicThicknessShader(ThicknessBlenderMixIn, ScalarBlendModifier): """Thickness modifier for achieving a calligraphy-like effect.""" + def __init__(self, thickness_position, thickness_ratio, blend_type, influence, orientation, thickness_min, thickness_max): ThicknessBlenderMixIn.__init__(self, thickness_position, thickness_ratio) @@ -531,6 +546,7 @@ class CalligraphicThicknessShader(ThicknessBlenderMixIn, ScalarBlendModifier): class TangentColorShader(ColorRampModifier): """Color based on the direction of the stroke""" + def shade(self, stroke): it = Interface0DIterator(stroke) for svert in it: @@ -542,6 +558,7 @@ class TangentColorShader(ColorRampModifier): class TangentAlphaShader(CurveMappingModifier): """Alpha transparency based on the direction of the stroke""" + def shade(self, stroke): it = Interface0DIterator(stroke) for svert in it: @@ -553,6 +570,7 @@ class TangentAlphaShader(CurveMappingModifier): class TangentThicknessShader(ThicknessBlenderMixIn, CurveMappingModifier): """Thickness based on the direction of the stroke""" + def __init__(self, thickness_position, thickness_ratio, blend, influence, mapping, invert, curve, thickness_min, thickness_max): ThicknessBlenderMixIn.__init__(self, thickness_position, thickness_ratio) @@ -571,6 +589,7 @@ class TangentThicknessShader(ThicknessBlenderMixIn, CurveMappingModifier): class NoiseShader: """Base class for noise shaders""" + def __init__(self, amplitude, period, seed=512): self.amplitude = amplitude self.scale = 1 / period / seed @@ -605,6 +624,7 @@ class ThicknessNoiseShader(ThicknessBlenderMixIn, ScalarBlendModifier, NoiseShad class ColorNoiseShader(ColorRampModifier, NoiseShader): """Color based on pseudo-noise""" + def __init__(self, blend, influence, ramp, amplitude, period, seed=512): ColorRampModifier.__init__(self, blend, influence, ramp) NoiseShader.__init__(self, amplitude, period, seed) @@ -617,6 +637,7 @@ class ColorNoiseShader(ColorRampModifier, NoiseShader): class AlphaNoiseShader(CurveMappingModifier, NoiseShader): """Alpha transparency on based pseudo-noise""" + def __init__(self, blend, influence, mapping, invert, curve, amplitude, period, seed=512): CurveMappingModifier.__init__(self, blend, influence, mapping, invert, curve) NoiseShader.__init__(self, amplitude, period, seed) @@ -641,6 +662,7 @@ def crease_angle(svert): class CreaseAngleColorShader(ColorRampModifier): """Color based on the crease angle between two adjacent faces on the underlying geometry""" + def __init__(self, blend, influence, ramp, angle_min, angle_max): ColorRampModifier.__init__(self, blend, influence, ramp) # angles are (already) in radians @@ -657,6 +679,7 @@ class CreaseAngleColorShader(ColorRampModifier): class CreaseAngleAlphaShader(CurveMappingModifier): """Alpha transparency based on the crease angle between two adjacent faces on the underlying geometry""" + def __init__(self, blend, influence, mapping, invert, curve, angle_min, angle_max): CurveMappingModifier.__init__(self, blend, influence, mapping, invert, curve) # angles are (already) in radians @@ -673,6 +696,7 @@ class CreaseAngleAlphaShader(CurveMappingModifier): class CreaseAngleThicknessShader(ThicknessBlenderMixIn, CurveMappingModifier): """Thickness based on the crease angle between two adjacent faces on the underlying geometry""" + def __init__(self, thickness_position, thickness_ratio, blend, influence, mapping, invert, curve, angle_min, angle_max, thickness_min, thickness_max): ThicknessBlenderMixIn.__init__(self, thickness_position, thickness_ratio) @@ -709,6 +733,7 @@ def normalized_absolute_curvature(svert, bounded_curvature): class Curvature3DColorShader(ColorRampModifier): """Color based on the 3D curvature of the underlying geometry""" + def __init__(self, blend, influence, ramp, curvature_min, curvature_max): ColorRampModifier.__init__(self, blend, influence, ramp) self.curvature = BoundedProperty(curvature_min, curvature_max) @@ -723,6 +748,7 @@ class Curvature3DColorShader(ColorRampModifier): class Curvature3DAlphaShader(CurveMappingModifier): """Alpha based on the 3D curvature of the underlying geometry""" + def __init__(self, blend, influence, mapping, invert, curve, curvature_min, curvature_max): CurveMappingModifier.__init__(self, blend, influence, mapping, invert, curve) self.curvature = BoundedProperty(curvature_min, curvature_max) @@ -737,6 +763,7 @@ class Curvature3DAlphaShader(CurveMappingModifier): class Curvature3DThicknessShader(ThicknessBlenderMixIn, CurveMappingModifier): """Alpha based on the 3D curvature of the underlying geometry""" + def __init__(self, thickness_position, thickness_ratio, blend, influence, mapping, invert, curve, curvature_min, curvature_max, thickness_min, thickness_max): ThicknessBlenderMixIn.__init__(self, thickness_position, thickness_ratio) @@ -744,7 +771,6 @@ class Curvature3DThicknessShader(ThicknessBlenderMixIn, CurveMappingModifier): self.curvature = BoundedProperty(curvature_min, curvature_max) self.thickness = BoundedProperty(thickness_min, thickness_max) - def shade(self, stroke): for svert in stroke: t = normalized_absolute_curvature(svert, self.curvature) @@ -756,6 +782,7 @@ class Curvature3DThicknessShader(ThicknessBlenderMixIn, CurveMappingModifier): class SimplificationShader(StrokeShader): """Simplifies a stroke by merging points together""" + def __init__(self, tolerance): StrokeShader.__init__(self) self.tolerance = tolerance @@ -774,6 +801,7 @@ class SimplificationShader(StrokeShader): class SinusDisplacementShader(StrokeShader): """Displaces the stroke in a sine wave-like shape.""" + def __init__(self, wavelength, amplitude, phase): StrokeShader.__init__(self) self.wavelength = wavelength @@ -797,6 +825,7 @@ class PerlinNoise1DShader(StrokeShader): that lines with the same length and sampling interval will be identically distorded. """ + def __init__(self, freq=10, amp=10, oct=4, angle=radians(45), seed=-1): StrokeShader.__init__(self) self.noise = Noise(seed) @@ -821,6 +850,7 @@ class PerlinNoise2DShader(StrokeShader): More information on the noise shaders can be found at: freestyleintegration.wordpress.com/2011/09/25/development-updates-on-september-25/ """ + def __init__(self, freq=10, amp=10, oct=4, angle=radians(45), seed=-1): StrokeShader.__init__(self) self.noise = Noise(seed) @@ -839,6 +869,7 @@ class PerlinNoise2DShader(StrokeShader): class Offset2DShader(StrokeShader): """Offsets the stroke by a given amount.""" + def __init__(self, start, end, x, y): StrokeShader.__init__(self) self.start = start @@ -856,6 +887,7 @@ class Offset2DShader(StrokeShader): class Transform2DShader(StrokeShader): """Transforms the stroke (scale, rotation, location) around a given pivot point """ + def __init__(self, pivot, scale_x, scale_y, angle, pivot_u, pivot_x, pivot_y): StrokeShader.__init__(self) self.pivot = pivot @@ -1168,6 +1200,7 @@ class Seed: return self.t return seed + _seed = Seed() 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 505223872fe..e18cca7fe25 100644 --- a/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py +++ b/release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py @@ -25,6 +25,7 @@ __all__ = ( "generate", ) + def generate(context, space_type, use_fallback_keys=True, use_reset=True): """ Keymap for popup toolbar, currently generated each time. @@ -110,7 +111,6 @@ def generate(context, space_type, use_fallback_keys=True, use_reset=True): del keymap_src del items_all_id - kmi_unique_args = set() def kmi_unique_or_pass(kmi_args): @@ -118,7 +118,6 @@ def generate(context, space_type, use_fallback_keys=True, use_reset=True): kmi_unique_args.add(dict_as_tuple(kmi_args)) return kmi_unique_len != len(kmi_unique_args) - cls = ToolSelectPanelHelper._tool_class_from_space_type(space_type) if use_hack_properties: @@ -405,7 +404,6 @@ def generate(context, space_type, use_fallback_keys=True, use_reset=True): kmi.properties.name = item.idname kmi_unique_args.add(kmi_tuple) - # --------------------- # End Keymap Generation diff --git a/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py b/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py index 3b829de405a..52b9f1601d5 100644 --- a/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py +++ b/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py @@ -22,6 +22,7 @@ __all__ = ( "generate", ) + def _km_expand_from_toolsystem(space_type, context_mode): def _fn(): from bl_ui.space_toolsystem_common import ToolSelectPanelHelper diff --git a/release/scripts/modules/bpy/utils/__init__.py b/release/scripts/modules/bpy/utils/__init__.py index 4e0220ee1cc..3ff259e0e3e 100644 --- a/release/scripts/modules/bpy/utils/__init__.py +++ b/release/scripts/modules/bpy/utils/__init__.py @@ -847,7 +847,6 @@ def register_tool(tool_cls, *, after=None, separator=False, group=False): # Create a new group tool_converted = (tool_converted,) - tool_def_insert = ( (None, tool_converted) if separator else (tool_converted,) diff --git a/release/scripts/modules/bpy_extras/keyconfig_utils.py b/release/scripts/modules/bpy_extras/keyconfig_utils.py index 8eea2ede425..3d1b087094b 100644 --- a/release/scripts/modules/bpy_extras/keyconfig_utils.py +++ b/release/scripts/modules/bpy_extras/keyconfig_utils.py @@ -51,6 +51,7 @@ def addon_keymap_register(keymap_data): kmap = kconf.keymaps.new(km_name, **km_args) keymap_init_from_data(kmap, km_content["items"], is_modal=km_modal) + def addon_keymap_unregister(keymap_data): """ Unregister a set of keymaps for addons. diff --git a/release/scripts/modules/bpy_extras/node_shader_utils.py b/release/scripts/modules/bpy_extras/node_shader_utils.py index bcb8adff910..5ddb42e49fc 100644 --- a/release/scripts/modules/bpy_extras/node_shader_utils.py +++ b/release/scripts/modules/bpy_extras/node_shader_utils.py @@ -36,12 +36,15 @@ def _set_check(func): return func(self, *args, **kwargs) return wrapper + def rgb_to_rgba(rgb): return list(rgb) + [1.0] + def rgba_to_rgb(rgba): return Color((rgba[0], rgba[1], rgba[2])) + # All clamping value shall follow Blender's defined min/max (check relevant node definition .c file). def values_clamp(val, minv, maxv): if hasattr(val, "__iter__"): @@ -110,7 +113,6 @@ class ShaderWrapper(): self._textures = {} self._grid_locations = set() - def use_nodes_get(self): return self.material.use_nodes @@ -121,7 +123,6 @@ class ShaderWrapper(): use_nodes = property(use_nodes_get, use_nodes_set) - def node_texcoords_get(self): if not self.use_nodes: return None @@ -173,7 +174,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): def __init__(self, material, is_readonly=True, use_nodes=True): super(PrincipledBSDFWrapper, self).__init__(material, is_readonly, use_nodes) - def update(self): super(PrincipledBSDFWrapper, self).update() @@ -234,7 +234,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): # Tex Coords, lazy initialization... self._node_texcoords = ... - def node_normalmap_get(self): if not self.use_nodes or self.node_principled_bsdf is None: return None @@ -263,7 +262,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): node_normalmap = property(node_normalmap_get) - # -------------------------------------------------------------------- # Base Color. @@ -282,7 +280,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): base_color = property(base_color_get, base_color_set) - def base_color_texture_get(self): if not self.use_nodes or self.node_principled_bsdf is None: return None @@ -294,7 +291,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): base_color_texture = property(base_color_texture_get) - # -------------------------------------------------------------------- # Specular. @@ -312,7 +308,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): specular = property(specular_get, specular_set) - def specular_tint_get(self): if not self.use_nodes or self.node_principled_bsdf is None: return 0.0 @@ -326,7 +321,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): specular_tint = property(specular_tint_get, specular_tint_set) - # Will only be used as gray-scale one... def specular_texture_get(self): if not self.use_nodes or self.node_principled_bsdf is None: @@ -341,7 +335,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): specular_texture = property(specular_texture_get) - # -------------------------------------------------------------------- # Roughness (also sort of inverse of specular hardness...). @@ -359,7 +352,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): roughness = property(roughness_get, roughness_set) - # Will only be used as gray-scale one... def roughness_texture_get(self): if not self.use_nodes or self.node_principled_bsdf is None: @@ -373,7 +365,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): roughness_texture = property(roughness_texture_get) - # -------------------------------------------------------------------- # Metallic (a.k.a reflection, mirror). @@ -391,7 +382,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): metallic = property(metallic_get, metallic_set) - # Will only be used as gray-scale one... def metallic_texture_get(self): if not self.use_nodes or self.node_principled_bsdf is None: @@ -405,7 +395,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): metallic_texture = property(metallic_texture_get) - # -------------------------------------------------------------------- # Transparency settings. @@ -422,7 +411,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): ior = property(ior_get, ior_set) - # Will only be used as gray-scale one... def ior_texture_get(self): if not self.use_nodes or self.node_principled_bsdf is None: @@ -436,7 +424,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): ior_texture = property(ior_texture_get) - def transmission_get(self): if not self.use_nodes or self.node_principled_bsdf is None: return 0.0 @@ -450,7 +437,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): transmission = property(transmission_get, transmission_set) - # Will only be used as gray-scale one... def transmission_texture_get(self): if not self.use_nodes or self.node_principled_bsdf is None: @@ -464,7 +450,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): transmission_texture = property(transmission_texture_get) - def alpha_get(self): if not self.use_nodes or self.node_principled_bsdf is None: return 1.0 @@ -478,7 +463,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): alpha = property(alpha_get, alpha_set) - # Will only be used as gray-scale one... def alpha_texture_get(self): if not self.use_nodes or self.node_principled_bsdf is None: @@ -493,7 +477,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): alpha_texture = property(alpha_texture_get) - # -------------------------------------------------------------------- # Emission color. @@ -511,7 +494,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): emission_color = property(emission_color_get, emission_color_set) - def emission_color_texture_get(self): if not self.use_nodes or self.node_principled_bsdf is None: return None @@ -536,7 +518,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): emission_strength = property(emission_strength_get, emission_strength_set) - def emission_strength_texture_get(self): if not self.use_nodes or self.node_principled_bsdf is None: return None @@ -565,7 +546,6 @@ class PrincipledBSDFWrapper(ShaderWrapper): normalmap_strength = property(normalmap_strength_get, normalmap_strength_set) - def normalmap_texture_get(self): if not self.use_nodes or self.node_normalmap is None: return None @@ -578,6 +558,7 @@ class PrincipledBSDFWrapper(ShaderWrapper): normalmap_texture = property(normalmap_texture_get) + class ShaderImageTextureWrapper(): """ Generic 'image texture'-like wrapper, handling image node, some mapping (texture coordinates transformations), @@ -642,7 +623,6 @@ class ShaderImageTextureWrapper(): if from_node.bl_idname == 'ShaderNodeMapping': self._node_mapping = from_node - def copy_from(self, tex): # Avoid generating any node in source texture. is_readonly_back = tex.is_readonly @@ -656,7 +636,6 @@ class ShaderImageTextureWrapper(): tex.is_readonly = is_readonly_back - def copy_mapping_from(self, tex): # Avoid generating any node in source texture. is_readonly_back = tex.is_readonly @@ -685,7 +664,6 @@ class ShaderImageTextureWrapper(): tex.is_readonly = is_readonly_back - # -------------------------------------------------------------------- # Image. @@ -712,7 +690,6 @@ class ShaderImageTextureWrapper(): node_image = property(node_image_get) - def image_get(self): return self.node_image.image if self.node_image is not None else None @@ -730,7 +707,6 @@ class ShaderImageTextureWrapper(): image = property(image_get, image_set) - def projection_get(self): return self.node_image.projection if self.node_image is not None else 'FLAT' @@ -740,7 +716,6 @@ class ShaderImageTextureWrapper(): projection = property(projection_get, projection_set) - def texcoords_get(self): if self.node_image is not None: socket = (self.node_mapping if self.has_mapping_node() else self.node_image).inputs["Vector"] @@ -762,7 +737,6 @@ class ShaderImageTextureWrapper(): texcoords = property(texcoords_get, texcoords_set) - def extension_get(self): return self.node_image.extension if self.node_image is not None else 'REPEAT' @@ -772,7 +746,6 @@ class ShaderImageTextureWrapper(): extension = property(extension_get, extension_set) - # -------------------------------------------------------------------- # Mapping. @@ -813,7 +786,6 @@ class ShaderImageTextureWrapper(): node_mapping = property(node_mapping_get) - def translation_get(self): if self.node_mapping is None: return Vector((0.0, 0.0, 0.0)) @@ -825,7 +797,6 @@ class ShaderImageTextureWrapper(): translation = property(translation_get, translation_set) - def rotation_get(self): if self.node_mapping is None: return Vector((0.0, 0.0, 0.0)) @@ -837,7 +808,6 @@ class ShaderImageTextureWrapper(): rotation = property(rotation_get, rotation_set) - def scale_get(self): if self.node_mapping is None: return Vector((1.0, 1.0, 1.0)) diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 1c31eaa39d0..7c26744ce8c 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -27,6 +27,7 @@ StructMetaPropGroup = bpy_types.bpy_struct_meta_idprop # Note that methods extended in C are defined in: 'bpy_rna_types_capi.c' + class Context(StructRNA): __slots__ = () diff --git a/release/scripts/presets/keyconfig/blender_27x.py b/release/scripts/presets/keyconfig/blender_27x.py index 8d50d449494..a02ac895efb 100644 --- a/release/scripts/presets/keyconfig/blender_27x.py +++ b/release/scripts/presets/keyconfig/blender_27x.py @@ -7,6 +7,7 @@ from bpy.props import ( DIRNAME, FILENAME = os.path.split(__file__) IDNAME = os.path.splitext(FILENAME)[0] + def update_fn(_self, _context): load() @@ -41,6 +42,7 @@ class Prefs(bpy.types.KeyConfigPreferences): blender_default = bpy.utils.execfile(os.path.join(DIRNAME, "keymap_data", "blender_default.py")) + def load(): from sys import platform from bpy import context @@ -68,7 +70,6 @@ def load(): from bl_keymap_utils.platform_helpers import keyconfig_data_oskey_from_ctrl_for_macos keyconfig_data = keyconfig_data_oskey_from_ctrl_for_macos(keyconfig_data) - keyconfig_init_from_data(kc, keyconfig_data) diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 3723e6b61bf..8f42c74092a 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -6388,6 +6388,7 @@ def km_3d_view_tool_sculpt_lasso_trim(params): ]}, ) + def km_3d_view_tool_sculpt_line_mask(params): return ( "3D View Tool: Sculpt, Line Mask", @@ -6400,6 +6401,7 @@ def km_3d_view_tool_sculpt_line_mask(params): ]}, ) + def km_3d_view_tool_sculpt_line_project(params): return ( "3D View Tool: Sculpt, Line Project", @@ -6410,6 +6412,7 @@ def km_3d_view_tool_sculpt_line_project(params): ]}, ) + def km_3d_view_tool_sculpt_mesh_filter(params): return ( "3D View Tool: Sculpt, Mesh Filter", diff --git a/release/scripts/startup/bl_app_templates_system/2D_Animation/__init__.py b/release/scripts/startup/bl_app_templates_system/2D_Animation/__init__.py index 1892bea41f7..9b0a260dc95 100644 --- a/release/scripts/startup/bl_app_templates_system/2D_Animation/__init__.py +++ b/release/scripts/startup/bl_app_templates_system/2D_Animation/__init__.py @@ -63,6 +63,7 @@ def load_handler(dummy): gpd = ob.data gpd.onion_keyframe_type = 'ALL' + def register(): bpy.app.handlers.load_factory_startup_post.append(load_handler) diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py index 87a006be673..73212d6641a 100644 --- a/release/scripts/startup/bl_operators/object.py +++ b/release/scripts/startup/bl_operators/object.py @@ -208,7 +208,6 @@ class SelectHierarchy(Operator): select_new.sort(key=lambda obj_iter: obj_iter.name) act_new = select_new[0] - # don't edit any object settings above this if select_new: if not self.extend: diff --git a/release/scripts/startup/bl_operators/simulation.py b/release/scripts/startup/bl_operators/simulation.py index 5d9c9476318..0981baa5941 100644 --- a/release/scripts/startup/bl_operators/simulation.py +++ b/release/scripts/startup/bl_operators/simulation.py @@ -18,6 +18,7 @@ import bpy + class NewSimulation(bpy.types.Operator): """Create a new simulation data block and edit it in the opened simulation editor""" @@ -34,6 +35,7 @@ class NewSimulation(bpy.types.Operator): context.space_data.simulation = simulation return {'FINISHED'} + classes = ( NewSimulation, ) diff --git a/release/scripts/startup/bl_operators/userpref.py b/release/scripts/startup/bl_operators/userpref.py index f92a231f1da..113e6b06153 100644 --- a/release/scripts/startup/bl_operators/userpref.py +++ b/release/scripts/startup/bl_operators/userpref.py @@ -49,6 +49,7 @@ def module_filesystem_remove(path_base, module_name): else: os.remove(f_full) + # This duplicates shutil.copytree from Python 3.8, with the new dirs_exist_ok # argument that we need. Once we upgrade to 3.8 we can remove this. def _preferences_copytree(entries, src, dst): @@ -85,11 +86,13 @@ def _preferences_copytree(entries, src, dst): raise Error(errors) return dst + def preferences_copytree(src, dst): import os with os.scandir(src) as entries: return _preferences_copytree(entries=entries, src=src, dst=dst) + class PREFERENCES_OT_keyconfig_activate(Operator): bl_idname = "preferences.keyconfig_activate" bl_label = "Activate Keyconfig" diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 89d3a2c449b..e9a658bdc10 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -1381,7 +1381,6 @@ class WM_OT_properties_edit(Operator): is_overridable = item.is_property_overridable_library('["%s"]' % self.property) self.is_overridable_library = bool(is_overridable) - # default default value prop_type, is_array = rna_idprop_value_item_type(self.get_value_eval()) if prop_type in {int, float}: diff --git a/release/scripts/startup/bl_ui/properties_constraint.py b/release/scripts/startup/bl_ui/properties_constraint.py index 14619ef916d..f46e9f9727f 100644 --- a/release/scripts/startup/bl_ui/properties_constraint.py +++ b/release/scripts/startup/bl_ui/properties_constraint.py @@ -374,7 +374,6 @@ class ConstraintButtonsPanel(Panel): subsub.prop(con, "max_z", text="") row.prop_decorator(con, "max_z") - layout.prop(con, "use_transform_limit") layout.prop(con, "owner_space") @@ -752,7 +751,6 @@ class ConstraintButtonsPanel(Panel): row.active = not con.use_3d_position row.prop(con, "use_undistorted_position") - if not con.use_active_clip: layout.prop(con, "clip") @@ -1152,6 +1150,7 @@ class BONE_PT_bChildOfConstraint(BoneConstraintPanel, ConstraintButtonsPanel): # Track To Constraint + class OBJECT_PT_bTrackToConstraint(ObjectConstraintPanel, ConstraintButtonsPanel): def draw(self, context): self.draw_trackto(context) @@ -1163,6 +1162,7 @@ class BONE_PT_bTrackToConstraint(BoneConstraintPanel, ConstraintButtonsPanel): # Follow Path Constraint + class OBJECT_PT_bFollowPathConstraint(ObjectConstraintPanel, ConstraintButtonsPanel): def draw(self, context): self.draw_follow_path(context) @@ -1530,12 +1530,12 @@ class OBJECT_PT_bPythonConstraint(ObjectConstraintPanel, ConstraintButtonsPanel) def draw(self, context): self.draw_python_constraint(context) + class BONE_PT_bPythonConstraint(BoneConstraintPanel, ConstraintButtonsPanel): def draw(self, context): self.draw_python_constraint(context) - # Armature Constraint class OBJECT_PT_bArmatureConstraint(ObjectConstraintPanel, ConstraintButtonsPanel): @@ -1576,7 +1576,6 @@ class BONE_PT_bKinematicConstraint(BoneConstraintPanel, ConstraintButtonsPanel): self.draw_kinematic(context) - classes = ( # Object Panels OBJECT_PT_constraints, diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py index 80bd8347421..b56182bb637 100644 --- a/release/scripts/startup/bl_ui/properties_data_camera.py +++ b/release/scripts/startup/bl_ui/properties_data_camera.py @@ -395,6 +395,7 @@ class DATA_PT_camera_display(CameraButtonsPanel, Panel): sub.prop(cam, "passepartout_alpha", text="") row.prop_decorator(cam, "passepartout_alpha") + class DATA_PT_camera_display_composition_guides(CameraButtonsPanel, Panel): bl_label = "Composition Guides" bl_parent_id = "DATA_PT_camera_display" diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py index c4c9660c798..9f84751e835 100644 --- a/release/scripts/startup/bl_ui/properties_paint_common.py +++ b/release/scripts/startup/bl_ui/properties_paint_common.py @@ -1120,6 +1120,7 @@ def brush_basic_texpaint_settings(layout, context, brush, *, compact=False): header=True ) + def brush_basic__draw_color_selector(context, layout, brush, gp_settings, props): tool_settings = context.scene.tool_settings settings = tool_settings.gpencil_paint @@ -1168,6 +1169,7 @@ def brush_basic__draw_color_selector(context, layout, brush, gp_settings, props) row = layout.row(align=True) row.prop(props, "subdivision") + def brush_basic_gpencil_paint_settings(layout, context, brush, *, compact=False): tool_settings = context.tool_settings settings = tool_settings.gpencil_paint diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index f1dd6a1c890..60caa39b723 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -618,7 +618,6 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel): layout.prop(part, "use_rotations", text="") layout.enabled = particle_panel_enabled(context, psys) - def draw(self, context): layout = self.layout diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py index db33fda3b17..abc75ceed2c 100644 --- a/release/scripts/startup/bl_ui/properties_physics_common.py +++ b/release/scripts/startup/bl_ui/properties_physics_common.py @@ -363,6 +363,7 @@ def basic_force_field_falloff_ui(self, field): sub.prop(field, "distance_max", text="") row.prop_decorator(field, "distance_max") + classes = ( PHYSICS_PT_add, ) diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index 82c5bd311a2..888eb40e27e 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -1397,6 +1397,7 @@ class PHYSICS_PT_viewport_display_debug(PhysicButtonsPanel, Panel): col.prop(domain, "vector_field") col.prop(domain, "vector_scale") + class PHYSICS_PT_viewport_display_advanced(PhysicButtonsPanel, Panel): bl_label = "Advanced" bl_parent_id = 'PHYSICS_PT_viewport_display' @@ -1428,6 +1429,7 @@ class PHYSICS_PT_viewport_display_advanced(PhysicButtonsPanel, Panel): else: note.label(icon='INFO', text="Range highlighting for flags is not available!") + classes = ( FLUID_PT_presets, PHYSICS_PT_fluid, diff --git a/release/scripts/startup/bl_ui/properties_view_layer.py b/release/scripts/startup/bl_ui/properties_view_layer.py index 36bbf78d8ab..afa00bb50c2 100644 --- a/release/scripts/startup/bl_ui/properties_view_layer.py +++ b/release/scripts/startup/bl_ui/properties_view_layer.py @@ -134,6 +134,7 @@ class VIEWLAYER_PT_eevee_layer_passes_effects(ViewLayerButtonsPanel, Panel): col.prop(view_layer_eevee, "use_pass_bloom", text="Bloom") col.active = scene_eevee.use_bloom + classes = ( VIEWLAYER_PT_layer, VIEWLAYER_PT_eevee_layer_passes, diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py index 2c52d9cd337..23734601570 100644 --- a/release/scripts/startup/bl_ui/space_filebrowser.py +++ b/release/scripts/startup/bl_ui/space_filebrowser.py @@ -20,7 +20,6 @@ from bpy.types import Header, Panel, Menu, UIList - class FILEBROWSER_HT_header(Header): bl_space_type = 'FILE_BROWSER' diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index 744726af5d1..e6dcfa0a7ab 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -1288,7 +1288,6 @@ class _defs_sculpt: draw_settings=draw_settings, ) - @ToolDef.from_fn def face_set_lasso(): def draw_settings(_context, layout, tool): diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 9a8934b8e50..576e56c929f 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -1019,6 +1019,7 @@ class USERPREF_PT_theme_bone_color_sets(ThemePanel, CenterAlignMixIn, Panel): flow.prop(ui, "active") flow.prop(ui, "show_colored_constraints") + class USERPREF_PT_theme_collection_colors(ThemePanel, CenterAlignMixIn, Panel): bl_label = "Collection Colors" bl_options = {'DEFAULT_CLOSED'} @@ -1671,6 +1672,7 @@ class USERPREF_PT_ndof_settings(Panel): # ----------------------------------------------------------------------------- # Key-Map Editor Panels + class KeymapPanel: bl_space_type = 'PREFERENCES' bl_region_type = 'WINDOW' @@ -2157,6 +2159,7 @@ class ExperimentalPanel: col = split.split() col.operator("wm.url_open", text=task, icon='URL').url = self.url_prefix + task + """ # Example panel, leave it here so we always have a template to follow even # after the features are gone from the experimental panel. diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 6871ab20194..4f814802705 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -3066,13 +3066,13 @@ class VIEW3D_MT_mask(Menu): props = layout.operator("sculpt.dirty_mask", text='Dirty Mask') + class VIEW3D_MT_face_sets(Menu): bl_label = "Face Sets" def draw(self, _context): layout = self.layout - op = layout.operator("sculpt.face_sets_create", text='Face Set From Masked') op.mode = 'MASKED' @@ -3248,6 +3248,7 @@ class VIEW3D_MT_particle_context_menu(Menu): layout.operator("particle.select_linked", text="Select Linked") + class VIEW3D_MT_particle_showhide(ShowHideMenu, Menu): _operator_name = "particle" @@ -5283,6 +5284,7 @@ class VIEW3D_MT_sculpt_mask_edit_pie(Menu): op.filter_type = 'CONTRAST_DECREASE' op.auto_iteration_count = False + class VIEW3D_MT_sculpt_face_sets_edit_pie(Menu): bl_label = "Face Sets Edit" @@ -5303,6 +5305,7 @@ class VIEW3D_MT_sculpt_face_sets_edit_pie(Menu): op = pie.operator("sculpt.face_set_change_visibility", text='Show All') op.mode = 'SHOW_ALL' + class VIEW3D_MT_wpaint_vgroup_lock_pie(Menu): bl_label = "Vertex Group Locks" diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 5d51c3a71a4..5f668bbc881 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -397,7 +397,6 @@ class VIEW3D_PT_tools_brush_settings_advanced(Panel, View3DPaintBrushPanel): bl_options = {'DEFAULT_CLOSED'} bl_ui_units_x = 14 - def draw(self, context): layout = self.layout @@ -825,7 +824,6 @@ class VIEW3D_PT_sculpt_voxel_remesh(Panel, View3DPaintPanel): if context.preferences.experimental.use_sculpt_vertex_colors: col.prop(mesh, "use_remesh_preserve_vertex_colors", text="Vertex Colors") - layout.operator("object.voxel_remesh", text="Remesh") @@ -966,7 +964,6 @@ class VIEW3D_PT_tools_weightpaint_symmetry(Panel, View3DPaintPanel): row.prop(context.object.data, 'use_mirror_vertex_group_x') - class VIEW3D_PT_tools_weightpaint_symmetry_for_topbar(Panel): bl_space_type = 'TOPBAR' bl_region_type = 'HEADER' @@ -1237,7 +1234,7 @@ class VIEW3D_PT_tools_particlemode_options(View3DPanel, Panel): col.active = pe.is_editable col.prop(ob.data, "use_mirror_x") if pe.tool == 'ADD': - col.prop(ob.data, "use_mirror_topology") + col.prop(ob.data, "use_mirror_topology") col.separator() col.prop(pe, "use_preserve_length", text="Preserve Strand Lengths") col.prop(pe, "use_preserve_root", text="Preserve Root Positions") diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py index 0cf0a99c326..027f4068dc4 100644 --- a/release/scripts/startup/nodeitems_builtins.py +++ b/release/scripts/startup/nodeitems_builtins.py @@ -475,12 +475,14 @@ texture_node_categories = [ ]), ] + def not_implemented_node(idname): NodeType = getattr(bpy.types, idname) name = NodeType.bl_rna.name label = "%s (mockup)" % name return NodeItem(idname, label=label) + simulation_node_categories = [ # Simulation Nodes SimulationNodeCategory("SIM_OUTPUT", "Output", items=[ diff --git a/release/windows/msix/create_msix_package.py b/release/windows/msix/create_msix_package.py index 69b0a2ef901..88b80291ebe 100644 --- a/release/windows/msix/create_msix_package.py +++ b/release/windows/msix/create_msix_package.py @@ -33,6 +33,7 @@ def execute_command(cmd : list, name : str, errcode : int): if cmd_process.stderr: print(cmd_process.stderr) exit(errcode) + LTSORNOT = "" PACKAGETYPE = "" if args.lts: @@ -115,7 +116,6 @@ with zipfile.ZipFile(local_blender_zip, "r") as blender_zip: print("... extraction complete.") - print(f"Creating MSIX package using command: {' '.join(msix_command)}") # Remove MSIX file if it already exists. Otherwise the MakeAppX tool diff --git a/tests/python/bl_animation_fcurves.py b/tests/python/bl_animation_fcurves.py index bacda5c1155..432cfa5f3ab 100644 --- a/tests/python/bl_animation_fcurves.py +++ b/tests/python/bl_animation_fcurves.py @@ -28,6 +28,7 @@ import unittest import bpy + class FCurveEvaluationTest(unittest.TestCase): @classmethod def setUpClass(cls): diff --git a/tests/python/bl_blendfile_io.py b/tests/python/bl_blendfile_io.py index ab06e313566..35b089f9bb2 100644 --- a/tests/python/bl_blendfile_io.py +++ b/tests/python/bl_blendfile_io.py @@ -44,7 +44,6 @@ class TestBlendFileSaveLoadBasic(TestHelper): assert(orig_data == read_data) - TESTS = ( TestBlendFileSaveLoadBasic, ) diff --git a/tests/python/bl_blendfile_liblink.py b/tests/python/bl_blendfile_liblink.py index d1cc7efc7fd..70614c3502d 100644 --- a/tests/python/bl_blendfile_liblink.py +++ b/tests/python/bl_blendfile_liblink.py @@ -42,7 +42,6 @@ class TestBlendLibLinkSaveLoadBasic(TestHelper): assert(orig_data == read_data) - TESTS = ( TestBlendLibLinkSaveLoadBasic, ) diff --git a/tests/python/cycles_render_tests.py b/tests/python/cycles_render_tests.py index cc949248ce6..3c597b39cb8 100644 --- a/tests/python/cycles_render_tests.py +++ b/tests/python/cycles_render_tests.py @@ -43,6 +43,7 @@ def get_arguments(filepath, output_filepath): return args + def create_argparse(): parser = argparse.ArgumentParser() parser.add_argument("-blender", nargs="+") diff --git a/tests/python/eevee_render_tests.py b/tests/python/eevee_render_tests.py index a90d7730ace..2f66af2344f 100644 --- a/tests/python/eevee_render_tests.py +++ b/tests/python/eevee_render_tests.py @@ -8,6 +8,7 @@ import shutil import subprocess import sys + def setup(): import bpy diff --git a/tests/python/modules/global_report.py b/tests/python/modules/global_report.py index 8ed8551beb9..7e6172c345a 100755 --- a/tests/python/modules/global_report.py +++ b/tests/python/modules/global_report.py @@ -6,6 +6,7 @@ import glob import os import pathlib + def _write_html(output_dir): combined_reports = "" diff --git a/tests/python/modules/mesh_test.py b/tests/python/modules/mesh_test.py index af0e78257d5..e1585aaa7a2 100644 --- a/tests/python/modules/mesh_test.py +++ b/tests/python/modules/mesh_test.py @@ -95,6 +95,7 @@ class PhysicsSpec: return "Physics Modifier: " + self.modifier_name + " of type " + self.modifier_type + \ " with parameters: " + str(self.modifier_parameters) + " with frame end: " + str(self.frame_end) + class OperatorSpec: """ Holds one operator and its parameters. @@ -281,7 +282,6 @@ class MeshTest: print("Created modifier '{}' of type '{}'.". format(physics_spec.modifier_name, physics_spec.modifier_type)) - for param_name in physics_spec.modifier_parameters: try: setattr(physics_setting, param_name, physics_spec.modifier_parameters[param_name]) diff --git a/tests/python/modules/render_report.py b/tests/python/modules/render_report.py index b6cafc2ee24..9e0c8ad6509 100755 --- a/tests/python/modules/render_report.py +++ b/tests/python/modules/render_report.py @@ -34,6 +34,7 @@ BLACKLIST = ( # 'file_to_blacklist.blend', ) + def print_message(message, type=None, status=''): if type == 'SUCCESS': print(COLORS.GREEN, end="")