From 09aa799e5331a9da666f8a6325b038a866b1f35d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 11 Jul 2018 22:18:09 +0200 Subject: PyAPI: Use annotations for RNA definitions - Logical use of fields since they define type information. - Avoids using ordered-dict metaclass. Properties using regular assignments will print a warning and load, however the order is undefined. --- release/scripts/modules/bpy_extras/io_utils.py | 22 +- .../scripts/modules/bpy_extras/keyconfig_utils.py | 1 + release/scripts/modules/bpy_extras/object_utils.py | 6 +- release/scripts/modules/bpy_types.py | 32 +-- .../scripts/startup/bl_operators/add_mesh_torus.py | 16 +- release/scripts/startup/bl_operators/anim.py | 30 +-- release/scripts/startup/bl_operators/clip.py | 2 +- release/scripts/startup/bl_operators/console.py | 4 +- release/scripts/startup/bl_operators/file.py | 40 ++-- release/scripts/startup/bl_operators/freestyle.py | 8 +- release/scripts/startup/bl_operators/image.py | 2 +- release/scripts/startup/bl_operators/mesh.py | 4 +- release/scripts/startup/bl_operators/node.py | 12 +- release/scripts/startup/bl_operators/object.py | 29 ++- .../scripts/startup/bl_operators/object_align.py | 8 +- .../startup/bl_operators/object_quick_effects.py | 32 +-- .../bl_operators/object_randomize_transform.py | 20 +- release/scripts/startup/bl_operators/presets.py | 25 +-- release/scripts/startup/bl_operators/rigidbody.py | 12 +- release/scripts/startup/bl_operators/sequencer.py | 2 +- .../startup/bl_operators/uvcalc_follow_active.py | 2 +- .../startup/bl_operators/uvcalc_lightmap.py | 14 +- .../startup/bl_operators/uvcalc_smart_project.py | 10 +- .../startup/bl_operators/vertexpaint_dirt.py | 10 +- release/scripts/startup/bl_operators/view3d.py | 12 +- release/scripts/startup/bl_operators/wm.py | 226 +++++++++++---------- release/scripts/templates_py/addon_add_object.py | 2 +- release/scripts/templates_py/custom_nodes.py | 13 +- .../scripts/templates_py/manipulator_operator.py | 4 +- .../scripts/templates_py/operator_file_export.py | 6 +- .../scripts/templates_py/operator_file_import.py | 6 +- release/scripts/templates_py/operator_mesh_add.py | 14 +- release/scripts/templates_py/operator_modal.py | 4 +- .../scripts/templates_py/operator_modal_view3d.py | 2 +- release/scripts/templates_py/ui_list.py | 6 +- 35 files changed, 299 insertions(+), 339 deletions(-) (limited to 'release') diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py index e2c2e4c9b93..a0c1c3e5c84 100644 --- a/release/scripts/modules/bpy_extras/io_utils.py +++ b/release/scripts/modules/bpy_extras/io_utils.py @@ -52,25 +52,19 @@ def _check_axis_conversion(op): class ExportHelper: - filepath = StringProperty( + filepath: StringProperty( name="File Path", description="Filepath used for exporting the file", maxlen=1024, subtype='FILE_PATH', ) - check_existing = BoolProperty( + check_existing: BoolProperty( name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'}, ) - # needed for mix-ins - order = [ - "filepath", - "check_existing", - ] - # subclasses can override with decorator # True == use ext, False == no ext, None == do nothing. check_extension = True @@ -112,18 +106,13 @@ class ExportHelper: class ImportHelper: - filepath = StringProperty( + filepath: StringProperty( name="File Path", description="Filepath used for importing the file", maxlen=1024, subtype='FILE_PATH', ) - # needed for mix-ins - order = [ - "filepath", - ] - def invoke(self, context, event): context.window_manager.fileselect_add(self) return {'RUNNING_MODAL'} @@ -173,11 +162,6 @@ def orientation_helper_factory(name, axis_forward='Y', axis_up='Z'): update=_update_axis_up, ) - members["order"] = [ - "axis_forward", - "axis_up", - ] - return type(name, (object,), members) diff --git a/release/scripts/modules/bpy_extras/keyconfig_utils.py b/release/scripts/modules/bpy_extras/keyconfig_utils.py index a078da2ff2f..7e5e1fb855c 100644 --- a/release/scripts/modules/bpy_extras/keyconfig_utils.py +++ b/release/scripts/modules/bpy_extras/keyconfig_utils.py @@ -406,6 +406,7 @@ def keyconfig_test(kc): result = True return result + # Note, we may eventually replace existing logic with this # so key configs are always data. from .keyconfig_utils_experimental import ( diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py index fcecb4cdd61..7719e2f6e30 100644 --- a/release/scripts/modules/bpy_extras/object_utils.py +++ b/release/scripts/modules/bpy_extras/object_utils.py @@ -194,16 +194,16 @@ class AddObjectHelper: if not self.view_align: self.rotation.zero() - view_align = BoolProperty( + view_align: BoolProperty( name="Align to View", default=False, update=view_align_update_callback, ) - location = FloatVectorProperty( + location: FloatVectorProperty( name="Location", subtype='TRANSLATION', ) - rotation = FloatVectorProperty( + rotation: FloatVectorProperty( name="Rotation", subtype='EULER', ) diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index c4bf8422d3f..b317ae18955 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -568,39 +568,13 @@ class RNAMeta(type): return "bl_rna" in cls.__dict__ -class OrderedDictMini(dict): - - def __init__(self, *args): - self.order = [] - dict.__init__(self, args) - - def __setitem__(self, key, val): - dict.__setitem__(self, key, val) - if key not in self.order: - self.order.append(key) - - def __delitem__(self, key): - dict.__delitem__(self, key) - self.order.remove(key) - - class RNAMetaPropGroup(StructMetaPropGroup, RNAMeta): pass -class OrderedMeta(RNAMeta): - - def __init__(cls, name, bases, attributes): - if attributes.__class__ is OrderedDictMini: - cls.order = attributes.order - - def __prepare__(name, bases, **kwargs): - return OrderedDictMini() # collections.OrderedDict() - - # Same as 'Operator' # only without 'as_keywords' -class Manipulator(StructRNA, metaclass=OrderedMeta): +class Manipulator(StructRNA): __slots__ = () def __getattribute__(self, attr): @@ -700,7 +674,7 @@ class Manipulator(StructRNA, metaclass=OrderedMeta): # Only defined so operators members can be used by accessing self.order # with doc generation 'self.properties.bl_rna.properties' can fail -class Operator(StructRNA, metaclass=OrderedMeta): +class Operator(StructRNA): __slots__ = () def __getattribute__(self, attr): @@ -732,7 +706,7 @@ class Operator(StructRNA, metaclass=OrderedMeta): if attr not in ignore} -class Macro(StructRNA, metaclass=OrderedMeta): +class Macro(StructRNA): # bpy_types is imported before ops is defined # so we have to do a local import on each run __slots__ = () diff --git a/release/scripts/startup/bl_operators/add_mesh_torus.py b/release/scripts/startup/bl_operators/add_mesh_torus.py index cc7f69ca7ca..4460af173ff 100644 --- a/release/scripts/startup/bl_operators/add_mesh_torus.py +++ b/release/scripts/startup/bl_operators/add_mesh_torus.py @@ -134,19 +134,19 @@ class AddTorus(Operator, object_utils.AddObjectHelper): self.abso_major_rad = self.major_radius + self.minor_radius self.abso_minor_rad = self.major_radius - self.minor_radius - major_segments = IntProperty( + major_segments: IntProperty( name="Major Segments", description="Number of segments for the main ring of the torus", min=3, max=256, default=48, ) - minor_segments = IntProperty( + minor_segments: IntProperty( name="Minor Segments", description="Number of segments for the minor ring of the torus", min=3, max=256, default=12, ) - mode = bpy.props.EnumProperty( + mode: bpy.props.EnumProperty( name="Torus Dimensions", items=(("MAJOR_MINOR", "Major/Minor", "Use the major/minor radii for torus dimensions"), @@ -154,7 +154,7 @@ class AddTorus(Operator, object_utils.AddObjectHelper): "Use the exterior/interior radii for torus dimensions")), update=mode_update_callback, ) - major_radius = FloatProperty( + major_radius: FloatProperty( name="Major Radius", description=("Radius from the origin to the " "center of the cross sections"), @@ -163,7 +163,7 @@ class AddTorus(Operator, object_utils.AddObjectHelper): subtype='DISTANCE', unit='LENGTH', ) - minor_radius = FloatProperty( + minor_radius: FloatProperty( name="Minor Radius", description="Radius of the torus' cross section", min=0.01, max=100.0, @@ -171,7 +171,7 @@ class AddTorus(Operator, object_utils.AddObjectHelper): subtype='DISTANCE', unit='LENGTH', ) - abso_major_rad = FloatProperty( + abso_major_rad: FloatProperty( name="Exterior Radius", description="Total Exterior Radius of the torus", min=0.01, max=100.0, @@ -179,7 +179,7 @@ class AddTorus(Operator, object_utils.AddObjectHelper): subtype='DISTANCE', unit='LENGTH', ) - abso_minor_rad = FloatProperty( + abso_minor_rad: FloatProperty( name="Interior Radius", description="Total Interior Radius of the torus", min=0.01, max=100.0, @@ -187,7 +187,7 @@ class AddTorus(Operator, object_utils.AddObjectHelper): subtype='DISTANCE', unit='LENGTH', ) - generate_uvs = BoolProperty( + generate_uvs: BoolProperty( name="Generate UVs", description="Generate a default UV map", default=False, diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py index d898239d7a9..31325cf0b50 100644 --- a/release/scripts/startup/bl_operators/anim.py +++ b/release/scripts/startup/bl_operators/anim.py @@ -40,20 +40,20 @@ class ANIM_OT_keying_set_export(Operator): bl_idname = "anim.keying_set_export" bl_label = "Export Keying Set..." - filepath = StringProperty( + filepath: StringProperty( subtype='FILE_PATH', ) - filter_folder = BoolProperty( + filter_folder: BoolProperty( name="Filter folders", default=True, options={'HIDDEN'}, ) - filter_text = BoolProperty( + filter_text: BoolProperty( name="Filter text", default=True, options={'HIDDEN'}, ) - filter_python = BoolProperty( + filter_python: BoolProperty( name="Filter python", default=True, options={'HIDDEN'}, @@ -203,51 +203,51 @@ class BakeAction(Operator): bl_label = "Bake Action" bl_options = {'REGISTER', 'UNDO'} - frame_start = IntProperty( + frame_start: IntProperty( name="Start Frame", description="Start frame for baking", min=0, max=300000, default=1, ) - frame_end = IntProperty( + frame_end: IntProperty( name="End Frame", description="End frame for baking", min=1, max=300000, default=250, ) - step = IntProperty( + step: IntProperty( name="Frame Step", description="Frame Step", min=1, max=120, default=1, ) - only_selected = BoolProperty( + only_selected: BoolProperty( name="Only Selected Bones", description="Only key selected bones (Pose baking only)", default=True, ) - visual_keying = BoolProperty( + visual_keying: BoolProperty( name="Visual Keying", description="Keyframe from the final transformations (with constraints applied)", default=False, ) - clear_constraints = BoolProperty( + clear_constraints: BoolProperty( name="Clear Constraints", description="Remove all constraints from keyed object/bones, and do 'visual' keying", default=False, ) - clear_parents = BoolProperty( + clear_parents: BoolProperty( name="Clear Parents", description="Bake animation onto the object then clear parents (objects only)", default=False, ) - use_current_action = BoolProperty( + use_current_action: BoolProperty( name="Overwrite Current Action", description="Bake animation into current action, instead of creating a new one " "(useful for baking only part of bones in an armature)", default=False, ) - bake_types = EnumProperty( + bake_types: EnumProperty( name="Bake Data", description="Which data's transformations to bake", options={'ENUM_FLAG'}, @@ -302,7 +302,7 @@ class ClearUselessActions(Operator): bl_label = "Clear Useless Actions" bl_options = {'REGISTER', 'UNDO'} - only_unused = BoolProperty( + only_unused: BoolProperty( name="Only Unused", description="Only unused (Fake User only) actions get considered", default=True, @@ -341,7 +341,7 @@ class UpdateAnimatedTransformConstraint(Operator): bl_label = "Update Animated Transform Constraints" bl_options = {'REGISTER', 'UNDO'} - use_convert_to_radians = BoolProperty( + use_convert_to_radians: BoolProperty( name="Convert To Radians", description="Convert fcurves/drivers affecting rotations to radians (Warning: use this only once!)", default=True, diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index 95c4bbbfba9..2717a4f62a3 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -133,7 +133,7 @@ class CLIP_OT_filter_tracks(bpy.types.Operator): bl_idname = "clip.filter_tracks" bl_options = {'UNDO', 'REGISTER'} - track_threshold = FloatProperty( + track_threshold: FloatProperty( name="Track Threshold", description="Filter Threshold to select problematic tracks", default=5.0, diff --git a/release/scripts/startup/bl_operators/console.py b/release/scripts/startup/bl_operators/console.py index 2d32f84805e..b62b9310224 100644 --- a/release/scripts/startup/bl_operators/console.py +++ b/release/scripts/startup/bl_operators/console.py @@ -37,7 +37,7 @@ class ConsoleExec(Operator): bl_idname = "console.execute" bl_label = "Console Execute" - interactive = BoolProperty( + interactive: BoolProperty( options={'SKIP_SAVE'}, ) @@ -137,7 +137,7 @@ class ConsoleLanguage(Operator): bl_idname = "console.language" bl_label = "Console Language" - language = StringProperty( + language: StringProperty( name="Language", maxlen=32, ) diff --git a/release/scripts/startup/bl_operators/file.py b/release/scripts/startup/bl_operators/file.py index cf03b4fccdb..44948879fe6 100644 --- a/release/scripts/startup/bl_operators/file.py +++ b/release/scripts/startup/bl_operators/file.py @@ -37,56 +37,56 @@ class WM_OT_previews_batch_generate(Operator): # ----------- # File props. - files = CollectionProperty( + files: CollectionProperty( type=bpy.types.OperatorFileListElement, options={'HIDDEN', 'SKIP_SAVE'}, ) - directory = StringProperty( + directory: StringProperty( maxlen=1024, subtype='FILE_PATH', options={'HIDDEN', 'SKIP_SAVE'}, ) # Show only images/videos, and directories! - filter_blender = BoolProperty( + filter_blender: BoolProperty( default=True, options={'HIDDEN', 'SKIP_SAVE'}, ) - filter_folder = BoolProperty( + filter_folder: BoolProperty( default=True, options={'HIDDEN', 'SKIP_SAVE'}, ) # ----------- # Own props. - use_scenes = BoolProperty( + use_scenes: BoolProperty( default=True, name="Scenes", description="Generate scenes' previews", ) - use_collections = BoolProperty( + use_collections: BoolProperty( default=True, name="Collections", description="Generate collections' previews", ) - use_objects = BoolProperty( + use_objects: BoolProperty( default=True, name="Objects", description="Generate objects' previews", ) - use_intern_data = BoolProperty( + use_intern_data: BoolProperty( default=True, name="Mat/Tex/...", description="Generate 'internal' previews (materials, textures, images, etc.)", ) - use_trusted = BoolProperty( + use_trusted: BoolProperty( default=False, name="Trusted Blend Files", description="Enable python evaluation for selected files", ) - use_backups = BoolProperty( + use_backups: BoolProperty( default=True, name="Save Backups", description="Keep a backup (.blend1) version of the files when saving with generated previews", @@ -147,56 +147,56 @@ class WM_OT_previews_batch_clear(Operator): # ----------- # File props. - files = CollectionProperty( + files: CollectionProperty( type=bpy.types.OperatorFileListElement, options={'HIDDEN', 'SKIP_SAVE'}, ) - directory = StringProperty( + directory: StringProperty( maxlen=1024, subtype='FILE_PATH', options={'HIDDEN', 'SKIP_SAVE'}, ) # Show only images/videos, and directories! - filter_blender = BoolProperty( + filter_blender: BoolProperty( default=True, options={'HIDDEN', 'SKIP_SAVE'}, ) - filter_folder = BoolProperty( + filter_folder: BoolProperty( default=True, options={'HIDDEN', 'SKIP_SAVE'}, ) # ----------- # Own props. - use_scenes = BoolProperty( + use_scenes: BoolProperty( default=True, name="Scenes", description="Clear scenes' previews", ) - use_collections = BoolProperty( + use_collections: BoolProperty( default=True, name="Collections", description="Clear collections' previews", ) - use_objects = BoolProperty( + use_objects: BoolProperty( default=True, name="Objects", description="Clear objects' previews", ) - use_intern_data = BoolProperty( + use_intern_data: BoolProperty( default=True, name="Mat/Tex/...", description="Clear 'internal' previews (materials, textures, images, etc.)", ) - use_trusted = BoolProperty( + use_trusted: BoolProperty( default=False, name="Trusted Blend Files", description="Enable python evaluation for selected files", ) - use_backups = BoolProperty( + use_backups: BoolProperty( default=True, name="Save Backups", description="Keep a backup (.blend1) version of the files when saving with cleared previews", diff --git a/release/scripts/startup/bl_operators/freestyle.py b/release/scripts/startup/bl_operators/freestyle.py index 88368792b8b..894808de3ed 100644 --- a/release/scripts/startup/bl_operators/freestyle.py +++ b/release/scripts/startup/bl_operators/freestyle.py @@ -34,13 +34,13 @@ class SCENE_OT_freestyle_fill_range_by_selection(bpy.types.Operator): bl_label = "Fill Range by Selection" bl_options = {'INTERNAL'} - type = EnumProperty( + type: EnumProperty( name="Type", description="Type of the modifier to work on", items=(("COLOR", "Color", "Color modifier type"), ("ALPHA", "Alpha", "Alpha modifier type"), ("THICKNESS", "Thickness", "Thickness modifier type")), ) - name = StringProperty( + name: StringProperty( name="Name", description="Name of the modifier to work on", ) @@ -198,9 +198,9 @@ class SCENE_OT_freestyle_module_open(bpy.types.Operator): bl_label = "Open Style Module File" bl_options = {'INTERNAL'} - filepath = StringProperty(subtype='FILE_PATH') + filepath: StringProperty(subtype='FILE_PATH') - make_internal = BoolProperty( + make_internal: BoolProperty( name="Make internal", description="Make module file internal after loading", default=True) diff --git a/release/scripts/startup/bl_operators/image.py b/release/scripts/startup/bl_operators/image.py index 5c5ca329cda..28e5e59d780 100644 --- a/release/scripts/startup/bl_operators/image.py +++ b/release/scripts/startup/bl_operators/image.py @@ -29,7 +29,7 @@ class EditExternally(Operator): bl_label = "Image Edit Externally" bl_options = {'REGISTER'} - filepath = StringProperty( + filepath: StringProperty( subtype='FILE_PATH', ) diff --git a/release/scripts/startup/bl_operators/mesh.py b/release/scripts/startup/bl_operators/mesh.py index f07c1ccb549..a7475dcc6ef 100644 --- a/release/scripts/startup/bl_operators/mesh.py +++ b/release/scripts/startup/bl_operators/mesh.py @@ -33,7 +33,7 @@ class MeshMirrorUV(Operator): bl_label = "Copy Mirrored UV coords" bl_options = {'REGISTER', 'UNDO'} - direction = EnumProperty( + direction: EnumProperty( name="Axis Direction", items=( ('POSITIVE', "Positive", ""), @@ -41,7 +41,7 @@ class MeshMirrorUV(Operator): ), ) - precision = IntProperty( + precision: IntProperty( name="Precision", description=("Tolerance for finding vertex duplicates"), min=1, max=16, diff --git a/release/scripts/startup/bl_operators/node.py b/release/scripts/startup/bl_operators/node.py index bb8f991e526..fbebee2d8a1 100644 --- a/release/scripts/startup/bl_operators/node.py +++ b/release/scripts/startup/bl_operators/node.py @@ -34,7 +34,7 @@ from bpy.props import ( class NodeSetting(PropertyGroup): - value = StringProperty( + value: StringProperty( name="Value", description="Python expression to be evaluated " "as the initial node setting", @@ -45,16 +45,16 @@ class NodeSetting(PropertyGroup): # Base class for node 'Add' operators class NodeAddOperator: - type = StringProperty( + type: StringProperty( name="Node Type", description="Node type", ) - use_transform = BoolProperty( + use_transform: BoolProperty( name="Use Transform", description="Start transform operator after inserting the node", default=False, ) - settings = CollectionProperty( + settings: CollectionProperty( name="Settings", description="Settings to be applied on the newly created node", type=NodeSetting, @@ -152,7 +152,7 @@ class NODE_OT_add_and_link_node(NodeAddOperator, Operator): bl_label = "Add and Link Node" bl_options = {'REGISTER', 'UNDO'} - link_socket_index = IntProperty( + link_socket_index: IntProperty( name="Link Socket Index", description="Index of the socket to link", ) @@ -210,7 +210,7 @@ class NODE_OT_add_search(NodeAddOperator, Operator): return item return None - node_item = EnumProperty( + node_item: EnumProperty( name="Node Type", description="Node type", items=node_enum_items, diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py index fb321463d33..be379ec6089 100644 --- a/release/scripts/startup/bl_operators/object.py +++ b/release/scripts/startup/bl_operators/object.py @@ -35,19 +35,19 @@ class SelectPattern(Operator): bl_label = "Select Pattern" bl_options = {'REGISTER', 'UNDO'} - pattern = StringProperty( + pattern: StringProperty( name="Pattern", description="Name filter using '*', '?' and " "'[abc]' unix style wildcards", maxlen=64, default="*", ) - case_sensitive = BoolProperty( + case_sensitive: BoolProperty( name="Case Sensitive", description="Do a case sensitive compare", default=False, ) - extend = BoolProperty( + extend: BoolProperty( name="Extend", description="Extend the existing selection", default=True, @@ -115,7 +115,7 @@ class SelectCamera(Operator): bl_label = "Select Camera" bl_options = {'REGISTER', 'UNDO'} - extend = BoolProperty( + extend: BoolProperty( name="Extend", description="Extend the selection", default=False @@ -152,15 +152,15 @@ class SelectHierarchy(Operator): bl_label = "Select Hierarchy" bl_options = {'REGISTER', 'UNDO'} - direction = EnumProperty( + direction: EnumProperty( items=(('PARENT', "Parent", ""), ('CHILD', "Child", ""), ), name="Direction", description="Direction to select in the hierarchy", - default='PARENT') - - extend = BoolProperty( + default='PARENT', + ) + extend: BoolProperty( name="Extend", description="Extend the existing selection", default=False, @@ -221,14 +221,13 @@ class SubdivisionSet(Operator): bl_label = "Subdivision Set" bl_options = {'REGISTER', 'UNDO'} - level = IntProperty( + level: IntProperty( name="Level", min=-100, max=100, soft_min=-6, soft_max=6, default=1, ) - - relative = BoolProperty( + relative: BoolProperty( name="Relative", description=("Apply the subsurf level as an offset " "relative to the current level"), @@ -312,7 +311,7 @@ class ShapeTransfer(Operator): bl_label = "Transfer Shape Key" bl_options = {'REGISTER', 'UNDO'} - mode = EnumProperty( + mode: EnumProperty( items=(('OFFSET', "Offset", "Apply the relative positional offset", @@ -330,7 +329,7 @@ class ShapeTransfer(Operator): description="Relative shape positions to the new shape method", default='OFFSET', ) - use_clamp = BoolProperty( + use_clamp: BoolProperty( name="Clamp Offset", description=("Clamp the transformation to the distance each " "vertex moves in the original shape"), @@ -696,7 +695,7 @@ class TransformsToDeltas(Operator): bl_label = "Transforms to Deltas" bl_options = {'REGISTER', 'UNDO'} - mode = EnumProperty( + mode: EnumProperty( items=( ('ALL', "All Transforms", "Transfer location, rotation, and scale transforms"), ('LOC', "Location", "Transfer location transforms only"), @@ -707,7 +706,7 @@ class TransformsToDeltas(Operator): description="Which transforms to transfer", default='ALL', ) - reset_values = BoolProperty( + reset_values: BoolProperty( name="Reset Values", description=("Clear transform values after transferring to deltas"), default=True, diff --git a/release/scripts/startup/bl_operators/object_align.py b/release/scripts/startup/bl_operators/object_align.py index 11c1514e4bf..f627fd30162 100644 --- a/release/scripts/startup/bl_operators/object_align.py +++ b/release/scripts/startup/bl_operators/object_align.py @@ -363,7 +363,7 @@ class AlignObjects(Operator): bl_label = "Align Objects" bl_options = {'REGISTER', 'UNDO'} - bb_quality = BoolProperty( + bb_quality: BoolProperty( name="High Quality", description=( "Enables high quality calculation of the " @@ -372,7 +372,7 @@ class AlignObjects(Operator): ), default=True, ) - align_mode = EnumProperty( + align_mode: EnumProperty( name="Align Mode:", description="Side of object to use for alignment", items=( @@ -382,7 +382,7 @@ class AlignObjects(Operator): ), default='OPT_2', ) - relative_to = EnumProperty( + relative_to: EnumProperty( name="Relative To:", description="Reference location to align to", items=( @@ -393,7 +393,7 @@ class AlignObjects(Operator): ), default='OPT_4', ) - align_axis = EnumProperty( + align_axis: EnumProperty( name="Align", description="Align to axis", items=( diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py b/release/scripts/startup/bl_operators/object_quick_effects.py index f087022b6fd..36dc1b46590 100644 --- a/release/scripts/startup/bl_operators/object_quick_effects.py +++ b/release/scripts/startup/bl_operators/object_quick_effects.py @@ -52,7 +52,7 @@ class QuickFur(Operator): bl_label = "Quick Fur" bl_options = {'REGISTER', 'UNDO'} - density = EnumProperty( + density: EnumProperty( name="Fur Density", items=( ('LIGHT', "Light", ""), @@ -61,13 +61,13 @@ class QuickFur(Operator): ), default='MEDIUM', ) - view_percentage = IntProperty( + view_percentage: IntProperty( name="View %", min=1, max=100, soft_min=1, soft_max=100, default=10, ) - length = FloatProperty( + length: FloatProperty( name="Length", min=0.001, max=100, soft_min=0.01, soft_max=10, @@ -118,7 +118,7 @@ class QuickExplode(Operator): bl_label = "Quick Explode" bl_options = {'REGISTER', 'UNDO'} - style = EnumProperty( + style: EnumProperty( name="Explode Style", items=( ('EXPLODE', "Explode", ""), @@ -126,40 +126,40 @@ class QuickExplode(Operator): ), default='EXPLODE', ) - amount = IntProperty( + amount: IntProperty( name="Amount of pieces", min=2, max=10000, soft_min=2, soft_max=10000, default=100, ) - frame_duration = IntProperty( + frame_duration: IntProperty( name="Duration", min=1, max=300000, soft_min=1, soft_max=10000, default=50, ) - frame_start = IntProperty( + frame_start: IntProperty( name="Start Frame", min=1, max=300000, soft_min=1, soft_max=10000, default=1, ) - frame_end = IntProperty( + frame_end: IntProperty( name="End Frame", min=1, max=300000, soft_min=1, soft_max=10000, default=10, ) - velocity = FloatProperty( + velocity: FloatProperty( name="Outwards Velocity", min=0, max=300000, soft_min=0, soft_max=10, default=1, ) - fade = BoolProperty( + fade: BoolProperty( name="Fade", description="Fade the pieces over time", default=True, @@ -306,7 +306,7 @@ class QuickSmoke(Operator): bl_label = "Quick Smoke" bl_options = {'REGISTER', 'UNDO'} - style = EnumProperty( + style: EnumProperty( name="Smoke Style", items=( ('SMOKE', "Smoke", ""), @@ -316,7 +316,7 @@ class QuickSmoke(Operator): default='SMOKE', ) - show_flows = BoolProperty( + show_flows: BoolProperty( name="Render Smoke Objects", description="Keep the smoke objects visible during rendering", default=False, @@ -410,7 +410,7 @@ class QuickFluid(Operator): bl_label = "Quick Fluid" bl_options = {'REGISTER', 'UNDO'} - style = EnumProperty( + style: EnumProperty( name="Fluid Style", items=( ('INFLOW', "Inflow", ""), @@ -418,19 +418,19 @@ class QuickFluid(Operator): ), default='BASIC', ) - initial_velocity = FloatVectorProperty( + initial_velocity: FloatVectorProperty( name="Initial Velocity", description="Initial velocity of the fluid", min=-100.0, max=100.0, default=(0.0, 0.0, 0.0), subtype='VELOCITY', ) - show_flows = BoolProperty( + show_flows: BoolProperty( name="Render Fluid Objects", description="Keep the fluid objects visible during rendering", default=False, ) - start_baking = BoolProperty( + start_baking: BoolProperty( name="Start Fluid Bake", description=("Start baking the fluid immediately " "after creating the domain object"), diff --git a/release/scripts/startup/bl_operators/object_randomize_transform.py b/release/scripts/startup/bl_operators/object_randomize_transform.py index dbc9461ad5a..6e2dad079ee 100644 --- a/release/scripts/startup/bl_operators/object_randomize_transform.py +++ b/release/scripts/startup/bl_operators/object_randomize_transform.py @@ -103,25 +103,25 @@ class RandomizeLocRotSize(Operator): bl_label = "Randomize Transform" bl_options = {'REGISTER', 'UNDO'} - random_seed = IntProperty( + random_seed: IntProperty( name="Random Seed", description="Seed value for the random generator", min=0, max=10000, default=0, ) - use_delta = BoolProperty( + use_delta: BoolProperty( name="Transform Delta", description=("Randomize delta transform values " "instead of regular transform"), default=False, ) - use_loc = BoolProperty( + use_loc: BoolProperty( name="Randomize Location", description="Randomize the location values", default=True, ) - loc = FloatVectorProperty( + loc: FloatVectorProperty( name="Location", description=("Maximum distance the objects " "can spread over each axis"), @@ -130,12 +130,12 @@ class RandomizeLocRotSize(Operator): default=(0.0, 0.0, 0.0), subtype='TRANSLATION', ) - use_rot = BoolProperty( + use_rot: BoolProperty( name="Randomize Rotation", description="Randomize the rotation values", default=True, ) - rot = FloatVectorProperty( + rot: FloatVectorProperty( name="Rotation", description="Maximum rotation over each axis", min=-3.141592, # math.pi @@ -143,25 +143,25 @@ class RandomizeLocRotSize(Operator): default=(0.0, 0.0, 0.0), subtype='EULER', ) - use_scale = BoolProperty( + use_scale: BoolProperty( name="Randomize Scale", description="Randomize the scale values", default=True, ) - scale_even = BoolProperty( + scale_even: BoolProperty( name="Scale Even", description="Use the same scale value for all axis", default=False, ) - '''scale_min = FloatProperty( + '''scale_min: FloatProperty( name="Minimun Scale Factor", description="Lowest scale percentage possible", min=-1.0, max=1.0, precision=3, default=0.15, )''' - scale = FloatVectorProperty( + scale: FloatVectorProperty( name="Scale", description="Maximum scale randomization over each axis", min=-100.0, diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py index 780183fb713..55e61be6370 100644 --- a/release/scripts/startup/bl_operators/presets.py +++ b/release/scripts/startup/bl_operators/presets.py @@ -41,28 +41,21 @@ class AddPresetBase: # only because invoke_props_popup requires. Also do not add to search menu. bl_options = {'REGISTER', 'INTERNAL'} - name = StringProperty( + name: StringProperty( name="Name", description="Name of the preset, used to make the path name", maxlen=64, options={'SKIP_SAVE'}, ) - remove_name = BoolProperty( + remove_name: BoolProperty( default=False, options={'HIDDEN', 'SKIP_SAVE'}, ) - remove_active = BoolProperty( + remove_active: BoolProperty( default=False, options={'HIDDEN', 'SKIP_SAVE'}, ) - # needed for mix-ins - order = [ - "name", - "remove_name", - "remove_active", - ] - @staticmethod def as_filename(name): # could reuse for other presets @@ -225,11 +218,11 @@ class ExecutePreset(Operator): bl_idname = "script.execute_preset" bl_label = "Execute a Python Preset" - filepath = StringProperty( + filepath: StringProperty( subtype='FILE_PATH', options={'SKIP_SAVE'}, ) - menu_idname = StringProperty( + menu_idname: StringProperty( name="Menu ID Name", description="ID name of the menu this was called from", options={'SKIP_SAVE'}, @@ -264,7 +257,7 @@ class PresetMenu(Panel): bl_space_type = 'PROPERTIES' bl_region_type = 'HEADER' bl_label = "Presets" - path_menu = Menu.path_menu + path_menu: Menu.path_menu @classmethod def draw_panel_header(cls, layout): @@ -333,7 +326,7 @@ class AddPresetCamera(AddPresetBase, Operator): preset_subdir = "camera" - use_focal_length = BoolProperty( + use_focal_length: BoolProperty( name="Include Focal Length", description="Include focal length into the preset", options={'SKIP_SAVE'}, @@ -480,7 +473,7 @@ class AddPresetTrackingCamera(AddPresetBase, Operator): preset_subdir = "tracking_camera" - use_focal_length = BoolProperty( + use_focal_length: BoolProperty( name="Include Focal Length", description="Include focal length into the preset", options={'SKIP_SAVE'}, @@ -605,7 +598,7 @@ class AddPresetOperator(AddPresetBase, Operator): bl_label = "Operator Preset" preset_menu = "WM_MT_operator_presets" - operator = StringProperty( + operator: StringProperty( name="Operator", maxlen=64, options={'HIDDEN', 'SKIP_SAVE'}, diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py index 9fa8188e946..36150a63895 100644 --- a/release/scripts/startup/bl_operators/rigidbody.py +++ b/release/scripts/startup/bl_operators/rigidbody.py @@ -92,19 +92,19 @@ class BakeToKeyframes(Operator): bl_label = "Bake To Keyframes" bl_options = {'REGISTER', 'UNDO'} - frame_start = IntProperty( + frame_start: IntProperty( name="Start Frame", description="Start frame for baking", min=0, max=300000, default=1, ) - frame_end = IntProperty( + frame_end: IntProperty( name="End Frame", description="End frame for baking", min=1, max=300000, default=250, ) - step = IntProperty( + step: IntProperty( name="Frame Step", description="Frame Step", min=1, max=120, @@ -216,7 +216,7 @@ class ConnectRigidBodies(Operator): bl_label = "Connect Rigid Bodies" bl_options = {'REGISTER', 'UNDO'} - con_type = EnumProperty( + con_type: EnumProperty( name="Type", description="Type of generated constraint", # XXX Would be nice to get icons too, but currently not possible ;) @@ -226,7 +226,7 @@ class ConnectRigidBodies(Operator): ), default='FIXED', ) - pivot_type = EnumProperty( + pivot_type: EnumProperty( name="Location", description="Constraint pivot location", items=( @@ -236,7 +236,7 @@ class ConnectRigidBodies(Operator): ), default='CENTER', ) - connection_pattern = EnumProperty( + connection_pattern: EnumProperty( name="Connection Pattern", description="Pattern used to connect objects", items=( diff --git a/release/scripts/startup/bl_operators/sequencer.py b/release/scripts/startup/bl_operators/sequencer.py index c9a7aa93805..b1152157cf8 100644 --- a/release/scripts/startup/bl_operators/sequencer.py +++ b/release/scripts/startup/bl_operators/sequencer.py @@ -82,7 +82,7 @@ class SequencerCutMulticam(Operator): bl_label = "Cut multicam" bl_options = {'REGISTER', 'UNDO'} - camera = IntProperty( + camera: IntProperty( name="Camera", min=1, max=32, soft_min=1, soft_max=32, diff --git a/release/scripts/startup/bl_operators/uvcalc_follow_active.py b/release/scripts/startup/bl_operators/uvcalc_follow_active.py index 7620b354a08..5c870849cc5 100644 --- a/release/scripts/startup/bl_operators/uvcalc_follow_active.py +++ b/release/scripts/startup/bl_operators/uvcalc_follow_active.py @@ -226,7 +226,7 @@ class FollowActiveQuads(Operator): bl_label = "Follow Active Quads" bl_options = {'REGISTER', 'UNDO'} - mode = bpy.props.EnumProperty( + mode: bpy.props.EnumProperty( name="Edge Length Mode", description="Method to space UV edge loops", items=(('EVEN', "Even", "Space all UVs evenly"), diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py index 0d5bc3136a5..95a3d18304b 100644 --- a/release/scripts/startup/bl_operators/uvcalc_lightmap.py +++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py @@ -616,7 +616,7 @@ class LightMapPack(Operator): # This fixes infinite image creation reported there [#30968] (sergey) bl_options = {'UNDO'} - PREF_CONTEXT = bpy.props.EnumProperty( + PREF_CONTEXT: bpy.props.EnumProperty( name="Selection", items=( ('SEL_FACES', "Selected Faces", "Space all UVs evenly"), @@ -626,7 +626,7 @@ class LightMapPack(Operator): ) # Image & UVs... - PREF_PACK_IN_ONE = BoolProperty( + PREF_PACK_IN_ONE: BoolProperty( name="Share Tex Space", description=( "Objects Share texture space, map all objects " @@ -634,12 +634,12 @@ class LightMapPack(Operator): ), default=True, ) - PREF_NEW_UVLAYER = BoolProperty( + PREF_NEW_UVLAYER: BoolProperty( name="New UV Map", description="Create a new UV map for every mesh packed", default=False, ) - PREF_APPLY_IMAGE = BoolProperty( + PREF_APPLY_IMAGE: BoolProperty( name="New Image", description=( "Assign new images for every mesh (only one if " @@ -647,20 +647,20 @@ class LightMapPack(Operator): ), default=False, ) - PREF_IMG_PX_SIZE = IntProperty( + PREF_IMG_PX_SIZE: IntProperty( name="Image Size", description="Width and Height for the new image", min=64, max=5000, default=512, ) # UV Packing... - PREF_BOX_DIV = IntProperty( + PREF_BOX_DIV: IntProperty( name="Pack Quality", description="Pre Packing before the complex boxpack", min=1, max=48, default=12, ) - PREF_MARGIN_DIV = FloatProperty( + PREF_MARGIN_DIV: FloatProperty( name="Margin", description="Size of the margin as a division of the UV", min=0.001, max=1.0, diff --git a/release/scripts/startup/bl_operators/uvcalc_smart_project.py b/release/scripts/startup/bl_operators/uvcalc_smart_project.py index aebc0ae0313..fe15b9fa345 100644 --- a/release/scripts/startup/bl_operators/uvcalc_smart_project.py +++ b/release/scripts/startup/bl_operators/uvcalc_smart_project.py @@ -1055,31 +1055,31 @@ class SmartProject(Operator): bl_label = "Smart UV Project" bl_options = {'REGISTER', 'UNDO'} - angle_limit = FloatProperty( + angle_limit: FloatProperty( name="Angle Limit", description="Lower for more projection groups, higher for less distortion", min=1.0, max=89.0, default=66.0, ) - island_margin = FloatProperty( + island_margin: FloatProperty( name="Island Margin", description="Margin to reduce bleed from adjacent islands", unit='LENGTH', subtype='DISTANCE', min=0.0, max=1.0, default=0.0, ) - user_area_weight = FloatProperty( + user_area_weight: FloatProperty( name="Area Weight", description="Weight projections vector by faces with larger areas", min=0.0, max=1.0, default=0.0, ) - use_aspect = BoolProperty( + use_aspect: BoolProperty( name="Correct Aspect", description="Map UVs taking image aspect ratio into account", default=True ) - stretch_to_bounds = BoolProperty( + stretch_to_bounds: BoolProperty( name="Stretch to UV Bounds", description="Stretch the final output to texture bounds", default=True, diff --git a/release/scripts/startup/bl_operators/vertexpaint_dirt.py b/release/scripts/startup/bl_operators/vertexpaint_dirt.py index 1173e0047bb..335c3d8bbda 100644 --- a/release/scripts/startup/bl_operators/vertexpaint_dirt.py +++ b/release/scripts/startup/bl_operators/vertexpaint_dirt.py @@ -138,33 +138,33 @@ class VertexPaintDirt(Operator): bl_label = "Dirty Vertex Colors" bl_options = {'REGISTER', 'UNDO'} - blur_strength = FloatProperty( + blur_strength: FloatProperty( name="Blur Strength", description="Blur strength per iteration", min=0.01, max=1.0, default=1.0, ) - blur_iterations = IntProperty( + blur_iterations: IntProperty( name="Blur Iterations", description="Number of times to blur the colors (higher blurs more)", min=0, max=40, default=1, ) - clean_angle = FloatProperty( + clean_angle: FloatProperty( name="Highlight Angle", description="Less than 90 limits the angle used in the tonal range", min=0.0, max=pi, default=pi, unit="ROTATION", ) - dirt_angle = FloatProperty( + dirt_angle: FloatProperty( name="Dirt Angle", description="Less than 90 limits the angle used in the tonal range", min=0.0, max=pi, default=0.0, unit="ROTATION", ) - dirt_only = BoolProperty( + dirt_only: BoolProperty( name="Dirt Only", description="Don't calculate cleans for convex areas", default=False, diff --git a/release/scripts/startup/bl_operators/view3d.py b/release/scripts/startup/bl_operators/view3d.py index f56c83be7d1..b43f4446802 100644 --- a/release/scripts/startup/bl_operators/view3d.py +++ b/release/scripts/startup/bl_operators/view3d.py @@ -143,37 +143,37 @@ class VIEW3D_OT_select_or_deselect_all(Operator): bl_idname = "view3d.select_or_deselect_all" bl_options = {'UNDO'} - extend = BoolProperty( + extend: BoolProperty( name="Extend", description="Extend selection instead of deselecting everything first", default=False, ) - toggle = BoolProperty( + toggle: BoolProperty( name="Toggle", description="Toggle the selection", default=False, ) - deselect = BoolProperty( + deselect: BoolProperty( name="Deselect", description="Remove from selection", default=False, ) - center = BoolProperty( + center: BoolProperty( name="Center", description="Use the object center when selecting, in editmode used to extend object selection", default=False, ) - enumerate = BoolProperty( + enumerate: BoolProperty( name="Enumerate", description="List objects under the mouse (object mode only)", default=False, ) - object = BoolProperty( + object: BoolProperty( name="Object", description="Use object selection (editmode only)", default=False, diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index a01298f5696..fe367973323 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -162,12 +162,12 @@ class BRUSH_OT_active_index_set(Operator): bl_idname = "brush.active_index_set" bl_label = "Set Brush Number" - mode = StringProperty( + mode: StringProperty( name="Mode", description="Paint mode to set brush for", maxlen=1024, ) - index = IntProperty( + index: IntProperty( name="Number", description="Brush number", ) @@ -199,8 +199,8 @@ class WM_OT_context_set_boolean(Operator): bl_label = "Context Set Boolean" bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path_prop - value = BoolProperty( + data_path: rna_path_prop + value: BoolProperty( name="Value", description="Assignment value", default=True, @@ -215,13 +215,13 @@ class WM_OT_context_set_int(Operator): # same as enum bl_label = "Context Set" bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path_prop - value = IntProperty( + data_path: rna_path_prop + value: IntProperty( name="Value", description="Assign value", default=0, ) - relative = rna_relative_prop + relative: rna_relative_prop execute = execute_context_assign @@ -232,8 +232,8 @@ class WM_OT_context_scale_float(Operator): bl_label = "Context Scale Float" bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path_prop - value = FloatProperty( + data_path: rna_path_prop + value: FloatProperty( name="Value", description="Assign value", default=1.0, @@ -260,13 +260,13 @@ class WM_OT_context_scale_int(Operator): bl_label = "Context Scale Int" bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path_prop - value = FloatProperty( + data_path: rna_path_prop + value: FloatProperty( name="Value", description="Assign value", default=1.0, ) - always_step = BoolProperty( + always_step: BoolProperty( name="Always Step", description="Always adjust the value by a minimum of 1 when 'value' is not 1.0", default=True, @@ -303,13 +303,13 @@ class WM_OT_context_set_float(Operator): # same as enum bl_label = "Context Set Float" bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path_prop - value = FloatProperty( + data_path: rna_path_prop + value: FloatProperty( name="Value", description="Assignment value", default=0.0, ) - relative = rna_relative_prop + relative: rna_relative_prop execute = execute_context_assign @@ -320,8 +320,8 @@ class WM_OT_context_set_string(Operator): # same as enum bl_label = "Context Set String" bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path_prop - value = StringProperty( + data_path: rna_path_prop + value: StringProperty( name="Value", description="Assign value", maxlen=1024, @@ -336,8 +336,8 @@ class WM_OT_context_set_enum(Operator): bl_label = "Context Set Enum" bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path_prop - value = StringProperty( + data_path: rna_path_prop + value: StringProperty( name="Value", description="Assignment value (as a string)", maxlen=1024, @@ -352,8 +352,8 @@ class WM_OT_context_set_value(Operator): bl_label = "Context Set Value" bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path_prop - value = StringProperty( + data_path: rna_path_prop + value: StringProperty( name="Value", description="Assignment value (as a string)", maxlen=1024, @@ -373,7 +373,7 @@ class WM_OT_context_toggle(Operator): bl_label = "Context Toggle" bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path_prop + data_path: rna_path_prop def execute(self, context): data_path = self.data_path @@ -392,13 +392,13 @@ class WM_OT_context_toggle_enum(Operator): bl_label = "Context Toggle Values" bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path_prop - value_1 = StringProperty( + data_path: rna_path_prop + value_1: StringProperty( name="Value", description="Toggle enum", maxlen=1024, ) - value_2 = StringProperty( + value_2: StringProperty( name="Value", description="Toggle enum", maxlen=1024, @@ -431,9 +431,9 @@ class WM_OT_context_cycle_int(Operator): bl_label = "Context Int Cycle" bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path_prop - reverse = rna_reverse_prop - wrap = rna_wrap_prop + data_path: rna_path_prop + reverse: rna_reverse_prop + wrap: rna_wrap_prop def execute(self, context): data_path = self.data_path @@ -467,9 +467,9 @@ class WM_OT_context_cycle_enum(Operator): bl_label = "Context Enum Cycle" bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path_prop - reverse = rna_reverse_prop - wrap = rna_wrap_prop + data_path: rna_path_prop + reverse: rna_reverse_prop + wrap: rna_wrap_prop def execute(self, context): data_path = self.data_path @@ -524,8 +524,8 @@ class WM_OT_context_cycle_array(Operator): bl_label = "Context Array Cycle" bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path_prop - reverse = rna_reverse_prop + data_path: rna_path_prop + reverse: rna_reverse_prop def execute(self, context): data_path = self.data_path @@ -549,7 +549,8 @@ class WM_OT_context_menu_enum(Operator): bl_idname = "wm.context_menu_enum" bl_label = "Context Enum Menu" bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path_prop + + data_path: rna_path_prop def execute(self, context): data_path = self.data_path @@ -575,7 +576,8 @@ class WM_OT_context_pie_enum(Operator): bl_idname = "wm.context_pie_enum" bl_label = "Context Enum Pie" bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path_prop + + data_path: rna_path_prop def invoke(self, context, event): wm = context.window_manager @@ -602,12 +604,13 @@ class WM_OT_operator_pie_enum(Operator): bl_idname = "wm.operator_pie_enum" bl_label = "Operator Enum Pie" bl_options = {'UNDO', 'INTERNAL'} - data_path = StringProperty( + + data_path: StringProperty( name="Operator", description="Operator name (in python as string)", maxlen=1024, ) - prop_string = StringProperty( + prop_string: StringProperty( name="Property", description="Property name (as a string)", maxlen=1024, @@ -646,8 +649,8 @@ class WM_OT_context_set_id(Operator): bl_label = "Set Library ID" bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path_prop - value = StringProperty( + data_path: rna_path_prop + value: StringProperty( name="Value", description="Assign value", maxlen=1024, @@ -697,10 +700,10 @@ class WM_OT_context_collection_boolean_set(Operator): bl_label = "Context Collection Boolean Set" bl_options = {'UNDO', 'REGISTER', 'INTERNAL'} - data_path_iter = data_path_iter - data_path_item = data_path_item + data_path_iter: data_path_iter + data_path_item: data_path_item - type = EnumProperty( + type: EnumProperty( name="Type", items=(('TOGGLE', "Toggle", ""), ('ENABLE', "Enable", ""), @@ -756,22 +759,22 @@ class WM_OT_context_modal_mouse(Operator): bl_label = "Context Modal Mouse" bl_options = {'GRAB_CURSOR', 'BLOCKING', 'UNDO', 'INTERNAL'} - data_path_iter = data_path_iter - data_path_item = data_path_item - header_text = StringProperty( + data_path_iter: data_path_iter + data_path_item: data_path_item + header_text: StringProperty( name="Header Text", description="Text to display in header during scale", ) - input_scale = FloatProperty( + input_scale: FloatProperty( description="Scale the mouse movement by this value before applying the delta", default=0.01, ) - invert = BoolProperty( + invert: BoolProperty( description="Invert the mouse input", default=False, ) - initial_x = IntProperty(options={'HIDDEN'}) + initial_x: IntProperty(options={'HIDDEN'}) def _values_store(self, context): data_path_iter = self.data_path_iter @@ -864,7 +867,7 @@ class WM_OT_url_open(Operator): bl_label = "" bl_options = {'INTERNAL'} - url = StringProperty( + url: StringProperty( name="URL", description="URL to open", ) @@ -881,7 +884,7 @@ class WM_OT_path_open(Operator): bl_label = "" bl_options = {'INTERNAL'} - filepath = StringProperty( + filepath: StringProperty( subtype='FILE_PATH', options={'SKIP_SAVE'}, ) @@ -996,7 +999,7 @@ class WM_OT_doc_view_manual(Operator): bl_idname = "wm.doc_view_manual" bl_label = "View Manual" - doc_id = doc_id + doc_id: doc_id @staticmethod def _find_reference(rna_id, url_mapping, verbose=True): @@ -1050,7 +1053,7 @@ class WM_OT_doc_view(Operator): bl_idname = "wm.doc_view" bl_label = "View Documentation" - doc_id = doc_id + doc_id: doc_id if bpy.app.version_cycle == "release": _prefix = ("https://docs.blender.org/api/blender_python_api_current") else: @@ -1114,16 +1117,16 @@ class WM_OT_properties_edit(Operator): # register only because invoke_props_popup requires. bl_options = {'REGISTER', 'INTERNAL'} - data_path = rna_path - property = rna_property - value = rna_value - min = rna_min - max = rna_max - use_soft_limits = rna_use_soft_limits - is_overridable_static = rna_is_overridable_static - soft_min = rna_min - soft_max = rna_max - description = StringProperty( + data_path: rna_path + property: rna_property + value: rna_value + min: rna_min + max: rna_max + use_soft_limits: rna_use_soft_limits + is_overridable_static: rna_is_overridable_static + soft_min: rna_min + soft_max: rna_max + description: StringProperty( name="Tooltip", ) @@ -1319,7 +1322,7 @@ class WM_OT_properties_add(Operator): bl_label = "Add Property" bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path + data_path: rna_path def execute(self, context): from rna_prop_ui import ( @@ -1362,7 +1365,7 @@ class WM_OT_properties_context_change(Operator): bl_label = "" bl_options = {'INTERNAL'} - context = StringProperty( + context: StringProperty( name="Context", maxlen=64, ) @@ -1378,8 +1381,8 @@ class WM_OT_properties_remove(Operator): bl_label = "Remove Property" bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path - property = rna_property + data_path: rna_path + property: rna_property def execute(self, context): from rna_prop_ui import ( @@ -1400,7 +1403,7 @@ class WM_OT_keyconfig_activate(Operator): bl_idname = "wm.keyconfig_activate" bl_label = "Activate Keyconfig" - filepath = StringProperty( + filepath: StringProperty( subtype='FILE_PATH', ) @@ -1435,7 +1438,7 @@ class WM_OT_appconfig_activate(Operator): bl_idname = "wm.appconfig_activate" bl_label = "Activate Application Configuration" - filepath = StringProperty( + filepath: StringProperty( subtype='FILE_PATH', ) @@ -1460,7 +1463,7 @@ class WM_OT_sysinfo(Operator): bl_idname = "wm.sysinfo" bl_label = "Save System Info" - filepath = StringProperty( + filepath: StringProperty( subtype='FILE_PATH', options={'SKIP_SAVE'}, ) @@ -1538,26 +1541,26 @@ class WM_OT_keyconfig_import(Operator): bl_idname = "wm.keyconfig_import" bl_label = "Import Key Configuration..." - filepath = StringProperty( + filepath: StringProperty( subtype='FILE_PATH', default="keymap.py", ) - filter_folder = BoolProperty( + filter_folder: BoolProperty( name="Filter folders", default=True, options={'HIDDEN'}, ) - filter_text = BoolProperty( + filter_text: BoolProperty( name="Filter text", default=True, options={'HIDDEN'}, ) - filter_python = BoolProperty( + filter_python: BoolProperty( name="Filter python", default=True, options={'HIDDEN'}, ) - keep_original = BoolProperty( + keep_original: BoolProperty( name="Keep original", description="Keep original file after copying to configuration folder", default=True, @@ -1605,21 +1608,21 @@ class WM_OT_keyconfig_export(Operator): bl_idname = "wm.keyconfig_export" bl_label = "Export Key Configuration..." - filepath = StringProperty( + filepath: StringProperty( subtype='FILE_PATH', default="keymap.py", ) - filter_folder = BoolProperty( + filter_folder: BoolProperty( name="Filter folders", default=True, options={'HIDDEN'}, ) - filter_text = BoolProperty( + filter_text: BoolProperty( name="Filter text", default=True, options={'HIDDEN'}, ) - filter_python = BoolProperty( + filter_python: BoolProperty( name="Filter python", default=True, options={'HIDDEN'}, @@ -1655,7 +1658,7 @@ class WM_OT_keymap_restore(Operator): bl_idname = "wm.keymap_restore" bl_label = "Restore Key Map(s)" - all = BoolProperty( + all: BoolProperty( name="All Keymaps", description="Restore all keymaps to default", ) @@ -1678,7 +1681,7 @@ class WM_OT_keyitem_restore(Operator): bl_idname = "wm.keyitem_restore" bl_label = "Restore Key Map Item" - item_id = IntProperty( + item_id: IntProperty( name="Item Identifier", description="Identifier of the item to remove", ) @@ -1725,7 +1728,7 @@ class WM_OT_keyitem_remove(Operator): bl_idname = "wm.keyitem_remove" bl_label = "Remove Key Map Item" - item_id = IntProperty( + item_id: IntProperty( name="Item Identifier", description="Identifier of the item to remove", ) @@ -1793,7 +1796,7 @@ class WM_OT_addon_enable(Operator): bl_idname = "wm.addon_enable" bl_label = "Enable Add-on" - module = StringProperty( + module: StringProperty( name="Module", description="Module name of the add-on to enable", ) @@ -1839,7 +1842,7 @@ class WM_OT_addon_disable(Operator): bl_idname = "wm.addon_disable" bl_label = "Disable Add-on" - module = StringProperty( + module: StringProperty( name="Module", description="Module name of the add-on to disable", ) @@ -1868,7 +1871,7 @@ class WM_OT_owner_enable(Operator): bl_idname = "wm.owner_enable" bl_label = "Enable Add-on" - owner_id = StringProperty( + owner_id: StringProperty( name="UI Tag", ) @@ -1883,7 +1886,7 @@ class WM_OT_owner_disable(Operator): bl_idname = "wm.owner_disable" bl_label = "Disable UI Tag" - owner_id = StringProperty( + owner_id: StringProperty( name="UI Tag", ) @@ -1899,20 +1902,20 @@ class WM_OT_theme_install(Operator): bl_idname = "wm.theme_install" bl_label = "Install Theme..." - overwrite = BoolProperty( + overwrite: BoolProperty( name="Overwrite", description="Remove existing theme file if exists", default=True, ) - filepath = StringProperty( + filepath: StringProperty( subtype='FILE_PATH', ) - filter_folder = BoolProperty( + filter_folder: BoolProperty( name="Filter folders", default=True, options={'HIDDEN'}, ) - filter_glob = StringProperty( + filter_glob: StringProperty( default="*.xml", options={'HIDDEN'}, ) @@ -1976,31 +1979,31 @@ class WM_OT_addon_install(Operator): bl_idname = "wm.addon_install" bl_label = "Install Add-on from File..." - overwrite = BoolProperty( + overwrite: BoolProperty( name="Overwrite", description="Remove existing add-ons with the same ID", default=True, ) - target = EnumProperty( + target: EnumProperty( name="Target Path", items=(('DEFAULT', "Default", ""), ('PREFS', "User Prefs", "")), ) - filepath = StringProperty( + filepath: StringProperty( subtype='FILE_PATH', ) - filter_folder = BoolProperty( + filter_folder: BoolProperty( name="Filter folders", default=True, options={'HIDDEN'}, ) - filter_python = BoolProperty( + filter_python: BoolProperty( name="Filter python", default=True, options={'HIDDEN'}, ) - filter_glob = StringProperty( + filter_glob: StringProperty( default="*.py;*.zip", options={'HIDDEN'}, ) @@ -2130,7 +2133,7 @@ class WM_OT_addon_remove(Operator): bl_idname = "wm.addon_remove" bl_label = "Remove Add-on" - module = StringProperty( + module: StringProperty( name="Module", description="Module name of the add-on to remove", ) @@ -2190,7 +2193,7 @@ class WM_OT_addon_expand(Operator): bl_label = "" bl_options = {'INTERNAL'} - module = StringProperty( + module: StringProperty( name="Module", description="Module name of the add-on to expand", ) @@ -2214,7 +2217,7 @@ class WM_OT_addon_userpref_show(Operator): bl_label = "" bl_options = {'INTERNAL'} - module = StringProperty( + module: StringProperty( name="Module", description="Module name of the add-on to expand", ) @@ -2245,21 +2248,21 @@ class WM_OT_app_template_install(Operator): bl_idname = "wm.app_template_install" bl_label = "Install Template from File..." - overwrite = BoolProperty( + overwrite: BoolProperty( name="Overwrite", description="Remove existing template with the same ID", default=True, ) - filepath = StringProperty( + filepath: StringProperty( subtype='FILE_PATH', ) - filter_folder = BoolProperty( + filter_folder: BoolProperty( name="Filter folders", default=True, options={'HIDDEN'}, ) - filter_glob = StringProperty( + filter_glob: StringProperty( default="*.zip", options={'HIDDEN'}, ) @@ -2344,19 +2347,18 @@ class WM_OT_tool_set_by_name(Operator): bl_idname = "wm.tool_set_by_name" bl_label = "Set Tool By Name" - name = StringProperty( + name: StringProperty( name="Text", description="Display name of the tool", ) - - cycle = BoolProperty( + cycle: BoolProperty( name="Cycle", description="Cycle through tools in this group", default=False, options={'SKIP_SAVE'}, ) - space_type = rna_space_type_prop + space_type: rna_space_type_prop def execute(self, context): from bl_ui.space_toolsystem_common import ( @@ -2414,23 +2416,23 @@ class WM_OT_studiolight_install(Operator): bl_idname = "wm.studiolight_install" bl_label = "Install Custom Studio Light" - files = CollectionProperty( + files: CollectionProperty( name="File Path", type=OperatorFileListElement, ) - directory = StringProperty( + directory: StringProperty( subtype='DIR_PATH', ) - filter_folder = BoolProperty( + filter_folder: BoolProperty( name="Filter folders", default=True, options={'HIDDEN'}, ) - filter_glob = StringProperty( + filter_glob: StringProperty( default="*.png;*.jpg;*.hdr;*.exr", options={'HIDDEN'}, ) - orientation = EnumProperty( + orientation: EnumProperty( items=( ("MATCAP", "MatCap", ""), ("WORLD", "World", ""), @@ -2480,7 +2482,7 @@ class WM_OT_studiolight_install(Operator): class WM_OT_studiolight_uninstall(Operator): bl_idname = 'wm.studiolight_uninstall' bl_label = "Uninstall Studio Light" - index = bpy.props.IntProperty() + index: bpy.props.IntProperty() def _remove_path(self, path): if path.exists(): diff --git a/release/scripts/templates_py/addon_add_object.py b/release/scripts/templates_py/addon_add_object.py index b74c0f8ee25..d26f3d351bf 100644 --- a/release/scripts/templates_py/addon_add_object.py +++ b/release/scripts/templates_py/addon_add_object.py @@ -45,7 +45,7 @@ class OBJECT_OT_add_object(Operator, AddObjectHelper): bl_label = "Add Mesh Object" bl_options = {'REGISTER', 'UNDO'} - scale = FloatVectorProperty( + scale: FloatVectorProperty( name="scale", default=(1.0, 1.0, 1.0), subtype='TRANSLATION', diff --git a/release/scripts/templates_py/custom_nodes.py b/release/scripts/templates_py/custom_nodes.py index 23d8ee55e72..7e4e89dafeb 100644 --- a/release/scripts/templates_py/custom_nodes.py +++ b/release/scripts/templates_py/custom_nodes.py @@ -30,10 +30,15 @@ class MyCustomSocket(NodeSocket): ('DOWN', "Down", "Where your feet are"), ('UP', "Up", "Where your head should be"), ('LEFT', "Left", "Not right"), - ('RIGHT', "Right", "Not left") + ('RIGHT', "Right", "Not left"), ) - my_enum_prop = bpy.props.EnumProperty(name="Direction", description="Just an example", items=my_items, default='UP') + my_enum_prop: bpy.props.EnumProperty( + name="Direction", + description="Just an example", + items=my_items, + default='UP', + ) # Optional function for drawing the socket input value def draw(self, context, layout, node, text): @@ -71,8 +76,8 @@ class MyCustomNode(Node, MyCustomTreeNode): # These work just like custom properties in ID data blocks # Extensive information can be found under # http://wiki.blender.org/index.php/Doc:2.6/Manual/Extensions/Python/Properties - my_string_prop = bpy.props.StringProperty() - my_float_prop = bpy.props.FloatProperty(default=3.1415926) + my_string_prop: bpy.props.StringProperty() + my_float_prop: bpy.props.FloatProperty(default=3.1415926) # === Optional Functions === # Initialization function, called when a new node is created. diff --git a/release/scripts/templates_py/manipulator_operator.py b/release/scripts/templates_py/manipulator_operator.py index 35e1c5b4fd1..61796489a95 100644 --- a/release/scripts/templates_py/manipulator_operator.py +++ b/release/scripts/templates_py/manipulator_operator.py @@ -39,11 +39,11 @@ class SelectSideOfPlane(Operator): bl_label = "Select Side of Plane" bl_options = {'REGISTER', 'UNDO'} - plane_co = FloatVectorProperty( + plane_co: FloatVectorProperty( size=3, default=(0, 0, 0), ) - plane_no = FloatVectorProperty( + plane_no: FloatVectorProperty( size=3, default=(0, 0, 1), ) diff --git a/release/scripts/templates_py/operator_file_export.py b/release/scripts/templates_py/operator_file_export.py index 8a1eb4ae54c..4ea817d3507 100644 --- a/release/scripts/templates_py/operator_file_export.py +++ b/release/scripts/templates_py/operator_file_export.py @@ -25,7 +25,7 @@ class ExportSomeData(Operator, ExportHelper): # ExportHelper mixin class uses this filename_ext = ".txt" - filter_glob = StringProperty( + filter_glob: StringProperty( default="*.txt", options={'HIDDEN'}, maxlen=255, # Max internal buffer length, longer would be clamped. @@ -33,13 +33,13 @@ class ExportSomeData(Operator, ExportHelper): # List of operator properties, the attributes will be assigned # to the class instance from the operator settings before calling. - use_setting = BoolProperty( + use_setting: BoolProperty( name="Example Boolean", description="Example Tooltip", default=True, ) - type = EnumProperty( + type: EnumProperty( name="Example Enum", description="Choose between two items", items=( diff --git a/release/scripts/templates_py/operator_file_import.py b/release/scripts/templates_py/operator_file_import.py index 9856b6a9040..b932b008c49 100644 --- a/release/scripts/templates_py/operator_file_import.py +++ b/release/scripts/templates_py/operator_file_import.py @@ -28,7 +28,7 @@ class ImportSomeData(Operator, ImportHelper): # ImportHelper mixin class uses this filename_ext = ".txt" - filter_glob = StringProperty( + filter_glob: StringProperty( default="*.txt", options={'HIDDEN'}, maxlen=255, # Max internal buffer length, longer would be clamped. @@ -36,13 +36,13 @@ class ImportSomeData(Operator, ImportHelper): # List of operator properties, the attributes will be assigned # to the class instance from the operator settings before calling. - use_setting = BoolProperty( + use_setting: BoolProperty( name="Example Boolean", description="Example Tooltip", default=True, ) - type = EnumProperty( + type: EnumProperty( name="Example Enum", description="Choose between two items", items=( diff --git a/release/scripts/templates_py/operator_mesh_add.py b/release/scripts/templates_py/operator_mesh_add.py index 407956a0fda..6b39ef7bbba 100644 --- a/release/scripts/templates_py/operator_mesh_add.py +++ b/release/scripts/templates_py/operator_mesh_add.py @@ -49,25 +49,25 @@ class AddBox(bpy.types.Operator): bl_label = "Add Box" bl_options = {'REGISTER', 'UNDO'} - width = FloatProperty( + width: FloatProperty( name="Width", description="Box Width", min=0.01, max=100.0, default=1.0, ) - height = FloatProperty( + height: FloatProperty( name="Height", description="Box Height", min=0.01, max=100.0, default=1.0, ) - depth = FloatProperty( + depth: FloatProperty( name="Depth", description="Box Depth", min=0.01, max=100.0, default=1.0, ) - layers = BoolVectorProperty( + layers: BoolVectorProperty( name="Layers", description="Object Layers", size=20, @@ -75,15 +75,15 @@ class AddBox(bpy.types.Operator): ) # generic transform props - view_align = BoolProperty( + view_align: BoolProperty( name="Align to View", default=False, ) - location = FloatVectorProperty( + location: FloatVectorProperty( name="Location", subtype='TRANSLATION', ) - rotation = FloatVectorProperty( + rotation: FloatVectorProperty( name="Rotation", subtype='EULER', ) diff --git a/release/scripts/templates_py/operator_modal.py b/release/scripts/templates_py/operator_modal.py index 88e5ee80590..c242e3b67b9 100644 --- a/release/scripts/templates_py/operator_modal.py +++ b/release/scripts/templates_py/operator_modal.py @@ -7,8 +7,8 @@ class ModalOperator(bpy.types.Operator): bl_idname = "object.modal_operator" bl_label = "Simple Modal Operator" - first_mouse_x = IntProperty() - first_value = FloatProperty() + first_mouse_x: IntProperty() + first_value: FloatProperty() def modal(self, context, event): if event.type == 'MOUSEMOVE': diff --git a/release/scripts/templates_py/operator_modal_view3d.py b/release/scripts/templates_py/operator_modal_view3d.py index 65bab3489b4..9d371446829 100644 --- a/release/scripts/templates_py/operator_modal_view3d.py +++ b/release/scripts/templates_py/operator_modal_view3d.py @@ -8,7 +8,7 @@ class ViewOperator(bpy.types.Operator): bl_idname = "view3d.modal_operator" bl_label = "Simple View Operator" - offset = FloatVectorProperty( + offset: FloatVectorProperty( name="Offset", size=3, ) diff --git a/release/scripts/templates_py/ui_list.py b/release/scripts/templates_py/ui_list.py index 92e1b29d2ae..f6b82356a78 100644 --- a/release/scripts/templates_py/ui_list.py +++ b/release/scripts/templates_py/ui_list.py @@ -7,8 +7,10 @@ class MESH_UL_mylist(bpy.types.UIList): # E.g. VGROUP_EMPTY = 1 << 0 # Custom properties, saved with .blend file. E.g. - # use_filter_empty = bpy.props.BoolProperty(name="Filter Empty", default=False, options=set(), - # description="Whether to filter empty vertex groups") + # use_filter_empty: bpy.props.BoolProperty( + # name="Filter Empty", default=False, options=set(), + # description="Whether to filter empty vertex groups", + # ) # Called for each drawn item. def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index, flt_flag): -- cgit v1.2.3